Commit b34af048 by 李嘉林

企业用户功能

parent adc60526
...@@ -75,7 +75,12 @@ export default { ...@@ -75,7 +75,12 @@ export default {
}, },
// 获取个人资料 // 获取个人资料
getUserInfo() { getUserInfo() {
return requestPOST(`${process.env.OLSHOP_URL}/user/get_user_info`) let enterpriseAccountInfo = wx.getStorageSync("enterpriseAccount") ? JSON.parse(wx.getStorageSync("enterpriseAccount")) : "";
let mainUserId = "";
if (enterpriseAccountInfo) {
mainUserId = enterpriseAccountInfo.customerId
}
return requestPOST(`${process.env.OLSHOP_URL}/user/get_user_info?mainUserId=${mainUserId}`)
}, },
imgToBase64(data){ imgToBase64(data){
return requestPOST(`${process.env.OLSHOP_URL}/common/read_remote_file?url=${data}`) return requestPOST(`${process.env.OLSHOP_URL}/common/read_remote_file?url=${data}`)
......
...@@ -4,7 +4,12 @@ export default { ...@@ -4,7 +4,12 @@ export default {
// 获取个人资料 // 获取个人资料
getUserInfo() { getUserInfo() {
return requestPOST(`${process.env.OLSHOP_URL}/user/get_user_info`) let enterpriseAccountInfo = wx.getStorageSync("enterpriseAccount") ? JSON.parse(wx.getStorageSync("enterpriseAccount")) : "";
let mainUserId = "";
if (enterpriseAccountInfo) {
mainUserId = enterpriseAccountInfo.customerId
}
return requestPOST(`${process.env.OLSHOP_URL}/user/get_user_info?mainUserId=${mainUserId}`)
}, },
getV3PortalShopCard() { getV3PortalShopCard() {
return requestPOST(`${process.env.OLSHOP_URL}/user/portal_card`); return requestPOST(`${process.env.OLSHOP_URL}/user/portal_card`);
......
<template>
<!-- 选择企业账号 -->
<div class="SelectEnterpriseAccount">
<van-popup
:show="show"
round
:close-on-click-overlay="false"
position="bottom"
>
<van-picker
title="选择企业登录"
:columns="masterAccount"
:value-key="'customerName'"
:show-toolbar="true"
@confirm="confirm"
/>
</van-popup>
</div>
</template>
<script type="text/ecmascript-6">
// import { setEnterpriseAccount } from "~/plugins/auth";
export default {
name: "SelectEnterpriseAccount",
data() {
return {
show: false,
masterAccount: [],
};
},
components: {},
computed: {},
created() {},
mounted() {
this.list1;
},
methods: {
open(val) {
this.masterAccount = val;
console.log(this.masterAccount,'----this.masterAccount')
this.show = true;
},
close() {
this.show = false;
},
confirm(val) {
console.log(val.target.value, "------------41");
// 选择数据
this.$emit("confirm", val.target.value);
wx.setStorage({
key: "enterpriseAccount",
data: JSON.stringify(val.target.value)
});
this.close();
},
},
};
</script>
<style lang="scss">
.SelectEnterpriseAccount {
.van-popup {
height: 40vh;
.van-picker__toolbar{
.van-picker__cancel{
opacity: 0;
}
.van-picker__confirm{
color: var(--main-color);
}
}
}
}
</style>
...@@ -57,6 +57,10 @@ export default { ...@@ -57,6 +57,10 @@ export default {
this.params = this.$options.data.call(this).params this.params = this.$options.data.call(this).params
let ss = wx.getStorageSync("sessionid"); let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : ""; this.ss = ss ? `&sessionid=${ss}` : "";
let enterpriseAccount = wx.getStorageSync("enterpriseAccount");
if(enterpriseAccount) {
this.ss += enterpriseAccount ? `&enterpriseAccount=${enterpriseAccount}` : "";
}
if (!ss) { if (!ss) {
this.params += this.params.includes("logOut") ? "" : "&logOut=true"; this.params += this.params.includes("logOut") ? "" : "&logOut=true";
......
...@@ -351,6 +351,9 @@ export default { ...@@ -351,6 +351,9 @@ export default {
wx.removeStorage({ wx.removeStorage({
key: "openid" key: "openid"
}); });
wx.removeStorage({
key: "enterpriseAccount"
});
} }
this.options = wx.getStorageSync("becomeInfo"); this.options = wx.getStorageSync("becomeInfo");
this.changeLocation = options.changeLocation || '' this.changeLocation = options.changeLocation || ''
...@@ -379,6 +382,9 @@ export default { ...@@ -379,6 +382,9 @@ export default {
wx.removeStorage({ wx.removeStorage({
key: "openid" key: "openid"
}); });
wx.removeStorage({
key: "enterpriseAccount"
});
} }
// 获取页面数据 // 获取页面数据
if (this.mpApp.globalData.pageList) { if (this.mpApp.globalData.pageList) {
...@@ -889,6 +895,9 @@ export default { ...@@ -889,6 +895,9 @@ export default {
wx.removeStorage({ wx.removeStorage({
key: "openid" key: "openid"
}); });
wx.removeStorage({
key: "enterpriseAccount"
});
} }
log.info(JSON.stringify(result), that, 'tztztz初始化') log.info(JSON.stringify(result), that, 'tztztz初始化')
if (result.data.gifts !== null && result.data.gifts.length > 0) { if (result.data.gifts !== null && result.data.gifts.length > 0) {
......
...@@ -62,6 +62,9 @@ export default { ...@@ -62,6 +62,9 @@ export default {
if(wx.getStorageSync("sessionid")){ if(wx.getStorageSync("sessionid")){
this.params +=`&sessionid=${wx.getStorageSync("sessionid")}`; this.params +=`&sessionid=${wx.getStorageSync("sessionid")}`;
} }
if(wx.getStorageSync("enterpriseAccount")){
this.params +=`&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`;
}
let pageUrl = forUrlAddKey(decodeURIComponent(this.link+this.page+this.params)); let pageUrl = forUrlAddKey(decodeURIComponent(this.link+this.page+this.params));
// let pageUrl = this.link+this.page+this.params; // let pageUrl = this.link+this.page+this.params;
return pageUrl; return pageUrl;
...@@ -229,6 +232,9 @@ export default { ...@@ -229,6 +232,9 @@ export default {
wx.removeStorage({ wx.removeStorage({
key: "openid" key: "openid"
}); });
wx.removeStorage({
key: "enterpriseAccount"
});
} else if (options.from && options.from == "address") { } else if (options.from && options.from == "address") {
log.info('options.from == "address"') log.info('options.from == "address"')
// 来自小程序地址页面 // 来自小程序地址页面
......
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
<div class="cancelLogin" @click="cancelLogin">暂不登录</div> <div class="cancelLogin" @click="cancelLogin">暂不登录</div>
</div> </div>
</div> </div>
<!-- 选择企业 -->
<SelectEnterpriseAccount ref="SelectEnterpriseAccount" @confirm="getEnterpriseAccount"></SelectEnterpriseAccount>
</div> </div>
</template> </template>
...@@ -92,6 +94,7 @@ import text from '@/components/content/text' ...@@ -92,6 +94,7 @@ import text from '@/components/content/text'
import richText from "../../components/basicTool/rich-text"; import richText from "../../components/basicTool/rich-text";
import interval from '@/components/basicTool/interval/index.vue' import interval from '@/components/basicTool/interval/index.vue'
import partition from '@/components/basicTool/partition/index.vue' import partition from '@/components/basicTool/partition/index.vue'
import SelectEnterpriseAccount from "@/components/common/SelectEnterpriseAccount"
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
...@@ -103,7 +106,8 @@ export default { ...@@ -103,7 +106,8 @@ export default {
ThemeDataPlant, ThemeDataPlant,
loginLogo, loginLogo,
loginBox, loginBox,
loginUserAgreement loginUserAgreement,
SelectEnterpriseAccount
}, },
data() { data() {
return { return {
...@@ -764,6 +768,10 @@ export default { ...@@ -764,6 +768,10 @@ export default {
}, },
// 账号密码登录 // 账号密码登录
loginIn(val) { loginIn(val) {
wx.setStorage({
key: "enterpriseAccount",
data: ""
});
console.log(val,'-----------loginIn') console.log(val,'-----------loginIn')
log.info(val,'-----------loginIn') log.info(val,'-----------loginIn')
if (val.account == "") { if (val.account == "") {
...@@ -791,11 +799,20 @@ export default { ...@@ -791,11 +799,20 @@ export default {
res.data.data.sessionId res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`; }&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED; this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
wx.setStorage({ console.log(this.mpApp.globalData.shopInfo,"------------------this.mpApp.globalData.shopInfo")
key: "sessionid", if(this.mpApp.globalData.shopInfo.whetherOpenEnterprisesWantGoods == 1 && res.data.data.masterAccount && res.data.data.masterAccount.length>0){
data: res.data.data.sessionId this.$refs.SelectEnterpriseAccount.open(res.data.data.masterAccount);
}); wx.setStorage({
this.pushPageType(); key: "sessionid",
data: res.data.data.sessionId
});
} else {
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
this.pushPageType();
}
} else { } else {
wx.showToast({title: res.data.msg, icon: "none"}) wx.showToast({title: res.data.msg, icon: "none"})
} }
...@@ -819,6 +836,13 @@ export default { ...@@ -819,6 +836,13 @@ export default {
} }
}); });
}, },
getEnterpriseAccount(val) {
console.log(val,'----getEnterpriseAccount')
if(val) {
this.backParams += `&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`
}
this.pushPageType();
},
} }
}; };
</script> </script>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"van-checkbox": "/static/vant/checkbox/index", "van-checkbox": "/static/vant/checkbox/index",
"van-popup":"/static/vant/popup/index", "van-popup":"/static/vant/popup/index",
"van-picker": "/static/vant/picker/index",
"van-icon":"/static/vant/icon/index", "van-icon":"/static/vant/icon/index",
"photo-gallery":"/static/nativeComponents/PhotoGallery/index", "photo-gallery":"/static/nativeComponents/PhotoGallery/index",
"notice":"/static/nativeComponents/Notice/index" "notice":"/static/nativeComponents/Notice/index"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment