put-storage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <view class="deliver-page">
  3. <u-navbar height="40px" title="采购入库" bgColor="#0256FF" :titleStyle="{color:'#fff'}" leftIconColor="#fff" autoBack
  4. placeholder>
  5. </u-navbar>
  6. <view class="container_main">
  7. <view class="info-box" :class="isUnfold ? '':'min-height'">
  8. <view class="info-line">
  9. <view class="info-line-label">
  10. <text>收入仓库</text>
  11. </view>
  12. <view class="info-line-value">
  13. {{cangName}}
  14. </view>
  15. </view>
  16. <view class="info-line">
  17. <view class="info-line-label">
  18. <text>供应商</text>
  19. </view>
  20. <view class="info-line-value">
  21. {{orderInfo.supplierName}}
  22. </view>
  23. </view>
  24. <view class="info-line">
  25. <view class="info-line-label">
  26. <text>入库类型</text>
  27. </view>
  28. <view class="info-line-value">
  29. {{orderInfo.subType}}
  30. </view>
  31. </view>
  32. <view class="info-line">
  33. <view class="info-line-label">
  34. <text>入库日期</text>
  35. </view>
  36. <view class="info-line-value">
  37. {{orderInfo.operTime}}
  38. </view>
  39. </view>
  40. <view class="info-line">
  41. <view class="info-line-label">
  42. <text>上传凭证</text>
  43. </view>
  44. <view class="info-line-value ss-p-y-24">
  45. <upload-image v-model="voucherPicture" width="196rpx" height="196rpx"></upload-image>
  46. </view>
  47. </view>
  48. <view class="info-line">
  49. <view class="info-line-label">
  50. <text>备注信息</text>
  51. </view>
  52. <view class="info-line-value">
  53. <u-input v-model="orderInfo.mark" placeholder="请输入备注信息" border="none"></u-input>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="btn-box">
  58. <view class="btn-cont" @click="isUnfold = !isUnfold">
  59. <text>{{isUnfold ? '收起' : '展开'}}</text>
  60. <u-icon :name="isUnfold?'arrow-up':'arrow-down'"></u-icon>
  61. </view>
  62. </view>
  63. <view class="scan-box">
  64. <view class="scan-box-l" @click="scanCode">
  65. <u-image width="120rpx" height="120rpx" src="@/static/image/zidong-saoma-img.png"></u-image>
  66. <view class="tips-text">扫描快速识别货物</view>
  67. <view class="tips-text2">
  68. <u-icon name="checkmark-circle-fill" color="#0256FF"></u-icon>
  69. <text>连续扫描</text>
  70. </view>
  71. </view>
  72. <!-- <view class="scan-box-r" @click="manualClick">
  73. <u-image width="120rpx" height="120rpx" src="@/static/image/shoudong-saoma-img.png"></u-image>
  74. <view class="tips-text">手动选择</view>
  75. </view> -->
  76. </view>
  77. <!-- 货物清单 -->
  78. <view class="cargo-list">
  79. <view class="cargo-list-title">
  80. <view>入库货物清单</view>
  81. <view class="cargo-list-title-tips">(轻触货物查看详情)</view>
  82. </view>
  83. <block v-for="(item,i) in goodsList" :key="i">
  84. <good-item :item="item" @toDetail="toDetail" @calendarClick="calendarClick" :show-print="true" @print="(e) => handlePrint(e.id)">
  85. <view class="num-box">
  86. <view class="num-box-text">已确认入库数量</view>
  87. <u-number-box v-model="item.materialNumber" min="0" :inputWidth="56" :max="item.inventory">
  88. <!-- <view slot="minus" class="minus">
  89. <u-icon name="minus" color="#0256FF" size="12"></u-icon>
  90. </view>
  91. <text slot="input" class="input">{{item.materialNumber}}</text>
  92. <view slot="plus" class="plus">
  93. <u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
  94. </view> -->
  95. </u-number-box>
  96. </view>
  97. </good-item>
  98. </block>
  99. </view>
  100. </view>
  101. <view class="footer-box">
  102. <view class="footer-box-l">
  103. <view>货物种类:{{speciesNum}}种</view>
  104. <view>货物总数:{{orderGoodsNum}}件</view>
  105. </view>
  106. <button class="submitBtn" @tap="submitClick">
  107. 提交
  108. </button>
  109. </view>
  110. <error-pop v-model="errorShow" @close="errorShow = false" @confirm="confirm" :content="popText.errorText"></error-pop>
  111. <success-pop v-model="successShow" @close="successShow = false" @backClick="backClick" :content="popText.successText"></success-pop>
  112. <!-- 扫码之后弹窗 -->
  113. <scaned-pop v-if="scanedShow" v-model="scanedShow" :scanNum="scanNum" @close="scanedShow = false" @confirm="scanConfirm"></scaned-pop>
  114. <goods-pop v-model="goodsShow" @close="goodsShow = false" type="caigou"></goods-pop>
  115. <u-datetime-picker
  116. :show="calendarShow"
  117. v-model="value1"
  118. :maxDate="maxDate"
  119. mode="date"
  120. :closeOnClickOverlay="true"
  121. @confirm="calendarConfirm"
  122. @cancel="calendarShow = false"
  123. ></u-datetime-picker>
  124. <!-- 打印条码弹框 -->
  125. <print-pop :show.sync="blePrintPop.show" :info="blePrintPop.data" @confirm="startPrint"></print-pop>
  126. <!-- 选择蓝牙设备弹框 -->
  127. <ble-pop :show.sync="bleSelectPop.show" :list="discoveredDevices" @close="closeBleSelectPop" @refresh="refreshBleDevice" @selectItem="handleSelectBle"></ble-pop>
  128. <ble-tip-pop v-model="bleErrorTipPop.show" :is-center="true" @confirm="bleErrorTipConfirm" :content="bleErrorTipPop.content" :extraText="bleErrorTipPop.extraText"> </ble-tip-pop>
  129. </view>
  130. </template>
  131. <script>
  132. import goodItem from '@/components/good-item/good-item.vue'
  133. import errorPop from '@/components/error-pop/error-pop.vue'
  134. import successPop from '@/components/success-pop/success-pop.vue'
  135. import scanedPop from '@/components/scaned-pop/scaned-pop.vue'
  136. import goodsPop from '@/components/goods-pop/goods-pop.vue'
  137. import {orderDetail, orderInfo, orderSubmit} from '@/common/request/apis/purchase'
  138. import {mapGetters} from 'vuex'
  139. import blePrintMixin from '@/common/mixins/blePrintMixin.js'
  140. export default {
  141. mixins: [blePrintMixin],
  142. components: {
  143. goodItem,
  144. errorPop,
  145. successPop,
  146. scanedPop,
  147. goodsPop
  148. },
  149. data() {
  150. return {
  151. popText:{
  152. errorText:'实际入库数量与应入库数量有差异,是否确认提交?',
  153. successText:'入库成功!'
  154. },
  155. goodsShow:false,
  156. scanedShow:false,
  157. errorShow:false,
  158. successShow:false,
  159. value:0,
  160. isUnfold: true, //是否展开
  161. info: {
  162. mark: '',
  163. url: ''
  164. },
  165. goodsList: [],
  166. orderInfo:{},
  167. id:'',
  168. calendarShow:false,
  169. value1: '',
  170. maxDate:Number(new Date()),
  171. chooseGoodsInfo:{},
  172. voucherPicture:'',
  173. scanIndex:-1,
  174. scanNum:1,
  175. }
  176. },
  177. onLoad(e) {
  178. this.id = e.id
  179. this.getOrderDetail(e.id)
  180. this.getOrderInfo(e.id)
  181. },
  182. onShow() {
  183. uni.$on('scanFinish',(data)=>{
  184. if(this.goodsList.length == 0) return uni.$u.toast("该货物不属于该任务");
  185. let index = this.goodsList.findIndex(item=>item.barCode == data)
  186. if(index == -1) return uni.$u.toast("该货物不属于该任务");
  187. this.scanIndex = index
  188. this.scanNum = this.goodsList[index].materialNumber
  189. this.scanedShow = true
  190. })
  191. },
  192. onHide() {
  193. uni.$off('scanFinish')
  194. },
  195. onUnload() {
  196. uni.$off('scanFinish')
  197. },
  198. computed: {
  199. ...mapGetters(['cangName']),
  200. speciesNum() {
  201. let num = 0
  202. if(this.goodsList.length == 0 || !this.goodsList) {
  203. num = 0
  204. }else {
  205. num = this.goodsList.length
  206. }
  207. return num
  208. },
  209. // 手动输入的数量
  210. goodsNum() {
  211. let num = 0
  212. if(this.goodsList.length == 0 || !this.goodsList) {
  213. num = 0
  214. }else {
  215. this.goodsList.forEach(item=>{
  216. num+=item.materialNumber
  217. })
  218. }
  219. return num
  220. },
  221. // 订单返回的数量
  222. orderGoodsNum() {
  223. let num = 0
  224. if(this.goodsList.length == 0 || !this.goodsList) {
  225. num = 0
  226. }else {
  227. this.goodsList.forEach(item=>{
  228. num+=item.operNumber
  229. })
  230. }
  231. return num
  232. }
  233. },
  234. methods:{
  235. scanCode() {
  236. this.$scan.scanCode()
  237. },
  238. calendarConfirm(val) {
  239. this.goodsList.forEach(item=>{
  240. if(item.id == this.chooseGoodsInfo.id) {
  241. item.productionDate = this.$u.timeFormat(val.value, 'yyyy-mm-dd')
  242. }
  243. })
  244. this.calendarShow = false
  245. },
  246. calendarCole() {
  247. this.calendarShow = false
  248. },
  249. calendarClick(item) {
  250. this.chooseGoodsInfo = item
  251. if(item.productionDate) {
  252. this.value1 = Number(new Date(item.productionDate))
  253. }else {
  254. this.value1 = Number(new Date())
  255. }
  256. this.calendarShow = true
  257. },
  258. getOrderInfo(id) {
  259. orderInfo(id)
  260. .then(res=>{
  261. if(res.code == 200) {
  262. this.orderInfo = res.data
  263. }
  264. })
  265. },
  266. getOrderDetail(id) {
  267. orderDetail(id)
  268. .then(res=>{
  269. if(res.code == 200) {
  270. res.data.rows.forEach(item=>{
  271. item.materialNumber = 0
  272. if(item.imgName && item.imgName.length >0) {
  273. item.imgNameArr = item.imgName.split(",")
  274. }else {
  275. item.imgNameArr = []
  276. }
  277. })
  278. this.goodsList = res.data.rows
  279. }
  280. })
  281. },
  282. submitClick() {
  283. let num = 0
  284. this.goodsList.forEach(item=>{
  285. if(item.materialNumber * 1 != item.operNumber ) {
  286. num ++
  287. }
  288. })
  289. if(num>0) {
  290. return this.errorShow = true
  291. }
  292. this.toOrderSubmit()
  293. },
  294. toOrderSubmit() {
  295. let materials = this.goodsList.map(item=> {
  296. return {
  297. batchNumber:item.batchNumber,
  298. materialNumber:item.materialNumber,
  299. productionDate:item.productionDate ? this.$u.timeFormat(item.productionDate, 'yyyy-mm-dd') : ''
  300. }
  301. })
  302. let params = {
  303. id:this.id,
  304. materials:materials,
  305. voucherPicture:this.voucherPicture || '',
  306. remark:this.orderInfo.mark || ''
  307. }
  308. orderSubmit(params)
  309. .then(res=>{
  310. if(res.code == 200) {
  311. if(this.errorShow){
  312. this.errorShow = false
  313. }
  314. this.successShow = true
  315. }
  316. })
  317. },
  318. confirm() {
  319. this.toOrderSubmit()
  320. this.errorShow = false
  321. },
  322. backClick() {
  323. uni.setStorageSync('orderRefresh',true)
  324. uni.navigateBack()
  325. },
  326. // 扫码确认
  327. scanConfirm(val) {
  328. this.goodsList[this.scanIndex].materialNumber = Number(val)
  329. this.scanedShow = false
  330. },
  331. manualClick() {
  332. // this.goodsShow = true
  333. },
  334. toDetail(val) {
  335. uni.navigateTo({
  336. url:`/pages/goods/detail?id=${val.id}&name=${val.materialName}`
  337. })
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. .deliver-page {
  344. min-height: 100vh;
  345. background-color: #F0F6FB;
  346. padding-bottom: 130rpx;
  347. .container_main {
  348. padding: 24rpx;
  349. .info-box {
  350. background-color: #fff;
  351. border-radius: 16rpx 16rpx 0 0;
  352. padding: 24rpx 24rpx 0 24rpx;
  353. .info-line {
  354. border-bottom: 1px solid #F4F4F4;
  355. min-height: 92rpx;
  356. color: #333;
  357. font-family: "PingFang SC";
  358. font-size: 28rpx;
  359. font-weight: 400;
  360. display: flex;
  361. align-items: center;
  362. &-label {
  363. width: 162rpx;
  364. }
  365. .must-box {
  366. color: #FF3B1D;
  367. }
  368. }
  369. }
  370. .min-height {
  371. height: 300rpx;
  372. overflow: hidden;
  373. }
  374. .btn-box {
  375. height: 112rpx;
  376. display: flex;
  377. align-items: center;
  378. justify-content: center;
  379. background-color: #fff;
  380. border-radius: 0 0 16rpx 16rpx;
  381. .btn-cont {
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. width: 154rpx;
  386. height: 56rpx;
  387. border-radius: 120rpx;
  388. border: 1px solid #D9D9D9;
  389. color: #666;
  390. font-family: "PingFang SC";
  391. font-size: 28rpx;
  392. font-weight: 400;
  393. }
  394. }
  395. .scan-box {
  396. margin-top: 24rpx;
  397. padding: 24rpx 0;
  398. border-radius: 16rpx;
  399. background: #FFF;
  400. display: flex;
  401. .tips-text {
  402. color: #333;
  403. font-size: 28rpx;
  404. font-weight: 400;
  405. line-height: 48rpx;
  406. }
  407. .tips-text2 {
  408. color: #0256FF;
  409. font-size: 24rpx;
  410. font-weight: 400;
  411. display: flex;
  412. align-items: center;
  413. .radio-box {
  414. width: 32rpx;
  415. height: 32rpx;
  416. border-radius: 50%;
  417. border: 1px solid #D9D9D9;
  418. margin-right: 16rpx;
  419. }
  420. }
  421. .scan-box-l {
  422. width: 100%;
  423. display: flex;
  424. flex-direction: column;
  425. align-items: center;
  426. position: relative;
  427. &::after {
  428. content: '';
  429. display: block;
  430. width: 1px;
  431. height: 138rpx;
  432. background-color: #F4F4F4;
  433. position: absolute;
  434. top: 50%;
  435. right: 0;
  436. transform: translateY(-50%);
  437. }
  438. }
  439. .scan-box-r {
  440. width: 50%;
  441. display: flex;
  442. flex-direction: column;
  443. align-items: center;
  444. }
  445. }
  446. .cargo-list {
  447. padding: 24rpx 0;
  448. background-color: #fff;
  449. margin-top: 24rpx;
  450. border-radius: 16rpx;
  451. .cargo-list-title {
  452. font-family: "PingFang SC";
  453. font-size: 32rpx;
  454. font-style: normal;
  455. font-weight: bold;
  456. display: flex;
  457. align-items: center;
  458. position: relative;
  459. padding-left: 50rpx;
  460. &::after {
  461. content: '';
  462. display: block;
  463. width: 6rpx;
  464. height: 30rpx;
  465. border-radius: 100px;
  466. background: #0256FF;
  467. position: absolute;
  468. top: 50%;
  469. left: 24rpx;
  470. transform: translateY(-50%);
  471. }
  472. .cargo-list-title-tips {
  473. color: #0256FF;
  474. font-size: 24rpx;
  475. font-weight: 400;
  476. }
  477. }
  478. .num-box {
  479. display: flex;
  480. align-items: center;
  481. justify-content: space-between;
  482. padding: 0 48rpx 0 26rpx;
  483. .num-box-text {
  484. color: #666;
  485. font-family: "PingFang SC";
  486. font-size: 28rpx;
  487. font-weight: 400;
  488. }
  489. .input {
  490. width: 112rpx;
  491. text-align: center;
  492. border-bottom: 1px solid #0256FF;
  493. margin: 0 8rpx;
  494. }
  495. .minus {
  496. width: 40rpx;
  497. height: 40rpx;
  498. border-radius: 8rpx;
  499. border: 1px solid #0256FF;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. }
  504. .plus {
  505. width: 40rpx;
  506. height: 40rpx;
  507. border-radius: 8rpx;
  508. background-color: #0256FF;
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. }
  513. }
  514. }
  515. }
  516. .footer-box {
  517. background-color: #fff;
  518. height: 126rpx;
  519. position: fixed;
  520. bottom: 0;
  521. left: 0;
  522. right: 0;
  523. display: flex;
  524. align-items: center;
  525. justify-content: space-between;
  526. padding: 0 40rpx 0 60rpx;
  527. .footer-box-l {
  528. color: #666;
  529. font-family: "PingFang SC";
  530. font-size: 28rpx;
  531. font-weight: 400;
  532. }
  533. .submitBtn {
  534. width: 362rpx;
  535. height: 76rpx;
  536. border-radius: 16rpx;
  537. background: #0256FF;
  538. color: #FFF;
  539. font-size: 28rpx;
  540. font-weight: 500;
  541. margin: 0;
  542. }
  543. }
  544. }
  545. </style>