218 lines
4.6 KiB
Vue
218 lines
4.6 KiB
Vue
<template>
|
|
<view class="content">
|
|
<!-- tabs -->
|
|
<view class="tabs">
|
|
<view class="item" :class="{'show': tabsIndex == 'day'}" @click="onTbas('day')">日成交</view>
|
|
<view class="item" :class="{'show': tabsIndex == 'month'}" @click="onTbas('month')">月成交</view>
|
|
<view class="item" :class="{'show': tabsIndex == 'year'}" @click="onTbas('year')">年成交</view>
|
|
</view>
|
|
<!-- 统计信息 -->
|
|
<view class="statistics">
|
|
<picker mode="date" :fields="tabsIndex" :value="dateValue" :end="endDate" @change="pickerDate">
|
|
<view class="statistics-date">
|
|
{{dateValue}}<uni-icons class="arrowdown" type="arrowdown" color="#555"></uni-icons>
|
|
</view>
|
|
</picker>
|
|
<view class="statistics-text">
|
|
<text>成交客户量 {{visitor.day}} 人</text>
|
|
<text>累计访客量 {{visitor.all}} 人</text>
|
|
</view>
|
|
</view>
|
|
<!-- 数据列表 -->
|
|
<view class="lists">
|
|
<block v-if="orders.length > 0">
|
|
<view class="item" v-for="(item, index) in orders" :key="index">
|
|
<image class="cover" :src="item.user.avatar" mode="aspectFill"></image>
|
|
<view class="title nowrap">
|
|
{{item.user.username}}
|
|
<view class="type">{{item.state}}</view>
|
|
</view>
|
|
<view class="sub-title nowrap">订单号: {{item.order_no}}</view>
|
|
<view class="sub-title nowrap">{{item.created_at}}</view>
|
|
</view>
|
|
</block>
|
|
<block v-else>
|
|
<view class="list-null">
|
|
<image class="icon" src="@/static/icons/listnull-icon.png" mode="widthFix"></image>
|
|
<view class="sub-title">暂无相关成交客户记录</view>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import getDate from '@/public/date'
|
|
import { customer } from '@/apis/interfaces/store'
|
|
export default {
|
|
data() {
|
|
return {
|
|
tabsIndex: 'day',
|
|
dateValue: '',
|
|
endDate : '',
|
|
visitor : {
|
|
day: 0,
|
|
all: 0
|
|
},
|
|
orders : [],
|
|
pages : {}
|
|
};
|
|
},
|
|
created() {
|
|
getDate().then(res => {
|
|
this.dateValue = res
|
|
this.endDate = res
|
|
this.getLists()
|
|
})
|
|
},
|
|
methods:{
|
|
// tabs筛选
|
|
onTbas(type){
|
|
console.log(type)
|
|
getDate(type).then(res => {
|
|
this.tabsIndex = type
|
|
this.dateValue = res
|
|
this.getLists()
|
|
})
|
|
},
|
|
// 日期筛选
|
|
pickerDate(e){
|
|
let dateValue = e.detail.value
|
|
this.dateValue = dateValue
|
|
this.getLists()
|
|
},
|
|
// 获取列表
|
|
getLists(){
|
|
customer({
|
|
type: this.tabsIndex,
|
|
date: this.dateValue
|
|
}).then(res => {
|
|
this.visitor = res.visitor
|
|
this.orders = res.orders.data
|
|
this.pages = res.orders.page
|
|
}).catch(err => {
|
|
uni.showToast({
|
|
title: err,
|
|
icon : 'none'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
// 空提示
|
|
.list-null{
|
|
width: 100vw;
|
|
height: 40vh;
|
|
background: white;
|
|
text-align: center;
|
|
@extend .vertical;
|
|
.sub-title{
|
|
color: $text-gray;
|
|
font-size: $title-size-m;
|
|
}
|
|
.icon{
|
|
width: 288rpx;
|
|
}
|
|
}
|
|
// content
|
|
.content{
|
|
padding-top: 80rpx;
|
|
}
|
|
// tabs
|
|
.tabs{
|
|
position: fixed;
|
|
z-index: 99;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
display: flex;
|
|
background: white;
|
|
justify-content: space-around;
|
|
line-height: 80rpx;
|
|
font-size: $title-size-m;
|
|
color: $text-gray;
|
|
.item.show{
|
|
color: $text-price;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
// 统计信息
|
|
.statistics{
|
|
margin-top: $margin;
|
|
background-color: white;
|
|
border-bottom: solid 1rpx $border-color;
|
|
padding: $padding;
|
|
.statistics-date{
|
|
font-size: $title-size + 4;
|
|
font-weight: bold;
|
|
line-height: 60rpx;
|
|
.arrowdown{
|
|
margin-left: $margin/2;
|
|
}
|
|
}
|
|
.statistics-text{
|
|
font-size: $title-size-sm;
|
|
color: gray;
|
|
line-height: 50rpx;
|
|
text{
|
|
margin-left: $margin;
|
|
&:first-child{
|
|
margin: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 客户列表
|
|
.lists{
|
|
padding: $padding/2 0;
|
|
background: white;
|
|
.item{
|
|
padding: ($padding - 10) $padding ($padding - 10) ($padding*2 + 68);
|
|
position: relative;
|
|
min-height: 68rpx;
|
|
&::after{
|
|
position: absolute;
|
|
left: $padding*2 + 68;
|
|
top: 0;
|
|
right: 0;
|
|
content: ' ';
|
|
border-bottom: solid 1rpx $border-color;
|
|
}
|
|
&:first-child::after{
|
|
display: none;
|
|
}
|
|
.cover{
|
|
position: absolute;
|
|
left: $padding;
|
|
top: $padding - 10;
|
|
width: 68rpx;
|
|
height: 68rpx;
|
|
border-radius: 50%;
|
|
background-color: #eee;
|
|
}
|
|
.title{
|
|
padding-right: 200rpx;
|
|
position: relative;
|
|
line-height: 58rpx;
|
|
font-size: $title-size-lg;
|
|
.type{
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
width: 180rpx;
|
|
text-align: right;
|
|
color: $text-price;
|
|
}
|
|
}
|
|
.sub-title{
|
|
line-height: 40rpx;
|
|
font-size: $title-size-sm;
|
|
color: $text-gray;
|
|
}
|
|
}
|
|
}
|
|
</style>
|