浏览代码

Merge branch 'master' of http://112.74.63.148:3000/litianbiao/shenze-sysMan

litianbiao 2 年之前
父节点
当前提交
e0ff6e0da3

+ 2 - 1
package.json

@@ -10,6 +10,7 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "airwallex-payment-elements": "latest",
     "@amap/amap-jsapi-loader": "^1.0.1",
     "@vant/touch-emulator": "^1.4.0",
     "axios": "^0.20.0",
@@ -57,7 +58,7 @@
     },
     "rules": {
       "no-irregular-whitespace": "off",
-	  "no-mixed-spaces-and-tabs":0
+      "no-mixed-spaces-and-tabs": 0
     }
   },
   "browserslist": [

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

@@ -252,6 +252,9 @@
     "furnaceHeadClosed": "Furnace head closed",
     "startSleep": "Start Sleep",
     "endSleep": "End Sleep",
+	"sleepDesc": "Sleep description",
+	"sleepDescPlace": "Please enter a sleep description",
+	"SuspendBusiness": "Suspend Business",
     "successfullyAddedAlarmClock": "Successfully added alarm clock",
     "parameterAdjustment": "Parameter adjustment",
     "generalParameterConfiguration": "General parameter configuration",
@@ -299,6 +302,11 @@
     "closeFurnHead": "Close furnace head",
     "remoteDoorOpening": "Remote door opening",
     "remoteSugarMaking": "Remote sugar making",
+	"outDoor": "Outer door",
+	"inDoor": "Inner door",
+	"openRemind": "Remind",
+	"openRemindOut": "Are you sure you want to switch the outer door?",
+	"openRemindIn": "Are you sure you want to switch the Inner door?",
     "modulation": "modulation",
     "equipmentRecharge": "Equipment recharge",
     "parameterSetting": "Parameter setting",

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

@@ -298,6 +298,11 @@
     "openFurnHead": "开启炉头",
     "closeFurnHead": "关闭炉头",
     "remoteDoorOpening": "远程开门",
+	"outDoor": "外 门",
+	"inDoor": "内 门",
+	"openRemind": "提醒",
+	"openRemindOut": "是否切换外门开关?",
+	"openRemindIn": "是否切换内门开关?",
     "remoteSugarMaking": "远程做糖",
     "modulation": "音量调节",
     "equipmentRecharge": "设备充值",
@@ -372,7 +377,7 @@
     "sleeping": "睡眠中",
     "notSleeping": "未睡眠",
 	"sleepDesc": "睡眠描述",
-	"confirmLog": "确定",
+	"SuspendBusiness": "暂停营业",
 	"sleepDescPlace": "请输入睡眠描述",
     "lastRefreshTime": "最近刷新时间",
     "machineUniqueCode": "机器唯一编码",

+ 4 - 1
src/router/index.js

@@ -25,6 +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: '/doSugar', name: 'doSugar', component: () => import('@/views/device/doSugar.vue'), meta: { index: 1} },
     // 今日做糖列表
@@ -109,7 +111,8 @@ const router = createRouter({
     { path: '/viewPosition', name: 'viewPosition', component: () => import('@/views/device/viewPosition/index'), meta: { index: 1 } },  
     // 设备编辑-编辑规则
     { path: '/editAdRule', name: 'editAdRule', component: () => import('@/views/device/editAdRule/index'), meta: { index: 1 } },
-    
+    // 跳转空中云汇
+	{ path: '/hpp', name: 'Hpp', component: () => import('@/views/Hpp.vue'), meta: { index: 1, noLogin: true } },
   ]
 });
 // 路由守卫处理

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

@@ -27,8 +27,11 @@ export function sleepEquipment(params) {
   return axios.post(`/SZWL-SERVER/tEquipment/sleep?${stringToUrl(params)}`, params);
 }
 // 远程开门
