Browse Source

添加机器密码,销售量修正以及优化退款

soobin 2 years ago
parent
commit
ffc7109468

BIN
src/assets/device/operIcon/ic_password.png


+ 24 - 8
src/assets/language/en.json

@@ -384,9 +384,9 @@
     "furnaceHeadTemperature": "furnace head temperature",
     "temperatureInCabinet": "Temperature in cabinet",
     "humidityInCabinet": "Humidity in cabinet",
-    "showGoods": "Block or display goods",
-    "editShowGoods": "Are you sure about the change?",
-    "unknownError": "Unknown error!",
+	"showGoods": "Block or display goods",
+	"editCheck": "Are you sure about the change?",
+	"unknownError": "Unknown error!",
     "degree": "degree",
     "volume": "volume",
     "alarmContent": "Alarm content",
@@ -465,6 +465,7 @@
     "sureUpdate": "Are you sure you want to update",
     "coupon": "coupon",
     "adRule": "Advertising rules",
+	"changePassword": "Changing device password",
     "editAdRule": {
       "title": "Edit Rule",
       "ruleName": "Rule Name",
@@ -476,6 +477,17 @@
       "title": "Goods display setting",
       "equipmentName": "Equipment name"
     },
+	"devicePasswordPage":{
+		"title":"Changing device password",
+		"equipmentName":"Equipment name",
+		"deivcePwd": "Equipment password",
+		"adminPassword": "Administrator password",
+		"guestPassword": "Secondary administrator password",
+		"checkDeivcePwd": "Confirm password",
+		"passwordPlaceholder": "Please enter a password of more than 6 characters",
+		"passwordCheckRequired": "Please enter your password again",
+		"passwordMatch": "Two passwords do not match"
+	},
     "flowerType": "Flower type",
     "flowerTypePlace": "Please select the flower type"
   },
@@ -556,7 +568,7 @@
     "dataOverview": "dataOverview",
     "orderData": "orderData",
     "totalIncome": "totalIncome",
-    "productNum": "numberOfProducts",
+    "productNum": "Sales volume",
     "numberOfOrders": "numberOfOrders",
     "commonTools": "commonTools",
     "deviceManagement": "deviceManagement",
@@ -728,7 +740,7 @@
     "dataOverview": "Data overview",
     "search": "search",
     "totalIncome": "Total income",
-    "productNum": "Number of products",
+    "productNum": "Sales volume",
     "numberOfOrders": "Number of orders",
     "orderDetails": "order details",
     "exportToExcel": "Export to Excel",
@@ -776,10 +788,14 @@
     "endTime": "End time",
     "clickSearch": "Click Search",
     "selectFullTime": "Select full time",
-    "refundAmount": "refund amount",
+    "refundAmount": "Refund amount",
+	"refundTip": "Make sure the amount corresponds to the quantity, otherwise it will affect the statistics!",
+	"refundQuantity":"Refund quantity",
     "refundAmountPlace": "Please enter the refund amount",
-    "most": "most",
-    "accountBalance": "Account balance"
+    "most": "most ",
+	"at":"",
+    "accountBalance": "Account balance",
+	"refundSubmit": "Submit applications"
   },
   "orderExport": {
     "orderAnalysis": "Order Analysis",

+ 22 - 6
src/assets/language/zh.json

@@ -258,7 +258,7 @@
     "advancedParameterConfiguration": "进阶参数配置",
     "debuggingParameterConfiguration": "调试参数配置",
     "humidityParameterConfiguration": "湿度参数配置",
-    "submitUpdates": "提交更新",
+    "submitUpdates": "提交更新",	
     "modificationSucceeded": "修改成功",
     "addDistributor": "添加分销人",
     "equipmentNoLabel": "设备编号",
@@ -385,7 +385,7 @@
     "temperatureInCabinet": "柜内温度",
     "humidityInCabinet": "柜内湿度",
 	"showGoods": "屏蔽/显示商品",
-	"editShowGoods": "是否确认更改?",
+	"editCheck": "是否确认更改?",
 	"unknownError": "未知错误!",
     "degree":"度",
     "volume": "音量",
@@ -444,7 +444,19 @@
       "customLogoSucceed": "定制logo成功"
     },
 
