|
@@ -11,20 +11,21 @@
|
|
|
<view class="checkbox-box">
|
|
|
<button class="checkbox iconfont" :class="[pros.checked ?'icon-gouxuanl':'icon-weigouxuan']"></button>
|
|
|
</view>
|
|
|
- <view class="pros-img"><image :src="pros.mainImage ? pros.mainImage:''" alt="" /></view>
|
|
|
+ <view class="pros-img"><image :src="pros.productImage ? pros.productImage:''" alt="" /></view>
|
|
|
<view class="pros-product">
|
|
|
<view class="producttitle">{{pros.name}}</view>
|
|
|
<view class="productspec">规格:{{pros.productUnit ? pros.productUnit : ''}}</view>
|
|
|
- <view class="productspec">商品编码:{{pros.productCode ? pros.productCode : ''}}</view>
|
|
|
+ <view class="productspec">商品编码:{{pros.productNo ? pros.productNo : ''}}</view>
|
|
|
<view class="product-view">
|
|
|
- <view class="view-num">数量:{{pros.num}}</view>
|
|
|
+ <view class="view-num">数量:{{pros.num+pros.presentNum}}</view>
|
|
|
</view>
|
|
|
<view class="product-view">
|
|
|
- <view class="view-num">已发货:{{pros.taxRate}}</view>
|
|
|
- <view class="view-num">未发货:{{pros.discount == null ? '0' : pros.discount}}</view>
|
|
|
+ <view class="view-num">已发货:{{pros.shipmentsNum}}</view>
|
|
|
+ <view class="view-num">未发货:{{pros.notOutStore-pros.actualCancelNum}}</view>
|
|
|
</view>
|
|
|
<view class="product-view">
|
|
|
- <view class="view-num">已退货:{{pros.discountPrice}}</view>
|
|
|
+ <view class="view-num">已退货:{{pros.returnedNum}}</view>
|
|
|
+ <view class="view-num">已取消:{{pros.actualCancelNum}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -33,9 +34,9 @@
|
|
|
<view class="text">本次发货</view>
|
|
|
<view class="count">
|
|
|
<view class="number-box">
|
|
|
- <view class="iconfont icon-jianhao" :class="[pros.validFlag == '3'?'disabled':'']" @click="changeCountSub(pros)"></view>
|
|
|
- <input class="btn-input" type="number" maxlength='4' v-model="pros.productCount" @blur="changeNnmber($event,pros)">
|
|
|
- <view class="iconfont icon-jiahao" :class="[pros.validFlag == '3'?'disabled':'']" @click="changeCountAdd(pros)"></view>
|
|
|
+ <view class="iconfont icon-jianhao" :class="[pros.isReduceNum ? 'disabled':'']" @click="changeCountSub(pros)"></view>
|
|
|
+ <input class="btn-input" type="number" maxlength='4' v-model="pros.shipmentCount" @blur="changeNnmber($event,pros)">
|
|
|
+ <view class="iconfont icon-jiahao" :class="[pros.isPlusNum ?'disabled':'']" @click="changeCountAdd(pros)"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -62,7 +63,6 @@
|
|
|
<script>
|
|
|
import authorize from '@/common/config/authorize.js'
|
|
|
import { mapState,mapMutations } from 'vuex';
|
|
|
- import { queryShoppingCartList,shoppingCartUpdate,shoppingCartDelete } from "@/api/cart.js"
|
|
|
|
|
|
export default{
|
|
|
data(){
|
|
@@ -70,36 +70,10 @@
|
|
|
CustomBar:this.CustomBar,// 顶部导航栏高度
|
|
|
isIphoneX:this.$store.state.isIphoneX,
|
|
|
userID:'',
|
|
|
+ shopOrderId:'',
|
|
|
alertType:'',
|
|
|
- isStock:'',
|
|
|
- productsList:[
|
|
|
- {
|
|
|
- mainImage:'https://img14.360buyimg.com/n7/jfs/t1/114670/38/7458/171560/5ec3b80fE5c5f15f9/549ceeeca82f0d02.jpg',
|
|
|
- name:'华西生物奥斯卡等级阿奥术大师大所打撒大啊萨达时代萨德',
|
|
|
- productUnit:'盒',
|
|
|
- productCode:'FXSW2131231231',
|
|
|
- num:20,
|
|
|
- taxRate:5,
|
|
|
- discount:5,
|
|
|
- discountPrice:3,
|
|
|
- productCount:6,
|
|
|
- price:'200.00',
|
|
|
- checked:false
|
|
|
- },{
|
|
|
- mainImage:'https://img14.360buyimg.com/n7/jfs/t1/114670/38/7458/171560/5ec3b80fE5c5f15f9/549ceeeca82f0d02.jpg',
|
|
|
- name:'华西生物奥斯卡等级阿奥术大师大所打撒大啊萨达时代萨德',
|
|
|
- productUnit:'盒',
|
|
|
- productCode:'FXSW2131231231',
|
|
|
- num:20,
|
|
|
- taxRate:5,
|
|
|
- discount:5,
|
|
|
- productCount:6,
|
|
|
- discountPrice:3,
|
|
|
- price:'200.00',
|
|
|
- checked:false
|
|
|
- }
|
|
|
- ], //购物车的商品
|
|
|
- setGoodData:'', //确认订单的商品
|
|
|
+ productsList:[],//发货的商品
|
|
|
+ setGoodData:'', //提交发货的商品
|
|
|
isCheckAll:false,//是否全选
|
|
|
isModallayer:false,
|
|
|
isDisabled: false, // 供应商/店铺全选是否禁用状态
|
|
@@ -108,34 +82,39 @@
|
|
|
},
|
|
|
onLoad(option){
|
|
|
console.log(option)
|
|
|
- // this.initGetCartGoodsList();
|
|
|
+ this.shopOrderId = option.shopOrderId
|
|
|
+ this.initShopOrderShipmentsInfo();
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['hasLogin','userInfo'])
|
|
|
},
|
|
|
methods:{
|
|
|
- initGetCartGoodsList(){//初始化购物车 index:1
|
|
|
- let params = {userID:this.userID}
|
|
|
- queryShoppingCartList(params).then(response =>{
|
|
|
- this.$store.commit('updateAllNum',response.data.cartQuantity)
|
|
|
- const responseData = response.data
|
|
|
- if(responseData.pageDate && responseData.pageDate.length > 0 ){
|
|
|
- this.productsList = responseData.pageDate;
|
|
|
- this.productsList.forEach((item,index) => {
|
|
|
- let productsListLength = item.productsList.length,
|
|
|
- invalidLength = 0;
|
|
|
- item.productsList.forEach(pros => {
|
|
|
- pros.shopID = item.shopID;
|
|
|
- if(pros.validFlag == '3' ) {invalidLength++;}
|
|
|
- })
|
|
|
- item.isDisabled = invalidLength === productsListLength;
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.productsList = [];
|
|
|
- }
|
|
|
+ initShopOrderShipmentsInfo(){//初始化购物车 index:1
|
|
|
+ this.ShopService.ShopOrderShipmentsInfo({ shopOrderId : this.shopOrderId }).then(response =>{
|
|
|
+ let orderProductList = response.data.orderProductList
|
|
|
+ let elObject = {}
|
|
|
+ let isReduceNum = false
|
|
|
+ let creatProductList = []
|
|
|
+ orderProductList.forEach(el =>{
|
|
|
+ let uninNum = el.notOutStore - el.actualCancelNum//未发货数量
|
|
|
+ if(uninNum == 1){
|
|
|
+ isReduceNum = true
|
|
|
+ }else{
|
|
|
+ isReduceNum = false
|
|
|
+ }
|
|
|
+ elObject = {
|
|
|
+ shipmentCount:uninNum,
|
|
|
+ isReduceNum:isReduceNum,
|
|
|
+ checked:false
|
|
|
+ }
|
|
|
+ creatProductList.push(Object.assign({},el,elObject))
|
|
|
+ })
|
|
|
+ this.productsList = creatProductList
|
|
|
+ console.log(this.productsList)
|
|
|
}).catch(error =>{
|
|
|
this.$util.msg(error.msg,2000);
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
ischeck(pro){//为未选中的时候改变为true,反之为true
|
|
|
pro.checked = !pro.checked;
|
|
@@ -158,102 +137,57 @@
|
|
|
this.isCheckAll = !this.isCheckAll;
|
|
|
this.updateBothCheckBtn();
|
|
|
},
|
|
|
- changeCountAdd(item,pros){//商品数量加加
|
|
|
- if(pros.productCount == pros.stock){
|
|
|
- pros.productCount= pros.stock
|
|
|
- this.isStock =true
|
|
|
+ changeCountAdd(pros){//商品数量加加
|
|
|
+ let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
|
|
|
+ if(pros.shipmentCount == uninNum){
|
|
|
+ this.isNoneNum =true
|
|
|
return
|
|
|
}else{
|
|
|
- pros.productCount++
|
|
|
- this.isStock =false
|
|
|
+ pros.shipmentCount++
|
|
|
+ this.isNoneNum =false
|
|
|
}
|
|
|
- this.updateShoppogNum(pros)
|
|
|
- this.totalShopPeice();
|
|
|
},
|
|
|
- changeCountSub(item,pros){//商品数量减减
|
|
|
- if(pros.productCount<=pros.minBuyNumber){
|
|
|
- pros.productCount= pros.minBuyNumber
|
|
|
- this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`,2000);
|
|
|
+ changeCountSub(pros){//商品数量减减
|
|
|
+ let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
|
|
|
+ if(pros.shipmentCount == 1){
|
|
|
+ pros.shipmentCount = pros.shipmentCount
|
|
|
return
|
|
|
}else{
|
|
|
- pros.productCount--
|
|
|
+ pros.shipmentCount--
|
|
|
}
|
|
|
- this.updateShoppogNum(pros)
|
|
|
- this.totalShopPeice();
|
|
|
},
|
|
|
changeNnmber(e,pros){//输入商品数量更新
|
|
|
+ let uninNum = pros.notOutStore-pros.actualCancelNum//未发货数量
|
|
|
let _value = e.detail.value;
|
|
|
- if(!this.$api.isNumber(_value)){
|
|
|
- pros.productCount = pros.minBuyNumber
|
|
|
- }else if(_value < pros.minBuyNumber){
|
|
|
- this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`,2000);
|
|
|
- pros.productCount = pros.minBuyNumber
|
|
|
+ if(!this.$api.isNumber(_value) || uninNum == 1){
|
|
|
+ pros.shipmentCount = uninNum
|
|
|
+ }else if(_value > uninNum){
|
|
|
+ pros.shipmentCount = uninNum
|
|
|
}else{
|
|
|
- pros.productCount = e.detail.value
|
|
|
+ pros.shipmentCount = e.detail.value
|
|
|
}
|
|
|
- this.updateShoppogNum(pros)
|
|
|
- this.totalShopPeice();
|
|
|
},
|
|
|
- updateShoppogNum(pros){//加减购物车商品更新到后台
|
|
|
- let params ={userID:this.userID,productID:pros.productID,productCount:pros.productCount}
|
|
|
- shoppingCartUpdate(params).then(response =>{
|
|
|
- this.isshowDelbtn = false;
|
|
|
- this.initGetCartGoodsList();
|
|
|
- }).catch(error =>{
|
|
|
- this.$util.msg(error.msg,2000);
|
|
|
- })
|
|
|
- },
|
|
|
toConfirmDeliver(){//添加物流页面
|
|
|
- this.$api.navigateTo(`/supplier/pages/deliver/add-logistics`)
|
|
|
- return
|
|
|
- let setGoodsList=[];
|
|
|
- this.goodsList.forEach(res=>{
|
|
|
- let products = res.productsList
|
|
|
- products.forEach(pros=>{
|
|
|
- if(pros.productsChecked){
|
|
|
- setGoodsList.push(pros.productID)
|
|
|
+ let setProductList=[];
|
|
|
+ this.productsList.forEach(el=>{
|
|
|
+ if(el.checked){
|
|
|
+ let elObject = {
|
|
|
+ orderProductId:el.orderProductID.toString(),
|
|
|
+ num:el.shipmentCount.toString()
|
|
|
}
|
|
|
- })
|
|
|
+ setProductList.push(elObject)
|
|
|
+ }
|
|
|
})
|
|
|
- if(setGoodsList == ''){
|
|
|
- this.$util.msg("请先选择结算商品~",2000);
|
|
|
+ if(setProductList == ''){
|
|
|
+ this.$util.msg("请先选择商品~",2000);
|
|
|
return
|
|
|
}else{
|
|
|
- this.isNoConfim = false
|
|
|
- this.goodsList.forEach(el=>{
|
|
|
- el.productsList.forEach(pros=>{
|
|
|
- if(pros.productsChecked){
|
|
|
- if(pros.productCount<pros.minBuyNumber){
|
|
|
- this.isNoConfim = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- if(this.isNoConfim){
|
|
|
- this.$util.modal('','有商品的购买量没达到最小起订量,请修改数量后再次提交结算','去修改','',false,() =>{})
|
|
|
- return;
|
|
|
- }else{
|
|
|
- let productID = '';
|
|
|
- this.goodsList.forEach(el=>{//获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
|
|
|
- el.productsList.forEach(pros=>{
|
|
|
- if(pros.productsChecked){
|
|
|
- productID += pros.productID+','
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- let cartPramsData={
|
|
|
- allPrice:this.allPrice,
|
|
|
- allCount:this.allCount,
|
|
|
- productID:productID.substring(0,productID.lastIndexOf(',')),
|
|
|
- productCount:''
|
|
|
- }
|
|
|
- this.$api.navigateTo(`/pages/user/order/create-order?data=${JSON.stringify({data:cartPramsData})}`)
|
|
|
- }
|
|
|
+ this.$api.navigateTo(`/supplier/pages/deliver/add-logistics?shopOrderId=${this.shopOrderId}&data=${JSON.stringify(setProductList)}`)
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
onPullDownRefresh() {//下拉刷新
|
|
|
- // this.initGetCartGoodsList()
|
|
|
+ // this.initShopOrderShipmentsInfo()
|
|
|
// uni.stopPullDownRefresh()
|
|
|
},
|
|
|
onShow(){
|
|
@@ -385,6 +319,9 @@
|
|
|
text-align: center;
|
|
|
line-height: 48rpx;
|
|
|
font-weight: bold;
|
|
|
+ &.disabled{
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
}
|
|
|
.btn-input{
|
|
|
width: 62rpx;
|