deliver-goods.vue 13 KB

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