Commit e8dcb9bd by 胡悦

提交

1 parent 8cf204ae
/*
* @Description: 基础数据
* @Author: huyue
* @Date: 2023-07-04 11:46:53
* @LastEditors: huyue
* @LastEditTime: 2023-07-14 14:39:49
*/
const DefaultData = { const DefaultData = {
yearList: ['2023', '2022', '2021', '2020'], yearList: ['2023', '2022'],
businessList: [ businessList: [
{ {
label: '业务数据 | 1.0太阳膜采购', label: '业务数据 | 1.0太阳膜采购',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-06 16:19:15 * @Date: 2023-07-06 16:19:15
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-14 10:29:38 * @LastEditTime: 2023-07-14 14:28:17
--> -->
<template> <template>
<div class="merchant-box"> <div class="merchant-box">
...@@ -45,22 +45,9 @@ export default { ...@@ -45,22 +45,9 @@ export default {
methods: { methods: {
init() { init() {
this.getTrendData() this.getTrendData()
// const p = new Promise((resolve) => {
// for (let i = 0; i < 12; i++) {
// this.dataList.push({
// month: i + 1 + '月',
// data1: +(Math.random() * 20).toFixed(2),
// data2: +(Math.random() * 40).toFixed(2)
// })
// }
// console.log(this.dataList)
// resolve()
// })
// p.then(() => {
// this.$refs.merchantTrendsRef.drawBar()
// })
}, },
async getTrendData() { async getTrendData() {
this.dataList = []
const _data = await this.api.solar.getAllOpenBuyTrend({ year: this.$store.state.app.solarYear }) const _data = await this.api.solar.getAllOpenBuyTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList const _dataList = _data.data.dataList
_dataList.forEach(item => { _dataList.forEach(item => {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-06 16:19:15 * @Date: 2023-07-06 16:19:15
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-14 10:29:34 * @LastEditTime: 2023-07-14 14:27:08
--> -->
<template> <template>
<div class="purchase-box"> <div class="purchase-box">
...@@ -57,22 +57,9 @@ export default { ...@@ -57,22 +57,9 @@ export default {
methods: { methods: {
init() { init() {
this.getDataList() this.getDataList()
// const p = new Promise((resolve) => {
// for (let i = 0; i < 12; i++) {
// this.dataList.push({
// month: i + 1 + '月',
// data1: +(Math.random() * 2000).toFixed(2),
// data2: +(Math.random() * 5000).toFixed(2),
// data3: +(Math.random() * 50).toFixed(2)
// })
// }
// resolve()
// })
// p.then(() => {
// this.$refs.purchaseRef.drawBarLine()
// })
}, },
async getDataList() { async getDataList() {
this.dataList = []
const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear }) const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList const _dataList = _data.data.dataList
_dataList.forEach(item => { _dataList.forEach(item => {
......
...@@ -83,21 +83,30 @@ export default { ...@@ -83,21 +83,30 @@ export default {
solarDetailList: [ solarDetailList: [
{ {
name: '总采购额', name: '总采购额',
valueName: 'amounttotal',
value: '2,280,708', value: '2,280,708',
bottomLabel: '本月采购额', bottomLabel: '本月采购额',
bottomValue: '2,280,708' bottemName: 'amounttotalThismonth',
bottomValue: '2,280,708',
bottomType: 'money'
}, },
{ {
name: '商城采购额', name: '商城采购额',
valueName: 'amountshop',
value: '2,280,708', value: '2,280,708',
bottomLabel: '本月采购额', bottomLabel: '本月采购额',
bottomValue: '2,280,708' bottemName: 'amountshopThismonth',
bottomValue: '2,280,708',
bottomType: 'money'
}, },
{ {
name: '自采采购额', name: '自采采购额',
valueName: 'amountself',
value: '2,280,708', value: '2,280,708',
bottomLabel: '本月采购额', bottomLabel: '本月采购额',
bottomValue: '2,280,708' bottemName: 'amountselfThismonth',
bottomValue: '2,280,708',
bottomType: 'money'
} }
], ],
// 商城采购饼图结构 // 商城采购饼图结构
...@@ -186,11 +195,16 @@ export default { ...@@ -186,11 +195,16 @@ export default {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
return return
} }
const _dataList = res.data.dataList[0]
this.solarDetailList.forEach(item => {
item.value = _dataList[item.valueName]
item.bottomValue = _dataList[item.bottemName]
})
}) })
}, },
// 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势 // 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势
getMerchantPurchaseTrend(merchantid) { getMerchantPurchaseTrend(merchantid) {
this.api.solar.getMerchantPurchaseTrend({ year: 2023, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchaseTrend({ year: this.$store.state.app.solarYear, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -201,10 +215,10 @@ export default { ...@@ -201,10 +215,10 @@ export default {
this.dataList.push({ this.dataList.push({
month: item.statDate, month: item.statDate,
data1: item.shopamount, data1: item.shopamount,
data2: item.selfamount data2: item.selfamount,
data3: item.shopratio
}) })
}) })
console.log(this.dataList)
this.$refs.purchaseTrend.drawBarLine() this.$refs.purchaseTrend.drawBarLine()
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!