Selaa lähdekoodia

各省销售总数据

李天标 5 vuotta sitten
vanhempi
commit
62aba78281

+ 150 - 0
components/mix-tree/mix-tree.vue

@@ -0,0 +1,150 @@
+<template>
+	<view class="content">
+		<view class="mix-tree-list">
+			<block v-for="(item, index) in treeList" :key="index">
+				<view 
+					class="mix-tree-item"
+					:style="[{
+							paddingLeft: item.rank*15 + 'px',
+							zIndex: item.rank*-1 +50
+						}]"
+					:class="{
+							border: treeParams.border === true,
+							show: item.show,
+							last: item.lastRank,
+							showchild: item.showChild
+						}"
+					@click.stop="treeItemTap(item, index)"
+				>
+					<image class="mix-tree-icon" :src="item.lastRank ? treeParams.lastIcon : item.showChild ? treeParams.currentIcon : treeParams.defaultIcon"></image>
+					{{item.name}}
+				</view>
+			</block>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			list: {
+				type: Array,
+				default(){
+					return [];
+				}
+			},
+			params: {
+				type: Object,
+				default(){
+					return {}
+				}
+			}
+		},
+		data() {
+			return {
+				treeList: [],
+				treeParams: {
+					defaultIcon: '/static/mix-tree/defaultIcon.png',
+					currentIcon: '/static/mix-tree/currentIcon.png',
+					lastIcon: '',
+					border: false
+				}
+			}
+		},
+		watch: {
+			list(list){
+				
+				this.treeParams = Object.assign(this.treeParams, this.params);
+				console.log(this.treeParams, this.params);
+				this.renderTreeList(list);
+			}
+		},
+		methods: {
+			//扁平化树结构
+			renderTreeList(list=[], rank=0, parentId=[]){
+				list.forEach(item=>{
+					this.treeList.push({
+						id: item.id,
+						name: item.name,
+						parentId,  // 父级id数组
+						rank,  // 层级
+						showChild: false,  //子级是否显示
+						show: rank === 0  // 自身是否显示
+					})
+					if(Array.isArray(item.children) && item.children.length > 0){
+						let parents = [...parentId];
+						parents.push(item.id);
+						this.renderTreeList(item.children, rank+1, parents);
+					}else{
+						this.treeList[this.treeList.length-1].lastRank = true;
+					}
+				})
+			},
+			// 点击
+			treeItemTap(item){
+				let list = this.treeList;
+				let id = item.id;
+				if(item.lastRank === true){
+					//点击最后一级时触发事件
+					this.$emit('treeItemClick', item);
+					return;
+				}
+				item.showChild = !item.showChild;
+				list.forEach(childItem=>{
+					if(item.showChild === false){
+						//隐藏所有子级
+						if(!childItem.parentId.includes(id)){
+							return;
+						}
+						if(childItem.lastRank !== true){
+							childItem.showChild = false;
+						}
+						childItem.show = false;
+					}else{
+						if(childItem.parentId[childItem.parentId.length-1] === id){
+							childItem.show = true;
+						}
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+	.mix-tree-list{
+		display: flex;
+		flex-direction: column;
+		padding-left: 30upx;
+	}
+	.mix-tree-item{
+		display: flex;
+		align-items: center;
+		font-size: 30upx;
+		color: #333;
+		height: 0;
+		opacity: 0;
+		transition: .2s;
+		position: relative;
+	}
+	.mix-tree-item.border{
+		border-bottom: 1px solid #eee;
+	}
+	.mix-tree-item.show{
+		height: 80upx;
+		opacity: 1;
+	}
+	.mix-tree-icon{
+		width: 26upx;
+		height: 26upx;
+		margin-right: 8upx;
+		opacity: .9;
+	}
+	
+	.mix-tree-item.showchild:before{
+		transform: rotate(90deg);
+	}
+	.mix-tree-item.last:before{
+		opacity: 0;
+	}
+</style>

+ 86 - 0
components/t-table/t-table.vue

@@ -0,0 +1,86 @@
+<template>
+	<view class="t-table" :style="{ 'border-width': border + 'px', 'border-color': borderColor }">
+		<slot />
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			border: {
+				type: String,
+				default: '1'
+			},
+			borderColor: {
+				type: String,
+				default: '#d0dee5'
+			},
+			isCheck: {
+				type: Boolean,
+				default: false
+			}
+		},
+		provide() {
+			return {
+				table: this
+			};
+		},
+		data() {
+			return {};
+		},
+		created() {
+			this.childrens = [];
+			this.index = 0;
+		},
+		methods: {
+			fire(e, index, len) {
+				let childrens = this.childrens;
+				console.log(childrens);
+				// 全选
+				if (index === 0) {
+					childrens.map((vm, index) => {
+						vm.checkboxData.checked = e;
+						return vm;
+					});
+				} else {
+					let isAll = childrens.find((n, ids) => ids !== 0 && !n.checkboxData.checked);
+					childrens[0].checkboxData.checked = isAll ? false : true;
+				}
+
+				let fireArr = [];
+				for (let i = 0; i < childrens.length; i++) {
+					if (childrens[i].checkboxData.checked && i !== 0) {
+						fireArr.push(childrens[i].checkboxData.value - 1);
+					}
+				}
+				this.$emit('change', {
+					detail: fireArr
+				});
+			}
+		}
+	};
+</script>
+
+<style scoped>
+	.t-table {
+		width: 100%;
+		border: 1px #d0dee5 solid;
+		border-left: none;
+		border-top: none;
+		box-sizing: border-box;
+	}
+
+	.t-table>>>t-tr {
+		display: flex;
+	}
+
+	.t-table>>>t-tr:nth-child(2n) {
+		background: #f5f5f5;
+	}
+
+	/* #ifdef H5 */
+	.t-table>>>.t-tr:nth-child(2n) {
+		background: #f5f5f5;
+	}
+	/* #endif */
+</style>

+ 71 - 0
components/t-table/t-td.vue

@@ -0,0 +1,71 @@
+<template>
+	<view class="t-td" :style="{ 'border-width': thBorder + 'px','border-color':borderColor ,'font-size':fontSize+'px' ,'color':color,'justify-content':tdAlignCpd}">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			align: String
+		},
+		data() {
+			return {
+				thBorder: '1',
+				borderColor: '#d0dee5',
+				fontSize: '14',
+				color: '#555c60',
+				tdAlign: 'center'
+			};
+		},
+		inject: ['table', 'tr'],
+
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.fontSize = this.tr.fontSize;
+			this.color = this.tr.color;
+			if (this.align) {
+				this.tdAlign = this.align;
+			} else {
+				this.tdAlign = this.tr.align
+			}
+		},
+		computed: {
+			tdAlignCpd() {
+				let nameAlign = '';
+				switch (this.tdAlign) {
+					case 'left':
+						nameAlign = 'flex-start'
+						break;
+					case 'center':
+						nameAlign = 'center'
+						break;
+					case 'right':
+						nameAlign = 'flex-end'
+						break;
+					default:
+						nameAlign = 'center'
+						break;
+				}
+				return nameAlign
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-td {
+		flex: 1;
+		display: flex;
+		align-items: center;
+		width: 100%;
+		padding: 14upx;
+		border-top: 1px #d0dee5 solid;
+		border-left: 1px #d0dee5 solid;
+		text-align: center;
+		color: #555c60;
+		font-size: 28upx;
+
+	}
+</style>

+ 71 - 0
components/t-table/t-th.vue

@@ -0,0 +1,71 @@
+<template>
+	<view class="t-th" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor,'font-size':fontSize+'px' ,'color':color,'justify-content':thAlignCpd}">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			align: String,
+		},
+		data() {
+			return {
+				thBorder: '1',
+				borderColor: '#d0dee5',
+				fontSize: '15',
+				color: '#3b4246',
+				thAlign: 'center'
+			};
+		},
+		inject: ['table', 'tr'],
+
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.fontSize = this.tr.fontSize;
+			this.color = this.tr.color;
+			if (this.align) {
+				this.thAlign = this.align;
+			} else {
+				this.thAlign = this.tr.align
+			}
+		},
+
+		computed: {
+			thAlignCpd() {
+				let nameAlign = '';
+				switch (this.thAlign) {
+					case 'left':
+						nameAlign = 'flex-start'
+						break;
+					case 'center':
+						nameAlign = 'center'
+						break;
+					case 'right':
+						nameAlign = 'flex-end'
+						break;
+					default:
+						nameAlign = 'center'
+						break;
+				}
+				return nameAlign
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-th {
+		flex: 1;
+		display: flex;
+		align-items: center;
+		font-size: 30upx;
+		font-weight: bold;
+		text-align: center;
+		color: #3b4246;
+		border-left: 1px #d0dee5 solid;
+		border-top: 1px #d0dee5 solid;
+		padding: 15upx;
+	}
+</style>

+ 81 - 0
components/t-table/t-tr.vue

@@ -0,0 +1,81 @@
+<template>
+	<view class="t-tr">
+		<view v-if="isCheck" class="t-check-box" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor}">
+			<checkbox-group @change="checkboxChange">
+				<checkbox :value="checkboxData.value + ''" :checked="checkboxData.checked" />
+			</checkbox-group>
+		</view>
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			fontSize: String,
+			color: String,
+			align: String
+		},
+		inject: ['table'],
+		provide() {
+			return {
+				tr: this
+			};
+		},
+		data() {
+			return {
+				isCheck: false,
+				checkboxData: {
+					value: 0,
+					checked: false
+				},
+				checked: false,
+				thBorder: '1',
+				borderColor: '#d0dee5'
+			};
+		},
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.table.childrens.push(this);
+			this.checkboxData.value = this.table.index++;
+			this.isCheck = this.table.isCheck;
+
+		},
+		methods: {
+			checkboxChange(e) {
+				this.checkboxData.checked = !this.checkboxData.checked;
+				this.table.childrens[this.checkboxData.value] = this;
+				this.table.fire(e.detail.value[0] ? true : false, this.checkboxData.value, this.table.index);
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-tr {
+		width: 100%;
+		display: flex;
+	}
+
+	.t-tr t-th,
+	.t-tr t-td {
+		display: flex;
+		flex: 1;
+	}
+
+	.t-tr .t-check-box {
+		flex-shrink: 0;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 80upx;
+		color: #3b4246;
+		border-left: 1px #d0dee5 solid;
+		border-top: 1px #d0dee5 solid;
+	}
+
+	.t-tr .t-check-box checkbox {
+		transform: scale(0.8);
+	}
+</style>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 921 - 0
components/xfl-select/xfl-select.vue


+ 0 - 2
pages/Charts/elseStatistics.vue

@@ -38,8 +38,6 @@
 			this.equipmentId = option['equipmentId'];
 			this.adminId = option['adminId'];
 			this.pname = option['pname'];
-			// console.log("option:",this.equipmentId,this.adminId)
-			// this.mainStatistics.init();
 		},
 		mounted() {
 		},

+ 388 - 8
pages/Charts/equipmentStatistics.vue

@@ -143,6 +143,75 @@
 					 @touchmove="moveLine8" @touchend="touchEndLine8" style="background-color: #FFFFFF;"></canvas>
 				</view>
 			</view>
+			
+			<!-- 各省销售额 -->
+			<view class="qiun-columns">
+				<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
+					<view class="qiun-title-dot-light">
+						<view class="dis">全国日销售排行</view>
+					</view>
+					<view class="shijian" style="text-align: center;position: relative;">
+						<image @click="pre3('day')" class="preImg" src="/static/img/leftTriangle.png"></image>
+						<span>{{startDate9}}</span>
+						<image @click="next3('day')" class="nextImg" src="/static/img/rightTriangle.png"></image>
+					</view>
+				</view>
+				<view class="qiun-charts2" style="background-color: #FFFFFF;">
+					<canvas canvas-id="canvaColumn9" id="canvaColumn9" class="charts2" disable-scroll=true @touchstart="touchLine9"
+					 @touchmove="moveLine9" @touchend="touchEndLine9" style="background-color: #FFFFFF;"></canvas>
+				</view>
+			</view>
+			<view class="line"></view>
+			<view class="qiun-columns">
+				<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
+					<view class="qiun-title-dot-light">
+						<view class="dis">全国周销售排行</view>
+					</view>
+					<view class="shijian" style="text-align: center;position: relative;">
+						<image @click="pre3('week')" class="preImg" src="/static/img/leftTriangle.png"></image>
+						<span>{{startDate10}} 至 {{endDate10}}</span>
+						<image @click="next3('week')" class="nextImg" src="/static/img/rightTriangle.png"></image>
+					</view>
+				</view>
+				<view class="qiun-charts2" style="background-color: #FFFFFF;">
+					<canvas canvas-id="canvaColumn10" id="canvaColumn10" class="charts2" disable-scroll=true @touchstart="touchLine10"
+					 @touchmove="moveLine10" @touchend="touchEndLine10" style="background-color: #FFFFFF;"></canvas>
+				</view>
+			</view>
+			<view class="line"></view>
+			<view class="qiun-columns">
+				<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
+					<view class="qiun-title-dot-light">
+						<view class="dis">全国月销售排行</view>
+					</view>
+					<view class="shijian" style="text-align: center;position: relative;">
+						<image @click="pre3('month')" class="preImg" src="/static/img/leftTriangle.png"></image>
+						<span>{{startDate11}} 至 {{endDate11}}</span>
+						<image @click="next3('month')" class="nextImg" src="/static/img/rightTriangle.png"></image>
+					</view>
+				</view>
+				<view class="qiun-charts2" style="background-color: #FFFFFF;">
+					<canvas canvas-id="canvaColumn11" id="canvaColumn11" class="charts2" disable-scroll=true @touchstart="touchLine11"
+					 @touchmove="moveLine11" @touchend="touchEndLine11" style="background-color: #FFFFFF;"></canvas>
+				</view>
+			</view>
+			<view class="line"></view>
+			<view class="qiun-columns">
+				<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
+					<view class="qiun-title-dot-light">
+						<view class="dis">全国年销售排行</view>
+					</view>
+					<view class="shijian" style="text-align: center;position: relative;">
+						<image @click="pre3('year')" class="preImg" src="/static/img/leftTriangle.png"></image>
+						<span>{{startDate12}} 至 {{endDate12}}</span>
+						<image @click="next3('year')" class="nextImg" src="/static/img/rightTriangle.png"></image>
+					</view>
+				</view>
+				<view class="qiun-charts2" style="background-color: #FFFFFF;">
+					<canvas canvas-id="canvaColumn12" id="canvaColumn12" class="charts2" disable-scroll=true @touchstart="touchLine12"
+					 @touchmove="moveLine12" @touchend="touchEndLine12" style="background-color: #FFFFFF;"></canvas>
+				</view>
+			</view>
 		</view>
 	</view>
 </template>
@@ -163,10 +232,16 @@
 	var canvaColumn2 = null;
 	var canvaColumn3 = null;
 	var canvaColumn4 = null;
+	
 	var canvaColumn5 = null;
 	var canvaColumn6 = null;
 	var canvaColumn7 = null;
 	var canvaColumn8 = null;
+	
+	var canvaColumn9 = null;
+	var canvaColumn10 = null;
+	var canvaColumn11 = null;
+	var canvaColumn12 = null;
 	export default {
 		name: 'equipmentStatistics',
 		props: {
@@ -178,6 +253,8 @@
 				cWidth: '',
 				cHeight: '',
 				pixelRatio: 1,
+				tese:0,
+				
 				startDate1: '',
 				endDate1: '',
 				startDate2: '',
@@ -186,6 +263,7 @@
 				endDate3: '',
 				startDate4: '',
 				endDate4: '',
+				
 				startDate5: '',
 				endDate5: '',
 				startDate6: '',
@@ -194,6 +272,15 @@
 				endDate7: '',
 				startDate8: '',
 				endDate8: '',
+				
+				startDate9: '',
+				endDate9: '',
+				startDate10: '',
+				endDate10: '',
+				startDate11: '',
+				endDate11: '',
+				startDate12: '',
+				endDate12: '',
 				show: false
 			}
 		},
@@ -205,14 +292,16 @@
 			// this.init2();
 		},
 		onShow() {
+			this.tese = this.tese + 1;
 			var globalUser = uni.getStorageSync("globalUser");
 			if (globalUser.id == '1') {
 				this.show = true
 			}
 			this.init();
 		},
