Commit 672b7747 by zhangxw

修改

1 parent d54bcf2b
...@@ -24,7 +24,6 @@ Component({ ...@@ -24,7 +24,6 @@ Component({
attached() { attached() {
// 获取服务商下4s店 // 获取服务商下4s店
this.getMerchantList() this.getMerchantList()
console.log(this.data.tabType, '123123')
}, },
}, },
/** /**
......
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
</view> </view>
</view> </view>
<!-- 选择门店 --> <!-- 选择门店 -->
<select-merchant-popup wx:if="{{popupShow}}" bind:hidePopup="handleSlectMerchant" bindmerchantConfirm="handleMerchantChange" selectInfo="{{formData}}" popShow="{{popupShow}}" serviceRange="{{merchantList}}" isTab="{{true}}"/> <select-merchant-popup wx:if="{{popupShow}}" bind:hidePopup="handleSlectMerchant" bindmerchantConfirm="handleMerchantChange" selectInfo="{{formData}}" popShow="{{popupShow}}" merchantRange="{{merchantList}}" isTab="{{true}}"/>
<!-- 筛选 --> <!-- 筛选 -->
<screen-confirm-box wx:if="{{confirmShow}}" tabBarStyle="{{tabBarStyle}}" show="{{confirmShow}}" formData="{{formData}}" tabType="{{tabType}}"></screen-confirm-box>
\ No newline at end of file \ No newline at end of file
<screen-confirm-box wx:if="{{confirmShow}}" tabBarStyle="{{tabBarStyle}}" show="{{confirmShow}}" formData="{{formData}}" tabType="{{tabType}}" bindreloadMerchantList="getMerchantList"></screen-confirm-box>
\ No newline at end of file \ No newline at end of file
...@@ -33,7 +33,6 @@ Component({ ...@@ -33,7 +33,6 @@ Component({
isSuper: false, isSuper: false,
servicePopupShow: false, servicePopupShow: false,
merchantRange: [], merchantRange: [],
subIndex: 0,
sceneList: [ sceneList: [
{ {
id: '', id: '',
...@@ -87,25 +86,18 @@ Component({ ...@@ -87,25 +86,18 @@ Component({
USERAPI.adminSelectLogin() USERAPI.adminSelectLogin()
.then(result => { .then(result => {
let { merchantList: merchantRange } = result let { merchantList: merchantRange } = result
let subIndex = -1
merchantRange.forEach((item, index) => { merchantRange.forEach((item, index) => {
item.show = true item.show = true
if (item.merchantId == userInfo.subLoginUser.merchantId) {
subIndex = index
item.act = true
}
}) })
this.setData({ this.setData({
merchantRange, merchantRange
subIndex
}) })
}) })
.catch(err => { }) .catch(err => { })
} else { } else {
let merchantRange = [{ merchantId: userInfo.subLoginUser.merchantId, merchantName: userInfo.subLoginUser.merchantName }] let merchantRange = [{ merchantId: userInfo.subLoginUser.merchantId, merchantName: userInfo.subLoginUser.merchantName }]
this.setData({ this.setData({
merchantRange, merchantRange
subIndex: 0
}) })
} }
}, },
...@@ -125,6 +117,7 @@ Component({ ...@@ -125,6 +117,7 @@ Component({
subIndex, subIndex,
formData formData
}) })
if (this.data.tabType == 1 && merchantId !== userInfo?.subLoginUser?.merchantId) this.getStaffList()
this.servicePicker() this.servicePicker()
}, },
// 服务商切换 // 服务商切换
...@@ -132,8 +125,6 @@ Component({ ...@@ -132,8 +125,6 @@ Component({
this.setData({ this.setData({
servicePopupShow: !this.data.servicePopupShow servicePopupShow: !this.data.servicePopupShow
}) })
// 根据服务商请求员工数据
this.getStaffList()
}, },
// 月份确定 // 月份确定
dateRangeSelect(e) { dateRangeSelect(e) {
...@@ -190,8 +181,7 @@ Component({ ...@@ -190,8 +181,7 @@ Component({
}, },
init() { init() {
this.getMerchantRange() this.getMerchantRange()
this.getStaffList() if (this.data.tabType == 1) this.getStaffList() // 我的员工有员工筛选条件
console.log(this.data.tabType, 'tabType')
}, },
choose(e) { choose(e) {
let { index, listName } = e.currentTarget.dataset let { index, listName } = e.currentTarget.dataset
...@@ -214,8 +204,6 @@ Component({ ...@@ -214,8 +204,6 @@ Component({
this.setData({ this.setData({
formData formData
}) })
// 请求员工数据
this.getStaffList()
break break
} }
this.setData({ this.setData({
...@@ -229,13 +217,14 @@ Component({ ...@@ -229,13 +217,14 @@ Component({
formData.sceneType = sceneList.filter(val => val.active)[0]?.id || '' formData.sceneType = sceneList.filter(val => val.active)[0]?.id || ''
formData.staffUUIDs = staffList.filter(val => val.active).map(subVal => {return subVal.userId}) formData.staffUUIDs = staffList.filter(val => val.active).map(subVal => {return subVal.userId})
const thisPage = wx.$router.getPageInstance() const thisPage = wx.$router.getPageInstance()
// 切换登录账号
console.log(formData?.partnerMerchantIds[0])
if (formData?.partnerMerchantIds[0] !== userInfo.subLoginUser.merchantId) { if (formData?.partnerMerchantIds[0] !== userInfo.subLoginUser.merchantId) {
USERAPI.switchSubLoginInfo({ merchantId: formData?.partnerMerchantIds[0] }).then(res => { USERAPI.switchSubLoginInfo({ merchantId: formData?.partnerMerchantIds[0] }).then(res => {
console.log(res)
setUserInfo(res) setUserInfo(res)
wx.$api.hideLoading() wx.$api.hideLoading()
this.triggerEvent('reloadMerchantList')
// 切换服务商 清空已选的门店
formData.shopMerchantIds = []
formData.shopMerchantNames = '全部门店'
thisPage.setData({ thisPage.setData({
screenFormData: formData screenFormData: formData
}) })
...@@ -243,28 +232,38 @@ Component({ ...@@ -243,28 +232,38 @@ Component({
}) })
} else { } else {
wx.$api.hideLoading() wx.$api.hideLoading()
thisPage.searchEvent()
thisPage.setData({ thisPage.setData({
screenFormData: formData screenFormData: formData
}) })
thisPage.searchEvent()
} }
}, },
reset() { reset() {
let { formData, userInfo, sceneList, staffList } = this.data let { formData, userInfo, sceneList, staffList, tabType, merchantRange, subIndex } = this.data
formData.partnerMerchantIds = [userInfo.subLoginUser.merchantId] formData.partnerMerchantIds = [userInfo.subLoginUser.merchantId]
formData.startTime = '' formData.startTime = ''
formData.endTime = '' formData.endTime = ''
formData.sceneType = '' formData.sceneType = ''
formData.staffUUIDs = [] formData.staffUUIDs = []
sceneList.map(val => val.active = false) if (tabType == 0) {
sceneList[0].active = true sceneList.map(val => val.active = false)
staffList.map(val => val.active = false) sceneList[0].active = true
staffList[0].active = true } else if (tabType == 1) {
staffList.map(val => val.active = false)
staffList[0].active = true
}
merchantRange.forEach((item, index) => {
item.show = true
if (item.merchantId == userInfo.subLoginUser.merchantId) {
subIndex = index
}
})
this.setData({ this.setData({
formData, formData,
sceneList, sceneList,
staffList staffList,
merchantRange,
subIndex
}) })
this.init() this.init()
} }
......
...@@ -80,4 +80,4 @@ ...@@ -80,4 +80,4 @@
</view> </view>
</scroll-view> </scroll-view>
<switchAccountPopup wx:if="{{servicePopupShow}}" bind:hidePopup="tapPicker" bindchangeAccount="changeMerchantRange" popShow="{{servicePopupShow}}" merchantRange="{{merchantRange}}" hideTab="{{true}}"/> <switchAccountPopup wx:if="{{servicePopupShow}}" bind:hidePopup="servicePicker" bindchangeAccount="changeMerchantRange" popShow="{{servicePopupShow}}" merchantRange="{{merchantRange}}" selectInfo="{{formData}}" hideTab="{{true}}"/>
...@@ -10,9 +10,31 @@ Component({ ...@@ -10,9 +10,31 @@ Component({
properties: { properties: {
popShow: { popShow: {
type: Boolean, type: Boolean,
value: false value: false,
observer: function (n) {
if (n) {
let { merchantRange, selectInfo } = this.data
let activeIndex = merchantRange.findIndex(v => v.merchantId == selectInfo.partnerMerchantIds[0])
merchantRange.forEach((item, ind) => {
item.show = true
if (activeIndex == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantRange,
selectedMerchantId: selectInfo.partnerMerchantIds[0]
})
})
this.setData({
searchKeyword: ''
})
}
}
}, },
merchantRange: Object, merchantRange: Object,
selectInfo: Object,
hideTab: Boolean hideTab: Boolean
}, },
...@@ -25,7 +47,6 @@ Component({ ...@@ -25,7 +47,6 @@ Component({
}, },
observers: { observers: {
merchantRange: function (e) { merchantRange: function (e) {
// console.log(e)
this.setData({ this.setData({
merchantList: e merchantList: e
}) })
...@@ -60,7 +81,7 @@ Component({ ...@@ -60,7 +81,7 @@ Component({
this.triggerEvent('changeAccount', actObj) this.triggerEvent('changeAccount', actObj)
}, },
select(e) { select(e) {
let { index } = e.currentTarget.dataset let { index, target } = e.currentTarget.dataset
let { merchantRange } = this.data let { merchantRange } = this.data
merchantRange.forEach((item, ind) => { merchantRange.forEach((item, ind) => {
if (index == ind) { if (index == ind) {
...@@ -69,16 +90,18 @@ Component({ ...@@ -69,16 +90,18 @@ Component({
item.act = false item.act = false
} }
this.setData({ this.setData({
merchantRange merchantRange,
selectedMerchantId: target.merchantId
}) })
}) })
}, },
input(e) { input(e) {
let { merchantRange } = this.data let { merchantRange, selectedMerchantId } = this.data
let { value } = e.detail let { value } = e.detail
merchantRange.forEach(item => { merchantRange.forEach(item => {
item.act = false item.act = false
item.show = item.merchantName.includes(value) item.show = item.merchantName.includes(value)
if (item.merchantId == selectedMerchantId) item.act = true
}) })
this.setData({ this.setData({
merchantRange merchantRange
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
class="itemCon text-hide {{item.act?'active':''}}" class="itemCon text-hide {{item.act?'active':''}}"
hidden="{{!item.show}}" hidden="{{!item.show}}"
data-index="{{index}}" data-index="{{index}}"
data-target="{{item}}"
bindtap="select"> bindtap="select">
{{item.merchantName}} {{item.merchantName}}
</view> </view>
......
...@@ -13,10 +13,10 @@ Component({ ...@@ -13,10 +13,10 @@ Component({
value: false, value: false,
observer: function (n) { observer: function (n) {
if (n) { if (n) {
let { serviceRange, selectInfo } = this.data let { merchantRange, selectInfo } = this.data
let activeIndex = serviceRange.findIndex(v => v.merchantId == selectInfo.shopMerchantIds[0]) let activeIndex = merchantRange.findIndex(v => v.merchantId == selectInfo.shopMerchantIds[0])
if (serviceRange.length) serviceRange.unshift({merchantId: '', merchantName: '全部'}) if (merchantRange.length) merchantRange.unshift({merchantId: '', merchantName: '全部'})
serviceRange.forEach((item, ind) => { merchantRange.forEach((item, ind) => {
item.show = true item.show = true
if (activeIndex == (ind - 1)) { if (activeIndex == (ind - 1)) {
item.act = true item.act = true
...@@ -24,7 +24,8 @@ Component({ ...@@ -24,7 +24,8 @@ Component({
item.act = false item.act = false
} }
this.setData({ this.setData({
serviceRange merchantRange,
selectedMerchantId: selectInfo.shopMerchantIds[0]
}) })
}) })
this.setData({ this.setData({
...@@ -33,7 +34,7 @@ Component({ ...@@ -33,7 +34,7 @@ Component({
} }
} }
}, },
serviceRange: Object, merchantRange: Object,
selectInfo: Object, selectInfo: Object,
isMerchant: Boolean, isMerchant: Boolean,
isTab: Boolean isTab: Boolean
...@@ -48,7 +49,7 @@ Component({ ...@@ -48,7 +49,7 @@ Component({
searchKeyword: '' searchKeyword: ''
}, },
observers: { observers: {
serviceRange: function (e) { merchantRange: function (e) {
this.setData({ this.setData({
serviceList: e || [] serviceList: e || []
}) })
...@@ -62,8 +63,8 @@ Component({ ...@@ -62,8 +63,8 @@ Component({
this.triggerEvent('hidePopup') this.triggerEvent('hidePopup')
}, },
confirm() { confirm() {
let { serviceRange, subIndex } = this.data let { merchantRange, subIndex } = this.data
let actObj = serviceRange.find((item, index) => { let actObj = merchantRange.find((item, index) => {
if (item.act) { if (item.act) {
subIndex = index subIndex = index
} }
...@@ -84,29 +85,30 @@ Component({ ...@@ -84,29 +85,30 @@ Component({
this.hidePopup() this.hidePopup()
}, },
select(e) { select(e) {
let { index } = e.currentTarget.dataset let { index, target } = e.currentTarget.dataset
let { serviceRange } = this.data let { merchantRange } = this.data
serviceRange.forEach((item, ind) => { merchantRange.forEach((item, ind) => {
if (index == ind) { if (index == ind) {
item.act = true item.act = true
} else { } else {
item.act = false item.act = false
} }
this.setData({ this.setData({
serviceRange merchantRange,
selectedMerchantId: target.merchantId
}) })
}) })
}, },
search(e) { search(e) {
let { serviceRange, selectInfo } = this.data let { merchantRange, selectedMerchantId } = this.data
let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail
serviceRange.forEach(item => { merchantRange.forEach(item => {
item.act = false item.act = false
item.show = item.merchantName?.includes(value) item.show = item.merchantName?.includes(value)
if (item.merchantId == selectInfo.shopMerchantIds[0]) item.act = true if (item.merchantId == selectedMerchantId) item.act = true
}) })
this.setData({ this.setData({
serviceRange merchantRange
}) })
}, },
input(e) { input(e) {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<view <view
class="itemCon text-hide {{item.act?'active':''}}" class="itemCon text-hide {{item.act?'active':''}}"
data-index="{{index}}" data-index="{{index}}"
data-target="{{item}}"
hidden="{{!item.show}}" hidden="{{!item.show}}"
bindtap="select"> bindtap="select">
{{item.merchantName}} {{item.merchantName}}
......
...@@ -56,7 +56,6 @@ Page({ ...@@ -56,7 +56,6 @@ Page({
}) })
}, },
changeTabIndx(e) { changeTabIndx(e) {
console.log(e)
this.setData({ this.setData({
tabIndx: e.detail tabIndx: e.detail
}) })
...@@ -98,7 +97,6 @@ Page({ ...@@ -98,7 +97,6 @@ Page({
// merchantModule.init && merchantModule.init() // merchantModule.init && merchantModule.init()
} }
let { isSuper, userInfo } = this.data let { isSuper, userInfo } = this.data
console.log(isSuper)
// 判断是超管才需要切换账号 // 判断是超管才需要切换账号
if (isSuper) { if (isSuper) {
USERAPI.adminSelectLogin() USERAPI.adminSelectLogin()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<block> <block>
<tab wx:if="{{!isShowFilterScreen}}" noLine="{{true}}" tab="{{tabList}}" itemWidth="{{'136rpx'}}" index="{{tabIndx}}" tabHeight unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" /> <tab wx:if="{{!isShowFilterScreen}}" noLine="{{true}}" tab="{{tabList}}" itemWidth="{{'136rpx'}}" index="{{tabIndx}}" tabHeight unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="screen_box"> <view class="screen_box">
<screen-box id="screenBox" formData="{{screenFormData}}" tabType="{{tabIndex}}" tabBarStyle="{{tabBarStyle}}" isShowFilterScreen="{{isShowFilterScreen}}" bindconfirm="screenConfirm" merchantRange="{{merchantRange}}"></screen-box> <screen-box id="screenBox" formData="{{screenFormData}}" tabType="{{tabIndx}}" tabBarStyle="{{tabBarStyle}}" isShowFilterScreen="{{isShowFilterScreen}}" bindconfirm="screenConfirm" merchantRange="{{merchantRange}}"></screen-box>
</view> </view>
</block> </block>
<block wx:if="{{isShowFilterScreen}}"> <block wx:if="{{isShowFilterScreen}}">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!