Commit ee3b8180 authored by jyx's avatar jyx

代码优化

parent bae59d4e
...@@ -262,16 +262,6 @@ function getPayInfo(id, amount, openId, callback, typeId = ENUM_PAY_TYPE.VIP.val ...@@ -262,16 +262,6 @@ function getPayInfo(id, amount, openId, callback, typeId = ENUM_PAY_TYPE.VIP.val
}) })
} }
function getPayInfoDy(pid) {
apiPOST({
url: `/vip/getVipPayParams/douyin`,
data: {
pid: pid
},
callback
})
}
/** /**
* 获取书豆套餐数据 * 获取书豆套餐数据
...@@ -318,7 +308,6 @@ module.exports = { ...@@ -318,7 +308,6 @@ module.exports = {
getOpenId, getOpenId,
getFeedback, getFeedback,
ENUM_PAY_TYPE, ENUM_PAY_TYPE,
getPayInfoDy,
getPayInfo, getPayInfo,
buyBookWithBookBean, buyBookWithBookBean,
......
...@@ -29,7 +29,7 @@ function gotoBookContentPage(bookId, shortis) { ...@@ -29,7 +29,7 @@ function gotoBookContentPage(bookId, shortis) {
function gotoShortBookContentPage(bookId) { function gotoShortBookContentPage(bookId) {
// 短篇小说 // 短篇小说
uni.navigateTo({ uni.navigateTo({
url: `/page-subs/sub_A/book-content/book-content`, url: `/page-subs/sub_A/book-content/book-content?bookId=` + bookId,
success: (res) => { success: (res) => {
res.eventChannel.emit("openBookContentPage", { res.eventChannel.emit("openBookContentPage", {
bookId bookId
...@@ -41,7 +41,7 @@ function gotoShortBookContentPage(bookId) { ...@@ -41,7 +41,7 @@ function gotoShortBookContentPage(bookId) {
// 长篇文章详情 // 长篇文章详情
function gotoLongBookContentPage(bookId) { function gotoLongBookContentPage(bookId) {
uni.navigateTo({ uni.navigateTo({
url: `/page-subs/sub_A/book-long-content/book-long-content`, url: `/page-subs/sub_A/book-long-content/book-long-content?bookId=` + bookId,
success: (res) => { success: (res) => {
res.eventChannel.emit("openBookContentPage", { res.eventChannel.emit("openBookContentPage", {
bookId bookId
......
...@@ -114,7 +114,7 @@ function refreshUserInfo() { ...@@ -114,7 +114,7 @@ function refreshUserInfo() {
id: userData.idcode, id: userData.idcode,
memberExpirationDate: userData.expireTime memberExpirationDate: userData.expireTime
}) })
saveNickname(userData.nickname); // saveNickname(userData.nickname);
saveUserInfo(user); // 存储用户数据 saveUserInfo(user); // 存储用户数据
postNotification(KEY_NOTIFICATION_LOGIN_SUCCESS); // 通知登录成功 postNotification(KEY_NOTIFICATION_LOGIN_SUCCESS); // 通知登录成功
} }
...@@ -147,7 +147,7 @@ function postPhone(data, callback) { ...@@ -147,7 +147,7 @@ function postPhone(data, callback) {
// 请求token // 请求token
function requestToken(data, callback) { function requestToken(data, callback) {
let url = `${config["BASE_URL"]}/user/wechatlogin`; let url = `${config["BASE_URL"]}/user/ksLogin`;
let header = { let header = {
pkgName: PAKEAGE_NAME, pkgName: PAKEAGE_NAME,
version: VERSION_CODE, version: VERSION_CODE,
......
<template> <template>
<z-paging> <z-paging>
<c-navi id='navi'></c-navi> <!-- <c-navi id='navi'></c-navi> -->
<book-search-box id='search' :searchType='searchType'></book-search-box> <book-search-box id='search' :searchType='searchType'></book-search-box>
<read-time-count-row id='count' ref='timeCount' @resize='resizeTimeCount'></read-time-count-row> <read-time-count-row id='count' ref='timeCount' @resize='resizeTimeCount'></read-time-count-row>
<BookshelfList ref='bookList' :height='listHeight'></BookshelfList> <BookshelfList ref='bookList' :height='listHeight'></BookshelfList>
......
<template> <template>
<view v-if="false" class="c-empty" :style="[emptyStyle]"> <view class="c-empty" :style="[emptyStyle]">
<image class='empty-image' :style="[emptyImgStyle]" :src='emptyImg'> <image class='empty-image' :style="[emptyImgStyle]" :src='emptyImg'>
</image> </image>
<view class="empty-title" :style="[emptyTitleStyle]"> <view class="empty-title" :style="[emptyTitleStyle]">
......
...@@ -203,7 +203,9 @@ ...@@ -203,7 +203,9 @@
if (this.refreshTrigger) { if (this.refreshTrigger) {
this.refreshTrigger = false; this.refreshTrigger = false;
} }
this.refreshTrigger = true; this.refreshTrigger = true;
this.refresh()
}, },
closeTrigger() { closeTrigger() {
if (!this.refreshTrigger) { if (!this.refreshTrigger) {
...@@ -230,7 +232,7 @@ ...@@ -230,7 +232,7 @@
} }
}, },
/** 外部触发 变更trigger list 响应 refresh 接口 */ /** 外部触发 变更trigger list 响应 refresh 接口 */
onPullRefreshing() { onPullRefreshing() {
if (this.loading && !this.customRequest) { if (this.loading && !this.customRequest) {
this.closeTrigger(); this.closeTrigger();
return; return;
...@@ -238,7 +240,7 @@ ...@@ -238,7 +240,7 @@
this.openTrigger(); this.openTrigger();
}, },
/** 响应触发 响应 list 回调 */ /** 响应触发 响应 list 回调 */
refresh() { refresh() {
if (this.loading && !this.customRequest) { // loading 用于内部数据判断标识, 所以要判断是否启用 customeRequest if (this.loading && !this.customRequest) { // loading 用于内部数据判断标识, 所以要判断是否启用 customeRequest
this.closeTrigger(); this.closeTrigger();
return; return;
...@@ -274,10 +276,10 @@ ...@@ -274,10 +276,10 @@
} }
}, },
/** customeRequst 不会使用的接口*/ /** customeRequst 不会使用的接口*/
requestData() { requestData() {
if (this.needLogin && !this.userInfo) { if (this.needLogin && !this.userInfo) {
this.loading = false; this.loading = false;
this.closeTrigger(); this.closeTrigger();
return; return;
} }
this.loading = true; this.loading = true;
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
} }
this.post({ this.post({
url: '/vip/getVipProducts/cyc', url: '/vip/getVipProducts',
data: { data: {
bookId: that.vedioId bookId: that.vedioId
}, },
...@@ -199,83 +199,36 @@ ...@@ -199,83 +199,36 @@
message.notify('暂不支持ios系统~'); message.notify('暂不支持ios系统~');
} else { } else {
this.post({ this.post({
url: '/vip/getVipPayParams/wechat', url: '/vip/getVipPayParams/kuaishou',
data: { data: {
pid: vipBean.pid, pid: vipBean.pid,
payChannel: 'WEIXIN' payChannel: 'kuaishou'
}, },
showLoading: true, showLoading: true,
success: ({ success: ({
data data
}) => { }) => {
if (vipBean.firstPayPrice == 0) { //普通支付
//签约 that.wxPay(data, vipBean.largeType);
that.wxSign(data, vipBean.largeType);
} else {
//普通支付
that.wxPay(data, vipBean.largeType);
}
} }
}); });
} }
}, },
wxPay(wxData, largeType) { ksPay(wxData, largeType) {
let wxParams = wxData.params;
let that = this; let that = this;
// 发起微信支付 ks.pay({
wx.requestPayment({ serviceId: '1',
timeStamp: wxParams.timeStamp, orderInfo: ksData.params,
nonceStr: wxParams.nonceStr, // paymentChannel: ksData.params.paymentChannel,
package: wxParams.packageStr, success() {
signType: wxParams.signType, message.notify('支付成功')
paySign: wxParams.paySign,
success(res) {
that.queryOrderStatus(largeType, wxData.tidStr); that.queryOrderStatus(largeType, wxData.tidStr);
}, },
fail(res) {} fail() {
}) message.notify('支付失败');
},
wxSign(wxData, largeType) {
let wxParams = wxData.params;
let that = this;
// 发起微信签约
wx.navigateToMiniProgram({
appId: "wxbd687630cd02ce1d",
path: 'pages/index/index',
extraData: wxData.params,
success(res) {
console.log("wxSign suc=", res);
if (res.return_code == 'SUCCESS') {
console.log("wxSign suc1111");
// 成功跳转到签约小程序
that.queryOrderStatus(largeType, wxData.tidStr);
} else {
// 签约失败
console.log("wxSign fail22222");
}
}, },
fail(res) {
// 未成功跳转到签约小程序
console.log("wxSign fail=3333", res);
}
}) })
}, },
queryOrderStatus(largeType, tid) {
let that = this;
this.post({
data: {
tid: tid
},
url: '/vip/queryVipOrder',
showLoading: true,
success: ({
data
}) => {
that.paySuccess(largeType);
}
});
}
}, },
watch: { watch: {
show: { show: {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
import { import {
isEmpty isEmpty
} from '../../../common/utils/util' } from '../../../common/utils/util'
import { login } from '../../../utils/fun';
import WarehouseBookItem from '../models/WarehouseBookItem.js'; import WarehouseBookItem from '../models/WarehouseBookItem.js';
export default { export default {
components: {}, components: {},
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
refreshList() { refreshList() {
this.$nextTick(() => { this.$nextTick(() => {
let ref = this.$refs.list; let ref = this.$refs.list;
if (ref) { if (ref) {
ref.onPullRefreshing(); ref.onPullRefreshing();
} }
}) })
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
return new WarehouseBookItem(item) return new WarehouseBookItem(item)
}) })
}, },
tapItem(e, index) { tapItem(e, index) {
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis) gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
}, },
tapClose(e, index) { tapClose(e, index) {
......
<template> <template>
<z-paging> <view>
<c-navi id='navi'></c-navi>
<book-search-box id='search'></book-search-box> <book-search-box id='search'></book-search-box>
<CategoryBar id='category' :range='categorys' :current='currentIndex' @change='changeCategory' <CategoryBar id='category' :range='categorys' :current='currentIndex' @change='changeCategory'
@ready='readyCategory'></CategoryBar> @ready='readyCategory'></CategoryBar>
<view :style="[listStyle]" v-if='showEmpty'> <view :style="[listStyle]" v-if='showEmpty'>
<c-empty emptyTitle="暂无数据"></c-empty> <c-empty emptyTitle="正在加载中~"></c-empty>
</view> </view>
<view :style="[listStyle]" v-else> <view :style="[listStyle]" v-else>
<swiper :style="[listStyle]" :indicator-dots="false" :autoplay="false" :current="currentIndex" <swiper :style="[listStyle]" :indicator-dots="false" :autoplay="false" :current="currentIndex"
...@@ -16,8 +15,8 @@ ...@@ -16,8 +15,8 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<c-login></c-login> <!-- <c-login></c-login> -->
</z-paging> </view>
</template> </template>
<script> <script>
...@@ -80,13 +79,6 @@ ...@@ -80,13 +79,6 @@
setTimeout(() => { setTimeout(() => {
this.$refs[`bookList${n.currentIndex}`][0].initRefresh(); this.$refs[`bookList${n.currentIndex}`][0].initRefresh();
}, 500) }, 500)
// this.$nextTick(() => {
// // this.$refs[`bookList${n.currentIndex}`][0].initRefresh();
// let ref = this.$refs.bookList;
// if (ref) {
// ref[n.currentIndex].initRefresh();
// }
// })
}, },
deep: true deep: true
} }
...@@ -119,7 +111,7 @@ ...@@ -119,7 +111,7 @@
if (success) { if (success) {
setTimeout(() => { setTimeout(() => {
// 匹配用户直接跳转小说 // 匹配用户直接跳转小说
if (data.articleMsg != null) { if (data.articleMsg != null) {
gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis); gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis);
} }
}, 800); }, 800);
...@@ -145,14 +137,15 @@ ...@@ -145,14 +137,15 @@
}, },
initHeight() { initHeight() {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select("#navi").boundingClientRect();
query.select("#search").boundingClientRect(); query.select("#search").boundingClientRect();
query.select("#category").boundingClientRect(); query.select("#category").boundingClientRect();
query.exec((res) => { query.exec((res) => {
let result = 0; var result = 0;
res.forEach(item => { res.forEach(item => {
if (item) { if (item) {
result = result + item.height; if (item.height) {
result = result + item.height;
}
} }
}) })
this.listHeight = this.windowHeight - result - (this.windowHeight * 0.1); this.listHeight = this.windowHeight - result - (this.windowHeight * 0.1);
......
<template>
<view style="padding-top: 50rpx;">
<profile-header :userInfo='userInfo'></profile-header>
<CategoryBar id='category' :range='categorys' :current='currentIndex' @change='changeCategory'
@ready='readyCategory'></CategoryBar>
<view :style="[listStyle]" v-if='showEmpty'>
<c-empty emptyTitle="暂无数据"></c-empty>
</view>
<view :style="[listStyle]" v-else>
<swiper :style="[listStyle]" :indicator-dots="false" :autoplay="false" :current="currentIndex"
@change="changeSwiper">
<swiper-item v-for='(item, index) in categorys' :key='index'>
<WarehouseList ref='bookList' :category='item' :height='listHeight'></WarehouseList>
</swiper-item>
</swiper>
</view>
<c-login></c-login>
</view>
</template>
<script>
import ProfileHeader from "./components/profile-headertemp.vue";
import {
watchUserInfoChange,
refreshUserInfo
} from "../../common/services/userServices.js"
import CategoryBar from "./components/category-bar.vue";
import WarehouseList from "./components/warehouse-list.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js";
import Category from "./models/Category.js";
import {
getCategorys
} from "./services/index.js"
import {
isEmpty
} from "../../common/utils/util";
import {
readStorage,
saveStorage
} from '../../common/utils/storageUtil';
export default {
mixins: [SystemInfoMixin],
components: {
CategoryBar,
ProfileHeader,
WarehouseList
},
data() {
return {
userInfo: null,
listHeight: 0,
categorys: [],
currentIndex: 0
};
},
onLoad() {
},
computed: {
showEmpty: function() {
return isEmpty(this.categorys);
},
listStyle: function() {
return {
height: `${this.listHeight}px`
}
},
categroyChange: function() {
const {
categorys,
currentIndex
} = this;
return {
categorys,
currentIndex
}
}
},
watch: {
categroyChange: {
handler: function(n, o) {
this.$nextTick(() => {
let ref = this.$refs.bookList;
if (ref) {
ref[n.currentIndex].initRefresh();
}
})
},
deep: true
}
},
methods: {
show(){
console.log("123123123")
this.getCategoryData();
watchUserInfoChange((info) => {
this.userInfo = info.userInfo
}, this);
this.refreshUserData();
},
hide() {
},
readyCategory() {
setTimeout(() => {
this.initHeight()
}, 300)
},
getCategoryData() {
getCategorys((success, data) => {
if (success) {
let result = data ? data.map(item => {
return new Category(item)
}).sort((a, b) => {
return a.sort - b.sort
}) : [];
result.unshift(new Category({
name: "全部",
id: ""
}))
this.categorys = result;
}
})
},
initHeight() {
const query = uni.createSelectorQuery().in(this);
// query.select("#navi").boundingClientRect();
// query.select("#search").boundingClientRect();
query.select("#category").boundingClientRect();
query.exec((res) => {
let result = 0;
res.forEach(item => {
result = result + item.height;
})
this.listHeight = this.windowHeight - result;
})
},
changeCategory(e) {
this.changeCurrent(e.index);
},
changeSwiper(e) {
this.changeCurrent(e.detail.current);
},
changeCurrent(index) {
if (index != this.currentIndex) {
this.currentIndex = index;
}
},
refreshUserData() {
if (this.userInfo) {
refreshUserInfo();
}
}
}
}
</script>
<style lang="scss">
.name {
font-size: 34rpx;
font-weight: 700;
}
</style>
\ No newline at end of file
<template> <template>
<z-paging :style="[bgStyle]"> <z-paging :style="[bgStyle]">
<c-empty v-if='showEmpty'></c-empty> <template v-if="bookData">
<template v-else>
<detail-warn></detail-warn> <detail-warn></detail-warn>
<detail-thumb :detail='bookData' @tapThumb='tapThumb'></detail-thumb> <detail-thumb :detail='bookData' @tapThumb='tapThumb'></detail-thumb>
<detail-content @tapVip='tapPayPop' :detail='bookData' :userInfo='userInfo'></detail-content> <detail-content @tapVip='tapPayPop' :detail='bookData' :userInfo='userInfo'></detail-content>
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
:vedioId="bookData.id" @paySuccess="paySuccess"> :vedioId="bookData.id" @paySuccess="paySuccess">
</coin-popup> </coin-popup>
</template> </template>
<c-empty v-else emptyTitle="正在加载中~"></c-empty>
<c-login :isShareLink="true"></c-login> <c-login :isShareLink="true"></c-login>
<popup :show="showMoibleLogin" @close="showMoibleLogin=false"> <popup :show="showMoibleLogin" @close="showMoibleLogin=false">
<view> <view>
...@@ -142,14 +142,14 @@ ...@@ -142,14 +142,14 @@
uni.startPullDownRefresh({}) uni.startPullDownRefresh({})
}) })
// 绑定分享参数 // // 绑定分享参数
// #ifdef MP-WEIXIN // // #ifdef MP-KUAISHOU
wx.onCopyUrl(() => { // ks.onCopyUrl(() => {
return { // return {
query: `bookId=${this.bookData.id}` // query: `bookId=${this.bookData.id}`
} // }
}) // })
// #endif // // #endif
}, },
onShow() { onShow() {
refreshUserInfo(); refreshUserInfo();
...@@ -167,10 +167,10 @@ ...@@ -167,10 +167,10 @@
removeContentFormatChangeWatch(this); removeContentFormatChangeWatch(this);
removeUserInfoChangeWatch(this); removeUserInfoChangeWatch(this);
// 取消绑定分享参数 // // 取消绑定分享参数
// #ifdef MP-WEIXIN // // #ifdef MP-KUAISHOU
wx.offCopyUrl() // ks.offCopyUrl()
// #endif // // #endif
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refreshBookData(this.bookId) this.refreshBookData(this.bookId)
...@@ -282,7 +282,7 @@ ...@@ -282,7 +282,7 @@
} }
}) })
break; break;
case 'setting': // 设置 case 'setting': // 设置
this.showSetting = true; this.showSetting = true;
break; break;
default: default:
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
this.showBean = true; this.showBean = true;
}, },
// 关闭设置弹窗 // 关闭设置弹窗
closePop(e) { closePop(e) {
this.showSetting = false; this.showSetting = false;
}, },
// 关闭会员弹窗 // 关闭会员弹窗
......
...@@ -12,12 +12,13 @@ import { ...@@ -12,12 +12,13 @@ import {
apiGET, apiGET,
apiPOST apiPOST
} from "../../../../common/utils/apiRequest.js" } from "../../../../common/utils/apiRequest.js"
import Book from "../../../../common/models/Book";
/** 获取文章详情 /** 获取文章详情
* @param {Object} bookId * @param {Object} bookId
* @param {Object} callback * @param {Object} callback
*/ */
function getBookDetailData(bookId, callback) { function getBookDetailData(bookId, callback) {
apiPOST({ apiPOST({
url: `/book/info`, url: `/book/info`,
data: { data: {
......
<template> <template>
<view v-if="localActiviteFlag==1" class="body"> <view class="body">
<view style="height: 92%;"> <view style="height: 92%;">
<bookshelf v-show="currentPage==0" ref="index" /> <bookshelf v-show="currentPage==0" ref="index" />
<warehouse v-show="currentPage==1" ref="recommend" /> <warehouse v-show="currentPage==1" ref="recommend" />
...@@ -36,22 +36,6 @@ ...@@ -36,22 +36,6 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else class="body">
<view
:style="'display: flex;flex-direction: row;align-items: center;margin: 20rpx;padding-left: 10rpx;margin-top:'+10+'px;'">
<image class="avatar" src="@/static/logo-about.png"></image>
<view>
<view style="font-size: 34rpx;color: black;margin-left: 30rpx;">用户ID:{{localIdcode}}</view>
<view style="font-size: 26rpx;color: #b5b5b5;margin-left: 30rpx;margin-top: 10rpx;">
书中自有颜如玉,书中自有黄金屋,书中自有千钟黍</view>
</view>
</view>
<view style="height: 92%;">
<warehouse v-show="currentPage==1" ref="recommend" />
</view>
</view>
</template> </template>
<script> <script>
...@@ -77,13 +61,11 @@ ...@@ -77,13 +61,11 @@
data() { data() {
return { return {
currentPage: 1, currentPage: 1,
localActiviteFlag: 0,
localIdcode: 0, localIdcode: 0,
} }
}, },
onLoad(options) { onLoad(options) {
let index = options.index ?? '' let index = options.index ?? ''
this.localActiviteFlag = options.activiteFlag;
this.localIdcode = options.idcode; this.localIdcode = options.idcode;
if (index != '' && index != undefined) { if (index != '' && index != undefined) {
this.currentPage = index this.currentPage = index
...@@ -107,13 +89,6 @@ ...@@ -107,13 +89,6 @@
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
this.loadComponentData(); this.loadComponentData();
let that = this let that = this
if (this.localActiviteFlag == 1) {
uni.$on('goWareHouse', function(data) {
that.tabChange(1)
})
}
uni.$on('refreshPreviousPage', (data) => { uni.$on('refreshPreviousPage', (data) => {
if (data.vipFlag == '1') { if (data.vipFlag == '1') {
...@@ -131,18 +106,12 @@ ...@@ -131,18 +106,12 @@
this.loadComponentData(); this.loadComponentData();
}, },
loadComponentData() { loadComponentData() {
if (this.localActiviteFlag == 1) { if (this.currentPage == 0) {
if (this.currentPage == 0) { this.$refs.index.show();
this.$refs.index.show(); } else if (this.currentPage == 1) {
} else if (this.currentPage == 1) { this.$refs.recommend.show();
this.$refs.recommend.show(); } else if (this.currentPage == 2) {
} else if (this.currentPage == 2) { this.$refs.user.show();
this.$refs.user.show();
}
} else {
if (this.currentPage == 1) {
this.$refs.recommend.show();
}
} }
} }
} }
......
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
this.tips1 = options.tips1 this.tips1 = options.tips1
}, },
onShow(options) { onShow(options) {
this.ttLoging() this.ksLoging()
}, },
methods: { methods: {
ttLoging() { ksLoging() {
var that = this; var that = this;
var obj = ks.getLaunchOptionsSync() var obj = ks.getLaunchOptionsSync()
...@@ -89,11 +89,8 @@ ...@@ -89,11 +89,8 @@
app.globalData.userId = data.idcode; app.globalData.userId = data.idcode;
saveToken(data.token) saveToken(data.token)
setTimeout(() => { setTimeout(() => {
redirectTo('home?activiteFlag=' + data.activiteFlag + redirectTo('home?&idcode=' + data.idcode);
"&idcode=" + data.idcode); }, 500);
// redirectTo('/pagesA/vipPay/vipPay');
}, 1000);
} }
}); });
}, },
......
...@@ -43,21 +43,21 @@ ...@@ -43,21 +43,21 @@
</view> </view>
<view class="trialStyle"> <view class="trialStyle">
<text v-if="hintText"> <text v-if="hintText">
{{hintText}} {{hintText}}
</text> </text>
</view> </view>
<view class="agreementWrp"> <view class="agreementWrp">
<checkbox-group @change="checkboxChange" style="width: 50rpx;"> <checkbox-group @change="checkboxChange" style="width: 50rpx; margin-right: 10rpx;">
<checkbox :checked="checked" style="transform:scale(0.9)"> <checkbox :checked="checked" style="transform:scale(0.9)">
</checkbox> </checkbox>
</checkbox-group> </checkbox-group>
<text>您已阅读并同意 <view>您已阅读并同意
<text class="agreementText" @click="goAgreement(1)">《连续订阅服务协议》</text> <text class="agreementText" @click="goAgreement(1)">《连续订阅服务协议》</text>
<text class="agreementText" @click="goAgreement(2)">《支付协议》</text> <text class="agreementText" @click="goAgreement(2)">《支付协议》</text>
<text class="agreementText" @click="goAgreement(3)">《隐私政策》</text> <text class="agreementText" @click="goAgreement(3)">《隐私政策》</text>
</text> </view>
</view> </view>
<view class="section"> <view class="section">
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
} }
this.post({ this.post({
url: '/vip/getVipProducts/cyc', url: '/vip/getVipProducts',
showLoading: false, showLoading: false,
success: ({ success: ({
data data
...@@ -163,58 +163,27 @@ ...@@ -163,58 +163,27 @@
message.notify('暂不支持ios系统~'); message.notify('暂不支持ios系统~');
} else { } else {
this.post({ this.post({
url: '/vip/getVipPayParams/wechat', url: '/vip/getVipPayParams/kuaishou',
data: { data: {
pid: vipBean.pid, pid: vipBean.pid,
payChannel: 'WEIXIN' payChannel: 'kuaishou'
}, },
showLoading: true, showLoading: true,
success: ({ success: ({
data data
}) => { }) => {
if (vipBean.firstPayPrice == 0) { that.ksPay(data);
//签约
that.wxSign(data, vipBean.largeType);
} else {
//普通支付
that.wxPay(data, vipBean.largeType);
}
} }
}); });
} }
}, },
wxSign(wxData, largeType) { ksPay(ksData) {
let that = this; let that = this;
// 发起微信签约 ks.pay({
wx.navigateToMiniProgram({ serviceId: '1',
appId: "wxbd687630cd02ce1d", orderInfo: ksData.params,
path: 'pages/index/index', // paymentChannel: ksData.params.paymentChannel,
extraData: wxData.params, success() {
success(res) {
message.notify('支付成功')
setTimeout(() => {
navigateBack();
}, 1000);
},
fail(res) {
// 未成功跳转到签约小程序
console.log("wxSign fail=", res);
}
})
},
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('支付成功') message.notify('支付成功')
setTimeout(() => { setTimeout(() => {
...@@ -226,9 +195,9 @@ ...@@ -226,9 +195,9 @@
}); });
}, 1000); }, 1000);
}, },
fail(res) { fail() {
message.notify('取消支付') message.notify('支付失败');
} },
}) })
}, },
checkboxChange(e) { checkboxChange(e) {
...@@ -353,8 +322,8 @@ ...@@ -353,8 +322,8 @@
} }
.label { .label {
margin-top: -4rpx; // margin-top: -4rpx;
margin-left: -4rpx; // margin-left: -4rpx;
border-radius: 20rpx 0 20rpx 0; border-radius: 20rpx 0 20rpx 0;
width: 80%; width: 80%;
background: linear-gradient(90deg, #FC4F3B, #FBCB7A); background: linear-gradient(90deg, #FC4F3B, #FBCB7A);
...@@ -370,9 +339,9 @@ ...@@ -370,9 +339,9 @@
} }
.label2 { .label2 {
margin-bottom: -4rpx; // margin-bottom: -4rpx;
margin-left: -4rpx; // margin-left: -4rpx;
margin-right: -4rpx; // margin-right: -4rpx;
width: 100%; width: 100%;
border-radius: 0 0 20rpx 20rpx; border-radius: 0 0 20rpx 20rpx;
background-color: #FC4F3B; background-color: #FC4F3B;
...@@ -408,7 +377,8 @@ ...@@ -408,7 +377,8 @@
color: darkgray; color: darkgray;
font-size: 26rpx; font-size: 26rpx;
margin-top: 30rpx; margin-top: 30rpx;
padding-left: 30rpx; padding: 0 30rpx;
.agreementText { .agreementText {
color: #387EF4; color: #387EF4;
...@@ -416,7 +386,7 @@ ...@@ -416,7 +386,7 @@
} }
} }
.trialStyle { .trialStyle {
height: 60rpx; height: 60rpx;
padding: 40rpx; padding: 40rpx;
font-size: 22rpx; font-size: 22rpx;
......
export const PAKEAGE_NAME = 'com.mingce.kshelibook'
export const PAKEAGE_NAME = 'com.mingce.wxhelibook' export const VERSION_CODE = '1.0.0'
export const VERSION_CODE = '1.0.3'
// export const PAKEAGE_NAME = 'com.test.test'
export function trim(str) { export function trim(str) {
return str ? str.replace(/(^\s*)|(\s*$)/g, "") : '' return str ? str.replace(/(^\s*)|(\s*$)/g, "") : ''
......
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