Commit c58b93c3 by 张立顺

fix bug 修复

1 parent e62be18f
...@@ -23,6 +23,7 @@ Page({ ...@@ -23,6 +23,7 @@ Page({
pageNum: 1, pageNum: 1,
searchKey: '', searchKey: '',
list: [], list: [],
userInfo: null,
orderObj: [ orderObj: [
{ {
label: '技师姓名', label: '技师姓名',
...@@ -54,6 +55,30 @@ Page({ ...@@ -54,6 +55,30 @@ Page({
] ]
}, },
syncUserContext(done) {
let userInfo = wx.$util.getUserInfo() || {}
let nextShopMerchantId = userInfo?.shopMerchantId || ''
let prevShopMerchantId = this.data.userInfo?.shopMerchantId || ''
let searchObj = { ...this.data.searchObj }
let merchantType =
userInfo?.merchantAccountList?.includes('6') ||
userInfo?.merchantAccountList?.includes('8')
let nextUserInfo = {
...userInfo,
merchantType
}
let updateData = {
userInfo: nextUserInfo
}
if (prevShopMerchantId && prevShopMerchantId !== nextShopMerchantId) {
delete searchObj.technicianUuidList
updateData.searchObj = searchObj
}
this.setData(updateData, () => {
typeof done === 'function' && done()
})
},
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height let navBarHeight = e.detail.height
this.setData({ this.setData({
...@@ -64,7 +89,9 @@ Page({ ...@@ -64,7 +89,9 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) {}, onLoad(options) {
this.syncUserContext()
},
// tab切换 // tab切换
tabClick(e) { tabClick(e) {
let { searchObj } = this.data let { searchObj } = this.data
...@@ -305,7 +332,9 @@ Page({ ...@@ -305,7 +332,9 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.syncUserContext(() => {
this.search() this.search()
})
}, },
/** /**
......
...@@ -608,11 +608,11 @@ Page({ ...@@ -608,11 +608,11 @@ Page({
}, },
init(userInfo) { }, init(userInfo) { },
syncUserContext() { syncUserContext(done) {
let userInfo = wx.$util.getUserInfo() || {} let userInfo = wx.$util.getUserInfo() || {}
let nextShopMerchantId = userInfo?.shopMerchantId || '' let nextShopMerchantId = userInfo?.shopMerchantId || ''
let prevShopMerchantId = this.data.userInfo?.shopMerchantId || '' let prevShopMerchantId = this.data.userInfo?.shopMerchantId || ''
let searchObj = this.data.searchObj || {} let searchObj = { ...(this.data.searchObj || {}) }
let merchantType = let merchantType =
userInfo?.merchantAccountList?.includes('6') || userInfo?.merchantAccountList?.includes('6') ||
userInfo?.merchantAccountList?.includes('8') userInfo?.merchantAccountList?.includes('8')
...@@ -629,7 +629,9 @@ Page({ ...@@ -629,7 +629,9 @@ Page({
searchObj.merchantId = '' searchObj.merchantId = ''
updateData.searchObj = searchObj updateData.searchObj = searchObj
} }
this.setData(updateData) this.setData(updateData, () => {
typeof done === 'function' && done()
})
}, },
search() { search() {
wx.$orderListRefresh = false wx.$orderListRefresh = false
...@@ -950,8 +952,9 @@ Page({ ...@@ -950,8 +952,9 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
// this.test() // this.test()
this.syncUserContext() this.syncUserContext(() => {
this.getCreateOrderSetting() this.getCreateOrderSetting()
})
}, },
/** /**
...@@ -963,9 +966,10 @@ Page({ ...@@ -963,9 +966,10 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.syncUserContext() this.syncUserContext(() => {
this.getCreateOrderSetting() this.getCreateOrderSetting()
this.search() this.search()
})
}, },
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!