Commit 6405d2c3 by zhangzhen

细节优化

parent 4924ef47
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
success: (res) => { success: (res) => {
login(res.code).then(res => { login(res.code).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.setStorageSync('loginStatus', res.data.data.type)
if (res.data.data.type === "login") { if (res.data.data.type === "login") {
uni.setStorageSync('tokenHeaders', "Authori-zation") uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({ uni.setStorage({
......
...@@ -7,7 +7,7 @@ const CONFIG = { ...@@ -7,7 +7,7 @@ const CONFIG = {
// baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址 // baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
// baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址 // baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
baseUrl: 'http://129.211.46.84:8883/front-api', baseUrl: 'http://129.211.46.84:8883/front-api',
hostUrl: 'http://129.211.46.84:8882/prod-api', // H5地址(前端运行地址) hostUrl: 'http://129.211.46.84:8888/prod-api', // H5地址(前端运行地址)
// hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址) // hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
weixinAppId: '' ,// 微信公众号appid weixinAppId: '' ,// 微信公众号appid
...@@ -20,7 +20,7 @@ const CONFIG = { ...@@ -20,7 +20,7 @@ const CONFIG = {
// assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径 // assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
baseUrl: 'http://129.211.46.84:8883/front-api', // 后台接口请求地址 baseUrl: 'http://129.211.46.84:8883/front-api', // 后台接口请求地址
// baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址 // baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
hostUrl: 'http://129.211.46.84:8882/prod-api', // H5地址(前端运行地址) hostUrl: 'http://129.211.46.84:8888/prod-api', // H5地址(前端运行地址)
// hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址) // hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
weixinAppId: '', // 微信公众号appid weixinAppId: '', // 微信公众号appid
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</view> </view>
</view> </view>
<view class="banner2"> <view class="banner2">
<image :src="assetsPath +'/banner3.png'" mode="widthFix"></image> <image :src="assetsPath +'/banner4.png'" mode="widthFix"></image>
</view> </view>
<view class="flex-col list-box"> <view class="flex-col list-box">
<!-- <view class="title titleStyle"> <!-- <view class="title titleStyle">
...@@ -944,8 +944,7 @@ ...@@ -944,8 +944,7 @@
.banner2 { .banner2 {
width: 674upx; width: 674upx;
margin: 0 auto; margin: 10upx auto 20upx;
image { image {
display: block; display: block;
width: 100%; width: 100%;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</view> </view>
<view class="flex-col item-content" :class="rechargeIndex === k?'active':''"> <view class="flex-col item-content" :class="rechargeIndex === k?'active':''">
<view v-if="item.giveType.includes('1')" class="preferential"> <view v-if="item.giveType.includes('1')" class="preferential">
<text>{{item.giveAmount}}小时</text> <text>{{item.giveAmount}}</text>
</view> </view>
<view v-else-if="item.giveType.includes('2')" class="preferential"> <view v-else-if="item.giveType.includes('2')" class="preferential">
<text>{{item.giveDuration}}小时</text> <text>{{item.giveDuration}}小时</text>
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
<view class="flex-3"> <view class="flex-3">
<view class="flex-row"> <view class="flex-row">
<text class="text-1"></text> <text class="text-1"></text>
<text class="text-2">{{equityAmountList[0]}}.</text> <text class="text-2">{{equityAmountList.length? equityAmountList[0]:'99'}}.</text>
<text class="text-3">{{equityAmountList[1]}}</text> <text class="text-3">{{equityAmountList.length? equityAmountList[1]:'00'}}</text>
</view> </view>
<view class="cu-btn-box" @tap="onSubmit"> <view class="cu-btn-box" @tap="onSubmit">
<button class="cu-btn" <button class="cu-btn"
...@@ -167,6 +167,86 @@ ...@@ -167,6 +167,86 @@
<view class="rule-btn" @tap="onNavToRule"> <view class="rule-btn" @tap="onNavToRule">
<text>规则</text> <text>规则</text>
</view> </view>
<uni-popup ref="popup" type="center">
<view class="popup-box">
<view class="title-header">
<text class="text-title text-black text-lg text-bold">提示</text>
</view>
<view class="popup-content">
<text>购买或充值前请先授权登录,请确认是否授权登录?</text>
</view>
<view class="btn-list-box">
<view class="btn-box">
<button class="cu-btn bg-gray" @tap="onClose">取 消</button>
</view>
<view class="btn-box">
<button class="cu-btn bg-pink" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">授 权</button>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="popupPay" type="bottom">
<view class="popup-box popup-box-2">
<view class="title-header">
<text class="text-title text-black text-lg text-bold">购买详情</text>
<text class="cuIcon-roundclose text-xl text-icon" @tap="onClose"></text>
</view>
<view v-if="rechargeConfList.length" class="flex-col popup-content">
<view v-if="tabIndex ==1" class="recharge-content">
<text class="text-1">余额充值,多充多送,待支付:</text>
<view class="payfee-text">
<text>{{rechargeConfList[rechargeIndex].rechargeAmount}}</text>
</view>
<view class="flex-row">
<text class="text-3">赠送:</text>
<view class="flex-col">
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('1')">
<text class="text-11"></text>
<text class="text-12">{{rechargeConfList[rechargeIndex].giveAmount}}</text>
<text class="text-13">钱包余额,下单可抵扣</text>
</view>
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('2')">
<text class="text-12">{{rechargeConfList[rechargeIndex].giveDuration}}小时</text>
<text class="text-13">时长,下单可抵扣</text>
</view>
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('3')">
<text class="text-14">优惠券</text>
<text class="text-13">1张,下单可抵扣</text>
</view>
</view>
</view>
</view>
<view v-else-if="tabIndex ==2" class="recharge-content">
<text class="text-1">购买权益,优惠享不停,待支付:</text>
<view class="payfee-text">
<text>{{equityAmountList[0].requiredAmount}}</text>
</view>
<view class="flex-row">
<text class="text-3">可享权益:</text>
<view class="flex-col">
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('1')">
<text class="text-13">房间预定,下单即可享98折起</text>
</view>
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('2')">
<text class="text-13">房间预定,下单即可享会员积分赠送</text>
</view>
<view class="flex-row-center" v-if="rechargeConfList[rechargeIndex].giveType.includes('3')">
<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="onConfirmPay">确认支付</button>
</view>
</view>
</view>
</uni-popup>
<f-tabbar></f-tabbar> <f-tabbar></f-tabbar>
</view> </view>
</template> </template>
...@@ -180,7 +260,8 @@ ...@@ -180,7 +260,8 @@
} from "@/api/uerInfo.js"; } from "@/api/uerInfo.js";
import { import {
getUserInfo, register,
getUserInfo
} from "@/api/index.js" } from "@/api/index.js"
import { import {
...@@ -202,6 +283,7 @@ ...@@ -202,6 +283,7 @@
tabIndex: 1, tabIndex: 1,
rechargeIndex: 0, rechargeIndex: 0,
index: 0, index: 0,
phoneCode:'',
consumerMemberStatus: false, consumerMemberStatus: false,
equityAmountList:[], equityAmountList:[],
preferList: [{ preferList: [{
...@@ -263,6 +345,54 @@ ...@@ -263,6 +345,54 @@
this.onLoading(); this.onLoading();
}, },
methods: { methods: {
onConfirmPay(){
if(this.tabIndex ==1){
this.onCreateRecharge()
}else if(this.tabIndex ==2){
this.onCreateEquityMembers()
}
},
onClose(){
this.$refs.popup.close()
this.$refs.popupPay.close()
},
onGetPhoneNumber(e){
if(e.detail.errMsg !== "getPhoneNumber:ok") return;
this.onClose();
let that = this;
this.phoneCode = e.detail.code;
wx.login({
success: (res) => {
uni.showLoading({
title: "授权中"
})
register({
loginCode:res.code,
phoneCode: this.phoneCode,
type: "routine",
}).then(res => {
uni.hideLoading();
console.log(JSON.stringify(res),"注册后的数据结构")
if (res.data.code == 200) {
uni.setStorageSync('loginStatus', res.data.data.type || 'login')
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token,
success: (res) => {
if(that.tabIndex ==1 ){
that.onNavToRecharge();
}else{
that.onSubmit();
}
}
})
}
})
}
})
},
onGetUserInfo() { onGetUserInfo() {
getUserInfo().then(res => { getUserInfo().then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -315,6 +445,23 @@ ...@@ -315,6 +445,23 @@
this.tabIndex = val; this.tabIndex = val;
this.checked = false; this.checked = false;
}, },
onNavToRule() {
uni.navigateTo({
url: "/setting/rule/rule?keyData=vip_user_rule"
})
},
onNavToRule2() {
uni.navigateTo({
url: "/setting/rule/rule?keyData=user_pay_protocol"
})
},
onNavToRule3(){
uni.navigateTo({
url: "/setting/rule/rule?keyData=user_equity_details"
})
},
onSubmit() { onSubmit() {
if(this.consumerMemberStatus) return; if(this.consumerMemberStatus) return;
if (!this.checked) { if (!this.checked) {
...@@ -324,13 +471,33 @@ ...@@ -324,13 +471,33 @@
}) })
return; return;
} }
let that = this; if(uni.getStorageSync('loginStatus') != 'login'){
this.$refs.popup.open();
return
}
this.$refs.popupPay.open();
},
onNavToRecharge() {
if (!this.checked) {
uni.showToast({
icon: "none",
title: "请先阅读充值协议并同意"
})
return;
}
if(uni.getStorageSync('loginStatus') != 'login'){
this.$refs.popup.open();
return
}
this.$refs.popupPay.open();
},
onCreateRecharge(){
uni.showLoading({ uni.showLoading({
title: "提交中..." title: "提交中..."
}) })
createEquityMembers({ createRecharge({
payType: 1, payType: 1,
equityMembersConfigId: this.list[this.index].id rechargeConfId: this.rechargeConfList[this.rechargeIndex].id
}).then(res => { }).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res.data.data.jsConfig) { if (res.data.data.jsConfig) {
...@@ -346,9 +513,7 @@ ...@@ -346,9 +513,7 @@
icon: "success", icon: "success",
title: "下单成功", title: "下单成功",
success: () => { success: () => {
setTimeout(() => {
that.onGetUserInfo();
}, 1000)
} }
}) })
}, },
...@@ -366,35 +531,14 @@ ...@@ -366,35 +531,14 @@
}) })
}, },
onNavToRule() { onCreateEquityMembers(){
uni.navigateTo({ let that = this;
url: "/setting/rule/rule?keyData=vip_user_rule"
})
},
onNavToRule2() {
uni.navigateTo({
url: "/setting/rule/rule?keyData=user_pay_protocol"
})
},
onNavToRule3(){
uni.navigateTo({
url: "/setting/rule/rule?keyData=user_equity_details"
})
},
onNavToRecharge() {
if (!this.checked) {
uni.showToast({
icon: "none",
title: "请先阅读充值协议并同意"
})
return;
}
uni.showLoading({ uni.showLoading({
title: "提交中..." title: "提交中..."
}) })
createRecharge({ createEquityMembers({
payType: 1, payType: 1,
rechargeConfId: this.rechargeConfList[this.rechargeIndex].id equityMembersConfigId: this.list[this.index].id
}).then(res => { }).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res.data.data.jsConfig) { if (res.data.data.jsConfig) {
...@@ -410,7 +554,9 @@ ...@@ -410,7 +554,9 @@
icon: "success", icon: "success",
title: "下单成功", title: "下单成功",
success: () => { success: () => {
setTimeout(() => {
that.onGetUserInfo();
}, 1000)
} }
}) })
}, },
...@@ -425,7 +571,6 @@ ...@@ -425,7 +571,6 @@
} }
}); });
} }
}) })
} }
} }
...@@ -998,4 +1143,103 @@ ...@@ -998,4 +1143,103 @@
text-align: center; text-align: center;
} }
} }
.popup-box{
display: flex;
flex-direction: column;
background: linear-gradient(-45deg,rgba(255, 170, 0, 0.98), rgba(255,255,255,0.98));
border-radius: 12upx;
width: 80%;
margin: 0 auto;
.title-header{
display: flex;
justify-content: center;
align-items: center;
padding: 24upx 0;
border-bottom: 1px dashed #fce051;
}
.popup-content{
display: flex;
align-items: center;
padding: 30upx 24upx;
min-height: 180upx;
}
.btn-list-box{
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
border-top: 1px solid #fce051;
.btn-box{
display: flex;
flex: 1;
justify-content: center;
align-items: center;
padding: 24upx 0;
.cu-btn{
width: 80%;
}
.bg-gray{
// color: #ffffff;
}
.bg-pink{
background-color: rgba(224, 57, 151, 0.74);
}
}
}
}
.popup-box-2{
width: 100%;
border-radius: 20upx 20upx 0 0;
.title-header{
display: flex;
justify-content: space-between;
padding: 30upx 24upx;
.text-icon{
font-size: 50upx;
color: #ffffff;
}
}
.popup-content{
min-height: 240upx;
.recharge-content{
display: flex;
flex-direction: column;
width: 100%;
.text-1{
font-size: 26upx;
}
.payfee-text{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
font-size: 52upx;
color: rgba(224, 57, 151, 1);
font-weight: bolder;
margin: 24upx 0;
}
.flex-row{
.text-3{
color: #999999;
}
.flex-col{
.text-11{
color: rgba(224, 57, 151, 0.9);
}
.text-12{
color: rgba(224, 57, 151, 0.9);
font-size: 36upx;
}
.text-13{
color: #333333;
margin-left: 4upx;
}
.text-14{
color: rgba(224, 57, 151, 0.9);
}
}
}
}
}
}
</style> </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