Commit 74c57688 by zhangxw

接待记录交互优化

1 parent 52d08e51
......@@ -203,7 +203,7 @@ class Calendar {
range(e) {
const _this = this[_CalendarObject_]
let { index, data, ind } = e.currentTarget.dataset
let { allowSameDay, showConfirm, monthList, rangeDate, maxDayRange } = _this.data
let { allowSameDay, showConfirm, monthList, rangeDate, maxDayRange, maxDayRangeType } = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({
......@@ -215,7 +215,18 @@ class Calendar {
rangeDate.end = ''
} else {
if (!allowSameDay && Date.parse(data) == Date.parse(rangeDate.start)) return
if (maxDayRange && Date.parse(data) > (Date.parse(rangeDate.start) + (maxDayRange - 1) * 24 * 60 * 60 * 1000)) return wx.showToast({title: `选择天数不能超过${maxDayRange}天`, icon: 'none'})
if (maxDayRangeType == 'day') {
if (Date.parse(data) > (Date.parse(rangeDate.start) + (maxDayRange - 1) * 24 * 60 * 60 * 1000)) return wx.showToast({title: `选择范围不能超过${maxDayRange}天`, icon: 'none'})
}
if (maxDayRangeType == 'month') {
let start = new Date(rangeDate.start)
let end = new Date(data)
let months = (end.getFullYear() - start.getFullYear()) * 12 + (end.getMonth() - start.getMonth())
if (start.getDate() > end.getDate()) {
months--
}
if (months >= maxDayRange) return wx.showToast({title: `选择范围不能超过${maxDayRange}个月`, icon: 'none'})
}
monthList[index].data[ind].active = true
monthList[index].data[ind].end = true
rangeDate.end = data
......
......@@ -83,7 +83,8 @@ export default {
/**隐藏水印 */
hideMark: Boolean,
isComponents: Boolean,
maxDayRange: Number // 最大可选天数范围
maxDayRange: Number, // 最大可选范围长度
maxDayRangeType: String // 最大可选范围类型
// dataDateStr: {
// type: String,
// observer: function (n) {
......
......@@ -16,11 +16,22 @@ var filterMerchantName = function (list) {
return list.join(',')
}
var isShowEmpty = function (listData) {
var listDataLength = 0
for (var i = 0; i < listData.length; i++) {
var curr = listData[i]
listDataLength += curr.receptionStaticInfoDTOList ? curr.receptionStaticInfoDTOList.length : 0
}
console.log(listDataLength > 0)
return listDataLength > 0
}
/*
* 导出
*/
module.exports = {
replaceItemText: replaceItemText,
isIncludesItem: isIncludesItem,
filterMerchantName: filterMerchantName
filterMerchantName: filterMerchantName,
isShowEmpty: isShowEmpty
}
......@@ -52,7 +52,7 @@
<order-no-popup wx:if="{{ tipsProps }}" show="{{ tipsProps }}" title="请选择支付订单号" bind:success="navigator" orderNoList="{{ orderNoList }}" />
<page-container show="{{ show_order_confirm || show_reception_confirm }}" duration="{{ 0 }}" overlay="{{ false }}" bind:afterleave="containerBack">
<view wx:if="{{ showReceptionRendering }}">
<reception-screen show="{{ show_reception_confirm }}" userInfo="{{ userInfo }}" isFilterUpgrade="{{isFilterUpgrade}}" isFilterDefeat="{{isFilterDefeat}}" navBarHeight="{{ navBarHeight }}" bindconfirm="searchScreen" />
<reception-screen show="{{ show_reception_confirm }}" userInfo="{{ userInfo }}" dateTime="{{dateTime}}" isFilterUpgrade="{{isFilterUpgrade}}" isFilterDefeat="{{isFilterDefeat}}" maxDayRange="{{7}}" maxDayRangeType="day" navBarHeight="{{ navBarHeight }}" bindconfirm="searchScreen" />
</view>
<view wx:if="{{ showOrderRendering }}">
<order-screen show="{{ show_order_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" status="{{ orderStatus }}" bindconfirm="searchScreen" />
......
......@@ -28,7 +28,9 @@ Component({
}
},
isFilterDefeat: Boolean,
isFilterUpgrade: Boolean
isFilterUpgrade: Boolean,
maxDayRange: Number,
maxDayRangeType: String
},
/**
......@@ -315,8 +317,10 @@ Component({
obj['staffUuids'] = arr
}
// 日期
obj.startDateTime = startDateTime || '',
obj.endDateTime = endDateTime || ''
if (e == 'dateTime') {
obj.startDateTime = startDateTime || '',
obj.endDateTime = endDateTime || ''
}
// 质检分数
if (e == 'scoreList') {
let qualityCheckScore = ['', [0, 20], [21, 50], [51, 80], [81, 100]]
......
......@@ -7,7 +7,7 @@
日期
</view>
<view class="list-box" wx:for="{{form.dateTime}}" wx:key="index">
<calendar allowSameDay maxDayRange="7" shortcut bindselect='rangeSelect' id="orderCalendar" data-index="{{index}}" data-name="dateTime" dateType='range' calenderColor='#347BFF'
<calendar allowSameDay maxDayRange="{{maxDayRange}}" maxDayRangeType="{{maxDayRangeType}}" shortcut bindselect='rangeSelect' id="orderCalendar" data-index="{{index}}" data-name="dateTime" dateType='range' calenderColor='#347BFF'
vertical minDate="2020-10-01" maxDate="{{maxDate}}" minDate="2024-01-01" isComponents>
</calendar>
<view style="display: flex;align-items: center;width: 100%;">
......
......@@ -9,20 +9,29 @@ Component({
record: {
type: Object,
observer: function (params) {
let { timelineWidth } = this.data
const totalMinutes = params.totalDuration / 1000
let _this = this
_this.calculatePositions(params)
let query = wx.createSelectorQuery().in(_this)
query.select(`.line-status`).boundingClientRect()
query.exec(function(res){
const timelineWidth = res?.[0]?.width - 32; // 时间轴宽度
const totalMinutes = params.totalDuration / 1000 // 时间跨度 (秒数)
// if (params.receptionStaticInfoDetailDTOList) { // 质检环节
if (!timelineWidth) {
let query = wx.createSelectorQuery().in(_this)
query.select(`.line-status`).boundingClientRect()
query.exec(function(res){
timelineWidth = res?.[0]?.width - 32; // 时间轴宽度
_this.setData({timelineWidth})
// 质检环节
_this.getProcess(params.receptionStaticInfoDetailDTOList, timelineWidth, totalMinutes)
// }
if (params.receptionStaticInfoODDetailDTOList) { // 攻防点
_this.getDefensePoints(params.receptionStaticInfoODDetailDTOList, timelineWidth, totalMinutes)
}
})
} else {
// 质检环节
_this.getProcess(params.receptionStaticInfoDetailDTOList, timelineWidth, totalMinutes)
if (params.receptionStaticInfoODDetailDTOList) { // 攻防点
_this.getDefensePoints(params.receptionStaticInfoODDetailDTOList, timelineWidth, totalMinutes)
}
})
}
}
}
},
......@@ -32,7 +41,8 @@ Component({
*/
data: {
contantsData,
itemInfo: {}
itemInfo: {},
timelineWidth: 0
},
/**
......@@ -70,7 +80,7 @@ Component({
events?.forEach((event, index) => {
event.stage = event.stage.replace('环节', '')
event.width = this.getWidth(event, totalMinutes, timelineWidth)
event.left = Math.ceil(Math.min(...event.mergedOffset) / totalMinutes * timelineWidth)
event.left = event.mergedOffset && Math.ceil(Math.min(...event.mergedOffset) / totalMinutes * timelineWidth)
if (index == (events?.length - 1) && event.left > (timelineWidth - event.width)) { // 最后的质检环节
event.left = (timelineWidth - event.width)
}
......@@ -112,7 +122,7 @@ Component({
})
},
getWidth(item, totalMinutes, timelineWidth) {
let diff = Math.max(...item.mergedOffset) - Math.min(...item.mergedOffset)
let diff = item.mergedOffset && Math.max(...item.mergedOffset) - Math.min(...item.mergedOffset)
let width = Math.ceil(diff / totalMinutes * timelineWidth)
let minWidth = item.stage?.length == 3 ? 56 : item.stage?.length == 4 ? 72 : 44 // 根据质检环节最小宽度
let filterWidth = width > minWidth ? width : minWidth // 最小宽度
......
......@@ -219,6 +219,7 @@
align-items: center;
justify-content: space-between;
position: relative;
color: #757980;
margin-top: var(--fontSize10);
.line{
width: 100%;
......@@ -230,8 +231,9 @@
transform: translateY(-50%);
}
.time-bt{
background: #FFFFFF;
background: #FAFAFA;
border-radius: var(--fontSize28);
font-size: var(--fontSize20);
z-index: 10;
&.pad-4{
padding: 0 var(--fontSize8);
......
......@@ -359,19 +359,19 @@ Component({
});
},
// 接待记录查询条件
getParams(index) {
getParams() {
let { searchForm, isFilterDefeat, isFilterUpgrade, storeRangeList } = this.data
let userInfo = wx.$util.getUserInfo() || {};
let endDayNum = index > 1 ? (index - 1) * 7 : 0
let startDayNum = index > 1 ? index * 7 - 1 : index * 6
// 获取当前时间的时间戳
let timestamp = new Date().getTime()
let sevenDaysAgoTimestamp = timestamp - startDayNum * 24 * 60 * 60 * 1000
let sevenDaysAgoDate = new Date(sevenDaysAgoTimestamp).format('yyyy-MM-dd')
searchForm.orderResult = (isFilterDefeat ? [2] : []).concat(isFilterUpgrade ? [1] : [])
let sevenDaysAgoTimestamp = timestamp - 6 * 24 * 60 * 60 * 1000
let sevenDaysAgoDate = new Date().format('yyyy-MM-dd')
if (!searchForm.orderResult?.length) searchForm.orderResult = (isFilterDefeat ? [2] : []).concat(isFilterUpgrade ? [1] : [])
let obj = {
startDateTime: searchForm?.startDateTime || sevenDaysAgoDate,
endDateTime: searchForm?.endDateTime || new Date(timestamp - endDayNum * 24 * 60 * 60 * 1000).format('yyyy-MM-dd'),
// startDateTime: searchForm?.startDateTime || new Date(sevenDaysAgoTimestamp).format('yyyy-MM-dd'),
// endDateTime: searchForm?.endDateTime || sevenDaysAgoDate,
startDateTime: '2024-06-01',
endDateTime: '2024-06-09',
customerName: searchForm?.customerName || '',
qualityCheckScoreBegin: searchForm?.qualityCheckScoreBegin,
qualityCheckScoreEnd: searchForm?.qualityCheckScoreEnd,
......@@ -521,7 +521,7 @@ Component({
},
// 获取接待记录统计数据
getReceptionList() {
let params = this.getParams(1)
let params = this.getParams()
getReceptionRecordList({
merchantNo: params.merchantNo,
startDateTime: params.startDateTime,
......@@ -550,7 +550,7 @@ Component({
let { pageNum, listData, nothing } = this.data
let params = {
pageNum,
...this.getParams(1)
...this.getParams()
}
if (nothing) return // 进获取近七天数据
getRecordDetailList(params).then(res => {
......
......@@ -515,15 +515,13 @@ swiper{
height: var(--fontSize72);
line-height: var(--fontSize72);
padding: var(--fontSize16);
background: #F7F8FA;
&.sticky-date-section{
position: sticky;
top: var(--fontSize80);
left: 0;
z-index: 1000;
}
&.bg-white{
background: #FFFFFF;
}
.date {
font-size: var(--fontSize28);
color: #292D33;
......
......@@ -102,11 +102,11 @@
</block>
</view> -->
</view>
<view class="receive-list {{isSticky ? 'minh100' :''}}" wx:if="{{storeRangeList.length}}">
<view class="receive-list" wx:if="{{storeRangeList.length}}">
<view class="'screen-box' {{showScreen ? '' : 'sticky-screen'}} {{isScrollTop ? 'bg-white' : ''}}">
<view>
<text class="title">接待记录</text>
<text class="name text-hide">{{searchForm.merchantNames.length ? filter.filterMerchantName(searchForm.merchantNames) : !userInfo.isSuper ? userInfo.default4SStoreInfo.merchantName : ''}}</text>
<text class="name text-hide">{{searchForm.merchantNames.length > 1 ? '部分门店' : searchForm.merchantNames.length ? filter.filterMerchantName(searchForm.merchantNames) : !userInfo.isSuper ? userInfo.default4SStoreInfo.merchantName : '全部门店'}}</text>
</view>
<view bindtap="showScreenPop">
<text class="text">筛选</text>
......@@ -115,7 +115,7 @@
</view>
<view class="list-box">
<block wx:for="{{listData}}" wx:key="date" wx:if="{{item.receptionStaticInfoDTOList.length}}">
<view class="date-section {{showScreen ? '' : 'sticky-date-section'}} {{isScrollTop ? 'bg-white' : ''}}">
<view class="date-section {{showScreen ? '' : 'sticky-date-section'}}">
<text class="date">{{item.staticDateStr}}</text>
<text class="summary-item">交付量 {{item.deliveryVolume}}</text>
<text class="line"></text>
......
......@@ -13,8 +13,8 @@ Page({
scrollTop: 0,
listData: [],
pageNum: 1,
staticPage: 1,
searchForm: {}
searchForm: {},
nothing: false
},
/**
......@@ -23,6 +23,9 @@ Page({
onLoad(options) {
let userInfo = wx.$util.getUserInfo() || {}
// 超管获取所有质检门店/员工
this.setData({
nothing: false
})
if (userInfo?.isSuper) {
this.getStoreList()
} else {
......@@ -47,28 +50,22 @@ Page({
}
})
},
getParams(index) {
getParams() {
let { searchForm, isFilterDefeat, isFilterUpgrade, storeRangeList } = this.data
let userInfo = wx.$util.getUserInfo() || {};
let endDayNum = index > 1 ? (index - 1) * 7 : 0
let startDayNum = index > 1 ? index * 7 - 1 : index * 6
// 获取当前时间的时间戳
let timestamp = new Date().getTime()
let sevenDaysAgoTimestamp = timestamp - startDayNum * 24 * 60 * 60 * 1000
let sevenDaysAgoDate = new Date(sevenDaysAgoTimestamp).format('yyyy-MM-dd')
searchForm.orderResult = (isFilterDefeat ? [2] : []).concat(isFilterUpgrade ? [1] : []);
const now = new Date();
const threeMonthsAgo = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate() - 1)
if (!searchForm.orderResult?.length) searchForm.orderResult = (isFilterDefeat ? [2] : []).concat(isFilterUpgrade ? [1] : [])
let obj = {
startDateTime: searchForm?.startDateTime || sevenDaysAgoDate,
endDateTime: searchForm?.endDateTime || new Date(timestamp - endDayNum * 24 * 60 * 60 * 1000).format('yyyy-MM-dd'),
// startDateTime: '2024-06-02',
// endDateTime: '2024-06-08',
startDateTime: searchForm?.startDateTime || new Date(threeMonthsAgo).format('yyyy-MM-dd'),
endDateTime: searchForm?.endDateTime || now.format('yyyy-MM-dd'),
customerName: searchForm?.customerName || '',
qualityCheckScoreBegin: searchForm?.qualityCheckScoreBegin || '',
qualityCheckScoreEnd: searchForm?.qualityCheckScoreEnd || '',
customerTypes: searchForm?.customerTypes,
carModels: searchForm?.carModels,
orderResult: searchForm?.orderResult,
merchantNo: userInfo?.isSuper && !searchForm?.merchantNo?.length ? storeRangeList.map(v => {if (v.merchantNo) return v.merchantNo}) : (searchForm?.merchantNo || [userInfo.default4SStoreInfo.merchantId]),
merchantNo: userInfo?.isSuper && !searchForm?.merchantNo?.length ? storeRangeList?.map(v => {if (v.merchantNo) return v.merchantNo}) : (searchForm?.merchantNo || [userInfo.default4SStoreInfo.merchantId]),
staffUuids: searchForm?.staffUuids
}
return obj
......@@ -109,9 +106,12 @@ Page({
isFilterDefeat: orderResult?.includes(2)
})
this.setData({
searchForm
searchForm,
nothing: false,
listData: []
}, () => {
this.getReceptionList()
})
this.getReceptionList()
this.containerBack();
},
......@@ -121,13 +121,15 @@ Page({
// 获取接待记录统计数据
getReceptionList() {
let { staticPage, listData } = this.data
let params = this.getParams(staticPage)
let { listData } = this.data
let params = this.getParams()
wx.$util.showLoading()
getReceptionRecordList({
merchantNo: params.merchantNo,
startDateTime: params.startDateTime,
endDateTime: params.endDateTime
}).then(res => {
wx.$util.hideLoading()
let { code, message, data } = res
if (code == 0) {
data?.forEach(val => {
......@@ -147,11 +149,12 @@ Page({
},
// 获取接待记录接待时间轴详情数据
getReceptionRecordDetailInfo() {
let { pageNum, listData, staticPage } = this.data
let { pageNum, listData, nothing } = this.data
let params = {
pageNum,
...this.getParams(staticPage)
...this.getParams()
}
if (nothing) return
getRecordDetailList(params).then(res => {
let { code, data, message } = res
if (code == 0) {
......@@ -160,21 +163,13 @@ Page({
if (val.staticDate == subV.staticDate) val.receptionStaticInfoDTOList.push(subV)
})
})
let listDataLength = listData.reduce((acc, curr) => acc + curr?.receptionStaticInfoDTOList?.length, 0)
this.setData({
listData,
pageNum: pageNum + 1,
triggered: false
triggered: false,
nothing: listDataLength == data?.total
})
let listDataLength = listData.reduce((acc, curr) => acc + curr?.receptionStaticInfoDTOList?.length, 0)
if (listDataLength < 5) { // 未铺满一屏 或
// 近七天数据加载完毕 继续加载上一个七天周期的数据
this.setData({
staticPage: staticPage + 1
})
setTimeout(() => {
this.getReceptionList()
}, 200)
}
} else {
wx.$util.showToast(message)
}
......@@ -183,14 +178,18 @@ Page({
// 过滤升级/战败接待记录数据
filterItemData(e) {
let { type } = e.currentTarget.dataset
if (type == 'upgrade') {
this.setData({
isFilterUpgrade: !this.data.isFilterUpgrade
})
} else {
this.setData({isFilterDefeat: !this.data.isFilterDefeat})
}
this.getReceptionList()
const keyMap = {
upgrade: 'isFilterUpgrade',
defeat: 'isFilterDefeat'
};
const key = keyMap[type] || 'isFilterDefeat'
this.setData({
[key]: !this.data[key],
nothing: false
}, () => {
this.getReceptionList()
})
},
// 触底加载更多
onBottomRefresh() {
......@@ -199,10 +198,11 @@ Page({
// 下拉刷新数据
refreshListData() {
this.setData({
staticPage: 1,
listData: []
listData: [],
nothing: false
}, () => {
this.getReceptionList()
})
this.getReceptionList()
},
goto(e){
let {record} = e.currentTarget.dataset
......
......@@ -55,14 +55,13 @@
height: var(--fontSize72);
line-height: var(--fontSize72);
padding: var(--fontSize16);
background: #F7F8FA;
position: sticky;
top: 0;
left: 0;
z-index: 1000;
&.sticky-date-section{
position: sticky;
top: 0;
left: 0;
z-index: 1000;
}
&.bg-white{
background: #FFFFFF;
}
.date {
font-size: var(--fontSize28);
......
/* packageEquity/pages/receptionRecords/receptionRecords.wxss */
\ No newline at end of file
......@@ -6,7 +6,7 @@
<block wx:else>
<navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showBack navStyle="{{'background-color: #FFFFFF;box-shadow:none;' }}" bindback="back">
<view class="navigation-title">
<view class="navigation-title-text text-hide">{{userInfo && userInfo.default4SStoreInfo && userInfo.default4SStoreInfo.merchantName}}</view>
<view class="navigation-title-text text-hide">{{userInfo && userInfo.isSuper ? '接待记录' : (userInfo.default4SStoreInfo && userInfo.default4SStoreInfo.merchantName)}}</view>
</view>
</navigation-bar>
</block>
......@@ -14,7 +14,7 @@
<view class="screen-box">
<view>
<text class="title">接待记录</text>
<text class="name text-hide">{{searchForm.merchantNames.length ? filter.filterMerchantName(searchForm.merchantNames) : !userInfo.isSuper ? userInfo.default4SStoreInfo.merchantName : ''}}</text>
<text class="name text-hide">{{searchForm.merchantNames.length > 1 ? '部分门店' : searchForm.merchantNames.length ? filter.filterMerchantName(searchForm.merchantNames) : !userInfo.isSuper ? userInfo.default4SStoreInfo.merchantName : '全部门店'}}</text>
</view>
<view bindtap="showScreenPop">
<text class="text">筛选</text>
......@@ -23,9 +23,9 @@
</view>
<scroll-view scroll-y class="list-box" enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="refreshListData" bindscrolltolower="onBottomRefresh" style="height: calc(100% - var(--fontSize80));" scroll-top="{{scrollTop}}" refresher-threshold="104" refresher-triggered="{{triggered}}">
<view class="box-content">
<block wx:if="{{listData.length}}">
<block wx:if="{{filter.isShowEmpty(listData)}}">
<block wx:for="{{listData}}" wx:key="date" wx:if="{{item.receptionStaticInfoDTOList.length}}">
<view class="date-section sticky-date-section bg-white">
<view class="date-section">
<text class="date">{{item.staticDate}}</text>
<text class="summary-item">交付量 {{item.summary.deliveries}}</text>
<text class="line"></text>
......@@ -47,12 +47,18 @@
</view>
</block>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing">到底了~</view>
</block>
</block>
<block wx:else>
<empty-data />
</block>
</view>
</scroll-view>
</view>
<page-container show="{{ show_reception_confirm }}" duration="{{ 0 }}" overlay="{{ false }}" bind:afterleave="containerBack">
<view wx:if="{{ showReceptionRendering }}">
<reception-screen show="{{ show_reception_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" bindconfirm="searchScreen" />
<reception-screen show="{{ show_reception_confirm }}" userInfo="{{ userInfo }}" maxDayRange="{{3}}" maxDayRangeType="month" navBarHeight="{{ navBarHeight }}" bindconfirm="searchScreen" />
</view>
</page-container>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!