|
@@ -52,8 +52,8 @@
|
|
|
<text v-if="selectedObj" style="color: #666666;margin-right: 30rpx;">已选:{{
|
|
<text v-if="selectedObj" style="color: #666666;margin-right: 30rpx;">已选:{{
|
|
|
selectedObj.specValueText }}</text>
|
|
selectedObj.specValueText }}</text>
|
|
|
<text v-else style="color: #999;margin-right: 30rpx;">选择商品</text>
|
|
<text v-else style="color: #999;margin-right: 30rpx;">选择商品</text>
|
|
|
- <span style="position: absolute;right: 0;top: 1rpx;">
|
|
|
|
|
- <image style="width: 28rpx;height: 28rpx;" @click="selectProductShowFun"
|
|
|
|
|
|
|
+ <span style="position: absolute;right: 0;top: -3rpx;">
|
|
|
|
|
+ <image style="width: 35rpx;height: 35rpx;" @click="selectProductShowFun"
|
|
|
src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
|
|
src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
|
|
|
</span>
|
|
</span>
|
|
|
</view>
|
|
</view>
|
|
@@ -66,8 +66,8 @@
|
|
|
style="width: 520rpx;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
style="width: 520rpx;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
{{ defaultAddress.address }}</text>
|
|
{{ defaultAddress.address }}</text>
|
|
|
<text v-else style="color: #999;position: absolute;right: 30rpx;">添加收货地址</text>
|
|
<text v-else style="color: #999;position: absolute;right: 30rpx;">添加收货地址</text>
|
|
|
- <span style="position: absolute;right: 0;top: 1rpx;">
|
|
|
|
|
- <image style="width: 28rpx;height: 28rpx;" @click="addressSelectFun"
|
|
|
|
|
|
|
+ <span style="position: absolute;right: 0;top: -3rpx;">
|
|
|
|
|
+ <image style="width: 35rpx;height: 35rpx;" @click="addressSelectFun"
|
|
|
src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
|
|
src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
|
|
|
</span>
|
|
</span>
|
|
|
</view>
|
|
</view>
|
|
@@ -136,7 +136,8 @@
|
|
|
</u-popup>
|
|
</u-popup>
|
|
|
<u-popup :z-index="999" :show="selectProductShowPopup" mode="bottom" round="10">
|
|
<u-popup :z-index="999" :show="selectProductShowPopup" mode="bottom" round="10">
|
|
|
<SelectProduct :redeemNowBtnDisable="redeemNowBtnDisable" :params="params" ref="selectProductRef"
|
|
<SelectProduct :redeemNowBtnDisable="redeemNowBtnDisable" :params="params" ref="selectProductRef"
|
|
|
- :defaultAddress="defaultAddress" @redeemNowFun="redeemNowFun" @closeSelectProduct="closeSelectProduct">
|
|
|
|
|
|
|
+ :defaultAddress="defaultAddress" @redeemNowFun="redeemNowFun" @getAddrListFun="getAddrListFun"
|
|
|
|
|
+ @closeSelectProduct="closeSelectProduct">
|
|
|
</SelectProduct>
|
|
</SelectProduct>
|
|
|
</u-popup>
|
|
</u-popup>
|
|
|
|
|
|
|
@@ -186,6 +187,7 @@ export default {
|
|
|
addressList: [],
|
|
addressList: [],
|
|
|
dBalance: 0.00,
|
|
dBalance: 0.00,
|
|
|
wxconfig: {},
|
|
wxconfig: {},
|
|
|
|
|
+ orderNo:null,
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -200,8 +202,14 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
|
|
+ console.log(this.selectedAddressId, '666661111111')
|
|
|
|
|
+ if (!this.selectedAddressId) {
|
|
|
|
|
+ this.defaultAddress = null
|
|
|
|
|
+ } else if (!this.defaultAddress) {
|
|
|
|
|
+ this.getAddrListFun(this.selectedAddressId)
|
|
|
|
|
+ }
|
|
|
//选择地址后传回的地址id
|
|
//选择地址后传回的地址id
|
|
|
- if (this.selectedAddressId) {
|
|
|
|
|
|
|
+ if (this.selectedAddressId && this.defaultAddress) {
|
|
|
if (this.selectedAddressId !== this.defaultAddress.id) {
|
|
if (this.selectedAddressId !== this.defaultAddress.id) {
|
|
|
this.defaultAddress = this.addressList.find(item => {
|
|
this.defaultAddress = this.addressList.find(item => {
|
|
|
if (item.id == this.selectedAddressId)
|
|
if (item.id == this.selectedAddressId)
|
|
@@ -229,7 +237,7 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
//查询默认地址
|
|
//查询默认地址
|
|
|
- getAddrListFun() {
|
|
|
|
|
|
|
+ getAddrListFun(selectedAddressId) {
|
|
|
let params = {
|
|
let params = {
|
|
|
current: 1,
|
|
current: 1,
|
|
|
size: 100,
|
|
size: 100,
|
|
@@ -238,10 +246,20 @@ export default {
|
|
|
getAddrList(params).then(res => {
|
|
getAddrList(params).then(res => {
|
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
|
this.addressList = res.data.data
|
|
this.addressList = res.data.data
|
|
|
- this.defaultAddress = res.data.data.find(item => {
|
|
|
|
|
- if (item.type == 1)
|
|
|
|
|
- return item
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (selectedAddressId) {
|
|
|
|
|
+ this.defaultAddress = res.data.data.find(item => {
|
|
|
|
|
+ if (item.id == selectedAddressId)
|
|
|
|
|
+ return item
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.defaultAddress) {
|
|
|
|
|
+ this.defaultAddress = res.data.data.find(item => {
|
|
|
|
|
+ if (item.type == 1)
|
|
|
|
|
+ return item
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -276,16 +294,14 @@ export default {
|
|
|
if (selectPayMeth) this.selectPayMeth = selectPayMeth
|
|
if (selectPayMeth) this.selectPayMeth = selectPayMeth
|
|
|
if (orderRemarks) this.orderRemarks = orderRemarks
|
|
if (orderRemarks) this.orderRemarks = orderRemarks
|
|
|
|
|
|
|
|
- // if (this.remainingTime == 0) {
|
|
|
|
|
- // uni.showToast({
|
|
|
|
|
- // title: '订单已过期',
|
|
|
|
|
- // icon: 'none'
|
|
|
|
|
- // })
|
|
|
|
|
- // return;
|
|
|
|
|
- //
|
|
|
|
|
- // uni.navigateTo({
|
|
|
|
|
- // url: '/points/productDetails/pendingPayment'
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ console.log(this.selectedObj, 'this.selectedObj')
|
|
|
|
|
+ if (!this.defaultAddress) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请选择添加地址',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (this.selectedObj) {
|
|
if (this.selectedObj) {
|
|
|
if (this.selectPayMeth == null) {
|
|
if (this.selectPayMeth == null) {
|
|
@@ -337,6 +353,7 @@ export default {
|
|
|
weixinPay(params) {
|
|
weixinPay(params) {
|
|
|
productOrderCreate(params).then(res => {
|
|
productOrderCreate(params).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
|
|
|
+ this.orderNo = res.data.data
|
|
|
productOrderPay({
|
|
productOrderPay({
|
|
|
orderNo: res.data.data, //订单编号
|
|
orderNo: res.data.data, //订单编号
|
|
|
payType: params.payType, //支付方式:1微信支付 2:余额支付
|
|
payType: params.payType, //支付方式:1微信支付 2:余额支付
|
|
@@ -344,10 +361,10 @@ export default {
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
|
let payConfig = JSON.parse(res.data.data)
|
|
let payConfig = JSON.parse(res.data.data)
|
|
|
- console.log(payConfig,'this.payConfig9999999')
|
|
|
|
|
|
|
+ console.log(payConfig, 'this.payConfig9999999')
|
|
|
getSignature(h5Url).then(res => {
|
|
getSignature(h5Url).then(res => {
|
|
|
this.wxconfig = res.data
|
|
this.wxconfig = res.data
|
|
|
- console.log(this.wxconfig,'this.wxconfig66666')
|
|
|
|
|
|
|
+ console.log(this.wxconfig, 'this.wxconfig66666')
|
|
|
wx.config({
|
|
wx.config({
|
|
|
beta: true,
|
|
beta: true,
|
|
|
debug: false,
|
|
debug: false,
|
|
@@ -370,16 +387,17 @@ export default {
|
|
|
'paySign': payConfig.paySign, // 微信签名
|
|
'paySign': payConfig.paySign, // 微信签名
|
|
|
},
|
|
},
|
|
|
function (res) {
|
|
function (res) {
|
|
|
- console.log(res,'---------------付款')
|
|
|
|
|
|
|
+ console.log(res, '---------------付款')
|
|
|
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
- this.redeemNowBtnDisable = false
|
|
|
|
|
|
|
+
|
|
|
// JSON.stringify(res);
|
|
// JSON.stringify(res);
|
|
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
-
|
|
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
|
|
url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
|
|
|
});
|
|
});
|
|
|
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '已取消支付',
|
|
title: '已取消支付',
|
|
|
icon: 'none'
|
|
icon: 'none'
|
|
@@ -390,15 +408,28 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
alert('付款失败');
|
|
alert('付款失败');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: err,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: err,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -431,15 +462,28 @@ export default {
|
|
|
url: '/points/productDetails/paymentSuccessful'
|
|
url: '/points/productDetails/paymentSuccessful'
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
icon: 'error',
|
|
icon: 'error',
|
|
|
title: res.data.msg,
|
|
title: res.data.msg,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: err,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.redeemNowBtnDisable = false
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: err,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -461,7 +505,7 @@ export default {
|
|
|
//去我的地址页面 /points/productDetails/addressManagement
|
|
//去我的地址页面 /points/productDetails/addressManagement
|
|
|
addressSelectFun() {
|
|
addressSelectFun() {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: `/pages/address/index?selectedAddressId=${this.defaultAddress.id}`
|
|
|
|
|
|
|
+ url: `/pages/address/index?selectedAddressId=${this.defaultAddress ? this.defaultAddress.id : null}`
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -610,6 +654,7 @@ export default {
|
|
|
margin-top: 32rpx;
|
|
margin-top: 32rpx;
|
|
|
position: relative;
|
|
position: relative;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.addressTextClass {
|
|
.addressTextClass {
|