Commit b9b1f268 by zhangxw

联调修改

1 parent c4f48212
......@@ -35,6 +35,18 @@ Component({
}
}
},
initTimeDimension: {
type: Number,
value: -1
},
initStartDate: {
type: String,
value: ''
},
initEndDate: {
type: String,
value: ''
},
isSticky: Boolean,
customBackground: String,
setTrackData: Boolean
......@@ -42,10 +54,23 @@ Component({
lifetimes: {
attached: function () {
this._hasAppliedInit = false
const hasInit = this._hasInitConfig()
if (hasInit) {
const dim = Number(this.data.initTimeDimension)
if (dim === 1) {
this.getWeeklyData().then(() => {
this._tryApplyInitConfig()
})
} else {
this._tryApplyInitConfig()
this.getWeeklyData()
}
} else {
this.initDate()
// 周数据
this.getWeeklyData()
}
}
},
/**
......@@ -207,6 +232,96 @@ Component({
console.warn('[initDate] 未知 type:', type);
}
},
_hasInitConfig() {
const dim = Number(this.data.initTimeDimension)
if (![0, 1, 2].includes(dim)) return false
return true
},
_normalizeDateStr(input) {
if (!input) return ''
const str = String(input).trim().split(' ')[0]
const normalized = str.replace(/-/g, '/')
const d = dayjs(normalized)
return d.isValid() ? d.format('YYYY/MM/DD') : ''
},
_tryApplyInitConfig() {
if (this._hasAppliedInit) return
const dim = Number(this.data.initTimeDimension)
if (![0, 1, 2].includes(dim)) return
const timeTypeEnum = this.data.timeTypeEnum || {}
const timeType = timeTypeEnum[dim] || 'date'
const start = this._normalizeDateStr(this.data.initStartDate)
const end = this._normalizeDateStr(this.data.initEndDate)
if (dim === 1 && (!Array.isArray(this.data.weekColumns) || !this.data.weekColumns.length)) {
return
}
const nextData = {
dateCurrent: dim,
timeType
}
if (dim === 0) {
const base = start || end
if (base) {
const d = dayjs(base)
nextData.date = d.format('YYYY/MM/DD')
nextData.currentDate = d.valueOf()
} else {
const now = dayjs()
nextData.date = now.format('YYYY/MM/DD')
nextData.currentDate = now.valueOf()
}
}
if (dim === 2) {
const base = start || end
if (base) {
const d = dayjs(base)
nextData.date = d.format('YYYY/MM')
nextData.currentDate = d.valueOf()
} else {
const now = dayjs()
nextData.date = now.format('YYYY/MM')
nextData.currentDate = now.valueOf()
}
}
if (dim === 1) {
const weekColumns = this.data.weekColumns || []
const target = weekColumns.find(i => i.startDate === start && i.endDate === end) || weekColumns[0]
if (target) {
nextData.currentWeek = target
nextData.date = `${target.startDate}-${target.endDate}`
nextData.defaultIndex = target.index
nextData.rightCurrent = target.index === 0
nextData.leftCurrent = target.index === weekColumns.length - 1
}
}
if (dim === 0) {
const today = dayjs().startOf('day')
const min = dayjs(this.data.minDate).startOf('day')
const sel = dayjs(nextData.date).startOf('day')
nextData.rightCurrent = sel.isSame(today, 'day')
nextData.leftCurrent = sel.isSame(min, 'day')
}
if (dim === 2) {
const current = dayjs().startOf('month')
const min = dayjs(this.data.minDate).startOf('month')
const sel = dayjs(nextData.date)
nextData.rightCurrent = sel.isSame(current, 'month')
nextData.leftCurrent = sel.isSame(min, 'month')
}
this._hasAppliedInit = true
this.setData(nextData, () => {
this.triggerEvent('search', this.getParams())
})
},
onDisplayDate() {
const { timeType, date, currentDate } = this.data
if (timeType == 'custom') {
......@@ -233,7 +348,7 @@ Component({
wx.nextTick(() => {
if (timeType == 'date' && currentObj) {
const c_value = currentObj.getValues()
const _date = date.split('-')
const _date = String(date).split(/[/-]/)
if (c_value[0] != _date[0] || c_value[1] != _date[1] || c_value[2] != _date[2]) {
const picker = this.selectComponent("#datePicker")
this.setData({
......@@ -246,7 +361,7 @@ Component({
}
} else if (timeType == 'year-month'&& currentObj) {
const c_value = currentObj.getValues()
const _date = date.split('-')
const _date = String(date).split(/[/-]/)
if (c_value[0] != _date[0] || c_value[1] != _date[1]) {
const picker = this.selectComponent("#datePicker")
this.setData({
......
......@@ -23,7 +23,7 @@ const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion;
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = true;
const manual = false;
const release = false;
// 判断小程序环境
......
......@@ -48,7 +48,6 @@ Page({
if (options.id) {
this.getDetail(options.id)
} else {
console.log(options)
this.setData({
'orderObj.storeManagerName': options.storeManagerName,
'orderObj.storeManagerPhone': options.storeManagerPhone,
......
......@@ -10,6 +10,18 @@ Component({
},
selectedMerchantObj: {
type: Object
},
initTimeDimension: {
type: Number,
value: -1
},
initStartDate: {
type: String,
value: ''
},
initEndDate: {
type: String,
value: ''
}
},
data: {
......@@ -82,6 +94,12 @@ Component({
}, () => {
this.getData()
})
this.triggerEvent('datesave', {
scope: 'behaviorAnalysis',
timeDimension: e.detail.timeDimension,
startDate: e.detail.startDay,
endDate: e.detail.endDay
}, { bubbles: true, composed: true })
},
safeObjectToLabelList(obj) {
if (!obj || typeof obj !== 'object') {
......
<view class="behavior-analysis">
<view class="date">
<date-screen bind:search="search" customBackground="#F7F8FA"></date-screen>
<date-screen bind:search="search" customBackground="#F7F8FA" initTimeDimension="{{initTimeDimension}}" initStartDate="{{initStartDate}}" initEndDate="{{initEndDate}}"></date-screen>
</view>
<view class="merchant-change" bind:tap="handleChangeMerchant">
<image src="{{IMG_URL}}analyse-merchant-icon.png" mode=""/>
......
......@@ -249,6 +249,18 @@ Component({
},
selectedMerchantObj: {
type: Object
},
initTimeDimension: {
type: Number,
value: -1
},
initStartDate: {
type: String,
value: ''
},
initEndDate: {
type: String,
value: ''
}
},
data: {
......@@ -288,6 +300,12 @@ Component({
}, () => {
this.refreshViewModel()
})
this.triggerEvent('datesave', {
scope: 'personalPerformance',
timeDimension: e.detail.timeDimension,
startDate: e.detail.startDay,
endDate: e.detail.endDay
}, { bubbles: true, composed: true })
},
openHelp(e) {
this._helpDialogSeq = (this._helpDialogSeq || 0) + 1
......
<view class="personal-performance">
<view class="date">
<date-screen id="dateScreen" bind:search="onDateSearch" customBackground="#F7F8FA"></date-screen>
<date-screen id="dateScreen" bind:search="onDateSearch" customBackground="#F7F8FA" initTimeDimension="{{initTimeDimension}}" initStartDate="{{initStartDate}}" initEndDate="{{initEndDate}}"></date-screen>
</view>
<view class="merchant-change" bind:tap="handleChangeMerchant">
<image src="{{IMG_URL}}analyse-merchant-icon.png" mode=""/>
......
......@@ -7,6 +7,18 @@ Component({
type: Object,
value: {},
},
initTimeDimension: {
type: Number,
value: -1
},
initStartDate: {
type: String,
value: ''
},
initEndDate: {
type: String,
value: ''
},
},
data: {
IMG_URL,
......@@ -37,6 +49,10 @@ Component({
_isLatestTopRequest(seq) {
return seq === this._topReqSeq
},
reloadData() {
this.getData()
this.getStaticsData()
},
search(e) {
this.setData({
startDate: e.detail.startDay?.replace(/\//g, '-'),
......@@ -45,6 +61,12 @@ Component({
this.getData()
this.getStaticsData()
})
this.triggerEvent('datesave', {
scope: 'trainingExperience',
timeDimension: e.detail.timeDimension,
startDate: e.detail.startDay,
endDate: e.detail.endDay
}, { bubbles: true, composed: true })
},
getStaticsData() {
const seq = this._beginTopRequest()
......
<view class="training-experience">
<view class="date">
<date-screen bind:search="search"></date-screen>
<date-screen bind:search="search" initTimeDimension="{{initTimeDimension}}" initStartDate="{{initStartDate}}" initEndDate="{{initEndDate}}"></date-screen>
</view>
<view class="stats">
......
......@@ -10,6 +10,9 @@ Page({
IMG_URL,
navBarHeight: 84,
isFooterHidden: false,
personalPerformanceDate: {},
behaviorAnalysisDate: {},
trainingExperienceDate: {},
AIContent: '',
detailInfo: {},
detailItems: [{
......@@ -55,16 +58,43 @@ Page({
isFooterHidden: !!e?.detail?.visible
})
},
onDateSave(e) {
const { scope, timeDimension, startDate, endDate } = e?.detail || {}
if (!scope) return
const next = { timeDimension, startDate, endDate }
if (scope === 'personalPerformance') {
this.setData({ personalPerformanceDate: next })
return
}
if (scope === 'behaviorAnalysis') {
this.setData({ behaviorAnalysisDate: next })
return
}
if (scope === 'trainingExperience') {
this.setData({ trainingExperienceDate: next })
return
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (options.query) {
let query = JSON.parse(options.query)
let query = {}
try {
const decoded = decodeURIComponent(options.query || '')
query = JSON.parse(decoded)
} catch (e) {
query = {}
}
console.log(query, '=========')
const { timeDimension, startDate, endDate } = query || {}
this.setData({
detailInfo: query
detailInfo: query,
personalPerformanceDate: { timeDimension, startDate, endDate },
behaviorAnalysisDate: { timeDimension, startDate, endDate },
trainingExperienceDate: { timeDimension, startDate, endDate },
})
// 获取个人基础数据信息
this.getBaseData(query)
......@@ -87,6 +117,10 @@ Page({
*/
onShow() {
wx.$track.setTrackData(0, `supervisor_personal_dashboard_detail`, {}, '')
if (this.data.tabIndex == 3) { // 发起带教后返回在培训经历tab刷新数据
const comp = this.selectComponent('#training')
if (comp && comp.reloadData) comp.reloadData()
}
},
getTranferLog() {
......@@ -160,9 +194,23 @@ Page({
// 接待录音
handleRecording() {
wx.$track.setTrackData(0, `supervisor_reception_recording`, {}, '')
let { baseInfo, selectedMerchantObj, detailInfo } = this.data
let { baseInfo, selectedMerchantObj, detailInfo, tabIndex } = this.data
let query = {
storeManagerName: baseInfo.name,
gender: baseInfo.gender,
storeManagerPhone: baseInfo.phone,
entryDate: baseInfo.entryDate || '',
business: baseInfo.business || '',
selectedMerchantId: selectedMerchantObj.merchantId,
scene: detailInfo.scene,
employeeId: selectedMerchantObj.employeeId,
timeDimension: detailInfo.timeDimension,
startDate: detailInfo.startDate,
endDate: detailInfo.endDate
}
const encoded = encodeURIComponent(JSON.stringify(query))
wx.navigateTo({
url: `/packageCrew/pages/receptionRecording/receptionRecording?storeManagerName=${baseInfo.name}&gender=${baseInfo.gender}&storeManagerPhone=${baseInfo.phone}&entryDate=${baseInfo.entryDate}&business=${baseInfo.business}&selectedMerchantId=${selectedMerchantObj.merchantId}&scene=${detailInfo.scene}&employeeId=${selectedMerchantObj.employeeId}`,
url: `/packageCrew/pages/receptionRecording/receptionRecording?query=${encoded}`,
})
},
......@@ -171,7 +219,7 @@ Page({
wx.$track.setTrackData(0, `supervisor_start_mentoring`, {}, '')
let { baseInfo } = this.data
wx.navigateTo({
url: `/packageCrew/pages/mentoring/mentoring?storeManagerName=${baseInfo.name}&gender=${baseInfo.gender}&storeManagerPhone=${baseInfo.phone}&entryDate=${baseInfo.entryDate}&business=${baseInfo.business}`,
url: `/packageCrew/pages/mentoring/mentoring?storeManagerName=${baseInfo.name}&gender=${baseInfo.gender}&storeManagerPhone=${baseInfo.phone}&entryDate=${baseInfo.entryDate || ''}&business=${baseInfo.business || ''}`,
})
},
// 调店记录
......
......@@ -23,9 +23,9 @@ page{
}
.content {
border-radius: 24rpx 24rpx 0 0;
background: #FFFFFF;
margin-top: 24rpx;
.top-box {
background: #FFFFFF;
padding: 32rpx;
border-bottom: 2rpx solid #f2f3f7;
.name {
......@@ -80,6 +80,9 @@ page{
}
}
}
.tab-box {
background: #FFFFFF;
}
}
.isFullSucreen-btn {
padding-bottom: 34px !important;
......
......@@ -36,9 +36,9 @@
</view>
<view class="tab-content">
<basic-info wx:if="{{tabIndex === 0}}" baseInfo="{{baseInfo}}" />
<personal-performance wx:if="{{tabIndex === 1}}" detailInfo="{{detailInfo}}" merchantList="{{merchantList}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" />
<behavior-analysis wx:if="{{tabIndex === 2}}" detailInfo="{{detailInfo}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" />
<training-experience wx:if="{{tabIndex === 3}}" detailInfo="{{detailInfo}}" bindpopupvisible="onDatePopupVisible" />
<personal-performance wx:if="{{tabIndex === 1}}" detailInfo="{{detailInfo}}" merchantList="{{merchantList}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{personalPerformanceDate.timeDimension}}" initStartDate="{{personalPerformanceDate.startDate}}" initEndDate="{{personalPerformanceDate.endDate}}" />
<behavior-analysis wx:if="{{tabIndex === 2}}" detailInfo="{{detailInfo}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{behaviorAnalysisDate.timeDimension}}" initStartDate="{{behaviorAnalysisDate.startDate}}" initEndDate="{{behaviorAnalysisDate.endDate}}" />
<training-experience id="training" wx:if="{{tabIndex === 3}}" detailInfo="{{detailInfo}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{trainingExperienceDate.timeDimension}}" initStartDate="{{trainingExperienceDate.startDate}}" initEndDate="{{trainingExperienceDate.endDate}}" />
<view style="width: 100%;height: 200rpx;"></view>
</view>
</view>
......
......@@ -10,6 +10,10 @@ Page({
data: {
IMG_URL,
detailInfo: {},
initTimeDimension: -1,
initStartDate: '',
initEndDate: '',
dateReady: false,
detailItems: [{
label: '手机号码',
key: 'storeManagerPhone'
......@@ -41,8 +45,19 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let query = {}
try {
const decoded = decodeURIComponent(options.query || '')
query = JSON.parse(decoded)
} catch (e) {
query = {}
}
this.setData({
detailInfo: options
detailInfo: query,
initTimeDimension: Number(query?.timeDimension ?? query?.dateType ?? -1),
initStartDate: query?.startDate || '',
initEndDate: query?.endDate || '',
dateReady: true
})
},
......@@ -74,6 +89,7 @@ Page({
},
getReceptionList() {
const seq = (this._reqSeq = (this._reqSeq || 0) + 1)
let { pageNum, startStr, endStr, detailInfo, nothing } = this.data
let params = {
employeeId: detailInfo.employeeId,
......@@ -87,6 +103,7 @@ Page({
if (nothing) return
wx.$util.showLoading()
getRecordingList(params).then(res => {
if (seq !== this._reqSeq) return
wx.$util.hideLoading()
let { code, data, message } = res
if (code == 0) {
......@@ -125,6 +142,7 @@ Page({
wx.$util.showToast(message)
}
}).catch(() => {
if (seq !== this._reqSeq) return
wx.$util.hideLoading()
})
},
......
......@@ -44,7 +44,7 @@
</view>
</view>
<view class="date">
<date-screen bind:search="search" customBackground="#F7F8FA"></date-screen>
<date-screen wx:if="{{dateReady}}" bind:search="search" customBackground="#F7F8FA" initTimeDimension="{{initTimeDimension}}" initStartDate="{{initStartDate}}" initEndDate="{{initEndDate}}"></date-screen>
</view>
<view class="grid grid-3">
<view class="grid-item" wx:for="{{staticsItems}}" wx:key="label">
......
......@@ -26,7 +26,7 @@ Page({
const record = JSON.parse(options.record)
this.setData({
record,
title: `${dayjs(record.receptionTime).format('M月D日')}${record.recordemployeeName}接待`,
title: `${dayjs(record.receptionTime).format('M月D日')}${record.salesName}接待`,
}, () => {
wx.$util.getViewInfo('.reception-wrap', ({
height
......
<!--packageCrew/pages/recordingDetail/recordingDetail.wxml-->
<glsx-privacy appletName="嘀加门店管理助手" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showBack="true" navStyle="{{'background-color: rgba(0,0,0,0);box-shadow:none;' }}" bindback="back">
<view class="navigation-title text-hide ">{{record.staticDate}}{{record.employeeName}}接待</view>
<view class="navigation-title text-hide ">{{title}}</view>
</navigation-bar>
<view class="bg"></view>
<view class="reception-wrap" style="padding-top:{{ navBarHeight }}px;position: relative;">
......
......@@ -269,8 +269,9 @@ Page({
endDate: endStr,
timeDimension: timeDimension
}
const encoded = encodeURIComponent(JSON.stringify(query))
wx.navigateTo({
url: `/packageCrew/pages/peopleOverview/peopleOverview?query=${JSON.stringify(query)}`,
url: `/packageCrew/pages/peopleOverview/peopleOverview?query=${encoded}`,
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!