Commit 402a60ed by 李嘉林

选择门店

parent 6641f197
import { requestPOST, requestPOST1 } from "@/utils/request.js"; import { requestPOST, requestPOST1 } from "@/utils/request.js";
export default { export default {
getShopInfo() { getShopInfo() {
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_shop_info`); return requestPOST(`${process.env.OLSHOP_URL}/shop/get_shop_info`);
...@@ -12,14 +11,13 @@ export default { ...@@ -12,14 +11,13 @@ export default {
}, },
addWxMiniSubscribeMessageRecord(data) { addWxMiniSubscribeMessageRecord(data) {
return requestPOST( return requestPOST(
`${process.env.OLSHOP_URL}/shop/addWxMiniSubscribeMessageRecord`, data `${process.env.OLSHOP_URL}/shop/addWxMiniSubscribeMessageRecord`,
data
); );
}, },
// 页面数据 // 页面数据
themePagesInfo(params) { themePagesInfo(params) {
return requestPOST( return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages?homePageFlag=${params.homePageFlag || false}&shopMixId=${params.shopMixId}`,
`${process.env.OLSHOP_URL}/cms/get_shop_install_pages?homePageFlag=${params.homePageFlag||false}`,
params
); );
}, },
checkShowCondition(params) { checkShowCondition(params) {
...@@ -30,12 +28,9 @@ export default { ...@@ -30,12 +28,9 @@ export default {
}, },
// 获取新版会员卡列表 // 获取新版会员卡列表
getV3CardList(params) { getV3CardList(params) {
return requestPOST( return requestPOST(`${process.env.OLSHOP_URL}/user/membership_card_list`, {
`${process.env.OLSHOP_URL}/user/membership_card_list`,
{
params params
} });
);
}, },
// 领取新版无门槛会员卡 // 领取新版无门槛会员卡
drawV3Card(params) { drawV3Card(params) {
...@@ -45,13 +40,22 @@ export default { ...@@ -45,13 +40,22 @@ export default {
}, },
//获取shop配置 //获取shop配置
get_shop_configuration(){ get_shop_configuration() {
return requestPOST( return requestPOST(`${process.env.OLSHOP_URL}/shop/get_shop_configuration`);
`${process.env.OLSHOP_URL}/shop/get_shop_configuration`
);
}, },
// 获取系统配置 // 获取系统配置
get_system_config_by_code(params) { get_system_config_by_code(params) {
return requestPOST(`${process.env.OLSHOP_URL}/common/get_system_config_by_code?code=${params.code}`) return requestPOST(
}, `${process.env.OLSHOP_URL}/common/get_system_config_by_code?code=${
params.code
}`
);
},
// 首页获取线下门店列表
getThousandsStoresOfflineStore(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/shop/get_thousands_stores_offline_store`,
data
);
}
}; };
<template>
<div class="storeAddr flex" v-if="openThousandsStoresFlag">
<div class="left flex">
<div class="logo">
<image :src="shopLogo" alt=""></image>
</div>
<div class="contentInfo flex" v-if="name != ''">
<p class="info">{{ name }}</p>
<p class="change" @click="pushStorePage">[切换]</p>
</div>
</div>
</div>
</template>
<script>
import shop from "@/api/shop";
import { DFSImg } from "@/utils/index";
import {setStoreInfo, getStoreInfo} from "@/utils/mayi"
const app = getApp();
export default {
data() {
return {
show: false,
name: "",
storeList: [],
userLatitude: "", //纬度
userLongitude: "", //经度
offlineStoreReq: {
latitude: "",
longitude: "",
pageNum: 0,
pageSize: 100,
shopName: "",
whetherOnlineShop: 1 //是否网店(0:不是,1:是) 给1 或 null
}
};
},
onLoad() {
this.getShopList();
},
computed: {
shopName() {
return app.globalData.shopInfo.shopName;
},
shopLogo() {
return DFSImg(app.globalData.shopInfo.logoUrl, 400, 400);
},
// 开启连锁商城(千店千面)
openThousandsStoresFlag() {
return app.globalData.shopInfo.openThousandsStoresFlag == 1
}
},
methods: {
getShopList() {
if (!this.openThousandsStoresFlag) {
// 未开启连锁商城初始化
setStoreInfo({
offlineShopCode: "",
offlineShopName: "",
});
return;
};
shop.getThousandsStoresOfflineStore(this.offlineStoreReq).then(res1 => {
let res = res1.data;
if (res.code == 200) {
if (res.data && res.data.length != 0) {
this.storeList = res.data;
let isStore = false;
let { offlineShopName, offlineShopCode } = getStoreInfo();
console.log(offlineShopName,offlineShopCode, '------------------sa114')
this.storeList.forEach((item, index) => {
if (item.shopName == offlineShopName) {
isStore = true;
} else if (offlineShopCode == "") {
isStore = true;
}
});
console.log(offlineShopName, isStore, "sa97");
if (offlineShopName && isStore) {
console.log("判断列表中是否存在(未关闭网店)");
this.name = offlineShopName;
// this.$emit("toUpdate");
} else {
console.log("如果关闭网店,重新选择列表第一个");
setStoreInfo({
offlineShopCode: this.storeList[0].shopCode,
offlineShopName: this.storeList[0].shopName,
});
this.name = this.storeList[0].shopName;
// this.$emit("toUpdate");
}
// this.$emit("toUpdate");
} else {
console.log("如果列表为空--选择商城");
setStoreInfo({
offlineShopCode: "",
offlineShopName: this.shopName,
});
this.name = this.shopName;
}
}
});
},
// 去切换门店页面
pushStorePage() {
app.$themeToLink({
type: 1,
link: `/chooseStores`,
})
}
}
};
</script>
<style lang="scss" scoped>
.storeAddr {
padding: 6px 12px;
justify-content: space-between;
.left,
.right {
align-items: center;
i.iconfont {
font-size: 22px;
margin: 0 5px;
}
}
.left {
align-items: center;
.contentInfo {
align-items: flex-start;
.info {
font-size: 14px;
color: #999;
flex: 1;
}
.change {
flex-shrink: 0;
padding-left: 6px;
color: #333;
font-size: 14px;
}
}
.logo {
width: 30px;
height: 30px;
border-radius: 50%;
overflow: hidden;
margin-right: 10px;
image {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
.right {
i.iconfont {
font-size: 24px;
}
}
}
</style>
\ No newline at end of file
...@@ -18,6 +18,7 @@ import { ...@@ -18,6 +18,7 @@ import {
getUrlofQuery getUrlofQuery
} from "../utils/mayi.js"; } from "../utils/mayi.js";
import { serialize, DFSImg} from "@/utils/index"; import { serialize, DFSImg} from "@/utils/index";
import { getStoreInfo } from "@/utils/mayi.js";
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
...@@ -42,15 +43,19 @@ export default { ...@@ -42,15 +43,19 @@ export default {
}, },
computed: { computed: {
pageUrl() { pageUrl() {
console.log(this.link,'******',this.page,'-------',this.params,'++++++++') console.log(this.link, '******', this.page, '-------', this.params, '++++++++')
return ( this.params +=
this.link +
this.page +
this.params +
`&native_test=1&tabbar=${this.index}&location_obj=${wx.getStorageSync( `&native_test=1&tabbar=${this.index}&location_obj=${wx.getStorageSync(
"location" "location"
)}` + )}`
this.ss+this.timestamp // url添加门店信息参数
let { offlineShopCode, offlineShopName } = getStoreInfo();
if (offlineShopCode) {
this.params+=`&offlineShopCode=${offlineShopCode}&offlineShopName=${offlineShopName}`
}
return (
this.link +
this.page + this.params + this.ss+this.timestamp
); );
} }
}, },
......
...@@ -143,7 +143,7 @@ mpApp.DFSImg = DFSImg; ...@@ -143,7 +143,7 @@ mpApp.DFSImg = DFSImg;
mpApp.concatUrl = concatUrl; mpApp.concatUrl = concatUrl;
mpApp.spokesmanApi = spokesmanApi mpApp.spokesmanApi = spokesmanApi
mpApp.getThemePage = getThemePage // mpApp.getThemePage = getThemePage
mpApp.themeColor = {} mpApp.themeColor = {}
mpApp.log = log mpApp.log = log
...@@ -152,7 +152,6 @@ mpApp.tool = tool ...@@ -152,7 +152,6 @@ mpApp.tool = tool
function getThemePage({mixid,shopid}) { function getThemePage({mixid,shopid}) {
shop shop
.themePagesInfo({ .themePagesInfo({
shopid,
shopMixId: mixid, shopMixId: mixid,
homePageFlag: true homePageFlag: true
}) })
......
<template> <template>
<div class="domain" :style="{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}"> <div class="domain" :style="{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}">
<!-- <view class="ant-daipinglun">1</view> -->
<!-- <goods-list id="goodsList"></goods-list> -->
<!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> -->
<div style="position:relative;"> <div style="position:relative;">
<div v-if="showSpokesManHome"> <div v-if="showSpokesManHome">
<get-index-homepage class="getIndexHomePage"></get-index-homepage> <get-index-homepage class="getIndexHomePage"></get-index-homepage>
</div> </div>
<ThemeDataPlant></ThemeDataPlant> <ThemeDataPlant></ThemeDataPlant>
<StoreAddr></StoreAddr>
<div v-for="(item,index) in pageData" :key="index"> <div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1"> <div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
<banner :datas="item"></banner> <banner :datas="item"></banner>
...@@ -173,11 +171,12 @@ import memberInfo from "../../components/basicTool/member-info"; ...@@ -173,11 +171,12 @@ import memberInfo from "../../components/basicTool/member-info";
import GoodsFliters from "../../components/common/GoodsFliters"; import GoodsFliters from "../../components/common/GoodsFliters";
import SelectGoods from "../../components/common/SelectGoods"; import SelectGoods from "../../components/common/SelectGoods";
import TwoBAddCart from "../../components/common/TwoBAddCart"; import TwoBAddCart from "../../components/common/TwoBAddCart";
import { setTabBarActive, checkTabbarPage,themeColor, checkShowConditionIds } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage,themeColor, checkShowConditionIds, setStoreInfo } from "../../utils/mayi.js";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
import { throttle, concatUrl } from "../../utils/index.js" import { throttle, concatUrl } from "../../utils/index.js"
import mpvueCropper from '@/components/mpvue-cropper' import mpvueCropper from '@/components/mpvue-cropper'
import tool from '../../utils/tool.js' import tool from '../../utils/tool.js'
import StoreAddr from "@/components/common/StoreAddr.vue";
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
...@@ -219,8 +218,8 @@ export default { ...@@ -219,8 +218,8 @@ export default {
shopPopup, shopPopup,
bottomCont, bottomCont,
ThemeDataPlant, ThemeDataPlant,
'text-text':text, "text-text": text,
'img-text':imgText, "img-text": imgText,
coupon, coupon,
integralTurntable, integralTurntable,
transverseLabel, transverseLabel,
...@@ -232,14 +231,15 @@ export default { ...@@ -232,14 +231,15 @@ export default {
birthPopup, birthPopup,
mpvueCropper, mpvueCropper,
woTimeout, woTimeout,
'custom-list':customList, "custom-list": customList,
'rich-text':richText, "rich-text": richText,
'member-info':memberInfo, "member-info": memberInfo,
GoodsFliters, GoodsFliters,
SelectGoods, SelectGoods,
TwoBAddCart, TwoBAddCart,
brandList brandList,
}, StoreAddr
},
computed: { computed: {
applySucessEntryFlag() { applySucessEntryFlag() {
// 高意匠不展示 // 高意匠不展示
...@@ -320,8 +320,18 @@ export default { ...@@ -320,8 +320,18 @@ export default {
}) })
}, },
onLoad(options) { onLoad(options) {
console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,'---------home----options') console.log(options,'---------home----options')
log.info(options,'---------home----options') log.info(options, '---------home----options')
let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : "";
console.log(h5Params,'--h5Params')
if (h5Params) {
// 存储h5url门店信息
setStoreInfo({
offlineShopCode:h5Params.offlineShopCode,
offlineShopName:h5Params.offlineShopName,
});
}
//进页面存储需要绑定的信息 //进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) { if(options.userId||options.spokesmanRelId) {
wx.setStorage({ wx.setStorage({
...@@ -457,8 +467,10 @@ export default { ...@@ -457,8 +467,10 @@ export default {
console.log('storageGoodsList---detory'); console.log('storageGoodsList---detory');
}, },
onShow() { onShow(options) {
console.log(new Date().getTime(),'load-----home-onShow')
// 设置显示条件 // 设置显示条件
console.log(new Date().getTime(),'--------on--------------show')
log.info('--------on--------------show') log.info('--------on--------------show')
//分销隔流 //分销隔流
if(this.toHomePage) { if(this.toHomePage) {
......
...@@ -11,6 +11,7 @@ import shop from "@/api/shop.js"; ...@@ -11,6 +11,7 @@ import shop from "@/api/shop.js";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
import { serialize, getQueryVariable, DFSImg } from "@/utils/index"; import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
import login from "@/api/login"; import login from "@/api/login";
import { getStoreInfo } from "@/utils/mayi.js";
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
...@@ -66,6 +67,11 @@ export default { ...@@ -66,6 +67,11 @@ export default {
if(wx.getStorageSync("enterpriseAccount")){ if(wx.getStorageSync("enterpriseAccount")){
this.params +=`&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`; this.params +=`&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`;
} }
// url添加门店信息参数
let { offlineShopCode, offlineShopName } = getStoreInfo();
if (offlineShopCode) {
this.params+=`&offlineShopCode=${offlineShopCode}&offlineShopName=${offlineShopName}`
}
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--')
...@@ -81,6 +87,7 @@ export default { ...@@ -81,6 +87,7 @@ export default {
return; return;
} }
this.newPageUrl = this.pageUrl; this.newPageUrl = this.pageUrl;
console.log('------------------index----2')
// 进入直播页面调用不息屏api // 进入直播页面调用不息屏api
console.log(this.pageUrl,this.pageUrl.includes('/liveBroadcast/lived'),"this.pageUrl.includes('/liveBroadcast/lived')") console.log(this.pageUrl,this.pageUrl.includes('/liveBroadcast/lived'),"this.pageUrl.includes('/liveBroadcast/lived')")
if(this.pageUrl.includes('/liveBroadcast/lived')){ if(this.pageUrl.includes('/liveBroadcast/lived')){
...@@ -139,7 +146,15 @@ export default { ...@@ -139,7 +146,15 @@ export default {
this.options = options; this.options = options;
log.info(this.options,'----------------index-----options') log.info(this.options,'----------------index-----options')
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : "";
console.log(h5Params,'--h5Params')
if (h5Params) {
// 存储h5url门店信息
setStoreInfo({
offlineShopCode:h5Params.offlineShopCode,
offlineShopName:h5Params.offlineShopName,
});
}
if(wx.getStorageSync("workBox")){ if(wx.getStorageSync("workBox")){
this.params += `&workBox=${wx.getStorageSync("workBox")}` this.params += `&workBox=${wx.getStorageSync("workBox")}`
} }
...@@ -429,7 +444,7 @@ export default { ...@@ -429,7 +444,7 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数 // var query = options.query.dentistId; // 参数二维码传递过来的场景参数
} }
this.newPageUrl = this.pageUrl; // this.newPageUrl = this.pageUrl;
this.init(); this.init();
}, },
onShow(){ onShow(){
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
let forUrlAddKey = require("mayi-front-tools/forUrlAddKey").default; let forUrlAddKey = require("mayi-front-tools/forUrlAddKey").default;
import { serialize, getQueryVariable, DFSImg } from "@/utils/index"; import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
import { getStoreInfo } from "@/utils/mayi.js";
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
...@@ -32,6 +33,11 @@ export default { ...@@ -32,6 +33,11 @@ export default {
if (wx.getStorageSync("enterpriseAccount")) { if (wx.getStorageSync("enterpriseAccount")) {
this.params += `&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`; this.params += `&enterpriseAccount=${wx.getStorageSync("enterpriseAccount")}`;
} }
// url添加门店信息参数
let { offlineShopCode, offlineShopName } = getStoreInfo();
if (offlineShopCode) {
this.params+=`&offlineShopCode=${offlineShopCode}&offlineShopName=${offlineShopName}`
}
console.log(this.baseUrl, '=======', this.page, '++++++++++++++', this.params, '************') console.log(this.baseUrl, '=======', this.page, '++++++++++++++', this.params, '************')
let pageUrl1 = (this.page.startsWith('http://') || this.page.startsWith('https://')) ? (this.page + this.params) : this.baseUrl + this.page + this.params let pageUrl1 = (this.page.startsWith('http://') || this.page.startsWith('https://')) ? (this.page + this.params) : this.baseUrl + this.page + this.params
console.log(pageUrl1, '--------pageUrl1--') console.log(pageUrl1, '--------pageUrl1--')
......
...@@ -10,9 +10,6 @@ const mutations = { ...@@ -10,9 +10,6 @@ const mutations = {
setSubscribeMessageObj(state, subscribeMessageObj) { setSubscribeMessageObj(state, subscribeMessageObj) {
state.subscribeMessageObj = subscribeMessageObj; state.subscribeMessageObj = subscribeMessageObj;
}, },
setOfflineShopCode(state, code) {
state.offlineShopCode = code;
},
//设置登录状态 //设置登录状态
setLoginStatus(state,val){ setLoginStatus(state,val){
......
...@@ -17,7 +17,6 @@ const state = { ...@@ -17,7 +17,6 @@ const state = {
spokesmanRelId: "", spokesmanRelId: "",
userId : "", userId : "",
subscribeMessageObj: {}, subscribeMessageObj: {},
offlineShopCode:"",
isLogin, isLogin,
userInfo, userInfo,
shopUserInfo: {}, shopUserInfo: {},
......
...@@ -13,7 +13,7 @@ export async function requestGET(url, options) { ...@@ -13,7 +13,7 @@ export async function requestGET(url, options) {
method: "GET", method: "GET",
header: { header: {
"Shop-Mixid": store.state.mixid, "Shop-Mixid": store.state.mixid,
"Offline-Shop-Code": store.state.offlineShopCode, "Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Authorization": wx.getStorageSync('sessionid') || "", "Authorization": wx.getStorageSync('sessionid') || "",
"Region-id" : wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '', "Region-id" : wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '', "Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
...@@ -38,7 +38,7 @@ export async function requestPOST(url, options) { ...@@ -38,7 +38,7 @@ export async function requestPOST(url, options) {
header: { header: {
"Shop-Mixid": store.state.mixid, "Shop-Mixid": store.state.mixid,
"Authorization": wx.getStorageSync('sessionid') || "", "Authorization": wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": store.state.offlineShopCode, "Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"openId": wx.getStorageSync("openid") || '', "openId": wx.getStorageSync("openid") || '',
"Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '', "Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '', "Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
...@@ -64,7 +64,7 @@ export function requestPOST1(url, options) { ...@@ -64,7 +64,7 @@ export function requestPOST1(url, options) {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
"Shop-Mixid": store.state.mixid, "Shop-Mixid": store.state.mixid,
Authorization: wx.getStorageSync('sessionid') || "", Authorization: wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": store.state.offlineShopCode, "Offline-Shop-Code": wx.getStorageSync('offlineShopCode') || "",
"Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '', "Region-id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).systemRegionId : '',
"Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '', "Area-Id": wx.getStorageSync('location') ? JSON.parse(wx.getStorageSync('location')).id : '',
// "dubbo-tag": "ljx" // "dubbo-tag": "ljx"
......
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