Explorar o código

feat:“增加雪糕机机器工作模式切换按钮,设备上/离线通知开关功能”

soobin hai 1 ano
pai
achega
d633b80060

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


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


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


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

@@ -558,6 +558,9 @@
     "position": "定位",
     "viewPositioning": "查看定位",
     "restartAndroid": "重启触摸屏",
+    "refrigeration": "制冷模式",
+    "keepFresh": "保鲜模式",
+    "stir": "搅拌模式",
     "view": "查看",
     "oneKeyFeed": "一键补料",
     "replenishment": "补料",
@@ -1441,6 +1444,9 @@
     "orderNotice": "订单通知",
     "openOrderNotice": "是否开启订单通知?",
     "closeOrderNotice": "是否关闭订单通知?",
+    "onOffNotice": "设备上/离线通知",
+    "openOnOffNotice": "是否开启设备上/离线通知?",
+    "closeOnOffNotice": "是否关闭设备上/离线通知?",
     "pleaseBindWechat": "请先绑定微信",
     "openSuccess": "开启成功",
     "closeSuccess": "关闭成功"

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

@@ -230,4 +230,9 @@ export function updateLockStatus(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

@@ -44,5 +44,10 @@ export function updateDIYPassword(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

@@ -78,13 +78,13 @@
 
     .userInfoBox {
         // margin-top: 25px;
-        padding: 0px 10px 0.5rem;
+        padding: 0px 10px 15px;
 
         .userInfo {
             // width: 87%;
-            margin: 0 auto;
+            margin: 0 3px;
             justify-content: flex-start;
-            margin-top: 0.5rem;
+            margin-top: 15px;
             position: relative;
 
             .filedInpPad {
@@ -140,7 +140,7 @@
 
     .lineBox {
         width: 100%;
-        height: 15px;
+        height: 10px;
         background-color: #f6f7fc;
     }
 

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

@@ -49,6 +49,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
@@ -180,7 +201,7 @@
         <div class="operText">{{ $t("device.lockDevice") }}</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>
@@ -228,6 +249,7 @@ import {
   updateLockStatus,
   restartScreen,
   machineReset,
+  changeWorkingMode,
 } from "../../service/device";
 import { showFailToast, showSuccessToast } from "vant";
 import { useRouter } from "vue-router";
@@ -274,6 +296,8 @@ export default {
     const sleepIcon = ref('0');
     // 物料监控图标
     const materialIcon = ref('0');
+    // 工作模式
+    const workMode = ref(null);
 
     // 初始化页面获取列表
     onMounted(async () => {
@@ -400,10 +424,17 @@ export default {
       operType.value = 8;
       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;
@@ -550,6 +581,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;
@@ -597,6 +641,7 @@ export default {
       sleepIcon,
       materialIcon,
       materialMonitorClk,
+      updateWorkingMode,
     };
   },
   components: {},

+ 46 - 18
src/views/user.vue

@@ -188,12 +188,20 @@
             </div>
             <span class="o-pl-10">{{ $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: 18px;"
+                @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>
@@ -299,7 +307,6 @@
 
           <!-- 意见反馈 -->
           <div v-if="user.type > 1" class="taskListRow flex-col" @click="pushPageList('/feedback')">
-            <!-- <div v-if="user.id == 31 || user.id == 34" class="taskListRow flex-col" @click="pushPageList('/feedback')"> -->
             <div class="taskIcon feedbackIcon"></div>
             <div class="taskRight">
               <div class="taskTitle">{{ $t("user.feedback") }}</div>
@@ -323,7 +330,6 @@
         </div>
       </div>
     </div>
-    <!-- <nav-bar></nav-bar> -->
     <!-- 退出登录弹窗 -->
     <kDialog :dialogTitle="$t('user.logOutTips')" :cancelBtnTxt="$t('user.cancelLog')"
       :confirmBtnTxt="$t('user.confirmLog')" ref="kDialogRef" :dialogContent="$t('user.logOutContent')"
@@ -345,15 +351,13 @@ import { updateAdmin } from "@/service/merchantManage";
 import kDialog from "@/components/commom/kDialog/index.vue";
 import { onMounted, reactive, ref } from "vue";
 import sHeader from "@/components/SimpleHeader";
-// import navBar from "@/components/NavBar";
 import {
   getLoginUser,
   $M_EmailAvailable,
   $M_PhoneTest,
 } from "@/common/js/utils";
 import { useRouter } from "vue-router";
-import { tAdminGetRelation, updatePayPlatform, updateDIYPassword, updateOrderNotice } from "@/service/user";
-// import { tAdminGetRelation, tAdminSetRelationAdmin, updatePayPlatform } from "@/service/user";
+import { tAdminGetRelation, updatePayPlatform, updateDIYPassword, updateOrderNotice, updateOnOffNotice } from "@/service/user";
 import { showFailToast, showToast, showSuccessToast, showConfirmDialog } from 'vant';
 import { useI18n } from "vue-i18n";
 import { styleUrl } from "../common/js/utils";
@@ -386,6 +390,8 @@ export default {
 
     // 订单通知开关状态
     const orderNotice = ref(false);
+    // 设备上/离线通知开关状态
+    const onOffNotice = ref(false);
 
     const user = getLoginUser();
     const router = useRouter();
@@ -573,6 +579,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);
       });
@@ -673,7 +682,7 @@ export default {
         console.error(error);
       })
     }
-
+    // 切换订单通知开关
     const changeOrderNotice = (value) => {
       showConfirmDialog({
         title: t('user.tips'),
@@ -688,7 +697,7 @@ 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);
@@ -698,6 +707,30 @@ export default {
       })
     }
 
+    // 切换设备通知开关
+    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);
+        }
+      }).catch((error) => {
+        console.error(error);
+      })
+    }
     // 初始化页面获取列表
     onMounted(async () => {
       // 加载样式
@@ -716,13 +749,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({
@@ -898,7 +924,9 @@ export default {
       changeSunzeePay,
       changeSevenCloudPay,
       orderNotice,
-      changeOrderNotice
+      changeOrderNotice,
+      onOffNotice,
+      changeOnOffNotice,
     };
   }
 };