Commit 065d6ac3 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 5d1e4141
......@@ -19,8 +19,8 @@
<scroll-view scroll-y>
<view style="display: flex;flex-direction: column;">
<view style="display: flex;flex-direction: row;">
<view v-if="agreementDto != undefined" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理</view>
<view v-if="agreementDto != null" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理></view>
<view style="margin-top: 12rpx;margin-left: auto;display: flex;flex-direction: row;">
<view @click="handleAgree" style="margin-right: 10rpx;">付费须知></view>
......@@ -127,7 +127,7 @@
}
this.post({
url: '/vip/getVipProducts',
url: '/vip/getVipProducts/cyc',
data: {
bookId: that.vedioId
},
......@@ -153,8 +153,15 @@
success: ({
data
}) => {
console.log("agreement=",data.agreement);
if(data.agreement==undefined){
console.log("agreement=22222");
this.agreementDto = null;
}else{
this.agreementDto = data.agreement;
}
}
});
},
handleUnsign() {
......
......@@ -47,7 +47,7 @@
style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<view @click="handleCoinPay"
style="width: 160rpx;height: 60rpx;background-color: #fff;border-radius:30rpx;color: 263358;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;">
{{userBean.expireTime<=0 ? '去开通' : 'VIP会员'}}
{{userBean.expireTime<=0 ? '去开通' : '已开通'}}
</view>
</view>
</view>
......
......@@ -5,7 +5,7 @@
<image @click="onClose" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx;
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content">
<button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话:400-096-9950</button>
<button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话400-096-9950</button>
<!-- <button class="button2" open-type="im" data-im-id="93264117800">客服在线</button> -->
</view>
</view>
......
<template>
<view class="body">
<text style="margin-left: 40rpx;margin-top: 50rpx;font-size: 36rpx;">自动续费管理</text>
<text style="margin-left: 40rpx;margin-top: 50rpx;font-size: 36rpx;">续费管理</text>
<view class="unsign-head">
<view style="position: absolute;z-index: 10;width: 100%;padding-top: 30rpx;">
......@@ -16,7 +16,7 @@
</view>
<view class="section">
<view>支付方式</view>
<view>{{ agreementData.payChannel }}</view>
<view>微信</view>
</view>
<text class="unsignbutton" @click="unsign">取消自动续费</text>
......
......@@ -5,8 +5,8 @@
mode="widthFix" />
<view class="section">
<view v-if="agreementDto != undefined" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 30rpx;color: black;">自动续费管理</view>
<view v-if="agreementDto != null" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 30rpx;color: black;">自动续费管理></view>
<view class="pack-box">
<scroll-view scroll-x style="white-space: nowrap">
......@@ -78,14 +78,19 @@
return {
vipList: [],
selectedIndex: 0,
os: 'android',
checked: false,
agreementDto: null,
}
},
methods: {
loadData() {
if (wx.getSystemInfoSync().platform === 'ios') {
this.os = 'ios';
}
this.post({
url: '/vip/getVipProducts',
url: '/vip/getVipProducts/cyc',
showLoading: false,
success: ({
data
......@@ -100,8 +105,13 @@
success: ({
data
}) => {
if (data.agreement == undefined) {
this.agreementDto = null;
} else {
this.agreementDto = data.agreement;
}
}
});
},
choosePack(item, index) {
......@@ -118,26 +128,57 @@
},
handlePay() {
if (!this.checked) {
message.notify("请阅读《连续订阅服务协议》与《支付协议》与《河狸小故事隐私政策》后勾选同意")
message.notify("请阅读《支付协议》后勾选同意")
return
}
let that = this;
let vipBean = this.vipList[this.selectedIndex];
if (this.os == 'ios') {
message.notify('暂不支持ios系统~');
} else {
this.post({
url: '/vip/getVipPayParams',
url: '/vip/getVipPayParams/wechat',
data: {
pid: vipBean.pid,
payChannel: 'WEIXIN'
},
showLoading: false,
showLoading: true,
success: ({
data
}) => {
that.wxPay(data);
if (vipBean.firstPayPrice == 0) {
//签约
that.wxSign(data, vipBean.largeType);
} else {
//普通支付
that.wxPay(data, vipBean.largeType);
}
}
});
}
},
wxSign(wxData, largeType) {
let that = this;
// 发起微信签约
wx.navigateToMiniProgram({
appId: wxData.appId,
path: 'pages/loading',
extraData: wxData.params,
success(res) {
message.notify('支付成功')
setTimeout(() => {
navigateBack();
}, 1000);
},
fail(res) {
// 未成功跳转到签约小程序
console.log("wxSign fail=", res);
}
})
},
wxPay(wxData) {
let wxParams = wxData.params;
......@@ -152,21 +193,8 @@
success(res) {
message.notify('支付成功')
// that.post({
// url: '/vip/queryVipOrder',
// data: {
// tid: wxData.tid
// },
// showLoading: false,
// success: ({
// data
// }) => {
// }
// });
setTimeout(() => {
navigateTo(`/pages/home`)
navigateBack();
}, 1000);
},
fail(res) {
......@@ -336,8 +364,8 @@
border-radius: 50rpx;
background: #e8c8ae;
color: #8d5a29;
width: 500rpx;
margin: 30rpx auto;
width: 550rpx;
margin: 40rpx auto;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment