Commit 3061a629 by 前端

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

上线合并

See merge request !25
2 parents 5daebc54 945f25d4
Showing 93 changed files with 3874 additions and 515 deletions
......@@ -285,6 +285,96 @@ module.exports = {
getStaffRemindList(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) {
return api.post('dj.api.smartcarlife.staff.reminder.shutdown', data)
......@@ -427,5 +517,14 @@ module.exports = {
// 获取异常订单待审核数量
getOrderWaitForAudit(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 @@
"pages/webView/webView",
"pages/tab/index/index",
"pages/tab/workspace/workspace",
"pages/tab/matters/matters",
"pages/tab/study/study",
"pages/tab/mine/mine",
"pages/log/log",
"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": {
"backgroundTextStyle": "light",
......@@ -29,16 +35,22 @@
"position": "bottom",
"list": [
{
"pagePath": "pages/tab/workspace/workspace",
"text": "工作台",
"iconPath": "images/tab-workspace.png",
"selectedIconPath": "images/tab-workspace-active.png"
},
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"text": "店效",
"iconPath": "images/tab-home.png",
"selectedIconPath": "images/tab-home-active.png"
},
{
"pagePath": "pages/tab/workspace/workspace",
"text": "工作台",
"iconPath": "images/tab-workspace.png",
"selectedIconPath": "images/tab-workspace-active.png"
"pagePath": "pages/tab/matters/matters",
"text": "事项",
"iconPath": "images/tab-shixiang.png",
"selectedIconPath": "images/tab-shixiang-active.png"
},
{
"pagePath": "pages/tab/study/study",
......@@ -88,8 +100,7 @@
"pages/performanceRating/batchOperation/batchOperation",
"pages/validReferralCount/referraCountEdit/referraCountEdit",
"pages/attendanceStatis/attendanceDetail/attendanceDetail",
"pages/appealFormManage/appealFormDetail/appealFormDetail",
"pages/residentManage/createStaff"
"pages/appealFormManage/appealFormDetail/appealFormDetail"
]
},
{
......
......@@ -26,7 +26,9 @@ Component({
/**
* 组件的初始数据
*/
data: {},
data: {
showPopup: false,
},
/**
* 组件的方法列表
......@@ -34,9 +36,7 @@ Component({
methods: {
noScroll() { },
hidePopup() {
this.setData({
show: false
})
this.setData({ showPopup: false })
this.triggerEvent('cancel')
},
confirm() {
......@@ -44,9 +44,9 @@ Component({
}
},
attached() {
// console.log(wx.$util.isFullSucreen(), 'wx.$util.isFullSucreen()')
this.setData({
isFullSucreen: wx.$util.isFullSucreen(true)
isFullSucreen: wx.$util.isFullSucreen(true),
showPopup: !!this.properties.show,
})
}
})
\ No newline at end of file
// components/TabBar/TabBar.js
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: Array,
activeIndex: {
type: Number,
observer: function (n) {
console.log(this.data.tabIndex, 'activeIndex', n);
console.log(this.data.tabIndex != n);
if (this.data.tabIndex != n) {
this.setData({
tabIndex: this.data.activeIndex
})
this.setTab(this.data.tabIndex)
observer(n) {
if (this.data.tabIndex !== n) {
this.setData({ tabIndex: n })
}
}
},
},
scroll: Boolean
scroll: Boolean,
},
/**
* 组件的初始数据
*/
data: {
tabIndex: 0
tabIndex: 0,
},
lifetimes: {
ready() {
// console.log('lifetimes',this.data.tabIndex);
// console.log('lifetimes',this.data.activeIndex);
this.setTab(this.data.tabIndex)
let that = this
wx.$eventbus.on('page_show', n => {
!that.data.width && that.setTab(that.data.tabIndex)
})
}
const index = this.properties.activeIndex || 0
this.setData({ tabIndex: index })
},
},
/**
* 组件的方法列表
*/
methods: {
methods: {
change(e) {
let {
index
} = e.currentTarget.dataset
const { index } = e.currentTarget.dataset
this.setTab(index)
},
setTab(index = 0) {
let {
tabIndex,
} = this.data
wx.$util.getViewInfo(`#tab-${tabIndex}`, old => {
let oldLeft = old.left
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({
activeStyle: `width: var(--fontSize64);left:${left + (width - 32) / 2}px;background-color:#2C66F7;`,
tabIndex: index,
to: `to-${index}`,
width
})
this.triggerEvent('click', index)
}, 100)
}, this)
}, this)
}
}
})
\ No newline at end of file
index = Number(index)
if (Number.isNaN(index)) index = 0
if (Number(this.data.tabIndex) === index) {
this.triggerEvent('click', index)
return
}
this.setData({
tabIndex: index,
to: `to-${index}`,
})
this.triggerEvent('click', index)
},
},
})
......@@ -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>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}" />
</view>
</block>
\ No newline at end of file
/* components/TabBar/TabBar.wxss */
.tab {
position: relative;
background-color: #fff;
height: var(--fontSize72);
box-sizing: border-box;
......@@ -7,7 +8,6 @@
align-items: center;
font-size: var(--fontSize28);
color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
}
.scroll {
......@@ -15,7 +15,6 @@
height: var(--fontSize72);
box-sizing: border-box;
color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
width: 100%;
display: flex;
line-height: var(--fontSize72);
......@@ -28,16 +27,21 @@
color: #2C66F7;
}
.active-doc {
.tab .tab-item {
position: relative;
text-align: center;
}
.tab .tab-item.active::after {
content: '';
position: absolute;
bottom: var(--fontSize1);
bottom: -12rpx;
left: 50%;
transform: translateX(-50%);
width: 64rpx;
height: var(--fontSize4);
background-color: #2c66f7;
border-radius: var(--fontSize2) var(--fontSize2) 0 0;
transition: all .25s;
}
.tab .tab-item {
text-align: center;
}
.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";
* 4预发布
* 5cdptest
*/
let index = 1;
let index = 2;
const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync();
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;
}
......@@ -126,8 +126,10 @@ Component({
// 单选:取消其他,选中当前
const currentVal = item[valueKey]
const display = this.data.displayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
const selected = display[index].checked ? [currentVal] : []
this.setData({ displayOptions: display, selectedValues: selected })
const selected = display[index].checked ? [currentVal] : []
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() })
if (this.properties.confirmOnSelect) {
this.onConfirm()
......@@ -164,8 +166,8 @@ Component({
this.triggerEvent('cancel')
},
onConfirm() {
const values = this.data.selectedValues
const items = this.getSelectedItems()
const values = this.data.selectedValues
const items = this.getSelectedItems()
this.triggerEvent('confirm', { values, items })
},
getSelectedItems() {
......
......@@ -38,5 +38,10 @@ module.exports = {
/** 根据人员获取业务场景数据 */
getBaseSceneCodeList(data) {
return api.post("dj.api.scenemerchantref.findAllSceneByMerchantId", data)
},
/** 新增员工-获取北森待激活的员工数据 */
getEmployeeOnTheJobList(data) {
return api.post("dj.api.smartcarlife.staffBaseInfo.pageList", data)
}
};
\ No newline at end of file
};
......@@ -275,8 +275,10 @@ Component({
staffNameOrPhone,
pageNum,
pageSize
}
}
wx.$util.showLoading()
api.getDailyReportConfigList(params).then(res => {
wx.$util.hideLoading()
if (res.code == 0) {
let {
list,
......@@ -309,20 +311,31 @@ Component({
})
},
goToStaff(e) {
let {
index
} = e.currentTarget.dataset, {
accountList
} = this.data;
let {
staffPhone,
staffName,
staffId
} = accountList[index]
wx.navigateTo({
url: `/packageWorkspace/pages/residentManage/createStaff?staffPhone=${staffPhone}&staffName=${staffName}&staffId=${staffId}`
})
},
let {
index
} = e.currentTarget.dataset, {
accountList
} = this.data;
let {
staffPhone,
staffName,
staffId
} = accountList[index]
let pageInstance = wx.$router.getPageInstance()
pageInstance.setData({
activeIndex: 0
}, () => {
let thisPage = pageInstance.selectComponent(`#componet-0`)
thisPage.setData({
'staffObj.staffName': staffName,
'staffObj.staffPhone': staffPhone,
'staffObj.staffId': staffId,
namePhoneDisabled: true
})
})
},
// 触底刷新
mineReachBottom() {
console.log('触底')
......@@ -354,11 +367,9 @@ Component({
})
},
},
// lifetimes: {
// attached: function () {
// this.getData()
// }
// },
lifetimes: {
attached: function () {
this.getData()
}
},
})
\ No newline at end of file
/* tabWorkOrder/pages/residentManage/components/accountAllocation/index.wxss */
.container {
height: calc(100% - 104rpx);
}
.search-input {
// border: 1rpx solid #979797;
background: #ffffff;
......
......@@ -23,7 +23,7 @@
<block wx:if="{{ isFlag }}">
<scroll-view
class="account-box"
style="height: calc(100vh - var(--fontSize540));"
style="height: calc(100% - var(--fontSize340));"
enhanced="{{ true }}"
show-scrollbar="{{ false }}"
scroll-y
......
......@@ -3,6 +3,8 @@
"usingComponents": {
"business-type":"../businessType/index",
"shop-merchant":"../shopMerchant/index",
"yq-merchant":"../yqMerchant/index"
"yq-merchant":"../yqMerchant/index",
"select-popup":"../../../../components/selectPopup/selectPopup",
"staff-select-popup": "../staffSelectPopup/index"
}
}
\ No newline at end of file
}
/* tabWorkOrder/pages/residentManage/components/addStaff/index.wxss */
.container {
margin: var(--fontSize16) var(--fontSize24);
margin: 0 var(--fontSize24);
border-radius: 16rpx;
opacity: 1;
box-sizing: border-box;
......@@ -39,7 +39,10 @@
height: 100%;
}
.between{
text-align:right;
text-align:right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.placeholder-class {
color: #BBBBBB;
......
<!--tabWorkOrder/pages/residentManage/components/addStaff/index.wxml-->
<view class="container">
<view class="top-box">
<view>
<view class="title">增设新员工门店账号</view>
<view class="info">增设的员工账号支持该手机号所绑定的员工登录「嘀加区域助手」小程序开展业务录单。
仅支持新增深圳嘀加服务商下的员工账号</view>
</view>
<image class="staff-icon" src="{{IMG_URL}}add-staff.png" mode=""/>
</view>
<view class="box">
<gl-cell border valueAlign="right" label="员工姓名" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize290)" required>
<input placeholder="请输入" disabled style="color: #BBBBBB;" value="{{staffObj.staffName}}" class="input" placeholder-class="placeholder-class" bindinput="input" data-name="staffObj.staffName" always-embed></input>
</gl-cell>
<gl-cell border valueAlign="right" label="手机号" cellHeight="{{cellHeight}}" cellStyle="{{cellStyle}}" requiredAfter labelWidth="var(--fontSize140)" required>
<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>
</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="点击选择">
<block wx:if="{{ staffObj.merchantId }}">
<view class="between">{{staffObj.merchantName}}{{staffObj.merchantId}}</view>
</block>
</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="点击选择">
<block wx:if="{{ staffObj.staffSceneLabelText }}">
<view class="between">{{staffObj.staffSceneLabelText}}</view>
</block>
</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="点击选择" >
<block wx:if="{{ staffObj.yqMerchantName }}">
<view class="between">{{staffObj.yqMerchantName}}{{staffObj.yqMerchantId}}</view>
</block>
</gl-cell>
</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
<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>
<view class="title">
增设新员工门店账号
</view>
<view class="info">
增设的员工账号支持该手机号所绑定的员工登录「嘀加区域助手」小程序开展业务录单。仅支持新增深圳嘀加服务商下的员工账号
</view>
</view>
<image class="staff-icon"
src="{{ IMG_URL }}add-staff.png"
mode="" />
</view>
<view class="box">
<gl-cell border
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 border
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 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 }}">
<view class="between">
{{ staffObj.merchantName }}{{ staffObj.merchantId }}
</view>
</block>
</gl-cell>
<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 }}">
<view class="between">
{{ staffObj.staffSceneLabelText }}
</view>
</block>
</gl-cell>
<gl-cell valueAlign="right"
border
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>
</gl-cell>
</view>
</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({
} = this.data, {
index
} = e.currentTarget.dataset;
list.forEach(item=>{
item.active=false
})
list[index].active =true
if (index === undefined || index === null) return
const item = list[index]
if (!item) return
item.active = !item.active
this.setData({
list,
});
......@@ -84,4 +84,4 @@ Component({
});
},
}
})
\ No newline at end of file
})
......@@ -2,47 +2,46 @@
.box {
// height:200rpx;
height: 100%;
// width: calc(100% + var(--fontSize64));
// margin-left: calc(-1 * var(--fontSize32));
}
.item {
padding: 24rpx 4rpx;
box-sizing: border-box;
.item{
display: flex;
height: var(--fontSize88);
align-items: center;
color: #292D33;
border-bottom: var(--fontSize1) solid #EFF0F2;
.item-hd {
display: flex;
align-items: center;
}
.item:last-child{
border-bottom: none;
}
.item.active{
color: #2C66F7;
}
.name {
max-width: 400rpx;
font-weight: 400;
font-size: 28rpx;
color: #292D33;
margin-left: 20rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.merchant_item{
height: var(--fontSize88);
font-size: var(--fontSize28);
display: flex;
align-items: center;
width:94%;
}
.total-price {
font-weight: 500;
font-size: 28rpx;
color: #2C66F7;
margin-left: auto;
}
.merchant_item .text-hide{
max-width: calc(100% - var(--fontSize192));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.icon {
display: block;
width: var(--fontSize32);
height: var(--fontSize32);
}
.mark{
width:var(--fontSize32);
height: var(--fontSize32);
}
.icon .arc {
width: 100%;
height: 100%;
border: var(--fontSize2) solid #979797;
border-radius: 100%;
box-sizing: border-box;
}
}
}
\ No newline at end of file
.icon {
width: var(--fontSize32);
height: var(--fontSize32);
display: block;
margin-right: var(--fontSize20);
flex-shrink: 0;
}
<popup show="{{ show }}" title="选择所属业务" bindconfirm="confirm" bindcancel="cancel" height="40%">
<scroll-view scroll-y show-scrollbar="{{false}}" enhanced="true" class="box">
<block wx:if="{{list.length}}">
<view class="item" wx:for="{{ list }}">
<view class="item-hd" catchtap="choose" data-index="{{ index }}">
<view class="icon" >
<block wx:if="{{ item.active }}">
<image src="../../image/radio.png" />
</block>
<block wx:else>
<view class="arc" />
</block>
<block wx:for="{{ list }}" wx:key="index">
<view class="item {{ item.active ? 'active' : '' }}" bindtap="choose" data-index="{{ index }}">
<view class="merchant_item">
<view class="text-hide">{{item.baseSceneCodeName}}</view>
</view>
<view class="mark" wx:if="{{ item.active }}">
<gl-image class="icon" src="/equity/mark.png" />
</view>
<view class="name">{{item.baseSceneCodeName}}</view>
</view>
</view>
</block>
</block>
<view class="safeAreaInset"></view>
</scroll-view>
</popup>
\ No newline at end of file
</popup>
......@@ -11,22 +11,24 @@ Component({
if (n) {
this.setData({
pageNum: 1,
storeIndex: null,
nothing: false,
keyword:'',
merchantIdName:'',
tempMerchantId: this.data.merchantId,
scrollTop: 0
scrollTop: 0,
isFlag: false,
shopMerchantList: []
}, () => {
this.getData()
this.setData({
selectItem: wx.$util.deepClone(this.data.selectedObj)
})
})
}
}
},
sceneLabel: String,
merchantId: String
selectedObj: Object
},
/**
......@@ -41,8 +43,7 @@ Component({
total: 0,
pageNum: 1,
pageSize: 20,
storeIndex: null,
tempMerchantId: '',
selectItem: {},
shopMerchantList: []
},
/**
......@@ -88,21 +89,28 @@ Component({
merchantIdName,
pageNum,
pageSize
}
}
this.setData({
requestLoading: true
})
if (pageNum == 1) wx.$util.showLoading()
api.getshopMerchantList(params).then(res => {
wx.$util.hideLoading()
this.setData({
requestLoading: false
})
if (res.code == 0) {
let {
list,
total
total,
pages
} = res.data;
let tempList = pageNum == 1 ? list : [...shopMerchantList, ...res.data.list];
this.setData({
shopMerchantList: tempList,
isFlag: true,
total: total,
nothing: pageNum == 1 ? false : total == tempList.length,
}, () => {
if (this.data.tempMerchantId ) this.initData()
nothing: pages == pageNum,
})
}
......@@ -117,59 +125,40 @@ Component({
} = this.data
if (pageNum * pageSize >= total) {
return
}
}
if (this.data.requestLoading) return
this.setData({
pageNum: pageNum + 1
}, () => {
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) {
let {
index
item
} = e.currentTarget.dataset,
{
shopMerchantList
} = this.data,
{
shopMerchantId
} = shopMerchantList[index];
} = this.data
console.log(item)
this.setData({
storeIndex: index,
tempMerchantId:shopMerchantId
selectItem: item,
shopMerchantList
})
},
confirm() {
if (this.data.shopMerchantList.length == 0) return
let {
shopMerchantList,
storeIndex
selectItem
} = this.data;
if(storeIndex===null) {
if(!Object.keys(selectItem).length) {
wx.$util.showToast('请选择门店');
return
}
let {
shopMerchantId,
shopMerchantName
} = shopMerchantList[storeIndex];
} = selectItem;
this.setData({
show: false
}, () => {
......@@ -193,9 +182,6 @@ Component({
thisPage.setData({
shopMerchantBox: false,
})
this.setData({
storeIndex: 0
})
},
}
......
......@@ -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">
<view class="merchant-box" wx:if="{{shopMerchantList.length>0}}">
<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="text-hide">{{item.shopMerchantName}}</view>
<view>{{item.shopMerchantId}}</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" />
</view>
</view>
</block>
<block wx:if="{{requestLoading}}">
<view class="list-nothing">加载中</view>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing">到底了~</view>
</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
{
"component": true,
"usingComponents": {}
}
\ 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
<!--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
// 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
/* 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
<!--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({
data: {
navStyle: 'background-color: transparent',
list: ['新增员工', '调店账号分配'],
activeIndex:0
activeIndex: 0,
navBarHeight: 113.5
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
},
/**
......@@ -22,28 +30,35 @@ Page({
checkRequired(obj) {
let target = [
"staffName",
"staffPhone",
"staffPhone",
"merchantId",
"staffSceneLabel",
"merchantId",
"yqMerchantId"
"yqMerchantList",
"stationType"
];
obj = {
...obj
};
if (!phoneRex.test(obj.staffPhone)) {
this.showToast("请输入正确的手机号");
return true;
}
try {
target.map((key) => {
if (key === "yqMerchantList") {
const hasList = Array.isArray(obj.yqMerchantList) && obj.yqMerchantList.length > 0
if (!hasList) throw key
return
}
if (!obj[key]) {
throw key;
}
});
} catch (error) {
return error;
}
}
if (!phoneRex.test(obj.staffPhone)) {
this.showToast("请输入正确的手机号");
return true;
}
return false;
},
/**
......@@ -57,8 +72,6 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
const comp = this.selectComponent("#componet-1");
comp.getData && comp.getData()
},
back() {
wx.$router.back()
......@@ -106,4 +119,4 @@ Page({
onShareAppMessage() {
}
})
\ No newline at end of file
})
{
"navigationStyle": "custom",
"usingComponents": {
"add-staff": "./components/addStaff/index",
"account-allocation":"./components/accountAllocation/index"
}
}
\ No newline at end of file
......@@ -14,8 +14,8 @@ page {
}
.content {
margin-top: 176rpx;
box-sizing: border-box;
height: 100vh;
.tabs {
margin: 0 40rpx;
display: flex;
......
<navigation-bar bindnavbarReady="navbarReady" class="navigation-bar-wrap" bindback="back" showBack="true" navStyle="{{navStyle}}">驻店管理</navigation-bar>
<view class="bg"></view>
<view class="content">
<account-allocation id="componet-1"></account-allocation>
<view class="content" style="padding-top: {{navBarHeight}}px;">
<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>
\ No newline at end of file
......@@ -49,7 +49,7 @@ Page({
sceneType: scene,
loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant,
});
wx.$router.reLaunch('pages.index', {
wx.$router.reLaunch('pages.workspace', {
resetStoreList: true,
});
} else {
......
......@@ -68,7 +68,7 @@ Page({
wx.$router._to(navigateParams.url, navigateParams, 'reLaunch')
return
}
if (!((userInfo?.sceneType ?? '') === '')) return wx.$router.reLaunch('pages.index', {
if (!((userInfo?.sceneType ?? '') === '')) return wx.$router.reLaunch('pages.workspace', {
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({
sceneType: scene,
loginRoleOnSelectMerchant: data?.loginRoleOnSelectMerchant,
});
wx.$router.reLaunch('pages.index', {
wx.$router.reLaunch('pages.workspace', {
resetStoreList: true,
});
} else {
......
// pages/tab/index/index.js
const app = getApp()
// pages/tab/index/index.js — 店效(原首页 Tab,H5)
Page({
/**
* 页面的初始数据
*/
data: {
webUrl: ''
webUrl: '',
userInfo: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad() {
this.getUserInfo()
this.init()
},
getUserInfo() {
let userInfo =wx.$util.getUserInfo()
this.setData({
userInfo
})
const userInfo = wx.$util.getUserInfo()
this.setData({ userInfo })
},
init() {
let webUrl = this.data;
let index = 2;
let accountInfo = wx.getAccountInfoSync();
let systemInfo = wx.getSystemInfoSync();
let envName = accountInfo.miniProgram.envVersion;
let {type} = this.data;
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false;
const release = false;
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;
case 'develop':
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3;
break;
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"];
webUrl = webUrls[target[index]];
console.log(`${webUrl}${this.data.userInfo.phone}`)
this.setData({
webUrl
})
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 })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow() {
this.getUserInfo()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
})
\ No newline at end of file
})
{
"usingComponents": {}
}
\ No newline at end of file
"navigationStyle": "default"
}
<!--pages/tab/index/index.wxml-->
<web-view src="{{webUrl}}{{userInfo.phone}}"></web-view>
\ 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
......@@ -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": {
"add-staff":"./components/addStaff/index"
"cover-tab-bar": "/components/cover-tab-bar/cover-tab-bar"
},
"navigationStyle": "custom"
}
\ No newline at end of file
}
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({
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
onShow() {},
navbarReady(e) {
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 {
}
.container {
padding-top: var(--fontSize1);
padding-bottom: var(--fontSize30);
overflow: auto;
}
.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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!