支付宝优化更新
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
</view>
|
||||
<view class="">
|
||||
<u-radio-group v-model="radiovalue1" iconPlacement="right" :size="28" placement="column">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-radio activeColor="#ffd158" name="1">
|
||||
<view class="dfs">
|
||||
<image style="width:44rpx;height:44rpx"
|
||||
@@ -65,7 +66,20 @@
|
||||
</text>
|
||||
</view>
|
||||
</u-radio>
|
||||
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;"
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<u-radio activeColor="#ffd158" name="1">
|
||||
<view class="dfs">
|
||||
<image style="width:44rpx;height:44rpx"
|
||||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png" mode="aspectFill" />
|
||||
<text style="font-size: 28rpx;margin-left: 16rpx;">
|
||||
支付宝支付
|
||||
</text>
|
||||
</view>
|
||||
</u-radio>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- <view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;"
|
||||
v-if="info.isUseVip==1"> </view>
|
||||
<u-radio activeColor="#ffd158" name="2" v-if="info.isUseVip==1">
|
||||
<view class="dfs">
|
||||
@@ -75,7 +89,7 @@
|
||||
<text style="font-size: 28rpx;margin-left: 16rpx;">
|
||||
余额支付</text>
|
||||
</view>
|
||||
</u-radio>
|
||||
</u-radio> -->
|
||||
</u-radio-group>
|
||||
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;"
|
||||
v-if="info.isUseVip==1">
|
||||
@@ -98,7 +112,7 @@
|
||||
</view>
|
||||
<button class="btnStyle" @click="fangdouevent">提交订单</button>
|
||||
</view>
|
||||
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
|
||||
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-if="ispws"></payPassword>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -109,7 +123,7 @@
|
||||
payPassword
|
||||
},
|
||||
onLoad(e) {
|
||||
this.$store.dispatch("set_shopid"); //获取shapid
|
||||
// this.$store.dispatch("set_shopid"); //获取shapid
|
||||
this.getInfo(e.id)
|
||||
this.orderIds = e.id
|
||||
this.amount = uni.cache.get('userInfo').amount
|
||||
@@ -143,6 +157,12 @@
|
||||
// 余额支付
|
||||
async accountPayevent(pwd) {
|
||||
this.ispws = false
|
||||
if ( this.amountVIP.isVip == 0 ) {
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: this.info.shopId,
|
||||
})
|
||||
return;
|
||||
}
|
||||
let res = await this.api.payOrderPay({
|
||||
orderId: this.listinfoid.id,
|
||||
payType: "deposit",
|
||||
@@ -207,7 +227,7 @@
|
||||
let isVip = uni.cache.get('userInfo').isPwd
|
||||
if (isVip == 0) {
|
||||
uni.pro.navigateTo('/pages/user/repairpassword', {
|
||||
shopId_id: uni.cache.get('shopId')
|
||||
shopId_id: this.info.shopId
|
||||
})
|
||||
} else {
|
||||
this.ispws = true
|
||||
@@ -221,12 +241,19 @@
|
||||
},
|
||||
async payEvent(id) {
|
||||
let res = await this.api.payOrderPay({
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
payType: 'aliPay',
|
||||
// #endif
|
||||
orderId: id,
|
||||
orderType: 'group'
|
||||
})
|
||||
if (res) {
|
||||
// 微信支付还是余额支付
|
||||
uni.requestPayment({
|
||||
// #ifdef MP-WEIXIN
|
||||
provider: 'wxpay', //支付类型-固定值
|
||||
partnerid: res.data.appId, // 微信支付商户号
|
||||
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
|
||||
@@ -234,22 +261,32 @@
|
||||
package: res.data.package, // 固定值
|
||||
signType: res.data.signType, //固定值
|
||||
paySign: res.data.paySign, //签名
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
provider: 'alipay', //支付类型-固定值
|
||||
orderInfo: res.data.tradeNo, // 支付宝支付商户号
|
||||
// #endif
|
||||
success: (res) => {
|
||||
let _this = this
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.navigateBack()
|
||||
},
|
||||
fail: (err) => {
|
||||
setTimeout(res => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '支付失败'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 2000)
|
||||
fail: async (err) => {
|
||||
console.log(err)
|
||||
let res = await this.api.cancelOrderPay({
|
||||
orderId: this.listinfoid.id,
|
||||
})
|
||||
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '支付失败'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user