-	"deleteDevice":"删除设备",
+	"devicePasswordPage":{
+		"title": "修改机器密码",
+		"equipmentName": "设备名称",
+		"adminPassword": "管理员密码",
+		"guestPassword": "次管理员密码",
+		"deivcePwd": "机器密码",
+		"checkDeivcePwd": "确认密码",
+		"passwordPlaceholder": "请输入6位数以上密码",
+		"passwordCheckRequired": "请再次输入密码进行确认",
+		"passwordMatch": "两次密码不一致"
+	},
+	"changePassword": "修改机器密码",
+	"deleteDevice": "删除设备",
     "noPosition":"暂无定位",
     "equipLocation":"设备位置",
     "position":"定位",
@@ -558,7 +570,7 @@
     "dataOverview": "数据概览",
     "orderData": "订单数据",
     "totalIncome": "收入总额",
-    "productNum": "商品数",
+    "productNum": "销售量",
     "numberOfOrders": "订单数",
     "commonTools": "常用工具",
     "deviceManagement": "设备管理",
@@ -730,7 +742,7 @@
     "dataOverview": "数据概览",
     "search": "搜索",
     "totalIncome": "收入总额",
-    "productNum": "商品数",
+    "productNum": "销售量",
     "numberOfOrders": "订单数",
     "orderDetails": "订单明细",
     "exportToExcel": "导出excel",
@@ -779,9 +791,13 @@
     "clickSearch": "点击搜索",
     "selectFullTime": "选择完整时间",
     "refundAmount":"退款金额",
+	"refundTip": "确保金额与数量对应,否则会影响统计!",
+	"refundQuantity":"退款数量",
     "refundAmountPlace":"请输入退款金额",
     "most":"最多",
