yunshangxie/pages/index/user.vue

471 lines
16 KiB
Vue
Raw Permalink Normal View History

2023-12-25 17:56:30 +08:00
<template>
<view style="background-color: #EBF4F7;letter-spacing: 1rpx;">
2024-04-20 14:57:39 +08:00
<view :style="{paddingTop: vuex_custom_bar_height +40+ 'rpx'}"
style="background: linear-gradient(50deg, #034EF9 0%, #05ACFF 99%);height: 400rpx;">
<view class="tn-flex tn-flex-center tn-flex-col-center" style="padding: 30rpx;width: 100%;">
2024-05-21 18:16:48 +08:00
<view v-if="login && userInfo.photo_image">
2024-05-08 18:14:41 +08:00
<image :src="apiImgUrl+userInfo.photo_image"
2024-06-26 14:17:06 +08:00
@click="tn_ru('/pages/packageA/user/my_card?id='+userInfo.member_id)"
2024-05-08 18:14:41 +08:00
style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
</view>
2024-05-21 18:16:48 +08:00
<view v-if="!login || !userInfo.photo_image">
2024-05-08 18:14:41 +08:00
<image src="/static/def.png" style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
2024-04-20 14:57:39 +08:00
</view>
<view style="width: 100%;">
2024-06-04 18:04:09 +08:00
<view v-if="login" class="tn-flex tn-flex-col-center tn-flex-row-between">
<view style="margin-left: 20rpx;color: #fff"
2024-06-26 14:17:06 +08:00
@click="tn_ru('/pages/packageA/user/my_card?id='+userInfo.member_id)">
2024-05-08 18:14:41 +08:00
<view style="font-size: 35rpx;">{{ userInfo.nikename }}</view>
2024-06-21 16:15:26 +08:00
<view v-if="userInfo.position_name!=null" style="font-size: 24rpx;margin-top: 10rpx;">
{{userInfo.position_name}}
</view>
2024-06-04 18:04:09 +08:00
</view>
2024-06-26 14:17:06 +08:00
<view @click="tn('/pages/packageA/user/my_edit')">
2024-06-04 18:04:09 +08:00
<image src="/static/ico13.png" style="width: 40rpx ;" mode="widthFix"></image>
2024-04-20 14:57:39 +08:00
</view>
2024-05-08 18:14:41 +08:00
</view>
<view v-if="!login" class="tn-flex tn-flex-col-center tn-flex-row-between">
<view style="margin-left: 20rpx;color: #fff">
2024-06-21 16:15:26 +08:00
<!-- <tn-button @click="loginMod = true">点击登陆</tn-button> -->
<tn-button open-type="getPhoneNumber" @getphonenumber="PhoneLogin">点击登陆</tn-button>
2024-05-08 18:14:41 +08:00
</view>
<!-- <view @click="tn('/pages/index/my_edit')">-->
<!-- <image src="/static/ico13.png" style="width: 40rpx ;" mode="widthFix"></image>-->
<!-- </view>-->
2023-12-25 17:56:30 +08:00
</view>
</view>
</view>
</view>
<view>
<view style="padding: 30rpx;margin-top:-115rpx;background-color: transparent;">
<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between"
style="text-align: center;padding: 30rpx;background-color: #FFF;border-radius: 20rpx;box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(12,0,5,0.1);">
2024-04-24 17:34:38 +08:00
<view @click="tn('/pages/index/pizz_info?id='+userInfo.association_id)">
2023-12-25 17:56:30 +08:00
<view>
<image src="/static/ico5.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
<view style="margin-top: 10rpx;">
2024-04-23 11:58:07 +08:00
<text>所在商/协会</text>
2023-12-25 17:56:30 +08:00
</view>
</view>
2024-06-26 14:17:06 +08:00
<view @click="tn('/pages/packageA/user/events_my')">
2023-12-25 17:56:30 +08:00
<view>
<image src="/static/ico1.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
<view style="margin-top: 10rpx;">
<text>参与活动</text>
</view>
</view>
2024-06-26 14:17:06 +08:00
<view @click="tn('/pages/packageA/user/my_desc')">
2023-12-25 17:56:30 +08:00
<view>
<image src="/static/02_2.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
<view style="margin-top: 10rpx;">
<text>协会服务</text>
</view>
</view>
2024-06-26 14:17:06 +08:00
<view @click="tn('/pages/packageA/user/my_card?id='+userInfo.member_id)">
2023-12-25 17:56:30 +08:00
<view>
<image src="/static/ico6.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
<view style="margin-top: 10rpx;">
<text>我的名片</text>
</view>
</view>
</view>
</view>
2024-06-28 08:50:34 +08:00
<view style="background-color: #fff;padding-bottom: 0rpx;">
2023-12-25 17:56:30 +08:00
<view style="padding:0px 20rpx;">
2024-06-26 14:17:06 +08:00
<tn-list-cell v-if="login" :arrow="true" @click="tn('/pages/packageA/user/my_card_holder')">
2024-05-31 18:06:24 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
2024-06-03 18:19:31 +08:00
<image src="/static/icon13.png" style="width: 50rpx;height: 50rpx"></image>
2024-05-31 18:06:24 +08:00
<view style="margin-left: 20rpx;">名片夹</view>
</view>
</tn-list-cell>
2024-06-26 14:17:06 +08:00
<tn-list-cell v-if="login" :arrow="true" @click="tn('/pages/packageA/user/my_edit')">
2024-05-31 18:06:24 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
2024-06-03 18:19:31 +08:00
<image src="/static/icon14.png" style="width: 50rpx;height: 50rpx"></image>
2024-05-31 18:06:24 +08:00
<view style="margin-left: 20rpx;">信息修改</view>
</view>
</tn-list-cell>
2024-05-08 18:14:41 +08:00
<!-- <tn-list-cell :arrow="true" @click="tn('/pages/index/my_pizz')">-->
<!-- <view class="tn-flex tn-flex-center tn-flex-col-center">-->
<!-- <image src="/static/ico7.png" style="width: 50rpx;height: 50rpx"></image>-->
<!-- <view style="margin-left: 20rpx;">所在商/协会</view>-->
<!-- </view>-->
<!-- </tn-list-cell>-->
2024-05-27 17:40:54 +08:00
<tn-list-cell :arrow="true" v-if="userInfo.if_xianshi!=1 || !login"
2024-06-26 14:17:06 +08:00
@click="tn_ru('/pages/packageA/user/apply_in?association_id='+loginData.association_id)">
2023-12-25 17:56:30 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico8.png" style="width: 50rpx;height: 50rpx"></image>
2024-05-17 18:17:07 +08:00
<view style="margin-left: 20rpx;">入会申请</view>
2023-12-25 17:56:30 +08:00
</view>
</tn-list-cell>
2024-06-26 14:17:06 +08:00
<tn-list-cell :arrow="true" @click="tn('/pages/packageA/user/my_msg')">
2024-05-14 10:20:09 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center" style="position: relative;">
2024-05-11 18:14:49 +08:00
<image src="/static/ico9.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">我的消息</view>
2024-05-15 17:54:48 +08:00
<tn-badge v-if="msg()>0" style="position: absolute;right: 40rpx;" backgroundColor="#E83A30"
fontColor="#ffffff">{{msg()}}</tn-badge>
</view>
</tn-list-cell>
2024-06-26 14:17:06 +08:00
<tn-list-cell v-if="login" :arrow="true" @click="tn('/pages/packageA/user/my_invite')">
2024-05-15 17:54:48 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico10.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">邀请入会</view>
2024-05-11 18:14:49 +08:00
</view>
</tn-list-cell>
2024-05-08 18:14:41 +08:00
<!-- <tn-list-cell :arrow="true" @click="tn('/pages/index/my_assist')">-->
<!-- <view class="tn-flex tn-flex-center tn-flex-col-center">-->
<!-- <image src="/static/ico10.png" style="width: 50rpx;height: 50rpx"></image>-->
<!-- <view style="margin-left: 20rpx;">常见问题</view>-->
<!-- </view>-->
<!-- </tn-list-cell>-->
2024-06-21 16:15:26 +08:00
<tn-list-cell v-if="userInfo.shenhe==1&&login" :arrow="true"
2024-06-26 14:17:06 +08:00
@click="tn('/pages/packageA/user/user_auditing')">
2024-06-21 16:15:26 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/icon15.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">内容审核</view>
</view>
</tn-list-cell>
<tn-list-cell v-if="userInfo.shenhe==1&&login" :arrow="true"
2024-06-26 14:17:06 +08:00
@click="tn('/pages/packageA/user/user_activity')">
2024-06-21 16:15:26 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico16.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">发布活动</view>
</view>
</tn-list-cell>
2024-06-26 14:17:06 +08:00
<tn-list-cell :arrow="true" @click="tn('/pages/packageA/user/my_idea')">
2023-12-25 17:56:30 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
2024-05-08 18:14:41 +08:00
<image src="/static/ico12.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">意见反馈</view>
2023-12-25 17:56:30 +08:00
</view>
2024-06-21 16:15:26 +08:00
</tn-list-cell>
2024-06-28 08:50:34 +08:00
<tn-list-cell v-if="userInfo.if_business==1" :arrow="true"
@click="tn('/pages/packageA/user/my_vip')">
2024-06-26 14:17:06 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico12.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">会员卡</view>
</view>
</tn-list-cell>
<tn-list-cell v-if="userInfo.business==1" :arrow="true"
@click="tn('/pages/packageA/user/my_vip_clerk')">
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico12.png" style="width: 50rpx;height: 50rpx"></image>
<view style="margin-left: 20rpx;">店员管理</view>
</view>
</tn-list-cell>
2024-05-08 18:14:41 +08:00
<tn-list-cell :arrow="true" @click="loginAut">
2023-12-25 17:56:30 +08:00
<view class="tn-flex tn-flex-center tn-flex-col-center">
<image src="/static/ico11.png" style="width: 50rpx;height: 50rpx"></image>
2024-05-08 18:14:41 +08:00
<view style="margin-left: 20rpx;">退出帐号</view>
2023-12-25 17:56:30 +08:00
</view>
</tn-list-cell>
</view>
</view>
</view>
2024-05-27 17:40:54 +08:00
<tn-popup v-model="loginMod" mode="bottom" :safeAreaInsetBottom="true">
2024-05-08 18:14:41 +08:00
<view class="custom-modal-content">
2024-05-17 18:17:07 +08:00
<view style="font-size: 30rpx;padding: 30rpx 30rpx 0rpx 30rpx;font-weight: 600;letter-spacing: 2rpx">
会员登陆</view>
<view class="text" style="padding: 40rpx;">
2024-05-08 18:14:41 +08:00
<tn-form ref="form" :labelWidth="120">
2024-05-17 18:17:07 +08:00
<tn-form-item prop="phone">
<tn-input placeholder="手机号" :customStyle="{width: '660rpx'}" v-model="loginData.phone" />
2024-05-08 18:14:41 +08:00
</tn-form-item>
2024-05-17 18:17:07 +08:00
<view style="height: 20rpx;"></view>
<tn-form-item prop="password">
2024-05-21 18:16:48 +08:00
<tn-input placeholder="密码" :customStyle="{width: '660rpx'}" :passwordIcon="false"
v-model="loginData.password" type="password" />
2024-05-17 18:17:07 +08:00
</tn-form-item>
<tn-form-item prop="code">
2024-05-21 18:16:48 +08:00
<tn-input v-model="code" :customStyle="{width: '400rpx'}" type="text"
placeholder="请输入验证码"></tn-input>
2024-05-17 18:17:07 +08:00
<view slot="right">
2024-05-21 18:16:48 +08:00
<view @click="getcheckCode"
style="letter-spacing: 2px; font-size: 42rpx; background-color: antiquewhite; padding: 5rpx 15rpx;">
<text v-for="(item,index) in identifyCode" :style="{color:colors[index]}">
{{ item }}
</text>
</view>
2024-05-17 18:17:07 +08:00
</view>
2024-05-08 18:14:41 +08:00
</tn-form-item>
</tn-form>
2024-05-17 18:17:07 +08:00
<view style="text-align: center;margin-top: 50rpx;">
<!-- <tn-button backgroundColor="#E6E6E6" fontColor="#ffffff"
@click="loginMod = false">取消</tn-button> -->
<tn-button style="border-radius: 0px;" height="80rpx" backgroundColor="#EEF0F2" width="100%"
fontColor="#000000" @click="submitLogin">确定</tn-button>
2024-05-08 18:14:41 +08:00
</view>
</view>
</view>
2024-05-27 17:40:54 +08:00
<view style="height: 120rpx;"></view>
2024-05-17 18:17:07 +08:00
</tn-popup>
2024-06-28 08:50:34 +08:00
<view @click="callPhone"
style="text-align: center;padding-bottom: 100rpx;font-size: 24rpx;color: #999999;letter-spacing: 2rpx;padding-top: 40rpx;">
<view>技术支持洛阳灵睿网络</view>
<view style="margin-top: 10rpx;">电话15503791530</view>
</view>
2023-12-25 17:56:30 +08:00
</view>
</template>
<script>
2024-05-08 18:14:41 +08:00
import {
getUserIndex,
2024-06-21 16:15:26 +08:00
loginDo,
wxphoneLogin
2024-05-08 18:14:41 +08:00
} from "@/util/api";
import store from "@/store";
2024-04-23 11:58:07 +08:00
2024-05-08 18:14:41 +08:00
export default {
2023-12-25 17:56:30 +08:00
data() {
return {
2024-04-23 11:58:07 +08:00
topCurrent: 0,
2024-05-08 18:14:41 +08:00
login: false,
loginMod: false,
userInfo: {},
apiImgUrl: this.$store.state.imgUrl,
loginData: {
openid: '',
phone: '',
password: '',
association_id: store.state.Gid
},
2024-05-17 18:17:07 +08:00
code: '',
2024-05-21 18:16:48 +08:00
identifyCode: '',
identifyCodeName: '',
colors: ['#00CCFF', '#FF0000', '#FF9933', '#33CC99'], // 可以根据需要增加颜色
2024-05-08 18:14:41 +08:00
}
},
mounted() {
var uid = uni.getStorageSync('uid');
2024-05-14 10:20:09 +08:00
this.uid = uid;
2024-06-04 18:04:09 +08:00
if (uid) {
this.getUserInfo();
}
2024-05-21 18:16:48 +08:00
this.getcheckCode();
2023-12-25 17:56:30 +08:00
},
methods: {
2024-06-21 16:15:26 +08:00
PhoneLogin(d) {
console.log(d);
var openid = uni.getStorageSync('openid');
wxphoneLogin({
code: d.code,
openid: openid
})
.then(res => {
console.log(res);
if (res.code == 1) {
uni.showToast({
title: '登陆成功!',
icon: 'none',
duration: 2000
});
uni.setStorageSync('uid', res.data.id);
uni.setStorageSync('userInfo', res.data);
this.userInfo = res.data;
this.login = true;
this.loginMod = false;
} else {
uni.showToast({
title: '登陆失败!',
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
2024-05-21 18:16:48 +08:00
getcheckCode() {
let code = [];
const codeLength = 4;
var codeName = '';
const random = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z',
];
for (let i = 0; i < codeLength; i++) {
let index = Math.floor(Math.random() * 34);
code.push(random[index]);
codeName += random[index];
}
this.identifyCodeName = codeName;
this.identifyCode = code;
},
2024-05-15 17:54:48 +08:00
msg() {
return this.$store.state.msgCount;
},
2024-05-14 10:20:09 +08:00
getUserInfo() {
2024-05-08 18:14:41 +08:00
getUserIndex({
2024-05-14 10:20:09 +08:00
member_b_id: this.uid,
member_id: this.uid
2024-05-08 18:14:41 +08:00
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.userInfo = res.data;
this.login = true;
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
submitLogin() {
2024-05-21 18:16:48 +08:00
console.log(this.code);
console.log(this.identifyCodeName);
if (this.code.toLowerCase() !== this.identifyCodeName.toLowerCase()) {
uni.showToast({
title: '验证码错误!',
icon: 'none',
duration: 2000
});
return;
}
if (this.loginData.phone == '') {
uni.showToast({
title: '请填写手机号!',
icon: 'none',
duration: 2000
});
return;
}
if (this.loginData.password == '') {
uni.showToast({
title: '请填写密码!',
icon: 'none',
duration: 2000
});
return;
}
2024-05-08 18:14:41 +08:00
this.loginData.openid = uni.getStorageSync('openid');
loginDo(this.loginData)
.then(res => {
console.log(res);
if (res.code == 1) {
uni.showToast({
title: '登陆成功!',
icon: 'none',
duration: 2000
});
uni.setStorageSync('uid', res.data.id);
2024-06-21 16:15:26 +08:00
uni.setStorageSync('userInfo', res.data);
2024-05-08 18:14:41 +08:00
this.userInfo = res.data;
this.login = true;
this.loginMod = false;
} else {
uni.showToast({
title: '帐号或密码错误!',
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
loginAut() {
var that = this;
uni.showModal({
title: '提示',
content: '确定要退出吗?',
success: function(res) {
if (res.confirm) {
uni.removeStorageSync('uid');
that.login = false;
2024-05-27 17:40:54 +08:00
that.loginData.openid = '';
that.loginData.phone = '';
that.loginData.password = '';
that.code = '';
that.getcheckCode();
2024-05-08 18:14:41 +08:00
}
}
});
},
2024-05-21 18:16:48 +08:00
tn_ru(e) {
2024-06-26 14:17:06 +08:00
var url = "/pages/packageA/user/apply_in?association_id=" + store.state.Gid;
2024-05-21 18:16:48 +08:00
uni.navigateTo({
url: e
})
},
2024-04-20 14:57:39 +08:00
tn(e) {
2024-05-08 18:14:41 +08:00
var uid = uni.getStorageSync('uid');
2024-06-21 16:15:26 +08:00
console.log(this.userInfo);
if (!this.login) {
uni.showToast({
title: '请登陆后查看',
icon: 'none',
duration: 2000
});
2024-05-08 18:14:41 +08:00
return;
}
2024-06-21 16:15:26 +08:00
if (this.userInfo.if_member == 2) {
2024-06-26 14:17:06 +08:00
if (e == '/pages/packageA/user/my_edit') {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
2024-06-26 14:17:06 +08:00
if (e.includes("/pages/packageA/user/my_invite")) {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/index/pizz_info")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
2024-06-26 14:17:06 +08:00
if (e.includes("/pages/packageA/user/my_card")) {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
}
2024-04-20 14:57:39 +08:00
uni.navigateTo({
url: e
})
}
2023-12-25 17:56:30 +08:00
}
}
</script>
<style>
2024-05-21 18:16:48 +08:00
.my_input view {
width: 100% !important;
}
.my_input input {
width: 100% !important;
}
2024-06-04 18:04:09 +08:00
</style>