delivery.vue 12 KB

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