Просмотр исходного кода

feat:“添加设备搜索功能和优化海外版存在部分中文问题”

soobin 1 год назад
Родитель
Сommit
ed8a38f2b5

+ 15 - 3
common/lang/en.js

@@ -125,6 +125,11 @@ export default {
 		suspendBusiness:'Suspend Business',
 		previousPage:'Previous Page',
 		nextPage:'Next Page',
+		equipmentClientID:'Device code',
+		deviceName:'Device name',
+		devicePlaceholder:'Enter the last 6 digits of the device code',
+		deviceNamePlaceholder:'Enter key word',
+		search:'search',
 	},
 	equipmentStatics:{
 		title:'Machine Sales Ranking',
@@ -165,7 +170,8 @@ export default {
 		search:'search',
 		chooseEquipment:'choose equipment',
 		chooseProduct:'choose product',
-		list:'today sugar list'
+		list:'today sugar list',
+		submit:'submit',
 	},
 	flowers:{
 		flower:'flower',
@@ -263,7 +269,9 @@ export default {
 	},
 	bangdingMachine:{
 		clientId:'clientId',
-		equimentType:'equimentType'
+		equimentType:'equimentType',
+		QR:'scan QR codes',
+		binding:'Apply for binding',
 	},
 	generalParameters:{
 		headTemperature:'Head temperature',
@@ -307,5 +315,9 @@ export default {
 		on:'ON',
 		off:'OFF',
 		success:'Sent successfully',
-	}
+	},
+	common:{
+		name:'name:',
+		ID:'ID:',
+	},
 }

+ 15 - 3
common/lang/zh.js

@@ -123,6 +123,11 @@ export default {
 		suspendBusiness:'暂停营业',
 		previousPage:'上一页',
 		nextPage:'下一页',
+		equipmentClientID:'设备编码',
+		deviceName:'设备名称',
+		devicePlaceholder:'输入设备编码后6位',
+		deviceNamePlaceholder:'输入关键字',
+		search:'搜索',
 	},
 	equipmentStatics:{
 		title:'机器销售排行',
@@ -163,7 +168,8 @@ export default {
 		search:'搜索',
 		chooseEquipment:'点击选择机器',
 		chooseProduct:'点击选择商品',
-		list:'今日做糖列表'
+		list:'今日做糖列表',
+		submit:'提交',
 	},
 	flowers:{
 		flower:'花型',
@@ -261,7 +267,9 @@ export default {
 	},
 	bangdingMachine:{
 		clientId:'设备编号',
-		equimentType:'机型'
+		equimentType:'机型',
+		QR:'扫码',
+		binding:'申请绑定',
 	},
 	generalParameters:{
 		headTemperature:'炉头工作温度',
@@ -305,5 +313,9 @@ export default {
 		on:'开启',
 		off:'关闭',
 		success:'发送成功',
-	}
+	},
+	common:{
+		name:'名称:',
+		ID:'编号:',
+	},
 }

+ 3 - 3
packageA/pages/equipmentStatus/equipmentlist.vue

@@ -186,9 +186,9 @@
 		onShow() {
 			// this.input = this.input + 1;
 			this.globalUser = uni.getStorageSync("globalUser");
-			// uni.setNavigationBarTitle({
-			// 	title: this.$t('equipmentStatusList.title')
-			// });
+			uni.setNavigationBarTitle({
+				title: this.$t('user.equipmentlist')
+			});
 			// uni.setTabBarItem({
 			// 	index: 3,
 			// 	text: this.$t('tabs.tab4')

+ 1 - 1
packageA/pages/remote/advancedParameters.vue

@@ -213,7 +213,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageA/pages/remote/alarmClockItem.vue

@@ -189,7 +189,7 @@
 						for (var i = 0; i < listName.length; i++) {
 							var cov = {};
 							cov["value"] = listName[i].id;
-							cov["label"] = "名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							cov["label"] = this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length);
 							equipmentNameList.push(cov);
 						}

+ 1 - 1
packageA/pages/remote/debugParameters.vue

@@ -294,7 +294,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 2 - 2
packageA/pages/remote/dosugar.vue

@@ -42,7 +42,7 @@
 		</view>
 		<view class="tr">
 			<button type="primary" formType="submit" @click="dosugar()" class="button">
-				<p class="p1">提交</p>
+				<p class="p1">{{$t('dosugar.submit')}}</p>
 			</button>
 		</view>
 	</view>
@@ -100,7 +100,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageA/pages/remote/flowerShow.vue

@@ -147,7 +147,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageA/pages/remote/generalParameters.vue

@@ -299,7 +299,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageA/pages/remote/humidityParameters.vue

@@ -124,7 +124,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 3 - 0
packageA/pages/remote/sugarList.vue

@@ -24,6 +24,9 @@
 		},
 		onShow() {
 			var token = uni.getStorageSync("token");
+			uni.setNavigationBarTitle({
+				title: this.$t('dosugar.list')
+			});
 			if (token.length > 1) {
 				this.selectSugarList();
 			} else {

+ 1 - 1
packageA/pages/remote/updatePassword.vue

@@ -107,7 +107,7 @@
 						for (var i = 0; i < listName.length; i++) {
 							var cov = {};
 							cov["value"] = listName[i].id;
-							cov["label"] = "名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							cov["label"] = this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length);
 							equipmentNameList.push(cov);
 						}

+ 1 - 1
packageA/pages/remote/volume.vue

@@ -84,7 +84,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageB/pages/remote/updatePayment.vue

@@ -115,7 +115,7 @@
 						var listName = data[0].equipmentList;
 						var equipmentNameList = [];
 						for (var i = 0; i < listName.length; i++) {
-							equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length));
 						}
 						this.equipmentNameList = equipmentNameList;

+ 1 - 1
packageB/pages/remote/updatePrice.vue

@@ -448,7 +448,7 @@
 						for (var i = 0; i < listName.length; i++) {
 							var cov = {};
 							cov["value"] = listName[i].id;
-							cov["label"] = "名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
+							cov["label"] = this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
 								listName[i].clientId.length - 6, listName[i].clientId.length);
 							equipmentNameList.push(cov);
 						}

+ 5 - 2
packageB/pages/user/bangdingMachine.vue

@@ -18,11 +18,11 @@
 			</view> -->
 			<view class="btn-area">
 				<!-- <button type="primary" @click="saoma()">扫码</button> -->
-				<button type="default" @click="scanCode">扫码</button>
+				<button type="default" @click="scanCode">{{$t('bangdingMachine.QR')}}</button>
 				<!-- <button type="primary" @click="tran()" >提交</button> -->
 			</view>
 			<view class="btn-area">
-				<button type="primary" formType="submit">申请绑定</button>
+				<button type="primary" formType="submit">{{$t('bangdingMachine.binding')}}</button>
 				<!-- <button type="primary" @click="tran()" >提交</button> -->
 			</view>
 		</form>
@@ -61,6 +61,9 @@
 		},
 		onShow() {
 			var date = new Date();
+			uni.setNavigationBarTitle({
+				title: this.$t('user.bangji')
+			});
 		},
 		computed: {
 

+ 9 - 0
pages/Charts/equipmentStatistics.vue

@@ -863,6 +863,15 @@
 			// 		});
 			// },
 			initChart(canvasId, chartData) {
+				chartData.series = chartData.series.map(e => {
+					if (e['name'] == '销售个数') {
+						e['name'] = this.$t('mainStatistics.saleNum');
+					}
+					if (e['name'] == '销售额') {
+						e['name'] = this.$t('mainStatistics.saleroom');
+					}
+					return e;
+				});
 				return new uCharts({
 					$this: _self,
 					canvasId: canvasId,

+ 137 - 12
pages/User/equipmentStatusList.vue

@@ -102,6 +102,24 @@
 				<image class="img" src="../../static/img/green.png"></image>
 				<font class="wenziT">{{$t('equipmentStatusList.green')}}</font>
 			</view>
+			<view class="search">
+				<view class="search-title">
+					<picker @change="changeSearch" :value="index" :range="searchList">
+						<view class="uni-input">{{searchList[index]}}</view>
+					</picker>
+					<!-- {{$t('equipmentStatusList.equipmentClientID')}} -->
+				</view>
+				<view class="search-input">
+					<input v-if="searchList[index] === $t('equipmentStatusList.equipmentClientID')" type="text" :placeholder="$t('equipmentStatusList.devicePlaceholder')" v-model="searchClientId" />
+					<input v-else type="text" :placeholder="$t('equipmentStatusList.deviceNamePlaceholder')" v-model="searchDeviceName" />
+				</view>
+				<view class="search-button">
+					<button type="primary" size="mini" class="" @click="search()">
+						<p class="">{{$t('equipmentStatusList.search')}}</P>
+					</button>
+				</view>
+			</view>
+			<view class="line"></view>
 			<view class="titlelist" style="position: relative;" v-for="(equipment, index) in equipmentList"
 				:key="equipment.id">
 				<span class="status-css" :class="equipment.hasTodayAlarm===true?statusError : statusNormal"></span>
@@ -358,19 +376,30 @@
 				input: 0,
 				isReadOnly: true,
 				editBtn:true,
-				sleepDesc:null,
+				sleepDesc:false,
 				descShow:false,
 				btnShow:false, // 按钮显示
 				upBtn:false, // 上一页按钮
 				nextBtn:true, // 下一页按钮
 				equipmentTotal:0, // 设备总数
 				isLoading: false, //是否加载中
+				searchList:[this.$t('equipmentStatusList.equipmentClientID'),this.$t('equipmentStatusList.deviceName')],
+				index: 0,
+				searchClientId: null,
+				searchDeviceName: null,
 			}
 		},
 		computed: {
 			...mapState(['loginUser']),
 		},
 		onPullDownRefresh() {
+			this.index = 0;
+			this.searchClientId = null;
+			this.searchDeviceName = null;
+			this.globalUser.deviceName = null;
+			this.globalUser.clientId = null;
+			this.globalUser.offset = 0;
+			this.globalUser.limit = 20;
 			this.getEquipmentListData();
 		},
 		onShow() {
@@ -378,6 +407,10 @@
 			this.globalUser = uni.getStorageSync("globalUser");
 			this.globalUser.offset = 0;
 			this.globalUser.limit = 20;
+			this.searchClientId = null;
+			this.searchDeviceName = null;
+			this.globalUser.deviceName = null;
+			this.globalUser.clientId = null;
 			uni.setNavigationBarTitle({
 				title: this.$t('equipmentStatusList.title')
 			});
@@ -413,8 +446,10 @@
 						// this.equipmentList.push(...data[0].equipmentList);
 						this.equipmentList = data[0].equipmentList;
 						this.equipmentTotal = this.merchantList[0].equipmentTotal;
-						if(this.equipmentTotal > this.globalUser.limit) {
+						if(this.equipmentTotal > this.globalUser.limit && this.globalUser.limit != null) {
 							this.btnShow = true;
+						} else {
+							this.btnShow = false;
 						}
 						console.log(this.equipmentList);
 						this.isLoading = false;
@@ -478,6 +513,53 @@
 				this.editBtn = true;
 			},
 			
+			// 选择搜索类型
+			changeSearch: function(e) {
+			    // console.log('picker发送选择改变,携带值为', e.detail.value)
+			    this.index = e.detail.value
+				this.searchClientId = null;
+				this.searchDeviceName = null;
+				this.globalUser.deviceName = null;
+				this.globalUser.clientId = null;
+			},
+			
+			// 点击搜索
+			search() {
+				if(this.index === 0) {
+					if(this.searchClientId === null || this.searchClientId === '') {
+						uni.showToast({
+							title: '请输入设备编码后6位',
+							icon: "none",
+							duration: 2000
+						});
+						return;
+						// this.globalUser.offset = 0;
+						// this.globalUser.limit = 20;
+					} else {
+						this.globalUser.offset = null;
+						this.globalUser.limit = null;
+						console.log(this.globalUser)
+						this.globalUser.clientId = this.searchClientId;
+						this.getEquipmentListData();
+					}
+				} else {
+					if(this.searchDeviceName === null || this.searchDeviceName === '') {
+						uni.showToast({
+							title: '请输入设备名称关键字',
+							icon: "none",
+							duration: 2000
+						});
+						return;
+					} else {
+						this.globalUser.offset = null;
+						this.globalUser.limit = null;
+						this.globalUser.deviceName = this.searchDeviceName;
+						this.getEquipmentListData();
+						console.log(this.globalUser)
+					}
+				}
+			},
+			
 			// 更改睡眠描述
 			confirmDesc(sleepDesc,id) {
 				var that = this;
@@ -552,12 +634,6 @@
 							.stringify(item))
 					});
 				}
