xnzt/xnzt-h5/pages/mine/index.vue

642 lines
16 KiB
Vue
Raw Permalink Normal View History

2024-11-11 10:27:27 +08:00
<template>
<view class="page">
<view class="user-top">
<view class="bg">
<image src="@/static/images/mine/ubg.png" mode="aspectFill"></image>
</view>
<view class="user-info u-flex u-col-center u-row-between">
<view class="l u-flex u-col-center" @click="$pageTo('/pages/mine/info/index')">
<view class="img">
<image :src="$config.imageBaseUrl + userInfo.avatar" mode="aspectFill" v-if="userInfo.avatar"></image>
<image src="@/static/images/mine/up.png" mode="aspectFill" v-else></image>
</view>
<view class="con">
<view class="name">
{{userInfo.nickName||'匿名用户'}} <text v-if="userInfo.type==0">农业公司</text>
</view>
<view class="tel">
{{userInfo.phonenumber||'未绑定手机号'}}
</view>
</view>
</view>
<view class="r u-flex u-col-center u-row-right" @click="$pageTo('/pages/mine/info/index')">
<text>查看资料</text>
<uni-icons type="right" size="14" color="#333"></uni-icons>
</view>
</view>
</view>
<view class="user-list">
<view class="item u-flex u-col-center u-row-between" @click="$pageTo('/pages/mine/businessesEntity/baseInfo/index')">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u21.png" mode="aspectFill"></image>
<text>主体信息</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view>
<view class="item u-flex u-col-center u-row-between" @click="$pageTo('/pages/mine/auth/index')">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u22.png" mode="aspectFill"></image>
<text>快速认证</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view>
<!-- <view class="item u-flex u-col-center u-row-between" @click="$pageTo('/pages/mine/msg/index')">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u7.png" mode="aspectFill"></image>
<text>消息中心</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view> -->
<view class="item u-flex u-col-center u-row-between" @click="call()">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u23.png" mode="aspectFill"></image>
<text>联系我们</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view>
<view class="item u-flex u-col-center u-row-between" @click="$pageTo('/pages/mine/about/index')">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u24.png" mode="aspectFill"></image>
<text>关于我们</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view>
<view class="item u-flex u-col-center u-row-between" @click="$pageTo('/pages/mine/setting/index')">
<view class="l u-flex u-col-center">
<image src="@/static/images/mine/u25.png" mode="aspectFill"></image>
<text>设置</text>
</view>
<view class="r">
<uni-icons type="right" size="24" color="#999"></uni-icons>
</view>
</view>
</view>
</view>
</template>
<script>
import {
cacheBaseInfo, selectBaseInfo
} from "@/api/enterprise/baseInfo";
import {
getInfo
} from "@/api/login.js";
import { selectUserEntity } from "@/api/enterprise/userEntity";
import { checkPermi, checkRole } from "@/utils/permission";
import {uploadAvatar, getUserProfile} from '@/api/system/user.js'
export default {
data() {
return {
userInfo:{
// userName:'',
phonenumber:"",
type:'',
nickName:"",
avatar:''
},
userId:'',
haveEnterprise: false,
serviceTel: "0717-6777967",
baseInfo: {},
listBaseInfo: [],
selectDefalute: [
{
value: false,
text: "+ 新增主体",
}
],
topLeft: {
page: "setting",
label: "设置",
img: "../../static/images/mine/xxlphq.png",
},
topRight: {
// page: "user",
page: "info",
label: "我的",
img: "../../static/images/mine/xxlSNn.png",
},
dialogShow: false,
dialogButtons: [
{
text: "取消",
},
{
text: "拨打",
},
],
entityInfo: {
img: "../../static/images/mine/xxlAuF.png",
round: "../../static/images/mine/xxWhzq.png",
},
integral: {
id: "integral",
name: "积分",
page: "integral",
img: "../../static/images/mine/xxlC90.png",
},
informationList: [
{
id: "1",
name: "经营主体",
package: "mine",
page: "businessesEntity",
img: "../../static/images/mine/xxlFjU.png",
},
{
id: "2",
name: "我的直报",
package: "accounts",
page: "dirRepInfo",
img: "../../static/images/mine/xxlicT.png",
},
{
id: "3",
name: "我的统计",
package: "packageInfo",
page: "my-stats",
img: "../../static/images/mine/xxlP3V.png",
},
],
list: [
{
id: "1",
name: "我的收藏",
package: "packageInfo",
show: false,
page: "my-star",
img: "../../static/images/mine/xz7YfU.png",
openType: "navigateTo",
},
{
id: "2",
name: "我的贷款",
package: "packageInfo",
show: true,
// page: "my-loan",
page: "myLoan",
img: "../../static/images/mine/xz7JYT.png",
openType: "navigateTo",
},
{
id: "3",
name: "我的保险",
package: "packageInfo",
show: true,
page: "myInsurance",
img: "../../static/images/mine/xz7NpF.png",
openType: "navigateTo",
},
{
id: "4",
name: "我的服务",
package: "packageInfo",
show: false,
page: "my-service",
img: "../../static/images/mine/xz7GkV.png",
openType: "navigateTo",
},
{
id: "5",
name: "我的补贴",
package: "packageInfo",
show: true,
page: "mySubsidies",
img: "../../static/images/mine/xz73T0.png",
openType: "navigateTo",
},
{
id: "6",
name: "我的产品",
package: "packageInfo",
show: false,
page: "my-products",
img: "../../static/images/mine/xz7Ul4.png",
openType: "navigateTo",
},
{
id: "7",
name: "我的买卖",
package: "packageInfo",
show: false,
page: "my-businesses",
img: "../../static/images/mine/xz7a6J.png",
openType: "navigateTo",
},
{
id: "8",
name: "我的培训",
package: "packageInfo",
show: false,
page: "my-train",
img: "../../static/images/mine/xz7dX9.png",
openType: "navigateTo",
},
{
id: "9",
name: "邀请好友",
package: "packageInfo",
show: false,
page: "invite-friends",
img: "../../static/images/mine/xz70mR.png",
openType: "navigateTo",
},
{
id: "10",
name: "联系我们",
package: "packageInfo",
show: true,
page: "connect-us",
img: "../../static/images/mine/xz7B01.png",
openType: "navigateTo",
},
],
};
},
onLoad() {
},
onShow() {
this.getEnterprise();
let user = uni.getStorageSync('user')
this.userId = user.userId
this.getUserInfo()
},
computed: {
avatar() {
return this.$store.state.user.avatar;
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50;
},
},
watch: {
haveEnterprise: {
handler: function (val, oldVal) {
if (this.haveEnterprise === true) {
this.getBaseInfo();
this.listallBaseInfo();
}
},
deep: true,
},
},
methods: {
checkRole,
showToast(e) {
this.$modal.showToast("模块建设中~");
},
navigator(item, isNew) {
if (this.$auth.hasRole("admin") || !this.$auth.hasRole("enterprise")) {
this.$modal.confirm("非主体用户无法拥有主体!").then(() => { });
} else {
this.$tab[item.openType]("/" + item.link).then((res) => {
if (res[0] !== null) {
this.$modal.showToast("模块建设中~");
}
});
}
},
createEntity() {
if (this.$auth.hasRole("admin") || !this.$auth.hasRole("enterprise")) {
this.$modal.confirm("非主体用户无法拥有主体!").then(() => { });
}
},
getEnterprise() {
selectUserEntity().then((response) => {
this.options = response.data;
if (response.data.length !== 0) {
this.haveEnterprise = true;
} else {
this.haveEnterprise = false;
}
});
},
getBaseInfo() {
selectBaseInfo().then((response) => {
this.baseInfo = response.data;
});
},
//获取用户信息
getUserInfo(){
getUserProfile().then(res => {
this.userInfo = res.data
})
},
/**
* "联系我们"点击事件
*/
openDialog(e) {
const that = this;
// console.log("=================openDialog-----e=============")
// console.log(e)
const item = e.currentTarget.dataset.itemx;
const name = item.name;
if (name === "联系我们") {
uni.showModal({
title: "联系我们",
content: "联系电话:" + this.serviceTel,
cancelText: "取消",
confirmText: "拨打",
success: function (res) {
if (res.confirm) {
that.collServiceTel();
} else if (res.cancel) {
}
},
});
} else {
// this.showToast();
let naviItem = item;
naviItem.link = "pages/mine/" + item.page + "/index";
this.navigator(naviItem);
}
},
show() {
if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar().setData({
current: 3,
});
}
},
/**
* 对话框取消按钮函数
*/
tapDialogButton(e) {
const button = e.detail.item.text;
const dialogButtonArray = this.data.dialogButtons;
if (button === dialogButtonArray[0].text) {
this.cancel();
} else {
this.collServiceTel();
}
},
/**
* 联系我们对话框取消按钮
*/
cancel() {
this.setData({
dialogShow: false,
});
},
/**
* 联系我们对话框拨打按钮函数
*/
collServiceTel() {
const phone = this.serviceTel;
uni.makePhoneCall({
phoneNumber: phone,
});
},
listallBaseInfo() {
selectUserEntity().then((response) => {
const list = response.data;
let dataList = [];
for (const item of list) {
let element = {};
element["value"] = item.value;
element["text"] = item.label;
dataList.push(element);
}
this.listBaseInfo = this.selectDefalute.concat(dataList);
});
},
baseAction(action, id) {
if (action != null && action != "") {
var baseId = action.toString();
cacheBaseInfo(baseId).then(res => {
this.haveEnterprise = !this.haveEnterprise
this.haveEnterprise = !this.haveEnterprise
});
} else if (action === false) {
this.$tab.navigateTo("/pages/formPages/enterprise/baseInfo/index")
}
},
isLisBasNull() {
if (this.haveEnterprise === true) {
try {
const RL = this.$refs.rudon_left;
const selectC = RL.$children[0].$children[0].$children
selectC.forEach(element => {
if (element.$el._prevClass !== "uni-select__selector") { return };
const selectorC = element.$children;
selectorC.forEach(selorC => {
if (selorC.$el._prevClass !== "uni-select__selector-scroll") { return };
selorC.$children[0].$children[0].$el.setAttribute("class", "uni-select__selector__add-ent_pri")
})
});
}
catch (e) { /*console.error(e)*/ }
} else {
this.$refs.rudon_left.toggleSelector();
}
},
//打电话
call(){
let that = this
uni.showModal({
title: "联系我们",
content: "联系电话:" + this.serviceTel,
cancelText: "取消",
confirmText: "拨打",
success: function (res) {
if (res.confirm) {
that.collServiceTel();
} else if (res.cancel) {
}
},
});
},
},
onBackPress(event) {
return true
},
};
</script>
<style scoped lang="scss">
@import url("@/static/scss/infoBody.scss");
/* 页面导航链接列表 */
.navigator {
background-color: white;
}
$color: #FCAA30;
.user-top {
position: relative;
.bg {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 1;
height: 510rpx;
image {
width: 100%;
height: 100%;
}
}
.user-ss{
position: relative;
z-index: 666;
background: #fff;
width: calc(100% - 60rpx);
margin: 0 auto 30rpx;
padding:40rpx 20rpx 20rpx;border-radius: 20rpx;
box-sizing: border-box;
.i{
flex: 1;
display: flex;align-items: center;flex-direction: column;
justify-content: center;
image{
width: 56rpx;height: 56rpx;
}
text{
margin-top: 20rpx;
font-size: 24rpx;color: #666;height: 40rpx;line-height: 40rpx;
}
}
}
.user-info {
position: relative;
z-index: 888;
padding: 50rpx 0 50rpx 30rpx;
.l {
flex: 1;
width: 1rpx;
.img {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.con {
flex: 1;
width: 1rpx;
margin-left: 30rpx;
.name {
font-size: 36rpx;
color: #333;
font-weight: 600;
height: 60rpx;
line-height: 60rpx;
text {
background: #3CC5FF;
height: 40rpx;
line-height: 40rpx;
font-size: 24rpx;
border-radius: 6rpx;
padding: 0 10rpx;
color: #fff;
margin-left: 30rpx;
font-weight: 400;
}
}
.tel {
font-size: 26rpx;
color: #666;
height: 40rpx;
line-height: 40rpx;
}
}
}
.r {
position: absolute;
right: 0;
bottom: 50rpx;
width: 188rpx;
height: 53rpx;
line-height: 53rpx;
background: #A6D3FF;
border-top-left-radius: 26rpx;
border-bottom-left-radius: 26rpx;
text-align: center;
padding-right: 15rpx;box-sizing: border-box;
text {
color: #0D0D0D;
font-size: 24rpx;
padding-left: 10rpx;
}
}
}
}
.user-list {
position: relative;
z-index: 888;
width: calc(100% - 60rpx);
margin: 30rpx auto;
background: #fff;
border-radius: 10rpx;
padding:10rpx 20rpx;
box-sizing: border-box;
.item {
padding: 20rpx 0;
border-bottom: 2rpx solid #eee;
&:last-child{
border: 0;
}
.l {
height: 60rpx;
line-height: 60rpx;
image {
width: 42rpx;
height: 42rpx;
}
text {
font-size: 28rpx;
color: #333;
margin-left: 20rpx;
}
}
.r {
height: 60rpx;
line-height: 60rpx;
}
}
}
</style>