|
@ -96,8 +96,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="commodity-info"> |
|
|
<view class="commodity-info"> |
|
|
<view class="text-overflowRows" |
|
|
<view class="text-overflowRows" style="width: 90%" |
|
|
style="width: 90%;" |
|
|
|
|
|
>{{ sku.specValueOne }}-{{ sku.specValueTwo }}</view |
|
|
>{{ sku.specValueOne }}-{{ sku.specValueTwo }}</view |
|
|
> |
|
|
> |
|
|
<view class="commodity-num"> x{{ sku.quantity }} </view> |
|
|
<view class="commodity-num"> x{{ sku.quantity }} </view> |
|
@ -170,7 +169,9 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class="price-detail"> |
|
|
<view class="price-detail"> |
|
|
<view class="text">运费:</view> |
|
|
<view class="text">运费:</view> |
|
|
<view class="price">包邮</view> |
|
|
<view class="price">{{ |
|
|
|
|
|
post > 0 ? "¥" + post.toFixed(2) : "包邮" |
|
|
|
|
|
}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="price-detail" v-if="usePoints > 0"> |
|
|
<view class="price-detail" v-if="usePoints > 0"> |
|
|
<view class="text">积分抵扣:</view> |
|
|
<view class="text">积分抵扣:</view> |
|
@ -475,7 +476,7 @@ export default { |
|
|
// 获取总积分 |
|
|
// 获取总积分 |
|
|
async getTotalPoints() { |
|
|
async getTotalPoints() { |
|
|
try { |
|
|
try { |
|
|
if(!uni.getStorageSync("userInfo") )return |
|
|
if (!uni.getStorageSync("userInfo")) return; |
|
|
this.Post({}, "/framework/points/getLastBalance", "DES").then((res) => { |
|
|
this.Post({}, "/framework/points/getLastBalance", "DES").then((res) => { |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
this.userPoints = res.data.balance || 0; |
|
|
this.userPoints = res.data.balance || 0; |
|
@ -598,32 +599,9 @@ export default { |
|
|
if (this.info.is_post == 0 || !this.contacts) { |
|
|
if (this.info.is_post == 0 || !this.contacts) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
this.flag = false; |
|
|
|
|
|
|
|
|
|
|
|
let param = []; |
|
|
// 调用新的运费计算方法 |
|
|
this.info.goods.forEach((v) => { |
|
|
this.calculateFreight(); |
|
|
param.push({ |
|
|
|
|
|
specifications_id: v.skuInfo.id, |
|
|
|
|
|
num: v.skuInfo.quantity, |
|
|
|
|
|
consignee_id: this.contacts.id, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
let data = JSON.stringify(param); |
|
|
|
|
|
// console.log(data); |
|
|
|
|
|
this.Post({ data: data }, "/api/order/getNewPost") |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
for (let i = 0; i < this.info.goods.length; i++) { |
|
|
|
|
|
this.info.goods[i].post = res.data[i].post_money; |
|
|
|
|
|
} |
|
|
|
|
|
this.flag = true; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
// console.log(err, "aaaaaaa"); |
|
|
|
|
|
this.flag = true; |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
plus(sku) { |
|
|
plus(sku) { |
|
@ -800,10 +778,56 @@ export default { |
|
|
return "¥" + allPriceYuan.toFixed(2); |
|
|
return "¥" + allPriceYuan.toFixed(2); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 获取总运费(单位:分) |
|
|
// 获取总运费(单位:元) |
|
|
getTotalPost() { |
|
|
getTotalPost() { |
|
|
// 运费暂时设为0 |
|
|
// 如果有计算的运费,则返回运费,否则返回0 |
|
|
return 0; |
|
|
return this.post ? this.post : 0; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 计算运费 |
|
|
|
|
|
calculateFreight() { |
|
|
|
|
|
if (!this.contacts) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.flag = false; |
|
|
|
|
|
|
|
|
|
|
|
// 构建商品数组信息,不根据供应商区分 |
|
|
|
|
|
let shoppingCartBoList = []; |
|
|
|
|
|
this.info.forEach((sku) => { |
|
|
|
|
|
shoppingCartBoList.push({ |
|
|
|
|
|
goodsId: sku.goodsId, |
|
|
|
|
|
specId: sku.specId, |
|
|
|
|
|
quantity: sku.quantity, |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 调用运费计算接口 |
|
|
|
|
|
this.Post( |
|
|
|
|
|
{ |
|
|
|
|
|
shoppingCartBoList: this.info, |
|
|
|
|
|
userContactId: this.contacts.id, |
|
|
|
|
|
method: "POST", |
|
|
|
|
|
}, |
|
|
|
|
|
"/framework/ygOrder/calculateMultiSpecFreight", |
|
|
|
|
|
"DES" |
|
|
|
|
|
) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
if (res && res.code === 200) { |
|
|
|
|
|
this.post = Number(res.data.total) || 0; |
|
|
|
|
|
this.flag = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg || "运费计算失败", |
|
|
|
|
|
icon: "none", |
|
|
|
|
|
}); |
|
|
|
|
|
this.flag = true; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
console.error("运费计算错误:", err); |
|
|
|
|
|
this.flag = true; |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 获取当前订单最大可用积分 |
|
|
// 获取当前订单最大可用积分 |
|
@ -946,7 +970,7 @@ export default { |
|
|
expectedAmount: this.allprice, |
|
|
expectedAmount: this.allprice, |
|
|
usePoints: this.usePoints ? 0 : 1, // 是否使用积分 |
|
|
usePoints: this.usePoints ? 0 : 1, // 是否使用积分 |
|
|
pointsQuantity: parseInt(this.usePoints) || 0, // 使用的积分数量 |
|
|
pointsQuantity: parseInt(this.usePoints) || 0, // 使用的积分数量 |
|
|
shippingFee: 0, |
|
|
shippingFee: this.post || 0, // 使用计算出的运费 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.Post( |
|
|
this.Post( |
|
@ -971,7 +995,7 @@ export default { |
|
|
// title: "订单创建成功", |
|
|
// title: "订单创建成功", |
|
|
// icon: "success", |
|
|
// icon: "success", |
|
|
// }); |
|
|
// }); |
|
|
this.orderPay(res.msg) |
|
|
this.orderPay(res.msg); |
|
|
}, |
|
|
}, |
|
|
onFailure: (data) => { |
|
|
onFailure: (data) => { |
|
|
this.isOrderLoading = false; // 结束加载 |
|
|
this.isOrderLoading = false; // 结束加载 |
|
@ -1006,17 +1030,17 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
orderPay(token){ |
|
|
orderPay(token) { |
|
|
this.Post( |
|
|
this.Post( |
|
|
{ |
|
|
{ |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
orderNo:token, |
|
|
orderNo: token, |
|
|
fromType:1, |
|
|
fromType: 1, |
|
|
payAmount:this.allprice, |
|
|
payAmount: this.allprice, |
|
|
}, |
|
|
}, |
|
|
"/framework/wxPay/submitShopPurOrder", |
|
|
"/framework/wxPay/submitShopPurOrder", |
|
|
"DES" |
|
|
"DES" |
|
|
).then(res =>{ |
|
|
).then((res) => { |
|
|
uni.requestPayment({ |
|
|
uni.requestPayment({ |
|
|
nonceStr: res.data.wxInfo.nonceStr, |
|
|
nonceStr: res.data.wxInfo.nonceStr, |
|
|
package: res.data.wxInfo.package, |
|
|
package: res.data.wxInfo.package, |
|
@ -1025,16 +1049,16 @@ export default { |
|
|
timeStamp: res.data.wxInfo.timeStamp, |
|
|
timeStamp: res.data.wxInfo.timeStamp, |
|
|
success: () => { |
|
|
success: () => { |
|
|
uni.redirectTo({ |
|
|
uni.redirectTo({ |
|
|
url:'/subPackages/haveFeeling/list' |
|
|
url: "/subPackages/haveFeeling/list", |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
fail() { |
|
|
fail() { |
|
|
uni.redirectTo({ |
|
|
uni.redirectTo({ |
|
|
url:'/subPackages/haveFeeling/list' |
|
|
url: "/subPackages/haveFeeling/list", |
|
|
}) |
|
|
}); |
|
|
} |
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// ---------------自提----------------------- |
|
|
// ---------------自提----------------------- |
|
|