index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="盘点工单"
  8. @clickLeft="back"
  9. ></uni-nav-bar>
  10. <template>
  11. <view class="tab-title">
  12. <view
  13. v-for="(item, index) in tabList"
  14. :key="index"
  15. class="tab-item"
  16. v-text="item.label"
  17. :class="index === pickTabIndex ? 'active' : ''"
  18. @click="changeChartsTab(index)"
  19. ></view>
  20. </view>
  21. <view class="tab-title__placeholder"></view>
  22. </template>
  23. <view
  24. class="list-wrap"
  25. v-for="(item, index) in listData"
  26. :key="index"
  27. v-show="listData.length !== 0"
  28. @click="goInventory(item)"
  29. >
  30. <CardTime :time="item.createTime" />
  31. <KdCard
  32. :title="item.workOrderCode"
  33. :status="true"
  34. :item="item"
  35. type="check"
  36. />
  37. </view>
  38. <view v-show="listData.length === 0" class="no_data">
  39. <u-empty mode="data"></u-empty>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { post } from '@/utils/api.js'
  45. import KdCard from './components/KdCard/index.vue'
  46. import CardTime from './components/CardTime.vue'
  47. import dictMixins from '@/mixins/dictMixins'
  48. let [page, size, isEnd] = [1, 10, true]
  49. export default {
  50. mixins: [dictMixins],
  51. components: {
  52. KdCard,
  53. CardTime
  54. },
  55. data () {
  56. return {
  57. tabList: [
  58. {
  59. value: '',
  60. label: '全部',
  61. list: []
  62. },
  63. {
  64. value: 1,
  65. label: '盘点中',
  66. list: []
  67. },
  68. {
  69. value: 3,
  70. label: '已盘点',
  71. list: []
  72. },
  73. {
  74. value: 2,
  75. label: '待审核',
  76. list: []
  77. }
  78. ],
  79. pickTabIndex: 0, //Tab选择
  80. listData: [],
  81. dictOpt: {
  82. status: {
  83. 0: '待接收',
  84. 1: '执行中',
  85. 2: '待审核',
  86. 3: '完成',
  87. 4: '已撤回',
  88. 5: '待验收',
  89. 6: '已驳回',
  90. 7: '未修复',
  91. 8: '已派单'
  92. },
  93. asset: {
  94. 1: {
  95. color: '#027DB4',
  96. backgroundColor: '#def5ff'
  97. },
  98. 2: {
  99. color: '#B8741A',
  100. backgroundColor: '#fef1e8'
  101. },
  102. 3: {
  103. color: '#A30014',
  104. backgroundColor: '#f9e5e7'
  105. },
  106. 4: {
  107. color: 'green',
  108. backgroundColor: '#67C23A'
  109. },
  110. 5: {
  111. color: '#a30014',
  112. backgroundColor: '#F56C6C'
  113. },
  114. 6: {
  115. color: '#f56c6c',
  116. backgroundColor: '#fbc4c4'
  117. },
  118. 7: {
  119. color: '#e6a23c',
  120. backgroundColor: '#fdf6ec'
  121. }
  122. }
  123. }
  124. }
  125. },
  126. onLoad () {
  127. // this.requestDict('物品类型')
  128. this.getFirstList()
  129. },
  130. //加载更多
  131. onReachBottom () {
  132. if (isEnd) {
  133. return
  134. }
  135. // 显示加载图标
  136. uni.showLoading({
  137. title: '数据加载中'
  138. })
  139. this.getMoreLists()
  140. },
  141. methods: {
  142. //首次加载
  143. getFirstList () {
  144. page = 1
  145. isEnd = true
  146. uni.showLoading({
  147. title: '数据加载中'
  148. })
  149. this.getList()
  150. },
  151. //获取更多列表
  152. getMoreLists () {
  153. //获取更多数据
  154. page++
  155. this.getList()
  156. },
  157. //获取数据列表
  158. getList () {
  159. uni.showLoading({
  160. title: '加载中'
  161. })
  162. let Pagination = {
  163. page,
  164. size
  165. }
  166. let data = {
  167. workOrderType: 4
  168. }
  169. let status = this.tabList[this.pickTabIndex].value
  170. if (status) {
  171. data.status = status
  172. }
  173. //2 - 99 [已完成]
  174. let par = this.URLSearchParams(Pagination)
  175. post(this.apiUrl + '/workOrder/getWorkOrderList?' + par, data)
  176. .then(res => {
  177. let data = res.data.records
  178. let pageTotal = res.data.pages
  179. if (page === 1) {
  180. this.listData = data
  181. } else {
  182. data.forEach(element => {
  183. this.listData.push(element)
  184. })
  185. }
  186. page < pageTotal ? (isEnd = false) : (isEnd = true)
  187. })
  188. .then(() => {
  189. uni.hideLoading()
  190. })
  191. },
  192. //切换菜单Tab
  193. changeChartsTab (index) {
  194. this.pickTabIndex = index
  195. this.getFirstList()
  196. },
  197. // 跳转盘点清单
  198. goInventory (item) {
  199. let par = this.URLSearchParams({
  200. id: item.id,
  201. workOrderCode: item.workOrderCode,
  202. BizType: item.bizType
  203. })
  204. uni.navigateTo({
  205. url: '/pages/warehouse/workOrder/inventory/inventory?' + par
  206. })
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .mainBox {
  213. }
  214. /*Tab条*/
  215. .tab-title {
  216. position: fixed;
  217. z-index: 99;
  218. width: 100%;
  219. display: flex;
  220. justify-content: space-between;
  221. align-items: center;
  222. height: $tab-height;
  223. line-height: $tab-height;
  224. background-color: #ffffff;
  225. border-bottom: 1px solid #f2f2f2;
  226. box-sizing: border-box;
  227. .tab-item {
  228. width: 25%;
  229. text-align: center;
  230. font-size: 32rpx;
  231. color: $uni-text-color-grey;
  232. }
  233. .tab-item.active {
  234. color: $j-primary-border-green;
  235. border-bottom: 1px solid $j-primary-border-green;
  236. font-weight: bold;
  237. }
  238. .tab-item.filter {
  239. flex: 1;
  240. padding: 0px 30rpx;
  241. .uni-icons {
  242. display: flex;
  243. padding-top: 5px;
  244. font-weight: bold;
  245. }
  246. }
  247. }
  248. /*列表信息*/
  249. .list-wrap {
  250. padding: 10rpx;
  251. background-color: $page-bg;
  252. // .item {
  253. // display: flex;
  254. // justify-content: space-between;
  255. // padding: 10rpx;
  256. // color: rgb(170, 170, 170);
  257. // font-size: 28rpx;
  258. // word-break: break-all;
  259. // .title {
  260. // color: #333333;
  261. // font-size: 28rpx;
  262. // }
  263. // .state {
  264. // font-size: 12px;
  265. // display: inline;
  266. // padding: 2px 5px;
  267. // border-radius: 10px;
  268. // }
  269. // .asset {
  270. // font-size: 12px;
  271. // color: #7f7f7f;
  272. // background: #f1f1f1;
  273. // padding: 2px 5px;
  274. // border-radius: 2px;
  275. // }
  276. // }
  277. & + .list-wrap {
  278. border-top: 1px solid rgba(242, 242, 242, 1);
  279. }
  280. }
  281. </style>