deliver-goods.vue 12 KB

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