-    "accountBalance":"账户余额"
+	"at":"个",
+    "accountBalance":"账户余额",
+	"refundSubmit": "提交申请"
   },
   "orderExport": {
     "orderAnalysis": "订单分析",

+ 3 - 2
src/main.js

@@ -3,8 +3,7 @@ import {
   ActionBar, ActionBarIcon, ActionBarButton, Divider, Popup, Overlay, Loading, Dialog, ContactCard, Form, AddressEdit,
   AddressList, Field, CellGroup, Cell, SwipeCell, Icon, Stepper, Card, Checkbox, CheckboxGroup, Button, Swipe, SwipeItem,
   PullRefresh, List, Tab, Tabs, SubmitBar, Toast, Skeleton, RadioGroup, Radio, NoticeBar, ActionSheet, Cascader, Col, Row,
-  Slider, DatetimePicker, Switch, Calendar, Picker, Uploader, Tag, DropdownMenu, DropdownItem
-  
+  Slider, DatetimePicker, Switch, Calendar, Picker, Uploader, Tag, DropdownMenu, DropdownItem, Notify, ConfigProvider
 } from 'vant';
 import { Image as VanImage } from 'vant';
 import App from './App.vue'
@@ -77,6 +76,8 @@ app.use(ActionBarButton)
   .use(Tag)
   .use(DropdownMenu)
   .use(DropdownItem)
+  .use(Notify)
+  .use(ConfigProvider)
 
 app.use(router)
 app.use(store)

+ 6 - 4
src/router/index.js

@@ -25,8 +25,8 @@ const router = createRouter({
     // { path: '/deviceOpr', name: 'deviceOpr', component: () => import('@/views/device/deviceOper2.vue'), meta: { index: 1 } },
     // 音量调节
     { path: '/modulation', name: 'modulation', component: () => import('@/views/device/modulation.vue'), meta: { index: 1} },
-	  // 远程开门
-	  { path: '/openDoor', name: 'openDoor', component: () => import('@/views/device/openDoor.vue'), meta: { index: 1} },
+	// 远程开门
+	{ path: '/openDoor', name: 'openDoor', component: () => import('@/views/device/openDoor.vue'), meta: { index: 1} },
     // 远程做糖
     { path: '/doSugar', name: 'doSugar', component: () => import('@/views/device/doSugar.vue'), meta: { index: 1} },
     // 今日做糖列表
@@ -107,8 +107,10 @@ const router = createRouter({
     { path: '/labelManAdd', name: 'labelManAdd', component: () => import('@/views/labelMan/add'), meta: { index: 1 } },
     // 修改价格
     { path: '/modifyPrice', name: 'modifyPrice', component: () => import('@/views/device/modifyPrice/index'), meta: { index: 1 } },
-    // 屏蔽/展示商品
-    { path: '/showGoods', name: 'showGoods', component: () => import('@/views/device/showGoods/index'), meta: { index: 1 } },
+	// 屏蔽/展示商品
+	{ path: '/showGoods', name: 'showGoods', component: () => import('@/views/device/showGoods/index'), meta: { index: 1 } },
+	// 修改机器密码
+	{ path: '/devicePassword', name: 'devicePassword', component: () => import('@/views/device/devicePassword/index'), meta: { index: 1 } },
     // 查看定位
     { path: '/viewPosition', name: 'viewPosition', component: () => import('@/views/device/viewPosition/index'), meta: { index: 1 } },  
     // 设备编辑-编辑规则

+ 4 - 0
src/service/device/index.js

@@ -126,6 +126,10 @@ export function delOneDevice(params) {
 export function updateProductsShow(params) {
   return axios.post(`/SZWL-SERVER/tProduct/updateProductsShow`, params)
 }
+// 远程修改机器密码
+export function updateDevicePassword(params) {
+  return axios.post(`/SZWL-SERVER/tEquipment/updatePassword`, params)
+}
 // 定制Logo
 export function customLogo(params) {
   return axios.post(`/SZWL-SERVER/tLogo/customLogo?${stringToUrl(params)}`, params)

+ 17 - 1
src/views/device/deviceOper.vue

@@ -150,6 +150,15 @@
         </div>
         <div class="operText">{{ $t("device.showGoods") }}</div>
       </div>
+	  <div class="operItem" @click="changePasswordClk()">
+	    <div class="operIcon">
+	      <img
+	        class="operImg"
+	        src="../../assets/device/operIcon/ic_password.png"
+	      />
+	    </div>
+	    <div class="operText">{{ $t("device.changePassword") }}</div>
+	  </div>
 	  <!-- 删除设备 -->
 	  <div v-if="user.type < 2" class="operItem" @click="deleteDevice()">
 	    <div class="operIcon">
@@ -171,7 +180,6 @@
 	    </div>
 	    <div class="operText">{{ $t("device.customLogo.customLogo") }}</div>
 	  </div>
-    
     </div>
   </van-dialog>
   <van-dialog
@@ -313,6 +321,13 @@ export default {
       operType.value = 5;
       operCheckShow.value = true;
     };
+	// 修改机器密码
+	const changePasswordClk = () => {
+	  router.push({
+	    path: "devicePassword",
+	    query: { deviceId: device.value.id, name: device.value.name },
+	  });
+	};
     // 删除设备
     const deleteDevice = () => {
       operType.value = 6;
@@ -448,6 +463,7 @@ export default {
 	    showGoodsClk,
       sleepTitle,
       deleteDevice,
+	  changePasswordClk,
     };
   },
   components: {},

+ 197 - 0
src/views/device/devicePassword/index.vue

@@ -0,0 +1,197 @@
+<template>
+	<div class="passwordIdx">
+		<s-header :name="$t('device.devicePasswordPage.title')" :noback="false"></s-header>
+		<div class="headerCon kBordBott o-plr-10 o-ptb-16 l-flex-RC">
+			<div class="line o-mr-6"></div>
+			<div>
+				<span class="c-color c-text-14">{{ $t('device.devicePasswordPage.equipmentName') }}:</span>
+				<span class="c-text-color c-text-14">{{ equipmentName }}</span>
+			</div>
+		</div>
+	</div>
+	<van-config-provider :theme-vars="themeVars">
+	<van-dropdown-menu active-color="#1989fa">
+		<van-dropdown-item v-model="pwdValue" :options="pwdType" />
+	</van-dropdown-menu>
+	<van-form v-if="pwdValue==0" @submit="onSubmit">
+		<van-cell-group inset>
+			<van-field v-model="adminPwd" type="password" :label="$t('device.devicePasswordPage.deivcePwd')"
+				:placeholder="$t('device.devicePasswordPage.passwordPlaceholder')"
+				:rules="[{ validator, message: $t('device.devicePasswordPage.passwordPlaceholder') }]" />
+			<van-field v-model="checkAmdinPwd" type="password" :label="$t('device.devicePasswordPage.checkDeivcePwd')"
+				:placeholder="$t('device.devicePasswordPage.passwordCheckRequired')"
+				:rules="[{ validator, message: $t('device.devicePasswordPage.passwordPlaceholder') }]" />
+		</van-cell-group>
+		<div style="margin: 16px;">
+			<van-button round block type="primary" native-type="submit">
+				{{$t('device.submitAndPushDeviceUpdates')}}
+			</van-button>
+		</div>
+	</van-form>
+	<van-form v-else @submit="onSubmit">
+		<van-cell-group inset>
+			<van-field v-model="guestPwd" type="password" :label="$t('device.devicePasswordPage.deivcePwd')"
+				:placeholder="$t('device.devicePasswordPage.passwordPlaceholder')"
+				:rules="[{ validator, message: $t('device.devicePasswordPage.passwordPlaceholder') }]" />
+			<van-field v-model="checkGuestPwd" type="password" :label="$t('device.devicePasswordPage.checkDeivcePwd')"
+				:placeholder="$t('device.devicePasswordPage.passwordCheckRequired')"
+				:rules="[{ validator, message: $t('device.devicePasswordPage.passwordPlaceholder') }]" />
+		</van-cell-group>
+		<div style="margin: 16px;">
+			<van-button round block type="primary" native-type="submit">
+				{{$t('device.submitAndPushDeviceUpdates')}}
+			</van-button>
+		</div>
+	</van-form>
+	</van-config-provider>
+</template>
+
+<script>
+	// 导入接口
+	import {
+		updateDevicePassword
+	} from '@/service/device/index';
+	import sHeader from "@/components/SimpleHeader";
+	import {
+		ref,
+		reactive
+	} from "@vue/reactivity";
+	import {
+		onMounted
+	} from '@vue/runtime-core';
+	import {
+		useRoute, useRouter
+	} from 'vue-router';
+	import {
+		Notify, Dialog, Toast
+	} from 'vant';
+	import {
+		useI18n
+	} from "vue-i18n";
+	export default {
+		components: {
+			sHeader
+		},
+		setup() {
+			// 引入语言
+			const { t } = useI18n();
+			// 路由
+			const route = useRoute();
+			const router = useRouter();
+			// 设备名称
+			const equipmentName = ref('');
+			const pwdValue = ref();
+			const adminPwd = ref();
+			const checkAmdinPwd = ref();
+			const guestPwd = ref();
+			const checkGuestPwd = ref();
+
+			const validator = (val) => /\w{6,}/.test(val);
+			const themeVars = {
+				dropdownMenuTitleTextColor: '#404d74'
+			};
+			const pwdType = [{
+					text: t('device.devicePasswordPage.adminPassword'),
+					value: 0
+				},
+				{
+					text: t('device.devicePasswordPage.guestPassword'),
+					value: 1
+				},
+			]
+			// 刚进页面
+			onMounted(() => {
+				console.log(pwdType[0].value)
+				pwdValue.value = pwdType[0].value;
+				console.log(pwdValue.value)
+				const id = route.query.deviceId || "";
+				const name = route.query.name || "";
+				if (id) {
+					passwordForm.equipmentId = id;
+					equipmentName.value = name;
+				}
+
+			});
+			// 修改的价格
+			const passwordForm = reactive({
+				equipmentId: '',
+				adminPwd: '',
+				guestPwd: ''
+			});
+
+			// 点击提交
+			const onSubmit = () => {
+				passwordForm.adminPwd = adminPwd.value;
+				passwordForm.guestPwd = guestPwd.value;
+				console.log(passwordForm);
+				if ((passwordForm.adminPwd != checkAmdinPwd.value) || (passwordForm.guestPwd != checkGuestPwd.value)) {
+					Notify({
+						type: 'danger',
+						message: t('device.devicePasswordPage.passwordMatch')
+					});
+					return;
+				}
+				if(pwdValue.value == 0) {
+					passwordForm.guestPwd = "";
+				}
+				if(pwdValue.value == 1) {
+					passwordForm.adminPwd = "";
+				}
+				Dialog.confirm({
+					// title: "提示",
+					message: t('device.editCheck'),
+				}).then(() => {
+					console.log(passwordForm);
+					updateDevicePassword({
+						"equipmentId": passwordForm.equipmentId,
+						"adminPwd": passwordForm.adminPwd,
+						"guestPwd": passwordForm.guestPwd
+					}).then((res) => {
+						if(res.data.code == "A0001") {
+							Toast.fail(t('device.unknownError'));
+							return;
+						}						
+						Dialog.alert({
+							message: t('device.modificationSucceeded'),
+						}).then(() => {
+							//返回上一页
+							router.go(-1);
+						});
+					});
+				});
+			}
+
+			return {
+				passwordForm,
+				equipmentName,
+				pwdType,
+				pwdValue,
+				adminPwd,
+				checkAmdinPwd,
+				guestPwd,
+				checkGuestPwd,
+				onSubmit,
+				validator,
+				themeVars
+			};
+		},
+	};
+</script>
+
+<style lang="less" scoped>
+	.passwordIdx {
+		overflow: hidden;
+		overflow-y: auto;
+
+
+		.headerCon {
+			.line {
+				background-color: rgba(128, 150, 236, 1);
+				border-radius: 2px;
+				width: 4px;
+				height: 16px;
+			}
+		}
+
+	}
+</style>

+ 4 - 10
src/views/device/showGoods/index.vue

@@ -22,7 +22,7 @@
 	</van-row>
 	<div style="margin: 16px">
 		<van-button round block type="primary" native-type="submit" @click="updateShowGoods()">
-			提交
+			{{$t('device.submitAndPushDeviceUpdates')}}
 		</van-button>
 	</div>
 </template>
@@ -134,7 +134,7 @@
 			const updateShowGoods = () => {
 				Dialog.confirm({
 					title: t('device.openRemind'),
-					message: t('device.editShowGoods'),
+					message: t('device.editCheck'),
 				}).then(() => {
 					console.log(tableData.value);
 					var products = tableData.value;
@@ -155,7 +155,7 @@
 						}, 1000);
 					}).catch((error) => {
 						console.log(error);
-						Toast(t('device.unknownError'));
+						Toast.fail(t('device.unknownError'));
 					});
 				});
 			};
@@ -174,7 +174,7 @@
 
 <style lang="less" scoped>
 	.showGoodsIdx {
-		height: calc(100%-44px);
+		// height: calc(100%-44px);
 		overflow: hidden;
 		overflow-y: auto;
 
@@ -199,12 +199,6 @@
 				.divider {
 					line-height: 50px;
 				}
-
-				// .goodsName {
-				// 	display: flex;
-				// 	/* 设置为 flex 布局 */
-				// 	flex-direction: column;
-				// }
 			}
 
 		}

+ 1 - 1
src/views/home/index.vue

@@ -488,7 +488,7 @@ export default {
     const showLogo = (url)=>{
       return require(`../../assets/home/${url}.png`);
     };
-    
+
     return {
       userName,
       update,

+ 10 - 0
src/views/orderCenter/index.less

@@ -1157,4 +1157,14 @@
       }
     }
   }
+  .cust_vantBorder {
+	display: flex;
+	justify-content: flex-end; /* 水平方向上右对齐 */
+	align-items: center; /* 垂直方向上居中对齐 */
+	flex-direction: column; /* 垂直方向上排列子元素 */
+	
+	.inputAmount {
+		width: 100%;
+	}
+  }
 }

