Commit c13fbd42 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 60e065c0
......@@ -18,8 +18,10 @@
v-for='(item, index) in vipList' :key='index' @click="choosePack(item, index)">
<view style="display: flex;flex-direction: column;padding-left: 4rpx;">
<view class="price row">
{{item.firstPayPrice}}
</view>
<view class="name row" v-if="item.title!=null&&item.title!=''">
......@@ -141,6 +143,7 @@
this.post({
url: '/vip/getVipProductsV1',
data: {
bookId: that.vedioId
},
......@@ -178,6 +181,7 @@
data
}) => {
this.userBean = data;
}
});
},
......
......@@ -180,7 +180,7 @@
},
handlePhone() {
this.showKefuPop = true
},
},
paySuccess(largeType) {
this.vipPopRefresh=false;
this.showAnimate = false;
......
<template>
<uni-popup type="bottom" ref="kefuPop" :maskClick="false" :safe-area='false' :isMaskClick="false">
<view class="container">
<image @click="onClose" style="width: 40rpx; height: 40rpx;margin-left:auto;margin-right: 30rpx;
......@@ -8,6 +9,7 @@
<text style="font-size: 40rpx;margin-bottom: 15rpx;">客服时间: 工作日9:00-18:00</text>
<text class="button1" @click="tapMakePhoneCall">客服电话</text>
<button class="button2" open-type="im" data-im-id="86900363628">在线客服</button>
</view>
</view>
</uni-popup>
......
......@@ -12,7 +12,7 @@
<recommend-pop :show='showRecommend' @close='closeRecommendPop' :bookId="bookId"></recommend-pop>
<coin-popup v-if="bookData.isUnlock==0 && !isVip()" :show="showVip" @close="coinClose($event)"
:vedioId="bookData.id" @paySuccess="paySuccess">
:vedioId="bookData.id" @paySuccess="paySuccess" :vipPopRefresh="vipPopRefresh">
</coin-popup>
<vipback-popup :show="showVipbackPop" :vipBean="backvipBean" @vipbackclose="vipbackClose()"
@vipbackpaySuccess="vipbackpaySuccess" />
......@@ -95,7 +95,8 @@
showBeanOpen: 0,
current: 1,
height: 0,
showVipbackPop: false,
showVipbackPop: false,
vipPopRefresh: false,
backvipBean: null,
};
},
......@@ -185,7 +186,8 @@
},
methods: {
// 解锁回调
paySuccess() {
paySuccess() {
this.vipPopRefresh=false;
this.showVip = false;
this.$set(this.bookData, "isUnlock", 1);
......@@ -256,7 +258,8 @@
changeCurrent(current) {
this.current = current
},
coinClose(e) {
coinClose(e) {
this.vipPopRefresh=false;
let item = e.detail.data;
if (item != null) {
......@@ -266,24 +269,26 @@
}, 300);
} else {
this.showVip = false;
if (this.bookData.isUnlock == 0) {
setTimeout(() => {
this.showRecommend = true;
}, 300);
}
// if (this.bookData.isUnlock == 0) {
// setTimeout(() => {
// this.showRecommend = true;
// }, 300);
// }
}
},
vipbackClose() {
this.showVip = false;
this.showVipbackPop = false;
// this.showVip = false;
this.showVipbackPop = false;
this.vipPopRefresh = true;
if (this.bookData.isUnlock == 0) {
setTimeout(() => {
this.showRecommend = true;
}, 300);
}
// if (this.bookData.isUnlock == 0) {
// setTimeout(() => {
// this.showRecommend = true;
// }, 300);
// }
},
vipbackpaySuccess(largeType) {
vipbackpaySuccess(largeType) {
this.vipPopRefresh=false;
this.showVip = false;
this.showVipbackPop = false;
......
......@@ -39,13 +39,6 @@
"subPackages": [{
"root": "pagesA",
"pages": [{
"path": "vipPay/vipPay",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "cdkey/cdkey",
"style": {
"navigationBarTitleText": "兑换会员",
......
<template>
<view class="body">
<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;">
<text style="margin-left: 50rpx;font-size: 30rpx;">{{ agreementData.topText }}</text>
<view class="section">
<view>下次扣款日期</view>
<view>{{ agreementData.nextDay }}</view>
</view>
<view class="section">
<view>下次扣款金额</view>
<view>{{ agreementData.balance }}</view>
</view>
<view class="section">
<view>支付方式</view>
<view>微信</view>
</view>
<text class="unsignbutton" @click="unsign">取消自动续费</text>
</view>
<image :src="bgImg" mode="widthFix" style="position: absolute;width: 100%;"></image>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
navigateBack,
message,
alert,
} from '@/utils/fun.js';
const app = getApp();
export default {
name: 'unsign',
mixins: [common],
data() {
return {
agreementData: {},
bgImg: 'https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_sign.png'
};
},
onLoad(options) {
this.agreementData = JSON.parse(decodeURIComponent(options.params));
},
methods: {
unsign() {
this.post({
url: '/vip/unSign',
showLoading: false,
success: ({
data
}) => {
message.notify('已取消自动签约')
setTimeout(() => {
navigateBack()
}, 1000)
}
});
}
}
};
</script>
<style lang="scss">
@import '@/scss/uni.scss';
.body {
background-color: whitesmoke;
color: #74380C;
}
.unsign-head {
margin-left: 3%;
margin-top: 5%;
width: 94%;
position: relative;
.section {
margin: 30rpx 50rpx;
display: flex;
justify-content: space-between;
}
.unsignbutton {
border: 1rpx solid #E6985D;
padding: 6rpx 20rpx;
border-radius: 3rpx;
text-align: center;
color: #763904;
font-size: 26rpx;
position: absolute;
right: 50rpx;
}
}
</style>
\ No newline at end of file
<template>
<view class="body">
<status-title :showBack="true" icon-color="white" font-color="white">会员支付</status-title>
<scroll-view scroll-y style="height: 100%;">
<image style="width: 100%;" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_vip_2.png" mode="widthFix" />
<view class="section">
<view class="title">
选择套餐
</view>
<view class="pack-box">
<view class="pack-item" :class="[{active: index==selectedIndex}]" v-for='(item, index) in vipList'
:key='index' @click="choosePack(item, index)">
<view class="name row">
{{item.title}}
</view>
<view class="price row">
{{item.firstPayPrice}}
</view>
<view class="origin row" v-if='item.oldPrice'>
原价:{{item.oldPrice}}
</view>
<view class="cut-down" v-if='item.oldPrice-item.firstPayPrice>0'>
立省 {{item.oldPrice-item.firstPayPrice}}
</view>
</view>
</view>
</view>
<view class="section">
<button class="apply-button" @click="handlePay">立即开通</button>
</view>
<image style="width: 100%;" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_vip_0.png" mode="widthFix" />
<image style="width: 100%;margin-bottom: 80rpx;" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_vip_1.png" mode="widthFix" />
</scroll-view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
message,
navigateBack,
navigateTo,
redirectTo
} from '@/utils/fun';
const app = getApp();
export default {
name: 'vipPay',
mixins: [common],
data() {
return {
vipList: [],
selectedIndex: 0,
}
},
methods: {
loadData() {
this.post({
url: '/vip/getVipProducts',
showLoading: false,
success: ({
data
}) => {
this.vipList = data.list
}
});
},
choosePack(item, index) {
this.selectedIndex = index;
},
handlePay() {
let that=this;
let vipBean = this.vipList[this.selectedIndex];
this.post({
url: '/vip/getVipPayParams',
data: {
pid: vipBean.pid,
payChannel: 'WEIXIN'
},
showLoading: false,
success: ({
data
}) => {
that.wxPay(data);
}
});
},
wxPay(wxData){
let wxParams = wxData.params;
let that=this;
// 发起微信支付
wx.requestPayment({
timeStamp: wxParams.timeStamp,
nonceStr: wxParams.nonceStr,
package: wxParams.packageStr,
signType: wxParams.signType,
paySign: wxParams.paySign,
success(res) {
message.notify('支付成功')
// that.post({
// url: '/vip/queryVipOrder',
// data: {
// tid: wxData.tid
// },
// showLoading: false,
// success: ({
// data
// }) => {
// }
// });
setTimeout(() => {
navigateTo(`/pages/home`)
}, 1000);
},
fail(res) {
message.notify('取消支付')
}
})
}
}
}
</script>
<style lang="scss">
.body {
background-color: black;
display: flex;
flex-direction: column;
.section {
padding: 0 30rpx;
display: flex;
flex-direction: column;
background: black;
.title {
font-size: 32rpx;
font-weight: 700;
color: white;
margin-bottom: 30rpx;
}
.pack-box {
margin-top: 25rpx;
margin-left: 40rpx;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.active {
border: 6rpx solid #fd5350 !important;
}
.pack-item {
margin-bottom: 25rpx;
margin-right: 40rpx;
width: calc(31% - 40rpx);
height: 200rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
background: #f5f5f5;
border: 6rpx solid #f5f5f5;
border-radius: 10rpx;
position: relative;
.row {
margin: 8rpx 15rpx;
marign-bottom: 0;
}
.row:last-child {
margin-bottom: 8rpx;
}
.name {
font-size: 26rpx;
font-weight: 700;
color: #333;
}
.price {
font-size: 30rpx;
color: #fd5350;
font-weight: 700;
}
.origin {
font-size: 22rpx;
color: #333;
text-decoration: line-through;
}
.cut-down {
position: absolute;
top: 0;
right: 0;
color: #fff;
background: #ff502f;
font-size: 22rpx;
border-radius: 15rpx;
height: 30rpx;
line-height: 30rpx;
padding: 0 10rpx;
transform: translate(0, -50%);
}
}
}
.apply-button {
border-radius: 50rpx;
background: #e8c8ae;
color: #8d5a29;
width: 500rpx;
margin: 30rpx auto;
}
}
}
</style>
\ No newline at end of file
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