|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view class="content flex flex_column">
|
|
|
<div class="p-header" @click="openShlef">
|
|
|
- <text>{{curShelfName||'全部客户'}}</text>
|
|
|
+ <text>{{curCustomerName||'全部客户'}}</text>
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
|
</div>
|
|
|
<div class="e-chart">
|
|
@@ -13,13 +13,13 @@
|
|
|
<div class="data-box flex">
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- 60
|
|
|
+ {{allData&&allData.salesTotalQty||0}}
|
|
|
</div>
|
|
|
<div class="data-label">销售产品数量(个)</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
|
|
|
+ <u-count-to :end-val="allData&&allData.salesTotalAmount||0" separator="," :decimals="2"></u-count-to>
|
|
|
</div>
|
|
|
<div class="data-label">销售金额(元)</div>
|
|
|
</div>
|
|
@@ -30,7 +30,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="card-box">
|
|
|
+ <div class="card-box" v-if="allData&&allData.xprhFlag">
|
|
|
<div class="card-tits">
|
|
|
货架订单
|
|
|
</div>
|
|
@@ -38,24 +38,24 @@
|
|
|
<div class="data-box flex">
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- 60
|
|
|
+ {{allData&&allData.orderTotalQty||0}}
|
|
|
</div>
|
|
|
<div class="data-label">取货产品数量(个)</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
|
|
|
+ <u-count-to :end-val="allData&&allData.orderTotalAmount||0" separator="," :decimals="2"></u-count-to>
|
|
|
</div>
|
|
|
<div class="data-label">取货产品金额(元)</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<qiun-data-charts
|
|
|
type="line"
|
|
|
- :chartData="chartData"
|
|
|
+ :chartData="chartData1"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="card-box">
|
|
|
+ <div class="card-box" v-if="allData&&allData.xprhFlag">
|
|
|
<div class="card-tits">
|
|
|
急送订单
|
|
|
</div>
|
|
@@ -63,20 +63,20 @@
|
|
|
<div class="data-box flex">
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- 60
|
|
|
+ {{allData&&allData.tempTotalQty||0}}
|
|
|
</div>
|
|
|
<div class="data-label">急送产品数量(个)</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="data-amount">
|
|
|
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
|
|
|
+ <u-count-to :end-val="allData&&allData.tempTotalAmount||0" separator="," :decimals="2"></u-count-to>
|
|
|
</div>
|
|
|
<div class="data-label">急送产品金额(元)</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<qiun-data-charts
|
|
|
type="line"
|
|
|
- :chartData="chartData"
|
|
|
+ :chartData="chartData2"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -106,13 +106,18 @@
|
|
|
|
|
|
<script>
|
|
|
import chooseShelf from './chooseShelf.vue'
|
|
|
+ import { salesStatistics } from '@/api/sales.js'
|
|
|
+ import getDate from '@/libs/getDate.js'
|
|
|
export default {
|
|
|
components: { chooseShelf },
|
|
|
data() {
|
|
|
return {
|
|
|
- shelfSn: '',
|
|
|
- curShelfName: '',
|
|
|
+ customerSn: '',
|
|
|
+ curCustomerName: '',
|
|
|
chartData: {},
|
|
|
+ chartData1: {},
|
|
|
+ chartData2: {},
|
|
|
+ allData: null,
|
|
|
showSearch: false,
|
|
|
showDate: false,
|
|
|
dateArray: '',
|
|
@@ -123,7 +128,8 @@
|
|
|
},
|
|
|
queryPramas:{
|
|
|
beginDate: '',
|
|
|
- endDate: ''
|
|
|
+ endDate: '',
|
|
|
+ buyerSn: ''
|
|
|
},
|
|
|
placeTab: [
|
|
|
{
|
|
@@ -156,20 +162,23 @@
|
|
|
val: '6'
|
|
|
}
|
|
|
],
|
|
|
- curTab: '',
|
|
|
+ curTab: '4',
|
|
|
webView: null
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
uni.$on('chooseShelfOk',(data)=>{
|
|
|
- this.shelfSn = data.shelfSn
|
|
|
- this.curShelfName = data.shelfName
|
|
|
+ this.customerSn = data.customerSn
|
|
|
+ this.curCustomerName = data.customerName
|
|
|
+ this.queryPramas.buyerSn = data.customerSn
|
|
|
})
|
|
|
- this.getServerData()
|
|
|
this.webView = this.$mp.page.$getAppWebview();
|
|
|
// 默认数据
|
|
|
this.tabChange(this.placeTab[2])
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ this.getServerData()
|
|
|
+ },
|
|
|
onUnload() {
|
|
|
uni.$off("chooseShelfOk")
|
|
|
},
|
|
@@ -186,8 +195,8 @@
|
|
|
// 时间 change
|
|
|
dateChange(date){
|
|
|
this.dateArray = date.startDate + ' ~ ' + date.endDate
|
|
|
- this.queryPramas.beginDate = date.startDate
|
|
|
- this.queryPramas.endDate = date.endDate
|
|
|
+ this.queryPramas.beginDate = date.startDate + ' 00:00:00'
|
|
|
+ this.queryPramas.endDate = date.endDate + ' 23:59:59'
|
|
|
this.webView.setTitleNViewButtonStyle(0, {
|
|
|
"text":"\ue626 "+date.startDate+"~"+date.endDate,
|
|
|
"color": "#00aaff",
|
|
@@ -212,6 +221,7 @@
|
|
|
this.tabChange(this.placeTab[2])
|
|
|
this.showSearch = false
|
|
|
},
|
|
|
+ // 查询
|
|
|
handleSearch(){
|
|
|
if(this.curTab == 6){
|
|
|
if(this.queryPramas.beginDate&&this.queryPramas.endDate){
|
|
@@ -228,28 +238,56 @@
|
|
|
this.showSearch = false
|
|
|
}
|
|
|
},
|
|
|
- getServerData() {
|
|
|
- //模拟从服务器获取数据时的延时
|
|
|
- setTimeout(() => {
|
|
|
- //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
|
|
|
- let res = {
|
|
|
- categories: ["8-7","8-6","8-9","8-10","8-11","8-12"],
|
|
|
+ // 格式化折线图数据
|
|
|
+ getFormatData(categories,data,name){
|
|
|
+ if(data){
|
|
|
+ data.map(item => Number(item))
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ categories: categories,
|
|
|
series: [
|
|
|
{
|
|
|
- name: "销售金额",
|
|
|
- data: [35,8,25,37,4,20],
|
|
|
+ name: name,
|
|
|
+ data: data||[],
|
|
|
label:{
|
|
|
position: 'top'
|
|
|
}
|
|
|
},
|
|
|
]
|
|
|
- };
|
|
|
- this.chartData = JSON.parse(JSON.stringify(res));
|
|
|
- }, 500);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getQueryDate(){
|
|
|
+ const fun = [
|
|
|
+ getDate.getToday,
|
|
|
+ getDate.getYesterday,
|
|
|
+ getDate.getCurrWeekDays,
|
|
|
+ getDate.getLastWeekDays,
|
|
|
+ getDate.getCurrLastMonthDays,
|
|
|
+ getDate.getCurrMonthDays
|
|
|
+ ];
|
|
|
+ return {
|
|
|
+ beginDate: fun[this.curTab]().starttime,
|
|
|
+ endDate: fun[this.curTab]().endtime
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getServerData() {
|
|
|
+ let params = {}
|
|
|
+ // 不是自定义时间段
|
|
|
+ if(this.curTab != 6){
|
|
|
+ params = this.getQueryDate()
|
|
|
+ }
|
|
|
+ salesStatistics(Object.assign(this.queryPramas,params)).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.allData = res.data
|
|
|
+ this.chartData = this.getFormatData(res.data.salesDateList,res.data.salesAmountList,"销售金额")
|
|
|
+ this.chartData1 = this.getFormatData(res.data.orderDateList,res.data.orderAmountList,"取货产品金额")
|
|
|
+ this.chartData2 = this.getFormatData(res.data.tempDateList,res.data.tempAmountList,"急送产品金额")
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
openShlef(){
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/statistics/chooseShelf?shelfSn="+this.shelfSn
|
|
|
+ url: "/pages/statistics/chooseShelf?customerSn="+this.customerSn
|
|
|
})
|
|
|
}
|
|
|
}
|