Commit 3061a629 by 前端

Merge branch 'sass+v5.8.2' into 'master'

上线合并

See merge request !25
2 parents 5daebc54 945f25d4
Showing 93 changed files with 4026 additions and 457 deletions
...@@ -285,6 +285,96 @@ module.exports = { ...@@ -285,6 +285,96 @@ module.exports = {
getStaffRemindList(data) { getStaffRemindList(data) {
return api.post('dj.api.smartcarlife.staff.reminder.list', data) return api.post('dj.api.smartcarlife.staff.reminder.list', data)
}, },
/** 分页查询事项列表(任务中心) */
getTaskCenterPage(data) {
return api.post(
'dj.staff.api.taskcenter.task.page',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 统计事项任务数量(待完成/已完成/全部,入参与列表一致) */
getTaskCenterCountStat(data) {
return api.post(
'dj.staff.api.taskcenter.task.count.stat',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 查询事项详情(传任务主键 id) */
getTaskCenterDetail(data) {
return api.post(
'dj.staff.api.taskcenter.task.detail',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 事项提交(任务主键 id + 专项任务回复) */
submitTaskCenter(data) {
return api.post(
'dj.staff.api.taskcenter.task.submit',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请分页列表 */
getTeachingApplicationPage(data) {
return api.post(
'dj.staff.api.strategy.teachingApplication.page',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请详情(传审批中心申请单 applicationId) */
getTeachingApplicationDetail(data) {
return api.post(
'dj.staff.api.strategy.teachingApplication.detail',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请提交 */
submitTeachingApplication(data) {
return api.post(
'dj.staff.api.strategy.teachingApplication.submit',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请-归属门店列表 */
getStrategyShopMerchantList(data) {
return api.post(
'dj.staff.api.strategy.shopMerchantList',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请-驻店人员列表 */
getStrategyShopMerchantStaffList(data) {
return api.post(
'dj.staff.api.strategy.shopMerchantStaffList',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 带教申请-区域督导 */
getStrategyShopMerchantSupervisor(data) {
return api.post(
'dj.staff.api.strategy.shopMerchantSupervisorGet',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
/** 关闭员工待办事项 */ /** 关闭员工待办事项 */
shutDownTaskApi(data) { shutDownTaskApi(data) {
return api.post('dj.api.smartcarlife.staff.reminder.shutdown', data) return api.post('dj.api.smartcarlife.staff.reminder.shutdown', data)
...@@ -427,5 +517,14 @@ module.exports = { ...@@ -427,5 +517,14 @@ module.exports = {
// 获取异常订单待审核数量 // 获取异常订单待审核数量
getOrderWaitForAudit(data) { getOrderWaitForAudit(data) {
return api.post('dj.api.smartcarlife.goodsOrderApplyRecord.waitForAudit.count', data) return api.post('dj.api.smartcarlife.goodsOrderApplyRecord.waitForAudit.count', data)
} },
/** 带教申请列表 */
getMentorShipList(data) {
return api.post(
'dj.api.businessSchool.miniProgram.teachTask.page',
data,
[],
'/rop-dj-business-school-miniprogram/router'
)
},
} }
...@@ -9,11 +9,17 @@ ...@@ -9,11 +9,17 @@
"pages/webView/webView", "pages/webView/webView",
"pages/tab/index/index", "pages/tab/index/index",
"pages/tab/workspace/workspace", "pages/tab/workspace/workspace",
"pages/tab/matters/matters",
"pages/tab/study/study", "pages/tab/study/study",
"pages/tab/mine/mine", "pages/tab/mine/mine",
"pages/log/log", "pages/log/log",
"pages/changeScene/changeScene", "pages/changeScene/changeScene",
"pages/h5AuthPhone/h5AuthPhone" "pages/h5AuthPhone/h5AuthPhone",
"pages/mattersHandle/mattersHandle",
"pages/mattersSubmitResult/mattersSubmitResult",
"pages/teachApply/teachApply",
"pages/teachApplyDetail/teachApplyDetail",
"pages/teachApplyCreate/teachApplyCreate"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
...@@ -29,16 +35,22 @@ ...@@ -29,16 +35,22 @@
"position": "bottom", "position": "bottom",
"list": [ "list": [
{ {
"pagePath": "pages/tab/workspace/workspace",
"text": "工作台",
"iconPath": "images/tab-workspace.png",
"selectedIconPath": "images/tab-workspace-active.png"
},
{
"pagePath": "pages/tab/index/index", "pagePath": "pages/tab/index/index",
"text": "首页", "text": "店效",
"iconPath": "images/tab-home.png", "iconPath": "images/tab-home.png",
"selectedIconPath": "images/tab-home-active.png" "selectedIconPath": "images/tab-home-active.png"
}, },
{ {
"pagePath": "pages/tab/workspace/workspace", "pagePath": "pages/tab/matters/matters",
"text": "工作台", "text": "事项",
"iconPath": "images/tab-workspace.png", "iconPath": "images/tab-shixiang.png",
"selectedIconPath": "images/tab-workspace-active.png" "selectedIconPath": "images/tab-shixiang-active.png"
}, },
{ {
"pagePath": "pages/tab/study/study", "pagePath": "pages/tab/study/study",
...@@ -88,8 +100,7 @@ ...@@ -88,8 +100,7 @@
"pages/performanceRating/batchOperation/batchOperation", "pages/performanceRating/batchOperation/batchOperation",
"pages/validReferralCount/referraCountEdit/referraCountEdit", "pages/validReferralCount/referraCountEdit/referraCountEdit",
"pages/attendanceStatis/attendanceDetail/attendanceDetail", "pages/attendanceStatis/attendanceDetail/attendanceDetail",
"pages/appealFormManage/appealFormDetail/appealFormDetail", "pages/appealFormManage/appealFormDetail/appealFormDetail"
"pages/residentManage/createStaff"
] ]
}, },
{ {
......
...@@ -26,7 +26,9 @@ Component({ ...@@ -26,7 +26,9 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: {}, data: {
showPopup: false,
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -34,9 +36,7 @@ Component({ ...@@ -34,9 +36,7 @@ Component({
methods: { methods: {
noScroll() { }, noScroll() { },
hidePopup() { hidePopup() {
this.setData({ this.setData({ showPopup: false })
show: false
})
this.triggerEvent('cancel') this.triggerEvent('cancel')
}, },
confirm() { confirm() {
...@@ -44,9 +44,9 @@ Component({ ...@@ -44,9 +44,9 @@ Component({
} }
}, },
attached() { attached() {
// console.log(wx.$util.isFullSucreen(), 'wx.$util.isFullSucreen()')
this.setData({ this.setData({
isFullSucreen: wx.$util.isFullSucreen(true) isFullSucreen: wx.$util.isFullSucreen(true),
showPopup: !!this.properties.show,
}) })
} }
}) })
\ No newline at end of file \ No newline at end of file
// components/TabBar/TabBar.js // components/TabBar/TabBar.js
Component({ Component({
/**
* 组件的属性列表
*/
properties: { properties: {
tabList: Array, tabList: Array,
activeIndex: { activeIndex: {
type: Number, type: Number,
observer: function (n) { observer(n) {
console.log(this.data.tabIndex, 'activeIndex', n); if (this.data.tabIndex !== n) {
console.log(this.data.tabIndex != n); this.setData({ tabIndex: n })
if (this.data.tabIndex != n) {
this.setData({
tabIndex: this.data.activeIndex
})
this.setTab(this.data.tabIndex)
}
} }
}, },
scroll: Boolean
}, },
/** scroll: Boolean,
* 组件的初始数据 },
*/
data: { data: {
tabIndex: 0 tabIndex: 0,
}, },
lifetimes: { lifetimes: {
ready() { ready() {
// console.log('lifetimes',this.data.tabIndex); const index = this.properties.activeIndex || 0
// console.log('lifetimes',this.data.activeIndex); this.setData({ tabIndex: index })
this.setTab(this.data.tabIndex) },
let that = this
wx.$eventbus.on('page_show', n => {
!that.data.width && that.setTab(that.data.tabIndex)
})
}
}, },
/**
* 组件的方法列表
*/
methods: {
methods: {
change(e) { change(e) {
let { const { index } = e.currentTarget.dataset
index
} = e.currentTarget.dataset
this.setTab(index) this.setTab(index)
}, },
setTab(index = 0) { setTab(index = 0) {
let { index = Number(index)
tabIndex, if (Number.isNaN(index)) index = 0
} = this.data if (Number(this.data.tabIndex) === index) {
wx.$util.getViewInfo(`#tab-${tabIndex}`, old => { this.triggerEvent('click', index)
let oldLeft = old.left return
let oldWidth = old.width
wx.$util.getViewInfo(`#tab-${index}`, res => {
let {
left,
width
} = res
if (tabIndex != index) {
let readyLeft = oldLeft > left ? left : oldLeft
let readyWidth = oldLeft > left ? oldLeft - left : left - oldLeft
this.setData({
activeStyle: `width: var(--fontSize64);background-color:#2C66F7;border-radius:3rpx;left:${readyLeft + readyWidth / 2}px;transition: all .1s;`
})
} }
setTimeout(() => {
this.setData({ this.setData({
activeStyle: `width: var(--fontSize64);left:${left + (width - 32) / 2}px;background-color:#2C66F7;`,
tabIndex: index, tabIndex: index,
to: `to-${index}`, to: `to-${index}`,
width
}) })
this.triggerEvent('click', index) this.triggerEvent('click', index)
}, 100) },
}, this) },
}, this)
}
}
}) })
...@@ -18,6 +18,5 @@ ...@@ -18,6 +18,5 @@
<text id="tab-{{index}}"><text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text></text> <text id="tab-{{index}}"><text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text></text>
</view> </view>
</block> </block>
<view class="active-doc" style="{{activeStyle}}" />
</view> </view>
</block> </block>
\ No newline at end of file \ No newline at end of file
/* components/TabBar/TabBar.wxss */ /* components/TabBar/TabBar.wxss */
.tab { .tab {
position: relative;
background-color: #fff; background-color: #fff;
height: var(--fontSize72); height: var(--fontSize72);
box-sizing: border-box; box-sizing: border-box;
...@@ -7,7 +8,6 @@ ...@@ -7,7 +8,6 @@
align-items: center; align-items: center;
font-size: var(--fontSize28); font-size: var(--fontSize28);
color: #999999; color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
} }
.scroll { .scroll {
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
height: var(--fontSize72); height: var(--fontSize72);
box-sizing: border-box; box-sizing: border-box;
color: #999999; color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
width: 100%; width: 100%;
display: flex; display: flex;
line-height: var(--fontSize72); line-height: var(--fontSize72);
...@@ -28,16 +27,21 @@ ...@@ -28,16 +27,21 @@
color: #2C66F7; color: #2C66F7;
} }
.active-doc { .tab .tab-item {
position: relative;
text-align: center;
}
.tab .tab-item.active::after {
content: '';
position: absolute; position: absolute;
bottom: var(--fontSize1); bottom: -12rpx;
left: 50%;
transform: translateX(-50%);
width: 64rpx;
height: var(--fontSize4); height: var(--fontSize4);
background-color: #2c66f7;
border-radius: var(--fontSize2) var(--fontSize2) 0 0; border-radius: var(--fontSize2) var(--fontSize2) 0 0;
transition: all .25s;
}
.tab .tab-item {
text-align: center;
} }
.scroll .tab-item { .scroll .tab-item {
......
const { TAB_LIST } = require('~/utils/tabBarConfig')
Component({
properties: {
selected: {
type: Number,
value: 0,
},
},
data: {
list: TAB_LIST,
color: '#999999',
selectedColor: '#222222',
layout: {},
},
lifetimes: {
attached() {
this.updateLayout()
},
},
methods: {
updateLayout() {
const sys = wx.getSystemInfoSync()
const rpx = sys.windowWidth / 750
const contentH = Math.round(112 * rpx)
const iconSize = Math.round(48 * rpx)
const mattersActSize = Math.round(112 * rpx)
const textSize = Math.round(20 * rpx)
const safeBottom = sys.safeArea?.bottom || 0
const itemWidth = Math.floor(sys.windowWidth / TAB_LIST.length)
this.setData({
layout: {
barHeight: contentH + safeBottom,
contentH,
safeBottom,
itemWidth,
iconSize,
mattersActSize,
textSize,
lineH: Math.round(28 * rpx),
},
})
},
switchTab(e) {
const { path, index } = e.currentTarget.dataset
const idx = Number(index)
if (idx === this.properties.selected) return
wx.switchTab({ url: path })
},
},
})
<!-- web-view 页面专用:cover-view 可浮在原生 web-view 之上 -->
<cover-view
class="cover-tab-bar"
style="height: {{layout.barHeight}}px; padding-bottom: {{layout.safeBottom}}px;"
>
<cover-view class="cover-tab-bar-border"></cover-view>
<cover-view class="cover-tab-bar-inner" style="height: {{layout.contentH}}px;">
<cover-view
wx:for="{{list}}"
wx:key="pagePath"
class="cover-tab-item"
style="width: {{layout.itemWidth}}px; height: {{layout.contentH}}px;"
data-path="{{item.pagePath}}"
data-index="{{index}}"
bindtap="switchTab"
>
<block wx:if="{{item.isMatters}}">
<block wx:if="{{selected === index}}">
<cover-image
class="cover-matters-act"
src="{{item.selectedIconPath}}"
style="width: {{layout.mattersActSize}}px; height: {{layout.mattersActSize}}px;"
/>
</block>
<block wx:else>
<cover-image
class="cover-icon"
src="{{item.iconPath}}"
style="width: {{layout.iconSize}}px; height: {{layout.iconSize}}px;"
/>
<cover-view
class="cover-text"
style="font-size: {{layout.textSize}}px; line-height: {{layout.lineH}}px; color: {{color}};"
>
{{item.text}}
</cover-view>
</block>
</block>
<block wx:else>
<cover-image
class="cover-icon"
src="{{selected === index ? item.selectedIconPath : item.iconPath}}"
style="width: {{layout.iconSize}}px; height: {{layout.iconSize}}px;"
/>
<cover-view
class="cover-text"
style="font-size: {{layout.textSize}}px; line-height: {{layout.lineH}}px; color: {{selected === index ? selectedColor : color}};"
>
{{item.text}}
</cover-view>
</block>
</cover-view>
</cover-view>
</cover-view>
.cover-tab-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background-color: #ffffff;
box-sizing: border-box;
z-index: 99999;
}
.cover-tab-bar-border {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1px;
background-color: #f2f3f5;
}
.cover-tab-bar-inner {
display: flex;
flex-direction: row;
align-items: flex-end;
width: 100%;
}
.cover-tab-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
padding-bottom: 4px;
}
.cover-icon {
display: block;
}
.cover-text {
text-align: center;
margin-top: 2px;
}
.cover-matters-act {
display: block;
}
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 1; let index = 2;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
const { TAB_LIST } = require('~/utils/tabBarConfig')
Component({
data: {
selected: 0,
color: '#999999',
selectedColor: '#222222',
list: TAB_LIST,
},
lifetimes: {
attached() {
TAB_LIST.forEach((item) => {
wx.getImageInfo({ src: item.iconPath, fail() {} })
wx.getImageInfo({ src: item.selectedIconPath, fail() {} })
})
},
},
methods: {
switchTab(e) {
const { path, index } = e.currentTarget.dataset
if (this.data.selected === index) return
wx.switchTab({ url: path })
this.setData({ selected: index })
},
},
})
{
"component": true
}
<view class="tab-bar">
<view class="tab-bar-border"></view>
<block wx:for="{{list}}" wx:key="pagePath">
<view
class="tab-bar-item {{item.isMatters ? 'tab-bar-item--matters' : ''}} {{item.isMatters && selected === index ? 'tab-bar-item--matters-on' : ''}}"
data-path="{{item.pagePath}}"
data-index="{{index}}"
bindtap="switchTab"
>
<block wx:if="{{item.isMatters}}">
<view class="tab-bar-matters-box">
<block wx:if="{{selected === index}}">
<image
class="tab-bar-matters-act-icon"
src="{{item.selectedIconPath}}"
mode="aspectFit"
/>
</block>
<block wx:else>
<image class="tab-bar-icon" src="{{item.iconPath}}" mode="aspectFit" />
<text class="tab-bar-text">{{item.text}}</text>
</block>
</view>
</block>
<block wx:else>
<view class="tab-bar-icon-wrap">
<image
class="tab-bar-icon-layer"
src="{{item.iconPath}}"
mode="aspectFit"
style="opacity: {{selected === index ? 0 : 1}};"
/>
<image
class="tab-bar-icon-layer"
src="{{item.selectedIconPath}}"
mode="aspectFit"
style="opacity: {{selected === index ? 1 : 0}};"
/>
</view>
<text class="tab-bar-text" style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</text>
</block>
</view>
</block>
</view>
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: calc(112rpx + env(safe-area-inset-bottom));
padding-bottom: env(safe-area-inset-bottom);
background: #ffffff;
display: flex;
align-items: flex-end;
box-sizing: border-box;
z-index: 9999;
}
.tab-bar-border {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1rpx;
background: #f2f3f5;
transform: scaleY(0.5);
}
.tab-bar-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
height: 112rpx;
padding-bottom: 8rpx;
box-sizing: border-box;
}
.tab-bar-icon {
width: 48rpx;
height: 48rpx;
display: block;
flex-shrink: 0;
}
.tab-bar-icon-wrap {
position: relative;
width: 48rpx;
height: 48rpx;
flex-shrink: 0;
}
.tab-bar-icon-layer {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.tab-bar-text {
font-size: 20rpx;
line-height: 28rpx;
margin-top: 4rpx;
color: #999999;
}
/* 事项:未激活 48rpx + 文案;激活 112rpx 大图无文案 */
.tab-bar-item--matters {
padding-bottom: 8rpx;
}
.tab-bar-item--matters-on {
padding-bottom: 0;
}
.tab-bar-matters-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
width: 100%;
min-height: 80rpx;
}
.tab-bar-item--matters-on .tab-bar-matters-box {
min-height: 112rpx;
justify-content: center;
}
.tab-bar-matters-act-icon {
width: 112rpx;
height: 112rpx;
display: block;
flex-shrink: 0;
}
...@@ -128,6 +128,8 @@ Component({ ...@@ -128,6 +128,8 @@ Component({
const display = this.data.displayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false })) const display = this.data.displayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
const selected = display[index].checked ? [currentVal] : [] const selected = display[index].checked ? [currentVal] : []
this.setData({ displayOptions: display, selectedValues: selected }) this.setData({ displayOptions: display, selectedValues: selected })
const copyDisplay = this.data.copyDisplayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
this.setData({ copyDisplayOptions: copyDisplay })
this.triggerEvent('change', { values: selected, items: this.getSelectedItems() }) this.triggerEvent('change', { values: selected, items: this.getSelectedItems() })
if (this.properties.confirmOnSelect) { if (this.properties.confirmOnSelect) {
this.onConfirm() this.onConfirm()
......
...@@ -38,5 +38,10 @@ module.exports = { ...@@ -38,5 +38,10 @@ module.exports = {
/** 根据人员获取业务场景数据 */ /** 根据人员获取业务场景数据 */
getBaseSceneCodeList(data) { getBaseSceneCodeList(data) {
return api.post("dj.api.scenemerchantref.findAllSceneByMerchantId", data) return api.post("dj.api.scenemerchantref.findAllSceneByMerchantId", data)
},
/** 新增员工-获取北森待激活的员工数据 */
getEmployeeOnTheJobList(data) {
return api.post("dj.api.smartcarlife.staffBaseInfo.pageList", data)
} }
}; };
...@@ -276,7 +276,9 @@ Component({ ...@@ -276,7 +276,9 @@ Component({
pageNum, pageNum,
pageSize pageSize
} }
wx.$util.showLoading()
api.getDailyReportConfigList(params).then(res => { api.getDailyReportConfigList(params).then(res => {
wx.$util.hideLoading()
if (res.code == 0) { if (res.code == 0) {
let { let {
list, list,
...@@ -319,9 +321,20 @@ Component({ ...@@ -319,9 +321,20 @@ Component({
staffName, staffName,
staffId staffId
} = accountList[index] } = accountList[index]
wx.navigateTo({ let pageInstance = wx.$router.getPageInstance()
url: `/packageWorkspace/pages/residentManage/createStaff?staffPhone=${staffPhone}&staffName=${staffName}&staffId=${staffId}`
pageInstance.setData({
activeIndex: 0
}, () => {
let thisPage = pageInstance.selectComponent(`#componet-0`)
thisPage.setData({
'staffObj.staffName': staffName,
'staffObj.staffPhone': staffPhone,
'staffObj.staffId': staffId,
namePhoneDisabled: true
})
}) })
}, },
// 触底刷新 // 触底刷新
mineReachBottom() { mineReachBottom() {
...@@ -354,11 +367,9 @@ Component({ ...@@ -354,11 +367,9 @@ Component({
}) })
}, },
}, },
// lifetimes: { lifetimes: {
// attached: function () { attached: function () {
// this.getData() this.getData()
// } }
},
// },
}) })
\ No newline at end of file \ No newline at end of file
/* tabWorkOrder/pages/residentManage/components/accountAllocation/index.wxss */ /* tabWorkOrder/pages/residentManage/components/accountAllocation/index.wxss */
.container {
height: calc(100% - 104rpx);
}
.search-input { .search-input {
// border: 1rpx solid #979797; // border: 1rpx solid #979797;
background: #ffffff; background: #ffffff;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<block wx:if="{{ isFlag }}"> <block wx:if="{{ isFlag }}">
<scroll-view <scroll-view
class="account-box" class="account-box"
style="height: calc(100vh - var(--fontSize540));" style="height: calc(100% - var(--fontSize340));"
enhanced="{{ true }}" enhanced="{{ true }}"
show-scrollbar="{{ false }}" show-scrollbar="{{ false }}"
scroll-y scroll-y
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
"usingComponents": { "usingComponents": {
"business-type":"../businessType/index", "business-type":"../businessType/index",
"shop-merchant":"../shopMerchant/index", "shop-merchant":"../shopMerchant/index",
"yq-merchant":"../yqMerchant/index" "yq-merchant":"../yqMerchant/index",
"select-popup":"../../../../components/selectPopup/selectPopup",
"staff-select-popup": "../staffSelectPopup/index"
} }
} }
/* tabWorkOrder/pages/residentManage/components/addStaff/index.wxss */ /* tabWorkOrder/pages/residentManage/components/addStaff/index.wxss */
.container { .container {
margin: var(--fontSize16) var(--fontSize24); margin: 0 var(--fontSize24);
border-radius: 16rpx; border-radius: 16rpx;
opacity: 1; opacity: 1;
box-sizing: border-box; box-sizing: border-box;
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
} }
.between{ .between{
text-align:right; text-align:right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.placeholder-class { .placeholder-class {
color: #BBBBBB; color: #BBBBBB;
......
<!--tabWorkOrder/pages/residentManage/components/addStaff/index.wxml--> <!--tabWorkOrder/pages/residentManage/components/addStaff/index.wxml-->
<view class="container"> <scroll-view class="content-box"
style="height: calc(100% - 104rpx);"
scroll-y>
<view style="width: 100%; height: 16rpx;background: transparent;"></view>
<view class="container">
<view class="top-box"> <view class="top-box">
<view> <view>
<view class="title">增设新员工门店账号</view> <view class="title">
<view class="info">增设的员工账号支持该手机号所绑定的员工登录「嘀加区域助手」小程序开展业务录单。 增设新员工门店账号
仅支持新增深圳嘀加服务商下的员工账号</view>
</view> </view>
<image class="staff-icon" src="{{IMG_URL}}add-staff.png" mode=""/> <view class="info">
增设的员工账号支持该手机号所绑定的员工登录「嘀加区域助手」小程序开展业务录单。仅支持新增深圳嘀加服务商下的员工账号
</view>
</view>
<image class="staff-icon"
src="{{ IMG_URL }}add-staff.png"
mode="" />
</view> </view>
<view class="box"> <view class="box">
<gl-cell border valueAlign="right" label="员工姓名" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize290)" required> <gl-cell border
<input placeholder="请输入" disabled style="color: #BBBBBB;" value="{{staffObj.staffName}}" class="input" placeholder-class="placeholder-class" bindinput="input" data-name="staffObj.staffName" always-embed></input> valueAlign="right"
label="员工姓名"
cellHeight="{{ cellHeight }}"
cellStyle="{{ cellStyle }}"
requiredAfter
labelWidth="var(--fontSize160)"
required
haveArrow="{{ !namePhoneDisabled }}"
bindclick="openStaffSelect"
placeholder="点击选择">
<block wx:if="{{ namePhoneDisabled }}">
<input placeholder="请输入"
disabled="{{ namePhoneDisabled }}"
style="color: {{ namePhoneDisabled ? '#BBBBBB' : '' }}"
value="{{ staffObj.staffName }}"
class="input"
placeholder-class="placeholder-class"
bindinput="input"
data-name="staffObj.staffName"
always-embed></input>
</block>
<block wx:else>
<view class="between {{ staffObj.staffName ? '' : 'placeholder-class' }}">
{{ staffObj.staffName || '点击选择' }}
</view>
</block>
</gl-cell> </gl-cell>
<gl-cell border valueAlign="right" label="手机号" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize140)" required> <gl-cell border
<input placeholder="请输入" disabled class="input" style="color: #BBBBBB;" value="{{staffObj.staffPhone}}" type="number" maxlength="11" placeholder-class="placeholder-class" bindinput="input" bindblur="phoneBlur" data-name="staffObj.staffPhone" always-embed></input> valueAlign="right"
label="手机号"
cellHeight="{{ cellHeight }}"
cellStyle="{{ cellStyle }}"
requiredAfter
labelWidth="var(--fontSize160)"
required>
<input placeholder="请输入"
disabled="{{ true }}"
class="input"
style="color: #BBBBBB"
value="{{ staffObj.staffPhone }}"
type="number"
maxlength="11"
placeholder-class="placeholder-class"
always-embed></input>
</gl-cell> </gl-cell>
<gl-cell border valueAlign="right" required label="归属门店" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize180)" haveArrow bindclick="showPopup" data-show-name="shopMerchantBox" placeholder="点击选择"> <gl-cell border
valueAlign="right"
required
label="归属门店"
cellHeight="{{ cellHeight }}"
cellStyle="{{ cellStyle }}"
requiredAfter
labelWidth="var(--fontSize160)"
haveArrow
bindclick="showPopup"
data-show-name="shopMerchantBox"
placeholder="点击选择">
<block wx:if="{{ staffObj.merchantId }}"> <block wx:if="{{ staffObj.merchantId }}">
<view class="between">{{staffObj.merchantName}}{{staffObj.merchantId}}</view> <view class="between">
{{ staffObj.merchantName }}{{ staffObj.merchantId }}
</view>
</block> </block>
</gl-cell> </gl-cell>
<gl-cell border valueAlign="right" label="所属业务" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize180)" required haveArrow bindclick="showPopup"data-show-name="isBusiness" placeholder="点击选择"> <gl-cell border
valueAlign="right"
label="所属业务"
cellHeight="{{ cellHeight }}"
cellStyle="{{ cellStyle }}"
requiredAfter
labelWidth="var(--fontSize160)"
required
haveArrow
bindclick="showPopup"
data-show-name="isBusiness"
placeholder="点击选择">
<block wx:if="{{ staffObj.staffSceneLabelText }}"> <block wx:if="{{ staffObj.staffSceneLabelText }}">
<view class="between">{{staffObj.staffSceneLabelText}}</view> <view class="between">
{{ staffObj.staffSceneLabelText }}
</view>
</block> </block>
</gl-cell> </gl-cell>
<gl-cell valueAlign="right" label="关联账号" required cellHeight="{{cellHeight}}" cellBoxStyle="{{cellBoxStyle}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize290)" haveArrow="{{yqMerchartList.length>1}}" bindclick="showPopup" data-show-name="yqMerchartBox" placeholder="点击选择" > <gl-cell valueAlign="right"
<block wx:if="{{ staffObj.yqMerchantName }}"> border
<view class="between">{{staffObj.yqMerchantName}}{{staffObj.yqMerchantId}}</view> label="关联账号"
required
cellHeight="{{ cellHeight }}"
cellBoxStyle="{{ cellBoxStyle }}"
cellStyle="{{ cellStyle }}"
requiredAfter
labelWidth="var(--fontSize160)"
placeholder="自动关联">
<block wx:if="{{ staffObj.yqMerchantListText }}">
<view class="between" bindtap="showAllYqMerchantListText">
{{ staffObj.yqMerchantListText }}
</view>
</block>
</gl-cell>
<gl-cell valueAlign="right"
label="驻店类型"
required
requiredAfter
cellHeight="{{ cellHeight }}"
cellBoxStyle="{{ cellBoxStyle }}"
cellStyle="{{ cellStyle }}"
labelWidth="var(--fontSize160)"
haveArrow
bindclick="openResidentType"
placeholder="点击选择">
<block wx:if="{{ staffObj.stationTypeText }}">
<view class="between">
{{ staffObj.stationTypeText }}
</view>
</block> </block>
</gl-cell> </gl-cell>
</view> </view>
</view>
<view class="btn" bind:tap="submit">确认开通</view>
<text class="hint">请核对员工姓名、手机号,开通账号后即可</text>
<text class="hint">投入使用。登录密码默认为Aa+手机号</text>
<business-type show="{{isBusiness}}" scene-label="{{staffObj.staffSceneLabel}}" baseSceneList="{{baseSceneList}}" bindconfirm="selectChoose"></business-type>
<shop-merchant show="{{shopMerchantBox}}" scene-label="{{staffObj.staffSceneLabel}}" bindconfirm="selectChooseShop" merchantId="{{staffObj.merchantId}}"></shop-merchant>
<yq-merchant show="{{yqMerchartBox}}" merchantId="{{staffObj.yqMerchantId}}" yqMerchartList="{{yqMerchartList}}"></yq-merchant>
\ No newline at end of file \ No newline at end of file
</view>
<view class="btn" bind:tap="submit">
确认开通
</view>
<text class="hint">请核对员工姓名、手机号,开通账号后即可</text><text class="hint">投入使用。登录密码默认为Aa+手机号</text>
</scroll-view>
<business-type show="{{ isBusiness }}"
scene-label="{{ staffObj.staffSceneLabel }}"
baseSceneList="{{ baseSceneList }}"
bindconfirm="selectChoose"></business-type>
<shop-merchant show="{{ shopMerchantBox }}"
scene-label="{{ staffObj.staffSceneLabel }}"
bindconfirm="selectChooseShop"
selectedObj="{{ selectedShopObj }}"></shop-merchant>
<staff-select-popup show="{{staffSelectBox}}" bindconfirm="selectChooseStaff" selectedObj="{{selectedStaffObj}}"></staff-select-popup>
<select-popup show="{{ stationTypeBox }}"
title="选择驻店类型"
options="{{ stationTypeOptions }}"
labelKey="label"
valueKey="value"
value="{{ [staffObj.stationType] }}"
height="40%"
bindconfirm="onResidentTypeConfirm"
bindcancel="onResidentTypeCancel" />
...@@ -48,10 +48,10 @@ Component({ ...@@ -48,10 +48,10 @@ Component({
} = this.data, { } = this.data, {
index index
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
list.forEach(item=>{ if (index === undefined || index === null) return
item.active=false const item = list[index]
}) if (!item) return
list[index].active =true item.active = !item.active
this.setData({ this.setData({
list, list,
}); });
......
...@@ -2,47 +2,46 @@ ...@@ -2,47 +2,46 @@
.box { .box {
// height:200rpx; // height:200rpx;
height: 100%; height: 100%;
// width: calc(100% + var(--fontSize64));
// margin-left: calc(-1 * var(--fontSize32));
} }
.item {
padding: 24rpx 4rpx; .item{
box-sizing: border-box; display: flex;
height: var(--fontSize88);
align-items: center;
color: #292D33;
border-bottom: var(--fontSize1) solid #EFF0F2; border-bottom: var(--fontSize1) solid #EFF0F2;
}
.item:last-child{
border-bottom: none;
}
.item.active{
color: #2C66F7;
}
.item-hd { .merchant_item{
height: var(--fontSize88);
font-size: var(--fontSize28);
display: flex; display: flex;
align-items: center; align-items: center;
width:94%;
}
.name { .merchant_item .text-hide{
max-width: 400rpx; max-width: calc(100% - var(--fontSize192));
font-weight: 400;
font-size: 28rpx;
color: #292D33;
margin-left: 20rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} white-space: nowrap;
}
.total-price { .mark{
font-weight: 500; width:var(--fontSize32);
font-size: 28rpx; height: var(--fontSize32);
color: #2C66F7; }
margin-left: auto;
}
.icon { .icon {
display: block;
width: var(--fontSize32); width: var(--fontSize32);
height: var(--fontSize32); height: var(--fontSize32);
} display: block;
margin-right: var(--fontSize20);
.icon .arc { flex-shrink: 0;
width: 100%;
height: 100%;
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
}
} }
<popup show="{{ show }}" title="选择所属业务" bindconfirm="confirm" bindcancel="cancel" height="40%"> <popup show="{{ show }}" title="选择所属业务" bindconfirm="confirm" bindcancel="cancel" height="40%">
<scroll-view scroll-y show-scrollbar="{{false}}" enhanced="true" class="box"> <scroll-view scroll-y show-scrollbar="{{false}}" enhanced="true" class="box">
<block wx:if="{{list.length}}"> <block wx:if="{{list.length}}">
<view class="item" wx:for="{{ list }}"> <block wx:for="{{ list }}" wx:key="index">
<view class="item-hd" catchtap="choose" data-index="{{ index }}"> <view class="item {{ item.active ? 'active' : '' }}" bindtap="choose" data-index="{{ index }}">
<view class="icon" > <view class="merchant_item">
<block wx:if="{{ item.active }}"> <view class="text-hide">{{item.baseSceneCodeName}}</view>
<image src="../../image/radio.png" />
</block>
<block wx:else>
<view class="arc" />
</block>
</view> </view>
<view class="name">{{item.baseSceneCodeName}}</view> <view class="mark" wx:if="{{ item.active }}">
<gl-image class="icon" src="/equity/mark.png" />
</view> </view>
</view> </view>
</block> </block>
<view class="safeAreaInset"></view> </block>
</scroll-view> </scroll-view>
</popup> </popup>
...@@ -11,22 +11,24 @@ Component({ ...@@ -11,22 +11,24 @@ Component({
if (n) { if (n) {
this.setData({ this.setData({
pageNum: 1, pageNum: 1,
storeIndex: null,
nothing: false, nothing: false,
keyword:'', keyword:'',
merchantIdName:'', merchantIdName:'',
tempMerchantId: this.data.merchantId, scrollTop: 0,
scrollTop: 0 isFlag: false,
shopMerchantList: []
}, () => { }, () => {
this.getData() this.getData()
this.setData({
selectItem: wx.$util.deepClone(this.data.selectedObj)
})
}) })
} }
} }
}, },
sceneLabel: String, sceneLabel: String,
merchantId: String selectedObj: Object
}, },
/** /**
...@@ -41,8 +43,7 @@ Component({ ...@@ -41,8 +43,7 @@ Component({
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
storeIndex: null, selectItem: {},
tempMerchantId: '',
shopMerchantList: [] shopMerchantList: []
}, },
/** /**
...@@ -89,20 +90,27 @@ Component({ ...@@ -89,20 +90,27 @@ Component({
pageNum, pageNum,
pageSize pageSize
} }
this.setData({
requestLoading: true
})
if (pageNum == 1) wx.$util.showLoading()
api.getshopMerchantList(params).then(res => { api.getshopMerchantList(params).then(res => {
wx.$util.hideLoading()
this.setData({
requestLoading: false
})
if (res.code == 0) { if (res.code == 0) {
let { let {
list, list,
total total,
pages
} = res.data; } = res.data;
let tempList = pageNum == 1 ? list : [...shopMerchantList, ...res.data.list]; let tempList = pageNum == 1 ? list : [...shopMerchantList, ...res.data.list];
this.setData({ this.setData({
shopMerchantList: tempList, shopMerchantList: tempList,
isFlag: true, isFlag: true,
total: total, total: total,
nothing: pageNum == 1 ? false : total == tempList.length, nothing: pages == pageNum,
}, () => {
if (this.data.tempMerchantId ) this.initData()
}) })
} }
...@@ -118,58 +126,39 @@ Component({ ...@@ -118,58 +126,39 @@ Component({
if (pageNum * pageSize >= total) { if (pageNum * pageSize >= total) {
return return
} }
if (this.data.requestLoading) return
this.setData({ this.setData({
pageNum: pageNum + 1 pageNum: pageNum + 1
}, () => { }, () => {
this.getData() this.getData()
}) })
}, },
initData(n) {
let {
shopMerchantList,
storeIndex,
tempMerchantId,
} = this.data;
storeIndex = null
shopMerchantList.forEach((item, index) => {
if (item.shopMerchantId == tempMerchantId) {
storeIndex = index
}
})
this.setData({
storeIndex
})
},
choose(e) { choose(e) {
let { let {
index item
} = e.currentTarget.dataset, } = e.currentTarget.dataset,
{ {
shopMerchantList shopMerchantList
} = this.data, } = this.data
{ console.log(item)
shopMerchantId
} = shopMerchantList[index];
this.setData({ this.setData({
storeIndex: index, selectItem: item,
tempMerchantId:shopMerchantId shopMerchantList
}) })
}, },
confirm() { confirm() {
if (this.data.shopMerchantList.length == 0) return if (this.data.shopMerchantList.length == 0) return
let { let {
shopMerchantList, selectItem
storeIndex
} = this.data; } = this.data;
if(storeIndex===null) { if(!Object.keys(selectItem).length) {
wx.$util.showToast('请选择门店'); wx.$util.showToast('请选择门店');
return return
} }
let { let {
shopMerchantId, shopMerchantId,
shopMerchantName shopMerchantName
} = shopMerchantList[storeIndex]; } = selectItem;
this.setData({ this.setData({
show: false show: false
}, () => { }, () => {
...@@ -193,9 +182,6 @@ Component({ ...@@ -193,9 +182,6 @@ Component({
thisPage.setData({ thisPage.setData({
shopMerchantBox: false, shopMerchantBox: false,
}) })
this.setData({
storeIndex: 0
})
}, },
} }
......
...@@ -10,16 +10,19 @@ ...@@ -10,16 +10,19 @@
<scroll-view class="store-select-box" scroll-top="{{scrollTop}}" style="height: calc(100% - var(--fontSize82));" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-y bindscrolltolower="mineReachBottom"> <scroll-view class="store-select-box" scroll-top="{{scrollTop}}" style="height: calc(100% - var(--fontSize82));" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-y bindscrolltolower="mineReachBottom">
<view class="merchant-box" wx:if="{{shopMerchantList.length>0}}"> <view class="merchant-box" wx:if="{{shopMerchantList.length>0}}">
<block wx:for="{{shopMerchantList}}" wx:key="index"> <block wx:for="{{shopMerchantList}}" wx:key="index">
<view class="item {{storeIndex===index?'active':''}}" bindtap="choose" data-index="{{index}}"> <view class="item {{selectItem.shopMerchantId == item.shopMerchantId ? 'active' : ''}}" bindtap="choose" data-item="{{item}}" data-index="{{index}}">
<view class="merchant_item"> <view class="merchant_item">
<view class="text-hide">{{item.shopMerchantName}}</view> <view class="text-hide">{{item.shopMerchantName}}</view>
<view>{{item.shopMerchantId}}</view> <view>{{item.shopMerchantId}}</view>
</view> </view>
<view class="mark" wx:if="{{storeIndex===index}}"> <view class="mark" wx:if="{{selectItem.shopMerchantId == item.shopMerchantId}}">
<gl-image class="icon" src="/equity/mark.png" /> <gl-image class="icon" src="/equity/mark.png" />
</view> </view>
</view> </view>
</block> </block>
<block wx:if="{{requestLoading}}">
<view class="list-nothing">加载中</view>
</block>
<block wx:if="{{nothing}}"> <block wx:if="{{nothing}}">
<view class="list-nothing">到底了~</view> <view class="list-nothing">到底了~</view>
</block> </block>
......
// packageWorkspace/pages/residentManage/components/staffSelectPopup/index.js
import api from '../../api'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
this.setData({
pageNum: 1,
nothing: false,
keyword:'',
staffName:'',
scrollTop: 0,
selectedObj: wx.$util.deepClone(this.data.selectedObj),
staffList: [],
isFlag: false
}, () => {
this.getData()
})
}
}
},
sceneLabel: String,
selectedObj: Object
},
/**
* 组件的初始数据
*/
data: {
keyword: '',
staffName: '',
scrollTop: 0,
nothing: false,
isFlag: false,
total: 0,
pageNum: 1,
pageSize: 20,
selectItem: {},
staffList: []
},
/**
* 组件的方法列表
*/
methods: {
clear() {
this.setData({
keyword: "",
staffName:''
});
this.search();
},
input(e) {
let {
value
} = e.detail;
this.setData({
keyword: value
});
},
search() {
this.setData({
staffName:this.data.keyword,
pageNum:1,
accountList: [],
isFlag: false,
nothing: false,
}, () => {
this.getData()
});
},
getData() {
let {
staffList,
staffName,
pageNum,
pageSize
} = this.data
let params = {
staffName,
workingStatus: 2,
pageNum,
pageSize
}
if (pageNum == 1) wx.$util.showLoading()
if (this.data.requestLoading) return
this.setData({
requestLoading: true
})
api.getEmployeeOnTheJobList(params).then(res => {
wx.$util.hideLoading()
this.setData({requestLoading: false})
if (res.code == 0) {
let {
list,
total,
pages
} = res.data;
res.data?.list?.forEach(val => {
val.staffId = val.id
})
let tempList = pageNum == 1 ? list : [...staffList, ...res.data.list];
this.setData({
staffList: tempList,
isFlag: true,
total: total,
nothing: pageNum == pages
})
}
})
},
// 触底刷新
mineReachBottom() {
let {
pageNum,
total,
pageSize
} = this.data
if (this.data.requestLoading) return
if (pageNum * pageSize >= total) {
return
}
this.setData({
pageNum: pageNum + 1
}, () => {
this.getData()
})
},
choose(e) {
let {item} = e.currentTarget.dataset,
{
staffList
} = this.data
this.setData({
selectItem: item,
staffList
})
},
confirm() {
if (this.data.staffList.length == 0) return
let {
selectItem
} = this.data;
if(!Object.keys(selectItem).length) {
wx.$util.showToast('请选择员工');
return
}
let {
staffPhone,
staffName,
staffId
} = selectItem;
this.setData({
show: false
}, () => {
this.triggerEvent("confirm",{ staffPhone, staffName, staffId})
})
},
hidePopup() {
let pageInstance = wx.$router.getPageInstance()
let thisPage = pageInstance.selectComponent(`#componet-0`)
thisPage.setData({
staffSelectBox: false,
})
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageWorkspace/pages/residentManage/components/staffSelectPopup/index.wxss */
.title{
margin-bottom: var(--fontSize20);
color: #292D33;
font-weight: 400;
font-size: var(--fontSize32);
}
.staff-select-box{
height: calc(100% - var(--fontSize168));
}
.staff-box{
height:100%;
}
.staff-box .item{
display: flex;
height: var(--fontSize88);
align-items: center;
color: #292D33;
border-bottom: var(--fontSize1) solid #EFF0F2;
}
.staff-box .item:last-child{
border-bottom: none;
}
.staff-box .item.active{
color: #2C66F7;
}
.item .staff_item{
height: var(--fontSize88);
font-size: var(--fontSize28);
display: flex;
align-items: center;
width:94%;
}
.item .staff_item .text-hide{
max-width: calc(100% - var(--fontSize192));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item .icon {
width: var(--fontSize32);
height: var(--fontSize32);
display: block;
margin-right: var(--fontSize20);
flex-shrink: 0;
}
.item .icon .arc {
width: 100%;
height: 100%;
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
.mark{
width:var(--fontSize32);
height: var(--fontSize32);
}
.list-nothing,
.list-not {
text-align: center;
font-size: 28rpx;
color: #979797;
}
.search-input {
// border: 1rpx solid #979797;
background: #F7F8FA;
border-radius: var(--fontSize38);
//width: calc(100% - var(--fontSize64));
height: var(--fontSize72);
display: flex;
align-items: center;
margin: 16rpx 0;
}
.search-input .search-icon {
width: var(--fontSize28);
height: var(--fontSize28);
margin: 0 var(--fontSize10) 0 var(--fontSize26);
}
.search-input .search-clear {
width: var(--fontSize36);
height: var(--fontSize36);
margin: 0 var(--fontSize26) 0 var(--fontSize10);
}
.search-input .input {
font-size: var(--fontSize28);
height: var(--fontSize38);
line-height: var(--fontSize38);
width: calc(100% - var(--fontSize136));
}
.input-placeholder {
color: rgba(200, 201, 204, .89);
}
\ No newline at end of file \ No newline at end of file
<!--packageWorkspace/pages/residentManage/components/staffSelectPopup/index.wxml-->
<popup title="选择员工" show="{{ show }}" bindconfirm="confirm" height="85%" bindcancel="hidePopup" class="staff-wrap">
<view class="search-input">
<image src="/images/search.png" class="search-icon" />
<input type="text" placeholder="员工查询" class="input" value="{{ keyword }}" placeholder-class="input-placeholder" bindinput="input" bindconfirm="search" />
<block wx:if="{{ keyword }}">
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<block wx:if="{{isFlag}}">
<scroll-view class="staff-select-box" scroll-top="{{scrollTop}}" style="height: calc(100% - var(--fontSize82));" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-y bindscrolltolower="mineReachBottom">
<view class="staff-box" wx:if="{{staffList.length>0}}">
<block wx:for="{{staffList}}" wx:key="index">
<view class="item {{selectItem.staffId == item.id ? 'active' : ''}}" bindtap="choose" data-item="{{item}}">
<view class="staff_item">
<view class="text-hide">{{item.staffName}}</view>
</view>
<view class="mark" wx:if="{{selectItem.staffId == item.id}}">
<gl-image class="icon" src="/equity/mark.png" />
</view>
</view>
</block>
<view class="list-nothing" wx:if="{{requestLoading}}">加载中</view>
<block wx:if="{{nothing}}">
<view class="list-nothing">到底了~</view>
</block>
</view>
<view class="no-data" wx:if="{{!staffList.length}}">
<empty-data />
</view>
</scroll-view>
</block>
</popup>
\ No newline at end of file \ No newline at end of file
// packageWorkspace/pages/residentManage/createStaff.js
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
Page({
/**
* 页面的初始数据
*/
data: {
navStyle: 'background-color: transparent',
navBarHeight: 88,
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let comp = this.selectComponent('#componet-0')
if (comp) {
comp.setData({
'staffObj.staffName': options?.staffName,
'staffObj.staffPhone': options?.staffPhone,
'staffObj.staffId': options?.staffId
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
back() {
wx.$router.back()
},
getBaseSceneList() {
getBaseSceneCodeList
},
checkRequired(obj) {
let target = [
"staffName",
"staffPhone",
"staffSceneLabel",
"merchantId",
"yqMerchantId"
];
obj = {
...obj
};
if (!phoneRex.test(obj.staffPhone)) {
this.showToast("请输入正确的手机号");
return true;
}
try {
target.map((key) => {
if (!obj[key]) {
throw key;
}
});
} catch (error) {
return error;
}
return false;
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
/* packageWorkspace/pages/residentManage/createStaff.wxss */
page {
background: #F7F8FA;
}
.bg {
width: 100%;
height: var(--fontSize400);
background: linear-gradient(0deg, #e8f0fb00 0%, #dde8fb 100%);
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
\ No newline at end of file \ No newline at end of file
<!--packageWorkspace/pages/residentManage/createStaff.wxml-->
<navigation-bar bindnavbarReady="navbarReady" class="navigation-bar-wrap" bindback="back" showBack="true" navStyle="{{navStyle}}">新增员工</navigation-bar>
<view class="bg"></view>
<view class="content" style="margin-top: {{navBarHeight}}px;">
<add-staff id="componet-0"></add-staff>
</view>
...@@ -10,7 +10,15 @@ Page({ ...@@ -10,7 +10,15 @@ Page({
data: { data: {
navStyle: 'background-color: transparent', navStyle: 'background-color: transparent',
list: ['新增员工', '调店账号分配'], list: ['新增员工', '调店账号分配'],
activeIndex:0 activeIndex: 0,
navBarHeight: 113.5
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
}, },
/** /**
...@@ -23,20 +31,23 @@ Page({ ...@@ -23,20 +31,23 @@ Page({
let target = [ let target = [
"staffName", "staffName",
"staffPhone", "staffPhone",
"staffSceneLabel",
"merchantId", "merchantId",
"yqMerchantId" "staffSceneLabel",
"yqMerchantList",
"stationType"
]; ];
obj = { obj = {
...obj ...obj
}; };
if (!phoneRex.test(obj.staffPhone)) {
this.showToast("请输入正确的手机号");
return true;
}
try { try {
target.map((key) => { target.map((key) => {
if (key === "yqMerchantList") {
const hasList = Array.isArray(obj.yqMerchantList) && obj.yqMerchantList.length > 0
if (!hasList) throw key
return
}
if (!obj[key]) { if (!obj[key]) {
throw key; throw key;
} }
...@@ -44,6 +55,10 @@ Page({ ...@@ -44,6 +55,10 @@ Page({
} catch (error) { } catch (error) {
return error; return error;
} }
if (!phoneRex.test(obj.staffPhone)) {
this.showToast("请输入正确的手机号");
return true;
}
return false; return false;
}, },
/** /**
...@@ -57,8 +72,6 @@ Page({ ...@@ -57,8 +72,6 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
const comp = this.selectComponent("#componet-1");
comp.getData && comp.getData()
}, },
back() { back() {
wx.$router.back() wx.$router.back()
......
{ {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"add-staff": "./components/addStaff/index",
"account-allocation":"./components/accountAllocation/index" "account-allocation":"./components/accountAllocation/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,8 +14,8 @@ page { ...@@ -14,8 +14,8 @@ page {
} }
.content { .content {
margin-top: 176rpx; box-sizing: border-box;
height: 100vh;
.tabs { .tabs {
margin: 0 40rpx; margin: 0 40rpx;
display: flex; display: flex;
......
<navigation-bar bindnavbarReady="navbarReady" class="navigation-bar-wrap" bindback="back" showBack="true" navStyle="{{navStyle}}">驻店管理</navigation-bar> <navigation-bar bindnavbarReady="navbarReady" class="navigation-bar-wrap" bindback="back" showBack="true" navStyle="{{navStyle}}">驻店管理</navigation-bar>
<view class="bg"></view> <view class="bg"></view>
<view class="content"> <view class="content" style="padding-top: {{navBarHeight}}px;">
<account-allocation id="componet-1"></account-allocation> <view class="tabs" >
<view wx:for="{{list}}" wx:key="index" class="tab {{activeIndex==index?'active':''}}" data-index="{{index}}" bind:tap="changeHandle">{{item}}</view>
</view>
<add-staff id="componet-0" wx:if="{{activeIndex===0}}"></add-staff>
<account-allocation id="componet-1" wx:if="{{activeIndex===1}}"></account-allocation>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -49,7 +49,7 @@ Page({ ...@@ -49,7 +49,7 @@ Page({
sceneType: scene, sceneType: scene,
loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant, loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant,
}); });
wx.$router.reLaunch('pages.index', { wx.$router.reLaunch('pages.workspace', {
resetStoreList: true, resetStoreList: true,
}); });
} else { } else {
......
...@@ -68,7 +68,7 @@ Page({ ...@@ -68,7 +68,7 @@ Page({
wx.$router._to(navigateParams.url, navigateParams, 'reLaunch') wx.$router._to(navigateParams.url, navigateParams, 'reLaunch')
return return
} }
if (!((userInfo?.sceneType ?? '') === '')) return wx.$router.reLaunch('pages.index', { if (!((userInfo?.sceneType ?? '') === '')) return wx.$router.reLaunch('pages.workspace', {
resetStoreList: true resetStoreList: true
}) })
......
import api from '~/api/api'
import { getMatterDetailFields, normalizeMatterItem } from '~/utils/matterItem'
Page({
data: {
navBarHeight: 0,
task: null,
reply: '',
detailFields: [],
submitting: false,
isReadonly: false,
loading: true,
},
onLoad(options) {
const id = options?.id
if (!id) {
wx.showToast({ title: '缺少任务信息', icon: 'none' })
setTimeout(() => wx.navigateBack(), 1500)
return
}
this.taskId = id
this.loadDetail()
},
async loadDetail() {
this.setData({ loading: true })
wx.showLoading({ title: '加载中', mask: true })
try {
const res = await api.getTaskCenterDetail({ id: this.taskId })
if (res?.code !== '0' && res?.code !== 0) {
wx.showToast({
title: res?.message || '加载失败',
icon: 'none',
})
setTimeout(() => wx.navigateBack(), 1500)
return
}
const task = normalizeMatterItem(res.data || {}, 0)
this.setData({
task,
detailFields: getMatterDetailFields(task.taskType),
isReadonly: task.completed,
reply: task.replyText || '',
loading: false,
})
} catch (e) {
wx.showToast({ title: '加载失败', icon: 'none' })
setTimeout(() => wx.navigateBack(), 1500)
} finally {
wx.hideLoading()
this.setData({ loading: false })
}
},
navbarReady(e) {
this.setData({ navBarHeight: e.detail.height })
},
onBack() {
wx.navigateBack()
},
onReplyInput(e) {
this.setData({ reply: e.detail.value || '' })
},
async submit() {
const { reply, task, submitting } = this.data
if (submitting || !task) return
const content = (reply || '').trim()
if (!content) {
wx.showToast({ title: '请输入专项任务回复', icon: 'none' })
return
}
if (content.length > 800) {
wx.showToast({ title: '回复内容不能超过800字', icon: 'none' })
return
}
this.setData({ submitting: true })
wx.showLoading({ title: '提交中', mask: true })
try {
const res = await api.submitTaskCenter({
id: task.id,
replyContent: content,
})
if (res?.code === '0' || res?.code === 0) {
this.onSubmitSuccess()
} else {
wx.showToast({
title: res?.message || res?.msg || '提交失败',
icon: 'none',
})
}
} catch (e) {
wx.showToast({ title: '提交失败', icon: 'none' })
} finally {
wx.hideLoading()
this.setData({ submitting: false })
}
},
onSubmitSuccess() {
const { task } = this.data
wx.hideLoading()
this.setData({ submitting: false })
wx.showToast({ title: '提交成功', icon: 'success' })
this.notifyRefresh()
setTimeout(() => {
if (task?.taskType === 'staff-replace-access') {
wx.redirectTo({
url: '/pages/mattersSubmitResult/mattersSubmitResult',
})
return
}
wx.navigateBack()
}, 1000)
},
notifyRefresh() {
const eventChannel = this.getOpenerEventChannel()
eventChannel?.emit?.('refreshList')
},
})
{
"navigationStyle": "custom",
"usingComponents": {
"navigation-bar": "/components/navigationBar/navigationBar",
"gl-textarea": "/components/GlTextarea/GlTextarea"
}
}
page {
background: #f2f3f7;
height: 100vh;
overflow: hidden;
}
.nav-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.handle-page {
box-sizing: border-box;
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.handle-scroll {
flex: 1;
height: 0;
box-sizing: border-box;
}
.flex {
display: flex;
align-items: flex-start;
}
.card {
margin: 24rpx 24rpx 0;
padding: 24rpx 32rpx;
background: #ffffff;
border-radius: 32rpx;
box-sizing: border-box;
}
.card-head {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 24rpx;
border-bottom: 2rpx dashed #f0f1f5;
}
.card-head-title {
flex: 1;
min-width: 0;
margin-right: 16rpx;
font-size: 30rpx;
font-weight: 600;
color: #222222;
}
.status {
height: 48rpx;
line-height: 48rpx;
border-radius: 8rpx;
padding: 0 12rpx;
font-size: 24rpx;
flex-shrink: 0;
}
.info-list {
padding-top: 24rpx;
}
.info-row {
margin-bottom: 12rpx;
font-size: 26rpx;
}
.info-row:last-child {
margin-bottom: 0;
}
.info-label {
width: 184rpx;
margin-right: 32rpx;
color: #999999;
flex-shrink: 0;
line-height: 40rpx;
}
.info-value {
flex: 1;
color: #222222;
line-height: 40rpx;
word-break: break-all;
}
.info-value--multiline {
white-space: normal;
}
.reply-card {
margin-top: 24rpx;
}
.reply-card .reply-info-list {
padding-top: 0;
}
.card-title {
font-size: 28rpx;
font-weight: 600;
color: #222222;
margin-bottom: 16rpx;
}
.required {
color: #ff4d4f;
margin-left: 4rpx;
}
.textarea-wrap {
height: 284px;
padding: 24rpx;
background: #ffffff;
border-radius: 16rpx;
box-sizing: border-box;
border: 2rpx solid #ececec;
}
.textarea-wrap gl-textarea {
display: block;
height: 100%;
}
.textarea-wrap .textarea-box {
height: 100%;
min-height: 0;
}
.textarea-wrap ._textarea_ {
width: 100%;
}
.footer-bar {
flex-shrink: 0;
padding: 16rpx 24rpx;
background: #ffffff;
box-sizing: border-box;
box-shadow: 0 -2rpx 16rpx rgba(0, 0, 0, 0.04);
}
.submit-btn {
height: 88rpx;
line-height: 88rpx;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-weight: 500;
color: #ffffff;
background: #2c66f7;
}
.reply-text {
font-size: 28rpx;
color: #222222;
line-height: 40rpx;
word-break: break-all;
}
.handle-page--readonly .reply-card {
margin-bottom: 24rpx;
}
<navigation-bar
showBack="{{ true }}"
bindback="onBack"
bindnavbarReady="navbarReady"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="nav-title">专项任务</view>
</navigation-bar>
<view
class="handle-page {{ isReadonly ? 'handle-page--readonly' : '' }}"
style="padding-top: {{ navBarHeight }}px;"
>
<scroll-view scroll-y class="handle-scroll">
<view class="card task-card" wx:if="{{ task }}">
<view class="card-head">
<view class="card-head-title text-hide">{{ task.taskTypeText }}</view>
<view
class="status text-center"
style="color:{{ task.statusStyle.color }};background-color:{{ task.statusStyle.background }};"
>
{{ task.statusName }}
</view>
</view>
<view class="info-list">
<view
class="info-row flex"
wx:for="{{ detailFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="info-label">{{ field.label }}</view>
<view class="info-value {{ field.multiline ? 'info-value--multiline' : '' }}">
{{ task[field.key] || '-' }}
</view>
</view>
</view>
</view>
<view class="card reply-card" wx:if="{{ task }}">
<block wx:if="{{ isReadonly }}">
<view class="info-list reply-info-list">
<view class="info-row flex">
<view class="info-label">专项任务回复</view>
<view class="info-value info-value--multiline reply-text">
{{ task.replyText || '-' }}
</view>
</view>
<view class="info-row flex">
<view class="info-label">回复时间</view>
<view class="info-value">{{ task.replyTimeText || '-' }}</view>
</view>
</view>
</block>
<block wx:else>
<view class="card-title">
专项任务回复<text class="required">*</text>
</view>
<view class="textarea-wrap">
<gl-textarea
bindinput="onReplyInput"
maxlength="{{ 800 }}"
showWordLimit
value="{{ reply }}"
placeholder="请输入"
placeholderColor="#bbbbbb"
color="#222222"
textStyle="font-size:28rpx;line-height:40rpx;"
/>
</view>
</block>
</view>
</scroll-view>
<view class="footer-bar isFullSucreen" wx:if="{{ !isReadonly }}">
<view class="submit-btn" bindtap="submit">提交</view>
</view>
</view>
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
Page({
data: {
IMG_URL,
navBarHeight: 0,
},
navbarReady(e) {
this.setData({ navBarHeight: e.detail.height })
},
goRecruit() {
wx.navigateTo({
url: '/packageWorkspace/pages/recruitManage/recruitInsert/recruitInsert',
})
},
onClose() {
wx.switchTab({ url: '/pages/tab/matters/matters' })
},
})
{
"navigationStyle": "custom",
"usingComponents": {
"navigation-bar": "/components/navigationBar/navigationBar"
}
}
page {
background: #ffffff;
height: 100vh;
}
.nav-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.result-page {
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: 0 48rpx;
}
.result-icon {
width: var(--fontSize304);
height: var(--fontSize304);
margin-top: var(--fontSize80);
margin-bottom: var(--fontSize24);
}
.result-title {
font-size: 40rpx;
font-weight: 600;
color: #222222;
margin-bottom: var(--fontSize16);
}
.result-desc {
font-size: var(--fontSize28);
color: #999999;
text-align: center;
line-height: 1.5;
margin-bottom: var(--fontSize80);
padding: 0 16rpx;
}
.btn {
width: 100%;
max-width: var(--fontSize622);
height: var(--fontSize88);
line-height: var(--fontSize88);
text-align: center;
border-radius: var(--fontSize24);
font-size: var(--fontSize32);
box-sizing: border-box;
}
.btn-primary {
background: #2c66f7;
color: #ffffff;
margin-bottom: var(--fontSize24);
}
.btn-secondary {
background: #f4f5f7;
color: #222222;
}
<navigation-bar
showBack="{{ true }}"
bindback="onClose"
bindnavbarReady="navbarReady"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="nav-title">提交成功</view>
</navigation-bar>
<view class="result-page" style="padding-top: {{ navBarHeight }}px;">
<image
class="result-icon"
src="{{ IMG_URL }}recruitment-success.png"
mode="aspectFit"
/>
<view class="result-title">提交成功</view>
<view class="result-desc">
如需跳转「新建招聘需求功能」页面请点击跳转
</view>
<view class="btn btn-primary" bindtap="goRecruit">跳转</view>
<view class="btn btn-secondary" bindtap="onClose">关闭</view>
</view>
...@@ -55,7 +55,7 @@ Page({ ...@@ -55,7 +55,7 @@ Page({
sceneType: scene, sceneType: scene,
loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant, loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant,
}); });
wx.$router.reLaunch('pages.index', { wx.$router.reLaunch('pages.workspace', {
resetStoreList: true, resetStoreList: true,
}); });
} else { } else {
......
// pages/tab/index/index.js // pages/tab/index/index.js — 店效(原首页 Tab,H5)
const app = getApp()
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
webUrl: '' webUrl: '',
userInfo: {},
}, },
/** onLoad() {
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUserInfo() this.getUserInfo()
this.init() this.init()
}, },
getUserInfo() { getUserInfo() {
let userInfo =wx.$util.getUserInfo() const userInfo = wx.$util.getUserInfo()
this.setData({ this.setData({ userInfo })
userInfo
})
}, },
init() { init() {
let webUrl = this.data; let index = 2
let index = 2; const accountInfo = wx.getAccountInfoSync()
let accountInfo = wx.getAccountInfoSync(); const envName = accountInfo.miniProgram.envVersion
let systemInfo = wx.getSystemInfoSync(); const manual = false
let envName = accountInfo.miniProgram.envVersion; const release = false
let {type} = this.data;
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false;
const release = false;
switch (envName) { switch (envName) {
case "develop": case 'develop':
break; break
case "trial": case 'trial':
index = manual ? index : 2; index = manual ? index : 2
break; break
case "release": case 'release':
index = release ? index : 3; index = release ? index : 3
break; break
default: default:
index = 3; index = 3
break; break
} }
const webUrls = { const webUrls = {
develop: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`, develop: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
trial: `https://scrm.test.glsx.com.cn/glsx-bi-report/#/?phone=`, trial: 'https://scrm.test.glsx.com.cn/glsx-bi-report/#/?phone=',
release: `https://scrm.glsx.com.cn/glsx-bi-report/#/?phone=`, release: 'https://scrm.glsx.com.cn/glsx-bi-report/#/?phone=',
preRelease: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`, preRelease: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
}; }
const target = ["ip", "develop", "trial", "release", "preRelease"]; const target = ['ip', 'develop', 'trial', 'release', 'preRelease']
webUrl = webUrls[target[index]]; const webUrl = webUrls[target[index]]
console.log(`${webUrl}${this.data.userInfo.phone}`) this.setData({ webUrl })
this.setData({
webUrl
})
}, },
/** onShow() {
* 生命周期函数--监听页面初次渲染完成 this.getUserInfo()
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
}, },
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
}) })
{ {
"usingComponents": {} "navigationStyle": "default"
} }
<!--pages/tab/index/index.wxml-->
<web-view src="{{webUrl}}{{userInfo.phone}}"></web-view>
\ No newline at end of file \ No newline at end of file
<web-view wx:if="{{webUrl}}" src="{{webUrl}}{{userInfo.phone}}"></web-view>
// pages/tab/matters/matters.js
import api from '~/api/api'
import {
parseTaskCenterCountStat,
parseTaskCenterPageData,
} from '~/utils/matterItem'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
const PAGE_SIZE = 10
Page({
data: {
IMG_URL,
navBarHeight: 0,
keyword: '',
tabList: ['待完成(0)', '已完成(0)', '全部(0)'],
tabIndex: 0,
displayList: [],
pageNum: 1,
pageSize: PAGE_SIZE,
total: 0,
hasMore: true,
loading: false,
triggered: false,
nothing: false,
tabCounts: { pending: 0, done: 0, all: 0 },
},
navbarReady(e) {
const navBarHeight = e.detail.height
this.setData({ navBarHeight })
},
onShow() {
if (this._pendingRefresh) {
this._pendingRefresh = false
this._returnedFromDetail = false
this.refreshAll()
return
}
if (this._returnedFromDetail) {
this._returnedFromDetail = false
return
}
if (!this._loaded) {
this._loaded = true
this.refreshAll()
return
}
this.fetchTabCounts()
},
onHide() {
this._returnedFromDetail = !!this._openingDetail
this._openingDetail = false
},
getKeyword() {
return String(this.data.keyword ?? '').trim()
},
onKeywordInput(e) {
this.setData({ keyword: e.detail.value })
},
clearKeyword() {
this.setData({ keyword: '' }, () => this.refreshAll())
},
search(e) {
const keyword = String(e?.detail?.value ?? this.data.keyword ?? '').trim()
this.setData({ keyword }, () => this.refreshAll())
},
onRefresh() {
this.setData({ triggered: true })
this.refreshAll().finally(() => {
this.setData({ triggered: false })
})
},
tabClick(e) {
const tabIndex = Number(e.detail)
if (Number.isNaN(tabIndex)) return
if (tabIndex === Number(this.data.tabIndex)) return
this.setData({ tabIndex }, () => this.reloadList())
},
onReachBottom() {
const { hasMore, loading } = this.data
if (!hasMore || loading) return
this.loadList(false)
},
getStatusByTab(tabIndex) {
const index = Number(tabIndex)
if (index === 0) return 0
if (index === 1) return 1
return undefined
},
buildListParams(pageNum, tabIndex = this.data.tabIndex) {
const index = Number(tabIndex)
const { pageSize } = this.data
const params = this.buildTaskQueryParams({ pageNum, pageSize })
const status = this.getStatusByTab(index)
if (status !== undefined) params.status = status
return params
},
/** 与列表接口相同的查询条件(不含 status,用于统计) */
buildTaskQueryParams({ pageNum = 1, pageSize } = {}) {
const { pageSize: defaultPageSize } = this.data
const keyWord = this.getKeyword()
return {
pageNum,
pageSize: pageSize ?? defaultPageSize,
keyWord,
keyword: keyWord,
}
},
updateTabListLabels(tabCounts) {
const { pending, done, all } = tabCounts
this.setData({
tabCounts,
tabList: [
`待完成(${pending})`,
`已完成(${done})`,
`全部(${all})`,
],
})
},
async fetchTabCounts() {
try {
const res = await api.getTaskCenterCountStat(this.buildTaskQueryParams())
if (res?.code !== '0' && res?.code !== 0) return
this.updateTabListLabels(parseTaskCenterCountStat(res.data || {}))
} catch (e) {
// 计数失败不影响列表展示
}
},
async refreshAll() {
await this.fetchTabCounts()
await this.reloadList()
},
async reloadList(clearList = true) {
this._loadSeq = (this._loadSeq || 0) + 1
const seq = this._loadSeq
const patch = { pageNum: 1, hasMore: true, loading: true }
if (clearList) patch.displayList = []
this.setData(patch)
await this.loadList(true, seq)
},
async loadList(reset = true, seq) {
if (!reset) {
if (this.data.loading) return
seq = seq || this._loadSeq
} else if (!seq) {
this._loadSeq = (this._loadSeq || 0) + 1
seq = this._loadSeq
this.setData({ loading: true })
}
const pageNum = reset ? 1 : this.data.pageNum
const requestTabIndex = Number(this.data.tabIndex)
if (!reset) this.setData({ loading: true })
try {
const res = await api.getTaskCenterPage(
this.buildListParams(pageNum, requestTabIndex)
)
if (seq !== this._loadSeq) return
if (Number(this.data.tabIndex) !== requestTabIndex) return
if (res?.code !== '0' && res?.code !== 0) {
wx.showToast({
title: res?.message || '加载失败',
icon: 'none',
})
this.setData({ loading: false, hasMore: false, nothing: true })
return
}
const { list, total } = parseTaskCenterPageData(res.data || {})
const displayList = reset ? list : [...this.data.displayList, ...list]
const hasMore = displayList.length < total
this.setData({
displayList,
total,
pageNum: pageNum + 1,
hasMore,
nothing: !hasMore,
loading: false,
})
} catch (e) {
if (seq !== this._loadSeq) return
wx.showToast({ title: '加载失败', icon: 'none' })
this.setData({
loading: false,
hasMore: false,
nothing: true,
})
}
},
goTeachApply() {
wx.navigateTo({
url: '/pages/teachApply/teachApply',
})
},
openMatterDetail(e) {
const { item } = e.currentTarget.dataset
if (!item?.id) return
this._openingDetail = true
wx.navigateTo({
url: `/pages/mattersHandle/mattersHandle?id=${item.id}`,
events: {
refreshList: () => {
this._pendingRefresh = true
},
},
})
},
})
{
"enablePullDownRefresh": false,
"usingComponents": {
"tab-bar": "/components/TabBar/TabBar",
"empty-data": "/components/EmptyData/EmptyData"
},
"navigationStyle": "custom"
}
page {
background: #f2f3f7;
height: 100vh;
overflow: hidden;
}
.bg {
width: 100%;
/* 高度与 matters-page 的 margin-top(navBarHeight)一致,见 wxml 内联 style */
background: #ffffff;
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
.page-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.matters-page {
height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
/* 底部自定义 tabBar 占位,避免列表被遮挡 */
// padding-bottom: calc(112rpx + env(safe-area-inset-bottom));
// padding-bottom: calc(112rpx + constant(safe-area-inset-bottom));
}
.flex {
display: flex;
align-items: center;
}
.top-box {
flex-shrink: 0;
background: #ffffff;
padding: 16rpx 24rpx 0 24rpx;
box-sizing: border-box;
.search-input {
background: #f7f8fa;
border-radius: var(--fontSize72);
width: 100%;
height: var(--fontSize72);
display: flex;
align-items: center;
margin-bottom: 16rpx;
box-sizing: border-box;
.search-icon {
width: var(--fontSize28);
height: var(--fontSize28);
margin: 0 var(--fontSize10) 0 var(--fontSize26);
flex-shrink: 0;
}
.search-clear-wrap {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0 var(--fontSize26) 0 var(--fontSize10);
position: relative;
z-index: 2;
}
.search-clear {
width: var(--fontSize36);
height: var(--fontSize36);
display: block;
}
.input {
flex: 1;
min-width: 0;
font-size: var(--fontSize28);
height: var(--fontSize38);
line-height: var(--fontSize38);
}
.input-placeholder {
color: #bbbbbb;
}
}
}
/* 与 recruitManage tab_box 一致 */
.tab_box {
margin: 0 var(--fontSize32);
position: relative;
}
.list {
flex: 1;
height: 0;
box-sizing: border-box;
}
/* 与 orderApprovalList 列表一致 */
.list .empty-box {
width: 100%;
height: var(--fontSize20);
}
.list .item {
box-sizing: border-box;
background: #ffffff;
padding: var(--fontSize32);
position: relative;
margin: 0 var(--fontSize20) var(--fontSize20);
box-shadow: 0 var(--fontSize4) var(--fontSize20) 0 #0000001a;
border-radius: var(--fontSize32);
font-size: var(--fontSize24);
}
.list .item-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--fontSize28);
font-size: var(--fontSize24);
font-weight: 400;
color: #292d33;
}
.list .code {
color: #292d33;
font-size: var(--fontSize32);
font-weight: 500;
}
.list .code-text {
font-size: var(--fontSize24);
font-weight: 400;
color: #292d33;
margin-left: var(--fontSize12);
}
.list .status {
padding: var(--fontSize4) var(--fontSize8);
font-size: var(--fontSize24);
flex-shrink: 0;
}
.list .order-list {
padding: 0;
}
.list .order {
display: flex;
margin-bottom: var(--fontSize16);
font-size: var(--fontSize24);
color: #292d33;
}
.list .order:last-child {
margin-bottom: 0;
}
.list .order-label {
width: var(--fontSize160);
flex-shrink: 0;
color: #999ea8;
}
.list .order-value {
flex: 1;
min-width: 0;
color: #292d33;
display: flex;
align-items: center;
}
.list .order-value--ellipsis {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.list .btn-box {
margin-top: var(--fontSize24);
justify-content: space-between;
font-weight: 500;
}
.list .btn {
font-weight: 400;
width: 168rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
border-radius: 16rpx;
font-size: 26rpx;
color: #ffffff;
background: #2c66f7;
}
.list .btn-view {
color: #2c66f7;
background: #eef3ff;
}
.list-nothing {
padding: 0 0 50rpx;
text-align: center;
font-size: 24rpx;
color: #999999;
}
.teach-entry {
position: fixed;
right: 8px;
bottom: 121px;
z-index: 100;
width: 68px;
height: 66px;
box-sizing: border-box;
border-radius: 12px;
border: 2px solid #ffffff;
background: linear-gradient(180deg, #f7f8fa 0%, #ffffff 100%);
box-shadow: 0 4px 16px 0 rgba(61, 78, 102, 0.2);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.teach-entry__icon {
width: 36px;
height: 36px;
flex-shrink: 0;
}
.teach-entry__text {
margin-top: 2px;
font-size: 10px;
line-height: 14px;
color: #2c66f7;
font-weight: 500;
}
<navigation-bar
bindnavbarReady="navbarReady"
class="navigation-header"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="page-title">事项</view>
</navigation-bar>
<view class="bg" style="height: {{navBarHeight}}px;"></view>
<view class="matters-page" style="padding-top: {{navBarHeight}}px;">
<view class="top-box">
<view class="search-box">
<view class="search-input">
<image src="/images/search.png" class="search-icon" />
<input
type="text"
placeholder="关键词"
class="input"
model:value="{{ keyword }}"
placeholder-class="input-placeholder"
bindinput="onKeywordInput"
bindconfirm="search"
/>
<view
wx:if="{{ keyword }}"
class="search-clear-wrap"
catchtap="clearKeyword"
>
<image src="/images/clear.png" class="search-clear" />
</view>
</view>
</view>
<view class="tab_box" wx:if="{{ tabList.length }}">
<tab-bar tabList="{{ tabList }}" bindclick="tabClick" activeIndex="{{ tabIndex }}" />
</view>
</view>
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{ true }}"
bindrefresherrefresh="onRefresh"
bindscrolltolower="onReachBottom"
class="list"
refresher-threshold="104"
refresher-triggered="{{ triggered }}"
>
<view class="list-content">
<block wx:if="{{ displayList.length > 0 }}">
<view class="empty-box"></view>
<block wx:for="{{ displayList }}" wx:key="id">
<view
class="item content"
bindtap="openMatterDetail"
data-item="{{ item }}"
>
<view class="item-top">
<view class="code">
<text>任务类型</text>
<text class="code-text">{{ item.taskTypeText }}</text>
</view>
<view
class="status text-center"
style="color:{{ item.statusStyle.color }};background-color:{{ item.statusStyle.background }};"
>
{{ item.statusName }}
</view>
</view>
<view class="order-list">
<view
class="order"
wx:for="{{ item.completed ? item.completedListFields : item.listFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="order-label">{{ field.label }}</view>
<view class="order-value {{ field.ellipsis ? 'order-value--ellipsis' : '' }}">{{ item[field.key] || '-' }}</view>
</view>
</view>
<view class="btn-box flex" wx:if="{{ item.showAction || item.showView }}">
<view></view>
<view
wx:if="{{ item.showAction }}"
class="btn primary"
catchtap="openMatterDetail"
data-item="{{ item }}"
>去处理</view>
<view
wx:if="{{ item.showView }}"
class="btn btn-view"
catchtap="openMatterDetail"
data-item="{{ item }}"
>查看</view>
</view>
</view>
</block>
<view class="list-nothing" wx:if="{{ nothing }}">到底了~</view>
</block>
<empty-data wx:else emptyText="暂无待办事项" />
</view>
</scroll-view>
</view>
<!-- <view class="teach-entry" bindtap="goTeachApply">
<image class="teach-entry__icon" src="/images/daijiao.png" mode="aspectFit" />
<text class="teach-entry__text">带教申请</text>
</view> -->
\ No newline at end of file \ No newline at end of file
...@@ -176,8 +176,7 @@ Page({ ...@@ -176,8 +176,7 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {},
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
......
// pages/tab/storeEffect/storeEffect.js — 店效(原首页 H5,web-view 页用 cover-tab-bar)
const { setCustomTabBar } = require('~/utils/setCustomTabBar')
Page({
data: {
webUrl: '',
userInfo: {},
},
onLoad() {
this.getUserInfo()
this.init()
},
getUserInfo() {
const userInfo = wx.$util.getUserInfo()
this.setData({ userInfo })
},
init() {
let index = 2
const accountInfo = wx.getAccountInfoSync()
const envName = accountInfo.miniProgram.envVersion
const manual = false
const release = false
switch (envName) {
case 'develop':
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
const webUrls = {
develop: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
trial: 'https://scrm.test.glsx.com.cn/glsx-bi-report/#/?phone=',
release: 'https://scrm.glsx.com.cn/glsx-bi-report/#/?phone=',
preRelease: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
}
const target = ['ip', 'develop', 'trial', 'release', 'preRelease']
const webUrl = webUrls[target[index]]
this.setData({ webUrl })
},
onShow() {
setCustomTabBar(this, 1)
this.getUserInfo()
},
})
{ {
"usingComponents": { "usingComponents": {
"add-staff":"./components/addStaff/index" "cover-tab-bar": "/components/cover-tab-bar/cover-tab-bar"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
page {
background: #f2f3f7;
}
<!-- web-view 全屏;底部 Tab 必须用 cover-view 才能显示在 H5 之上 -->
<web-view wx:if="{{webUrl}}" src="{{webUrl}}{{userInfo.phone}}"></web-view>
<cover-tab-bar selected="{{1}}" />
...@@ -47,9 +47,7 @@ Page({ ...@@ -47,9 +47,7 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {},
},
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height; let navBarHeight = e.detail.height;
......
/* 与 custom-tab-bar 高度一致,避免自定义 tabBar 遮挡页面内容 */
$tab-bar-height: 112rpx;
.tab-bar-placeholder {
height: calc(#{$tab-bar-height} + env(safe-area-inset-bottom));
height: calc(#{$tab-bar-height} + constant(safe-area-inset-bottom));
width: 100%;
flex-shrink: 0;
}
.tab-page-with-bar {
box-sizing: border-box;
}
...@@ -19,7 +19,6 @@ page { ...@@ -19,7 +19,6 @@ page {
} }
.container { .container {
padding-top: var(--fontSize1); padding-top: var(--fontSize1);
padding-bottom: var(--fontSize30);
overflow: auto; overflow: auto;
} }
.banner-box { .banner-box {
......
import api from '~/api/api'
import {
TEACH_LIST_FIELDS,
isStrategyApiSuccess,
parseTeachingApplicationPageData,
} from '~/utils/teachApplyItem'
const PAGE_SIZE = 10
Page({
data: {
navBarHeight: 0,
keyword: '',
tabList: ['待审批(0)', '全部(0)'],
tabIndex: 0,
listFields: TEACH_LIST_FIELDS,
displayList: [],
pageNum: 1,
pageSize: PAGE_SIZE,
total: 0,
hasMore: true,
loading: false,
triggered: false,
nothing: false,
},
navbarReady(e) {
this.setData({ navBarHeight: e.detail.height })
},
onBack() {
wx.navigateBack()
},
onShow() {
this.refreshAll()
},
getKeyword() {
return String(this.data.keyword ?? '').trim()
},
onKeywordInput(e) {
this.setData({ keyword: e.detail.value })
},
clearKeyword() {
this.setData({ keyword: '' }, () => this.refreshAll())
},
search(e) {
const keyword = String(e?.detail?.value ?? this.data.keyword ?? '').trim()
this.setData({ keyword }, () => this.refreshAll())
},
onRefresh() {
this.setData({ triggered: true })
this.refreshAll().finally(() => {
this.setData({ triggered: false })
})
},
tabClick(e) {
const tabIndex = e.detail
if (tabIndex === this.data.tabIndex) return
this.setData({ tabIndex }, () => this.reloadList())
},
onReachBottom() {
const { hasMore, loading } = this.data
if (!hasMore || loading) return
this.loadList(false)
},
buildQueryParams({ pageNum, pageSize, tab } = {}) {
const { tabIndex, pageSize: defaultPageSize } = this.data
const keyWord = this.getKeyword()
const params = {
pageNum: pageNum ?? 1,
pageSize: pageSize ?? defaultPageSize,
keyWord,
keyword: keyWord,
}
const tabVal = tab !== undefined ? tab : tabIndex === 0 ? 0 : undefined
if (tabVal === 0) params.tab = 0
return params
},
buildListParams(pageNum) {
return this.buildQueryParams({ pageNum })
},
buildCountParams(tab) {
return this.buildQueryParams({ pageNum: 1, pageSize: 1, tab })
},
updateTabListLabels(pending, all) {
this.setData({
tabList: [`待审批(${pending})`, `全部(${all})`],
})
},
async fetchTabCounts() {
try {
const [pendingRes, allRes] = await Promise.all([
api.getTeachingApplicationPage(this.buildCountParams(0)),
api.getTeachingApplicationPage(this.buildCountParams()),
])
const pickTotal = (res) => parseTeachingApplicationPageData(res).total
this.updateTabListLabels(pickTotal(pendingRes), pickTotal(allRes))
} catch (e) {
// 计数失败不影响列表
}
},
async refreshAll() {
await Promise.all([this.fetchTabCounts(), this.reloadList()])
},
async reloadList() {
this.setData({ pageNum: 1, hasMore: true, displayList: [] })
await this.loadList(true)
},
async loadList(reset = true) {
if (this.data.loading) return
const pageNum = reset ? 1 : this.data.pageNum
this.setData({ loading: true })
try {
const res = await api.getTeachingApplicationPage(
this.buildListParams(pageNum)
)
const { list, total } = parseTeachingApplicationPageData(res)
if (!list.length && !isStrategyApiSuccess(res)) {
wx.showToast({
title: res?.message || '加载失败',
icon: 'none',
})
this.setData({ loading: false, hasMore: false, nothing: true })
return
}
const displayList = reset ? list : [...this.data.displayList, ...list]
const hasMore = displayList.length < total
this.setData({
displayList,
total,
pageNum: pageNum + 1,
hasMore,
nothing: !hasMore,
loading: false,
})
} catch (e) {
wx.showToast({ title: '加载失败', icon: 'none' })
this.setData({
loading: false,
hasMore: false,
nothing: true,
})
}
},
openDetail(e) {
const { item } = e.currentTarget.dataset
const applicationId = item?.applicationId || item?.id
if (!applicationId) return
wx.navigateTo({
url: `/pages/teachApplyDetail/teachApplyDetail?id=${applicationId}`,
})
},
goAddTeach() {
wx.navigateTo({
url: '/pages/teachApplyCreate/teachApplyCreate',
events: {
refreshList: () => this.refreshAll(),
},
})
},
})
{
"navigationStyle": "custom",
"usingComponents": {
"tab-bar": "/components/TabBar/TabBar",
"empty-data": "/components/EmptyData/EmptyData"
}
}
page {
background: #f2f3f7;
height: 100vh;
overflow: hidden;
}
.bg {
width: 100%;
background: #ffffff;
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
.page-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.teach-page {
height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
}
.flex {
display: flex;
align-items: center;
}
.top-box {
flex-shrink: 0;
background: #ffffff;
padding: 16rpx 24rpx 0 24rpx;
box-sizing: border-box;
.search-input {
background: #f7f8fa;
border-radius: var(--fontSize72);
width: 100%;
height: var(--fontSize72);
display: flex;
align-items: center;
margin-bottom: 16rpx;
box-sizing: border-box;
.search-icon {
width: var(--fontSize28);
height: var(--fontSize28);
margin: 0 var(--fontSize10) 0 var(--fontSize26);
flex-shrink: 0;
}
.search-clear-wrap {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0 var(--fontSize26) 0 var(--fontSize10);
position: relative;
z-index: 2;
}
.search-clear {
width: var(--fontSize36);
height: var(--fontSize36);
display: block;
}
.input {
flex: 1;
min-width: 0;
font-size: var(--fontSize28);
height: var(--fontSize38);
line-height: var(--fontSize38);
}
.input-placeholder {
color: #bbbbbb;
}
}
}
.tab_box {
margin: 0 var(--fontSize32);
position: relative;
}
.list {
flex: 1;
height: 0;
box-sizing: border-box;
}
.list .empty-box {
width: 100%;
height: 24rpx;
}
.list .item {
margin: 0 24rpx 24rpx;
border-radius: 32rpx;
background: #ffffff;
padding: 24rpx 32rpx;
box-sizing: border-box;
}
.list .item-top {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 -24rpx;
padding: 0 24rpx 24rpx;
border-bottom: 2rpx dashed #f0f1f5;
}
.list .title {
flex: 1;
min-width: 0;
margin-right: 16rpx;
font-size: 30rpx;
font-weight: 600;
color: #222222;
}
.list .status {
height: 48rpx;
line-height: 48rpx;
border-radius: 8rpx;
padding: 0 12rpx;
font-size: 24rpx;
flex-shrink: 0;
}
.list .order-list {
padding: 24rpx 0;
}
.list .order {
margin-bottom: 12rpx;
font-size: 26rpx;
color: #222222;
align-items: flex-start;
}
.list .order:last-child {
margin-bottom: 0;
}
.list .order-label {
width: 184rpx;
margin-right: 32rpx;
color: #999999;
flex-shrink: 0;
}
.list .order-value {
flex: 1;
word-break: break-all;
}
.list .order-value--ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
}
.list .btn-box {
justify-content: space-between;
font-weight: 500;
}
.list .btn-view {
font-weight: 400;
width: 168rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
border-radius: 16rpx;
font-size: 26rpx;
color: #2c66f7;
background: #eef3ff;
}
.list-nothing {
padding: 0 0 50rpx;
text-align: center;
font-size: 24rpx;
color: #999999;
}
.teach-entry {
position: fixed;
right: 8px;
bottom: 121px;
z-index: 100;
width: 68px;
height: 66px;
box-sizing: border-box;
border-radius: 12px;
border: 2px solid #ffffff;
background: linear-gradient(180deg, #f7f8fa 0%, #ffffff 100%);
box-shadow: 0 4px 16px 0 rgba(61, 78, 102, 0.2);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.teach-entry__icon {
width: 36px;
height: 36px;
flex-shrink: 0;
}
.teach-entry__text {
margin-top: 2px;
font-size: 10px;
line-height: 14px;
color: #2c66f7;
font-weight: 500;
}
<navigation-bar
bindnavbarReady="navbarReady"
class="navigation-header"
showBack="{{ true }}"
bindback="onBack"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="page-title">带教申请</view>
</navigation-bar>
<view class="bg" style="height: {{ navBarHeight }}px;"></view>
<view class="teach-page" style="padding-top: {{ navBarHeight }}px;">
<view class="top-box">
<view class="search-box">
<view class="search-input">
<image src="/images/search.png" class="search-icon" />
<input
type="text"
placeholder="关键词"
class="input"
model:value="{{ keyword }}"
placeholder-class="input-placeholder"
bindinput="onKeywordInput"
bindconfirm="search"
/>
<view
wx:if="{{ keyword }}"
class="search-clear-wrap"
catchtap="clearKeyword"
>
<image src="/images/clear.png" class="search-clear" />
</view>
</view>
</view>
<view class="tab_box" wx:if="{{ tabList.length }}">
<tab-bar tabList="{{ tabList }}" bindclick="tabClick" activeIndex="{{ tabIndex }}" />
</view>
</view>
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{ true }}"
bindrefresherrefresh="onRefresh"
bindscrolltolower="onReachBottom"
class="list"
refresher-threshold="104"
refresher-triggered="{{ triggered }}"
>
<view class="list-content">
<block wx:if="{{ displayList.length > 0 }}">
<view class="empty-box"></view>
<block wx:for="{{ displayList }}" wx:key="applicationId">
<view class="item content" bindtap="openDetail" data-item="{{ item }}">
<view class="item-top">
<view class="title text-hide">{{ item.title }}</view>
<view
class="status text-center"
style="color:{{ item.statusStyle.color }};background-color:{{ item.statusStyle.background }};"
>
{{ item.statusName }}
</view>
</view>
<view class="order-list">
<view
class="order flex"
wx:for="{{ listFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="order-label">{{ field.label }}</view>
<view class="order-value {{ field.ellipsis ? 'order-value--ellipsis' : '' }}">
{{ item[field.key] || '-' }}
</view>
</view>
</view>
<view class="btn-box flex">
<view></view>
<view class="btn btn-view" catchtap="openDetail" data-item="{{ item }}">查看</view>
</view>
</view>
</block>
<view class="list-nothing" wx:if="{{ nothing }}">到底了~</view>
</block>
<empty-data wx:else emptyText="暂无带教申请" />
</view>
</scroll-view>
</view>
<view class="teach-entry" bindtap="goAddTeach">
<image class="teach-entry__icon" src="/images/adddaijiao.png" mode="aspectFit" />
<text class="teach-entry__text">新增带教</text>
</view>
import api from '~/api/api'
import {
formatDirectorNames,
isStrategyApiSuccess,
parseStrategyShopMerchantList,
parseStrategyShopMerchantStaffList,
parseStrategyShopMerchantSupervisorList,
} from '~/utils/teachApplyItem'
const BUSINESS_OPTIONS = [
{ businessType: 1, businessName: '延保' },
{ businessType: 2, businessName: '轻改' },
{ businessType: 3, businessName: '权益' },
]
const DESCRIPTION_MAX_LENGTH = 200
Page({
data: {
navBarHeight: 0,
merchantId: '',
merchantName: '',
businessType: '',
businessName: '',
staffList: [],
staffNames: '',
supervisorName: '',
supervisorDisplayText: '选择门店和业务后自动填充',
supervisorLoading: false,
description: '',
descriptionMaxLength: DESCRIPTION_MAX_LENGTH,
submitting: false,
merchantPopupShow: false,
merchantKeyword: '',
merchantList: [],
merchantIndex: null,
merchantLoading: false,
staffPopupShow: false,
staffOptions: [],
staffLoading: false,
},
navbarReady(e) {
this.setData({ navBarHeight: e.detail.height })
},
onBack() {
wx.navigateBack()
},
pickMerchant() {
this.setData(
{
merchantPopupShow: true,
merchantKeyword: '',
merchantIndex: null,
},
() => this.loadMerchantList()
)
},
onMerchantKeywordInput(e) {
this.setData({ merchantKeyword: e.detail.value || '' })
},
clearMerchantKeyword() {
this.setData({ merchantKeyword: '' }, () => this.loadMerchantList())
},
searchMerchant() {
this.loadMerchantList()
},
async loadMerchantList() {
this.setData({ merchantLoading: true, merchantList: [], merchantIndex: null })
try {
const kw = (this.data.merchantKeyword || '').trim()
const params = {}
if (kw) params.keyword = kw
const res = await api.getStrategyShopMerchantList(params)
const merchantList = parseStrategyShopMerchantList(res)
if (!merchantList.length && !isStrategyApiSuccess(res)) {
wx.showToast({ title: res?.message || '加载失败', icon: 'none' })
this.setData({ merchantList: [], merchantIndex: null })
return
}
const { merchantId } = this.data
let merchantIndex = null
if (merchantId) {
merchantIndex = merchantList.findIndex(
(item) => String(item.merchantId) === String(merchantId)
)
if (merchantIndex < 0) merchantIndex = null
}
this.setData({ merchantList, merchantIndex })
} catch (e) {
console.error('loadMerchantList', e)
wx.showToast({ title: '网络异常', icon: 'none' })
} finally {
this.setData({ merchantLoading: false })
}
},
chooseMerchant(e) {
const { index } = e.currentTarget.dataset
this.setData({ merchantIndex: index })
},
cancelMerchantPopup() {
this.setData({ merchantPopupShow: false })
},
async confirmMerchantPopup() {
const { merchantList, merchantIndex } = this.data
if (merchantIndex == null || !merchantList[merchantIndex]) {
wx.showToast({ title: '请选择归属门店', icon: 'none' })
return
}
const { merchantId, merchantName } = merchantList[merchantIndex]
this.setData({
merchantPopupShow: false,
merchantId,
merchantName,
staffList: [],
staffNames: '',
supervisorName: '',
supervisorDisplayText: '选择门店和业务后自动填充',
})
this.tryLoadSupervisorDisplay()
},
tryLoadSupervisorDisplay() {
const { merchantId, businessType } = this.data
if (merchantId === '' || merchantId == null) return
if (businessType === '' || businessType == null || businessType === undefined) {
return
}
this.loadSupervisorDisplay()
},
async loadSupervisorDisplay() {
const { merchantId, businessType } = this.data
this.setData({
supervisorLoading: true,
supervisorName: '',
supervisorDisplayText: '加载中...',
})
try {
const res = await api.getStrategyShopMerchantSupervisor({
merchantId,
businessType: Number(businessType),
})
const list = parseStrategyShopMerchantSupervisorList(res)
const supervisorName = formatDirectorNames(list)
this.setData({
supervisorName,
supervisorDisplayText: supervisorName || '暂无督导',
supervisorLoading: false,
})
if (!supervisorName && !isStrategyApiSuccess(res)) {
wx.showToast({ title: res?.message || '获取督导失败', icon: 'none' })
}
} catch (e) {
console.error('loadSupervisorDisplay', e)
wx.showToast({ title: '网络异常', icon: 'none' })
this.setData({
supervisorName: '',
supervisorDisplayText: '获取失败',
supervisorLoading: false,
})
}
},
pickBusiness() {
wx.showActionSheet({
itemList: BUSINESS_OPTIONS.map((o) => o.businessName),
success: (res) => {
const item = BUSINESS_OPTIONS[res.tapIndex]
if (!item) return
this.setData(
{
businessType: item.businessType,
businessName: item.businessName,
supervisorName: '',
supervisorDisplayText: '选择门店和业务后自动填充',
},
() => this.tryLoadSupervisorDisplay()
)
},
})
},
pickStaff() {
const { merchantId } = this.data
if (!merchantId && merchantId !== 0) {
wx.showToast({ title: '请先选择归属门店', icon: 'none' })
return
}
this.setData({ staffPopupShow: false }, () => {
this.setData({ staffPopupShow: true }, () => this.loadStaffList())
})
},
async loadStaffList() {
const { merchantId, staffList } = this.data
this.setData({ staffLoading: true, staffOptions: [] })
try {
const res = await api.getStrategyShopMerchantStaffList({ merchantId })
const selectedPhones = new Set(
(staffList || []).map((s) => String(s.userPhone))
)
const staffOptions = parseStrategyShopMerchantStaffList(res).map((item) => ({
...item,
checked: item.userPhone
? selectedPhones.has(String(item.userPhone))
: false,
}))
if (!staffOptions.length && !isStrategyApiSuccess(res)) {
wx.showToast({ title: res?.message || '加载人员失败', icon: 'none' })
}
this.setData({ staffOptions })
} catch (e) {
wx.showToast({ title: '加载人员失败', icon: 'none' })
} finally {
this.setData({ staffLoading: false })
}
},
toggleStaff(e) {
const { index } = e.currentTarget.dataset
const staffOptions = [...(this.data.staffOptions || [])]
if (!staffOptions[index]) return
staffOptions[index] = {
...staffOptions[index],
checked: !staffOptions[index].checked,
}
this.setData({ staffOptions })
},
cancelStaffPopup() {
this.setData({ staffPopupShow: false })
},
confirmStaffPopup() {
const staffList = (this.data.staffOptions || []).filter((item) => item.checked)
if (!staffList.length) {
wx.showToast({ title: '请选择需带教驻店人员', icon: 'none' })
return
}
this.setData({
staffPopupShow: false,
staffList: staffList.map(({ userPhone, userName }) => ({
userPhone,
userName,
})),
staffNames: staffList.map((s) => s.userName).join(','),
})
},
onDescInput(e) {
this.setData({ description: e.detail.value || '' })
},
async submit() {
const {
merchantId,
merchantName,
businessType,
staffList,
description,
supervisorName,
supervisorLoading,
submitting,
} = this.data
if (submitting) return
if (!merchantId && merchantId !== 0) {
wx.showToast({ title: '请选择归属门店', icon: 'none' })
return
}
if (!businessType && businessType !== 0) {
wx.showToast({ title: '请选择归属业务', icon: 'none' })
return
}
if (!staffList?.length) {
wx.showToast({ title: '请选择员工', icon: 'none' })
return
}
if (supervisorLoading) {
wx.showToast({ title: '督导信息加载中', icon: 'none' })
return
}
if (!supervisorName) {
wx.showToast({ title: '暂无归属区域督导', icon: 'none' })
return
}
const content = (description || '').trim()
if (!content) {
wx.showToast({ title: '请填写申请描述', icon: 'none' })
return
}
if (content.length > DESCRIPTION_MAX_LENGTH) {
wx.showToast({ title: `申请描述不能超过${DESCRIPTION_MAX_LENGTH}字`, icon: 'none' })
return
}
const invalidStaff = staffList.some(
(s) => !(s.userName || '').trim() || !(s.userPhone || '').trim()
)
if (invalidStaff) {
wx.showToast({ title: '驻店人员信息不完整', icon: 'none' })
return
}
this.setData({ submitting: true })
wx.showLoading({ title: '提交中', mask: true })
try {
const res = await api.submitTeachingApplication({
merchantId: Number(merchantId),
merchantName,
businessType: Number(businessType),
staffListJson: JSON.stringify(
staffList.map((s) => ({
userPhone: String(s.userPhone).trim(),
userName: String(s.userName).trim(),
}))
),
description: content,
})
if (res?.code !== '0' && res?.code !== 0) {
wx.showToast({
title: res?.message || '提交失败',
icon: 'none',
})
return
}
wx.showToast({ title: '提交成功', icon: 'success' })
this.notifyRefresh()
setTimeout(() => wx.navigateBack(), 1000)
} catch (e) {
wx.showToast({ title: '提交失败', icon: 'none' })
} finally {
wx.hideLoading()
this.setData({ submitting: false })
}
},
notifyRefresh() {
const eventChannel = this.getOpenerEventChannel()
eventChannel?.emit?.('refreshList')
},
})
{
"navigationStyle": "custom",
"usingComponents": {
"navigation-bar": "/components/navigationBar/navigationBar",
"gl-textarea": "/components/GlTextarea/GlTextarea"
}
}
page {
background: #f2f3f7;
height: 100vh;
overflow: hidden;
}
.nav-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.create-page {
height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
}
.create-scroll {
flex: 1;
height: 0;
box-sizing: border-box;
}
.form-card {
margin: 24rpx 24rpx 0;
background: #ffffff;
border-radius: 32rpx;
box-sizing: border-box;
overflow: hidden;
}
.form-row {
display: flex;
align-items: center;
padding: 24rpx 32rpx;
box-sizing: border-box;
}
.form-row + .form-row {
border-top: 2rpx solid #f0f1f5;
}
.label {
width: 240rpx;
flex-shrink: 0;
font-size: 28rpx;
color: #666666;
}
.req {
color: #f24724;
margin-right: 6rpx;
}
.value {
flex: 1;
min-width: 0;
font-size: 28rpx;
color: #222222;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.placeholder {
color: #bbbbbb;
}
.arrow {
margin-left: 12rpx;
font-size: 32rpx;
color: #cccccc;
flex-shrink: 0;
}
.form-row.disabled {
padding-right: 32rpx;
}
.form-row.disabled .arrow {
display: none;
}
.textarea-block {
padding: 24rpx 32rpx 32rpx;
box-sizing: border-box;
border-top: 2rpx solid #f0f1f5;
}
.textarea-title {
font-size: 28rpx;
font-weight: 600;
color: #222222;
margin-bottom: 16rpx;
}
.textarea-wrap {
height: 420rpx;
padding: 24rpx;
background: #ffffff;
border-radius: 24rpx;
box-sizing: border-box;
border: 2rpx solid #ececec;
}
.textarea-wrap gl-textarea {
display: block;
height: 100%;
}
.textarea-wrap .textarea-box {
height: 100%;
min-height: 0;
}
.textarea-wrap ._textarea_ {
width: 100%;
}
.bottom-safe {
height: calc(120rpx + env(safe-area-inset-bottom));
height: calc(120rpx + constant(safe-area-inset-bottom));
}
.footer-bar {
flex-shrink: 0;
padding: 16rpx 24rpx;
background: #ffffff;
box-sizing: border-box;
box-shadow: 0 -2rpx 16rpx rgba(0, 0, 0, 0.04);
}
.submit-btn {
height: 88rpx;
line-height: 88rpx;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-weight: 500;
color: #ffffff;
background: #2c66f7;
}
.picker-search {
display: flex;
align-items: center;
height: 72rpx;
margin-bottom: 16rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 36rpx;
box-sizing: border-box;
}
.picker-search__icon {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
.picker-search__input {
flex: 1;
min-width: 0;
height: 72rpx;
margin: 0 16rpx;
font-size: 28rpx;
}
.picker-search__clear {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
.picker-list {
height: calc(100% - 88rpx);
box-sizing: border-box;
}
.picker-list--staff {
height: 100%;
}
.picker-tip {
padding: 48rpx 0;
text-align: center;
font-size: 28rpx;
color: #979797;
}
.picker-item {
display: flex;
align-items: center;
min-height: 88rpx;
padding: 16rpx 0;
border-bottom: 2rpx solid #eff0f2;
box-sizing: border-box;
}
.picker-item.active {
color: #2c66f7;
}
.picker-item__main {
flex: 1;
min-width: 0;
}
.picker-item__name {
font-size: 28rpx;
line-height: 40rpx;
}
.picker-item__sub {
margin-top: 4rpx;
font-size: 24rpx;
color: #979797;
}
.picker-item.active .picker-item__sub {
color: #2c66f7;
}
.picker-item__mark {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 32rpx;
color: #2c66f7;
}
<navigation-bar
showBack="{{ true }}"
bindback="onBack"
bindnavbarReady="navbarReady"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="nav-title">带教申请</view>
</navigation-bar>
<view class="create-page" style="padding-top: {{ navBarHeight }}px;">
<scroll-view scroll-y class="create-scroll">
<view class="form-card">
<view class="form-row" bindtap="pickMerchant">
<view class="label"><text class="req">*</text>归属门店</view>
<view class="value {{ merchantName ? '' : 'placeholder' }}">
{{ merchantName || '点击选择' }}
</view>
<view class="arrow">›</view>
</view>
<view class="form-row" bindtap="pickBusiness">
<view class="label"><text class="req">*</text>归属业务</view>
<view class="value {{ businessName ? '' : 'placeholder' }}">
{{ businessName || '点击选择' }}
</view>
<view class="arrow">›</view>
</view>
<view class="form-row" bindtap="pickStaff">
<view class="label"><text class="req">*</text>需带教驻店人员</view>
<view class="value {{ staffNames ? '' : 'placeholder' }}">
{{ staffNames || '点击选择' }}
</view>
<view class="arrow">›</view>
</view>
<view class="form-row disabled">
<view class="label"><text class="req">*</text>归属区域督导</view>
<view class="value {{ supervisorName ? '' : 'placeholder' }}">
{{ supervisorDisplayText }}
</view>
</view>
<view class="textarea-block">
<view class="textarea-title"><text class="req">*</text>申请描述</view>
<view class="textarea-wrap">
<gl-textarea
bindinput="onDescInput"
maxlength="{{ descriptionMaxLength }}"
showWordLimit
value="{{ description }}"
placeholder="请简单描述申请信息"
placeholderColor="#bbbbbb"
color="#222222"
textStyle="font-size:28rpx;line-height:40rpx;"
/>
</view>
</view>
</view>
<view class="bottom-safe"></view>
</scroll-view>
<view class="footer-bar isFullSucreen">
<view class="submit-btn" bindtap="submit">提交</view>
</view>
</view>
<popup
title="选择门店"
show="{{ merchantPopupShow }}"
height="85%"
bindconfirm="confirmMerchantPopup"
bindcancel="cancelMerchantPopup"
>
<view class="picker-search">
<image src="/images/search.png" class="picker-search__icon" />
<input
type="text"
placeholder="门店名称/编号"
class="picker-search__input"
value="{{ merchantKeyword }}"
placeholder-class="input-placeholder"
bindinput="onMerchantKeywordInput"
bindconfirm="searchMerchant"
/>
<block wx:if="{{ merchantKeyword }}">
<image
src="/images/clear.png"
class="picker-search__clear"
bindtap="clearMerchantKeyword"
/>
</block>
</view>
<scroll-view scroll-y class="picker-list" enhanced show-scrollbar="{{ false }}">
<block wx:if="{{ merchantLoading }}">
<view class="picker-tip">加载中...</view>
</block>
<block wx:elif="{{ merchantList.length }}">
<view
class="picker-item {{ merchantIndex === index ? 'active' : '' }}"
wx:for="{{ merchantList }}"
wx:key="merchantId"
bindtap="chooseMerchant"
data-index="{{ index }}"
>
<view class="picker-item__main">
<view class="picker-item__name text-hide">{{ item.merchantName }}</view>
<view class="picker-item__sub">{{ item.merchantId }}</view>
</view>
<view class="picker-item__mark" wx:if="{{ merchantIndex === index }}">✓</view>
</view>
</block>
<empty-data wx:else emptyText="暂无门店" />
</scroll-view>
</popup>
<popup
title="选择员工"
show="{{ staffPopupShow }}"
height="70%"
bindconfirm="confirmStaffPopup"
bindcancel="cancelStaffPopup"
>
<scroll-view scroll-y class="picker-list picker-list--staff" enhanced show-scrollbar="{{ false }}">
<block wx:if="{{ staffLoading }}">
<view class="picker-tip">加载中...</view>
</block>
<block wx:elif="{{ staffOptions.length }}">
<view
class="picker-item {{ item.checked ? 'active' : '' }}"
wx:for="{{ staffOptions }}"
wx:key="index"
catchtap="toggleStaff"
data-index="{{ index }}"
>
<view class="picker-item__main">
<view class="picker-item__name">{{ item.userName }}</view>
<view class="picker-item__sub">{{ item.userPhone }}</view>
</view>
<view class="picker-item__mark" wx:if="{{ item.checked }}">✓</view>
</view>
</block>
<empty-data wx:else emptyText="暂无驻店人员" />
</scroll-view>
</popup>
import api from '~/api/api'
import {
TEACH_APPROVE_FIELDS,
TEACH_DETAIL_FIELDS,
TEACH_REJECT_FIELDS,
normalizeTeachApplyItem,
} from '~/utils/teachApplyItem'
Page({
data: {
navBarHeight: 0,
detail: null,
detailFields: TEACH_DETAIL_FIELDS,
approveFields: TEACH_APPROVE_FIELDS,
rejectFields: TEACH_REJECT_FIELDS,
showApprove: false,
showReject: false,
loading: true,
},
onLoad(options) {
const applicationId = options?.id || options?.applicationId
if (!applicationId) {
wx.showToast({ title: '缺少申请单信息', icon: 'none' })
setTimeout(() => wx.navigateBack(), 1500)
return
}
this.applicationId = applicationId
this.loadDetail()
},
async loadDetail() {
this.setData({ loading: true })
wx.showLoading({ title: '加载中', mask: true })
try {
const res = await api.getTeachingApplicationDetail({
applicationId: this.applicationId,
})
if (res?.code !== '0' && res?.code !== 0) {
wx.showToast({
title: res?.message || '加载失败',
icon: 'none',
})
setTimeout(() => wx.navigateBack(), 1500)
return
}
const detail = normalizeTeachApplyItem(res.data || {}, 0)
this.setData({
detail,
showApprove: detail.showApprove,
showReject: detail.showReject,
loading: false,
})
} catch (e) {
wx.showToast({ title: '加载失败', icon: 'none' })
setTimeout(() => wx.navigateBack(), 1500)
} finally {
wx.hideLoading()
this.setData({ loading: false })
}
},
navbarReady(e) {
this.setData({ navBarHeight: e.detail.height })
},
onBack() {
wx.navigateBack()
},
})
{
"navigationStyle": "custom",
"usingComponents": {
"navigation-bar": "/components/navigationBar/navigationBar"
}
}
page {
background: #f2f3f7;
height: 100vh;
overflow: hidden;
}
.nav-title {
font-size: var(--fontSize34);
color: #222222;
font-weight: 600;
}
.detail-page {
height: 100vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
}
.detail-scroll {
flex: 1;
height: 0;
box-sizing: border-box;
}
.flex {
display: flex;
align-items: flex-start;
}
.card {
margin: 24rpx 24rpx 0;
padding: 24rpx 32rpx;
background: #ffffff;
border-radius: 32rpx;
box-sizing: border-box;
}
.head-row {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 24rpx;
border-bottom: 2rpx dashed #f0f1f5;
}
.head-title {
flex: 1;
min-width: 0;
margin-right: 16rpx;
font-size: 30rpx;
font-weight: 600;
color: #222222;
}
.status {
height: 48rpx;
line-height: 48rpx;
border-radius: 8rpx;
padding: 0 12rpx;
font-size: 24rpx;
flex-shrink: 0;
}
.card-title {
font-size: 28rpx;
font-weight: 600;
color: #222222;
margin-bottom: 16rpx;
}
.info-list {
padding-top: 24rpx;
}
.head-card .info-list {
padding-top: 24rpx;
}
.info-row {
margin-bottom: 12rpx;
font-size: 26rpx;
}
.info-row:last-child {
margin-bottom: 0;
}
.info-label {
width: 184rpx;
margin-right: 32rpx;
color: #999999;
flex-shrink: 0;
line-height: 40rpx;
}
.info-value {
flex: 1;
color: #222222;
line-height: 40rpx;
word-break: break-all;
}
.info-value--multiline {
white-space: normal;
}
.btn-box {
justify-content: space-between;
padding-top: 24rpx;
}
.btn-view {
font-weight: 400;
width: 168rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
border-radius: 16rpx;
font-size: 26rpx;
color: #2c66f7;
background: #eef3ff;
}
<navigation-bar
showBack="{{ true }}"
bindback="onBack"
bindnavbarReady="navbarReady"
navStyle="background-color:#ffffff;box-shadow:none;"
>
<view class="nav-title">带教申请</view>
</navigation-bar>
<view class="detail-page" style="padding-top: {{ navBarHeight }}px;">
<scroll-view scroll-y class="detail-scroll">
<view class="card head-card" wx:if="{{ detail }}">
<view class="head-row">
<view class="head-title text-hide">{{ detail.merchantName }}</view>
<view
class="status text-center"
style="color:{{ detail.statusStyle.color }};background-color:{{ detail.statusStyle.background }};"
>
{{ detail.statusName }}
</view>
</view>
<view class="info-list">
<view
class="info-row flex"
wx:for="{{ detailFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="info-label">{{ field.label }}</view>
<view class="info-value {{ field.multiline ? 'info-value--multiline' : '' }}">
{{ detail[field.key] || '-' }}
</view>
</view>
</view>
</view>
<view class="card" wx:if="{{ showApprove }}">
<view class="card-title">通过信息</view>
<view class="info-list">
<view
class="info-row flex"
wx:for="{{ approveFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="info-label">{{ field.label }}</view>
<view class="info-value">{{ detail[field.key] || '-' }}</view>
</view>
</view>
</view>
<view class="card" wx:if="{{ showReject }}">
<view class="card-title">驳回信息</view>
<view class="info-list">
<view
class="info-row flex"
wx:for="{{ rejectFields }}"
wx:key="key"
wx:for-item="field"
>
<view class="info-label">{{ field.label }}</view>
<view class="info-value {{ field.multiline ? 'info-value--multiline' : '' }}">
{{ detail[field.key] || '-' }}
</view>
</view>
</view>
</view>
</scroll-view>
</view>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"packNpmRelationList": [ "packNpmRelationList": [
{ {
"packageJsonPath": "./package.json", "packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./miniprogram_npm" "miniprogramNpmDistDir": "./"
} }
], ],
"compileHotReLoad": true, "compileHotReLoad": true,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"projectname": "regional-assistant", "projectname": "regional-assistant",
"setting": { "setting": {
"compileHotReLoad": true, "compileHotReLoad": true,
"urlCheck": true, "urlCheck": false,
"coverView": true, "coverView": true,
"lazyloadPlaceholderEnable": false, "lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false, "skylineRenderEnable": false,
......
...@@ -266,7 +266,8 @@ export const checkScene = options => { ...@@ -266,7 +266,8 @@ export const checkScene = options => {
'recruitDetail': 'packageEquity/pages/recruitManage/recruitDetail/recruitDetail', 'recruitDetail': 'packageEquity/pages/recruitManage/recruitDetail/recruitDetail',
'performanceRate': 'packageWorkspace/pages/performanceRating/rateList/retaList', 'performanceRate': 'packageWorkspace/pages/performanceRating/rateList/retaList',
'validReferralCount': 'packageWorkspace/pages/validReferralCount/referralCountList/referralCountList', 'validReferralCount': 'packageWorkspace/pages/validReferralCount/referralCountList/referralCountList',
'orderApprovalDetail': '/packageWorkspace/pages/orderApprovalManage/orderApprovalDetail/orderApprovalDetail' 'orderApprovalDetail': '/packageWorkspace/pages/orderApprovalManage/orderApprovalDetail/orderApprovalDetail',
'mattersHandle':'pages/mattersHandle/mattersHandle'
} }
options.path = pagePath[query.page] options.path = pagePath[query.page]
} }
......
/** TaskInfoDTO.status:0-待完成,1-已完成 */
export const MATTER_STATUS_MAP = {
0: { name: '待完成', color: '#FF9D0A', background: '#ff9d0a1a' },
1: { name: '已完成', color: '#35C376', background: '#35C3761a' },
}
/** 人员更换评估:列表/详情展示问题驻店销售 */
export const STAFF_REPLACE_ACCESS_TYPE = 'staff-replace-access'
/** taskType 枚举(接口文档) */
export const TASK_TYPE_NAME_MAP = {
[STAFF_REPLACE_ACCESS_TYPE]: '人员更换评估',
'policy-update-access': '商务政策更新评估',
'scene-expand': '多品类扩张',
'traffic-optimize': '流量问题改善',
}
/** businessType:1-延保 2-轻改 3-权益 */
export const BUSINESS_TYPE_NAME_MAP = {
1: '延保',
2: '轻改',
3: '权益',
}
function formatDateTime(val) {
if (!val) return '-'
return String(val).replace('T', ' ').replace(/\.\d+Z?$/, '').slice(0, 19)
}
/** TaskStaffRelDTO[] → 问题驻店人员展示文案 */
export function formatStaffList(staffList) {
if (!Array.isArray(staffList) || !staffList.length) return ''
return staffList
.map((s) => s.staffName)
.filter(Boolean)
.join('/')
}
function resolveBusinessTypeName(item) {
if (item.businessTypeName) return item.businessTypeName
const key = item.businessType
if (key == null || key === '') return '-'
return BUSINESS_TYPE_NAME_MAP[key] || String(key)
}
function resolveTaskTypeName(item) {
if (item.taskTypeName) return item.taskTypeName
if (item.taskType && TASK_TYPE_NAME_MAP[item.taskType]) {
return TASK_TYPE_NAME_MAP[item.taskType]
}
return item.taskType || '-'
}
export const MATTER_DETAIL_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '创建人', key: 'creatorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '任务描述', key: 'descriptionText', multiline: true },
]
export const MATTER_LIST_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '创建人', key: 'creatorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '任务描述', key: 'descriptionText', ellipsis: true },
]
export const MATTER_LIST_COMPLETED_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '创建人', key: 'creatorName' },
{ label: '任务描述', key: 'descriptionText', ellipsis: true },
{ label: '专项任务回复', key: 'replyText', ellipsis: true },
]
const STAFF_NAMES_LIST_FIELD = { label: '问题驻店销售', key: 'staffNames' }
/** 列表展示字段:仅 staff-replace-access 含问题驻店销售 */
export function getMatterListFields(taskType, completed = false) {
const base = completed ? MATTER_LIST_COMPLETED_FIELDS : MATTER_LIST_FIELDS
const fields = base.map((f) => ({ ...f }))
if (taskType !== STAFF_REPLACE_ACCESS_TYPE) return fields
fields.splice(2, 0, {
...STAFF_NAMES_LIST_FIELD,
ellipsis: !completed,
})
return fields
}
/** 详情展示字段:仅 staff-replace-access 含问题驻店销售 */
export function getMatterDetailFields(taskType) {
const fields = MATTER_DETAIL_FIELDS.map((f) => ({ ...f }))
if (taskType !== STAFF_REPLACE_ACCESS_TYPE) return fields
fields.splice(2, 0, { ...STAFF_NAMES_LIST_FIELD })
return fields
}
/**
* 归一化 TaskInfoDTO(列表项 / 分页 condition 同结构)
* @param {object} dto TaskInfoDTO
*/
export function normalizeMatterItem(dto = {}, index = 0) {
const statusKey = dto.status ?? 0
const completed = statusKey === 1 || statusKey === '1'
const statusStyle = completed ? MATTER_STATUS_MAP[1] : MATTER_STATUS_MAP[0]
const staffList = Array.isArray(dto.staffList) ? dto.staffList : []
const staffNames = formatStaffList(staffList)
return {
...dto,
id: dto.id ?? dto.taskCenterId ?? `matter-${index}`,
taskCenterId: dto.taskCenterId,
taskType: dto.taskType,
taskTypeText: resolveTaskTypeName(dto),
merchantName: dto.storeName || '-',
storeId: dto.storeId,
businessType: dto.businessType,
businessName: resolveBusinessTypeName(dto),
/** 问题驻店人员:仅来自 staffList */
staffList,
sellerName: staffNames || '-',
staffNames,
creatorName: dto.creator || '-',
creatorPhone: dto.creatorPhone || '',
createTimeText: formatDateTime(dto.createdDate),
descriptionText: dto.taskDescription || '-',
replyText: dto.replyContent || '',
replyTimeText: formatDateTime(dto.replyTime),
/** 指派的区域运营 */
assignedToId: dto.assignedToId,
assignedToName: dto.assignedToName || '-',
status: statusKey,
statusName: completed ? '已完成' : '待完成',
statusStyle,
completed,
showAction: !completed,
showView: completed,
listFields: getMatterListFields(dto.taskType, false),
completedListFields: getMatterListFields(dto.taskType, true),
}
}
function pickCount(data, keys) {
for (const key of keys) {
if (data[key] != null && data[key] !== '') return Number(data[key]) || 0
}
return null
}
/** 解析 count.stat 返回:待完成 / 已完成 / 全部 */
export function parseTaskCenterCountStat(data = {}) {
const pending = pickCount(data, [
'pendingCount',
'pendingTotal',
'waitCount',
'waitTotal',
'unfinishedCount',
'unCompleteCount',
'status0Count',
'toDoCount',
'pending',
'wait',
])
const done = pickCount(data, [
'completedCount',
'completedTotal',
'completeCount',
'finishCount',
'finishTotal',
'finishedCount',
'status1Count',
'doneCount',
'completed',
'finish',
'done',
])
const all = pickCount(data, [
'totalCount',
'allCount',
'allTotal',
'total',
'all',
])
const pendingNum = pending ?? 0
const doneNum = done ?? 0
const allNum = all ?? pendingNum + doneNum
return { pending: pendingNum, done: doneNum, all: allNum }
}
/** 解析分页接口 data:list 为列表,condition 为查询条件回显(TaskInfoDTO) */
export function parseTaskCenterPageData(data = {}) {
const list = (data.list || []).map((item, index) =>
normalizeMatterItem(item, index)
)
const condition = data.condition
? normalizeMatterItem(data.condition, -1)
: null
return {
list,
condition,
total: data.total ?? 0,
pageNum: data.pageNum,
pageSize: data.pageSize,
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!