Commit 30ab0579 by 匡雅琴

Merge branch 'v1.0.0' of http://192.168.3.233:8090/h5/glsk-data-view-pd into v1.0.0

2 parents 95c2ae58 a4286ff5
...@@ -3,20 +3,20 @@ ...@@ -3,20 +3,20 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-04 11:40:34 * @Date: 2023-07-04 11:40:34
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-04 11:40:40 * @LastEditTime: 2023-07-13 17:55:25
*/ */
class Request { class Request {
DOMAIN = '/dev' DOMAIN = '/dev'
constructor(_request_) { constructor(_request_) {
this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
} }
get (url, params, returnAll) { get(url, params, returnAll) {
return this.request('GET', url, params, returnAll) return this.request('GET', url, params, returnAll)
} }
post (url, params, returnAll) { post(url, params, returnAll) {
return this.request('POST', url, params, returnAll) return this.request('POST', url, params, returnAll)
} }
request (method, url, params, returnAll) { request(method, url, params, returnAll) {
var requestConfig = { var requestConfig = {
headers: { headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8' // 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
...@@ -26,7 +26,7 @@ class Request { ...@@ -26,7 +26,7 @@ class Request {
} }
if (method === 'GET') { if (method === 'GET') {
var paramsArray = [] var paramsArray = []
params&&Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key])) params && Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
if (url.search(/\?/) === -1) { if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&') url += '?' + paramsArray.join('&')
} else { } else {
......
...@@ -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 17:33: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,8 +41,8 @@ export default { ...@@ -38,8 +41,8 @@ export default {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
selectVal(val) { selectVal(val) {
console.log(val)
this.year = val this.year = val
this.$emit('yearValue', val)
this.switchYear() this.switchYear()
}, },
clickOutside() { clickOutside() {
......
...@@ -4,23 +4,30 @@ ...@@ -4,23 +4,30 @@
* @Author: limin * @Author: limin
* @Date: 2021-06-07 14:12:32 * @Date: 2021-06-07 14:12:32
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-04 11:46:21 * @LastEditTime: 2023-07-13 17:31:56
*/ */
const state = { const state = {
reportParams: { reportParams: {
reportType: 0 //月表0,日表1 reportType: 0 // 月表0,日表1
} },
solarYear: '2023'
} }
const mutations = { const mutations = {
SET_PAGE_META (state, meta) { SET_PAGE_META(state, meta) {
state.pageMeta = meta state.pageMeta = meta
}, },
SET_SOLAR_YEAR(state, meta) {
state.solarYear = meta
}
} }
const actions = { const actions = {
// 设置name // 设置name
setUserInfo ({ commit }, user) { setUserInfo({ commit }, user) {
commit('SET_USER_INFO', user) commit('SET_USER_INFO', user)
}, },
setSolarYear({ commit }, year) {
commit('SET_SOLAR_YEAR', year)
}
} }
export default { export default {
......
...@@ -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 17:43:57
--> -->
<template> <template>
<div class="view-content"> <div class="view-content">
<ViewDate></ViewDate> <ViewDate :businessTime="businessTime" @yearValue="yearValue"></ViewDate>
<div class="content"> <div class="content">
<ContentLeft></ContentLeft> <ContentLeft></ContentLeft>
<ContentRight></ContentRight> <ContentRight></ContentRight>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<script> <script>
import ContentLeft from '../solar/ContentLeft' import ContentLeft from '../solar/ContentLeft'
import ContentRight from '../solar/ContentRight.vue' import ContentRight from '../solar/ContentRight.vue'
import { mapActions } from 'vuex'
export default { export default {
name: 'ViewSolar', name: 'ViewSolar',
components: { components: {
...@@ -25,11 +26,23 @@ export default { ...@@ -25,11 +26,23 @@ export default {
}, },
props: { props: {
}, },
computed: {
},
data() { data() {
return { return {
businessTime: ''
} }
}, },
created() {
this.$bus.$on('businessstarttime', data => {
this.businessTime = data
})
},
methods: { methods: {
...mapActions(['setSolarYear']),
yearValue(val) {
this.setSolarYear(val)
}
} }
} }
</script> </script>
......
...@@ -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 18:01:02
--> -->
<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,16 @@ export default { ...@@ -74,9 +89,16 @@ export default {
init() { init() {
this.getSolarList() this.getSolarList()
}, },
getSolarList() { async getSolarList() {
this.api.solar.getAllPurchase({ req: { year: 2023 }}).then(res => { console.log(this.$store.state)
console.log(res) const _data = await this.api.solar.getAllPurchase({ year: 2023 })
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 17:55:09
--> -->
<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({ 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({ 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>
...@@ -82,32 +82,32 @@ export default { ...@@ -82,32 +82,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!