Commit acedc26f by 岑成威

fix:带教

1 parent 5daebc54
Showing 65 changed files with 3611 additions and 204 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",
......
......@@ -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
if (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;
}
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;
}
......@@ -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 { MATTER_DETAIL_FIELDS, normalizeMatterItem } from '~/utils/matterItem'
Page({
data: {
navBarHeight: 0,
task: null,
reply: '',
detailFields: MATTER_DETAIL_FIELDS,
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,
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() {
wx.hideLoading()
this.setData({ submitting: false })
wx.showToast({ title: '提交成功', icon: 'success' })
this.notifyRefresh()
setTimeout(() => {
wx.redirectTo({
url: '/pages/mattersSubmitResult/mattersSubmitResult',
})
}, 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;
}
.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;
}
.reply-time-row {
margin-top: 24rpx;
padding-top: 24rpx;
border-top: 2rpx dashed #f0f1f5;
}
.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">
<view class="card-title">
专项任务回复<text class="required" wx:if="{{ !isReadonly }}">*</text>
</view>
<block wx:if="{{ isReadonly }}">
<view class="reply-text">{{ task.replyText || '-' }}</view>
<view class="info-row flex reply-time-row">
<view class="info-label">回复时间</view>
<view class="info-value">{{ task.replyTimeText || '-' }}</view>
</view>
</block>
<block wx:else>
<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 {
MATTER_LIST_COMPLETED_FIELDS,
MATTER_LIST_FIELDS,
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,
matterItems: MATTER_LIST_FIELDS,
completedMatterItems: MATTER_LIST_COMPLETED_FIELDS,
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() {
this.refreshAll()
},
input(e) {
this.setData({ keyword: e.detail.value })
},
clear() {
this.setData({ keyword: '' }, () => this.reloadList())
},
search() {
this.reloadList()
},
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)
},
getStatusByTab(tabIndex) {
if (tabIndex === 0) return 0
if (tabIndex === 1) return 1
return undefined
},
buildListParams(pageNum) {
const { tabIndex, keyword, pageSize } = this.data
const params = this.buildTaskQueryParams({ pageNum, pageSize })
const status = this.getStatusByTab(tabIndex)
if (status !== undefined) params.status = status
return params
},
/** 与列表接口相同的查询条件(不含 status,用于统计) */
buildTaskQueryParams({ pageNum = 1, pageSize } = {}) {
const { keyword, pageSize: defaultPageSize } = this.data
const params = {
pageNum,
pageSize: pageSize ?? defaultPageSize,
}
const kw = (keyword || '').trim()
if (kw) params.keyword = kw
return params
},
updateTabListLabels(tabCounts) {
const { pending, done, all } = tabCounts
this.setData({
tabCounts,
tabList: [
`待完成(${pending})`,
`已完成(${done})`,
`全部(${all})`,
],
})
},
async fetchTabCounts() {
try {
const res = await api.getTaskCenterCountStat(
this.buildTaskQueryParams({ pageNum: 1, pageSize: 1 })
)
if (res?.code !== '0' && res?.code !== 0) return
this.updateTabListLabels(parseTaskCenterCountStat(res.data || {}))
} 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.getTaskCenterPage(this.buildListParams(pageNum))
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) {
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
wx.navigateTo({
url: `/pages/mattersHandle/mattersHandle?id=${item.id}`,
events: {
refreshList: () => this.refreshAll(),
},
})
},
})
{
"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 {
width: var(--fontSize36);
height: var(--fontSize36);
margin: 0 var(--fontSize26) 0 var(--fontSize10);
flex-shrink: 0;
}
.input {
font-size: var(--fontSize28);
height: var(--fontSize38);
line-height: var(--fontSize38);
width: calc(100% - var(--fontSize136));
}
.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: 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;
font-size: 26rpx;
font-weight: 500;
color: #666666;
border-bottom: 2rpx dashed #f0f1f5;
}
.list .code-text {
color: #222222;
margin-left: 16rpx;
}
.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;
}
.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 {
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"
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>
</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 flex"
wx:for="{{ item.completed ? completedMatterItems : matterItems }}"
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": {
"cover-tab-bar": "/components/cover-tab-bar/cover-tab-bar"
},
"navigationStyle": "custom"
}
page {
background: #f2f3f7;
}
<!-- web-view 全屏;底部 Tab 必须用 cover-view 才能显示在 H5 之上 -->
<web-view wx:if="{{webUrl}}" src="{{webUrl}}{{userInfo.phone}}"></web-view>
<cover-tab-bar selected="{{1}}" />
......@@ -47,9 +47,7 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
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()
},
input(e) {
this.setData({ keyword: e.detail.value })
},
clear() {
this.setData({ keyword: '' }, () => this.reloadList())
},
search() {
this.reloadList()
},
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)
},
buildListParams(pageNum) {
const { tabIndex, keyword, pageSize } = this.data
const params = { pageNum, pageSize }
const kw = (keyword || '').trim()
if (kw) params.keyword = kw
if (tabIndex === 0) params.tab = 0
return params
},
buildCountParams(tab) {
const params = { pageNum: 1, pageSize: 1 }
const kw = (this.data.keyword || '').trim()
if (kw) params.keyword = kw
if (tab === 0) params.tab = 0
return params
},
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 {
width: var(--fontSize36);
height: var(--fontSize36);
margin: 0 var(--fontSize26) 0 var(--fontSize10);
flex-shrink: 0;
}
.input {
font-size: var(--fontSize28);
height: var(--fontSize38);
line-height: var(--fontSize38);
width: calc(100% - var(--fontSize136));
}
.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"
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>
</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: '权益' },
]
Page({
data: {
navBarHeight: 0,
merchantId: '',
merchantName: '',
businessType: '',
businessName: '',
staffList: [],
staffNames: '',
supervisorName: '',
supervisorDisplayText: '选择门店和业务后自动填充',
supervisorLoading: false,
description: '',
submitting: false,
merchantPopupShow: false,
merchantKeyword: '',
merchantList: [],
merchantIndex: null,
merchantLoading: false,
staffPopupShow: false,
staffOptions: [],
staffLoading: false,
staffSelectedCount: 0,
},
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)
if (res?.code !== '0' && res?.code !== 0) {
wx.showToast({ title: res?.message || '加载门店失败', icon: 'none' })
return
}
const merchantList = parseStrategyShopMerchantList(res.data || {})
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) {
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, staffList } = this.data
if (!merchantId && merchantId !== 0) {
wx.showToast({ title: '请先选择归属门店', icon: 'none' })
return
}
const staffSelectedCount = (staffList || []).length
this.setData({ staffPopupShow: false, staffSelectedCount }, () => {
this.setData({ staffPopupShow: true }, () => this.loadStaffList())
})
},
syncStaffSelectedCount(staffOptions) {
const staffSelectedCount = (staffOptions || []).filter((i) => i.checked).length
this.setData({ staffSelectedCount })
},
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: selectedPhones.has(String(item.userPhone)),
}))
if (!staffOptions.length && !isStrategyApiSuccess(res)) {
wx.showToast({ title: res?.message || '加载人员失败', icon: 'none' })
}
this.setData({ staffOptions }, () => this.syncStaffSelectedCount(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 }, () => this.syncStaffSelectedCount(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(','),
staffSelectedCount: staffList.length,
})
},
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 > 800) {
wx.showToast({ title: '申请描述不能超过800字', icon: 'none' })
return
}
const invalidStaff = staffList.some(
(s) => !(s.userPhone || '').trim() || !(s.userName || '').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: calc(100% - 56rpx);
}
.picker-multi-tip {
margin-bottom: 12rpx;
font-size: 24rpx;
color: #979797;
text-align: center;
}
.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="{{ 800 }}"
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"
>
<view class="picker-multi-tip" wx:if="{{ staffOptions.length && !staffLoading }}">
已选 {{ staffSelectedCount }} 人,点击可多选
</view>
<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="userPhone"
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;
}
.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>
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"condition": {},
"libVersion": "3.14.3",
"projectname": "regional-assistant",
"setting": {
"compileHotReLoad": true,
"urlCheck": true,
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"autoAudits": false,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"checkInvalidKey": true,
"ignoreDevUnusedFiles": false,
"bigPackageSizeSupport": false
}
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"condition": {},
"libVersion": "3.14.3",
"projectname": "regional-assistant",
"setting": {
"compileHotReLoad": true,
"urlCheck": false,
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"autoAudits": false,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"checkInvalidKey": true,
"ignoreDevUnusedFiles": false,
"bigPackageSizeSupport": false
}
}
\ No newline at end of file
/** TaskInfoDTO.status:0-待完成,1-已完成 */
export const MATTER_STATUS_MAP = {
0: { name: '待完成', color: '#FF9D0A', background: '#ff9d0a1a' },
1: { name: '已完成', color: '#35C376', background: '#35C3761a' },
}
/** taskType 枚举(接口文档) */
export const TASK_TYPE_NAME_MAP = {
'staff-replace-access': '人员更换评估',
'policy-update-access': '商务政策更新评估',
'scene-expand': '多品类扩张',
'traffic-optimize': '流量问题改善',
}
/** businessType:1-延保 2-轻改 3-权益 */
export const BUSINESS_TYPE_NAME_MAP = {
1: '延保',
2: '轻改',
3: '权益',
}
function formatDateTime(val) {
if (!val) return '-'
return String(val).replace('T', ' ').replace(/\.\d+Z?$/, '').slice(0, 19)
}
/** TaskStaffRelDTO[] → 问题驻店人员展示文案 */
export function formatStaffList(staffList) {
if (!Array.isArray(staffList) || !staffList.length) return ''
return staffList
.map((s) => s.staffName)
.filter(Boolean)
.join('/')
}
function resolveBusinessTypeName(item) {
if (item.businessTypeName) return item.businessTypeName
const key = item.businessType
if (key == null || key === '') return '-'
return BUSINESS_TYPE_NAME_MAP[key] || String(key)
}
function resolveTaskTypeName(item) {
if (item.taskTypeName) return item.taskTypeName
if (item.taskType && TASK_TYPE_NAME_MAP[item.taskType]) {
return TASK_TYPE_NAME_MAP[item.taskType]
}
return item.taskType || '-'
}
/**
* 归一化 TaskInfoDTO(列表项 / 分页 condition 同结构)
* @param {object} dto TaskInfoDTO
*/
export function normalizeMatterItem(dto = {}, index = 0) {
const statusKey = dto.status ?? 0
const completed = statusKey === 1 || statusKey === '1'
const statusStyle = completed ? MATTER_STATUS_MAP[1] : MATTER_STATUS_MAP[0]
const staffList = Array.isArray(dto.staffList) ? dto.staffList : []
const staffNames = formatStaffList(staffList)
return {
...dto,
id: dto.id ?? dto.taskCenterId ?? `matter-${index}`,
taskCenterId: dto.taskCenterId,
taskType: dto.taskType,
taskTypeText: resolveTaskTypeName(dto),
merchantName: dto.storeName || '-',
storeId: dto.storeId,
businessType: dto.businessType,
businessName: resolveBusinessTypeName(dto),
/** 问题驻店人员:仅来自 staffList */
staffList,
sellerName: staffNames || '-',
staffNames,
creatorName: dto.creator || '-',
creatorPhone: dto.creatorPhone || '',
createTimeText: formatDateTime(dto.createdDate),
descriptionText: dto.taskDescription || '-',
replyText: dto.replyContent || '',
replyTimeText: formatDateTime(dto.replyTime),
/** 指派的区域运营 */
assignedToId: dto.assignedToId,
assignedToName: dto.assignedToName || '-',
status: statusKey,
statusName: completed ? '已完成' : '待完成',
statusStyle,
completed,
showAction: !completed,
showView: completed,
}
}
function pickCount(data, keys) {
for (const key of keys) {
if (data[key] != null && data[key] !== '') return Number(data[key]) || 0
}
return null
}
/** 解析 count.stat 返回:待完成 / 已完成 / 全部 */
export function parseTaskCenterCountStat(data = {}) {
const pending = pickCount(data, [
'pendingCount',
'pendingTotal',
'waitCount',
'waitTotal',
'unfinishedCount',
'unCompleteCount',
'status0Count',
'toDoCount',
'pending',
'wait',
])
const done = pickCount(data, [
'completedCount',
'completedTotal',
'completeCount',
'finishCount',
'finishTotal',
'finishedCount',
'status1Count',
'doneCount',
'completed',
'finish',
'done',
])
const all = pickCount(data, [
'totalCount',
'allCount',
'allTotal',
'total',
'all',
])
const pendingNum = pending ?? 0
const doneNum = done ?? 0
const allNum = all ?? pendingNum + doneNum
return { pending: pendingNum, done: doneNum, all: allNum }
}
/** 解析分页接口 data:list 为列表,condition 为查询条件回显(TaskInfoDTO) */
export function parseTaskCenterPageData(data = {}) {
const list = (data.list || []).map((item, index) =>
normalizeMatterItem(item, index)
)
const condition = data.condition
? normalizeMatterItem(data.condition, -1)
: null
return {
list,
condition,
total: data.total ?? 0,
pageNum: data.pageNum,
pageSize: data.pageSize,
}
}
export const MATTER_DETAIL_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '问题驻店销售', key: 'staffNames' },
{ label: '创建人', key: 'creatorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '任务描述', key: 'descriptionText', multiline: true },
]
export const MATTER_LIST_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '创建人', key: 'creatorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '任务描述', key: 'descriptionText', ellipsis: true },
]
export const MATTER_LIST_COMPLETED_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '创建人', key: 'creatorName' },
{ label: '任务描述', key: 'descriptionText', ellipsis: true },
{ label: '专项任务回复', key: 'replyText', ellipsis: true },
]
const TAB_INDEX = {
'/pages/tab/workspace/workspace': 0,
'/pages/tab/index/index': 1,
'/pages/tab/matters/matters': 2,
'/pages/tab/study/study': 3,
'/pages/tab/mine/mine': 4,
}
/** 在 tab 页 onShow 中调用,同步自定义 tabBar 选中态 */
function setCustomTabBar(page, index) {
const apply = () => {
if (typeof page.getTabBar === 'function' && page.getTabBar()) {
page.getTabBar().setData({ selected: index })
return true
}
return false
}
if (!apply()) {
wx.nextTick(() => apply())
}
}
function setCustomTabBarByRoute(page) {
const route = page.route
const index = TAB_INDEX[`/${route}`]
if (index !== undefined) {
setCustomTabBar(page, index)
}
}
module.exports = {
setCustomTabBar,
setCustomTabBarByRoute,
TAB_INDEX,
}
/** 底部 Tab 配置(custom-tab-bar / cover-tab-bar 共用) */
const TAB_LIST = [
{
pagePath: '/pages/tab/workspace/workspace',
text: '工作台',
iconPath: '/images/tab-workspace.png',
selectedIconPath: '/images/tab-workspace-active.png',
},
{
pagePath: '/pages/tab/index/index',
text: '店效',
iconPath: '/images/tab-home.png',
selectedIconPath: '/images/tab-home-active.png',
},
{
pagePath: '/pages/tab/matters/matters',
text: '事项',
iconPath: '/images/tab-shixiang.png',
selectedIconPath: '/images/tab-shixiang-active.png',
isMatters: true,
},
{
pagePath: '/pages/tab/study/study',
text: '学习',
iconPath: '/images/tab-study.png',
selectedIconPath: '/images/tab-study-active.png',
},
{
pagePath: '/pages/tab/mine/mine',
text: '我的',
iconPath: '/images/tab-mine.png',
selectedIconPath: '/images/tab-mine-active.png',
},
]
module.exports = {
TAB_LIST,
}
export const TEACH_STATUS_MAP = {
0: { name: '待审批', color: '#FF9D0A', background: '#ff9d0a1a' },
1: { name: '已通过', color: '#35C376', background: '#35C3761a' },
2: { name: '已驳回', color: '#F24724', background: '#f247241a' },
}
const DEFAULT_STATUS = TEACH_STATUS_MAP[0]
export const TEACH_LIST_FIELDS = [
{ label: '归属业务', key: 'businessName' },
{ label: '需带教驻店人员', key: 'staffNames' },
{ label: '归属区域督导', key: 'supervisorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '申请描述', key: 'descriptionText', ellipsis: true },
]
export const TEACH_DETAIL_FIELDS = [
{ label: '归属门店', key: 'merchantName' },
{ label: '归属业务', key: 'businessName' },
{ label: '需带教驻店人员', key: 'staffNames' },
{ label: '归属区域督导', key: 'supervisorName' },
{ label: '创建时间', key: 'createTimeText' },
{ label: '申请描述', key: 'descriptionText', multiline: true },
]
export const TEACH_APPROVE_FIELDS = [
{ label: '指定督导', key: 'approveSupervisorName' },
{ label: '带教场景', key: 'teachSceneName' },
{ label: '带教时间', key: 'teachTimeText' },
{ label: '带教方式', key: 'teachMethodName' },
{ label: '带教主题', key: 'teachTopic' },
{ label: '审核人', key: 'auditorName' },
{ label: '通过时间', key: 'auditTimeText' },
]
export const TEACH_REJECT_FIELDS = [
{ label: '驳回原因', key: 'rejectReason', multiline: true },
{ label: '审核人', key: 'auditorName' },
{ label: '驳回时间', key: 'auditTimeText' },
]
function resolveStaffNames(dto) {
if (typeof dto.staffNames === 'string' && dto.staffNames) return dto.staffNames
const staffList =
dto.staffNameList || dto.teachStaffList || dto.residentStaffNames || []
if (Array.isArray(staffList) && staffList.length) {
return staffList
.map((s) => (typeof s === 'string' ? s : s.staffName))
.filter(Boolean)
.join('/')
}
return '-'
}
/**
* 归一化带教申请列表项 / condition
* @param {object} dto TeachingApplicationListItemDTO
*/
export function normalizeTeachApplyItem(dto = {}, index = 0) {
const statusKey =
dto.approvalStatus ?? dto.auditStatus ?? dto.status ?? dto.approveStatus ?? 0
const statusStyle = TEACH_STATUS_MAP[statusKey] || DEFAULT_STATUS
const statusName =
dto.approvalStatusText ||
statusStyle.name ||
(statusKey === 1 ? '已通过' : statusKey === 2 ? '已驳回' : '待审批')
const pending = statusKey === 0 || statusKey === '0'
const approved = dto.approvedInfo || {}
const rejected = dto.rejectedInfo || {}
return {
...dto,
applicationId: dto.applicationId,
id: String(dto.applicationId ?? dto.id ?? `teach-${index}`),
title: dto.merchantName || dto.shopName || dto.storeName || '-',
merchantName: dto.merchantName || dto.shopName || dto.storeName || '-',
businessName: dto.businessTypeText || dto.businessName || dto.businessTypeName || '-',
businessType: dto.businessType,
staffNames: resolveStaffNames(dto),
supervisorName:
dto.supervisorName || dto.areaSupervisorName || dto.supervisor || '-',
createTimeText: dto.createdTime || dto.createTime || dto.gmtCreate || '-',
descriptionText: dto.description || dto.applyDesc || '-',
approvalStatus: statusKey,
auditStatus: statusKey,
approveSupervisorName: approved.assignedSupervisor || '-',
teachSceneName: approved.mentoringScene || '-',
teachTimeText: approved.mentoringTime || '-',
teachMethodName: approved.mentoringMethod || '-',
teachTopic: approved.mentoringTopic || '-',
auditorName: approved.approver || rejected.approver || '-',
auditTimeText: approved.approvedTime || rejected.rejectedTime || '',
rejectReason: rejected.rejectReason || '',
approvedInfo: approved,
rejectedInfo: rejected,
statusName,
statusStyle,
pending,
showApprove: statusKey === 1 || statusKey === '1',
showReject: statusKey === 2 || statusKey === '2',
}
}
/** 策略分页 data(兼容 { code, data: { list, total } } 或直接分页对象) */
export function getStrategyPageData(res) {
if (res && Array.isArray(res.list)) return res
if (res?.data && typeof res.data === 'object' && !Array.isArray(res.data)) {
return res.data
}
return {}
}
export function parseTeachingApplicationPageData(resOrData = {}) {
const data = getStrategyPageData(resOrData)
const list = (data.list || []).map((item, index) =>
normalizeTeachApplyItem(item, index)
)
const condition = data.condition
? normalizeTeachApplyItem(data.condition, -1)
: null
return {
list,
condition,
total: data.total ?? 0,
pageNum: data.pageNum,
pageSize: data.pageSize,
}
}
function pickList(data) {
if (Array.isArray(data)) return data
if (data && Array.isArray(data.data)) return data.data
return data?.list || []
}
/** 策略接口成功判断(兼容直接返回 data 数组) */
export function isStrategyApiSuccess(res) {
if (Array.isArray(res)) return true
return res?.code === '0' || res?.code === 0 || res?.code == 0
}
/** 策略接口 data 提取(兼容 data 为数组) */
export function getStrategyApiData(res) {
if (Array.isArray(res)) return res
if (Array.isArray(res?.data)) return res.data
if (typeof res?.data === 'string') {
try {
const parsed = JSON.parse(res.data)
return Array.isArray(parsed) ? parsed : []
} catch (e) {
return []
}
}
return []
}
/** 解析策略-归属门店列表 */
export function parseStrategyShopMerchantList(data = {}) {
return pickList(data)
.map((item) => ({
merchantId: item.merchantId ?? item.shopMerchantId,
merchantName: item.merchantName ?? item.shopMerchantName ?? '',
}))
.filter((item) => item.merchantId != null && item.merchantId !== '')
}
/** 解析策略-驻店人员列表(兼容 { code, data: [] } / 直接数组) */
export function parseStrategyShopMerchantStaffList(resOrData = {}) {
let raw = pickList(resOrData)
if (!raw.length && resOrData && !Array.isArray(resOrData)) {
raw = getStrategyApiData(resOrData)
}
return raw
.map((item) => ({
userPhone: item.userPhone ?? item.staffPhone ?? item.phone ?? '',
userName: item.userName ?? item.staffName ?? item.name ?? '',
}))
.filter((item) => item.userPhone && item.userName)
}
/** 解析策略-区域督导列表(兼容 { code, data: [] } / 直接数组) */
export function parseStrategyShopMerchantSupervisorList(resOrData = {}) {
let raw = pickList(resOrData)
if (!raw.length && resOrData && !Array.isArray(resOrData)) {
raw = getStrategyApiData(resOrData)
}
return raw
.map((item) => ({
merchantId: item.merchantId,
directorType: item.directorType,
directorUserId: item.directorUserId ?? '',
directorName: item.directorName ?? item.supervisorName ?? '',
directorPhone: item.directorPhone ?? item.supervisorPhone ?? '',
}))
.filter((item) => item.directorName)
}
/** 多个督导 directorName 用中文逗号拼接 */
export function formatDirectorNames(list = []) {
return list
.map((item) => item.directorName)
.filter(Boolean)
.join(',')
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!