-				// uni.navigateTo({
-				// 	// url:'map?item='+ encodeURIComponent(JSON.stringify(item))
-				// 	url:'../../packageA/pages/equipmentStatus/map?item='+ encodeURIComponent(JSON.stringify(item))
-				// 	// url:'../../packageA/pages/equipmentStatus/GoogleMap?item='+ encodeURIComponent(JSON.stringify(item))
-				//     // url: '/pages/user/map?item='+ encodeURIComponent(JSON.stringify(item))
-				// });
 			},
 			//一键重启
 			reboot(id) {
@@ -882,12 +958,13 @@
 
 			},
 			change(id, code, index) {
+				this.sleepChecked = true;
 				var that = this;
-				that.sleepChecked = true;
 				var code1 = code;
-				console.log(index);
-				console.log(code);
+				// console.log(index);
+				// console.log(code);
 				if (code1 == 1) {
+					// that.sleepChecked = true;
 					uni.showModal({
 						title: that.$t('equipmentStatusList.tip'),
 						content: that.$t('equipmentStatusList.sleepTip'),
@@ -910,10 +987,11 @@
 									success: (res) => {
 										var list = res.data.data;
 										that.equipmentList[index].isSleep = true;
+										that.sleepChecked = null;
 										that.getEquipmentListData();
 									}
 								});
-							} else if (res.cancel) {
+							} else {
 								that.equipmentList[index].isSleep = false;
 								that.sleepChecked = false;
 								that.getEquipmentListData();
@@ -940,6 +1018,7 @@
 						success: (res) => {
 							var list = res.data.data;
 							that.equipmentList[index].isSleep = false;
+							that.sleepChecked = false;
 							that.getEquipmentListData();
 						}
 					});
