Commit 8cefb039 by 胡悦

优化

1 parent a46390b8
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 19:18:15
* @LastEditTime: 2022-06-30 19:40:27
-->
<template>
<div>
......@@ -111,7 +111,8 @@ export default {
}
}
var brandName = val.brand ? val.brand.name : ''
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params).then(res => {
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params)
.then(res => {
if (res.code === '0') {
if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => {
......@@ -124,6 +125,9 @@ export default {
}
}
})
.catch(() => {
this.hasData = false
})
},
draw() {
this.option = {
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 19:15:13
* @LastEditTime: 2022-06-30 19:38:58
-->
<template>
<div>
......@@ -60,12 +60,17 @@ export default {
this.list.forEach((i, idx) => {
p[idx] = new Promise((resolve, reject) => {
params.req.queryItem = i
this.api.sales[api](params).then(res => {
this.api.sales[api](params)
.then(res => {
resolve(res.data.dataList)
})
.catch(() => {
reject()
})
})
Promise.all([p[0], p[1], p[2], p[3], p[4]]).then(results => {
})
Promise.all([p[0], p[1], p[2], p[3], p[4]])
.then(results => {
this.dataList = results
const flag = results.map(item => {
if (item.length) {
......@@ -77,6 +82,9 @@ export default {
this.$set(this, 'hasData', !flag.every(i => !i))
this.draw()
})
.catch(() => {
this.hasData = false
})
},
draw() {
this.option = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!