-export function openDoor(params) {
+/* export function openDoor(params) {
   return axios.post(`/SZWL-SERVER/tEquipment/openDoor?${stringToUrl(params)}`, params);
+} */
+export function Api_openDoor(params) {
+  return axios.get(`/SZWL-SERVER/tEquipment/openDoor`, {params})
 }
 // 系统脱机
 export function deviceTuoji(params) {

+ 175 - 0
src/views/Hpp.vue

@@ -0,0 +1,175 @@
+<template>
+  <div>
+    <h2>申泽智能</h2>
+    <button @click="redirectHpp()">Redirect to HPP</button>
+  </div>
+</template>
+
+<script>
+import { redirectToCheckout, loadAirwallex } from 'airwallex-payment-elements';
+import { useRoute } from "vue-router";
+
+export default {
+  name: 'Hpp',
+  
+  setup() {
+	const mode = 'payment';
+	const route = useRoute();
+	// const router = useRouter();
+	console.log(route.query.intent_id)
+  	const redirectHppForCheckout = () => {
+  	  redirectToCheckout({
+  	    env: 'demo',
+  	    mode,
+  	    currency: route.query.currency,
+  	    intent_id: route.query.intent_id,
+  	    client_secret: route.query.client_secret,
+  		//主题
+  	    theme: {
+  	      fonts: [
+  	        {
+  	          src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
+  	          family: 'AxLLCircular',
+  	          weight: 400,
+  	        },
+  	      ],
+  	    },
+  	    // successUrl: 'https://www.baidu.com', // 支付成功跳转页面
+  	    // failUrl: 'https://www.baidu.com', // 支付失败跳转页面
+  		logoUrl: '', //支付页面展示商户LOGO
+  	  });
+  	};
+  	const redirectHppForRecurring = () => {
+  	  redirectToCheckout({
+  	    env: 'demo',
+  	    // mode,
+  	    // currency,
+  	    // client_secret,
+  	    recurringOptions: {
+  	      card: {
+  	        next_triggered_by: 'customer',
+  	        merchant_trigger_reason: 'scheduled',
+  	        // currency,
+  	      },
+  	    },
+  	    theme: {
+  	      fonts: [
+  	        {
+  	          src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
+  	          family: 'AxLLCircular',
+  	          weight: 400,
+  	        },
+  	      ],
+  	    },
+  	    // successUrl: 'https://www.google.com',
+  	    // failUrl: 'https://www.google.com',
+  	  });
+  	};
+  	loadAirwallex({
+  	  env: 'demo', // Can choose other production environments, 'staging | 'demo' | 'prod'
+  	});
+  	const redirectHpp = async () => {
+  	  try {
+  	    await loadAirwallex({
+  	      env: 'demo', 
+  	    });
+  	    if (mode === 'payment') {
+  	      redirectHppForCheckout();
+  	    } else if (mode === 'recurring') {
+  	      redirectHppForRecurring();
+  	    }
+  	  } catch (error) {
+  	    window.alert('There was an error with HPP redirection', error);
+  	  }
+  	};
+	return {
+	  redirectHpp,
+	  redirectHppForCheckout,
+	  redirectHppForRecurring
+	};
+  }
+};
+
+/* const intent_id = this.$route.query.intent_id;
+const client_secret = 'replace-with-your-client-secret';
+const currency = 'replace-with-your-currency';
+const mode = 'payment';
+// console.log(this.intent_id);
+const redirectHppForCheckout = () => {
+  redirectToCheckout({
+    env: 'demo',
+    mode,
+    currency,
+    intent_id,
+    client_secret,
+	//主题
+    theme: {
+      fonts: [
+        {
+          src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
+          family: 'AxLLCircular',
+          weight: 400,
+        },
+      ],
+    },
+    successUrl: 'https://www.baidu.com', // 支付成功跳转页面
+    failUrl: 'https://www.baidu.com', // 支付失败跳转页面
+	logoUrl: '', //支付页面展示商户LOGO
+  });
+};
+const redirectHppForRecurring = () => {
+  redirectToCheckout({
+    env: 'demo',
+    mode,
+    currency,
+    client_secret,
+    recurringOptions: {
+      card: {
+        next_triggered_by: 'customer',
+        merchant_trigger_reason: 'scheduled',
+        currency,
+      },
+    },
+    theme: {
+      fonts: [
+        {
+          src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
+          family: 'AxLLCircular',
+          weight: 400,
+        },
+      ],
+    },
+    successUrl: 'https://www.google.com',
+    failUrl: 'https://www.google.com',
+  });
+};
+loadAirwallex({
+  env: 'demo', // Can choose other production environments, 'staging | 'demo' | 'prod'
+});
+const redirectHpp = async () => {
+  try {
+    await loadAirwallex({
+      env: 'demo', 
+    });
+    if (mode === 'payment') {
+      redirectHppForCheckout();
+    } else if (mode === 'recurring') {
+      redirectHppForRecurring();
+    }
+  } catch (error) {
+    window.alert('There was an error with HPP redirection', error);
+  }
+};
+export default {
+  name: 'Hpp',
+  data() {
+    return {
+      redirectHpp,
+	  msg: this.$route.query.intent_id,
+	  intent_id: this.$route.query.intent_id,
+	  client_secret: this.$route.query.client_secret,
+	  currency: this.$route.query.currency
+    };
+  },
+}; */
+</script>

+ 19 - 7
src/views/device/deviceOper.vue

@@ -54,7 +54,7 @@
         </div>
         <div class="operText">{{ $t("device.closeFurnHead") }}</div>
       </div>
-      <div class="operItem" @click="openDoorFun()">
+<!--     <div class="operItem" @click="openDoorFun()">
         <div class="operIcon">
           <img
             class="operImg"
@@ -62,7 +62,16 @@
           />
         </div>
         <div class="operText">{{ $t("device.remoteDoorOpening") }}</div>
-      </div>
+      </div> -->
+	  <div class="operItem" @click="openDoorFun()">
+	     <div class="operIcon">
+	       <img
+	         class="operImg"
+	         src="../../assets/device/operIcon/ic_openDoor.png"
+	       />
+	     </div>
+	     <div class="operText">{{ $t("device.remoteDoorOpening") }}</div>
+	   </div>
       <div class="operItem" @click="doSugar()">
         <div class="operIcon">
           <img class="operImg" src="../../assets/device/operIcon/doSugar.png" />
@@ -175,7 +184,7 @@ import { onMounted, ref } from "vue";
 import {
   setFurnace,
   sleepEquipment,
-  openDoor,
+  // openDoor,
   deviceTuoji,
   delOneDevice,
 } from "../../service/device";
@@ -235,10 +244,13 @@ export default {
       operCheckShow.value = true;
     };
     // 远程开门
-    const openDoorFun = () => {
+/*    const openDoorFun = () => {
       operType.value = 4;
       operCheckShow.value = true;
-    };
+    }; */
+	const openDoorFun = () => {
+      router.push({ path: "openDoor", query: { deviceId: device.value.id } });
+	};
     // 音量调节
     const modulation = () => {
       router.push({ path: "modulation", query: { deviceId: device.value.id } });
@@ -335,7 +347,7 @@ export default {
         }
       }
       // 远程开门
-      if (operType.value === 4) {
+/*     if (operType.value === 4) {
         const { data } = await openDoor({ equipmentId: device.value.id });
         if (data.code) {
           Toast.success(t("device.remoteDoorOpeningSucceeded"));
@@ -343,7 +355,7 @@ export default {
         } else {
           Toast.fail(data.message);
         }
-      }
+      } */
       // 系统脱机
       if (operType.value === 5) {
         const { data } = await deviceTuoji({ id: device.value.id });

+ 3 - 0
src/views/device/deviceSet.vue

@@ -561,6 +561,9 @@ export default {
           operationalPhone: item.operationalPhone,
           timeRuleId: item.timeRuleId,
           channel: item.channel,
+		  messageReceiver1: item.messageReceiver1,
+		  messageReceiver2: item.messageReceiver2,
+		  messageReceiver3: item.messageReceiver3
         };
       })[0];
       const { data } = await updateDevice(params);

+ 5 - 2
src/views/device/index.vue

@@ -123,7 +123,7 @@
 									<van-button
 									  type="primary"
 									  @click="sleepDescChg(item.sleepDesc, item.id)"
-									  >{{ $t("device.confirmLog") }}
+									  >{{ $t("device.confirm") }}
 									</van-button>
 									<van-icon name="edit" class="editIcon" @click="editSleepDesc()" />
 								</template>
@@ -132,7 +132,7 @@
 					  	</div>
 					  	<div v-else>
 					  	  <span class="word8_3" >{{ $t("device.sleepDesc") }}: 
-						  {{item.sleepDesc ==null ? "暂停营业" : item.sleepDesc}}</span>
+						  {{item.sleepDesc ==null ? $t("device.SuspendBusiness") : item.sleepDesc}}</span>
 					  	  <van-icon name="edit" class="editIcon" @click="editSleepDesc()" />
 					  	</div>
 					  </span>
@@ -372,6 +372,9 @@ export default {
         // 列表值叠加
         list.value = list.value.concat(
           data.data.records.map((item) => {
+			if(item.sleepDesc == null) {
+			  	item.sleepDesc = t("device.SuspendBusiness");
+			}
             return {
               ...item,
               checkType: false,

+ 192 - 0
src/views/device/openDoor.vue

@@ -0,0 +1,192 @@
+<template>
+	<!-- 远程开门 -->
+	<div class="page flex-col">
+		<s-header :name="$t('device.remoteDoorOpening')" :noback="false"></s-header>
+		<div class="box1">
+			<div class="block2 flex-row justify-between">
+				<div class="block3 flex-col"></div>
+				<span class="info2">{{ $t('device.equipmentName') }}:{{ deviceDetal ? deviceDetal.name : '' }}</span>
+			</div>
+			<van-field
+				colon
+				readonly
+				:label="`${$t('device.outDoor')}`"
+				label-width="40px"
+			>
+				<template #input>
+					<div class="l-flex-RC">
+					<span>{{ deviceDetal.outDoor != 1 ? $t("device.close") : $t("device.open") }}</span>
+					<van-switch
+						disabled
+						:model-value="deviceDetal.outDoor"
+						@update:model-value="outDoorChg"
+						size="24"
+						active-value="1"
+						inactive-value="0"
+					/>
+					</div>
+				</template>
+			</van-field>
+			
+			<van-field
+				colon
+				readonly
+				:label="`${$t('device.inDoor')}`"
+				label-width="40px"
+			>
+				<template #input>
+					<div class="l-flex-RC">
+					<span>{{ deviceDetal.inDoor != 1 ? $t("device.close") : $t("device.open") }}</span>
+					<van-switch
+						disabled
+						:model-value="deviceDetal.inDoor"
+						@update:model-value="inDoorChg"
+						size="24"
+						active-value="1"
+						inactive-value="0"
+					/>
+					</div>
+				</template>
+			</van-field>
+		</div>
+	</div>
+</template>
+
+<script>
+	import { onMounted, ref } from 'vue';
+	import sHeader from "@/components/SimpleHeader";
+	import { useRoute } from 'vue-router';
+	import { getDeviceDetal, Api_openDoor } from '@/service/device'
+	import { Toast, Dialog } from 'vant';
+	import { useI18n } from "vue-i18n";
+
+	export default {
+		setup() {
+			const route = useRoute();
+			const deviceId = route.query.deviceId;
+			const deviceDetal = ref({});
+			const { t } = useI18n();
+
+			// 初始化页面获取列表
+			onMounted(async () => {
+				getDeviceDetalFun();
+				console.log(deviceDetal.value)
+			});
+
+			// 获取设备列表数据
+			const getDeviceDetalFun = async () => {
+				const {
+					data
+				} = await getDeviceDetal({
+					id: deviceId
+				});
+				if (data.code === '00000') {
+					// outDoor如果是null,默认是关闭
+					if (data.data.outDoor == null) {
+					  data.data.outDoor = "0";
+					}
+					// inDoor如果是null,默认是关闭
+					if (data.data.inDoor == null) {
+					  data.data.inDoor = "0";
+					}
+					deviceDetal.value = data.data;
+				} else {
+					Toast.fail(data.message);
+				}
+			}
+			
+			// 点击外门开关
+			const outDoorChg = (outDoor) => {
+				Dialog.confirm({
+				    title: t('device.openRemind'),
+				    message: t('device.openRemindOut'),
+				}).then(() => {
+				    Api_openDoor({
+				    	equipmentId: deviceDetal.value.id,
+				    	type: 0,
+				    	status: outDoor,
+				    }).then((res) => {
+				    	Toast(res.data.message);
+				    	setTimeout(() => {
+				    		getDeviceDetalFun();
+				    	}, 1000);
+				    });
+				});
+			};
+			
+			// 点击内门开关
+			const inDoorChg = (inDoor) => {
+				Dialog.confirm({
+				    title: t('device.openRemind'),
+				    message: t('device.openRemindIn'),
+				}).then(() => {
+				    Api_openDoor({
+				    	equipmentId: deviceDetal.value.id,
+				    	type: 1,
+				    	status: inDoor,
+				    }).then((res) => {
+				    	Toast(res.data.message);
+				    	setTimeout(() => {
+				    		getDeviceDetalFun();
+				    	}, 1000);
+				    });
+				});
+			};
+			
+			return {
+				deviceDetal,
+				outDoorChg,
+				inDoorChg
+			};
+		},
+		components: {
+			sHeader
+		},
+	}
+</script>
+
+<style lang="less" scoped>
+	@import "../../common/style/common";
+	
+	.page {
+		background-color: rgba(255, 255, 255, 1);
+		position: relative;
+		width: 100%;
+		height: calc(100vh - 44px);
+		overflow: hidden;
+		
+		
+		.box1 {
+			width: 100%;
+			height: 237px;
+			
+			
+			.block2 {
+				width: 162px;
+				height: 20px;
+				margin: 18px 0 0 15px;
+			
+				.block3 {
+					background-color: rgba(128, 150, 236, 1);
+					border-radius: 2px;
+					width: 4px;
+					height: 12px;
+					margin-top: 4px;
+				}
+			
+				.info2 {
+					width: 150px;
+					height: 20px;
+					overflow-wrap: break-word;
+					color: rgba(64, 77, 116, 1);
+					font-size: 14px;
+					font-family: PingFangSC-Medium;
+					text-align: left;
+					white-space: nowrap;
+					line-height: 20px;
+					display: block;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
src/views/register.vue

@@ -213,7 +213,7 @@ export default {
         margin-top: 10px;
         overflow: visible;
         &::after { display: none;}
-        .van-field__button button { background-color: #4d6add; color: #fff; }
+        .van-field__button button { background-color: #8096ec; color: #fff; }
         .van-field__control {
           height: 38px;
           line-height: 38px;