新用户的授权和权限更新修改
This commit is contained in:
parent
e56b53fb0c
commit
6f8d811054
17
App.vue
17
App.vue
@ -53,12 +53,25 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
|
||||||
|
// 创建全局 Promise,用于阻塞首页加载直到登录完成
|
||||||
|
// 注意:不能用 getApp(),因为在 onLaunch 中 App 实例还未完全创建
|
||||||
|
this.loginPromise = new Promise(async (resolve, reject) => {
|
||||||
if (this.user.WeChat_MiniProToken) {
|
if (this.user.WeChat_MiniProToken) {
|
||||||
this.memberLogin();
|
await this.memberLogin()
|
||||||
|
resolve()
|
||||||
} else {
|
} else {
|
||||||
this.getLoginCode();
|
await this.getLoginCode()
|
||||||
|
resolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 超时保护(10秒)
|
||||||
|
setTimeout(() => {
|
||||||
|
console.warn('登录超时,继续加载页面');
|
||||||
|
resolve();
|
||||||
|
}, 10000);
|
||||||
|
});
|
||||||
|
|
||||||
this.setVisitChannels(options.scene);
|
this.setVisitChannels(options.scene);
|
||||||
const updateManager = uni.getUpdateManager();
|
const updateManager = uni.getUpdateManager();
|
||||||
updateManager.onUpdateReady(function (res) {
|
updateManager.onUpdateReady(function (res) {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<image class="typeImg" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/noData.svg"></image>
|
<image class="typeImg" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/noData.svg"></image>
|
||||||
<p class="text" v-if="type==='index'">抱歉,数据为第三方接口传输,无法进行画像分析</p>
|
<p class="text" v-if="type === 'index'">抱歉,数据为第三方接口传输,无法进行画像分析</p>
|
||||||
<p class="noAuthor" v-else-if="type==='noAuthor'">抱歉,您没有权限查看数智化看板,请联系管理员进行授权</p>
|
<p class="noAuthor" v-else-if="type === 'noAuthor'">抱歉,您没有权限查看数智化看板,请联系管理员进行授权</p>
|
||||||
<p class="text" v-else>抱歉,第三方数据未传,无法分析</p>
|
<p class="text" v-else>抱歉,第三方数据未传,无法分析</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -10,38 +10,61 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "noData",
|
name: "noData",
|
||||||
data(){
|
data() {
|
||||||
return {
|
return {
|
||||||
type:''
|
type: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(query){
|
onLoad(query) {
|
||||||
if (query.type){
|
let _this = this
|
||||||
|
// 拿到最新的 userInfo
|
||||||
|
console.log('noData', this.$store.state);
|
||||||
|
|
||||||
|
if (this.$store.state.userData.Membership_Id) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
title: '温馨提示',
|
||||||
|
content: '请您授权登录后再操作。',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 点击确定,跳转到注册页
|
||||||
|
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
// 点击取消,不做任何操作,停留在无权限页面
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (query.type) {
|
||||||
this.type = query.type
|
this.type = query.type
|
||||||
}
|
}
|
||||||
let userInfo = uni.getStorageSync('vuex')
|
let userInfo = uni.getStorageSync('vuex')
|
||||||
userInfo = JSON.parse(userInfo)
|
userInfo = JSON.parse(userInfo)
|
||||||
console.log('userInfo',userInfo)
|
console.log('userInfo', userInfo)
|
||||||
console.log(userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee'])
|
console.log(userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee'])
|
||||||
if (userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee']===1){
|
if (userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee'] === 1) {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url:`/pages/index/index`
|
url: `/pages/index/index`
|
||||||
})
|
})
|
||||||
},200)
|
}, 200)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.$util.addUserBehavior()
|
this.$util.addUserBehavior()
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.main{
|
.main {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -49,18 +72,21 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
.img{
|
|
||||||
width:60px;
|
.img {
|
||||||
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
.typeImg{
|
|
||||||
|
.typeImg {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
margin-top: 40vh;
|
margin-top: 40vh;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: PingFangSC-Regular, PingFang SC;
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|||||||
@ -4277,12 +4277,7 @@ export default {
|
|||||||
) {
|
) {
|
||||||
this.getSuggestion();
|
this.getSuggestion();
|
||||||
}
|
}
|
||||||
console.log(
|
|
||||||
"userInfo.userData.AuthorityInfo['03bd2dbf-a5ed-4080-b168-92c3b7412d6f']",
|
|
||||||
userInfo.userData.AuthorityInfo[
|
|
||||||
"03bd2dbf-a5ed-4080-b168-92c3b7412d6f"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if (
|
if (
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"03bd2dbf-a5ed-4080-b168-92c3b7412d6f"
|
"03bd2dbf-a5ed-4080-b168-92c3b7412d6f"
|
||||||
@ -4290,12 +4285,7 @@ export default {
|
|||||||
) {
|
) {
|
||||||
this.businessWarning = true;
|
this.businessWarning = true;
|
||||||
}
|
}
|
||||||
console.log(
|
|
||||||
"userInfo.userData.AuthorityInfo['2d25dddc-e67f-4e26-b2d1-da78beed2c11']",
|
|
||||||
userInfo.userData.AuthorityInfo[
|
|
||||||
"2d25dddc-e67f-4e26-b2d1-da78beed2c11"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if (
|
if (
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"2d25dddc-e67f-4e26-b2d1-da78beed2c11"
|
"2d25dddc-e67f-4e26-b2d1-da78beed2c11"
|
||||||
@ -4304,46 +4294,7 @@ export default {
|
|||||||
this.projectWarning = true;
|
this.projectWarning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拿到用户当前的经纬度位置
|
|
||||||
this.seat = uni.getStorageSync("seatInfo");
|
|
||||||
if (!this.seat) {
|
|
||||||
//获取用户的经纬度位置存在stroge里面
|
|
||||||
if (wx.getPrivacySetting) {
|
|
||||||
wx.getPrivacySetting({
|
|
||||||
success: (res) => {
|
|
||||||
if (res.needAuthorization) {
|
|
||||||
this.$util.toNextRoute(
|
|
||||||
"redirectTo",
|
|
||||||
"/pages/register/register"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
wx.getFuzzyLocation({
|
|
||||||
type: "gcj02",
|
|
||||||
altitude: true,
|
|
||||||
success: (res) => {
|
|
||||||
let seatInfo = {
|
|
||||||
latitude: res.latitude,
|
|
||||||
longitude: res.longitude,
|
|
||||||
};
|
|
||||||
uni.setStorageSync("seatInfo", seatInfo);
|
|
||||||
this.seat = seatInfo;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content:
|
|
||||||
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//拿到最近服务区的数据
|
|
||||||
this.nearestService();
|
|
||||||
}
|
|
||||||
if (!this.isReturn) {
|
if (!this.isReturn) {
|
||||||
this.getData(this.option);
|
this.getData(this.option);
|
||||||
this.handleNoticeMonth();
|
this.handleNoticeMonth();
|
||||||
@ -4382,9 +4333,25 @@ export default {
|
|||||||
},
|
},
|
||||||
...mapGetters({ user: "getUser" }),
|
...mapGetters({ user: "getUser" }),
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
async onLoad(option) {
|
||||||
console.log("festivalObj", this.festivalObj);
|
// 等待 App.vue 的登录完成
|
||||||
console.log("lastDay", this.lastDay);
|
const app = getApp();
|
||||||
|
|
||||||
|
// 轮询等待 loginPromise 创建(因为 onLaunch 和 onLoad 几乎同时执行)
|
||||||
|
let waitCount = 0;
|
||||||
|
while (!app.loginPromise && waitCount < 100) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 50)); // 等待 50ms
|
||||||
|
waitCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app.loginPromise) {
|
||||||
|
console.log('等待 App.onLaunch 登录完成...');
|
||||||
|
await app.loginPromise;
|
||||||
|
console.log('登录完成,继续执行 onLoad');
|
||||||
|
} else {
|
||||||
|
console.warn('loginPromise 未创建,直接继续执行');
|
||||||
|
}
|
||||||
|
|
||||||
// 默认进来先清空 确保每次进来都能在缓存里面赋值上最新的
|
// 默认进来先清空 确保每次进来都能在缓存里面赋值上最新的
|
||||||
uni.setStorageSync("festival", this.isShowFestival);
|
uni.setStorageSync("festival", this.isShowFestival);
|
||||||
|
|
||||||
@ -4400,7 +4367,6 @@ export default {
|
|||||||
if (!this.isShowFestival) {
|
if (!this.isShowFestival) {
|
||||||
this.isShowFestival = "other";
|
this.isShowFestival = "other";
|
||||||
}
|
}
|
||||||
console.log("this.isShowFestival", this.isShowFestival);
|
|
||||||
uni.setStorageSync("festival", this.isShowFestival);
|
uni.setStorageSync("festival", this.isShowFestival);
|
||||||
|
|
||||||
// 顶部显示的时间
|
// 顶部显示的时间
|
||||||
@ -4450,7 +4416,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.swiperList = swiperList;
|
this.swiperList = swiperList;
|
||||||
console.log("this.swiperList", this.swiperList);
|
|
||||||
// 顶部卡片滚动的第几个
|
// 顶部卡片滚动的第几个
|
||||||
this.selectDetail = this.handleGetSwiperIndex(this.lastDay);
|
this.selectDetail = this.handleGetSwiperIndex(this.lastDay);
|
||||||
// 拿到选择日期的月份
|
// 拿到选择日期的月份
|
||||||
@ -4459,7 +4424,6 @@ export default {
|
|||||||
this.selectMonth = date.getMonth() + 1;
|
this.selectMonth = date.getMonth() + 1;
|
||||||
this.selectMonthIndex =
|
this.selectMonthIndex =
|
||||||
y > 2023 ? 12 + date.getMonth() + 1 : date.getMonth() + 1;
|
y > 2023 ? 12 + date.getMonth() + 1 : date.getMonth() + 1;
|
||||||
console.log("this.selectMonth", this.selectMonth);
|
|
||||||
// 设置顶部时间选择器的开始时间 因为不能选去年数据 所以只能从当前日期的年份开始计算
|
// 设置顶部时间选择器的开始时间 因为不能选去年数据 所以只能从当前日期的年份开始计算
|
||||||
this.startDate = `${date.getFullYear()}-01`;
|
this.startDate = `${date.getFullYear()}-01`;
|
||||||
|
|
||||||
@ -4470,23 +4434,29 @@ export default {
|
|||||||
// 把时间存起来给全部页面都能拿到
|
// 把时间存起来给全部页面都能拿到
|
||||||
uni.setStorageSync("lastDay", this.lastDay);
|
uni.setStorageSync("lastDay", this.lastDay);
|
||||||
uni.setStorageSync("version", this.selectVersion);
|
uni.setStorageSync("version", this.selectVersion);
|
||||||
// 小程序进来存起来的用户信息
|
|
||||||
let userInfo = uni.getStorageSync("vuex");
|
|
||||||
userInfo = JSON.parse(userInfo);
|
|
||||||
this.useInfo = JSON.parse(JSON.stringify(userInfo));
|
|
||||||
|
|
||||||
console.log("userInfo3232312321312", userInfo);
|
// 保留原有的 storage 读取(用于其他用途)
|
||||||
|
let storageInfo = uni.getStorageSync("vuex");
|
||||||
|
|
||||||
|
// 直接从 store.state 读取最新的用户数据,确保是 WeChat_GetBusinessMemberInfo 接口返回的最新数据
|
||||||
|
let userInfo = {
|
||||||
|
userData: this.$store.state.userData // 直接从 store.state 读取,确保是最新的
|
||||||
|
};
|
||||||
|
this.useInfo = JSON.parse(JSON.stringify(userInfo));
|
||||||
|
console.log('userInfo (最新)', JSON.parse(JSON.stringify(userInfo)));
|
||||||
|
|
||||||
// 判断有没有权限
|
// 判断有没有权限
|
||||||
if (
|
if (
|
||||||
userInfo.userData &&
|
userInfo.userData &&
|
||||||
userInfo.userData.UserId &&
|
userInfo.userData.UserId &&
|
||||||
|
userInfo.userData.AuthorityInfo &&
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"89a1f248-2113-4d57-84b1-c2e6edb9e8ee"
|
"89a1f248-2113-4d57-84b1-c2e6edb9e8ee"
|
||||||
] === 1
|
] === 1
|
||||||
) {
|
) {
|
||||||
this.isReturn = false;
|
this.isReturn = false;
|
||||||
} else {
|
} else {
|
||||||
|
return
|
||||||
this.$util.addUserBehavior({
|
this.$util.addUserBehavior({
|
||||||
intoRoute: `/pages/commercialBI/noData`,
|
intoRoute: `/pages/commercialBI/noData`,
|
||||||
});
|
});
|
||||||
@ -4495,20 +4465,21 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!this.isReturn) {
|
if (!this.isReturn) {
|
||||||
let userInfo = uni.getStorageSync("vuex");
|
// 使用最新的 userInfo 数据
|
||||||
userInfo = JSON.parse(userInfo);
|
|
||||||
// 判断是否有投诉建议的悬浮框弹出
|
// 判断是否有投诉建议的悬浮框弹出
|
||||||
if (
|
if (
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo &&
|
||||||
|
(userInfo.userData.AuthorityInfo[
|
||||||
"e2fb458b-d1bd-48fa-805e-fc93dc71efb7"
|
"e2fb458b-d1bd-48fa-805e-fc93dc71efb7"
|
||||||
] === 1 ||
|
] === 1 ||
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"ea2fc404-d924-4c88-98de-1f4d96137745"
|
"ea2fc404-d924-4c88-98de-1f4d96137745"
|
||||||
] === 1
|
] === 1)
|
||||||
) {
|
) {
|
||||||
this.getSuggestion();
|
this.getSuggestion();
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
userInfo.userData.AuthorityInfo &&
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"03bd2dbf-a5ed-4080-b168-92c3b7412d6f"
|
"03bd2dbf-a5ed-4080-b168-92c3b7412d6f"
|
||||||
] === 1
|
] === 1
|
||||||
@ -4516,6 +4487,7 @@ export default {
|
|||||||
this.businessWarning = true;
|
this.businessWarning = true;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
userInfo.userData.AuthorityInfo &&
|
||||||
userInfo.userData.AuthorityInfo[
|
userInfo.userData.AuthorityInfo[
|
||||||
"2d25dddc-e67f-4e26-b2d1-da78beed2c11"
|
"2d25dddc-e67f-4e26-b2d1-da78beed2c11"
|
||||||
] === 1
|
] === 1
|
||||||
@ -4648,9 +4620,6 @@ export default {
|
|||||||
},
|
},
|
||||||
// 版本选择到3的时候要调用拿到数据的方法
|
// 版本选择到3的时候要调用拿到数据的方法
|
||||||
async handleGetSelectVersion3Data(month) {
|
async handleGetSelectVersion3Data(month) {
|
||||||
console.log("month", month);
|
|
||||||
console.log("selectMonthIndex", this.selectMonthIndex);
|
|
||||||
console.log("selectMonth", this.selectMonth);
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "正在加载...",
|
title: "正在加载...",
|
||||||
});
|
});
|
||||||
@ -4667,7 +4636,6 @@ export default {
|
|||||||
StatisticsMonth: this.selectMonth, //结算月份
|
StatisticsMonth: this.selectMonth, //结算月份
|
||||||
StatisticsDate: this.lastDay,
|
StatisticsDate: this.lastDay,
|
||||||
};
|
};
|
||||||
console.log("req", req);
|
|
||||||
const nowData = await request.$webGet(
|
const nowData = await request.$webGet(
|
||||||
"CommercialApi/Revenue/GetMonthlyBusinessAnalysis",
|
"CommercialApi/Revenue/GetMonthlyBusinessAnalysis",
|
||||||
req
|
req
|
||||||
@ -4684,8 +4652,6 @@ export default {
|
|||||||
"CommercialApi/Revenue/GetMonthlyBusinessAnalysis",
|
"CommercialApi/Revenue/GetMonthlyBusinessAnalysis",
|
||||||
allReq
|
allReq
|
||||||
);
|
);
|
||||||
console.log("nowData", nowData);
|
|
||||||
console.log("allData", allData);
|
|
||||||
let allList = allData.Result_Data.List;
|
let allList = allData.Result_Data.List;
|
||||||
let allRes = {};
|
let allRes = {};
|
||||||
if (allList && allList.length > 0) {
|
if (allList && allList.length > 0) {
|
||||||
@ -4778,9 +4744,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.selectVersion3Obj = res;
|
this.selectVersion3Obj = res;
|
||||||
|
|
||||||
console.log("allRes", allRes);
|
|
||||||
console.log("res", res);
|
|
||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
},
|
},
|
||||||
// 跳转去老版本首页
|
// 跳转去老版本首页
|
||||||
@ -4897,7 +4860,6 @@ export default {
|
|||||||
this.showHaveNotice = !this.showHaveNotice;
|
this.showHaveNotice = !this.showHaveNotice;
|
||||||
},
|
},
|
||||||
changeShowRealBox(e) {
|
changeShowRealBox(e) {
|
||||||
console.log('eee', e);
|
|
||||||
this.realBoxPageX = e.detail.x;
|
this.realBoxPageX = e.detail.x;
|
||||||
this.realBoxPageY = e.detail.y;
|
this.realBoxPageY = e.detail.y;
|
||||||
this.showRealBox = !this.showRealBox;
|
this.showRealBox = !this.showRealBox;
|
||||||
@ -5238,11 +5200,9 @@ export default {
|
|||||||
StatisticsType: 1,
|
StatisticsType: 1,
|
||||||
ShowCount: 20,
|
ShowCount: 20,
|
||||||
};
|
};
|
||||||
console.log("12312312req", req);
|
|
||||||
request
|
request
|
||||||
.$webGet("CommercialApi/BigData/GetBayonetWarning", req)
|
.$webGet("CommercialApi/BigData/GetBayonetWarning", req)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("车流预警", res);
|
|
||||||
if (res.Result_Data.List && res.Result_Data.List.length > 0) {
|
if (res.Result_Data.List && res.Result_Data.List.length > 0) {
|
||||||
this.special = true;
|
this.special = true;
|
||||||
}
|
}
|
||||||
@ -5311,7 +5271,6 @@ export default {
|
|||||||
// latitude:user.latitude,
|
// latitude:user.latitude,
|
||||||
// }
|
// }
|
||||||
// request.$webGet('CommercialApi/BaseInfo/GetServerpartList',req).then(res=>{
|
// request.$webGet('CommercialApi/BaseInfo/GetServerpartList',req).then(res=>{
|
||||||
// console.log('res',res)
|
|
||||||
//
|
//
|
||||||
// uni.hideLoading()
|
// uni.hideLoading()
|
||||||
// })
|
// })
|
||||||
@ -5540,7 +5499,6 @@ export default {
|
|||||||
this.trafficQOQObj = null;
|
this.trafficQOQObj = null;
|
||||||
this.dailyExamineObj = null;
|
this.dailyExamineObj = null;
|
||||||
this.monthAdd = null;
|
this.monthAdd = null;
|
||||||
console.log("this.typeList", this.typeList);
|
|
||||||
// 月份详情卡片的详情
|
// 月份详情卡片的详情
|
||||||
this.initYesterdayData(this.selectMonth !== date.getMonth() + 1);
|
this.initYesterdayData(this.selectMonth !== date.getMonth() + 1);
|
||||||
// 自营计划
|
// 自营计划
|
||||||
@ -5693,40 +5651,32 @@ export default {
|
|||||||
// ShowCompareRate: true,
|
// ShowCompareRate: true,
|
||||||
// ShowYearRevenue: true
|
// ShowYearRevenue: true
|
||||||
// }
|
// }
|
||||||
console.log("this.single", this.single);
|
|
||||||
const nowDate = new Date(this.single);
|
const nowDate = new Date(this.single);
|
||||||
let month = JSON.parse(JSON.stringify(this.selectMonth));
|
let month = JSON.parse(JSON.stringify(this.selectMonth));
|
||||||
console.log("nowDate.getFullYear()", nowDate.getFullYear());
|
|
||||||
if (month < 10) {
|
if (month < 10) {
|
||||||
month = "0" + month;
|
month = "0" + month;
|
||||||
}
|
}
|
||||||
let req;
|
let req;
|
||||||
if (type) {
|
if (type) {
|
||||||
if (nowDate.getMonth() + 1 === this.selectMonth) {
|
if (nowDate.getMonth() + 1 === this.selectMonth) {
|
||||||
console.log("1");
|
|
||||||
req = {
|
req = {
|
||||||
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
||||||
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
||||||
StatisticsDate: this.lastDay,
|
StatisticsDate: this.lastDay,
|
||||||
};
|
};
|
||||||
console.log("req", req);
|
|
||||||
} else {
|
} else {
|
||||||
console.log("2");
|
|
||||||
req = {
|
req = {
|
||||||
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
||||||
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
||||||
StatisticsDate: this.lastDay,
|
StatisticsDate: this.lastDay,
|
||||||
};
|
};
|
||||||
console.log("req", req);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("3");
|
|
||||||
req = {
|
req = {
|
||||||
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
pushProvinceCode: this.useInfo.userData.ProvinceCode || "340000",
|
||||||
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
StatisticsMonth: `${nowDate.getFullYear()}${month}`,
|
||||||
StatisticsDate: type ? null : this.lastDay,
|
StatisticsDate: type ? null : this.lastDay,
|
||||||
};
|
};
|
||||||
console.log("req", req);
|
|
||||||
}
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "正在加载...",
|
title: "正在加载...",
|
||||||
@ -5736,11 +5686,9 @@ export default {
|
|||||||
.then((lastData) => {
|
.then((lastData) => {
|
||||||
flag3 = true;
|
flag3 = true;
|
||||||
let result = lastData.Result_Data;
|
let result = lastData.Result_Data;
|
||||||
console.log("result2", result);
|
|
||||||
let progressAll = 0;
|
let progressAll = 0;
|
||||||
this.currentPeriodData = result.MonthRevenueModel.CurAccountRoyalty;
|
this.currentPeriodData = result.MonthRevenueModel.CurAccountRoyalty;
|
||||||
|
|
||||||
console.log("result.BusinessTypeList", result.BusinessTypeList);
|
|
||||||
let shareList = [{}, {}, {}];
|
let shareList = [{}, {}, {}];
|
||||||
result.BusinessTypeList.forEach((item) => {
|
result.BusinessTypeList.forEach((item) => {
|
||||||
progressAll += Number(item.value);
|
progressAll += Number(item.value);
|
||||||
@ -5779,7 +5727,6 @@ export default {
|
|||||||
shareList[2] = item;
|
shareList[2] = item;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("shareList", shareList);
|
|
||||||
this.moneyRateList = [
|
this.moneyRateList = [
|
||||||
Number(shareList[0].value),
|
Number(shareList[0].value),
|
||||||
Number(shareList[1].value),
|
Number(shareList[1].value),
|
||||||
@ -5788,10 +5735,8 @@ export default {
|
|||||||
|
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
shareList.forEach((item) => {
|
shareList.forEach((item) => {
|
||||||
console.log("Number(item.value)", Number(item.value));
|
|
||||||
sum += Number(item.value);
|
sum += Number(item.value);
|
||||||
});
|
});
|
||||||
console.log("sum", sum);
|
|
||||||
if (sum === 0) {
|
if (sum === 0) {
|
||||||
this.ydRate = "-";
|
this.ydRate = "-";
|
||||||
this.shopRate = "-";
|
this.shopRate = "-";
|
||||||
@ -5810,7 +5755,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.profitSharingList = shareList;
|
this.profitSharingList = shareList;
|
||||||
console.log("result.BusinessTypeList", result.BusinessTypeList);
|
|
||||||
this.typeList = result.BusinessTypeList;
|
this.typeList = result.BusinessTypeList;
|
||||||
this.revenueMoney = result.BusinessTypeList[0].showValue;
|
this.revenueMoney = result.BusinessTypeList[0].showValue;
|
||||||
this.externalMoney = result.BusinessTypeList[1].showValue;
|
this.externalMoney = result.BusinessTypeList[1].showValue;
|
||||||
@ -5844,7 +5788,6 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.showTableData = result.MonthRevenueModel;
|
this.showTableData = result.MonthRevenueModel;
|
||||||
console.log("result.MonthRevenueModel", result.MonthRevenueModel);
|
|
||||||
// 对客营收的增幅
|
// 对客营收的增幅
|
||||||
this.showTableData.YearRevenueAdd = (
|
this.showTableData.YearRevenueAdd = (
|
||||||
((this.showTableData.YearRevenueAmount -
|
((this.showTableData.YearRevenueAmount -
|
||||||
@ -5991,14 +5934,12 @@ export default {
|
|||||||
request
|
request
|
||||||
.$webGet("CommercialApi/Revenue/GetProvinceAvgBayonetAnalysis", req)
|
.$webGet("CommercialApi/Revenue/GetProvinceAvgBayonetAnalysis", req)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("res11121212", res);
|
|
||||||
res.Result_Data.List.forEach((item) => {
|
res.Result_Data.List.forEach((item) => {
|
||||||
if (item.Serverpart_Name === "QOQ") {
|
if (item.Serverpart_Name === "QOQ") {
|
||||||
this.trafficQOQObj = item;
|
this.trafficQOQObj = item;
|
||||||
} else if (item.Serverpart_Name === "YOY") {
|
} else if (item.Serverpart_Name === "YOY") {
|
||||||
this.trafficYOYObj = item;
|
this.trafficYOYObj = item;
|
||||||
} else {
|
} else {
|
||||||
console.log("this.trafficCurrentObj", this.trafficCurrentObj);
|
|
||||||
this.trafficCurrentObj = item;
|
this.trafficCurrentObj = item;
|
||||||
if (this.trafficCurrentObj.Vehicle_AddUpCount / 1000000 >= 1) {
|
if (this.trafficCurrentObj.Vehicle_AddUpCount / 1000000 >= 1) {
|
||||||
this.trafficCurrentObj.AddUpCount = this.$util.fmoney(
|
this.trafficCurrentObj.AddUpCount = this.$util.fmoney(
|
||||||
@ -6188,9 +6129,7 @@ export default {
|
|||||||
this.bodyList = list;
|
this.bodyList = list;
|
||||||
}
|
}
|
||||||
let index1 = (this.showTableData.CashPay / 10000).toString().indexOf(".");
|
let index1 = (this.showTableData.CashPay / 10000).toString().indexOf(".");
|
||||||
console.log("this.showTableData.CashPay", this.showTableData.CashPay);
|
|
||||||
let number = this.showTableData.CashPay / 10000;
|
let number = this.showTableData.CashPay / 10000;
|
||||||
console.log("number", number);
|
|
||||||
this.showTableData.CashPayChange = this.$util.fmoney(
|
this.showTableData.CashPayChange = this.$util.fmoney(
|
||||||
this.$util.getMoney(number),
|
this.$util.getMoney(number),
|
||||||
2
|
2
|
||||||
|
|||||||
117
store/store.js
117
store/store.js
@ -9,9 +9,9 @@ const state = {
|
|||||||
visitChannels: '',
|
visitChannels: '',
|
||||||
userData: {}, // 用户基础信息
|
userData: {}, // 用户基础信息
|
||||||
toDoMsg: {},// 用户首页待办事项
|
toDoMsg: {},// 用户首页待办事项
|
||||||
isConnect: true ,// 网络是否链接
|
isConnect: true,// 网络是否链接
|
||||||
isLoading: false, // 是否在请求数据
|
isLoading: false, // 是否在请求数据
|
||||||
isChangeMsgCount: false ,// 是否更新待办事项
|
isChangeMsgCount: false,// 是否更新待办事项
|
||||||
shouldReLoadingList: false // 是否需要更新当前列表
|
shouldReLoadingList: false // 是否需要更新当前列表
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -23,16 +23,16 @@ const getters = {
|
|||||||
getMenu(state) {
|
getMenu(state) {
|
||||||
return state.userData.AuthorityInfo
|
return state.userData.AuthorityInfo
|
||||||
},
|
},
|
||||||
getConnect(state){
|
getConnect(state) {
|
||||||
return state.isConnect
|
return state.isConnect
|
||||||
},
|
},
|
||||||
getLoading (state) {
|
getLoading(state) {
|
||||||
return state.isLoading
|
return state.isLoading
|
||||||
},
|
},
|
||||||
isChangeMsgCount (state) {
|
isChangeMsgCount(state) {
|
||||||
return state.isChangeMsgCount
|
return state.isChangeMsgCount
|
||||||
},
|
},
|
||||||
shouldReLoadingList (state) {
|
shouldReLoadingList(state) {
|
||||||
return state.shouldReLoadingList
|
return state.shouldReLoadingList
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -40,33 +40,40 @@ const getters = {
|
|||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
|
||||||
setUser (state, data) {
|
setUser(state, data) {
|
||||||
state.userData = data
|
state.userData = data
|
||||||
},
|
},
|
||||||
setVisitChannels (state, data) {
|
setVisitChannels(state, data) {
|
||||||
state.visitChannels = data
|
state.visitChannels = data
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldReLoadingList (state, data){
|
shouldReLoadingList(state, data) {
|
||||||
state.shouldReLoadingList = data
|
state.shouldReLoadingList = data
|
||||||
},
|
},
|
||||||
isConnect(state,value) {
|
isConnect(state, value) {
|
||||||
|
|
||||||
state.isConnect = value
|
state.isConnect = value
|
||||||
},
|
},
|
||||||
setUserTodoList(state,value){
|
setUserTodoList(state, value) {
|
||||||
state.toDoMsg = value
|
state.toDoMsg = value
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const actions = {
|
const actions = {
|
||||||
getLoginCode({ dispatch, state} ){
|
getLoginCode({ dispatch, state }) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
uni.login({ // 登录
|
uni.login({ // 登录
|
||||||
success (res) {
|
success(res) {
|
||||||
dispatch('memberLogin',res.code) // 获取用户数据
|
dispatch('memberLogin', res.code) // 获取用户数据
|
||||||
|
.then(resolve)
|
||||||
|
.catch(reject);
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
reject(err);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getTodoList({ dispatch, state,commit}){ // 获取用户待办事项
|
getTodoList({ dispatch, state, commit }) { // 获取用户待办事项
|
||||||
let _user = state.userData
|
let _user = state.userData
|
||||||
request.$get("ToDoList", {
|
request.$get("ToDoList", {
|
||||||
userId: _user.UserId,
|
userId: _user.UserId,
|
||||||
@ -75,75 +82,87 @@ const actions = {
|
|||||||
commit('setUserTodoList', res.Data)
|
commit('setUserTodoList', res.Data)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
memberLogin({ dispatch, state,commit},_code) {
|
async memberLogin({ dispatch, state, commit }, _code) {
|
||||||
let _user = state.userData
|
let _user = state.userData
|
||||||
request.$get('WeChat_Login',{
|
const data = await request.$get('WeChat_Login', {
|
||||||
// request.$webGet('WebAPI_Push/WeChat/Login',{
|
// request.$webGet('WebAPI_Push/WeChat/Login',{
|
||||||
WeChat_Code: _code || '',
|
WeChat_Code: _code || '',
|
||||||
|
|
||||||
}).then(data=>{
|
})
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
let user = data.Result_Data
|
let user = data.Result_Data
|
||||||
|
console.log('WeChat_Login 返回的用户数据:', user);
|
||||||
|
console.log('Membership_Id:', user.Membership_Id);
|
||||||
if (user.Membership_Id) {
|
if (user.Membership_Id) {
|
||||||
dispatch('updateUser',data.Result_Data)
|
return dispatch('updateUser', data.Result_Data)
|
||||||
// _this.addUserBehavior(1002) // 记录用户行为
|
// _this.addUserBehavior(1002) // 记录用户行为
|
||||||
}else{
|
} else {
|
||||||
commit('setUser', user)
|
commit('setUser', user)
|
||||||
uni.showModal({
|
|
||||||
title:'温馨提示',
|
|
||||||
content: '请您授权登录后再操作。',
|
|
||||||
success(res) {
|
|
||||||
if(res.confirm){
|
|
||||||
|
|
||||||
util.toNextRoute('redirectTo', '/pages/register/register')
|
// 先跳转到无权限页面
|
||||||
|
uni.redirectTo({
|
||||||
}
|
url: '/pages/commercialBI/noData?type=noAuthor',
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '温馨提示',
|
||||||
|
// content: '请您授权登录后再操作。',
|
||||||
|
// success(res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// // 点击确定,跳转到注册页
|
||||||
|
// util.toNextRoute('redirectTo', '/pages/register/register')
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// // 点击取消,不做任何操作,停留在无权限页面
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }, 500)
|
||||||
|
|
||||||
|
return Promise.reject('无权限')
|
||||||
}
|
}
|
||||||
} else if (data.Result_Code === 200) { // session过期
|
} else if (data.Result_Code === 200) { // session过期
|
||||||
dispatch('getLoginCode')
|
return dispatch('getLoginCode')
|
||||||
} else {
|
} else {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
async updateUser ({dispatch, commit, state},user){
|
async updateUser({ dispatch, commit, state }, user) {
|
||||||
|
|
||||||
let _user = user || state.userData
|
let _user = user || state.userData
|
||||||
let _id = _user.Membership_Id
|
let _id = _user.Membership_Id
|
||||||
if(!_id) return
|
if (!_id) return
|
||||||
// console.log(_user)
|
|
||||||
await request.$get('WeChat_GetBusinessMemberInfo',{Membership_Id:_id}).then(async res=>{
|
// 直接 await,不使用 .then(),确保同步执行
|
||||||
// request.$webGet('WebAPI_Push/Member/GetMemberInfo',{Membership_Id:_id,memberShipId:_id}).then(res=>{
|
const res = await request.$get('WeChat_GetBusinessMemberInfo', { Membership_Id: _id })
|
||||||
if(res.Result_Code==100) {
|
|
||||||
|
if (res.Result_Code == 100) {
|
||||||
let data = res.Result_Data
|
let data = res.Result_Data
|
||||||
data.WeChat_MiniProToken = _user.WeChat_MiniProToken
|
data.WeChat_MiniProToken = _user.WeChat_MiniProToken
|
||||||
data.WeChat_UserId = _user.WeChat_UserId
|
data.WeChat_UserId = _user.WeChat_UserId
|
||||||
data.WeChat_UserName = _user.WeChat_UserName
|
data.WeChat_UserName = _user.WeChat_UserName
|
||||||
let UserCityList = data.UserCityAuthority.split(' ')
|
let UserCityList = data.UserCityAuthority.split(' ')
|
||||||
let str = ''
|
let str = ''
|
||||||
if (UserCityList && UserCityList.length>0){
|
if (UserCityList && UserCityList.length > 0) {
|
||||||
UserCityList.forEach(item=>{
|
UserCityList.forEach(item => {
|
||||||
if (str){
|
if (str) {
|
||||||
str+=`,${item}`
|
str += `,${item}`
|
||||||
}else{
|
} else {
|
||||||
str = item
|
str = item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const serverPart = await request.$webGet('/EShangApiMain/BaseInfo/GetServerpartDDL',{ServerpartCodes: str})
|
const serverPart = await request.$webGet('/EShangApiMain/BaseInfo/GetServerpartDDL', { ServerpartCodes: str })
|
||||||
data.serverPartList = serverPart.Result_Data.List
|
data.serverPartList = serverPart.Result_Data.List
|
||||||
commit('setUser', data)
|
commit('setUser', data)
|
||||||
dispatch('getTodoList')
|
dispatch('getTodoList')
|
||||||
}else{
|
} else {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url:`/pages/commercialBI/noData?type=noAuthor`
|
url: `/pages/commercialBI/noData?type=noAuthor`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
@ -156,7 +175,7 @@ export default new Vuex.Store({
|
|||||||
CreatePersistedState({
|
CreatePersistedState({
|
||||||
storage: {
|
storage: {
|
||||||
getItem: key => uni.getStorageSync(key),
|
getItem: key => uni.getStorageSync(key),
|
||||||
setItem: (key,value) => uni.setStorageSync(key,value),
|
setItem: (key, value) => uni.setStorageSync(key, value),
|
||||||
removeItem: key => uni.removeStorageSync(key)
|
removeItem: key => uni.removeStorageSync(key)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user