Commit 065d6ac3 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 5d1e4141
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
<scroll-view scroll-y> <scroll-view scroll-y>
<view style="display: flex;flex-direction: column;"> <view style="display: flex;flex-direction: column;">
<view style="display: flex;flex-direction: row;"> <view style="display: flex;flex-direction: row;">
<view v-if="agreementDto != undefined" @click="handleUnsign" <view v-if="agreementDto != null" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理</view> style="margin-top: 12rpx;margin-left: 10rpx;">自动续费管理></view>
<view style="margin-top: 12rpx;margin-left: auto;display: flex;flex-direction: row;"> <view style="margin-top: 12rpx;margin-left: auto;display: flex;flex-direction: row;">
<view @click="handleAgree" style="margin-right: 10rpx;">付费须知></view> <view @click="handleAgree" style="margin-right: 10rpx;">付费须知></view>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
} }
this.post({ this.post({
url: '/vip/getVipProducts', url: '/vip/getVipProducts/cyc',
data: { data: {
bookId: that.vedioId bookId: that.vedioId
}, },
...@@ -152,8 +152,15 @@ ...@@ -152,8 +152,15 @@
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
this.agreementDto = data.agreement; console.log("agreement=",data.agreement);
if(data.agreement==undefined){
console.log("agreement=22222");
this.agreementDto = null;
}else{
this.agreementDto = data.agreement;
}
} }
}); });
}, },
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;"> style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<view @click="handleCoinPay" <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;"> 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> </view>
</view> </view>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<image @click="onClose" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx; <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> margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content"> <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> --> <!-- <button class="button2" open-type="im" data-im-id="93264117800">客服在线</button> -->
</view> </view>
</view> </view>
......
<template> <template>
<view class="body"> <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 class="unsign-head">
<view style="position: absolute;z-index: 10;width: 100%;padding-top: 30rpx;"> <view style="position: absolute;z-index: 10;width: 100%;padding-top: 30rpx;">
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</view> </view>
<view class="section"> <view class="section">
<view>支付方式</view> <view>支付方式</view>
<view>{{ agreementData.payChannel }}</view> <view>微信</view>
</view> </view>
<text class="unsignbutton" @click="unsign">取消自动续费</text> <text class="unsignbutton" @click="unsign">取消自动续费</text>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
mode="widthFix" /> mode="widthFix" />
<view class="section"> <view class="section">
<view v-if="agreementDto != undefined" @click="handleUnsign" <view v-if="agreementDto != null" @click="handleUnsign"
style="margin-top: 12rpx;margin-left: 30rpx;color: black;">自动续费管理</view> style="margin-top: 12rpx;margin-left: 30rpx;color: black;">自动续费管理></view>
<view class="pack-box"> <view class="pack-box">
<scroll-view scroll-x style="white-space: nowrap"> <scroll-view scroll-x style="white-space: nowrap">
...@@ -77,15 +77,20 @@ ...@@ -77,15 +77,20 @@
data() { data() {
return { return {
vipList: [], vipList: [],
selectedIndex: 0, selectedIndex: 0,
os: 'android',
checked: false, checked: false,
agreementDto: null, agreementDto: null,
} }
}, },
methods: { methods: {
loadData() { loadData() {
if (wx.getSystemInfoSync().platform === 'ios') {
this.os = 'ios';
}
this.post({ this.post({
url: '/vip/getVipProducts', url: '/vip/getVipProducts/cyc',
showLoading: false, showLoading: false,
success: ({ success: ({
data data
...@@ -100,7 +105,12 @@ ...@@ -100,7 +105,12 @@
success: ({ success: ({
data data
}) => { }) => {
this.agreementDto = data.agreement; if (data.agreement == undefined) {
this.agreementDto = null;
} else {
this.agreementDto = data.agreement;
}
} }
}); });
}, },
...@@ -118,26 +128,57 @@ ...@@ -118,26 +128,57 @@
}, },
handlePay() { handlePay() {
if (!this.checked) { if (!this.checked) {
message.notify("请阅读《连续订阅服务协议》与《支付协议》与《河狸小故事隐私政策》后勾选同意") message.notify("请阅读《支付协议》后勾选同意")
return return
} }
let that = this; let that = this;
let vipBean = this.vipList[this.selectedIndex]; let vipBean = this.vipList[this.selectedIndex];
this.post({ if (this.os == 'ios') {
url: '/vip/getVipPayParams', message.notify('暂不支持ios系统~');
data: { } else {
pid: vipBean.pid, this.post({
payChannel: 'WEIXIN' url: '/vip/getVipPayParams/wechat',
}, data: {
showLoading: false, pid: vipBean.pid,
success: ({ payChannel: 'WEIXIN'
data },
}) => { showLoading: true,
that.wxPay(data); success: ({
} 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) { wxPay(wxData) {
let wxParams = wxData.params; let wxParams = wxData.params;
...@@ -152,21 +193,8 @@ ...@@ -152,21 +193,8 @@
success(res) { success(res) {
message.notify('支付成功') message.notify('支付成功')
// that.post({
// url: '/vip/queryVipOrder',
// data: {
// tid: wxData.tid
// },
// showLoading: false,
// success: ({
// data
// }) => {
// }
// });
setTimeout(() => { setTimeout(() => {
navigateTo(`/pages/home`) navigateBack();
}, 1000); }, 1000);
}, },
fail(res) { fail(res) {
...@@ -230,7 +258,7 @@ ...@@ -230,7 +258,7 @@
border: 4rpx solid #FDEADC !important; border: 4rpx solid #FDEADC !important;
} }
.pack-content { .pack-content {
width: 100%; width: 100%;
height: 260rpx; height: 260rpx;
display: flex; display: flex;
...@@ -336,8 +364,8 @@ ...@@ -336,8 +364,8 @@
border-radius: 50rpx; border-radius: 50rpx;
background: #e8c8ae; background: #e8c8ae;
color: #8d5a29; color: #8d5a29;
width: 500rpx; width: 550rpx;
margin: 30rpx auto; 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