Commit c58b93c3 by 张立顺

fix bug 修复

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