deliver-goods.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="container cart clearfix">
  3. <view class="record-content-empty" v-if="isEmpty" :style="{'height': windowHeight ? windowHeight - CustomBar+'px' : 'auto'}">
  4. <view class="record-container clearfix">
  5. <image class="club-empty-image" src="https://img.caimei365.com/group1/M00/03/B7/Cmis2178OfaAEjhLAABqsz9OXM0847.png" mode="aspectFit"></image>
  6. <view class="txt">未发货商品已全部取消,无需再发货~</view>
  7. </view>
  8. </view>
  9. <view class="container-cart-main" v-else>
  10. <view class="container-cart">
  11. <view class="cart-content" :style="{paddingBottom :isIphoneX ? '130rpx' : '100rpx'}">
  12. <view class="goods-title">请选择合适的商品数量进行发货</view>
  13. <view class="goods-list">
  14. <view class="goods-pros" v-for="(pros,idx) in productsList" :key="idx" >
  15. <view class="goods-pros-t" @click.stop="ischeck(pros)">
  16. <!--选择商品-->
  17. <view class="checkbox-box">
  18. <button class="checkbox iconfont" :class="[pros.checked ?'icon-gouxuanl':'icon-weigouxuan']"></button>
  19. </view>
  20. <view class="pros-img"><image :src="pros.productImage ? pros.productImage:''" alt="" /></view>
  21. <view class="pros-product">
  22. <view class="producttitle">{{pros.name}}</view>
  23. <view class="productspec">规格:{{pros.productUnit ? pros.productUnit : ''}}</view>
  24. <view class="productspec">商品编码:{{pros.productNo ? pros.productNo : ''}}</view>
  25. <view class="product-view">
  26. <view class="view-num">数量:{{pros.num+pros.presentNum}}</view>
  27. </view>
  28. <view class="product-view">
  29. <view class="view-num">已发货:{{pros.shipmentsNum}}</view>
  30. <view class="view-num">未发货:{{pros.notOutStore-pros.actualCancelNum}}</view>
  31. </view>
  32. <view class="product-view">
  33. <view class="view-num">已退货:{{pros.returnedNum}}</view>
  34. <view class="view-num">已取消:{{pros.actualCancelNum}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="goods-pros-b">
  39. <view class="productprice">
  40. <view class="text">本次发货</view>
  41. <view class="count">
  42. <view class="number-box">
  43. <view class="iconfont icon-jianhao" :class="[pros.isReduceNum ? 'disabled':'']" @click="changeCountSub(pros)"></view>
  44. <input class="btn-input" type="number" maxlength='4' v-model="pros.shipmentCount" @blur="changeNnmber($event,pros)">
  45. <view class="iconfont icon-jiahao" :class="[pros.isPlusNum ?'disabled':'']" @click="changeCountAdd(pros)"></view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 脚部菜单 -->
  54. <view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  55. <view class="footer-le">
  56. <view class="foot-check checkbox-box" @tap.stop="checkAll()">
  57. <button class="checkbox iconfont" :class="[isCheckAll?'icon-gouxuan':'icon-weigouxuan']"></button>
  58. <view class="text">全选</view>
  59. </view>
  60. </view>
  61. <view class="footer-ri" >
  62. <view class="btn" @tap="toConfirmDeliver">去发货</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import authorize from '@/common/config/authorize.js'
  71. import { mapState,mapMutations } from 'vuex';
  72. export default{
  73. data(){
  74. return{
  75. isEmpty:false,
  76. CustomBar:this.CustomBar,// 顶部导航栏高度
  77. isIphoneX:this.$store.state.isIphoneX,
  78. shopOrderId:'',
  79. productsList:[],//发货的商品
  80. isCheckAll:false,//是否全选
  81. scrollHeight: '',
  82. windowHeight: '',
  83. }
  84. },
  85. onLoad(option){
  86. this.shopOrderId = option.shopOrderId
  87. this.setScrollHeight()
  88. this.initShopOrderShipmentsInfo();
  89. },
  90. computed: {
  91. ...mapState(['hasLogin','userInfo'])
  92. },
  93. methods:{
  94. initShopOrderShipmentsInfo(){//初始化
  95. this.ShopService.ShopOrderShipmentsInfo({ shopOrderId : this.shopOrderId }).then(response =>{
  96. if( response.data.orderProductList.length>0){
  97. let orderProductList = response.data.orderProductList
  98. let elObject = {}
  99. let isReduceNum = false
  100. let creatProductList = []
  101. this.isEmpty = false
  102. orderProductList.forEach(el =>{
  103. let uninNum = el.notOutStore - el.actualCancelNum//未发货数量
  104. if(uninNum == 1){
  105. isReduceNum = true
  106. }else{
  107. isReduceNum = false
  108. }
  109. elObject = {
  110. shipmentCount:uninNum,
  111. isReduceNum:isReduceNum,
  112. checked:false
  113. }
  114. creatProductList.push(Object.assign({},el,elObject))
  115. })
  116. this.productsList = creatProductList
  117. console.log(this.productsList)
  118. }else{
  119. this.isEmpty = true
  120. }
  121. }).catch(error =>{
  122. this.$util.msg(error.msg,2000);
  123. })
  124. },
  125. setScrollHeight() {
  126. const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
  127. this.windowHeight = windowHeight - 1;
  128. this.scrollHeight = windowHeight - 1;
  129. },
  130. ischeck(pro){//为未选中的时候改变为true,反之为true
  131. pro.checked = !pro.checked;
  132. this.updateCheckAllBtn();
  133. },
  134. updateCheckAllBtn() {// 全选勾选判断
  135. let goodsCheckedLength = 0,
  136. productsList = this.productsList;
  137. productsList.forEach(item => {
  138. if(item.checked) { goodsCheckedLength++; }
  139. })
  140. this.isCheckAll = goodsCheckedLength === productsList.length;
  141. },
  142. updateBothCheckBtn() {//
  143. this.productsList.forEach((item)=>{
  144. item.checked = this.isCheckAll ;
  145. })
  146. },
  147. checkAll(){//全选方法内调用方法
  148. this.isCheckAll = !this.isCheckAll;
  149. this.updateBothCheckBtn();
  150. },
  151. changeCountAdd(pros){//商品数量加加
  152. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  153. if(pros.shipmentCount == uninNum){
  154. this.isNoneNum =true
  155. return
  156. }else{
  157. pros.shipmentCount++
  158. this.isNoneNum =false
  159. }
  160. },
  161. changeCountSub(pros){//商品数量减减
  162. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  163. if(pros.shipmentCount == 1){
  164. pros.shipmentCount = pros.shipmentCount
  165. return
  166. }else{
  167. pros.shipmentCount--
  168. }
  169. },
  170. changeNnmber(e,pros){//输入商品数量更新
  171. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  172. let _value = e.detail.value;
  173. if(!this.$api.isNumber(_value) || uninNum == 1){
  174. pros.shipmentCount = uninNum
  175. }else if(_value > uninNum){
  176. pros.shipmentCount = uninNum
  177. }else{
  178. pros.shipmentCount = e.detail.value
  179. }
  180. },
  181. toConfirmDeliver(){//添加物流页面
  182. let setProductList=[];
  183. this.productsList.forEach(el=>{
  184. if(el.checked){
  185. let elObject = {
  186. orderProductId:el.orderProductID.toString(),
  187. num:el.shipmentCount.toString()
  188. }
  189. setProductList.push(elObject)
  190. }
  191. })
  192. if(setProductList == ''){
  193. this.$util.msg("请先选择商品~",2000);
  194. return
  195. }else{
  196. this.$api.navigateTo(`/supplier/pages/deliver/add-logistics?type=add&shopOrderId=${this.shopOrderId}&data=${JSON.stringify(setProductList)}`)
  197. }
  198. },
  199. },
  200. onPullDownRefresh() {//下拉刷新
  201. this.initShopOrderShipmentsInfo()
  202. uni.stopPullDownRefresh()
  203. },
  204. onShow(){
  205. },
  206. }
  207. </script>
  208. <style lang="scss">
  209. page{
  210. background: #f7f7f7;
  211. height: auto;
  212. }
  213. .record-content-empty{
  214. width: 100%;
  215. height: 100%;
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. .record-container{
  220. width: 465rpx;
  221. height: auto;
  222. image{
  223. width: 400rpx;
  224. height: 400rpx;
  225. display: block;
  226. margin: 0 auto;
  227. }
  228. .txt{
  229. font-size: $font-size-28;
  230. text-align: center;
  231. color: #333;
  232. line-height: 30rpx;
  233. margin-bottom: 20rpx;
  234. }
  235. .btn{
  236. width: 400rpx;
  237. height: 80rpx;
  238. background: $btn-confirm;
  239. border-radius: 10rpx;
  240. line-height: 80rpx;
  241. font-size: $font-size-28;
  242. text-align: center;
  243. color: #FFFFFF;
  244. }
  245. }
  246. }
  247. .cart-content{
  248. position: relative;
  249. }
  250. .goods-title{
  251. width: 702rpx;
  252. padding: 0 24rpx;
  253. height: 80rpx;
  254. line-height: 80rpx;
  255. text-align: left;
  256. font-size: $font-size-28;
  257. color: $color-system;
  258. background-color: rgba(225, 86, 22, 0.17);
  259. }
  260. .checkbox-box{
  261. display: flex;
  262. align-items: center;
  263. .checkbox{
  264. display: flex;
  265. margin: 0;
  266. padding: 0;
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. box-sizing: border-box;
  271. text-align: center;
  272. text-decoration: none;
  273. border-radius: 0;
  274. -webkit-tap-highlight-color: transparent;
  275. overflow: hidden;
  276. background-color:#FFFFFF;
  277. font-size: 36rpx;
  278. color:$color-system;
  279. }
  280. &.disabled{
  281. .checkbox{
  282. color:#999999
  283. }
  284. }
  285. .text{
  286. font-size: $font-size-24;
  287. margin-left: 10rpx;
  288. }
  289. }
  290. .goods-list{
  291. width: 100%;
  292. height: auto;
  293. background-color: #F7F7F7;
  294. margin-top: 24rpx;
  295. .goods-item{
  296. width: 702rpx;
  297. padding: 0 24rpx;
  298. background: #FFFFFF;
  299. margin-bottom: 24rpx;
  300. }
  301. .goods-pros{
  302. width: 702rpx;
  303. padding: 0 24rpx;
  304. background: #FFFFFF;
  305. margin-bottom: 24rpx;
  306. }
  307. .goods-pros-t{
  308. display: flex;
  309. width: 100%;
  310. height: auto;
  311. padding:20rpx 0;
  312. .checkbox-box{
  313. padding: 10rpx;
  314. }
  315. .pros-img{
  316. width: 210rpx;
  317. height: 210rpx;
  318. border-radius: 10rpx;
  319. margin:0 20rpx;
  320. border:1px solid #f3f3f3;
  321. image{
  322. width: 100%;
  323. height: 100%;
  324. border-radius: 10rpx;
  325. }
  326. }
  327. }
  328. .goods-pros-b{
  329. width:622rpx;
  330. height: 80rpx;
  331. margin-left: 84rpx;
  332. border-top: 1px solid #F7F7F7;
  333. position: relative;
  334. .productprice{
  335. height: 48rpx;
  336. width: 100%;
  337. margin-top: 15rpx;
  338. .text{
  339. line-height: 48rpx;
  340. float: left;
  341. color: $text-color;
  342. font-size: $font-size-28;
  343. }
  344. .count{
  345. height: 100%;
  346. float: right;
  347. position: relative;
  348. &.show{
  349. display: block;
  350. }
  351. &.none{
  352. display: none;
  353. }
  354. .number-box{
  355. display: flex;
  356. justify-content: center;
  357. align-items: center;
  358. .iconfont{
  359. font-size: $font-size-24;
  360. padding:0 18rpx;
  361. color: $text-color;
  362. text-align: center;
  363. line-height: 48rpx;
  364. font-weight: bold;
  365. background-color: #ffe6dc;
  366. &.disabled{
  367. color: #999999;
  368. }
  369. }
  370. .btn-input{
  371. width: 62rpx;
  372. height: 48rpx;
  373. line-height: 48rpx;
  374. background: #F8F8F8;
  375. border-radius: 4rpx;
  376. text-align: center;
  377. font-size: $font-size-24;
  378. }
  379. }
  380. .uni-numbox{
  381. position: absolute;
  382. left: 45rpx;
  383. bottom: 0;
  384. .uni-numbox-minus, .uni-numbox-plus{
  385. width: 50rpx;
  386. line-height: 40rpx;
  387. }
  388. .uni-numbox-value {
  389. font-size: $font-size-28;
  390. width: 60rpx;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. .pros-product{
  397. width: 402rpx;
  398. height: 100%;
  399. line-height: 36rpx;
  400. font-size: $font-size-28;
  401. position: relative;
  402. .producttitle{
  403. width: 100%;
  404. display: inline-block;
  405. height: auto;
  406. text-overflow:ellipsis;
  407. display: -webkit-box;
  408. word-break: break-all;
  409. -webkit-box-orient: vertical;
  410. -webkit-line-clamp: 2;
  411. overflow: hidden;
  412. margin-bottom: 8rpx;
  413. }
  414. .productspec{
  415. height: 44rpx;
  416. color: #999999;
  417. line-height: 44rpx;
  418. font-size: $font-size-26;
  419. }
  420. .product-view{
  421. width: 100%;
  422. height: auto;
  423. display: flex;
  424. .view-num{
  425. flex: 1;
  426. text-align: left;
  427. font-size: $font-size-26;
  428. color: #666666;
  429. line-height: 44rpx;
  430. }
  431. }
  432. }
  433. }
  434. .footer{
  435. width: 100%;
  436. background-color: #FFFFFF;
  437. height: 110rpx;
  438. position: fixed;
  439. bottom: 0rpx;
  440. z-index: 100;
  441. .footer-le{
  442. width: 450rpx;
  443. height: 100%;
  444. padding:0 30rpx;
  445. float: left;
  446. .text{
  447. font-weight: bold;
  448. }
  449. .foot-check{
  450. width: 100rpx;
  451. float: left;
  452. line-height: 110rpx;
  453. font-size: $font-size-24;
  454. .checkbox{
  455. width: 40rpx;
  456. text-align: center;
  457. }
  458. .text{
  459. width: 60rpx;
  460. float: right;
  461. }
  462. }
  463. .foot-check-delbtn{
  464. float: left;
  465. .delBtn{
  466. margin: 0;
  467. padding: 0;
  468. display: flex;
  469. flex-direction: column;
  470. align-items: center;
  471. box-sizing: border-box;
  472. font-size: $font-size-24;
  473. text-align: center;
  474. text-decoration: none;
  475. border-radius: 0;
  476. -webkit-tap-highlight-color: transparent;
  477. overflow: hidden;
  478. background-color:#FFFFFF;
  479. color: #FF2A2A;
  480. padding: 0 24rpx;
  481. display: flex;
  482. justify-content: center;
  483. align-items: center;
  484. line-height: 110rpx;
  485. font-weight: bold;
  486. &.none{
  487. display: none;
  488. }
  489. }
  490. }
  491. .sum{
  492. font-size: $font-size-28;
  493. line-height: 110rpx;
  494. color: $text-color;
  495. display: flex;
  496. justify-content: flex-end;
  497. .money{
  498. color: #FF2A2A;
  499. }
  500. .money-sign{
  501. font-size: $font-size-24;
  502. color: #FF2A2A;
  503. }
  504. }
  505. }
  506. .footer-ri{
  507. width: 200rpx;
  508. height: 64rpx;
  509. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  510. float: right;
  511. display: flex;
  512. justify-content: space-between;
  513. align-items: center;
  514. z-index: 999;
  515. margin-top: 20rpx;
  516. margin-right: 24rpx;
  517. border-radius: 32rpx;
  518. &.none{
  519. display: none;
  520. }
  521. .btn{
  522. width: 200rpx;
  523. height: 64rpx;
  524. font-size: $font-size-28;
  525. line-height: 64rpx;
  526. color: #FFFFFF;
  527. display: flex;
  528. justify-content: center;
  529. align-items: center;
  530. }
  531. }
  532. }
  533. </style>