+
 		methods: {
-			...mapActions('chart', ['getProvince', 'getEquipmentStatistics', 'getMainStatistics', 'getMachineNum']),
+			...mapActions('chart', ['getProvince','getProvinceAll', 'getEquipmentStatistics', 'getMainStatistics', 'getMachineNum']),
 			async init() {
 				if (this.pname === '') {
 					this.pname = uni.getStorageSync("name");
@@ -225,15 +314,18 @@
 
 				await this.initDateRang(new Date(), 'day');
 				await this.initDateRang(new Date(), 'week');
-				await this.initDateRang(new Date(), 'month');
-				await this.initDateRang(new Date(), 'year');
+				if(this.tese == 1){
+					await this.initDateRang(new Date(), 'month');
+					await this.initDateRang(new Date(), 'year');
+				}
+
 				await this.init2();
+				await this.init3();
 			},
 			async init2() {
 				if (this.pname === '') {
 					this.pname = uni.getStorageSync("name");
 				}
-				// console.log("adminId:" + this.adminId)
 				_self = this;
 				//图表中图
 				this.cWidth2 = uni.upx2px(690);
@@ -241,10 +333,30 @@
 				if (this.show == true) {
 					await this.initDateRang2(new Date(), 'day');
 					await this.initDateRang2(new Date(), 'week');
-					await this.initDateRang2(new Date(), 'month');
-					await this.initDateRang2(new Date(), 'year');
+					if(this.tese == 1){
+						await this.initDateRang2(new Date(), 'month');
+						await this.initDateRang2(new Date(), 'year');
+					}
+					
+				}
+			},
+			async init3() {
+				if (this.pname === '') {
+					this.pname = uni.getStorageSync("name");
+				}
+				_self = this;
+				//图表中图
+				this.cWidth3 = uni.upx2px(690);
+				this.cHeight3 = uni.upx2px(370);
+				if (this.show == true) {
+					await this.initDateRang3(new Date(), 'day');
+					await this.initDateRang3(new Date(), 'week');
+					if(this.tese == 1){
+						await this.initDateRang3(new Date(), 'month');
+						await this.initDateRang3(new Date(), 'year');
+					}
+					
 				}
-
 			},
 			initDateRang(day, chartType) {
 				const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
@@ -286,6 +398,26 @@
 
 				return this.getProvinceData(chartType);
 			},
+			initDateRang3(day, chartType) {
+				const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
+				if (chartType === 'day') {
+					this.startDate9 = dateUtils.formateDate(day, 'yyyy/MM/dd');
+				}
+				if (chartType === 'week') {
+					this.startDate10 = dateUtils.formateDate(dateUtils.getFirstDayOfWeek(day), 'yyyy/MM/dd');
+					this.endDate10 = dateUtils.formateDate(dateUtils.getLastDayOfWeek(day), 'yyyy/MM/dd');
+				}
+				if (chartType === 'month') {
+					this.startDate11 = dateUtils.formateDate(dateUtils.getCurrentMonFirstDate(day), 'yyyy/MM/dd');
+					this.endDate11 = dateUtils.formateDate(dateUtils.getCurrentMonLastDate(day), 'yyyy/MM/dd');
+				}
+				if (chartType === 'year') {
+					this.startDate12 = dateUtils.formateDate(dateUtils.getCurrentYearFirstDate(day), 'yyyy/MM/dd');
+					this.endDate12 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
+				}
+			
+				return this.getProvinceAllData(chartType);
+			},
 			/**上一个 */
 			pre(chartType) {
 				let day;
@@ -327,6 +459,26 @@
 				}
 				this.initDateRang2(day, chartType);
 			},
+			pre3(chartType) {
+				let day;
+				if (chartType === 'day') { // 日
+					day = new Date(this.startDate9);
+					day.setDate(day.getDate() - 1);
+				}
+				if (chartType === 'week') { // 周
+					day = new Date(this.startDate10);
+					day.setDate(day.getDate() - 7);
+				}
+				if (chartType === 'month') { // 月
+					day = new Date(this.startDate11);
+					day.setMonth(day.getMonth() - 1);
+				}
+				if (chartType === 'year') { // 年
+					day = new Date(this.startDate12);
+					day.setFullYear(day.getFullYear() - 1);
+				}
+				this.initDateRang3(day, chartType);
+			},
 			/**下一个 */
 			next(chartType) {
 				let day;
@@ -370,6 +522,27 @@
 
 				this.initDateRang2(day, chartType);
 			},
+			next3(chartType) {
+				let day;
+				if (chartType === 'day') { // 日
+					day = new Date(this.startDate9);
+					day.setDate(day.getDate() + 1);
+				}
+				if (chartType === 'week') { // 周
+					day = new Date(this.startDate10);
+					day.setDate(day.getDate() + 7);
+				}
+				if (chartType === 'month') { // 月
+					day = new Date(this.startDate11);
+					day.setMonth(day.getMonth() + 1);
+				}
+				if (chartType === 'year') { // 年
+					day = new Date(this.startDate12);
+					day.setFullYear(day.getFullYear() + 1);
+				}
+			
+				this.initDateRang3(day, chartType);
+			},
 			getStatisticsData(chartType) {
 				const param = {
 					'chartType': chartType
@@ -540,6 +713,92 @@
 						}
 					});
 			},
