ソースを参照

feat:“同步2024.06.25(增加雪糕机工作模式切换功能)“

soobin 1 年間 前
コミット
6b44076043

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


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


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


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

@@ -536,6 +536,9 @@
     "position": "Position",
     "viewPositioning": "View positioning",
     "restartAndroid": "Restart touch screen",
+    "refrigeration": "Refrigeration mode",
+    "keepFresh": "Fresh-keeping mode",
+    "stir": "Stirring mode",
     "view": "view",
     "oneKeyFeed": "One key feeding",
     "replenishment": "Replenish",
@@ -1410,6 +1413,9 @@
     "orderNotice": "Order notice",
     "openOrderNotice": "Do you want to enable order notification?",
     "closeOrderNotice": "Do you want to turn off order notifications?",
+    "onOffNotice": "Machine online/offline notification",
+    "openOnOffNotice": "Do you want to turn on machine online/offline notifications?",
+    "closeOnOffNotice": "Do you want to turn off machine online/offline notifications?",
     "pleaseBindWechat": "Please bind to wechat first",
     "openSuccess": "Open successfully",
     "closeSuccess": "Closed successfully"

+ 6 - 0
src/assets/language/ja.json

@@ -558,6 +558,9 @@
         "position": "位置情報",
         "viewPositioning": "位置情報を見る",
         "restartAndroid": "画面を再起動",
+        "refrigeration": "冷却モードです",
+        "keepFresh": "鮮度保持モードです",
+        "stir": "撹拌モードです",
         "view": "見る",
         "oneKeyFeed": "ワンタッチ補充",
         "replenishment": "補充",
@@ -1435,6 +1438,9 @@
         "orderNotice": "オーダー通知",
         "openOrderNotice": "註文通知を開きますか?",
         "closeOrderNotice": "註文通知を閉じますか?",
+        "onOffNotice": "デバイスのオンライン/オフライン通知です",
+        "openOnOffNotice": "デバイスのオンライン/オフライン通知を開きますか?",
+        "closeOnOffNotice": "デバイスのオンライン/オフライン通知をオフにしますか?",
         "pleaseBindWechat": "wechatとの連携をお願いします",
         "openSuccess": "オン成功です",
         "closeSuccess": "閉鎖成功です"

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

@@ -555,6 +555,9 @@
     "position": "定位",
     "viewPositioning": "查看定位",
     "restartAndroid": "重启触摸屏",
+    "refrigeration": "制冷模式",
+    "keepFresh": "保鲜模式",
+    "stir": "搅拌模式",
     "view": "查看",
     "oneKeyFeed": "一键补料",
     "replenishment": "补料",
@@ -631,7 +634,7 @@
     "deletionSucceeded": "删除成功",
     "discount": "折扣",
     "sameAs": "相当于",
-    "deduction": "抵扣",
+    "deduction": "立减",
     "termOfValidity": "有效期",
     "affiliatedMerchants": "所属商家",
     "expired": "(已过期)",
@@ -1433,6 +1436,9 @@
     "orderNotice": "订单通知",
     "openOrderNotice": "是否开启订单通知?",
     "closeOrderNotice": "是否关闭订单通知?",
+    "onOffNotice": "设备上/离线通知",
+    "openOnOffNotice": "是否开启设备上/离线通知?",
+    "closeOnOffNotice": "是否关闭设备上/离线通知?",
     "pleaseBindWechat": "请先绑定微信",
     "openSuccess": "开启成功",
     "closeSuccess": "关闭成功"

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

