|
@@ -156,7 +156,8 @@ export default {
|
|
|
payType: '',
|
|
|
mealList: [],
|
|
|
status: 0,
|
|
|
- carousel: []
|
|
|
+ carousel: [],
|
|
|
+ phoneType: 'SVIP'
|
|
|
}
|
|
|
},
|
|
|
async fetch() {
|
|
@@ -180,7 +181,7 @@ export default {
|
|
|
this.carousel = res.data;
|
|
|
},
|
|
|
async getMealInfo() {
|
|
|
- const res = await this.$axios.$get('/pay/v2/meal/info?phoneType=SVIP');
|
|
|
+ const res = await this.$axios.$get('/pay/v2/meal/info?phoneType=' + this.phoneType);
|
|
|
this.mealList = res.data.list.filter(item => item.day === 30 || item.day === 365)
|
|
|
},
|
|
|
async createOrder() {
|
|
@@ -194,7 +195,7 @@ export default {
|
|
|
couponId: 0,
|
|
|
id: this.selMealId,
|
|
|
mealType: 0,
|
|
|
- phoneType: 'SVIP',
|
|
|
+ phoneType: this.phoneType,
|
|
|
quantity: 1,
|
|
|
};
|
|
|
taocan = this.sort_ASCII(taocan);
|
|
@@ -202,21 +203,22 @@ export default {
|
|
|
const res = await this.$axios.$post('/pay/v1/order/create', taocan, { headers: { Authorization: this.token, sign } });
|
|
|
if (this.$userAgent.isAndroid) {
|
|
|
window.native.startPay(this.payType === 'aliPay' ? 3 : 2, res.data.myOrderNum, 1);
|
|
|
- }
|
|
|
- if (this.$userAgent.isIos) {
|
|
|
+ } else if (this.$userAgent.isIos) {
|
|
|
window.webkit.messageHandlers.startPay.postMessage({
|
|
|
payType: this.payType === 'aliPay' ? 3 : 2,
|
|
|
orderNum: res.data.myOrderNum,
|
|
|
actualPrice: this.actualPrice
|
|
|
});
|
|
|
- }
|
|
|
- if (this.$userAgent.isSzxBrowser) {
|
|
|
- uni.webView.postMessage({
|
|
|
- data: {
|
|
|
- payType: this.payType === 'aliPay' ? 3 : 2,
|
|
|
- orderNum: res.data.myOrderNum,
|
|
|
- buyType: 1
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ document.addEventListener('UniAppJSBridgeReady', () => {
|
|
|
+ // 使用postMessage 方法可以发送消息到应用, 消息内容需要在data 对象中,否则webview无法接收到
|
|
|
+ uni.postMessage({
|
|
|
+ data: {
|
|
|
+ payType: this.payType === 'aliPay' ? 3 : 2,
|
|
|
+ orderNum: res.data.myOrderNum,
|
|
|
+ buyType: 1
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -284,6 +286,7 @@ export default {
|
|
|
this.selMealId = res.data.mealId
|
|
|
this.paySupportType = res.data.paySupportType
|
|
|
this.payType = this.paySupportType[0]
|
|
|
+ this.phoneType = res.data.phoneType
|
|
|
this.title = res.data.title
|
|
|
this.prizeIndex = index;
|
|
|
} else {
|