+ 42 - 14
src/views/orderCenter/index.vue

@@ -186,16 +186,24 @@
       </div>
     </van-popup>
     <!-- 退款弹窗 -->
-    <kDialog :isCloseForConfirm="false" :dialogTitle="$t('orderCenter.refundAmount')"
-      :confirmBtnTxt="$t('device.modifyPricePage.modifySubmit')" ref="kDialogRef" @confirmclk="confirmClk">
+    <kDialog :isCloseForConfirm="false" :dialogTitle="$t('orderCenter.refundTip')"
+      :confirmBtnTxt="$t('orderCenter.refundSubmit')" ref="kDialogRef" @confirmclk="confirmClk">
       <template #content>
         <div class="cust_vantBorder l-flex-RC">
-          <van-field colon required type="number" clearable v-model="cofficentForm.price"
+          <van-field colon required type="number" clearable v-model="cofficentForm.price" class="inputAmount"
             :placeholder="$t('orderCenter.refundAmountPlace')" :label="$t('orderCenter.refundAmount')">
             <template #extra>
-              最多¥{{ cofficentForm.maxPrice }}
+              {{$t('orderCenter.most')}}¥{{ cofficentForm.maxPrice }}
             </template>
           </van-field>
+		  <div class="van-cell l-flex-RC">
+			<div class="van-field__label van-field__label--required">
+				<span>{{$t('orderCenter.refundQuantity')}}: </span>
+			</div>
+			<van-stepper v-model="cofficentForm.productNumber" theme="round" button-size="22"
+			:max="cofficentForm.maxNumber" disable-input />
+			<span class="o-pl-10">{{$t('orderCenter.most')+cofficentForm.maxNumber+$t('orderCenter.at')}}</span>
+		  </div>
         </div>
       </template>
     </kDialog>
