更新:培训班可自定义报名支付方式
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar title="免费课程"></z-nav-bar>
|
||||
<!-- <view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
|
||||
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId"
|
||||
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
|
||||
itemStyle="padding-left: 15px; background-color:#fff; padding-right: 15px; height: 50px;"></u-tabs>
|
||||
</view> -->
|
||||
<view class="learnBox box" >
|
||||
<view class="newBox">
|
||||
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id, item.title)">
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order_top common_radius_box color_shandow goods_box pay_box">
|
||||
<view v-if="!!actualPayment" class="order_top common_radius_box color_shandow goods_box pay_box">
|
||||
<view class="title">支付方式</view>
|
||||
|
||||
<view class="curriulum_title_box goods_item pay_item" v-for="(v, i) in payList">
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
this.selectPayIndex = 0;
|
||||
}
|
||||
}
|
||||
this.payType = this.payList[this.selectPayIndex].type;
|
||||
this.payType = this.payList.length && this.payList[this.selectPayIndex].type;
|
||||
if (this.actualPayment == 0) {
|
||||
var that = this;
|
||||
this.payList.forEach((e, i) => {
|
||||
@@ -208,11 +208,6 @@ export default {
|
||||
{
|
||||
type: 1,
|
||||
text: '商品总价',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
imgUrl: require("@/static/icon/jifen.png"),
|
||||
text: '积分',
|
||||
}
|
||||
],
|
||||
number: 1,
|
||||
@@ -236,6 +231,13 @@ export default {
|
||||
},
|
||||
onLoad(options) {
|
||||
this.options = JSON.parse(options.data);
|
||||
if (!!this.options.displayJf) {
|
||||
this.priceBreakdownList.push({
|
||||
type: 2,
|
||||
imgUrl: require("@/static/icon/jifen.png"),
|
||||
text: '积分',
|
||||
})
|
||||
}
|
||||
if (platform == "ios") {
|
||||
this.payList = [
|
||||
{
|
||||
@@ -248,28 +250,33 @@ export default {
|
||||
this.selectPayIndex = 0;
|
||||
this.payType = 4;
|
||||
} else {
|
||||
this.payList = [
|
||||
{
|
||||
text: "支付宝",
|
||||
imgUrl: require("@/static/icon/pay_1.png"),
|
||||
type: 2,
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
const payType = this.options.payType.split(',')
|
||||
const payListKey = {
|
||||
1: {
|
||||
text: "微信",
|
||||
imgUrl: require("@/static/icon/pay_2.png"),
|
||||
type: 1,
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
2: {
|
||||
text: "支付宝",
|
||||
imgUrl: require("@/static/icon/pay_1.png"),
|
||||
type: 2,
|
||||
value: "0",
|
||||
},
|
||||
4: {
|
||||
text: "天医币",
|
||||
imgUrl: require("@/static/icon/pay_3.png"),
|
||||
type: 4,
|
||||
value: "2",
|
||||
},
|
||||
];
|
||||
this.selectPayIndex = 1;
|
||||
this.payType = 1;
|
||||
}
|
||||
}
|
||||
payType.forEach((item) => {
|
||||
this.payList.push(payListKey[item])
|
||||
})
|
||||
const hasWX = payType.includes('1')
|
||||
this.selectPayIndex = 0;
|
||||
this.payType = this.payList[0].type;
|
||||
}
|
||||
this.getUserInfo();
|
||||
},
|
||||
@@ -347,10 +354,11 @@ export default {
|
||||
if (this.actualPayment == 0) {
|
||||
this.isDefaultCurrency = true;
|
||||
var that = this;
|
||||
// 如果支付方式中有天医币,则默认天医币
|
||||
this.payList.forEach((e, i) => {
|
||||
if (e.type == 4) {
|
||||
that.selectPayIndex = i;
|
||||
that.payType = 4;
|
||||
that.selectPayIndex = i;
|
||||
that.payType = 4;
|
||||
}
|
||||
});
|
||||
this.$forceUpdate();
|
||||
@@ -362,7 +370,10 @@ export default {
|
||||
},
|
||||
//获取总金额
|
||||
getTotalPrice(userInfo) {
|
||||
if (userInfo.jf >= this.options.price) {
|
||||
if (!this.options.displayJf) {
|
||||
this.jfNumber = 0;
|
||||
this.jfNumberMax = 0;
|
||||
} else if (userInfo.jf >= this.options.price) {
|
||||
this.jfNumber = this.options.price;
|
||||
this.jfNumberMax = this.options.price;
|
||||
} else {
|
||||
@@ -405,7 +416,7 @@ export default {
|
||||
});
|
||||
var that = this;
|
||||
let data = {
|
||||
paymentMethod: that.payType,
|
||||
paymentMethod: this.actualPayment ? that.payType : 4, // 如果没有实付金额强制传天医币
|
||||
orderMoney: that.options.price,
|
||||
jfDeduction: that.jfNumber,
|
||||
realMoney: that.actualPayment,
|
||||
@@ -433,7 +444,16 @@ export default {
|
||||
icon: "none"
|
||||
});
|
||||
} else {
|
||||
if (that.payType == 2) {
|
||||
if (!this.actualPayment) {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/trainingCourse/index'
|
||||
})
|
||||
}, 1000);
|
||||
} else if (that.payType == 2) {
|
||||
// 常规支付
|
||||
uni.showToast({
|
||||
title: "正在支付",
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
<script>
|
||||
import $http from '@/config/requestConfig.js';
|
||||
const { platform } = uni.getSystemInfoSync();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -114,11 +115,20 @@ export default {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
price: item.finalFee,
|
||||
identity: item.identity
|
||||
identity: item.identity,
|
||||
payType: item.payType,
|
||||
displayJf: item.displayJf
|
||||
}
|
||||
if (platform == "ios" && !item.payType.includes('4')) {
|
||||
uni.showToast({
|
||||
title: "当前不能在线报名,请联系客服",
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/index?data='+JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/index?data='+JSON.stringify(data),
|
||||
});
|
||||
},
|
||||
//联系客服
|
||||
goToContact(item){
|
||||
|
||||
Reference in New Issue
Block a user