+			
+			getProvinceAllData(chartType) {
+				const param = {
+					'chartType': chartType
+				};
+				if (chartType == 'day') {
+					param['startDate'] = this.startDate9;
+					param['endDate'] = this.startDate9;
+				}
+				if (chartType == 'week') {
+					param['startDate'] = this.startDate10;
+					param['endDate'] = this.endDate10;
+				}
+				if (chartType == 'month') {
+					param['startDate'] = this.startDate11;
+					param['endDate'] = this.endDate11;
+				}
+				if (chartType == 'year') {
+					param['startDate'] = this.startDate12;
+					param['endDate'] = this.endDate12;
+				}
+				if (this.adminId) { // 子组件,则拿传过来的参
+					param['adminId'] = this.adminId;
+				} else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
+					param['adminId'] = this.loginUser['id'];
+				}
+				if (this.equipmentId) {
+					param['equipmentId'] = this.equipmentId;
+				}
+			
+				return this.getProvinceAll(param)
+					.then(data => {
+						uni.stopPullDownRefresh();
+						if (param['chartType'] == 'day') {
+							canvaColumn9 = this.initChart3('canvaColumn9', data);
+						}
+						if (param['chartType'] == 'week') {
+							canvaColumn10 = this.initChart3('canvaColumn10', data);
+						}
+						if (param['chartType'] == 'month') {
+							canvaColumn11 = this.initChart3('canvaColumn11', data);
+						}
+						if (param['chartType'] == 'year') {
+							canvaColumn12 = this.initChart3('canvaColumn12', data);
+						}
+			
+					}, _ => {
+						uni.stopPullDownRefresh();
+						if (param['chartType'] == 'day') {
+							canvaColumn9 = this.initChart3('canvaColumn9', {
+								categories: ['暂无数据'],
+								series: [{
+									name: '销售额',
+									data: [0]
+								}]
+							});
+						}
+						if (param['chartType'] == 'week') {
+							canvaColumn10 = this.initChart3('canvaColumn10', {
+								categories: ['暂无数据'],
+								series: [{
+									name: '销售额',
+									data: [0]
+								}]
+							});
+						}
+						if (param['chartType'] == 'month') {
+							canvaColumn11 = this.initChart3('canvaColumn11', {
+								categories: ['暂无数据'],
+								series: [{
+									name: '销售额',
+									data: [0]
+								}]
+							});
+						}
+						if (param['chartType'] == 'year') {
+							canvaColumn12 = this.initChart3('canvaColumn12', {
+								categories: ['暂无数据'],
+								series: [{
+									name: '销售额',
+									data: [0]
+								}]
+							});
+						}
+					});
+			},
 			initChart(canvasId, chartData) {
 				return new uCharts({
 					$this: _self,
@@ -610,7 +869,43 @@
 					height: _self.cHeight2 * _self.pixelRatio,
 					extra: {
 						column: {
-							// width: _self.cWidth*_self.pixelRatio*0.45/chartData.categories.length
+							width: 18
+						}
+					}
+				});
+			},
+			initChart3(canvasId, chartData) {
+				return new uCharts({
+					$this: _self,
+					canvasId: canvasId,
+					enableScroll: true,
+					type: 'column',
+					legend: true,
+					fontSize: 11,
+					background: '#FFFFFF', //y轴颜色
+					pixelRatio: 1,
+					animation: true,
+					categories: chartData.categories,
+					series: chartData.series,
+					xAxis: {
+						type: 'grid',
+						gridType: 'dash',
+						rotateLabel: true,
+						itemCount: 4, //x轴单屏显示数据的数量,默认为5个
+						scrollShow: true, //新增是否显示滚动条,默认false
+						scrollAlign: 'left', //滚动条初始位置
+						scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF  滚动条颜色底色
+						scrollColor: '#DEE7F7', //默认为 #A6A6A6  滚动条颜色
+						// disableGrid:true,
+					},
+					yAxis: {
+						//disabled:true
+					},
+					dataLabel: true,
+					width: _self.cWidth3 * _self.pixelRatio,
+					height: _self.cHeight3 * _self.pixelRatio,
+					extra: {
+						column: {
 							width: 18
 						}
 					}
@@ -784,6 +1079,91 @@
 					});
 				}
 			},
