吴洪双 6 éve
szülő
commit
4bc7fa56b5
7 módosított fájl, 78 hozzáadás és 141 törlés
  1. 2 0
      .gitignore
  2. 21 0
      App.vue
  3. 5 0
      main.js
  4. 30 2
      pages.json
  5. 0 120
      pages/Charts/column.vue
  6. 1 1
      pages/Login/Login.vue
  7. 19 18
      store/modules/chart.js

+ 2 - 0
.gitignore

@@ -31,3 +31,5 @@ testem.log
 # System Files
 .DS_Store
 Thumbs.db
+
+/unpackage/

+ 21 - 0
App.vue

@@ -14,4 +14,25 @@
 
 <style>
 	/*每个页面公共css */
+	/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
+	@import './common/uni.css';
+	/* icon图标 */
+	@font-face {
+	  font-family: 'iconfont';  /* project id 1095188 */
+	  src: url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.eot');
+	  src: url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.eot?#iefix') format('embedded-opentype'),
+	  url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.woff2') format('woff2'),
+	  url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.woff') format('woff'),
+	  url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.ttf') format('truetype'),
+	  url('https://at.alicdn.com/t/font_1095188_lvwtknkk16s.svg#iconfont') format('svg');
+	}
+	.icon {
+	  font-size: 24upx;
+	  color: #000000;
+	  font-family: iconfont;
+	}
+	.icon-warning:before { 
+		content: '\e604';
+		font-size: 48upx;
+	}
 </style>

+ 5 - 0
main.js

@@ -3,6 +3,8 @@ import App from './App'
 import apis from './configs/http';
 import store from './store';
 import env from '@/configs/env';
+import MyChartsColumn from '@/components/Charts/MyChartsColumn';
+import mainStatistics from '@/pages/Charts/mainStatistics';
 
 
 
@@ -21,3 +23,6 @@ app.$mount();
 Object.keys(apis).forEach(key => {
 	Vue.prototype[`$${key}`] = apis[key];
 });
+
+Vue.component('MyChartsColumn', MyChartsColumn);
+Vue.component('mainStatistics', mainStatistics);

+ 30 - 2
pages.json

