|
|
@ -46,7 +46,7 @@ |
|
|
|
<view class="pickpoint"> |
|
|
|
<view class="flex-shrink-0">自提点</view> |
|
|
|
<view class="pickpointAddress"> |
|
|
|
<view class="pointAddressText text-overflow">{{info.pickupAddress.extract_name||'选择提货地址'}}</view> |
|
|
|
<view class="pointAddressText text-overflow">{{info.pickupAddress.title||'选择提货地址'}}</view> |
|
|
|
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -97,7 +97,7 @@ |
|
|
|
<view class="tickets-box flex-between"> |
|
|
|
<view class="remark"> |
|
|
|
<view class="remark-title" >订单备注:</view> |
|
|
|
<input style="z-index:0;text-align: right;" type="text" placeholder="选填" v-model="remark" maxlength="50"/> |
|
|
|
<input style="z-index:0;text-align: right;" type="text" placeholder="选填" v-model="info.remark" maxlength="50"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -196,7 +196,6 @@ export default { |
|
|
|
post: 0, |
|
|
|
flag: true, |
|
|
|
|
|
|
|
remark: '', |
|
|
|
coupon: "", |
|
|
|
allprice: 0, |
|
|
|
|
|
|
@ -251,6 +250,7 @@ export default { |
|
|
|
v.pickupAddress = {} // 自提信息 |
|
|
|
v.contacts = null // 收货地址 |
|
|
|
v.post = null // 运费信息 |
|
|
|
v.remark = "" |
|
|
|
}) |
|
|
|
|
|
|
|
this.orderList = orderList |
|
|
@ -261,6 +261,7 @@ export default { |
|
|
|
changeUserPost (item,value) { |
|
|
|
console.log(item) |
|
|
|
item.is_user_post = value |
|
|
|
this.getPost() |
|
|
|
}, |
|
|
|
|
|
|
|
goOrderCoupon () { |
|
|
@ -308,32 +309,32 @@ export default { |
|
|
|
}); |
|
|
|
}, |
|
|
|
getPost() { |
|
|
|
let _this = this |
|
|
|
let tempList = [] |
|
|
|
this.orderList.forEach(v=>{ |
|
|
|
if( v.sInfo.contacts && v.is_user_post == 1) { |
|
|
|
if( v.contacts && v.is_user_post == 1) { |
|
|
|
tempList.push(v) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
let param = [] |
|
|
|
tempList.forEach(v=>{ |
|
|
|
param.push({specifications_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) |
|
|
|
param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) |
|
|
|
}) |
|
|
|
|
|
|
|
let data = JSON.stringify(param); |
|
|
|
// console.log(data); |
|
|
|
this.flag = false; |
|
|
|
this.Post({ data: data }, '/api/order/getNewPost').then(res => { |
|
|
|
|
|
|
|
Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{ |
|
|
|
if (res) { |
|
|
|
console.log("promise" ,res) |
|
|
|
for(let i=0;i<tempList.length;i++) { |
|
|
|
tempList[i].post = res.data[i].price; |
|
|
|
tempList[i].post = res[i].data.price; |
|
|
|
} |
|
|
|
this.flag = true; |
|
|
|
|
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err,'aaaaaaa'); |
|
|
|
this.flag = true; |
|
|
|
}); |
|
|
|
}).finally(()=>{this.flag = true;}) |
|
|
|
}, |
|
|
|
|
|
|
|
plus(sku) { |
|
|
@ -374,7 +375,7 @@ export default { |
|
|
|
this.selectInfo.contacts = item |
|
|
|
|
|
|
|
if (this.flag) { |
|
|
|
// this.getPost(); |
|
|
|
this.getPost(); |
|
|
|
} |
|
|
|
this.$refs.addressPopup.close(); |
|
|
|
}, |
|
|
@ -443,57 +444,52 @@ export default { |
|
|
|
}, |
|
|
|
// 预定 |
|
|
|
order() { |
|
|
|
if (this.info.is_user_post == 1 || this.info.is_user_post == 3) { |
|
|
|
console.log(this.info.is_user_post) |
|
|
|
if (this.info.is_user_post == 1 && !this.contacts) { |
|
|
|
uni.showToast({ |
|
|
|
title: '请选择收货地址', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
return; |
|
|
|
let goods = []; |
|
|
|
for(let info of this.orderList) { |
|
|
|
let param = { |
|
|
|
type: info.pInfo.type, |
|
|
|
product_id: info.pInfo.id, |
|
|
|
sku_id: info.sInfo.id, |
|
|
|
product_num: info.sInfo.buyNum, |
|
|
|
remark: info.remark |
|
|
|
} |
|
|
|
|
|
|
|
if (this.info.is_user_post == 2) { |
|
|
|
if (info.is_user_post == 1) { |
|
|
|
if(!info.contacts) { |
|
|
|
uni.showToast({ |
|
|
|
title: '请选择收货地址', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
param.use_type = 1 |
|
|
|
param.post = info.contacts.id |
|
|
|
} |
|
|
|
} |
|
|
|
if (info.is_user_post == 2) { |
|
|
|
if (!this.pickupAddress.id) { |
|
|
|
uni.showToast({title: '请选择自提点',icon: 'none'}); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
param.use_type = 2 |
|
|
|
param.pickup_shop_id = info.pickupAddress.id |
|
|
|
param.pickup_shop_info = info.pickupAddress |
|
|
|
} |
|
|
|
} |
|
|
|
goods.push(param) |
|
|
|
} |
|
|
|
|
|
|
|
let goods = []; |
|
|
|
this.info.goods.forEach(v=>{ |
|
|
|
let goodsItem = { |
|
|
|
specifications_id: v.skuInfo.id, |
|
|
|
num: v.skuInfo.buyNum, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (this.info.is_user_post == 2) { |
|
|
|
goodsItem.extract_id = this.pickupAddress.id; |
|
|
|
} else if (this.info.is_user_post == 1){ |
|
|
|
goodsItem.consignee_id = this.contacts.id |
|
|
|
} |
|
|
|
goods.push(goodsItem); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let data = { |
|
|
|
goods: goods, |
|
|
|
coupon: this.coupon ? this.coupon.id : "", |
|
|
|
remark: this.remark, |
|
|
|
is_post: this.info.is_user_post, |
|
|
|
product_list: goods, |
|
|
|
coupon_id: this.coupon ? this.coupon.id : null, |
|
|
|
}; |
|
|
|
this.Post( |
|
|
|
{ |
|
|
|
method: 'POST', |
|
|
|
data: JSON.stringify(data) |
|
|
|
}, |
|
|
|
'/api/order/place' |
|
|
|
'/api/order/create' |
|
|
|
).then(res => { |
|
|
|
uni.removeStorageSync('teChanOrder') |
|
|
|
uni.removeStorageSync('teChanInfo') |
|
|
|
if (res.code == 1) { |
|
|
|
this.Post( |
|
|
|
{ |
|
|
@ -532,7 +528,8 @@ export default { |
|
|
|
|
|
|
|
getDataByConnect(data) { |
|
|
|
if (data.msgType == "updatePickUpPoint") { |
|
|
|
let tempData = this.orderList.find(v=>v.sInfo.id == data.data.goodsId) |
|
|
|
let tempData = this.orderList.find(v=>v.pInfo.id == data.data.pInfoId) |
|
|
|
console.log(tempData) |
|
|
|
if (tempData) { |
|
|
|
tempData.pickupAddress = data.data.selectItem |
|
|
|
} |
|
|
|