Quellcode durchsuchen

修改运营端小程序界面功能

oyq28 vor 2 Jahren
Ursprung
Commit
98c156328d

+ 15 - 8
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/device.vue

@@ -32,7 +32,8 @@
 	export default {
 		data() {
 			return {
-				deviceList: [{
+				deviceList: [
+					/*{
 						name: "果奶机01",
 						id: 1,
 						address: "泥城扩路镇223号,三层",
@@ -52,7 +53,7 @@
 						address: "泥城扩路镇223号,三层",
 						status: "3",
 						pic: "../../static/images/device_bg.png"
-					}
+					}*/
 				],
 				queryParams: util.initQueryParams(),
 				totalPages: 1
@@ -64,7 +65,7 @@
 				if(type!=null){
 					//this.queryParams.model.status = type
 				}
-				util.request(api.DeviceList, this.queryParams, 'post', 'application/json').then(function(res) {
+				return util.request(api.DeviceList, this.queryParams, 'post', 'application/json').then(function(res) {
 					if (res.code === 0) {
 						console.log(res.data);
 						that.deviceList = that.deviceList.concat(res.data.records)
@@ -74,22 +75,28 @@
 			}
 		},
 		onReachBottom() {
+			let pages = getCurrentPages();
+			let page = pages[pages.length - 1].$page.fullPath;
+			let type = page.split('type=')[1]
+			type = type? type: ""
 			if (this.totalPages > this.queryParams.current) {
 				this.queryParams.current = this.queryParams.current + 1
-			} else {
-				return false;
+			}else{
+				return false
 			}
-			let type = this.$route.query.type;
 			this.getdeviceList(type);
 		},
-		onLoad: function() {		
-			let type = this.$route.query.type;
+		onLoad: function(option) {
+			let type = option.type? option.type : ""			
 			this.getdeviceList(type);
 		}
 	}
 </script>
 
 <style lang="scss">
+	.container {
+		height: 100%;
+	}
 	.device-list .item {
 		display: block;
 		width: 750rpx;

+ 15 - 7
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/deviceDetail.vue

@@ -98,29 +98,37 @@
 			}
 		},
 		methods: {
-			getDeviceDetail() {
+			getDeviceDetail(equId) {
 				let that = this;
 				util.request(api.DeviceDetail, {
-					equId: this.$route.query.id
+					equId: equId
 				}, 'GET', 'application/json').then(function(res) {
 					if (res.code === 0) {
 						that.device = res.data;
 					}
 				});
 			},
-			getStatistics() {
+			getStatistics(equId) {
 				let that = this;
 				util.request(api.OrderStatistic, {
-					equId: this.$route.query.id
+					equId: equId
 				}, 'GET', 'application/json').then(function(res) {
 					if (res.code === 0) {
 						that.statistics = res.data;
 					}
 				});
 			},
-			onLoad: function() {
-				this.getDeviceDetail();
-				this.getStatistics();
+			onLoad: function(option) {
+				let equId = option.id? option.id : ""
+				if(equId){
+					this.getDeviceDetail(equId);
+					this.getStatistics(equId);
+				}else{
+					util.toast("传参为空");
+					uni.redirectTo({
+					   url: '/pages/device/device',
+					})
+				}
 			}
 		}
 	}

+ 10 - 11
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/index/index.vue

@@ -129,7 +129,7 @@
 					</navigator>
 				</view>
 				<view class="item" v-for="(item, index) in device" :key="index">
-					<navigator :url="'/pages/device/device?id='+item.id">
+					<navigator :url="'/pages/device/deviceDetail?id='+item.id">
 						<image class="img" :src="item.imgUrl" background-size="cover" v-if="item.imgUrl"></image>
 						<image class="img" :src="item.pic" background-size="cover" v-else-if="item.pic"></image>
 						<view class="right">
@@ -238,7 +238,6 @@
 					},
 				],
 				channel: [{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 1,
 						name: "设备总数",
 						sort_order: 1,
@@ -246,7 +245,6 @@
 						val: "3"
 					},
 					{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 2,
 						name: "异常设备",
 						sort_order: 2,
@@ -254,7 +252,6 @@
 						val: "1"
 					},
 					{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 3,
 						name: "缺料设备",
 						sort_order: 3,
@@ -262,7 +259,6 @@
 						val: "4"
 					},
 					{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 4,
 						name: "今日订单",
 						sort_order: 4,
@@ -270,15 +266,13 @@
 						val: "3"
 					},
 					{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 5,
 						name: "今日销售额",
 						sort_order: 5,
-						url: "/pages/category/category?id=5",
+						url: "/pages/ucenter/order/order?type=1",
 						val: "333.5"
 					},
 					{
-						icon_url: "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/1509505811a78d.png",
 						id: 6,
 						name: "异常订单",
 						sort_order: 6,
@@ -350,10 +344,15 @@
 						}
 					});
 				}
-				if (!that.channel.length) {
-					util.request(api.IndexUrlChannel).then(function(res) {
-						if (res.errno === 0) {
+				if (that.channel.length) {
+					util.request(api.OrderStatistic,{equId:''},'Get','application/json').then(function(res) {
+						if (res.code === 0) {
 							//that.channel = res.data.channel
+							let statistic = res.data;
+							let arr = [statistic.deviceNum,1,1, statistic.todayNum,statistic.todayAmount,statistic.exceptNum];
+							that.channel.forEach((item,i)=>{								
+								item.val = arr[i]
+							})
 						}
 					});
 				}

+ 26 - 23
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/cup.vue

@@ -17,7 +17,7 @@
 							</view>
 							<text class="errMsg" v-if="item.exprStatus==='1'">即将到期</text>
 							<text class="errMsg" v-if="item.mtrResidue <= item.residueWarn">原料不足</text>
-							<text class="tip">{{item.mtrResidue || '0'}}ml</text>
+							<text class="tip">{{parseInt(item.mtrResidue) || '0'}}个</text>
 						</view>
 
 						<view class="num">
@@ -52,8 +52,8 @@
 				</uni-tr>
 			</uni-table>
 
-			<uni-table border stripe emptyText="暂无更多数据" v-show="false">
-				<!-- 表头行 -->
+			<!--<uni-table border stripe emptyText="暂无更多数据" v-show="false">
+				
 				<uni-tr>
 					<uni-th align="center"></uni-th>
 					<uni-th align="center">原料</uni-th>
@@ -66,7 +66,7 @@
 					<uni-td align="center">{{item.specs}}</uni-td>
 					<uni-td align="center">{{item.date}}</uni-td>
 				</uni-tr>
-			</uni-table>
+			</uni-table>-->
 
 			<uni-load-more status="more"></uni-load-more>
 		</uni-section>
@@ -134,13 +134,13 @@
 					<uni-forms class="uni-forms" :modelValue="form">
 						<uni-forms-item class="form-item" label="料筒" name="barrelCode">
 							<!--<text>{{this.form.barrelCode||'空'}}</text>-->
-							<text>{{this.form.barrelCode}}</text>
+							<text>{{form.barrelCode}}</text>
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="到期日期" name="date">
 							<uni-datetime-picker type="date" v-model="form.date" />
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="剩余原料" name="currentMaterial">
-							<text>{{this.form.mtName||'空'}}</text>
+							<text>{{form.mtName||'空'}}</text>
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="余量" name="surplus">
 							<uni-number-box :min="0" :max="100" v-model="form.surplus" :disabled="true">
@@ -379,10 +379,10 @@
 			editClose() {
 				this.editShow = false
 			},
-			getMaterialData() {
+			getMaterialData(equId) {
 				let that = this;
 				util.request(api.MaterialList, {
-					equId: this.$route.query.equId,
+					equId: equId,
 					barrelType: '1'
 				}, 'GET', 'application/json').then(function(res) {
 					if (res.code === 0) {
@@ -390,9 +390,9 @@
 					}
 				});
 			},
-			getRecordList() {
+			getRecordList(equId) {
 				let that = this;
-				that.queryParams.model.equId = this.$route.query.equId
+				that.queryParams.model.equId = equId
 				that.queryParams.model.barrelType = "1"
 				util.request(api.RecordList, that.queryParams, 'Post', 'application/json').then(function(res) {
 					if (res.code === 0) {
@@ -401,8 +401,12 @@
 					}
 				});
 			},
-			update() {
+			update() {				
 				let that = this;
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let equId = page.split('equId=')[1]
+				equId = equId? equId: ""
 				util.request(api.CupRecordAdd, this.form, "POST", "application/json").then(function(res) {
 					if (res.code === 0) {
 						uni.showToast({
@@ -413,7 +417,7 @@
 								setTimeout(function() {
 									that.editClose()
 									   uni.reLaunch({
-									        url: '/pages/material/cup?equId='+that.$route.query.equId,
+									        url: '/pages/material/cup?equId='+equId,
 									   });
 								}, 2000)
 							}
@@ -424,16 +428,21 @@
 				});
 			},
 			onReachBottom: function() {
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let equId = page.split('equId=')[1]
+				equId = equId? equId: ""
 				if (this.totalPages > this.queryParams.current) {
 					this.queryParams.current = this.queryParams.current + 1
 				} else {
 					return false;
 				}
-				this.getRecordList()
+				this.getRecordList(equId)
 			},
-			onLoad: function() {
-				this.getMaterialData();
-				this.getRecordList();
+			onLoad: function(option) {
+				let equId = option.equId? option.equId : ""
+				this.getMaterialData(equId);
+				this.getRecordList(equId);
 			}
 		}
 	}
@@ -587,13 +596,7 @@
 		padding: 0;
 	}
 
-	/deep/ .uni-popup .uni-popup__wrapper .popup {
-		min-width: 600rpx;
-	}
-
-	/deep/ .editBox .uni-popup .uni-popup__wrapper .popup {
-		min-height: 900rpx;
-	}
+	
 
 	/deep/ .editBox .uni-numbox {
 		margin-left: 35%;

+ 32 - 15
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/material.vue

@@ -134,13 +134,13 @@
 					<uni-forms class="uni-forms" :modelValue="form">
 						<uni-forms-item class="form-item" label="料筒" name="barrelCode">
 							<!--<text>{{this.form.barrelCode||'空'}}</text>-->
-							<text>{{this.form.barrelCode}}</text>
+							<text>{{form.barrelCode}}</text>
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="到期日期" name="date">
 							<uni-datetime-picker type="date" v-model="form.date" />
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="剩余原料" name="currentMaterial">
-							<text>{{this.form.mtName||'空'}}</text>
+							<text style="line-height: 25px;height:25px;">{{form.mtName||'空'}}</text>
 						</uni-forms-item>
 						<uni-forms-item class="form-item" label="余量" name="surplus">
 							<uni-number-box :min="0" :max="100" v-model="form.surplus" :disabled="true">
@@ -152,9 +152,9 @@
 								v-if="equMaterials.length>0">
 								<view class="picker">
 									<view class="fb-type">
-										<view class="type-label">{{this.equMaterials[this.index2].mtName}}</view>
+										<view class="type-label">{{equMaterials[index2].mtName}}</view>
 										<image class="type-icon"
-											src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/pickerArrow-a8b918f05f.png">
+											src="../../static/images/icon_select.png">
 										</image>
 									</view>
 								</view>
@@ -387,6 +387,7 @@
 					'barrelCode': row.barrelCode,
 					'equId': row.equId
 				}
+				console.log(this.form)
 				this.$refs.editDialog.open()
 				//this.$refs.edit.setMaterial(row);						 
 				if (row.barrelType == null || row.barrelType == "") {
@@ -404,10 +405,10 @@
 				this.editShow = false
 				this.equMaterials = this.allEquMaterials
 			},
-			getMaterialData() {
+			getMaterialData(equId) {
 				let that = this;
 				util.request(api.MaterialList, {
-					equId: this.$route.query.equId,
+					equId: equId,
 					barrelType: '',
 				}, 'GET', 'application/json').then(function(res) {
 					if (res.code === 0) {
@@ -415,9 +416,9 @@
 					}
 				});
 			},
-			getRecordList() {
+			getRecordList(equId) {
 				let that = this;
-				that.queryParams.model.equId = this.$route.query.equId
+				that.queryParams.model.equId = equId
 				util.request(api.RecordList, that.queryParams, 'Post', 'application/json').then(function(res) {
 					if (res.code === 0) {
 						that.records = res.data.records
@@ -441,6 +442,10 @@
 			},
 			update() {
 				let that = this;
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let equId = page.split('equId=')[1]
+				equId = equId? equId: ""
 				util.request(api.RecordAdd, this.form, "POST", "application/json").then(function(res) {
 					if (res.code === 0) {
 						uni.showToast({
@@ -451,7 +456,7 @@
 								setTimeout(function() {
 									that.editClose()
 									uni.reLaunch({
-									            url: '/pages/material/material?equId='+that.$route.query.equId,
+									            url: '/pages/material/material?equId='+equId,
 									        });
 								  }, 2000);
 							}
@@ -462,17 +467,22 @@
 				});
 			},
 			onReachBottom: function() {
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let equId = page.split('equId=')[1]
+				equId = equId? equId: ""
 				if (this.totalPages > this.queryParams.current) {
 					this.queryParams.current = this.queryParams.current + 1
 				} else {
 					return false;
 				}
-				this.getRecordList()
+				this.getRecordList(equId)
 			},
-			onLoad: function() {
-				this.getMaterialData();
+			onLoad: function(option) {
+				let equId = option.equId? option.equId : ""
+				this.getMaterialData(equId);
 				this.getEquMaterialData();
-				this.getRecordList();
+				this.getRecordList(equId);
 			}
 		}
 	}
@@ -625,13 +635,20 @@
 		width: 180rpx;
 		padding: 0;
 	}
+	
+	/deep/ .uni-forms .uni-forms-item__content {		
+		padding: 0;
+		height: 36px;
+		line-height: 36px;
+		vertical-align: middle;
+	}
 
 	/deep/ .uni-popup .uni-popup__wrapper .popup {
-		min-width: 800rpx;
+		min-width: 600rpx;
 	}
 
 	/deep/ .editBox .uni-popup .uni-popup__wrapper .popup {
-		min-height: 1200rpx;
+		min-height: 1000rpx;
 	}
 
 	/deep/ .editBox .uni-numbox {

+ 46 - 30
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/ucenter/order/order.vue

@@ -5,7 +5,7 @@
 			<view class="picker">
 				<view class="label">状态</view>
 				<view class="fb-type">
-					<view class="type-label">{{array[index]}}</view>
+					<view class="type-label">{{this.array[index]}}</view>
 					<image class="type-icon"
 						src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/pickerArrow-a8b918f05f.png">
 					</image>
@@ -14,10 +14,10 @@
 		</picker>
 
 		<picker @change="bindPickerChange2" v-model="index2" :range="deviceList" :range-key="'name'">
-			<view class="picker">
+			<view class="picker" style="position: relative;">
 				<view class="label">设备</view>
 				<view class="fb-type">
-					<view class="type-label">{{deviceList[index2].name}}</view>
+					<view class="type-label">{{this.deviceList[index2].name}}</view>
 					<image class="type-icon"
 						src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/pickerArrow-a8b918f05f.png">
 					</image>
@@ -26,10 +26,10 @@
 		</picker>
 
 		<view class="picker" style="position: relative;">
-			<view class="label" v-if="this.$route.query.type">今日订单</view>
+			<view class="label" v-if="isToday">今日订单</view>
 			<view class="fb-type">
 				<text>{{range[0]}} - {{range[1]}}</text>
-				<button type="primary" @click="onShowDatePicker('range')">选择日期范围</button>
+				<button type="primary" @click="onShowDatePicker('range')" :disabled="isToday" >选择</button>
 			</view>
 		</view>
 		<mx-date-picker :show="showPicker" :type="type" :value="value" :show-tips="true" :begin-text="'开始'"           
@@ -54,7 +54,7 @@
 				</view>
 				<view class="h">
 					<view class="l">订单编号:{{item.id||''}}</view>
-					<view class="r">¥{{item.orderAmount}}</view>
+					<view class="r">¥{{item.orderAmount||'0'}}</view>
 				</view>
 				<view class="h">
 					<view class="l">会员名称:{{item.orderMemberName||''}}</view>
@@ -90,19 +90,11 @@
 				showPicker: false,
 				index: 0,
 				index2: 0,
+				isToday: true,
 				deviceId: '',
 				deviceList: [{
 					id: '',
 					name: '全部'
-				}, {
-					id: 1,
-					name: "果奶机1"
-				}, {
-					id: 2,
-					name: "果奶机2"
-				}, {
-					id: 3,
-					name: "果奶机3"
 				}],
 				orderCount: 2,
 				orderSum: 0.0,
@@ -149,7 +141,7 @@
 			},
 			bindPickerChange2: function(e) {
 				this.index2 = e.detail.value
-				this.deviceId = this.deviceList[this.index].id
+				this.deviceId = this.deviceList[this.index2].id
 			},
 			bindDateChange: function(e) {
 				this.date = e.detail.value
@@ -168,7 +160,11 @@
 				}
 				this.orderList = []
 				this.queryParams.current = 1
-				this.getOrderList()
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let oType = page.split('type=')[1]
+				console.log(oType)
+				this.getOrderList(oType)
 			},
 			onCancel(e) {
 				this.range = []
@@ -178,7 +174,10 @@
 				}
 				this.orderList = []
 				this.queryParams.current = 1
-				this.getOrderList()
+				let pages = getCurrentPages();
+				let page = pages[pages.length - 1].$page.fullPath;
+				let oType = page.split('type=')[1]
+				this.getOrderList(oType)
 			},
 			getDeviceList() {
 				let that = this;
@@ -186,22 +185,25 @@
 					if (res.code === 0) {
 						//that.orderList = that.orderList.concat(res.data.data)
 						//that.page = res.data.currentPage + 1
-						that.totalPages2 = res.total
-						that.deviceList = res.data.records
+						that.totalPages2 = res.pages
+						that.deviceList = that.deviceList.concat(res.data.records)
 					}
 				});
 			},
-			getOrderList() {
+			getOrderList(type) {
 				let that = this;
-				let type = this.$route.query.type;
 				if(type=="1"){
-					that.range=[util.getNowDate(0), util.getNowDate(1)];					
+					that.range=[util.getNowDate(0), util.getNowDate(1)];
+					that.isToday = true					
+				}else{
+					that.isToday = false
 				}
-				if (that.index2 > 0) {
-					that.queryParams.model.orderEquId = that.index2;
+				if (that.deviceId) {
+					that.queryParams.model.orderEquId = that.deviceId;
 				} else {
 					that.queryParams.model = {}
 				}
+				console.log(that.range)
 				if (that.range.length > 0) {
 					that.queryParams.map.createTime_st = that.range[0];
 					that.queryParams.map.createTime_ed = that.range[1];
@@ -216,8 +218,7 @@
 							   return false
 							}
 							return true;
-						})
-						console.log(res.data.records[0])
+						})						
 						that.orderList = that.orderList.concat(res.data.records);
 						//that.page = res.data.currentPage + 1
 						that.totalPages = res.data.pages
@@ -240,15 +241,30 @@
 		 * 页面上拉触底事件的处理函数
 		 */
 		onReachBottom: function() {
+			let pages = getCurrentPages();
+			let page = pages[pages.length - 1].$page.fullPath;
+			let type = page.split('type=')[1]
+			type = type? type: ""
 			if (this.totalPages > this.queryParams.current) {
 				this.queryParams.current = this.queryParams.current + 1
 			} else {
 				return false;
 			}
-			this.getOrderList()
+			this.getOrderList(type)
 		},
-		onShow: function(options) {			
-			this.getOrderList();
+		onLoad: function(option) {		
+			this.getDeviceList();
+			console.log(this.deviceList)
+			let type = option.type? option.type : ""
+			let equId = option.equId? option.equId : ""
+			if(equId){
+				this.deviceId = equId;
+				this.index2 = this.deviceList.findIndex(function(item){
+					return item.id === equId;
+				});
+				console.log(this.index2);
+			}
+			this.getOrderList(type);
 		}
 	}
 </script>

+ 14 - 5
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/ucenter/order/orderDetail.vue

@@ -40,10 +40,10 @@
 			}
 		},
 		methods: {
-			getMsgList() {
+			getMsgList(id) {
 				let that = this;
 				util.request(api.OrderDetail, {
-					id: this.$route.query.id
+					id: id
 				},'GET','application/json').then(function(res) {
 					if (res.code === 0) {
 						that.msgList = that.msgList.concat(res.data)
@@ -67,10 +67,19 @@
 		 * 页面上拉触底事件的处理函数
 		 */
 		onReachBottom: function() {
-			this.getMsgList()
+			
 		},
-		onLoad: function(options) {
-			this.getMsgList();
+		onLoad: function(option) {
+			let id = option.id? option.id : ""
+			if(id){
+				this.getMsgList(id);
+			}else{
+				util.toast("传参为空");
+				uni.redirectTo({
+				   url: '/pages/order/order',
+				})
+			}
+			
 		}
 	}
 </script>

BIN
imcs-bt-fe/imcs-bt-fe/uni-mall/static/images/icon_select.png