@@ -208,6 +216,7 @@ import { getAdminMch } from "@/service/merchantManage";
 // 导入弹窗
 import kDialog from "@/components/commom/kDialog/index.vue";
 // 导入无数据组件
+import { Dialog } from 'vant';
 import kNoData from "@/components/commom/kNoData/index.vue";
 import { onMounted, reactive, ref } from "vue";
 import sHeader from "@/components/SimpleHeader";
@@ -232,6 +241,8 @@ export default {
       cofficentForm.price = row.price;
       cofficentForm.maxPrice = row.price;
       cofficentForm.id = row.id;
+	  cofficentForm.maxNumber = row.productNumber;
+	  cofficentForm.productNumber = row.productNumber;
       kDialogRef.value.openDialog();
     };
     // 点击确定按钮
@@ -241,8 +252,13 @@ export default {
       } else if (cofficentForm.price > cofficentForm.maxPrice) {
         Toast(t('orderCenter.most') + cofficentForm.maxPrice);
       } else {
-        refundAjax();
-        kDialogRef.value.closeDialog();
+		Dialog.confirm({
+			// title: "提示",
+			message: t('device.editCheck'),
+		}).then(() => {
+			refundAjax();
+			kDialogRef.value.closeDialog();
+		});
       }
     }
     // 退款操作
