Commit 40a184bf by 李伟康

commit 接待记录区分延保、轻改样式

1 parent 27caa73f
<template> <template>
<view class="record-box"> <view>
<view class="record-content"> <!-- sceneType 1 轻改 0 延保 -->
<view class="data-box"> <template v-if="userInfo.sceneType == 1">
<template v-for="(i, index) in dataList"> <scroll-view
<view :class="['data-item', i.type]" :key="index"> class="record-box boutique"
<image :src="i.icon" class="data-item-bg" /> scroll-y
<view class="title">{{ dateList[index].text }}</view> @scrolltolower="pageonReachBottom"
<view class="content"> @scroll="scroll"
<view class="total"> >
<view class="label">{{ i.label }}</view> <view class="record-content">
<view class="num-box"> <view class="data-box">
<view class="num">{{ i.count == null ? "-" : i.count }}</view> <template v-for="(i, index) in dataList">
</view>
</view>
<view class="duration">
<view class="label">平均接待时长</view>
<view class="num-box">
<view class="num">{{ i.minutes || "-" }}</view>
<view class="unit">分</view>
<view class="num"> {{ i.seconds || "-" }}</view>
<view class="unit">秒</view>
</view>
</view>
</view>
</view>
</template>
</view>
<view class="data-container">
<view :class="['type-box']">
<view
class="tab-item"
v-for="(i, index) in typeList"
:key="index"
@click="changeType(index, 'firstIndex')"
>
<view
class="sprite-icon"
:class="[
firstIndex == index ? `icon-${firstClass[index]} active` : '',
]"
:style="{ left: firstLeft[index] }"
></view>
<view class="text" :class="[firstIndex == index ? `active` : '']"
>{{ i.tabName
}}{{
i.num && recordFailList.length > 0
? `(${recordFailList.length})`
: ""
}}</view
>
</view>
</view>
<view class="tabs-bottom"></view>
<view v-if="firstIndex == 0" class="data-tabs-box">
<view class="data-tabs">
<template v-for="(i, index) in dateList">
<view <view
:class="['tab flex', { active: dateIndex == index }]" :class="['data-item', i.type]"
:key="index" :key="index"
@click="changeIndex(index)"
>{{ i.text }}</view
> >
<image
:src="i.icon"
class="data-item-bg"
/>
<view class="title">{{ dateList[index].text }}</view>
<view class="content">
<view class="total">
<view class="label">{{ i.label }}</view>
<view class="num-box">
<view class="num">{{ i.count == null ? "-" : i.count }}</view>
</view>
</view>
<view class="duration">
<view class="label">平均接待时长</view>
<view class="num-box">
<view class="num">{{ i.minutes || "-" }}</view>
<view class="unit">分</view>
<view class="num"> {{ i.seconds || "-" }}</view>
<view class="unit">秒</view>
</view>
</view>
</view>
</view>
</template> </template>
<view :class="['active-btn', `active-btn-${dateIndex}`]"></view>
</view> </view>
</view> <view :class="['data-tabs-box', { sticky: sticky }]">
<scroll-view <view class="data-tabs">
class="record-list" <template v-for="(i, index) in dateList">
:style="{ <view
height: :class="['tab flex', { active: dateIndex == index }]"
firstIndex == 0 ? 'calc(100% - 300rpx)' : 'calc(100% - 180rpx)', :key="index"
}" @click="changeIndex(index)"
scroll-y >{{ i.text }}</view>
@scrolltolower="pageonReachBottom" </template>
@scroll="scroll" <view :class="['active-btn', `active-btn-${dateIndex}`]"></view>
> </view>
</view>
<view class="list"> <view class="list">
<template v-if="flag"> <template v-if="flag">
<template v-if="list.length && list[0] && list[0].length"> <template v-if="list.length && list[0] && list[0].length">
<template v-for="i in list"> <template v-for="i in list">
<template v-for="item in i"> <template v-for="item in i">
<view class="item" :key="item.id"> <view
<view class="item"
:class="[ :key="item.id"
'status flex', >
{ deal: item.receptionStatus == 1 }, <view :class="[
]" 'status flex',
>{{ { deal: item.receptionStatus == 1 },
{ ]">{{
1: "成交", {
0: "战败", 1: "成交",
}[item.receptionStatus] 0: "战败",
}}</view }[item.receptionStatus]
> }}</view>
<view class="name"> <view class="name">
{{ item.customerName }} {{ item.customerName }}
</view> </view>
<view class="goods-name">{{ item.carModel }}</view> <view class="goods-name">{{ item.carModel }}</view>
<template v-for="(k, ind) in itemObject"> <template v-for="(k, ind) in itemObject">
<view class="info flex" :key="ind"> <view
class="info flex"
:key="ind"
>
<view class="label">{{ k.label }}</view> <view class="label">{{ k.label }}</view>
<view class="value">{{ item[k.key] || "-" }}</view> <view class="value">{{ item[k.key] || "-" }}</view>
</view> </view>
...@@ -121,10 +101,151 @@ ...@@ -121,10 +101,151 @@
<template v-if="nothing"> <template v-if="nothing">
<view class="end-text">到底了!</view> <view class="end-text">到底了!</view>
</template> </template>
</scroll-view> </view>
<view class="bottom-mask"></view>
</scroll-view>
</template>
<template v-else>
<view class="record-box">
<view class="record-content">
<view class="data-box">
<template v-for="(i, index) in dataList">
<view
:class="['data-item', i.type]"
:key="index"
>
<image
:src="i.icon"
class="data-item-bg"
/>
<view class="title">{{ dateList[index].text }}</view>
<view class="content">
<view class="total">
<view class="label">{{ i.label }}</view>
<view class="num-box">
<view class="num">{{ i.count == null ? "-" : i.count }}</view>
</view>
</view>
<view class="duration">
<view class="label">平均接待时长</view>
<view class="num-box">
<view class="num">{{ i.minutes || "-" }}</view>
<view class="unit">分</view>
<view class="num"> {{ i.seconds || "-" }}</view>
<view class="unit">秒</view>
</view>
</view>
</view>
</view>
</template>
</view>
<view class="data-container">
<view :class="['type-box']">
<view
class="tab-item"
v-for="(i, index) in typeList"
:key="index"
@click="changeType(index, 'firstIndex')"
>
<view
class="sprite-icon"
:class="[
firstIndex == index ? `icon-${firstClass[index]} active` : '',
]"
:style="{ left: firstLeft[index] }"
></view>
<view
class="text"
:class="[firstIndex == index ? `active` : '']"
>{{ i.tabName
}}{{
i.num && recordFailList.length > 0
? `(${recordFailList.length})`
: ""
}}</view>
</view>
</view>
<view class="tabs-bottom"></view>
<view
v-if="firstIndex == 0"
class="data-tabs-box"
>
<view class="data-tabs">
<template v-for="(i, index) in dateList">
<view
:class="['tab flex', { active: dateIndex == index }]"
:key="index"
@click="changeIndex(index)"
>{{ i.text }}</view>
</template>
<view :class="['active-btn', `active-btn-${dateIndex}`]"></view>
</view>
</view>
<scroll-view
class="record-list"
:style="{
height:
firstIndex == 0 ? 'calc(100% - 300rpx)' : 'calc(100% - 180rpx)',
}"
scroll-y
@scrolltolower="pageonReachBottom"
@scroll="scroll"
>
<view class="list">
<template v-if="flag">
<template v-if="list.length && list[0] && list[0].length">
<template v-for="i in list">
<template v-for="item in i">
<view
class="item"
:key="item.id"
>
<view :class="[
'status flex',
{ deal: item.receptionStatus == 1 },
]">{{
{
1: "成交",
0: "战败",
}[item.receptionStatus]
}}</view>
<view class="name">
{{ item.customerName }}
</view>
<view class="goods-name">{{ item.carModel }}</view>
<template v-for="(k, ind) in itemObject">
<view
class="info flex"
:key="ind"
>
<view class="label">{{ k.label }}</view>
<view class="value">{{ item[k.key] || "-" }}</view>
</view>
</template>
</view>
</template>
</template>
</template>
<template v-else>
<view class="nothing flex">
<image
class="icon"
src="../../../assets/images/home/nothing.webp"
/>
暂无接待记录
</view>
</template>
</template>
</view>
<template v-if="nothing">
<view class="end-text">到底了!</view>
</template>
</scroll-view>
</view>
<view class="bottom-mask"></view>
</view>
</view> </view>
<view class="bottom-mask"></view> </template>
</view>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -132,15 +253,16 @@ import dayjs from 'dayjs' ...@@ -132,15 +253,16 @@ import dayjs from 'dayjs'
const dayImgUrl = require('@/assets/images/common/day.webp') const dayImgUrl = require('@/assets/images/common/day.webp')
const weekImgUrl = require('@/assets/images/common/week.webp') const weekImgUrl = require('@/assets/images/common/week.webp')
const monthImgUrl = require('@/assets/images/common/month.webp') const monthImgUrl = require('@/assets/images/common/month.webp')
import utils from "@/utils/utils.js";
export default { export default {
name: '', name: '',
props:{
userInfo: {
type: Object,
default: () => ({})
},
},
data () { data () {
return { return {
sexType: {
'男': 'icon-male',
'女': 'icon-female'
},
dataList: [ dataList: [
{ {
label: '客户接待数', label: '客户接待数',
...@@ -160,7 +282,7 @@ export default { ...@@ -160,7 +282,7 @@ export default {
], ],
typeList: [ typeList: [
{ tabName: '已上传' }, { tabName: '已上传' },
{ tabName: '待上传',num:true }, { tabName: '待上传', num: true },
], ],
firstIndex: 0, firstIndex: 0,
firstLeft: ['0rpx', '352rpx', '756rpx'], firstLeft: ['0rpx', '352rpx', '756rpx'],
...@@ -177,7 +299,7 @@ export default { ...@@ -177,7 +299,7 @@ export default {
{ label: '开始接待', key: 'startTime' }, { label: '开始接待', key: 'startTime' },
{ label: '结束接待', key: 'endTime' }, { label: '结束接待', key: 'endTime' },
], ],
recordFailList:[], recordFailList: [],
dateIndex: 0, dateIndex: 0,
pageNum: 1, pageNum: 1,
total: 0, total: 0,
...@@ -203,38 +325,38 @@ export default { ...@@ -203,38 +325,38 @@ export default {
this.direction = 'left' this.direction = 'left'
} }
this[name] = index this[name] = index
this.list=[] this.list = []
this.pageNum = 1; this.pageNum = 1;
if(index == 0) { if (index == 0) {
this.changeIndex(this.dateIndex,true) this.changeIndex(this.dateIndex, true)
}else { } else {
this.getRecordFail() this.getRecordFail()
} }
}, },
scroll (e) { scroll (e) {
this.sticky = e.detail.scrollTop >= 148 this.sticky = e.detail.scrollTop >= 148
}, },
getRecordNum() { getRecordNum () {
let recordFailListAll = JSON.parse(uni.$storage.get("recordList") || "[]"); let recordFailListAll = JSON.parse(uni.$storage.get("recordList") || "[]");
const { shopMerchantId,sceneType } = uni.$storage.get("userInfo"); const { shopMerchantId, sceneType } = this.userInfo
let recordFailList = recordFailListAll.filter(i=>{ let recordFailList = recordFailListAll.filter(i => {
console.log(i.bussinessType,sceneType) console.log(i.bussinessType, sceneType)
return i.merchantId == shopMerchantId && i.bussinessType == (sceneType == 0 ? 1 : 2) return i.merchantId == shopMerchantId && i.bussinessType == (sceneType == 0 ? 1 : 2)
}) })
this.recordFailList = recordFailList this.recordFailList = recordFailList
}, },
getRecordFail() { getRecordFail () {
this.getRecordNum() this.getRecordNum()
this.list[0] = this.recordFailList.map(i=>{ this.list[0] = this.recordFailList.map(i => {
return { return {
receptionStatus:i.receptionStatus, receptionStatus: i.receptionStatus,
phoneNumber:i.phoneNumber, phoneNumber: i.phoneNumber,
salesName:i.salesName, salesName: i.salesName,
customerName:i.customerName, customerName: i.customerName,
carModel:i.carModel, carModel: i.carModel,
duration:this.formatSeconds(new Date(i.receptionEndTime).getTime() - new Date(i.receptionStartTime).getTime()), duration: this.formatSeconds(new Date(i.receptionEndTime).getTime() - new Date(i.receptionStartTime).getTime()),
startTime: i.receptionStartTime.replace(/\//g,'.'), startTime: i.receptionStartTime.replace(/\//g, '.'),
endTime: i.receptionEndTime.replace(/\//g,'.') endTime: i.receptionEndTime.replace(/\//g, '.')
} }
}) })
}, },
...@@ -256,8 +378,7 @@ export default { ...@@ -256,8 +378,7 @@ export default {
try { try {
const { dateList } = this, const { dateList } = this,
{ startTime, endTime } = dateList[index], { startTime, endTime } = dateList[index],
userInfo = uni.$storage.get("userInfo"), { shopMerchantId, sceneType } = this.userInfo,
{ shopMerchantId, sceneType } = userInfo,
data = await uni.$api.commonApi.getReceptionStatistics({ data = await uni.$api.commonApi.getReceptionStatistics({
merchantId: shopMerchantId, merchantId: shopMerchantId,
startTime, startTime,
...@@ -281,8 +402,7 @@ export default { ...@@ -281,8 +402,7 @@ export default {
}) })
const { dateList, dateIndex, pageNum, pageSize } = this, const { dateList, dateIndex, pageNum, pageSize } = this,
{ startTime, endTime } = dateList[dateIndex], { startTime, endTime } = dateList[dateIndex],
userInfo = uni.$storage.get("userInfo"), { shopMerchantId, sceneType } = this.userInfo,
{ shopMerchantId, sceneType } = userInfo,
{ list, total } = await uni.$api.commonApi.getReceptionList({ { list, total } = await uni.$api.commonApi.getReceptionList({
merchantId: shopMerchantId, merchantId: shopMerchantId,
pageNum, pageNum,
...@@ -299,7 +419,7 @@ export default { ...@@ -299,7 +419,7 @@ export default {
e.endTime = dayjs(e.receptionEndTime).format("YYYY.MM.DD HH:mm:ss") e.endTime = dayjs(e.receptionEndTime).format("YYYY.MM.DD HH:mm:ss")
e.phoneNumber = phoneNumber.slice(0, 3) + " " + phoneNumber.slice(3, 7) + " " + phoneNumber.slice(7) e.phoneNumber = phoneNumber.slice(0, 3) + " " + phoneNumber.slice(3, 7) + " " + phoneNumber.slice(7)
}) })
this.$set(this.list,pageNum - 1,list) this.$set(this.list, pageNum - 1, list)
// this.list[pageNum - 1] = list // this.list[pageNum - 1] = list
console.log(this.list) console.log(this.list)
this.flag = true this.flag = true
...@@ -331,7 +451,7 @@ export default { ...@@ -331,7 +451,7 @@ export default {
return formattedTime return formattedTime
} }
}, },
changeIndex (index,isType = false) { changeIndex (index, isType = false) {
if (this.dateIndex == index && !isType) return if (this.dateIndex == index && !isType) return
this.flag = false this.flag = false
this.nothing = false this.nothing = false
...@@ -391,6 +511,7 @@ export default { ...@@ -391,6 +511,7 @@ export default {
border-radius: 48rpx; border-radius: 48rpx;
margin-top: 48rpx; margin-top: 48rpx;
height: calc(100vh - 440rpx); height: calc(100vh - 440rpx);
margin-right: 66rpx;
.type-box { .type-box {
position: relative; position: relative;
display: flex; display: flex;
...@@ -441,8 +562,8 @@ export default { ...@@ -441,8 +562,8 @@ export default {
.list { .list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 48rpx 60rpx; gap: 40rpx 44rpx;
padding: 0rpx 64rpx 20rpx; padding: 0rpx 0 20rpx 64rpx;
.item { .item {
width: 608rpx; width: 608rpx;
background: #ffffff; background: #ffffff;
...@@ -688,4 +809,77 @@ export default { ...@@ -688,4 +809,77 @@ export default {
#e9f1fe 100% #e9f1fe 100%
); );
} }
.boutique {
height: 100vh;
.list {
display: flex;
flex-wrap: wrap;
gap: 48rpx 60rpx;
padding: 48rpx 0 0 0;
.item {
width: 640rpx;
background: #ffffff;
border-radius: 16rpx;
box-sizing: border-box;
padding: 24rpx 32rpx;
position: relative;
}
}
.data-tabs-box {
width: calc(100% + 120rpx);
transform: translateX(-60rpx);
padding-top: 80rpx;
.data-tabs {
display: flex;
justify-content: space-between;
width: 784rpx;
height: 70rpx;
border-radius: 370rpx;
margin: 0 auto;
position: relative;
background: transparent;
&::after {
position: absolute;
z-index: -2;
background: #ffffffb3;
width: 100%;
height: 100%;
border-radius: 370rpx;
left: 0;
top: 0;
content: "";
}
.tab {
width: 240rpx;
height: 70rpx;
justify-content: center;
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.active {
color: #ffffff;
}
.active-btn {
position: absolute;
width: 240rpx;
height: 70rpx;
background: #3b73ff;
border-radius: 360rpx;
top: 0;
z-index: -1;
transition: all 0.15s;
}
.active-btn-0 {
left: 0;
}
.active-btn-1 {
left: 272rpx;
}
.active-btn-2 {
left: 544rpx;
}
}
}
}
</style> </style>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<record-list /> <record-list :userInfo="userInfo" />
</template> </template>
<view class="store-addr"> <view class="store-addr">
<view class="icon-addr sprite-icon icon-addr"></view> <view class="icon-addr sprite-icon icon-addr"></view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!