Commit d4a62abc by 胡悦

接口联调

1 parent 6b5e9b21
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
<div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}</span></div> <div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}</span></div>
</div> </div>
<div class="statistics-bottom"> <div class="statistics-bottom">
<template v-if="bottomType == 'money'"> <template v-if="item.bottomType == 'money'">
<span> {{item.moneyName}}</span> <span> {{item.bottomLabel}}</span>
<span>¥{{item.moneyValue}}</span> <span>¥{{item.bottomValue}}</span>
</template> </template>
<template v-else-if="bottomType == 'default'"> <template v-else-if="item.bottomType == 'slot'">
<span>{{item.moneyName}}</span>
<span>{{item.moneyValue}}</span>
</template>
<template v-else-if="bottomType == 'slot'">
<slot name="bottom"></slot> <slot name="bottom"></slot>
</template> </template>
<template v-else>
<span>{{item.bottomLabel}}</span>
<span>{{item.bottomValue}}</span>
</template>
</div> </div>
</div> </div>
</div> </div>
...@@ -29,11 +29,11 @@ export default { ...@@ -29,11 +29,11 @@ export default {
props: { props: {
list: { list: {
type: Array type: Array
},
bottomType: {
type: String,
default: 'default'
} }
// bottomType: {
// type: String,
// default: 'default'
// }
}, },
data() { data() {
return { return {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-12 15:45:33 * @LastEditTime: 2023-07-13 15:56:27
--> -->
<template> <template>
<div class="view-date">统计年份: <div class="view-date">统计年份:
...@@ -17,12 +17,15 @@ ...@@ -17,12 +17,15 @@
<div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div> <div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div>
</div> --> </div> -->
</div> </div>
业务开始时间:2022年6月30日</div> 业务开始时间:{{businessTime}}</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import datas from '@/utils/data' import datas from '@/utils/data'
export default { export default {
name: 'ViewDate', name: 'ViewDate',
props: {
businessTime: String
},
data() { data() {
return { return {
isShow: false, isShow: false,
...@@ -38,7 +41,6 @@ export default { ...@@ -38,7 +41,6 @@ export default {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
selectVal(val) { selectVal(val) {
console.log(val)
this.year = val this.year = val
this.switchYear() this.switchYear()
}, },
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-04 13:56:33 * @Date: 2023-07-04 13:56:33
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:44:25 * @LastEditTime: 2023-07-13 15:47:43
--> -->
<template> <template>
<div class="view-content"> <div class="view-content">
<ViewDate></ViewDate> <ViewDate :businessTime="businessTime"></ViewDate>
<div class="content"> <div class="content">
<ContentLeft></ContentLeft> <ContentLeft></ContentLeft>
<ContentRight></ContentRight> <ContentRight></ContentRight>
...@@ -27,8 +27,14 @@ export default { ...@@ -27,8 +27,14 @@ export default {
}, },
data() { data() {
return { return {
businessTime: ''
} }
}, },
created() {
this.$bus.$on('businessstarttime', data => {
this.businessTime = data
})
},
methods: { methods: {
} }
} }
......
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-06 10:19:05 * @Date: 2023-07-06 10:19:05
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-06 11:07:11 * @LastEditTime: 2023-07-13 15:57:12
*/ */
import Vue from 'vue' import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/) const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => { componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default const component = componentsFiles(path).default
console.log(component.name)
Vue.component(component.name, component) Vue.component(component.name, component)
}) })
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-13 15:12:36 * @LastEditTime: 2023-07-13 16:38:26
--> -->
<template> <template>
<div class="left"> <div class="left">
<StatisticsBox :list="solarList" bottomType="money"></StatisticsBox> <StatisticsBox :list="solarList"></StatisticsBox>
<PurchaseTrends></PurchaseTrends> <PurchaseTrends></PurchaseTrends>
<div class="left-bottom"> <div class="left-bottom">
<MerchantTrends class="bottom-trends"></MerchantTrends> <MerchantTrends class="bottom-trends"></MerchantTrends>
...@@ -35,35 +35,50 @@ export default { ...@@ -35,35 +35,50 @@ export default {
solarList: [ solarList: [
{ {
name: '总采购额', name: '总采购额',
valueName: 'amounttotal',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708' bottemName: 'amounttotalThismonth',
bottomValue: '2,280,708',
bottomType: 'money'
}, },
{ {
name: '总采购额', name: '商城采购额',
valueName: 'amountshop',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708', bottemName: 'amountshopThismonth',
rate: '51%' bottomValue: '2,280,708',
rate: '51%',
rateName: 'shopRate',
bottomType: 'money'
}, },
{ {
name: '总采购额', name: '自采采购额',
valueName: 'amountself',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708', bottemName: 'amountselfThismonth',
rate: '49%' bottomValue: '2,280,708',
rate: '49%',
rateName: 'selfRate',
bottomType: 'money'
}, },
{ {
name: '总采购额', name: '开通商户数',
valueName: 'opentotal',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月开通商户数',
moneyValue: '2,280,708' bottemName: 'openThismonth',
bottomValue: '2,280,708'
}, },
{ {
name: '总采购额', name: '采购商户数',
valueName: 'buytotal',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购商户数',
moneyValue: '2,280,708' bottemName: 'buyThismonth',
bottomValue: '2,280,708'
} }
] ]
} }
...@@ -74,9 +89,15 @@ export default { ...@@ -74,9 +89,15 @@ export default {
init() { init() {
this.getSolarList() this.getSolarList()
}, },
getSolarList() { async getSolarList() {
this.api.solar.getAllPurchase({ req: { year: 2023 }}).then(res => { const _data = await this.api.solar.getAllPurchase({ req: { year: 2023 }})
console.log(res) const _dataList = _data.data.dataList[0]
console.log(_dataList)
this.$bus.$emit('businessstarttime', _dataList.businessstarttime)
this.solarList.forEach(item => {
item.value = _dataList[item.valueName]
item.bottomValue = _dataList[item.bottemName]
if (item.rateName) item.rate = _dataList[item.rateName]
}) })
} }
} }
......
...@@ -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-12 15:57:01 * @LastEditTime: 2023-07-13 16:39:55
--> -->
<template> <template>
<div class="merchant-box"> <div class="merchant-box">
...@@ -44,19 +44,33 @@ export default { ...@@ -44,19 +44,33 @@ export default {
}, },
methods: { methods: {
init() { init() {
const p = new Promise((resolve) => { this.getTrendData()
for (let i = 0; i < 12; i++) { // 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() {
const _data = await this.api.solar.getAllOpenBuyTrend({ req: { year: 2023 }})
const _dataList = _data.data.dataList
_dataList.forEach(item => {
this.dataList.push({ this.dataList.push({
month: i + 1 + '月', month: item.statDate,
data1: +(Math.random() * 20).toFixed(2), data1: item.opennum,
data2: +(Math.random() * 40).toFixed(2) data2: item.buynum
}) })
}
resolve()
}) })
p.then(() => {
this.$refs.merchantTrendsRef.drawBar() this.$refs.merchantTrendsRef.drawBar()
})
} }
} }
} }
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
* @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-07 18:08:57 * @LastEditTime: 2023-07-13 17:12:23
--> -->
<template> <template>
<div class="purchase-box"> <div class="purchase-box">
<box-title title="采购额排名"></box-title> <box-title title="近一年采购额趋势"></box-title>
<BarLineChart ref="purchaseRef" height="30.23vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart> <BarLineChart ref="purchaseRef" height="30.23vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
<div class="legend"> <div class="legend">
<div class="legend-item shop"> <div class="legend-item shop">
...@@ -56,20 +56,34 @@ export default { ...@@ -56,20 +56,34 @@ export default {
}, },
methods: { methods: {
init() { init() {
const p = new Promise((resolve) => { this.getDataList()
for (let i = 0; i < 12; i++) { // 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() {
const _data = await this.api.solar.getAllPurchaseTrend({ req: { year: 2023 }})
const _dataList = _data.data.dataList
_dataList.forEach(item => {
this.dataList.push({ this.dataList.push({
month: i + 1 + '月', month: item.statDate,
data1: +(Math.random() * 2000).toFixed(2), data1: item.shopamount,
data2: +(Math.random() * 5000).toFixed(2), data2: item.selfamount,
data3: +(Math.random() * 50).toFixed(2) data3: item.shopratio
}) })
}
resolve()
}) })
p.then(() => {
this.$refs.purchaseRef.drawBarLine() this.$refs.purchaseRef.drawBarLine()
})
} }
} }
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
</template> </template>
<template #content> <template #content>
<div class="solar-detail-content"> <div class="solar-detail-content">
<view-date></view-date> <view-date></view-date>z
<StatisticsBox class="statistic-box" :list="solarDetailList" bottomType="money"></StatisticsBox> <StatisticsBox class="statistic-box" :list="solarDetailList"></StatisticsBox>
<!-- 采购趋势 --> <!-- 采购趋势 -->
<div class="tendency-box"> <div class="tendency-box">
<box-title title="近一年采购额趋势"></box-title> <box-title title="近一年采购额趋势"></box-title>
...@@ -76,32 +76,32 @@ export default { ...@@ -76,32 +76,32 @@ export default {
{ {
name: '总采购额', name: '总采购额',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708' bottomValue: '2,280,708'
}, },
{ {
name: '总采购额', name: '总采购额',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708' bottomValue: '2,280,708'
}, },
{ {
name: '总采购额', name: '总采购额',
value: '2,280,708', value: '2,280,708',
moneyName: '本月采购额', bottomLabel: '本月采购额',
moneyValue: '2,280,708' bottomValue: '2,280,708'
}, },
// { // {
// name: '总采购额', // name: '总采购额',
// value: '2,280,708', // value: '2,280,708',
// moneyName: '本月采购额', // bottomLabel: '本月采购额',
// moneyValue: '2,280,708' // bottomValue: '2,280,708'
// }, // },
// { // {
// name: '总采购额', // name: '总采购额',
// value: '2,280,708', // value: '2,280,708',
// moneyName: '本月采购额', // bottomLabel: '本月采购额',
// moneyValue: '2,280,708' // bottomValue: '2,280,708'
// } // }
], ],
// 商城采购饼图结构 // 商城采购饼图结构
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!