manualCheck.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <!-- 手动盘点 -->
  3. <view class="main">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" @clickLeft="back" title="手动盘点">
  5. </uni-nav-bar>
  6. <manualCheckBatch :infoData="infoData" :bizType="bizType" v-if="activeType"></manualCheckBatch>
  7. <view class="" v-if="!activeType">
  8. <view class="top-bar">
  9. <view class="title">
  10. {{ infoData.assetName }}({{ infoData.assetCode }})
  11. </view>
  12. <view class="tab-title">
  13. <view class="item" :class="{ active: tabTitleActive == index }" v-for="(item, index) in tabTitle"
  14. :key="item.name" @click="handlActive(index)">
  15. {{ item.name }}({{ item.num }})
  16. </view>
  17. </view>
  18. </view>
  19. <view class="main-warp">
  20. <template v-if="tabTitle[tabTitleActive].list.length > 0">
  21. <view class="order-list" v-for="(item, index) in tabTitle[tabTitleActive].list" :key="index">
  22. <view class="s1">
  23. <view class="b1">
  24. {{ item.assetName }}({{ item.assetCode }})
  25. </view>
  26. <view class="b2"> </view>
  27. </view>
  28. <view class="wrap">
  29. <view class="item">
  30. <view class="label"> 牌号 </view>
  31. <view class="value">
  32. {{ item.assetBrand }}
  33. </view>
  34. </view>
  35. <view class="item">
  36. <view class="label"> 型号 </view>
  37. <view class="value">
  38. {{ item.assetSku }}
  39. </view>
  40. </view>
  41. </view>
  42. <view class="wrap">
  43. <view class="item">
  44. <view class="label"> 批次 </view>
  45. <view class="value">
  46. {{ item.batchNo }}
  47. </view>
  48. </view>
  49. <view class="item">
  50. <view class="label"> 类型 </view>
  51. <view class="value">
  52. {{ infoData.assetTypeDictDESC }}
  53. </view>
  54. </view>
  55. </view>
  56. <view class="wrap">
  57. <view class="item">
  58. <view class="label"> 最小单元 </view>
  59. <view class="value">
  60. {{ item.measurementUnit }} {{ item.unit }} /
  61. {{ item.minPackUnit }}
  62. </view>
  63. </view>
  64. <view class="item">
  65. <view class="label"> 包装编码 </view>
  66. <view class="value">
  67. {{ item.bucketNum }}
  68. </view>
  69. </view>
  70. </view>
  71. <view class="wrap">
  72. <view class="item" style="width: 100%">
  73. <view class="label"> 货位 </view>
  74. <view class="value">
  75. {{ item.warehouseName }}/{{ item.reservoirName }}/{{
  76. item.goodsShelfName
  77. }}/{{ item.goodsAllocationName }}
  78. </view>
  79. </view>
  80. </view>
  81. <view class="bd-btn" @click="handlManualCheckPop(item)" v-if="tabTitleActive == 1">
  82. 确认
  83. </view>
  84. <view class="bd-btn" @click="handlremove(item)" v-if="tabTitleActive == 0">
  85. 移除
  86. </view>
  87. </view>
  88. </template>
  89. <u-empty style="padding-top: 20rpx" v-else> </u-empty>
  90. </view>
  91. <manualCheckPop :bizType="bizType" :workOrderId="workOrderId" :planInventoryId="planInventoryId"
  92. ref="manualCheckPop" @succeed="succeed"></manualCheckPop>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. postJ
  99. } from '@/utils/api'
  100. import manualCheckBatch from './manualCheckBatch.vue'
  101. import manualCheckPop from './manualCheckPop'
  102. let [page, size, isEnd] = [1, 10, true]
  103. export default {
  104. components: {
  105. manualCheckBatch,
  106. manualCheckPop
  107. },
  108. data() {
  109. return {
  110. bizType: '',
  111. /* 工单id */
  112. workOrderId: '',
  113. /* 清单id */
  114. planInventoryId: '',
  115. tabTitle: [{
  116. name: '已盘',
  117. num: 0,
  118. list: []
  119. },
  120. {
  121. name: '待盘',
  122. num: 0,
  123. list: []
  124. }
  125. ],
  126. tabTitleActive: 1,
  127. activeType: true, //true批量盘 false 逐个盘
  128. // 信息
  129. infoData: '',
  130. dataList: [],
  131. dict: {
  132. assetTypeDict: {
  133. 1: 'SHENGCHANSHEBEI',
  134. 2: 'ZHOUMIN',
  135. 3: 'WULIAO',
  136. 4: 'CHANPIN',
  137. 5: 'ZHOUZHUANCHE',
  138. 6: 'MOJU',
  139. 7: 'BEIPINBEIJIAN'
  140. }
  141. }
  142. }
  143. },
  144. onLoad(option) {
  145. this.infoData = JSON.parse(decodeURIComponent(option.info))
  146. this.workOrderId = option.workOrderId
  147. this.planInventoryId = option.planInventoryId
  148. this.bizType = option.bizType
  149. this.activeType = Boolean(this.infoData.takeStockPattern)
  150. this.getOneDetailList()
  151. this.getAlreadyOneDetailList()
  152. },
  153. computed: {
  154. right_text() {
  155. if (this.activeType) {
  156. return '批量盘'
  157. } else {
  158. return '逐个盘'
  159. }
  160. }
  161. },
  162. onReachBottom: function() {
  163. if (isEnd) {
  164. return
  165. }
  166. // 显示加载图标
  167. uni.showLoading({
  168. title: '数据加载中'
  169. })
  170. this.getMoreLists()
  171. },
  172. methods: {
  173. handlRight() {
  174. //this.activeType = !this.activeType
  175. },
  176. // 返回
  177. back() {
  178. uni.navigateBack({
  179. delta: 1
  180. })
  181. },
  182. handlActive(index) {
  183. this.tabTitleActive = index
  184. this.initPage()
  185. this.getData()
  186. },
  187. initPage() {
  188. page = 1
  189. this.tabTitle[this.tabTitleActive].list = []
  190. },
  191. getData() {
  192. switch (this.tabTitleActive) {
  193. case 0:
  194. this.getAlreadyOneDetailList()
  195. break
  196. case 1:
  197. this.getOneDetailList()
  198. break
  199. default:
  200. break
  201. }
  202. },
  203. // 待盘
  204. getOneDetailList() {
  205. let paging = {
  206. page,
  207. size,
  208. bizType: this.bizType
  209. }
  210. paging = this.URLSearchParams(paging)
  211. let par = JSON.parse(JSON.stringify(this.infoData))
  212. return postJ(
  213. this.apiUrl + '/repertoryCheck/getOneDetailList?' + paging,
  214. par
  215. )
  216. .then(res => {
  217. if (res.success) {
  218. let item = this.tabTitle[1]
  219. this.tabTitle[1].list = [...item.list, ...res.data.records]
  220. this.tabTitle[1].num = res.data.total
  221. if (this.tabTitleActive == 1) {
  222. let pageTotal = res.data.pages
  223. page < pageTotal ? (isEnd = false) : (isEnd = true)
  224. }
  225. }
  226. })
  227. .finally(() => {
  228. uni.hideLoading()
  229. })
  230. },
  231. // 已盘
  232. getAlreadyOneDetailList() {
  233. let paging = {
  234. page,
  235. size,
  236. bizType: this.bizType
  237. }
  238. paging = this.URLSearchParams(paging)
  239. let par = JSON.parse(JSON.stringify(this.infoData))
  240. par.bizType = Number(this.bizType)
  241. return postJ(
  242. this.apiUrl + '/repertoryCheck/getAlreadyOneDetailList?' + paging,
  243. par
  244. )
  245. .then(res => {
  246. if (res.success) {
  247. console.log(res.data.records)
  248. let item = this.tabTitle[0]
  249. item.list = [...item.list, ...res.data.records]
  250. item.num = res.data.total
  251. if (this.tabTitleActive == 0) {
  252. let pageTotal = res.data.pages
  253. page < pageTotal ? (isEnd = false) : (isEnd = true)
  254. }
  255. }
  256. })
  257. .finally(() => {
  258. uni.hideLoading()
  259. })
  260. },
  261. handlManualCheckPop(item) {
  262. this.$refs.manualCheckPop.open(item)
  263. },
  264. async succeed() {
  265. this.initPage()
  266. await this.getOneDetailList()
  267. await this.getAlreadyOneDetailList()
  268. if (this.tabTitle[1].list.length == 0) {
  269. this.back()
  270. }
  271. },
  272. // 移除已盘
  273. handlremove(item) {
  274. let par = {
  275. id: item.id
  276. }
  277. par = this.URLSearchParams(par)
  278. postJ(this.apiUrl + '/repertoryCheck/delete?' + par).then(res => {
  279. if (res.success) {
  280. uni.showToast({
  281. title: '移除成功',
  282. icon: 'none'
  283. })
  284. this.initPage()
  285. this.getOneDetailList()
  286. this.getAlreadyOneDetailList()
  287. }
  288. })
  289. },
  290. getMoreLists: function() {
  291. //获取更多数据
  292. page++
  293. this.getData()
  294. },
  295. // 返回
  296. back() {
  297. uni.navigateBack({
  298. delta: 1
  299. })
  300. }
  301. }
  302. }
  303. </script>
  304. <style lang="scss" scoped>
  305. $cols: 3; // 列数
  306. $marginWidth: 20rpx; // 间隔
  307. .top-title {
  308. padding: 20rpx;
  309. }
  310. .main {
  311. min-height: 100vh;
  312. background-color: #f0f0f0;
  313. position: relative;
  314. }
  315. .order-list {
  316. padding: 30rpx 20rpx;
  317. border-bottom: 1px solid #f2f2f2;
  318. position: relative;
  319. .s1 {
  320. display: flex;
  321. justify-content: space-between;
  322. align-items: center;
  323. .b1 {
  324. color: #555555;
  325. font-size: 30rpx;
  326. }
  327. .b2 {
  328. color: #000000;
  329. font-size: 28rpx;
  330. }
  331. .type {
  332. font-size: 28rpx;
  333. height: 40rpx;
  334. padding: 0 20rpx;
  335. line-height: 40rpx;
  336. &.yc {
  337. background-color: #dacde6;
  338. }
  339. &.ds {
  340. background-color: #feeaeb;
  341. }
  342. &.ps {
  343. background-color: #cbcbcb;
  344. }
  345. }
  346. }
  347. .wrap {
  348. display: flex;
  349. margin-top: 20rpx;
  350. .item {
  351. color: #555555;
  352. font-size: 28rpx;
  353. display: flex;
  354. width: 340rpx;
  355. .label {
  356. margin-right: 20rpx;
  357. }
  358. }
  359. }
  360. }
  361. .num-wrap {
  362. display: flex;
  363. width: 100%;
  364. .item {
  365. display: flex;
  366. align-items: center;
  367. width: calc((100% - #{($cols - 1) * $marginWidth}) / #{$cols});
  368. margin-left: $marginWidth;
  369. .label {
  370. white-space: nowrap;
  371. margin-right: 20rpx;
  372. font-size: 28rpx;
  373. }
  374. .input-wrap {
  375. .input {
  376. border: 1px solid #f2f2f2;
  377. }
  378. }
  379. }
  380. .item:nth-of-type(#{$cols}n + 1) {
  381. margin-left: 0;
  382. }
  383. }
  384. .top-bar {
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. height: 80rpx;
  389. padding: 0 20rpx;
  390. background-color: #fff;
  391. /* position: absolute;
  392. top: 88rpx;
  393. left: 0; */
  394. width: 100%;
  395. box-sizing: border-box;
  396. z-index: 10;
  397. .title {
  398. color: #555555;
  399. font-size: 24rpx;
  400. }
  401. .tab-title {
  402. color: #555555;
  403. font-size: 24rpx;
  404. display: flex;
  405. .item {
  406. &+.item {
  407. margin-left: 20rpx;
  408. }
  409. &.active {
  410. color: #157a2c;
  411. border-bottom: 1px solid #157a2c;
  412. }
  413. }
  414. }
  415. }
  416. .order-list {
  417. padding: 30rpx 20rpx;
  418. border-bottom: 20rpx solid #d7d7d7;
  419. position: relative;
  420. .s1 {
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. .b1 {
  425. color: #555555;
  426. font-size: 30rpx;
  427. }
  428. .b2 {
  429. color: #000000;
  430. font-size: 24rpx;
  431. }
  432. .type {
  433. font-size: 24rpx;
  434. height: 40rpx;
  435. padding: 0 20rpx;
  436. line-height: 40rpx;
  437. &.yc {
  438. background-color: #dacde6;
  439. }
  440. &.ds {
  441. background-color: #feeaeb;
  442. }
  443. &.ps {
  444. background-color: #cbcbcb;
  445. }
  446. }
  447. }
  448. .wrap {
  449. display: flex;
  450. margin-top: 20rpx;
  451. .item {
  452. color: #555555;
  453. font-size: 24rpx;
  454. display: flex;
  455. width: 340rpx;
  456. .label {
  457. margin-right: 20rpx;
  458. }
  459. }
  460. }
  461. }
  462. .bd-btn {
  463. height: 56rpx;
  464. padding: 0 20rpx;
  465. display: flex;
  466. justify-content: center;
  467. align-items: center;
  468. color: #4b7902;
  469. font-size: 26rpx;
  470. border: 1px solid #4b7902;
  471. position: absolute;
  472. bottom: 20rpx;
  473. right: 20rpx;
  474. }
  475. .main-warp {
  476. //margin-top: 80rpx;
  477. }
  478. </style>