@@ -8,7 +8,7 @@
 			}
         },
 		{
-		    "path" : "pages/Charts/column",
+		    "path" : "pages/Charts/mainStatistics",
 		    "style" : {
 				"navigationBarTitleText":"统计图表"
 				// "disableScroll": true,
@@ -16,6 +16,22 @@
 			}
 		},
 		{
+		    "path" : "pages/User/merchantList",
+		    "style" : {
+				"navigationBarTitleText":"机器销售"
+				// "disableScroll": true,
+				// "enablePullDownRefresh": true
+			}
+		},
+		{
+		    "path" : "pages/User/merchantList2",
+		    "style" : {
+				"navigationBarTitleText":"机器状态"
+				// "disableScroll": true,
+				// "enablePullDownRefresh": true
+			}
+		},
+		{
 		    "path" : "pages/User/user",
 		    "style" : {
 				"navigationBarTitleText":"我的"
@@ -36,12 +52,24 @@
 		"borderStyle": "black",
 		"backgroundColor": "#F8F8F8",
 		"list": [{
-				"pagePath": "pages/Charts/column",
+				"pagePath": "pages/Charts/mainStatistics",
 				"iconPath": "static/img/home.png",
 				"selectedIconPath": "static/img/homeHL.png",
 				"text": "首页"
 			},
 			{
+				"pagePath": "pages/User/merchantList",
+				"iconPath": "static/img/merchantList.png",
+				"selectedIconPath": "static/img/merchantListHL.png",
+				"text": "机器销售"
+			},
+			{
+				"pagePath": "pages/User/merchantList2",
+				"iconPath": "static/img/equipment.png",
+				"selectedIconPath": "static/img/equipmentHL.png",
+				"text": "机器状态"
+			},
+			{
 				"pagePath": "pages/User/user",
 				"iconPath": "static/img/user.png",
 				"selectedIconPath": "static/img/userHL.png",

+ 0 - 120
pages/Charts/column.vue

@@ -1,120 +0,0 @@
-<template>
-	<view class="qiun-columns">
-		<view class="qiun-bg-white qiun-title-bar qiun-common-mt" >
-			<view class="qiun-title-dot-light">基本柱状图</view>
-		</view>
-		<view class="qiun-charts" style="background-color: #E5FDC3;">
-			<!--#ifdef MP-ALIPAY -->
-			<canvas canvas-id="canvasColumn" id="canvasColumn" class="charts" style="background-color: #E5FDC3;" :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"></canvas>
-			<!--#endif-->
-			<!--#ifndef MP-ALIPAY -->
-			<canvas canvas-id="canvasColumn" id="canvasColumn" class="charts" style="background-color: #E5FDC3;"></canvas>
-			<!--#endif-->
-		</view>
-	</view>
-</template>
-
-<script>
-	import { mapState, mapActions, mapMutations } from 'vuex';
-	import uCharts from '@/components/u-charts/u-charts.js';
-	var _self;
-	var canvaColumn=null;
-	/*下面是服务器返回的数据格式*/
-	
-   /* var Data={
-   	Column:{categories:['2012', '2013', '2014', '2015', '2016', '2017'],
-	series:[
-		{
-		name: '成交量1',
-		data:[15, {value:20,color:'#f04864'},45, 37, 43, 34],
-		},
-		{
-		name: '成交量2',
-		data:[30, {value:40,color:'#facc14'}, 25, 14, 34, 18],
-		}]}
-	} */
-	export default {
-		data() {
-			return {
-				cWidth:'',
-				cHeight:'',
-				pixelRatio:1,
-				serverData:'',
-			}
-		},
-		computed: {
-			...mapState(['loginUser']),
-			...mapState('chart',['column']),
-		},
-		onLoad() {
-			console.log(this.loginUser)
-			
-			_self = this;
-			this.cWidth=uni.upx2px(750);
-			this.cHeight=uni.upx2px(500);
-			// this.showColumn("canvasColumn",Data.Column);
-			this.getProductSaleMonth(this.loginUser['id'])
-					.then(_ => [uni.stopPullDownRefresh(),this.showColumn("canvasColumn",this.column)], _ => void uni.stopPullDownRefresh());
-		},
-		methods: {
-			...mapActions('chart', ['getProductSaleMonth']),
-			showColumn(canvasId,chartData){
-				canvaColumn=new uCharts({
-					$this:_self,
-					canvasId: canvasId,
-					enableScroll:true,
-					type: 'column',
-					legend:true,
-					fontSize:11,
-					background:'#E5FDC3',
-					pixelRatio:_self.pixelRatio,
-					animation: true,
-					categories: chartData.categories,
-					series: chartData.series,
-					xAxis: {
-						scrollShow:true,
-						itemCount:8,
-						disableGrid:true,
-					},
-					yAxis: {
-						//disabled:true
-					},
-					dataLabel: true,
-					width: _self.cWidth*_self.pixelRatio,
-					height: _self.cHeight*_self.pixelRatio,
-					extra: {
-						column: {
-						  // width: _self.cWidth*_self.pixelRatio*0.45/chartData.categories.length
-						  width:30
-						}
-					  }
-				});
-			},
-			touchColumn(e){
-				canvaColumn.showToolTip(e, {
-					format: function (item, category) {
-						if(typeof item.data === 'object'){
-							return category + ' ' + item.name + ':' + item.data.value 
-						}else{
-							return category + ' ' + item.name + ':' + item.data 
-						}
-					}
-				});
-			},
-		}
-	}
-</script>
-
-<style>
-page{background:#F2F2F2;width: 750upx;overflow-x: hidden;}
-.qiun-padding{padding:2%; width:96%;}
-.qiun-wrap{display:flex; flex-wrap:wrap;}
-.qiun-rows{display:flex; flex-direction:row !important;}
-.qiun-columns{display:flex; flex-direction:column !important;}
-.qiun-common-mt{margin-top:10upx;}
-.qiun-bg-white{background:#FFFFFF;}
-.qiun-title-bar{width:96%; padding:10upx 2%; flex-wrap:nowrap;}
-.qiun-title-dot-light{border-left: 10upx solid #0ea391; padding-left: 10upx; font-size: 32upx;color: #000000}
-.qiun-charts{width: 750upx; height:500upx;background-color: #FFFFFF;}
-.charts{width: 750upx; height:500upx;background-color: #FFFFFF;}
-</style>

+ 1 - 1
pages/Login/Login.vue

@@ -37,7 +37,7 @@
 						// 	url: '/pages/Charts/column',
 						// });
 						uni.reLaunch({
-						    url: '/pages/Charts/column',
+						    url: '/pages/Charts/mainStatistics',
 						});
 					});
 			}

+ 19 - 18
store/modules/chart.js

@@ -3,28 +3,29 @@ import { redirectToLogin, redirectTo } from '@/common/NavFuncs';
 
 export default {
 	namespaced: true,
-	state: {
-		column: null
-	},
-	mutations: {
-		setColumn(state, column) {
-			state.column = column;
-		}
-	},
-	getters: {
-		getColumn(state) {
-			return state.column
-		}
-	},
 	actions: {
-		getProductSaleMonth({ commit },userId) {
-			console.log('userId:'+userId);
-			return apis.sz.get('/TOrder/getProductSaleMonth?userId='+userId)
+		getStatistics({ commit },param) {
+			// console.log('param1:{}',param);
+			return apis.sz.post('/TOrder/getStatistics',param)
 				.then(res => {
 					const { data } = res;
-					commit('setColumn', data);
+					return data;
 				});
-		}
+		},
+		getMainStatistics({ commit },param) {
+			return apis.sz.post('/TOrder/getMainStatistics',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
+		getEquipmentListByUser({ commit },param) {
+			return apis.sz.post('/TEquipment/getEquipmentListByUser',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 	}
 }