@@ -252,9 +268,14 @@ export default {
       console.log('data', data)
       if (data.code && data.code !== 'B0001') {
         refundType.value = false;
-        Toast.success(t('orderCenter.refundSucceeded'));
-        orderList.value = [];
-        search({});
+		Dialog.alert({
+		  message: t('orderCenter.refundSucceeded'),
+		}).then(() => {
+		  // on close
+			orderList.value = [];
+			search({});
+		});
+        // Toast.success(t('orderCenter.refundSucceeded'));
       } else {
         Toast.fail(data.message);
       }
@@ -263,7 +284,9 @@ export default {
     const cofficentForm = reactive({
       price: "",
       maxPrice: "",
-      id: ""
+	  maxNumber: "",
+      id: "",
+	  productNumber: ""
     });
     // 引入语言
     const { t } = useI18n();
@@ -360,11 +383,16 @@ export default {
               return {
                 ...item,
                 statusText:
-                  item.status && item.status === 0
-                    ? t('orderCenter.toBePaid')
-                    : item.status
-                      ? t('orderCenter.onlinePayment')
+					item.altInfo!=null
+					  ? t('orderCenter.onlinePayment')
                       : t('orderCenter.offlinePayment'),
+                  // item.status && item.status === 0
+                  //   ? t('orderCenter.toBePaid')
+                  //   : item.status
+                  //     ? t('orderCenter.onlinePayment')
+                  //     : t('orderCenter.offlinePayment'),
+				// productName:
+				// 	item.pr
               };
             })
           );