程志平 4 лет назад
Родитель
Сommit
5a4af46a9a
1 измененных файлов с 34 добавлено и 10 удалено
  1. 34 10
      pagesAir/stdBookMgr/stdBookMgr.vue

+ 34 - 10
pagesAir/stdBookMgr/stdBookMgr.vue

@@ -68,6 +68,13 @@
 					categories: [],
 					categories: [],
 					series: []
 					series: []
 				},
 				},
+				chartDataInit: { // 如果 chartData 没有数据,解决一直打转的问题
+					"categories": ["无数据","无数据","无数据","无数据","无数据"],
+					"series": [{
+						"name": "金额",
+						"data": ["0.00","0.00","0.00","0.00","0.00"]
+					}]
+				},
 				chartOpts: {
 				chartOpts: {
 					color: ["#1890FF", "#91CB74", "#FAC858"],
 					color: ["#1890FF", "#91CB74", "#FAC858"],
 					padding: [15, 10, 0, 15],
 					padding: [15, 10, 0, 15],
@@ -155,8 +162,15 @@
 
 
 				// console.log(res.data);
 				// console.log(res.data);
 				let data = res.data
 				let data = res.data
+				if (typeof data.rows !== 'undefined' && data.rows === '') {
+					uni.showToast({
+						title: '暂无消费数据',
+						duration: 1500
+					})
+					return
+				}
 				if (data.code === 200) {
 				if (data.code === 200) {
-					if (typeof data.rows === 'undefined') {
+					if (typeof data.rows === 'undefined' || data.rows === '') {
 						uni.showToast({
 						uni.showToast({
 							title: '暂无消费数据',
 							title: '暂无消费数据',
 							duration: 1500
 							duration: 1500
@@ -204,21 +218,31 @@
 				})
 				})
 
 
 				// console.log(res.data);
 				// console.log(res.data);
+				let _this = this
+				if (typeof res.data === 'undefined') {
+					uni.showToast({
+						title: '暂无走势图数据',
+						duration: 1500
+					});
+					
+					setTimeout(() => {
+						_this.chartData = _this.chartDataInit
+					}, 1000);
+					
+					return
+				}
 				let tmpdata = res.data
 				let tmpdata = res.data
 				if (tmpdata.code === 200) {
 				if (tmpdata.code === 200) {
-					if (typeof res.data === 'undefined') {
-						uni.showToast({
-							title: '暂无走势图数据',
-							duration: 1500
-						})
-						return
-					}
-
 					if (typeof tmpdata.data === 'undefined' || tmpdata.data.length === 0) {
 					if (typeof tmpdata.data === 'undefined' || tmpdata.data.length === 0) {
 						uni.showToast({
 						uni.showToast({
 							title: '暂无走势图数据',
 							title: '暂无走势图数据',
 							duration: 1500
 							duration: 1500
-						})
+						});
+						
+						setTimeout(() => {
+							_this.chartData = _this.chartDataInit
+						}, 1000);
+						
 						return
 						return
 					}
 					}