Commit 40a184bf by 李伟康

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

1 parent 27caa73f
<template>
<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>
<!-- sceneType 1 轻改 0 延保 -->
<template v-if="userInfo.sceneType == 1">
<scroll-view
class="record-box boutique"
scroll-y
@scrolltolower="pageonReachBottom"
@scroll="scroll"
>
<view class="record-content">
<view class="data-box">
<template v-for="(i, index) in dataList">
<view
:class="['tab flex', { active: dateIndex == index }]"
:class="['data-item', i.type]"
: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>
<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="['data-tabs-box', { sticky: sticky }]">
<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>
<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="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="info flex"
:key="ind"
>
<view class="label">{{ k.label }}</view>
<view class="value">{{ item[k.key] || "-" }}</view>
</view>
......@@ -121,10 +101,151 @@
<template v-if="nothing">
<view class="end-text">到底了!</view>
</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 class="bottom-mask"></view>
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
......@@ -132,15 +253,16 @@ import dayjs from 'dayjs'
const dayImgUrl = require('@/assets/images/common/day.webp')
const weekImgUrl = require('@/assets/images/common/week.webp')
const monthImgUrl = require('@/assets/images/common/month.webp')
import utils from "@/utils/utils.js";
export default {
name: '',
props:{
userInfo: {
type: Object,
default: () => ({})
},
},
data () {
return {
sexType: {
'男': 'icon-male',
'女': 'icon-female'
},
dataList: [
{
label: '客户接待数',
......@@ -160,7 +282,7 @@ export default {
],
typeList: [
{ tabName: '已上传' },
{ tabName: '待上传',num:true },
{ tabName: '待上传', num: true },
],
firstIndex: 0,
firstLeft: ['0rpx', '352rpx', '756rpx'],
......@@ -177,7 +299,7 @@ export default {
{ label: '开始接待', key: 'startTime' },
{ label: '结束接待', key: 'endTime' },
],
recordFailList:[],
recordFailList: [],
dateIndex: 0,
pageNum: 1,
total: 0,
......@@ -203,38 +325,38 @@ export default {
this.direction = 'left'
}
this[name] = index
this.list=[]
this.list = []
this.pageNum = 1;
if(index == 0) {
this.changeIndex(this.dateIndex,true)
}else {
if (index == 0) {
this.changeIndex(this.dateIndex, true)
} else {
this.getRecordFail()
}
},
scroll (e) {
this.sticky = e.detail.scrollTop >= 148
},
getRecordNum() {
getRecordNum () {
let recordFailListAll = JSON.parse(uni.$storage.get("recordList") || "[]");
const { shopMerchantId,sceneType } = uni.$storage.get("userInfo");
let recordFailList = recordFailListAll.filter(i=>{
console.log(i.bussinessType,sceneType)
const { shopMerchantId, sceneType } = this.userInfo
let recordFailList = recordFailListAll.filter(i => {
console.log(i.bussinessType, sceneType)
return i.merchantId == shopMerchantId && i.bussinessType == (sceneType == 0 ? 1 : 2)
})
this.recordFailList = recordFailList
},
getRecordFail() {
getRecordFail () {
this.getRecordNum()
this.list[0] = this.recordFailList.map(i=>{
this.list[0] = this.recordFailList.map(i => {
return {
receptionStatus:i.receptionStatus,
phoneNumber:i.phoneNumber,
salesName:i.salesName,
customerName:i.customerName,
carModel:i.carModel,
duration:this.formatSeconds(new Date(i.receptionEndTime).getTime() - new Date(i.receptionStartTime).getTime()),
startTime: i.receptionStartTime.replace(/\//g,'.'),
endTime: i.receptionEndTime.replace(/\//g,'.')
receptionStatus: i.receptionStatus,
phoneNumber: i.phoneNumber,
salesName: i.salesName,
customerName: i.customerName,
carModel: i.carModel,
duration: this.formatSeconds(new Date(i.receptionEndTime).getTime() - new Date(i.receptionStartTime).getTime()),
startTime: i.receptionStartTime.replace(/\//g, '.'),
endTime: i.receptionEndTime.replace(/\//g, '.')
}
})
},
......@@ -256,8 +378,7 @@ export default {
try {
const { dateList } = this,
{ startTime, endTime } = dateList[index],
userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId, sceneType } = userInfo,
{ shopMerchantId, sceneType } = this.userInfo,
data = await uni.$api.commonApi.getReceptionStatistics({
merchantId: shopMerchantId,
startTime,
......@@ -281,8 +402,7 @@ export default {
})
const { dateList, dateIndex, pageNum, pageSize } = this,
{ startTime, endTime } = dateList[dateIndex],
userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId, sceneType } = userInfo,
{ shopMerchantId, sceneType } = this.userInfo,
{ list, total } = await uni.$api.commonApi.getReceptionList({
merchantId: shopMerchantId,
pageNum,
......@@ -299,7 +419,7 @@ export default {
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)
})
this.$set(this.list,pageNum - 1,list)
this.$set(this.list, pageNum - 1, list)
// this.list[pageNum - 1] = list
console.log(this.list)
this.flag = true
......@@ -331,7 +451,7 @@ export default {
return formattedTime
}
},
changeIndex (index,isType = false) {
changeIndex (index, isType = false) {
if (this.dateIndex == index && !isType) return
this.flag = false
this.nothing = false
......@@ -391,6 +511,7 @@ export default {
border-radius: 48rpx;
margin-top: 48rpx;
height: calc(100vh - 440rpx);
margin-right: 66rpx;
.type-box {
position: relative;
display: flex;
......@@ -441,8 +562,8 @@ export default {
.list {
display: flex;
flex-wrap: wrap;
gap: 48rpx 60rpx;
padding: 0rpx 64rpx 20rpx;
gap: 40rpx 44rpx;
padding: 0rpx 0 20rpx 64rpx;
.item {
width: 608rpx;
background: #ffffff;
......@@ -688,4 +809,77 @@ export default {
#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>
......@@ -85,7 +85,7 @@
</view>
</template>
<template v-else>
<record-list />
<record-list :userInfo="userInfo" />
</template>
<view class="store-addr">
<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!