Commit b34af048 by 李嘉林

企业用户功能

parent adc60526
......@@ -75,7 +75,12 @@ export default {
},
// 获取个人资料
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){
return requestPOST(`${process.env.OLSHOP_URL}/common/read_remote_file?url=${data}`)
......
......@@ -4,7 +4,12 @@ export default {
// 获取个人资料
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() {
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 {
this.params = this.$options.data.call(this).params
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
let enterpriseAccount = wx.getStorageSync("enterpriseAccount");
if(enterpriseAccount) {
this.ss += enterpriseAccount ? `&enterpriseAccount=${enterpriseAccount}` : "";
}
if (!ss) {
this.params += this.params.includes("logOut") ? "" : "&logOut=true";
......
......@@ -351,6 +351,9 @@ export default {
wx.removeStorage({
key: "openid"
});
wx.removeStorage({
key: "enterpriseAccount"
});
}
this.options = wx.getStorageSync("becomeInfo");
this.changeLocation = options.changeLocation || ''
......@@ -379,6 +382,9 @@ export default {
wx.removeStorage({
key: "openid"
});
wx.removeStorage({
key: "enterpriseAccount"
});
}
// 获取页面数据
if (this.mpApp.globalData.pageList) {
......@@ -889,6 +895,9 @@ export default {
wx.removeStorage({
key: "openid"
});
wx.removeStorage({
key: "enterpriseAccount"
});
}
log.info(JSON.stringify(result), that, 'tztztz初始化')
if (result.data.gifts !== null && result.data.gifts.length > 0) {
......
......@@ -62,6 +62,9 @@ export default {
if(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 = this.link+this.page+this.params;
return pageUrl;
......@@ -229,6 +232,9 @@ export default {
wx.removeStorage({
key: "openid"
});
wx.removeStorage({
key: "enterpriseAccount"
});
} else if (options.from && options.from == "address") {
log.info('options.from == "address"')
// 来自小程序地址页面
......
......@@ -73,6 +73,8 @@
<div class="cancelLogin" @click="cancelLogin">暂不登录</div>
</div>
</div>
<!-- 选择企业 -->
<SelectEnterpriseAccount ref="SelectEnterpriseAccount" @confirm="getEnterpriseAccount"></SelectEnterpriseAccount>
</div>
</template>
......@@ -92,6 +94,7 @@ import text from '@/components/content/text'
import richText from "../../components/basicTool/rich-text";
import interval from '@/components/basicTool/interval/index.vue'
import partition from '@/components/basicTool/partition/index.vue'
import SelectEnterpriseAccount from "@/components/common/SelectEnterpriseAccount"
const app = getApp();
const { log } = app;
export default {
......@@ -103,7 +106,8 @@ export default {
ThemeDataPlant,
loginLogo,
loginBox,
loginUserAgreement
loginUserAgreement,
SelectEnterpriseAccount
},
data() {
return {
......@@ -764,6 +768,10 @@ export default {
},
// 账号密码登录
loginIn(val) {
wx.setStorage({
key: "enterpriseAccount",
data: ""
});
console.log(val,'-----------loginIn')
log.info(val,'-----------loginIn')
if (val.account == "") {
......@@ -791,11 +799,20 @@ export default {
res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
console.log(this.mpApp.globalData.shopInfo,"------------------this.mpApp.globalData.shopInfo")
if(this.mpApp.globalData.shopInfo.whetherOpenEnterprisesWantGoods == 1 && res.data.data.masterAccount && res.data.data.masterAccount.length>0){
this.$refs.SelectEnterpriseAccount.open(res.data.data.masterAccount);
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
} else {
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
this.pushPageType();
}
} else {
wx.showToast({title: res.data.msg, icon: "none"})
}
......@@ -819,6 +836,13 @@ export default {
}
});
},
getEnterpriseAccount(val) {
console.log(val,'----getEnterpriseAccount')
if(val) {
this.backParams += `&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`
}
this.pushPageType();
},
}
};
</script>
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"van-checkbox": "/static/vant/checkbox/index",
"van-popup":"/static/vant/popup/index",
"van-picker": "/static/vant/picker/index",
"van-icon":"/static/vant/icon/index",
"photo-gallery":"/static/nativeComponents/PhotoGallery/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