deliver-goods.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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. },
  87. computed: {
  88. ...mapState(['hasLogin','userInfo'])
  89. },
  90. methods:{
  91. initShopOrderShipmentsInfo(){//初始化
  92. this.ShopService.ShopOrderShipmentsInfo({ shopOrderId : this.shopOrderId }).then(response =>{
  93. if( response.data.orderProductList.length>0){
  94. let orderProductList = response.data.orderProductList
  95. let elObject = {}
  96. let isReduceNum = false
  97. let creatProductList = []
  98. this.isEmpty = false
  99. orderProductList.forEach(el =>{
  100. let uninNum = el.notOutStore - el.actualCancelNum//未发货数量
  101. if(uninNum == 1){
  102. isReduceNum = true
  103. }else{
  104. isReduceNum = false
  105. }
  106. elObject = {
  107. shipmentCount:uninNum,
  108. isReduceNum:isReduceNum,
  109. checked:false
  110. }
  111. creatProductList.push(Object.assign({},el,elObject))
  112. })
  113. this.productsList = creatProductList
  114. console.log(this.productsList)
  115. }else{
  116. this.isEmpty = true
  117. }
  118. }).catch(error =>{
  119. this.$util.msg(error.msg,2000);
  120. })
  121. },
  122. setScrollHeight() {
  123. const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
  124. this.windowHeight = windowHeight - 1;
  125. this.scrollHeight = windowHeight - 1;
  126. },
  127. ischeck(pro){//为未选中的时候改变为true,反之为true
  128. pro.checked = !pro.checked;
  129. this.updateCheckAllBtn();
  130. },
  131. updateCheckAllBtn() {// 全选勾选判断
  132. let goodsCheckedLength = 0,
  133. productsList = this.productsList;
  134. productsList.forEach(item => {
  135. if(item.checked) { goodsCheckedLength++; }
  136. })
  137. this.isCheckAll = goodsCheckedLength === productsList.length;
  138. },
  139. updateBothCheckBtn() {//
  140. this.productsList.forEach((item)=>{
  141. item.checked = this.isCheckAll ;
  142. })
  143. },
  144. checkAll(){//全选方法内调用方法
  145. this.isCheckAll = !this.isCheckAll;
  146. this.updateBothCheckBtn();
  147. },
  148. changeCountAdd(pros){//商品数量加加
  149. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  150. if(pros.shipmentCount == uninNum){
  151. this.isNoneNum =true
  152. return
  153. }else{
  154. pros.shipmentCount++
  155. this.isNoneNum =false
  156. }
  157. },
  158. changeCountSub(pros){//商品数量减减
  159. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  160. if(pros.shipmentCount == 1){
  161. pros.shipmentCount = pros.shipmentCount
  162. return
  163. }else{
  164. pros.shipmentCount--
  165. }
  166. },
  167. changeNnmber(e,pros){//输入商品数量更新
  168. let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
  169. let _value = e.detail.value;
  170. if(!this.$api.isNumber(_value) || uninNum == 1){
  171. pros.shipmentCount = uninNum
  172. }else if(_value > uninNum){
  173. pros.shipmentCount = uninNum
  174. }else{
  175. pros.shipmentCount = e.detail.value
  176. }
  177. },
  178. toConfirmDeliver(){//添加物流页面
  179. let setProductList=[];
  180. this.productsList.forEach(el=>{
  181. if(el.checked){
  182. let elObject = {
  183. orderProductId:el.orderProductID.toString(),
  184. num:el.shipmentCount.toString()
  185. }
  186. setProductList.push(elObject)
  187. }
  188. })
  189. if(setProductList == ''){
  190. this.$util.msg("请先选择商品~",2000);
  191. return
  192. }else{
  193. this.$api.navigateTo(`/supplier/pages/deliver/add-logistics?type=add&shopOrderId=${this.shopOrderId}&data=${JSON.stringify(setProductList)}`)
  194. }
  195. },
  196. },
  197. onPullDownRefresh() {//下拉刷新
  198. this.initShopOrderShipmentsInfo()
  199. uni.stopPullDownRefresh()
  200. },
  201. onShow(){
  202. this.shopOrderId = uni.getStorageSync('shopOrderId')
  203. this.setScrollHeight()
  204. this.initShopOrderShipmentsInfo();
  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 20rpx;
  361. color: $text-color;
  362. text-align: center;
  363. line-height: 48rpx;
  364. font-weight: bold;
  365. &.disabled{
  366. color: #999999;
  367. }
  368. }
  369. .btn-input{
  370. width: 62rpx;
  371. height: 48rpx;
  372. line-height: 48rpx;
  373. background: #F8F8F8;
  374. border-radius: 4rpx;
  375. text-align: center;
  376. font-size: $font-size-24;
  377. }
  378. }
  379. .uni-numbox{
  380. position: absolute;
  381. left: 45rpx;
  382. bottom: 0;
  383. .uni-numbox-minus, .uni-numbox-plus{
  384. width: 50rpx;
  385. line-height: 40rpx;
  386. }
  387. .uni-numbox-value {
  388. font-size: $font-size-28;
  389. width: 60rpx;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .pros-product{
  396. width: 402rpx;
  397. height: 100%;
  398. line-height: 36rpx;
  399. font-size: $font-size-28;
  400. position: relative;
  401. .producttitle{
  402. width: 100%;
  403. display: inline-block;
  404. height: auto;
  405. text-overflow:ellipsis;
  406. display: -webkit-box;
  407. word-break: break-all;
  408. -webkit-box-orient: vertical;
  409. -webkit-line-clamp: 2;
  410. overflow: hidden;
  411. margin-bottom: 8rpx;
  412. }
  413. .productspec{
  414. height: 44rpx;
  415. color: #999999;
  416. line-height: 44rpx;
  417. font-size: $font-size-26;
  418. }
  419. .product-view{
  420. width: 100%;
  421. height: auto;
  422. display: flex;
  423. .view-num{
  424. flex: 1;
  425. text-align: left;
  426. font-size: $font-size-26;
  427. color: #666666;
  428. line-height: 44rpx;
  429. }
  430. }
  431. }
  432. }
  433. .footer{
  434. width: 100%;
  435. background-color: #FFFFFF;
  436. height: 110rpx;
  437. position: fixed;
  438. bottom: 0rpx;
  439. z-index: 100;
  440. .footer-le{
  441. width: 490rpx;
  442. height: 100%;
  443. padding:0 30rpx;
  444. float: left;
  445. .text{
  446. font-weight: bold;
  447. }
  448. .foot-check{
  449. width: 100rpx;
  450. float: left;
  451. line-height: 110rpx;
  452. font-size: $font-size-24;
  453. .checkbox{
  454. width: 40rpx;
  455. text-align: center;
  456. }
  457. .text{
  458. width: 60rpx;
  459. float: right;
  460. }
  461. }
  462. .foot-check-delbtn{
  463. float: left;
  464. .delBtn{
  465. margin: 0;
  466. padding: 0;
  467. display: flex;
  468. flex-direction: column;
  469. align-items: center;
  470. box-sizing: border-box;
  471. font-size: $font-size-24;
  472. text-align: center;
  473. text-decoration: none;
  474. border-radius: 0;
  475. -webkit-tap-highlight-color: transparent;
  476. overflow: hidden;
  477. background-color:#FFFFFF;
  478. color: #FF2A2A;
  479. padding: 0 24rpx;
  480. display: flex;
  481. justify-content: center;
  482. align-items: center;
  483. line-height: 110rpx;
  484. font-weight: bold;
  485. &.none{
  486. display: none;
  487. }
  488. }
  489. }
  490. .sum{
  491. font-size: $font-size-28;
  492. line-height: 110rpx;
  493. color: $text-color;
  494. display: flex;
  495. justify-content: flex-end;
  496. .money{
  497. color: #FF2A2A;
  498. }
  499. .money-sign{
  500. font-size: $font-size-24;
  501. color: #FF2A2A;
  502. }
  503. }
  504. }
  505. .footer-ri{
  506. width: 200rpx;
  507. height: 100%;
  508. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  509. float: right;
  510. display: flex;
  511. justify-content: space-between;
  512. align-items: center;
  513. z-index: 999;
  514. &.none{
  515. display: none;
  516. }
  517. .btn{
  518. width: 200rpx;
  519. height: 100%;
  520. font-size: $font-size-28;
  521. line-height: 110rpx;
  522. color: #FFFFFF;
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. }
  527. }
  528. }
  529. </style>