Commit 91253ede authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 6401c10b
<template>
<uni-popup type="bottom" ref="coinPop" :maskClick="false" :safe-area='false' :isMaskClick="false">
<view style="position: relative;background-color: white;">
<view v-if="agreeFlag"
style="width: 100%;height: 100%;background-color: black;opacity: 0.8;display: flex;position: absolute;z-index: 100;color: white;flex-direction: column;align-items: center;padding:40rpx 0;">
<text style="font-size: 30rpx;">
付费须知 \n
1、会员属于虚拟商品,一经购买不可退换 \n
2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作;\n
3、充值一般5分钟内到账,如未到账请在“我的”页面联系客服;
</text>
<image @click="agreeFlag=false" style="width: 30rpx;height: 30rpx;margin-top:150rpx;"
src="@/static/index/ic_quit_white.png"></image>
</view>
<view class="body" style="width: 100%;height: 100%;background-color: white;">
<scroll-view scroll-y>
<view style="display: flex;flex-direction: column;align-items: flex-end;margin-bottom: 10rpx;">
<view style="display: flex;flex-direction: row;">
<view @click="handleAgree" style="margin-top: 16rpx;margin-right: 16rpx;">付费须知></view>
<image @click="handleClose"
style="width: 40rpx;height: 40rpx;display: flex;align-items: right;margin-top: 20rpx;margin-right: 20rpx;margin-bottom: 10rpx;"
src="@/static/index/ic_quit_white.png"></image>
</view>
<view class="body" style="width: 100%;height: 100%;background-color: white;">
<scroll-view scroll-y>
<view style="display: flex;flex-direction: column;align-items: flex-end;margin-bottom: 10rpx;">
<view style="display: flex;flex-direction: row;">
<image @click="handleClose"
style="width: 40rpx;height: 40rpx;display: flex;align-items: right;margin-top: 20rpx;margin-right: 20rpx;margin-bottom: 10rpx;"
src="@/static/index/ic_quit_white.png"></image>
</view>
<view class="section">
<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 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!=''">
{{item.title}}
</view>
<view class="origin row" v-if="item.remarks!=null&&item.remarks!=''">
{{item.remarks}}
</view>
</view>
<view class="section">
<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 style="display: flex;flex-direction: column;padding-left: 4rpx;">
<view class="price row">
{{item.firstPayPrice}}
</view>
<view class="cut-down" v-if='item.topTitle!=null&&item.topTitle.length>0'>
{{item.topTitle}}
<view class="name row" v-if="item.title!=null&&item.title!=''">
{{item.title}}
</view>
<view v-if="index==selectedIndex" style="position: absolute;bottom: 0;right: 0;">
<image mode="scaleToFill"
style="width: 100rpx;height: 100rpx;display: flex;align-items: right;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_loading.gif">
</image>
<view class="origin row" v-if="item.remarks!=null&&item.remarks!=''">
{{item.remarks}}
</view>
</view>
<view class="cut-down" v-if='item.topTitle!=null&&item.topTitle.length>0'>
{{item.topTitle}}
</view>
<view v-if="index==selectedIndex" style="position: absolute;bottom: 0;right: 0;">
<image mode="scaleToFill"
style="width: 100rpx;height: 100rpx;display: flex;align-items: right;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_loading.gif">
</image>
</view>
</view>
</view>
<view style="display: flex;flex-direction: column;align-items: center;">
<view style="font-size: 24rpx;color: gray;margin-top: 16rpx;margin-bottom: 18rpx;">
订单中如有疑问,请在个人中心联系客服</view>
</view>
</scroll-view>
</view>
</view>
<view style="display: flex;flex-direction: column;align-items: center;">
<text style="font-size: 28rpx;color: gray;margin-left: 30rpx;margin-right: 30rpx;margin-bottom: 20rpx;">
1、会员属于虚拟商品,一经购买不可退换;
2、未满18岁的未成年人需要在监护人主导、同意下进行相关付费操作;
3、充值一般5分钟内到账,如未到账请在“我的”页面联系客服;
</text>
</view>
</scroll-view>
</view>
</uni-popup>
</template>
......@@ -78,6 +69,10 @@
type: Boolean,
default: false
},
vipPopRefresh: {
type: Boolean,
default: false
},
point: {
type: [Number, String],
default: 0
......@@ -87,6 +82,31 @@
default: 0
}
},
watch: {
vipPopRefresh: {
handler(newVal, oldVal) {
if (newVal) {
this.handleShow();
}
},
immediate: true
},
show: {
handler: function(newVal, oldVal) {
if (newVal) {
this.handleShow();
} else {
// 兼容vip界面返回弹窗
if (this.backvipBean != null) {
// 跳转了返回弹窗
this.$refs.coinPop.close('bottom');
}
}
},
immediate: true
}
},
data() {
return {
vipList: [],
......@@ -136,14 +156,17 @@
this.selectedIndex = i;
}
// 筛选产品
if (data.list[i].abtype == 1) {
// 返回弹窗产品
this.backvipBean = data.list[i];
} else {
if (this.vipPopRefresh) {
this.vipList.push(data.list[i]);
} else {
if (data.list[i].abtype == 1) {
// 返回弹窗产品
this.backvipBean = data.list[i];
} else {
this.vipList.push(data.list[i]);
}
}
}
}
}
});
......@@ -281,30 +304,13 @@
}
});
}
},
watch: {
show: {
handler: function(newVal, oldVal) {
if (newVal) {
this.handleShow();
} else {
// 兼容vip界面返回弹窗
if (this.backvipBean != null) {
// 跳转了返回弹窗
this.$refs.coinPop.close('bottom');
}
}
},
immediate: true
}
}
};
</script>
<style lang="scss">
.body {
margin: 0 auto;
margin: 0 auto;
padding-bottom: 100rpx;
border-radius: 20rpx 20rpx 0 0;
background-color: white;
......
......@@ -65,7 +65,7 @@
</view>
</view>
<coin-popup :show="showAnimate" @close="coinClose($event)" @paySuccess="paySuccess">
<coin-popup :show="showAnimate" @close="coinClose($event)" @paySuccess="paySuccess" :vipPopRefresh="vipPopRefresh">
</coin-popup>
<vipback-popup :show="showVipbackPop" :vipBean="backvipBean" @vipbackclose="vipbackClose()"
@vipbackpaySuccess="vipbackpaySuccess" />
......@@ -106,6 +106,7 @@
showMask: false,
showVipbackPop: false,
showKefuPop: false,
vipPopRefresh: false,
maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png',
maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png',
statusBarHeight: app.globalData.statusBarHeight,
......@@ -181,6 +182,7 @@
this.showKefuPop = true
},
paySuccess(largeType) {
this.vipPopRefresh=false;
this.showAnimate = false;
// largeType=vip 开通vip
// largeType=point 购买书豆
......@@ -196,7 +198,8 @@
}
});
},
coinClose(e) {
coinClose(e) {
this.vipPopRefresh=false;
let item = e.detail.data;
if (item != null) {
......@@ -210,25 +213,26 @@
console.log('mymymymymy', item);
},
vipbackClose() {
this.showAnimate = false;
this.showVipbackPop = false;
this.vipPopRefresh = true;
},
vipbackpaySuccess(largeType) {
this.showAnimate = false;
this.showVipbackPop = false;
setTimeout(() => {
message.notify('支付成功');
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
this.vipPopRefresh=false;
this.showAnimate = false;
this.showVipbackPop = false;
setTimeout(() => {
message.notify('支付成功');
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
}, 300);
}
}
......
......@@ -7,7 +7,7 @@
<view class="content">
<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="93264117800">在线客服</button>
<button class="button2" open-type="im" data-im-id="86900363628">在线客服</button>
</view>
</view>
</uni-popup>
......
<template>
<z-paging :style="[bgStyle]">
<c-empty v-if='showEmpty'></c-empty>
<template v-else>
<detail-warn></detail-warn>
<detail-thumb :detail='bookData' @tapThumb='tapThumb'></detail-thumb>
<detail-content @tapVip='tapPayPop' :detail='bookData' :userInfo='userInfo'></detail-content>
<detail-new-buy v-if="bookData.isUnlock==0 && !isVip()" :showVipOpen="1" :showBeanOpen="0"
:detail='bookData' :userInfo='userInfo' @unlockBook='unlockBook' @tapVip='tapVipPop'
@tapBean='tapBeanPop'></detail-new-buy>
<template>
<detail-thumb :detail='bookData'></detail-thumb>
<detail-content @tapVip='tapVipPop' :detail='bookData' :userInfo='userInfo'></detail-content>
<detail-new-buy v-if="bookData.isUnlock==0 && !isVip()"
:detail='bookData' :userInfo='userInfo' @tapVip='tapVipPop'
></detail-new-buy>
<detail-bottom :detail='bookData' :userInfo='userInfo' @tapBottomItem='tapBottomItem'></detail-bottom>
<setting-pop :show='showSetting' @close='closePop'></setting-pop>
<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" />
</template>
<c-login :isShareLink="true"></c-login>
<popup :show="showMoibleLogin" @close="showMoibleLogin=false">
<view>
<button open-type="getPhoneNumber" @getphonenumber="MygetPhonenumber">
<view>请先绑定手机号</view>
<view style="color:green;">去绑定</view>
</button>
</view>
</popup>
</z-paging>
</template>
......@@ -43,50 +31,33 @@
import {
collectionBook
} from "../../../common/services/index.js"
import DetailWarn from "./components/detail-warn.vue";
import DetailThumb from "./components/detail-thumb.vue";
import DetailContent from "./components/detail-content.vue";
import DetailBottom from "./components/detail-bottom.vue";
import DetailContent from "./components/detail-content.vue";
import DetailNewBuy from "./components/detail-new-buy.vue";
import DetailBottom from "./components/detail-bottom.vue";
import config from "../../../config/index.js";
import SettingPop from "./components/setting-pop.vue";
import VipPop from "./components/vip-pop.vue";
import BeanPop from "./components/bean-pop.vue";
import VipbackPopup from '@/components/vipback-popup/vipback-popup.vue';
import CoinPopup from "@/components/coin-popup/coin-popup.vue";
import RecommendPop from "./components/recommend-pop.vue";
import SystemInfoMixin from "../../../common/mixins/system-info-mixin.js";
import {
gotoBookCoverPage
} from "../../../common/services/page-route.js"
import {
watchUserInfoChange,
removeUserInfoChangeWatch,
refreshUserInfo,
postPhone
refreshUserInfo
} from "../../../common/services/userServices.js"
import {
noticeCollectionListChange,
startCountReadTime,
endCountReadTime,
getOpens
endCountReadTime
} from "../../../common/services/index.js"
import {
saveStorage,
readStorage
} from "../../../common/utils/storageUtil.js";
export default {
mixins: [SystemInfoMixin],
components: {
DetailWarn,
DetailThumb,
DetailContent,
DetailNewBuy,
DetailBottom,
SettingPop,
VipPop,
BeanPop,
RecommendPop,
SettingPop,
DetailNewBuy,
VipbackPopup,
CoinPopup,
},
......@@ -97,14 +68,10 @@
backgroundColor: "#fff",
showSetting: false,
showVip: false,
showBean: false,
showRecommend: false,
userInfo: null,
showVipOpen: 0,
showBeanOpen: 0,
showMoibleLogin: false,
mobileLoginLock: false,
showVipbackPop: false,
showVipbackPop: false,
vipPopRefresh: false,
backvipBean: null,
};
},
......@@ -117,8 +84,6 @@
this.bookId = info.bookId;
})
}
this.mobileLoginLock = readStorage("KEY_NEED_PHONE")
},
onReady() {
// 监听样式变动
......@@ -197,38 +162,6 @@
}
},
methods: {
async MygetPhonenumber(e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
this.showMoibleLogin = false
if (e.detail.code == undefined || e.detail.code == '') {
uni.showModal({
title: "提示",
content: e.detail.errMsg
})
return
}
var params = {
userId: this.userInfo.userid,
code: e.detail.code,
}
postPhone(params, (success, result) => {
if (success) {
saveStorage("KEY_NEED_PHONE", false);
this.mobileLoginLock = false
this.tapPayPop()
} else {
uni.showModal({
title: "提示",
content: "网络错误!"
})
}
})
},
// 解锁回调
unlockBook() {
this.$set(this.bookData, "isUnlock", true);
......@@ -275,44 +208,17 @@
}
return false;
},
tapPayPop() {
if (this.showVipOpen != 1 && this.showBeanOpen == 1) {
this.tapBeanPop()
return
}
this.tapVipPop()
},
// 展示充值VIP弹框
tapVipPop() {
// if (this.mobileLoginLock) {
// this.showMoibleLogin = true
// return
// }
this.showVip = true;
},
// 展示充值书豆弹框
tapBeanPop() {
if (this.mobileLoginLock) {
this.showMoibleLogin = true
return
}
this.showBean = true;
},
// 关闭设置弹窗
closePop(e) {
this.showSetting = false;
},
// 关闭推荐弹窗
closeRecommendPop(e) {
this.showRecommend = false;
},
// 点击封面,暂无
tapThumb(e) {
gotoBookCoverPage(this.bookData.id);
},
coinClose(e) {
},
// 价格弹窗
coinClose(e) {
this.vipPopRefresh=false;
let item = e.detail.data;
if (item != null) {
......@@ -322,23 +228,21 @@
}, 300);
} else {
this.showVip = false;
setTimeout(() => {
this.showRecommend = true;
}, 300);
}
},
vipbackClose() {
this.showVip = false;
},
// 价格挽留弹窗
vipbackClose() {
this.vipPopRefresh=false;
// this.showVip = false;
this.showVipbackPop = false;
this.vipPopRefresh = true;
},
// 价格挽留弹窗-支付成功回调
vipbackpaySuccess(largeType) {
this.vipPopRefresh=false;
this.showVip = false;
this.showVipbackPop = false;
setTimeout(() => {
this.showRecommend = true;
}, 300);
},
vipbackpaySuccess(largeType) {
this.vipbackClose();
this.$set(this.bookData, "isUnlock", true);
}
}
......
<template>
<view class="detail-buy">
<view class="book-card">
<view class="line-box">
<view class="line"></view>
<view class="text">全本订阅超优惠</view>
<view class="line"></view>
</view>
<view v-if="showBeanOpen==1" class="text-box">
<view class="text1">全本特价:</view>
<view class="text2">{{bookBeanCount}}</view>
<view class="text1">书豆</view>
</view>
<view v-if="showBeanOpen==1" class="text-box" style="margin-top: 20rpx;">
<view class="text1">账户余额:</view>
<view class="text2">{{bookAllBeanCount}}</view>
<view class="text1">书豆</view>
</view>
<view v-if="showBeanOpen==1" class="section" style="margin-top: 30rpx;">
<button class="btn1" :disabled="loading" :loading="loading" @click="tapBeanBtn">
{{bookBeanText}}
</button>
</view>
<view v-if="!isVip() && (showVipOpen==1)" class="section" style="margin-top: 30rpx;">
<view v-if="!isVip() " class="section" style="margin-top: 30rpx;">
<button class="btn2" :disabled="loading" :loading="loading" @click="tapVip">开通会员,免费阅读本书</button>
</view>
</view>
......
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