Commit d1ec7fc9 by 侯体倬

导购 id 处理

parent 7e6b25f8
...@@ -78,6 +78,12 @@ export default { ...@@ -78,6 +78,12 @@ export default {
if(wx.getStorageSync("workBox")){ if(wx.getStorageSync("workBox")){
this.params += `&workBox=${wx.getStorageSync("workBox")}` this.params += `&workBox=${wx.getStorageSync("workBox")}`
} }
// 判断当前是否为导购分享
const guideEmployeeId = wx.getStorageSync(this.$store.state.mixid + 'guideEmployeeId');
if (guideEmployeeId) {
this.params += `&setGuideEmployeeId=${guideEmployeeId}`;
}
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/"); let homeIndex = checkTabbarPage("/");
console.log(homeIndex,tabIndex,'--tabIndex') console.log(homeIndex,tabIndex,'--tabIndex')
......
...@@ -83,6 +83,11 @@ export default { ...@@ -83,6 +83,11 @@ export default {
let { latitude, longitude } = locationObj; let { latitude, longitude } = locationObj;
this.params+=`&latitude=${latitude}&longitude=${longitude}` this.params+=`&latitude=${latitude}&longitude=${longitude}`
} }
// 判断当前是否为导购分享
const guideEmployeeId = wx.getStorageSync(this.$store.state.mixid + 'guideEmployeeId');
if (guideEmployeeId) {
this.params += `&setGuideEmployeeId=${guideEmployeeId}`;
}
console.log(this.link,'=======',this.page,'++++++++++++++',this.params,'************') console.log(this.link,'=======',this.page,'++++++++++++++',this.params,'************')
let pageUrl1 = (this.page.startsWith('http://') || this.page.startsWith('https://'))? (this.page + this.params) : this.link+this.page+this.params let pageUrl1 = (this.page.startsWith('http://') || this.page.startsWith('https://'))? (this.page + this.params) : this.link+this.page+this.params
console.log(pageUrl1,'--------pageUrl1--') console.log(pageUrl1,'--------pageUrl1--')
...@@ -339,6 +344,10 @@ export default { ...@@ -339,6 +344,10 @@ export default {
offlineShopName:paramsObj.offlineShopName, offlineShopName:paramsObj.offlineShopName,
}); });
} }
// 判断是否为导购分享进入
if (paramsObj.guideEmployeeId) {
wx.setStorageSync(this.$store.state.mixid+'guideEmployeeId', paramsObj.guideEmployeeId);
}
wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId); wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId);
wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId); wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId);
wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId); wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId);
......
import store from '../store/index' import store from '../store/index'
console.log(store.state.mixid,'store.state') // 获取请求头
let shopMixid = store.state.mixid; const getRequestHeader = (extraHeader = {}) => {
// 共用请求头
const BASE_HEADER = {
"Shop-Mixid": store.state.mixid,
"Authorization": wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
"Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
}
// 判断是否存在导购员 id
const guideEmployeeId = wx.getStorageSync(store.state.mixid + 'guideEmployeeId');
if (guideEmployeeId) {
BASE_HEADER['Guide-Employee-Id'] = guideEmployeeId;
}
return Object.assign(BASE_HEADER, extraHeader);
}
// wx.getStore
export async function requestGET(url, options) { export async function requestGET(url, options) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -11,14 +27,7 @@ export async function requestGET(url, options) { ...@@ -11,14 +27,7 @@ export async function requestGET(url, options) {
url: url, url: url,
data: options, data: options,
method: "GET", method: "GET",
header: { header: getRequestHeader(),
"Shop-Mixid": store.state.mixid,
"Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Authorization": wx.getStorageSync('sessionid') || "",
"Region-id" : wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
// "dubbo-tag": "ljx"
},
success: function (res) { success: function (res) {
resolve(res) resolve(res)
}, },
...@@ -41,15 +50,9 @@ export async function requestPOST(url, options) { ...@@ -41,15 +50,9 @@ export async function requestPOST(url, options) {
url: url, url: url,
data: options, data: options,
method: "POST", method: "POST",
header: { header: getRequestHeader({
"Shop-Mixid": store.state.mixid, openId: wx.getStorageSync("openid") || ''
"Authorization": wx.getStorageSync('sessionid') || "", }),
"Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"openId": wx.getStorageSync("openid") || '',
"Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
// "dubbo-tag": "ljx"
},
success: function (res) { success: function (res) {
resolve(res) resolve(res)
}, },
...@@ -72,15 +75,9 @@ export function requestPOST1(url, options) { ...@@ -72,15 +75,9 @@ export function requestPOST1(url, options) {
url: url, url: url,
data: options, data: options,
method: "POST", method: "POST",
header: { header: getRequestHeader({
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded"
"Shop-Mixid": store.state.mixid, }),
Authorization: wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
// "dubbo-tag": "ljx"
},
success: function (res) { success: function (res) {
resolve(res) resolve(res)
}, },
......
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