分销城市选择添加状态管理

This commit is contained in:
wangxiaowei 2024-11-07 11:05:17 +08:00
parent 16bd2006a0
commit 82b8c54c6a
5 changed files with 20 additions and 6 deletions

@ -387,9 +387,7 @@
partnerIndex: -1 partnerIndex: -1
}; };
}, },
onLoad(options) { onLoad(options) {
this.scheme_city = options?.city
// 获取店铺类型及合作方案 // 获取店铺类型及合作方案
this.getSchemeFun() this.getSchemeFun()
// 获取上级及个人信息 // 获取上级及个人信息
@ -399,6 +397,10 @@
// 获取二维码 // 获取二维码
this.handleMakeMyWxImage() this.handleMakeMyWxImage()
}, },
onShow() {
this.scheme_city = this.$store.getters.schemeCity
},
methods: { methods: {
async handleMakeMyWxImage() { async handleMakeMyWxImage() {
@ -833,6 +835,9 @@
watch: { watch: {
scheme_city: { scheme_city: {
handler(val) { handler(val) {
console.log('val=', val);
console.log('scheme=', this.scheme);
console.log(' this.scheme.partner=', this.scheme.partner);
if (val && val.name && this.scheme && this.scheme.partner.length > 0) { if (val && val.name && this.scheme && this.scheme.partner.length > 0) {
const city = val.name const city = val.name
const partner = this.scheme.partner const partner = this.scheme.partner

@ -181,7 +181,9 @@
async setRect() { async setRect() {
await this.$nextTick() await this.$nextTick()
const sidebar = uni.createSelectorQuery().selectAll(".city-bar__sidebar"); const sidebar = uni.createSelectorQuery().selectAll(".city-bar__sidebar");
console.log('sidebar=', sidebar);
sidebar.boundingClientRect(res => { sidebar.boundingClientRect(res => {
console.log('res=', res);
this.sidebar = { this.sidebar = {
height: res[0].height, height: res[0].height,
top: res[0].top top: res[0].top

@ -86,6 +86,8 @@
chooseCity(city) { chooseCity(city) {
try{ try{
this.$store.commit('setSchemeCity', city)
// 返回上一页 // 返回上一页
this.$Router.back(1, { this.$Router.back(1, {
success: () => { success: () => {
@ -94,7 +96,7 @@
options options
} = currentPage() } = currentPage()
// 刷新上一个页面 // 刷新上一个页面
onLoad && onLoad({ ...options, refresh: true, city }) onLoad && onLoad({ ...options, refresh: true})
} }
}) })
}catch(e){ }catch(e){

@ -8,5 +8,6 @@ export default {
sysInfo: state => state.app.sysInfo, sysInfo: state => state.app.sysInfo,
cityInfo: state => state.city.cityInfo, cityInfo: state => state.city.cityInfo,
hasPid: state => state.app.pId, hasPid: state => state.app.pId,
hasSetId: state => state.app.setId hasSetId: state => state.app.setId,
schemeCity: state => state.app.schemeCity
}; };

@ -36,7 +36,8 @@ const state = {
cartNum: "", cartNum: "",
sysInfo: {}, sysInfo: {},
pId: 0, pId: 0,
setId: 0 setId: 0,
schemeCity: ''
}; };
const mutations = { const mutations = {
@ -72,6 +73,9 @@ const mutations = {
}, },
setSetId(state, data) { setSetId(state, data) {
state.setId = data state.setId = data
},
setSchemeCity(state, data) {
state.schemeCity = data
} }
}; };