+			
+			touchLine9(e) {
+				if (canvaColumn9) {
+					canvaColumn9.scrollStart(e);
+				}
+			},
+			moveLine9(e) {
+				if (canvaColumn9) {
+					canvaColumn9.scroll(e);
+				}
+			},
+			touchEndLine9(e) {
+				if (canvaColumn9) {
+					canvaColumn9.scrollEnd(e);
+					//下面是toolTip事件,如果滚动后不需要显示,可不填写
+					canvaColumn9.showToolTip(e, {
+						format: function(item, category) {
+							return category + ' ' + item.name + ':' + item.data
+						}
+					});
+				}
+			},
+			touchLine10(e) {
+				if (canvaColumn10) {
+					canvaColumn10.scrollStart(e);
+				}
+			},
+			moveLine10(e) {
+				if (canvaColumn10) {
+					canvaColumn10.scroll(e);
+				}
+			},
+			touchEndLine10(e) {
+				if (canvaColumn10) {
+					canvaColumn10.scrollEnd(e);
+					//下面是toolTip事件,如果滚动后不需要显示,可不填写
+					canvaColumn10.showToolTip(e, {
+						format: function(item, category) {
+							return category + ' ' + item.name + ':' + item.data
+						}
+					});
+				}
+			},
+			touchLine11(e) {
+				if (canvaColumn11) {
+					canvaColumn11.scrollStart(e);
+				}
+			},
+			moveLine11(e) {
+				if (canvaColumn11) {
+					canvaColumn11.scroll(e);
+				}
+			},
+			touchEndLine11(e) {
+				if (canvaColumn11) {
+					canvaColumn11.scrollEnd(e);
+					//下面是toolTip事件,如果滚动后不需要显示,可不填写
+					canvaColumn11.showToolTip(e, {
+						format: function(item, category) {
+							return category + ' ' + item.name + ':' + item.data
+						}
+					});
+				}
+			},
+			touchLine12(e) {
+				if (canvaColumn12) {
+					canvaColumn12.scrollStart(e);
+				}
+			},
+			moveLine12(e) {
+				if (canvaColumn12) {
+					canvaColumn12.scroll(e);
+				}
+			},
+			touchEndLine12(e) {
+				if (canvaColumn12) {
+					canvaColumn12.scrollEnd(e);
+					//下面是toolTip事件,如果滚动后不需要显示,可不填写
+					canvaColumn12.showToolTip(e, {
+						format: function(item, category) {
+							return category + ' ' + item.name + ':' + item.data
+						}
+					});
+				}
+			},
 		}
 	}
 </script>