@@ -225,4 +225,9 @@ export function queryLog(params) {
 // 重启触摸屏
 export function restartScreen(params) {
     return axios.get(`/SZWL-SERVER/tEquipment/openScreen`, { params })
+}
+
+// 远程切换雪糕机工作模式
+export function changeWorkingMode(params) {
+    return axios.get(`/SZWL-SERVER/tEquipment/updateWorkingMode`, { params })
 }

+ 5 - 0
src/service/user.js

@@ -32,4 +32,9 @@ export function updatePayPlatform(params) {
 // 切换订单通知开关
 export function updateOrderNotice(params) {
   return axios.get(`/SZWL-SERVER/tAdmin/updateOrderNotice?${stringToUrl(params)}`, params);
+} 
+
+// 切换设备通知开关
+export function updateOnOffNotice(params) {
+  return axios.get(`/SZWL-SERVER/tAdmin/updateOnOffNotice?${stringToUrl(params)}`, params);
 } 

+ 4 - 4
src/styles/user/index.less

@@ -77,13 +77,13 @@
 
     .userInfoBox {
         // margin-top: 25px;
-        padding: 0px 15px 20px;
+        padding: 0px 10px 15px;
 
         .userInfo {
             // width: 87%;
-            margin: 0 auto;
+            margin: 0 3px;
             justify-content: flex-start;
-            margin-top: 20px;
+            margin-top: 15px;
             position: relative;
             font-size: 12px;
 
@@ -134,7 +134,7 @@
 
     .lineBox {
         width: 100%;
-        height: 15px;
+        height: 10px;
         background-color: #f6f7fc;
     }
 

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

@@ -48,6 +48,27 @@
     $t("device.closeFurnHead") }}</div>
         <div v-else class="operText">{{ $t("device.closeDevice") }}</div>
       </div>
+      <!-- 雪糕机制冷模式 -->
+      <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(0)">
+        <div class="operIcon">
+          <img class="operImg" src="../../assets/device/operIcon/refrigeration.png" />
+        </div>
+        <div class="operText">{{ $t("device.refrigeration") }}</div>
+      </div>
+      <!-- 雪糕机搅拌模式 -->
+      <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(1)">
+        <div class="operIcon">
+          <img class="operImg" src="../../assets/device/operIcon/stir.png" />
+        </div>
+        <div class="operText">{{ $t("device.stir") }}</div>
+      </div>
+      <!-- 雪糕机保鲜模式 -->
+      <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(2)">
+        <div class="operIcon">
+          <img class="operImg" src="../../assets/device/operIcon/keepFresh.png" />
+        </div>
+        <div class="operText">{{ $t("device.keepFresh") }}</div>
+      </div>
       <!--     <div class="operItem" @click="openDoorFun()">
               <div class="operIcon">
                 <img
@@ -171,7 +192,7 @@
         <div class="operText">{{ $t("device.customLogo.customLogo") }}</div>
       </div>
       <!-- 远程重启触摸屏 -->
-      <div v-if="device.machineType != '2'" class="operItem" @click="restartAndroid()">
+      <div class="operItem" @click="restartAndroid()">
         <div class="operIcon">
           <img class="operImg" src="../../assets/device/operIcon/restartAndroid.png" />
         </div>
@@ -218,6 +239,7 @@ import {
   enableMaterial,
   restartScreen,
   machineReset,
+  changeWorkingMode,
 } from "../../service/device";
 import { showFailToast, showSuccessToast } from "vant";
 import { useRouter } from "vue-router";
@@ -264,6 +286,8 @@ export default {
     const sleepIcon = ref('0');
     // 物料监控图标
     const materialIcon = ref('0');
+    // 工作模式
+    const workMode = ref(null);
     // 初始化页面获取列表
     onMounted(async () => {
       // 加载样式
@@ -381,10 +405,17 @@ export default {
       operType.value = 7;
       operCheckShow.value = true;
     };
+    // 重启触摸屏
     const restartAndroid = () => {
       operType.value = 9;
       operCheckShow.value = true;
     };
+    // 切换工作模式
+    const updateWorkingMode = (value) => {
+      workMode.value = value;
+      operType.value = 10;
+      operCheckShow.value = true;
+    };
     // 取消操作
     const operCheckClear = () => {
       operCheckShow.value = false;
@@ -518,6 +549,19 @@ export default {
           showFailToast(t("device.Failed"));
         }
       }
+      // 切换雪糕机工作模式
+      if (operType.value === 10) {
+        const { data } = await changeWorkingMode({
+          equipmentId: device.value.id,
+          workingMode: workMode.value,
+        });
+        if (data.code === '00000') {
+          showSuccessToast(t("device.Succeed"));
+          operCheckShow.value = false;
+        } else {
+          showFailToast(t("device.Failed"));
+        }
+      }
       setTimeout(() => {
         // 关闭弹窗
         show.value = false;
@@ -564,6 +608,7 @@ export default {
       sleepIcon,
       materialIcon,
       materialMonitorClk,
+      updateWorkingMode,
     };
   },
   components: {},

+ 46 - 38
src/views/user.vue

@@ -162,12 +162,20 @@
             </div>
             <span class="o-pl-50">{{ $t("user.currentChoose") }}: {{ sevencloudPay ? "汇付" : "汇聚" }}</span>
           </div>
-
+          <!-- 订单通知 -->
           <div v-if="isInWeChat && user.type == '2'" class="userInfo l-flex-RC">
             <span class="userInfoLeft l-flex-RC">{{ $t("user.orderNotice") }}: </span>
             <div class="cust_vantBorder">
-              <van-switch :model-value="orderNotice" active-color="#0090fa"
-                style="font-size: 19px;" @update:model-value="changeOrderNotice" />
+              <van-switch :model-value="orderNotice" active-color="#0090fa" style="font-size: 19px;"
+                @update:model-value="changeOrderNotice" />
+            </div>
+          </div>
+          <!-- 设备上下线提醒 -->
+          <div v-if="isInWeChat && user.type == '2'" class="userInfo l-flex-RC">
+            <span class="userInfoLeft l-flex-RC">{{ $t("user.onOffNotice") }}: </span>
+            <div class="cust_vantBorder">
+              <van-switch :model-value="onOffNotice" active-color="#0090fa" style="font-size: 18px;"
+                @update:model-value="changeOnOffNotice" />
             </div>
           </div>
         </div>
@@ -195,15 +203,6 @@
               <div class="taskTitle">{{ $t("user.settlementAccount") }}</div>
             </div>
           </div>
-
-          <!-- Airwallex 钱包 -->
-          <!-- <div v-if="isAbroad && user.companyType != '1'" class="taskListRow flex-col"
-            @click="pushPageList('/airwallex')">
-            <div class="taskIcon airwallexIcon"></div>
-            <div class="taskRight">
-              <div class="taskTitle">{{ $t("user.airwallex") }}</div>
-            </div>
-          </div> -->
           <!-- 绑定微信 -->
           <div v-if="isInWeChat" class="taskListRow flex-col" @click="pushPageList('/bindWechat')">
             <div class="taskIcon bindWechatIcon"></div>
@@ -274,7 +273,7 @@ import {
   $M_PhoneTest,
 } from "@/common/js/utils";
 import { useRouter } from "vue-router";
-import { tAdminGetRelation, updatePayPlatform, updateOrderNotice } from "@/service/user";
+import { tAdminGetRelation, updatePayPlatform, updateOrderNotice, updateOnOffNotice } from "@/service/user";
 import { showFailToast, showToast, showSuccessToast, showConfirmDialog } from 'vant';
 import { useI18n } from "vue-i18n";
 import { styleUrl } from "../common/js/utils";
@@ -300,6 +299,8 @@ export default {
 
     // 订单通知开关状态
     const orderNotice = ref(false);
+    // 设备上/离线通知开关状态
+    const onOffNotice = ref(false);
 
     const sunzeePay = ref(false);
     const sevencloudPay = ref(false);
@@ -459,6 +460,9 @@ export default {
         if (accountDetail.value.orderNotice == "1") {
           orderNotice.value = true;
         }
+        if (accountDetail.value.onOffNotice == "1") {
+          onOffNotice.value = true;
+        }
         kCascaderRef.value.init(accountDetail.value.areaId);
       });
     };
@@ -558,7 +562,7 @@ export default {
         console.error(error);
       })
     }
-
+    // 切换订单通知开关
     const changeOrderNotice = (value) => {
       showConfirmDialog({
         title: t('user.tips'),
@@ -573,7 +577,32 @@ export default {
         if (data.code == "00000") {
           showSuccessToast(value ? t('user.openSuccess') : t('user.closeSuccess'));
           orderNotice.value = value;
-        } else if(data.code == "A0001") {
+        } else if (data.code == "A0001") {
+          showToast(t('user.pleaseBindWechat'));
+        } else {
+          showFailToast(data.message);
+        }
+      }).catch((error) => {
+        console.error(error);
+      })
+    }
+
+    // 切换设备通知开关
+    const changeOnOffNotice = (value) => {
+      showConfirmDialog({
+        title: t('user.tips'),
+        message: onOffNotice.value ? t('user.closeOnOffNotice') : t('user.openOnOffNotice'),
+      }).then(async () => {
+        const params = reactive({
+          adminId: user.id,
+          onOffNotice: value ? '1' : '0',
+        });
+        const { data } = await updateOnOffNotice(params);
+        console.log("data", data)
+        if (data.code == "00000") {
+          showSuccessToast(value ? t('user.openSuccess') : t('user.closeSuccess'));
+          onOffNotice.value = value;
+        } else if (data.code == "A0001") {
           showToast(t('user.pleaseBindWechat'));
         } else {
           showFailToast(data.message);
@@ -601,13 +630,6 @@ export default {
         getSunzeeDetail();
         getSevenCloudDetail();
       }
-      // else if (user.id == 2738) {
-      //   chaSzPayShow.value = true;
-      //   getSunzeeDetail();
-      // } else if (user.id == 2739) {
-      //   chaScPayShow.value = true;
-      //   getSevenCloudDetail();
-      // }
     });
     const gettAdminGetRelation = async () => {
       const { data } = await tAdminGetRelation({
@@ -705,26 +727,10 @@ export default {
         haveRelation.value = true;
       }
     }
-    // const checkIsAbroad = async () => {
-    //   try {
-    //     const { data } = await getIfForeign(user.id);
-    //     console.log("isAbroad >>> ", data);
-
-    //     if (data.data === '1') {
-    //       // TODO: 这里先把isAbroad设置为fasle,等开发完成再改成true;
-    //       isAbroad.value = false;
-    //       isInland.value = false;
-    //     }
-    //   } catch (error) {
-    //     console.error(error);
-    //   }
-    // };
     const checkIsAbroad = async () => {
       try {
         const userInfo = localStorage.getItem("loginUser");
         const userIfForeign = JSON.parse(userInfo);
-        // console.log("用户的海内外信息" + userIfForeign.ifForeign);
-        // console.log("看下user是什么***" + user.menuCodeList);
         if (userIfForeign.ifForeign === '1') {
           isAbroad.value = true;
           isInland.value = false;
@@ -781,6 +787,8 @@ export default {
       changeSevenCloudPay,
       orderNotice,
       changeOrderNotice,
+      onOffNotice,
+      changeOnOffNotice,
     };
   }
 };