苹果内购+订单结算页面条件编译

This commit is contained in:
@fawn-nine
2024-07-09 14:26:26 +08:00
parent 05edf730c9
commit 545fd9cc75
12 changed files with 391 additions and 118 deletions

View File

@@ -212,7 +212,7 @@
</view>
<view class="order_top common_radius_box color_shandow goods_box pay_box">
<view class="title">支付方式</view>
<template v-if="isAndorid">
<view
class="curriulum_title_box goods_item pay_item"
v-for="(v, i) in payList"
@@ -260,7 +260,58 @@
</template>
</view>
</view>
<template v-if="selectPayIndex == 2">
</template>
<!-- ios 支付列表 -->
<template v-else>
<view
class="curriulum_title_box goods_item pay_item"
v-for="(v, i) in payListIOS"
>
<view :class="isDefaultCurrency && i != 2 ? 'bgGrey top' : 'top'">
<view class="left">
<image
class="pay_item_img"
:src="v.imgUrl"
mode="aspectFil"
:style="v.style"
>
</image>
<template v-if="v.type == 4">
<text> {{ v.text }}</text>
<text
style="color: #258feb; font-weight: 600; margin-left: 10rpx"
>
(余额{{
initData && initData.user ? initData.user.peanutCoin : 0
}})</text
>
</template>
<text v-else> {{ v.text }}</text>
</view>
<template v-if="isDefaultCurrency">
<radio
v-if="i == 2"
:value="v.value"
color="#258feb"
:checked="selectPayIndex == i ? true : false"
@click="radioChange(i)"
size="10"
/>
</template>
<template v-else>
<radio
:value="v.value"
color="#258feb"
:checked="selectPayIndex == i ? true : false"
@click="radioChange(i)"
size="10"
/>
</template>
</view>
</view>
</template>
<template v-if="beizhuShow">
<view
class="goods_detail_list_title bg_box_shandow color_shandow bg_color"
>
@@ -525,6 +576,14 @@ export default {
value: "2",
},
],
payListIOS: [
{
text: "天医币",
imgUrl: require("@/static/icon/pay_3.png"),
type: 4,
value: "2",
},
],
priceBreakdownList: [],
orderInfoList: [
{
@@ -628,10 +687,13 @@ export default {
color: "#fff",
},
],
haveCourse: false, // 结算队列是否有课程类型的商品
isAndorid:null, //操作系统
beizhuShow:false, // 是否显示天医币说明?
};
},
async onLoad(options) {
console.log("调用了onLoad方法");
console.log("调用了onLoad方法");
var that = this;
console.log("options at line 387:", options);
this.options = JSON.parse(options.data);
@@ -641,6 +703,10 @@ export default {
// this.isShowAddress = true;
// }
this.goodsDataList = this.options.goods;
var list = [...this.options.goods]
list = list.map(e => e.goodsType)
this.haveCourse = list.some(ele => ele === '05')
console.log('list--------->',list, this.haveCourse);
if (this.options.sourceType == "curriculum") {
this.goToInfo = {
url: "/pages/curriculum/order/index/index",
@@ -683,13 +749,32 @@ export default {
}
});
// this.selectPayIndex = 0;
console.log("this.addressData at line 416:", this.addressData);
// #ifdef APP-PLUS
this.getOS()
// #endif
},
computed: {
...mapState(["userInfo"]),
},
methods: {
// 获得操作系统
getOS() {
let oprateOs = ''
oprateOs = uni.getSystemInfoSync().platform
// console.log(oprateOs)
if (oprateOs == 'android') {
this.isAndorid = true
} else {
this.isAndorid = false
if(this.haveCourse && !this.isAndorid){
console.log('苹果系统并且有商品类型为05');
this.selectPayIndex = 0;
this.payType = this.payListIOS[0].type;
this.beizhuShow = true
}
}
},
handleChangejf(val) {
console.log("val at line 653:", val);
var value = val;
@@ -1197,8 +1282,10 @@ export default {
radioChange(index) {
this.selectPayIndex = index;
this.selectPayIndex == 2 ? this.beizhuShow = true : this.beizhuShow = false
this.payType = this.payList[this.selectPayIndex].type;
console.log("this.selectPayIndex at line 315:", this.selectPayIndex);
this.$forceUpdate();
},
handleValChange(e) {