首页跳转充值修改,充值界面增加开通功能
This commit is contained in:
@@ -87,8 +87,9 @@
|
||||
url: '/pages/member/activatedmemberone?shopId=' + uni.cache.get('shopUser')
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('member/memberdetails', {
|
||||
shopId_id: uni.cache.get('shopUser'),
|
||||
uni.pro.navigateTo('member/index', {
|
||||
shopId: uni.cache.get('shopUser'),
|
||||
type: 'index',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
this.switchdata = false
|
||||
uni.cache.set('userInfo', resdata .data);
|
||||
uni.pro.redirectTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopUser')
|
||||
shopId: this.shopId,
|
||||
type: 'index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,15 @@
|
||||
<view class="fivecontent" @tap="$u.debounce(userbalancerechangesub, 500)">
|
||||
立即充值
|
||||
</view>
|
||||
|
||||
<!-- 开通会员 -->
|
||||
<u-popup :show="memberOpen" :closeOnClickOverlay="true" overlayOpacity="0.8" :round="20" mode="bottom" @close="memberCancel" height="500">
|
||||
<view class="u-popup-content">
|
||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wkthuiyuanbg.png" class="imgstyle" mode=""></image>
|
||||
<button class="btnclass" open-type="getPhoneNumber" @getphonenumber="sumbit">立即开通 </button>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -31,20 +40,121 @@
|
||||
listdata: [],
|
||||
amount: '',
|
||||
userInfo: {},
|
||||
shopId: ''
|
||||
shopId: '',
|
||||
tokenShow: true,
|
||||
memberOpen: false,
|
||||
usershopUserinfo: null,
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.shopId = e.shopId
|
||||
if (e.type == 'list') { //从列表进来的
|
||||
this.paygetShopByMember(e.shopId)
|
||||
} else {
|
||||
this.paygetShopByMember(e.shopId)
|
||||
console.log(e)
|
||||
if ( e.type == 'list' || e.type == 'index') {
|
||||
this.shopId = e.shopId;
|
||||
this.init();
|
||||
}
|
||||
this.paygetActive(e.shopId) //列表
|
||||
|
||||
if (e.q) {
|
||||
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
|
||||
if (!uni.cache.get('token')) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
try {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await this.api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: infoRes.rawData
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
this.tokenShow = false;
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
console.log(this.shopId)
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
let res = await this.api.shopUserInfo({
|
||||
"shopId": this.shopId,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.usershopUserinfo = res.data
|
||||
}
|
||||
if ( this.usershopUserinfo.isVip == 0 ) {
|
||||
this.memberOpen = true;
|
||||
return;
|
||||
}
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
},
|
||||
memberCancel () {
|
||||
let pages = getCurrentPages()
|
||||
if ( pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.exitMiniProgram({
|
||||
success: function () {
|
||||
console.log('退出成功');
|
||||
},
|
||||
fail: function () {
|
||||
console.log('退出失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
sumbit(d) {
|
||||
if (d.detail.iv) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
let res = await this.api.userwxlogins({
|
||||
code: data.code,
|
||||
encryptedData: d.detail.encryptedData,
|
||||
iv: d.detail.iv,
|
||||
shopId: this.shopId
|
||||
})
|
||||
if (res.code == 0) {
|
||||
let resdata = await this.api.loginwxuserInfo({
|
||||
userId: uni.cache.get('userInfo').id
|
||||
})
|
||||
if (resdata.code == 0) {
|
||||
uni.cache.set('userInfo', resdata .data);
|
||||
this.memberOpen = false
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
getQueryString(url, name) { //解码
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
var r = url.substr(1).match(reg)
|
||||
if (r != null) {
|
||||
return r[2]
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async paygetShopByMember(w) {
|
||||
let res = await this.api.paygetShopByMember({
|
||||
page: 1,
|
||||
@@ -60,6 +170,7 @@
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
try {
|
||||
this.listdata = res.data.list
|
||||
this.amount = res.data.list[0].minNum
|
||||
@@ -328,5 +439,35 @@
|
||||
border-radius: 8rpx;
|
||||
background: #F1CB66;
|
||||
}
|
||||
.imgstyle {
|
||||
width: 694rpx;
|
||||
height: 414rpx;
|
||||
margin: 70rpx auto;
|
||||
}
|
||||
|
||||
.btnclass {
|
||||
width: 694rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background: #6D89A4;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
color: #FFFFFF;
|
||||
bottom: 50rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
.u-popup-content {
|
||||
height: 80vh; /* 设置高度为视口高度的50% */
|
||||
width: 100%;
|
||||
/* 其他样式 */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user