+ 141 - 0
pages/User/buyPromo.vue

@@ -0,0 +1,141 @@
+<template>
+	<view class=" ">
+		<view class="font header">
+			优惠码价格:{{price}}元/个
+		</view>
+		<view class="font header">
+			<view class="font">
+				你要购买的数量:
+			</view>
+			<view class="input-two">
+				<input  type="text" class="input" v-model="num" />
+			</view>
+			<view class="font3">
+				个
+			</view>
+		</view>
+		<view class="font2 header">
+			<view class="font">
+				有效期:
+			</view>
+			<view class="input-two">
+				<input  type="text" class="input" v-model="day" />
+			</view>
+			<view class="font3">
+				天.(最长90天)
+			</view>
+		</view>
+		<view class="font2 header">
+			合计:{{num*price}}元
+		</view>
+		<view class="button">
+			<button type="primary" @click="buy()" class="button2">
+				<p class="p">购买</p>
+			</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				price:null,
+				num:'10',
+				day:'30'
+			}
+		},
+		onLoad() {
+		},
+		onShow() {
+			this.findPrice();
+		},
+		methods: {
+			findPrice(){
+				uni.request({
+					url: this.serverurl + '/TPromoCode/findPrice',
+					method: "GET",
+					success: (res) => {
+						
+						this.price = res.data.data;
+					}
+				})
+			},
+			buy(){
+				if(this.day>90){
+					uni.showModal({
+						content: '有效期不能超过90天',
+						showCancel: false
+					});
+					return null;
+				}
+				console.log(this.num+this.day)
+			}
+		},
+
+	}
+</script>
+
+<style>
+	.header {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+		padding-left: 20upx;
+	}
+	.font{
+		padding-top: 20upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font2{
+		padding-top: 40upx;
+		padding-bottom: 30upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font3{
+		padding-left: 30upx;
+		padding-top: 23upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.input-two {
+		width: 80upx;
+		height: 30upx;
+		padding-top: 23upx;
+		padding-left: 30upx;
+	}
+	.input {
+		padding-left: 20upx;
+		
+		background-color: #FFFFFF;
+		width: 80upx;
+		height: 30upx;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		border-radius: 5upx;
+	}
+	.button{
+		padding-top: 70upx;
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+	.button2{
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+	.p{
+		padding-top: 2upx;
+		margin: 0 auto;
+		font-size: 45upx;
+		font-family: "PingFang-SC-Bold";
+	}
+</style>

+ 250 - 0
pages/User/equipmentName.vue

@@ -0,0 +1,250 @@
+<template>
+	<view class="">
+		<view class="xiugai">
+			修改设备名称
+		</view>
+		<view v-for="(list,index) in listName" :key="index" class="body">
+			<view class="input-two">
+				<input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
+				<p id="p2" class="p2" :style="{display:showOrNo}">如:粤A张先生1</p>
+			</view>
+			<view class="button2">
+				<button type="primary" @click="updata1()" class="button">
+					<p class="p">更改</p>
+				</button>
+			</view>
+		
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex'
+	
+	export default {
+
+		data() {
+			return {
+				name: '',
+				show: false,
+				listName: [],
+				value: null,
+				id: null,
+				parm: {
+					name: null,
+					id: null
+				},
+				showOrNo: null,
+				avatarUrl: null,
+				weixinUp: false,
+				weixinDown: true
+			};
+		},
+		onPullDownRefresh() {
+			setTimeout(function() {
+				uni.stopPullDownRefresh();
+			}, 800);
+		},
+		onShow() {
+			// uni.startPullDownRefresh();
+			var me = this;
+			var name = uni.getStorageSync("name");
+			me.name = name;
+			var listName = uni.getStorageSync("listName");
+			me.listName = listName;
+			if (listName != '' && listName != null) {
+				var adminId = listName[0].adminId;
+				if (adminId != '1' && adminId != null) {
+					me.show = true;
+				}
+			}
+			var newparm = uni.getStorageSync("newparm");
+			if (newparm.toString().length > 1) {
+				if (newparm.avatarUrl.length > 1) {
+					this.avatarUrl = newparm.avatarUrl;
+					this.weixinUp = true;
+					this.weixinDown = false;
+				}
+			}
+	
+		},
+		onLoad() {
+	
+		},
+		methods: {
+			setStyle() {
+				this.showOrNo = "block";
+			},
+			setStyle2() {
+				this.showOrNo = "none";
+			},
+			getValue: function(event) {
+				// 绕过v-model 获取input输入框的值  
+				var value = event.target.value;
+				var id = event.target.id;
+				this.value = value;
+				this.id = id;
+				this.parm.name = value;
+				this.parm.id = id;
+			},
+			...mapActions('chart', ['updata']),
+			updata1() {
+				if (this.parm.id != null) {
+					this.updata(this.parm)
+						.then(res => {
+							uni.showModal({
+								title: '提示',
+								content: '名称:' + this.parm.name + res.message,
+							});
+						}, _ => void uni.stopPullDownRefresh());
+				}
+	
+	
+			}
+		}
+	}
+</script>
+
+<style>
+
+
+	.settings {
+		width: 100upx;
+		height: 64upx;
+		border-radius: 10upx;
+		background: #D6101F;
+		/* padding-right: 50upx; */
+		/* padding-top: 5upx; */
+		text-align: center;
+		margin: 0 auto;
+	}
+	
+	.p3 {
+		/* #ifdef H5 */
+		top: -13%;
+		/* #endif */
+		font-size: 32upx;
+		color: #FFFFFF;
+		font-weight: bold;
+		width: 100upx;
+		height: 64upx;
+		/* #ifndef H5 */
+		padding-top: 3upx;
+		/* #endif */
+		position: absolute;
+		/* 水平居中 */
+		left: 50%;
+		-webkit-transform: translateX(-50%);
+		transform: translateX(-50%);
+	}
+	
+	.centerY {
+		position: absolute;
+		top: 50%;
+		-webkit-transform: translateY(-50%);
+		transform: translateY(-50%);
+	}
+	
+	.button2 {
+		padding-right: 60upx;
+		padding-top: 2upx;
+	}
+	
+	.button {
+		/* padding: 5upx 10upx 10upx 0upx; */
+		width: 80upx;
+		height: 60upx;
+		border-radius: 10upx;
+	}
+	
+	.p {
+		/* #ifdef H5 */
+		top: -13%;
+		/* #endif */
+		width: 80upx;
+		height: 60upx;
+		font-size: 30upx;
+		/* #ifndef H5 */
+		padding-top: 3upx;
+		/* #endif */
+	
+		position: absolute;
+		/* 水平居中 */
+		left: 50%;
+		-webkit-transform: translateX(-50%);
+		transform: translateX(-50%);
+	}
+	
+	.input {
+		/* padding: 10upx 20upx 10upx 0upx; */
+		padding-left: 20upx;
+		padding-top: 10upx;
+		background-color: #FFFFFF;
+		width: 500upx;
+		height: 50upx;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		border-radius: 5upx;
+	}
+	
+	.xiugai {
+		width: 92%;
+		border-left: 20upx;
+		border-left: 10upx solid #206DC3;
+		padding-left: 10upx;
+		height: 38upx;
+		padding-bottom: 20upx;
+		font-family: "PingFang-SC-Bold";
+		font-weight: bold;
+		margin: auto;
+		font-size: 32upx;
+		color: #363D44;
+	}
+	
+	.xiugai2 {
+		width: 100%;
+		height: 80upx;
+		font-family: "PingFang-SC-Bold";
+		font-weight: bold;
+		margin: auto;
+		font-size: 50upx;
+		color: #363D44;
+		position: fixed;
+		bottom: 0;
+	}
+	
+	.xiugai3 {
+		height: 80upx;
+		font-family: "PingFang-SC-Bold";
+		font-weight: bold;
+		margin: auto;
+		font-size: 40upx;
+		color: #363D44;
+	
+	}
+	
+	.body {
+		background-color: #FFFFFF;
+		padding: 10upx 10upx 10upx 10upx;
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+	}
+	
+	.input-two {
+		width: 600upx;
+		height: 100upx;
+		padding-left: 30upx;
+	}
+	
+	.p2 {
+		color: #DD524D;
+		display: none;
+		width: 600upx;
+		height: 50upx;
+		border: 1px;
+	}
+</style>

+ 105 - 61
pages/User/merchantList.vue

@@ -1,114 +1,158 @@
 <!-- 机器销售列表页 -->
 <template>
-	<view v-if="merchantList.length>1">
-		<uni-collapse :accordion="true" >
-			<view class="titlelist" v-for="(merchant,index) in merchantList" :key="merchant.id" >
-				<uni-collapse-item :title="getMerchantTitle(merchant)" :open="index===0">
-					<view class="titlelist" style="padding: 20upx;background-color: aliceblue;">
-						<view v-if="merchant.equipmentList.length==0" style="text-align: center;">暂无数据</view>
-						<view v-if="merchant.equipmentList.length>0">
-						<view class="">
+	<view class="">
+		<view v-if="id!=1">
+			<view v-if="merchantList[0].equipmentList.length>1">
+				<uni-collapse :accordion="true">
+					<uni-list>
+						<uni-list-item title="总销售情况" @click="openByAdmin(merchantList[0].name,merchantList[0].id)" />
+						<view class="titlelist" v-for="equipment in merchantList[0].equipmentList" :key="equipment.id">
+							<uni-list-item :title="getEquipmentTitle(equipment)" @click="openByEquipment(merchantList[0].name,equipment.id)" />
 						</view>
-							<uni-collapse :accordion="true">
-								<uni-list>
-									<uni-list-item title="总销售情况" @click="openByAdmin(merchant.name,merchant.id)"/>
-									<view  v-for="equipment in merchant.equipmentList" :key="equipment.id">
-										<uni-list-item :title="getEquipmentTitle(equipment)" @click="openByEquipment(merchant.name,equipment.id)"/>
-									</view>
-								</uni-list>
-							</uni-collapse>	
-						</view>
-					</view>
-				</uni-collapse-item>
+					</uni-list>
+				</uni-collapse>
 			</view>
-		</uni-collapse>
-	</view>
-	<view v-else>
-		<view v-if="merchantList[0].equipmentList.length>1">
-			<uni-collapse :accordion="true">
-				<uni-list>
-					<uni-list-item title="总销售情况" @click="openByAdmin(merchantList[0].name,merchantList[0].id)"/>
-					<view class="titlelist" v-for="equipment in merchantList[0].equipmentList" :key="equipment.id">
-						<uni-list-item :title="getEquipmentTitle(equipment)" @click="openByEquipment(merchantList[0].name,equipment.id)"/>
-					</view>
-				</uni-list>
-			</uni-collapse>	
+			<view v-else style="text-align: center;">暂无数据</view>
+		</view>
+		<view class="">
+			<mix-tree :list="list" @treeItemClick="treeItemClick"></mix-tree>
 		</view>
-		<view v-else style="text-align: center;">暂无数据</view>
 	</view>
 </template>
 
 <script>
-    import {mapState,mapActions,mapMutations} from 'vuex'
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex'
 	import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
 	import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
 	import uniList from '@/components/uni-list/uni-list.vue'
 	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
-	
-    export default {
+	import mixTree from '@/components/mix-tree/mix-tree'
+	export default {
 		components: {
 			uniCollapse,
 			uniCollapseItem,
 			uniList,
-			uniListItem
+			uniListItem,
+			mixTree
 		},
 		data() {
 			return {
-				merchantList:[{equipmentList:[]}],
+				merchantList: [{
+					equipmentList: []
+				}],
 				extraIcon: {
 					color: '#4cd964',
 					size: '22',
 					type: 'spinner'
-				}
+				},
+				id: null,
+				pname:null,
+				list: []
 			}
 		},
 		computed: {
 			...mapState(['loginUser']),
 		},
-		onLoad(state){
+		onShow() {
+			var globalUser = uni.getStorageSync("globalUser");
+			this.id = globalUser.id;
+		},
+		onLoad(state) {
+			var globalUser = uni.getStorageSync("globalUser");
+			this.id = globalUser.id;
 			this.getEquipmentListData();
 		},
 		onPullDownRefresh() {
 			this.getEquipmentListData();
 		},
 		methods: {
-			...mapActions('chart', ['getEquipmentListByUser']),
-			openByAdmin(pname,adminId){
+			...mapActions('chart', ['getEquipmentListByUser', 'getEquipmentListByProvince']),
+			openByAdmin(pname, adminId) {
 				uni.navigateTo({
-					url: '/pages/Charts/elseStatistics?adminId=' + adminId+'&pname='+pname,
+					url: '/pages/Charts/elseStatistics?adminId=' + adminId + '&pname=' + pname,
 				});
 			},
-			openByEquipment(pname,equipmentId){
+			openByEquipment(pname, equipmentId) {
 				uni.navigateTo({
-					url: '/pages/Charts/elseStatistics?equipmentId=' + equipmentId+'&pname='+pname,
+					url: '/pages/Charts/elseStatistics?equipmentId=' + equipmentId + '&pname=' + pname,
 				});
 			},
-			getMerchantTitle(merchant){
-				return merchant.name?merchant.name:merchant.username;
+			//点击最后一级时触发该事件
+			treeItemClick(item) {
+				let {
+					id,
+					name,
+					parentId
+				} = item;
+				if(name=="总销售情况"){
+					uni.request({
+						url: this.serverurl + '/TAdmin/findById',
+						data: {
+							"id": id,
+						},
+						method: "POST",
+						success: (res) => {
+							this.pname = res.data.data.name;
+							uni.navigateTo({
+								url: '/pages/Charts/elseStatistics?adminId=' + id + '&pname=' + this.pname,
+							});
+						}
+					})
+				}else{
+					uni.request({
+						url: this.serverurl + '/TEquipment/findByEquipment',
+						data: {
+							"id": id,
+						},
+						method: "POST",
+						success: (res) => {
+							this.pname = res.data.data.name;
+							uni.navigateTo({
+								url: '/pages/Charts/elseStatistics?equipmentId=' + id + '&pname=' + this.pname,
+							});
+						}
+					})
+				}
+				console.log(item)
+			},
+			getMerchantTitle(merchant) {
+				return merchant.name ? merchant.name : merchant.username;
 			},
-			getEquipmentTitle(equipment){
-				return equipment.name?equipment.name:equipment.clientId;
+			getEquipmentTitle(equipment) {
+				return equipment.name ? equipment.name : equipment.clientId;
 			},
-			getEquipmentListData(){
-				this.getEquipmentListByUser(this.loginUser)
-				.then(data => {
-					this.merchantList = data;
-					var listName = data[0].equipmentList;
-					var listId = data[0].id;
-					if(listId!=null && listId!='1'){
-						uni.setStorageSync("listName",listName);
+			getEquipmentListData() {
+				if(this.id==1){
+					this.getEquipmentListByProvince(this.loginUser)
+					.then(data => {
+						this.list = data;
+					}, _ => void uni.stopPullDownRefresh());
+				}else{
+					this.getEquipmentListByUser(this.loginUser)
+					.then(data => {
+						this.merchantList = data;
+						var listName = data[0].equipmentList;
+						var listId = data[0].id;
+						if(listId!=null && listId!='1'){
+							uni.setStorageSync("listName",listName);
+						}
+						uni.stopPullDownRefresh();
 					}
-					uni.stopPullDownRefresh();
+					, _ => void uni.stopPullDownRefresh());
 				}
-				, _ => void uni.stopPullDownRefresh());
+				
 			}
 		}
-    }
+	}
 </script>
 
 <style>
-	.titlelist{
-		color:#363D44;
+	.titlelist {
+		color: #363D44;
 		font-size: 16upx;
 		font-family: "PingFang-SC-Medium";
 	}

+ 158 - 0
pages/User/promoCode.vue

@@ -0,0 +1,158 @@
+<template>
+	<view class="warp">
+		<view class="font">
+				<uni-list class="font">
+					<uni-list-item title="购买优惠码" @click="buy()" />
+				</uni-list>
+		</view>
+		<view class="box">
+			<view class="font">优惠码列表</view>
+			<view class="header">
+				<view class="nickname">
+					筛选条件:
+				</view>
+				<!-- <view class="header"> -->
+				<view class="nickname">
+					状态:
+				</view>
+				<view style="width: 20%; margin-bottom: 2px;padding-top: 2upx; ">
+					<xfl-select :list="list" :clearable="false" :showItemNum="4" :focusShowList="true" :isCanInput="false"
+					 :style_Container="'height: 18px;font-size: 13px;'" :placeholder="''" :initValue="'全部'" :selectHideType="'hideAll'"
+					 @change="change">
+					</xfl-select>
+				</view>
+				<!-- </view> -->
+			</view>
+
+			<t-table @change="change">
+				<t-tr>
+					<t-th>优惠码</t-th>
+					<t-th>到期时间</t-th>
+					<t-th>状态</t-th>
+					<t-th>使用时间</t-th>
+					<t-th>使用机器</t-th>
+				</t-tr>
+				<t-tr v-for="item in tableList" :key="item.id">
+					<t-td>{{ item.code}}</t-td>
+					<t-td>{{ item.lastUseDate}}</t-td>
+					<t-td>{{ item.isUse=='0'?'未使用':item.isUse=='1'?'已使用':item.isUse=='2'?'已过期':''}}</t-td>
+					<t-td>{{ item.useDate}}</t-td>
+					<t-td>{{ item.useBy}}</t-td>
+				</t-tr>
+			</t-table>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import tTable from '@/components/t-table/t-table.vue';
+	import tTh from '@/components/t-table/t-th.vue';
+	import tTr from '@/components/t-table/t-tr.vue';
+	import tTd from '@/components/t-table/t-td.vue';
+	import xflSelect from '@/components/xfl-select/xfl-select.vue';
+	import uniList from '@/components/uni-list/uni-list.vue';
+	import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
+	export default {
+		components: {
+			uniList,
+			uniListItem,
+			tTable,
+			tTh,
+			tTr,
+			tTd,
+			xflSelect
+		},
+		data() {
+			return {
+				tableList: [],
+				list: [ //要展示的数据
+					'全部',
+					'未使用',
+					'使用',
+					'已过期',
+				],
+			};
+		},
+		onShow() {
+			this.init();
+		},
+		methods: {
+			buy() {
+				uni.navigateTo({
+					url: 'buyPromo',
+				});
+			},
+			init() {
+				var globalUser = uni.getStorageSync("globalUser");
+				var id = globalUser.id;
+				uni.request({
+					url: this.serverurl + '/TPromoCode/findList',
+					data: {
+						"adminId": id,
+					},
+					method: "POST",
+					success: (res) => {
+						this.tableList = res.data.data;
+					}
+				})
+			},
+			change({
+				newVal,
+				oldVal,
+				index,
+				orignItem
+			}) {
+				this.tableList=null;
+				if(index==0){
+					var isUse = null;
+				}
+				if(index==1){
+					var isUse = 0;
+				}
+				if(index==2){
+					var isUse = 1;
+				}
+				if(index==3){
+					var isUse = 2;
+				}
+				var globalUser = uni.getStorageSync("globalUser");
+				var id = globalUser.id;
+				uni.request({
+					url: this.serverurl + '/TPromoCode/findList',
+					data: {
+						"adminId": id,
+						"isUse":isUse
+					},
+					method: "POST",
+					success: (res) => {
+						this.tableList = res.data.data;
+					}
+				})
+			}
+
+		}
+	};
+</script>
+
+<style>
+	.header {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+		padding-left: 10upx;
+	}
+
+	.nickname {
+		padding-left: 10upx;
+		height: 32upx;
+		color: #363D44;
+		font-size: 32upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font{
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+</style>

+ 30 - 88
pages/User/user.vue

@@ -19,40 +19,39 @@
 				</button>
 			</view>
 		</view>
-		<view v-if="show">
-			<view class="xiugai">
-				修改设备名称
+			<view class="">
+					<uni-list>
+						<view v-if="Aid!='1'">
+						<uni-list-item title="优惠码" @click="open()" />
+						</view>
+						<view v-if="show">
+							<uni-list-item title="修改设备名称" @click="updataName()" />
+						</view>
+					</uni-list>
 			</view>
-			<view v-for="(list,index) in listName" :key="index" class="body">
-				<view class="input-two">
-					<input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
-					<p id="p2" class="p2" :style="{display:showOrNo}">如:xx广场301机</p>
-				</view>
-				<view class="button2">
-					<button type="primary" @click="updata1()" class="button">
-						<p class="p">更改</p>
-					</button>
-				</view>
-
-			</view>
-		</view>
 		<view class="xiugai2">
 			<button type="primary" @click="trant()" class="xiugai2">
 				<p class="xiugai3">解除微信绑定</p>
 			</button>
-			<!-- <font @click="trant()">解除微信绑定</font> -->
 		</view>
 	</view>
 
 </template>
 
 <script>
+	import uniList from '@/components/uni-list/uni-list.vue'
+	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
 	import {
 		mapState,
 		mapActions,
 		mapMutations
 	} from 'vuex'
+	
 	export default {
+		components: {
+			uniList,
+			uniListItem,
+		},
 		data() {
 			return {
 				name: '',
@@ -60,6 +59,7 @@
 				listName: [],
 				value: null,
 				id: null,
+				Aid:null,
 				parm: {
 					name: null,
 					id: null
@@ -77,6 +77,8 @@
 		},
 		onShow() {
 			// uni.startPullDownRefresh();
+			var globalUser = uni.getStorageSync("globalUser");
+			this.Aid = globalUser.id;
 			var me = this;
 			var name = uni.getStorageSync("name");
 			me.name = name;
@@ -89,7 +91,7 @@
 				}
 			}
 			var newparm = uni.getStorageSync("newparm");
-			if (newparm.toString().length>1) {
+			if (newparm.toString().length > 1) {
 				if (newparm.avatarUrl.length > 1) {
 					this.avatarUrl = newparm.avatarUrl;
 					this.weixinUp = true;
@@ -102,6 +104,16 @@
 
 		},
 		methods: {
+			open() {
+				uni.navigateTo({
+					url: 'promoCode',
+				});
+			},
+			updataName() {
+				uni.navigateTo({
+					url: 'equipmentName',
+				});
+			},
 			trant() {
 				uni.reLaunch({
 					url: '../WeixinSwicth/WeixinSwicth',
@@ -120,29 +132,6 @@
 			setStyle2() {
 				this.showOrNo = "none";
 			},
-			getValue: function(event) {
-				// 绕过v-model 获取input输入框的值  
-				var value = event.target.value;
-				var id = event.target.id;
-				this.value = value;
-				this.id = id;
-				this.parm.name = value;
-				this.parm.id = id;
-			},
-			...mapActions('chart', ['updata']),
-			updata1() {
-				if (this.parm.id != null) {
-					this.updata(this.parm)
-						.then(res => {
-							uni.showModal({
-								title: '提示',
-								content: '名称:' + this.parm.name + res.message,
-							});
-						}, _ => void uni.stopPullDownRefresh());
-				}
-
-
-			}
 		}
 	}
 </script>
@@ -184,17 +173,14 @@
 	}
 
 	.face2 {
-		/* border-left: 10upx; */
 		width: 120upx;
 		height: 120upx;
-		/* padding-left: 30upx; */
 		padding-right: 0upx;
 		border-radius: 50%;
 		flex-shrink: 0;
 	}
 
 	.face3 {
-		/* border-left: 10upx; */
 		width: 120upx;
 		height: 120upx;
 		padding-left: 30upx;
@@ -229,7 +215,6 @@
 		width: 100upx;
 		height: 64upx;
 		padding-top: 30upx;
-		/* padding-right: 30upx; */
 		text-align: center;
 		margin: 0 auto;
 	}
@@ -239,8 +224,6 @@
 		height: 64upx;
 		border-radius: 10upx;
 		background: #D6101F;
-		/* padding-right: 50upx; */
-		/* padding-top: 5upx; */
 		text-align: center;
 		margin: 0 auto;
 	}
@@ -277,7 +260,6 @@
 	}
 
 	.button {
-		/* padding: 5upx 10upx 10upx 0upx; */
 		width: 80upx;
 		height: 60upx;
 		border-radius: 10upx;
@@ -300,32 +282,6 @@
 		-webkit-transform: translateX(-50%);
 		transform: translateX(-50%);
 	}
-
-	.input {
-		/* padding: 10upx 20upx 10upx 0upx; */
-		padding-left: 20upx;
-		padding-top: 10upx;
-		background-color: #FFFFFF;
-		width: 500upx;
-		height: 50upx;
-		box-shadow: 0upx 0upx 20upx #D3D3D3;
-		border-radius: 5upx;
-	}
-
-	.xiugai {
-		width: 92%;
-		border-left: 20upx;
-		border-left: 10upx solid #206DC3;
-		padding-left: 10upx;
-		height: 38upx;
-		padding-bottom: 20upx;
-		font-family: "PingFang-SC-Bold";
-		font-weight: bold;
-		margin: auto;
-		font-size: 32upx;
-		color: #363D44;
-	}
-
 	.xiugai2 {
 		width: 100%;
 		height: 80upx;
@@ -345,7 +301,6 @@
 		margin: auto;
 		font-size: 40upx;
 		color: #363D44;
-
 	}
 
 	.body {
@@ -356,17 +311,4 @@
 		justify-content: flex-start;
 	}
 
-	.input-two {
-		width: 600upx;
-		height: 100upx;
-		padding-left: 30upx;
-	}
-
-	.p2 {
-		color: #DD524D;
-		display: none;
-		width: 600upx;
-		height: 50upx;
-		border: 1px;
-	}
 </style>

BIN
static/mix-tree/currentIcon.png


BIN
static/mix-tree/defaultIcon.png


+ 14 - 1
store/modules/chart.js

@@ -4,6 +4,13 @@ import { redirectToLogin, redirectTo } from '@/common/NavFuncs';
 export default {
 	namespaced: true,
 	actions: {
+		getProvinceAll({ commit },param) {
+			return apis.sz.post('/TOrder/getProvinceAll',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 		getProvince({ commit },param) {
 			return apis.sz.post('/TOrder/getProvince',param)
 				.then(res => {
@@ -33,13 +40,19 @@ export default {
 				});
 		},
 		getEquipmentListByUser({ commit },param) {
-			// console.log('getEquipmentListByUser')
 			return apis.sz.post('/TEquipment/getEquipmentListByUser',param)
 				.then(res => {
 					const { data } = res;
 					return data;
 				});
 		},
+		getEquipmentListByProvince({ commit },param) {
+			return apis.sz.post('/TEquipment/getEquipmentListByProvince',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 		updata({ commit },param) {
 			return apis.sz.post('/TEquipment/updateName',param)
 				.then(res => {