Commit 98e45b11 by zhangzhen

次卡月卡功能添加

parent 1221b817
......@@ -56,3 +56,26 @@ export const equityDuration=(data)=>{
let url=`/durationLog/sumVariableDuration`
return http.get(url,data)
}
export const monthlyCardConf=(data)=>{
let url=`/monthlyCardConf/query`
return http.get(url,data)
}
export const createMonthlyCardOrder=(data)=>{
let url=`/monthlyCardOrder/createMonthlyCard`
return http.post(url,data)
}
export const secondaryCardConf=(data)=>{
let url=`/secondaryCardConf/query`
return http.get(url,data)
}
export const createSecondaryCardOrder=(data)=>{
let url=`/secondaryCardOrder/createSecondaryCardOrder`
return http.post(url,data)
}
......@@ -120,12 +120,12 @@
</view>
</view>
<view v-if="false" class="flex-3">
<view v-if="userInfo && userInfo.secondaryCardList && userInfo.secondaryCardList.length" class="flex-3">
<text class="text-1">次卡</text>
<text class="text-2">权益会员专享</text>
<view class="flex-row">
<text class="text-3">还剩</text>
<text class="text-4">3</text>
<text class="text-4">{{userInfo.secondaryCardList[0].number}}</text>
<text class="text-3"></text>
</view>
</view>
......
......@@ -250,25 +250,103 @@
<view class="flex-5">
<view class="flex-row">
<text class="text-1">次卡</text>
<text class="text-2">充值 畅玩无忧</text>
<text class="text-2">专属购 畅玩无忧</text>
</view>
<text class="text-3">有效期:领取后1年内有效</text>
</view>
<view class="flex-3">
<view class="flex-col">
<!-- <view class="flex-col">
<text class="text-2">暂未上线</text>
<text class="text-2">敬请期待</text>
</view> -->
<view class="flex-row">
<text class="text-1"></text>
<text
class="text-2">{{secondaryCardConf? secondaryCardConf.amountArr[0]:'99'}}.</text>
<text
class="text-3">{{secondaryCardConf? secondaryCardConf.amountArr[1]:'00'}}</text>
</view>
<view class="cu-btn-box" @tap="onSubmitBuyTimesCar">
<button class="cu-btn bg-pink">立即购买</button>
</view>
</view>
</view>
</view>
<view class="rule-tip">
<checkbox-group @change="onRuleTipChange3">
<checkbox class='round yellow' :class="checked3?'checked':''" :checked="checked3"
value="checked" style="transform: scale(0.6);"></checkbox>
</checkbox-group>
<text>我已阅读</text><text class="text-pink" @tap="onNavToRule2">用户充值协议</text><text>, 并同意协议内容</text>
</view>
</view>
</view>
</view>
<view v-if="tabIndex ==2" class="bg-box-1 margin-top">
<view class="bg-box-2">
<view class="flex-col list-box-2">
<view class="flex-row-center title-content">
<view class="xx">
<image :src="assetsPath+'/xx.png'" mode="widthFix"></image>
</view>
<view class="title-text">
<view class="text">
<text>月卡专属购</text>
</view>
<view class="line">
</view>
</view>
<view class="xx">
<image :src="assetsPath+'/xx.png'" mode="widthFix"></image>
</view>
</view>
<view class="flex-row part-1">
<view class="text-bg-1">
<text>专属</text>
</view>
<text class="text-2">超值回馈!</text>
<text class="text-3">(权益会员独享)</text>
</view>
<view class="part-2">
<image class="img-bg" :src="assetsPath+'/vip/qy_bg_1.png'" mode="widthFix"></image>
<view class="absolute">
<view class="flex-5">
<view class="flex-row">
<text class="text-1">月卡</text>
<text class="text-2">专属购 畅玩无忧</text>
</view>
<text class="text-3">有效期:领取后1年内有效</text>
</view>
<view class="flex-3">
<!-- <view class="flex-col">
<text class="text-2">暂未上线</text>
<text class="text-2">敬请期待</text>
</view> -->
<view class="flex-row">
<text class="text-1"></text>
<text
class="text-2">{{monthlyCardConf? monthlyCardConf.amountArr[0]:'99'}}.</text>
<text
class="text-3">{{monthlyCardConf? monthlyCardConf.amountArr[1]:'00'}}</text>
</view>
<view class="cu-btn-box" @tap="onSubmitBuyMonthsCar">
<button class="cu-btn bg-pink">立即购买</button>
</view>
</view>
</view>
</view>
<view class="rule-tip">
<checkbox-group @change="onRuleTipChange2">
<checkbox class='round yellow' :class="checked2?'checked':''" :checked="checked2"
<checkbox-group @change="onRuleTipChange4">
<checkbox class='round yellow' :class="checked4?'checked':''" :checked="checked4"
value="checked" style="transform: scale(0.6);"></checkbox>
</checkbox-group>
<text>我已阅读</text><text class="text-pink" @tap="onNavToRule2">1用户充值协议</text><text>, 并同意协议内容</text>
<text>我已阅读</text><text class="text-pink" @tap="onNavToRule2">用户充值协议</text><text>, 并同意协议内容</text>
</view>
</view>
</view>
......@@ -397,6 +475,90 @@
</view>
</uni-popup>
<uni-popup ref="popupPay2" type="center">
<view class="popup-box-content">
<view class="popup-box popup-box-2">
<view class="close-box" @tap="onClose">
<text class="cuIcon-close text-xl text-icon"></text>
</view>
<view class="title-header">
<text class="text-title text-black text-lg text-bold">购买详情</text>
</view>
<view v-if="rechargeConfList.length" class="flex-col popup-content">
<view v-if="monthlyOrsecondary ==1" class="recharge-content">
<text class="text-1">· 次卡专属购,待支付:</text>
<view class="payfee-text">
<text>{{secondaryCardConf.secondaryCardAmount}}</text>
</view>
<view class="flex-row content-tip content-tip2">
<text class="text-3">优惠详情:</text>
<view class="flex-col">
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{secondaryCardConf.name}}</text>
<!-- <text class="text-13"></text> -->
</view>
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{secondaryCardConf.packName}}</text>
<text class="text-13">套餐,可享受</text>
</view>
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{secondaryCardConf.number}}</text>
<text class="text-13">次,可使用</text>
</view>
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{secondaryCardConf.validityPeriod}}</text>
<text class="text-13">年,可使用期限</text>
</view>
</view>
</view>
</view>
<view v-else-if="monthlyOrsecondary ==2" class="recharge-content">
<text class="text-1">月卡专属购,待支付:</text>
<view class="payfee-text">
<text>{{monthlyCardConf.monthlyCardAmount}}</text>
</view>
<view class="flex-row content-tip content-tip2">
<text class="text-3">优惠详情:</text>
<view class="flex-col">
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{monthlyCardConf.monthlyCardDays}}</text>
<text class="text-13">天期限内</text>
</view>
<view class="flex-row-center">
<view class="gift-box">
<text class="cuIcon-title text-pink"></text>
</view>
<text class="text-12">{{monthlyCardConf.freeDuration}}</text>
<text class="text-13">小时每天,可免费使用</text>
</view>
</view>
</view>
</view>
</view>
<view class="btn-list-box">
<view class="btn-box">
<button class="cu-btn bg-pink" @tap="onConfirmPay2">确认支付</button>
</view>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="popupShare" type="center">
<view class="popup-box-content popup-box-share">
<view class="popup-box popup-box-2">
......@@ -454,7 +616,11 @@
import {
rechargeConf,
createRecharge
createRecharge,
monthlyCardConf,
secondaryCardConf,
createSecondaryCardOrder,
createMonthlyCardOrder
} from "@/api/recharge.js";
import config from "@/config/index.config";
......@@ -474,6 +640,8 @@
qrPath: '',
checked: false,
checked2: false,
checked3: false,
checked4: false,
assetsPath: config.assetsPath,
list: [],
userInfo: {},
......@@ -559,10 +727,12 @@
routePath:'/pages/storeList/storeList'
},
],
monthlyCardConf:'',
secondaryCardConf:'',
monthlyOrsecondary:1,
};
},
onLoad(query) {
console.log(query, "页面传递过来的参数")
if (query.q) {
const q = decodeURIComponent(query.q)
let d = q.split('?')
......@@ -572,7 +742,6 @@
let l = item.split('=');
obj[l[0]] = l[1];
})
console.log(obj, "参数对象")
if (obj.uid) {
uni.setStorageSync("shareUserId", obj.uid)
this.tabIndex = 2
......@@ -596,6 +765,146 @@
}
},
methods: {
onGetMonthlyCardConf(){
monthlyCardConf().then(res => {
if (res.data.code == 200 && res.data.data && res.data.data.length) {
let list = res.data.data[0]
this.monthlyCardConf = {
...list,
amountArr: Number(list.monthlyCardAmount).toFixed(2).toString().split('.')
}
}
})
},
onGetSecondaryCardConf(){
secondaryCardConf().then(res => {
if (res.data.code == 200 && res.data.data && res.data.data.length) {
let list = res.data.data[0]
this.secondaryCardConf = {
...list,
amountArr: Number(list.secondaryCardAmount).toFixed(2).toString().split('.')
}
}
})
},
onSubmitBuyTimesCar(){
if (!this.checked3) {
uni.showToast({
icon: "none",
title: "请先阅读充值协议并同意"
})
return;
}
// 购买次卡操作
this.monthlyOrsecondary = 1;
this.$refs.popupPay2.open()
},
onSubmitBuyMonthsCar(){
if (!this.checked4) {
uni.showToast({
icon: "none",
title: "请先阅读充值协议并同意"
})
return;
}
// 购买月卡操作
this.monthlyOrsecondary = 2;
this.$refs.popupPay2.open()
},
onConfirmPay2(){
uni.showLoading({
title: "提交中..."
})
let that = this;
if(this.monthlyOrsecondary ===1){
createSecondaryCardOrder({
payType: 1,
secondaryCardConfId: this.secondaryCardConf.id
}).then(res => {
uni.hideLoading();
if (res.data.data.jsConfig) {
wx.requestPayment({
"timeStamp": res.data.data.jsConfig.timeStamp,
"nonceStr": res.data.data.jsConfig.nonceStr,
"package": res.data.data.jsConfig.packages,
"signType": res.data.data.jsConfig.signType,
"paySign": res.data.data.jsConfig.paySign,
"success": (resp) => {
// 支付成功
uni.showToast({
icon: "success",
title: "下单成功",
success: () => {
that.onClose()
setTimeout(() => {
uni.switchTab({
url: "/pages/my/myInfo"
})
}, 1000)
}
})
},
"fail": (resp) => {
// 取消支付或支付失败
uni.showToast({
title: "取消支付"
})
},
"complete": (resp) => {
that.onClose()
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
}
})
}else{
createMonthlyCardOrder({
payType: 1,
monthlyCardConfId: this.monthlyCardConf.id
}).then(res => {
uni.hideLoading();
if (res.data.data.jsConfig) {
wx.requestPayment({
"timeStamp": res.data.data.jsConfig.timeStamp,
"nonceStr": res.data.data.jsConfig.nonceStr,
"package": res.data.data.jsConfig.packages,
"signType": res.data.data.jsConfig.signType,
"paySign": res.data.data.jsConfig.paySign,
"success": (resp) => {
// 支付成功
uni.showToast({
icon: "success",
title: "下单成功",
success: () => {
that.onClose();
setTimeout(() => {
uni.switchTab({
url: "/pages/my/myInfo"
})
}, 1000)
}
})
},
"fail": (resp) => {
// 取消支付或支付失败
uni.showToast({
title: "取消支付"
})
},
"complete": (resp) => {
that.onClose()
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
}
})
}
},
onNavTo(val){
if(val.routePath){
uni.navigateTo({
......@@ -614,6 +923,7 @@
this.$refs.popup.close()
this.$refs.popupPay.close()
this.$refs.popupShare.close()
this.$refs.popupPay2.close()
},
onGetPhoneNumber(e) {
if (e.detail.errMsg !== "getPhoneNumber:ok") return;
......@@ -657,6 +967,8 @@
this.userInfo = res.data.data;
if (this.userInfo.consumerMember && this.userInfo.consumerMember.isRights) {
this.consumerMemberStatus = true;
this.onGetMonthlyCardConf();
this.onGetSecondaryCardConf();
}
}
})
......@@ -669,9 +981,14 @@
this.checked = e.detail.value.includes("checked")
},
onRuleTipChange2(e) {
console.log(e,9999)
this.checked2 = e.detail.value.includes("checked")
},
onRuleTipChange3(e) {
this.checked3 = e.detail.value.includes("checked")
},
onRuleTipChange4(e) {
this.checked4 = e.detail.value.includes("checked")
},
onLoading() {
equityMembersList().then(res => {
......@@ -846,12 +1163,10 @@
})
},
qrR(r) {
console.log(r, "二维码路径")
this.qrPath = r;
},
onShareByQrcode() {
this.text = `https://www.coujio.com/vipShare?uid=${this.userInfo.id}&act=0`;
console.log(this.text, "text")
this.loadMake = true;
this.$refs.popupShare.open()
},
......@@ -1671,6 +1986,12 @@
}
}
}
.content-tip2{
width: 90%;
.gift-box{
background: transparent!important;
}
}
}
}
......
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