@@ -1114,6 +1193,13 @@
 		height: 3upx;
 		background: #000000;
 	}
+	
+	.line {
+		width: 100%;
+		height: 3upx;
+		background: #c8c7cc;
+	}
+	
 	.button-container {
 	  display: flex;
 	}
@@ -1122,4 +1208,43 @@
 	.right-button {
 	  flex: 1;
 	}
+	
+	.search {
+		width: 100%;
+		padding-top: 10upx;
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+	}
+	
+	.search-title {
+		width: 25%;
+		/* margin: 0 10px; */
+		margin-right: 10px;
+		text-align: center;
+		font-family: "PingFang-SC-Bold";
+		/* box-shadow: 0upx 0upx 20upx #D3D3D3; */
+		border-radius: 20px;
+		/* padding: 2px; */
+	}
+	
+	.search-input{
+		width: 48%;
+		height: 25px;
+		text-align: center;
+		margin-top: 5px;
+		font-size: 26upx;
+		font-family: "PingFang-SC-Bold";
+		box-shadow: 0upx 0upx 30upx #D3D3D3;
+		border-radius: 5upx;
+	}
+	.search-button{
+		width: 20%;
+		padding-left: 10px;
+		padding-bottom: 5px;
+		margin-top: 3px;
+		text-align: center;
+		height: 60upx;
+		text-align: left;
+	}
 </style>