[支付宝支付0元支付和有金额支付两种,]
This commit is contained in:
@@ -48,6 +48,17 @@
|
||||
<u-icon v-if="selectTypeId!== '2'" name="checkmark-circle" color="#f7f7f7" size="50"></u-icon>
|
||||
<u-icon v-else name="checkmark-circle-fill" color="#8b64fd" size="50"></u-icon>
|
||||
</view>
|
||||
<view class="pay-select-item" @click="selectPay('3')">
|
||||
<view class="pay-left">
|
||||
<u-icon class="wx-icon" name="zhifubao" color="#fff" size="40"></u-icon>
|
||||
<view class="pay-wx-title">
|
||||
支付宝支付
|
||||
<span>推荐支付宝用户使用</span>
|
||||
</view>
|
||||
</view>
|
||||
<u-icon v-if="selectTypeId!== '3'" name="checkmark-circle" color="#f7f7f7" size="50"></u-icon>
|
||||
<u-icon v-else name="checkmark-circle-fill" color="#8b64fd" size="50"></u-icon>
|
||||
</view>
|
||||
<!-- <view class="pay-select-item" @click="selectPay('1')">
|
||||
<view class="pay-left">
|
||||
<u-icon class="wx-icon" name="integral-fill" color="#fff" size="40"></u-icon>
|
||||
@@ -98,6 +109,7 @@
|
||||
} from '@/apis/interfaces/goods'
|
||||
import {
|
||||
wxPay,
|
||||
aliPay,
|
||||
ebPay
|
||||
} from '@/apis/interfaces/order'
|
||||
export default {
|
||||
@@ -177,6 +189,12 @@
|
||||
order_no: this.order_no,
|
||||
type: 'app'
|
||||
}
|
||||
} else if (this.selectTypeId === '3') {
|
||||
apiUrl = aliPay
|
||||
data = {
|
||||
order_no: this.order_no,
|
||||
type: 'app'
|
||||
}
|
||||
} else {
|
||||
apiUrl = ebPay
|
||||
data = {
|
||||
@@ -184,6 +202,9 @@
|
||||
}
|
||||
}
|
||||
apiUrl(data).then(res => {
|
||||
console.log(res)
|
||||
debugger;
|
||||
// 微信支付
|
||||
if (this.selectTypeId === '2') {
|
||||
if (typeof res === 'string') {
|
||||
let payInfo = JSON.parse(res)
|
||||
@@ -234,6 +255,56 @@
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
// 支付宝支付
|
||||
else if (this.selectTypeId === '3') {
|
||||
if (typeof res === 'string') {
|
||||
uni.requestPayment({
|
||||
provider: "alipay",
|
||||
orderInfo: res,
|
||||
success: res => {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
duration: 3000,
|
||||
mask: true,
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/goods/payStatus?success=true'
|
||||
})
|
||||
this.canPay = true
|
||||
}, 3000);
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
duration: 3000,
|
||||
mask: true,
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/goods/payStatus?success=false'
|
||||
})
|
||||
this.canPay = true
|
||||
}, 3000);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '创建订单成功',
|
||||
duration: 3000,
|
||||
mask: true,
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.canPay = true
|
||||
uni.reLaunch({
|
||||
url: '/pages/goods/payStatus?success=true'
|
||||
})
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
@@ -276,6 +347,8 @@
|
||||
}
|
||||
} else if (id === '2') {
|
||||
this.selectTypeId = id
|
||||
} else if (id === '3') {
|
||||
this.selectTypeId = id
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user