From d82bd93033f9abfb134d92beaee706134ec7ccdf Mon Sep 17 00:00:00 2001
From: GaoHao <1210693421@qq.com>
Date: Thu, 8 Aug 2024 16:02:54 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=B7=B3=E8=BD=AC=E5=85=85?=
=?UTF-8?q?=E5=80=BC=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=85=85=E5=80=BC=E7=95=8C?=
=?UTF-8?q?=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=BC=80=E9=80=9A=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/index/indexs.vue | 5 +-
pages/member/activatedmemberone.vue | 3 +-
pages/member/index.vue | 157 ++++++++++++++++++++++++++--
3 files changed, 154 insertions(+), 11 deletions(-)
diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue
index 0dba44e..25d6b33 100644
--- a/pages/index/indexs.vue
+++ b/pages/index/indexs.vue
@@ -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 {
diff --git a/pages/member/activatedmemberone.vue b/pages/member/activatedmemberone.vue
index 66539e9..838cec3 100644
--- a/pages/member/activatedmemberone.vue
+++ b/pages/member/activatedmemberone.vue
@@ -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'
})
}
diff --git a/pages/member/index.vue b/pages/member/index.vue
index c159a44..afa681d 100644
--- a/pages/member/index.vue
+++ b/pages/member/index.vue
@@ -16,6 +16,15 @@
立即充值
+
+
+
+
+
+
@@ -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%;
+ /* 其他样式 */
+ }
}
\ No newline at end of file