...
|
...
|
@@ -343,20 +343,21 @@ |
|
|
},
|
|
|
// 提交按钮
|
|
|
comfim() {
|
|
|
if (this.whereEnter) {// 购物车支付
|
|
|
if (this.whereEnter) { // 购物车支付
|
|
|
let join = !!this.joinValue ? 3 : 0; // 入会
|
|
|
let look = !!this.lookValue ? 2 : 0; // 关注
|
|
|
let cheapActive = !!this.cheapActive ? 1: 0; // 优惠券
|
|
|
console.log(join,look,cheapActive);
|
|
|
let cheapActive = !!this.cheapActive ? 1 : 0; // 优惠券
|
|
|
console.log(join, look, cheapActive);
|
|
|
let alreadyMake = []; // 用户已选择的
|
|
|
let userCheap = '';
|
|
|
// 获取用户已选择优惠券
|
|
|
this.cheapList.forEach(item =>{
|
|
|
if(((item.category == join) || (item.category == look)) && (item.status == 1)){
|
|
|
this.cheapList.forEach(item => {
|
|
|
if (((item.category == join) || (item.category == look)) && (item.status == 1)) {
|
|
|
alreadyMake.push(item);
|
|
|
}else if((item.category == cheapActive) && (item.status == 1) && (!userCheap)){
|
|
|
this.cheapList.forEach(ite =>{
|
|
|
if((ite.price == this.cheapActive) && (!userCheap) && (ite.category == cheapActive) && (item.status == 1)){
|
|
|
} else if ((item.category == cheapActive) && (item.status == 1) && (!userCheap)) {
|
|
|
this.cheapList.forEach(ite => {
|
|
|
if ((ite.price == this.cheapActive) && (!userCheap) && (ite.category ==
|
|
|
cheapActive) && (item.status == 1)) {
|
|
|
userCheap = ite;
|
|
|
alreadyMake.push(userCheap);
|
|
|
return
|
...
|
...
|
@@ -365,7 +366,7 @@ |
|
|
}
|
|
|
})
|
|
|
//获取用户已选择优惠券 id
|
|
|
let coupon_id = (alreadyMake.map(item =>{
|
|
|
let coupon_id = (alreadyMake.map(item => {
|
|
|
return item.id
|
|
|
})).join(',')
|
|
|
// 调用支付接口,获取支付所需信息
|
...
|
...
|
@@ -379,9 +380,34 @@ |
|
|
uni.getStorageSync('token')
|
|
|
this.$rqs('/api/cart/pay', data).then(res => {
|
|
|
console.log(res);
|
|
|
});
|
|
|
} else {// 商品详情支付
|
|
|
|
|
|
|
|
|
if (res.data) {
|
|
|
WeixinJSBridge.invoke(
|
|
|
'getBrandWCPayRequest', {
|
|
|
"appId": res.data.appId, //公众号ID,由商户传入
|
|
|
"timeStamp": res.data.timeStamp, //时间戳,自1970年以来的秒数
|
|
|
"nonceStr": res.data.nonceStr, //随机串
|
|
|
"package": res.data.package,
|
|
|
"signType": res.data.signType, //微信签名方式:
|
|
|
"paySign": res.data.paySign //微信签名
|
|
|
},
|
|
|
function(re) {
|
|
|
if (re.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
console.log(re);
|
|
|
// 使用以上方式判断前端返回,微信团队郑重提示:
|
|
|
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.data.message,
|
|
|
icon: 'none',
|
|
|
duration: 1000
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
} else { // 商品详情支付
|
|
|
|
|
|
}
|
|
|
uni.showToast({
|
|
|
title: '请选择收货地址',
|
...
|
...
|
|