Prechádzať zdrojové kódy

feat:“添加订单通知功能”

soobin 1 rok pred
rodič
commit
6942cdeaeb

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

@@ -1415,7 +1415,13 @@
     "currentChoose": "Current selection",
     "tips": "Remind",
     "changeTips": "Whether to switch payment platforms?",
-    "changeSuccess": "Switchover successful"
+    "changeSuccess": "Switchover successful",
+    "orderNotice": "Order notice",
+    "openOrderNotice": "Do you want to enable order notification?",
+    "closeOrderNotice": "Do you want to turn off order notifications?",
+    "pleaseBindWechat": "Please bind to wechat first",
+    "openSuccess": "Open successfully",
+    "closeSuccess": "Closed successfully"
   },
   "bindWechat": {
     "cancel": "Cancel",

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

@@ -1431,7 +1431,13 @@
         "currentChoose": "現在の選択",
         "tips": "リマインダー",
         "changeTips": "支払いプラットフォームを切り替えますか?",
-        "changeSuccess": "切り替えに成功しました"
+        "changeSuccess": "切り替えに成功しました",
+        "orderNotice": "オーダー通知",
+        "openOrderNotice": "註文通知を開きますか?",
+        "closeOrderNotice": "註文通知を閉じますか?",
+        "pleaseBindWechat": "wechatとの連携をお願いします",
+        "openSuccess": "オン成功です",
+        "closeSuccess": "閉鎖成功です"
     },
     "bindWechat": {
         "cancel": "キャンセル",

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

@@ -1437,7 +1437,13 @@
     "currentChoose": "当前选择",
     "tips": "提醒",
     "changeTips": "是否切换支付平台?",
-    "changeSuccess": "修改成功"
+    "changeSuccess": "修改成功",
+    "orderNotice": "订单通知",
+    "openOrderNotice": "是否开启订单通知?",
+    "closeOrderNotice": "是否关闭订单通知?",
+    "pleaseBindWechat": "请先绑定微信",
+    "openSuccess": "开启成功",
+    "closeSuccess": "关闭成功"
   },
   "bindWechat": {
     "cancel": "取消",

+ 7 - 1
src/service/user.js

@@ -39,4 +39,10 @@ export function addNotice(params) {
 // 修改DIY功能使用密码
 export function updateDIYPassword(params) {
   return axios.get(`/SZWL-SERVER/tEquipment/updateDIYPassword?${stringToUrl(params)}`, params);
-} 
+} 
+
+// 切换订单通知开关
+export function updateOrderNotice(params) {
+  return axios.get(`/SZWL-SERVER/tAdmin/updateOrderNotice?${stringToUrl(params)}`, params);
+} 
+

+ 2 - 1
src/styles/user/index.less

@@ -101,7 +101,8 @@
             }
 
             .userInfoLeft {
-                width: 80px;
+                // width: 80px;
+                padding-right: 10px;
             }
 
             .van-cell {

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

@@ -464,7 +464,6 @@ export default {
     };
     // 消除报警
     const clearAlarm = async (e, e1) => {
-      console.log(e1);
       const params = {
         id: e.id,
         name: e.name,
@@ -485,11 +484,9 @@ export default {
           e.alarmContent = "";
           e1.hasTodayAlarm = false;
         }, 1000);
-        console.log("e", e);
       } else {
         showFailToast(data.message);
       }
-      console.log("/tEquipment/eliminate", e);
     };
     const showDateTime = (date) => {
       if (!date) {

+ 1 - 0
src/views/orderCenter/index.vue

@@ -623,6 +623,7 @@ export default {
 
       // 获取订单列表
       const { data } = await getOrderList(Object.assign({}, params));
+      total.value = 0;
       if (data.code === "00000") {
         if (data.data.total === 0) {
           finished.value = true;

+ 45 - 4
src/views/user.vue

@@ -173,7 +173,7 @@
           <!-- 切换支付平台 -->
           <div v-if="chaSzPayShow" class="userInfo l-flex-between">
             <span class="userInfoLeft">{{ $t("user.szPayType") }}: </span>
-            <div class="cust_vantBorder o-pl-5">
+            <div class="cust_vantBorder">
               <van-switch :model-value="sunzeePay" active-color="#0090fa" inactive-color="#30c25c"
                 style="font-size: 0.5rem;" @update:model-value="changeSunzeePay" />
             </div>
@@ -182,12 +182,20 @@
 
           <div v-if="chaScPayShow" class="userInfo l-flex-between">
             <span class="userInfoLeft">{{ $t("user.scPayType") }}: </span>
-            <div class="cust_vantBorder o-pl-5">
+            <div class="cust_vantBorder">
               <van-switch :model-value="sevencloudPay" active-color="#0090fa" inactive-color="#30c25c"
                 style="font-size: 0.5rem;" @update:model-value="changeSevenCloudPay" />
             </div>
             <span class="o-pl-10">{{ $t("user.currentChoose") }}: {{ sevencloudPay ? "汇付" : "汇聚" }}</span>
           </div>
+          
+          <div v-if="isInWeChat" 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" />
+            </div>
+          </div>
         </div>
       </div>
       <div class="lineBox"></div>
@@ -344,7 +352,7 @@ import {
   $M_PhoneTest,
 } from "@/common/js/utils";
 import { useRouter } from "vue-router";
-import { tAdminGetRelation, updatePayPlatform, updateDIYPassword } from "@/service/user";
+import { tAdminGetRelation, updatePayPlatform, updateDIYPassword, updateOrderNotice } from "@/service/user";
 // import { tAdminGetRelation, tAdminSetRelationAdmin, updatePayPlatform } from "@/service/user";
 import { showFailToast, showToast, showSuccessToast, showConfirmDialog } from 'vant';
 import { useI18n } from "vue-i18n";
@@ -376,6 +384,9 @@ export default {
     const sunzeePay = ref(false);
     const sevencloudPay = ref(false);
 
+    // 订单通知开关状态
+    const orderNotice = ref(false);
+
     const user = getLoginUser();
     const router = useRouter();
     const relationAdminName = ref("");
@@ -393,7 +404,7 @@ export default {
     // 
     const params = reactive({
       id: '', // 用户ID	
-      payPlatform: '', //支付平台	
+      payPlatform: '', //支付平台
     });
     // 点击修改图标
     const editClk = (idx) => {
@@ -558,6 +569,10 @@ export default {
     const getAcccountDetail = () => {
       getAdmin({ id: user.id }).then((res) => {
         accountDetail.value = res.data.data;
+        console.log("accountDetail", accountDetail.value)
+        if (accountDetail.value.orderNotice == "1") {
+          orderNotice.value = true;
+        }
         // 查询地址回显
         kCascaderRef.value.init(accountDetail.value.areaId);
       });
@@ -659,6 +674,30 @@ export default {
       })
     }
 
+    const changeOrderNotice = (value) => {
+      showConfirmDialog({
+        title: t('user.tips'),
+        message: orderNotice.value ? t('user.closeOrderNotice') : t('user.openOrderNotice'),
+      }).then(async () => {
+        const params = reactive({
+          adminId: user.id,
+          orderNotice: value ? '1' : '0',
+        });
+        const { data } = await updateOrderNotice(params);
+        console.log("data", data)
+        if (data.code == "00000") {
+          showSuccessToast(value ? t('user.openSuccess') : t('user.closeSuccess'));
+          orderNotice.value = value;
+        } else if(data.code == "A0001") {
+          showToast(t('user.pleaseBindWechat'));
+        } else {
+          showFailToast(data.message);
+        }
+      }).catch((error) => {
+        console.error(error);
+      })
+    }
+
     // 初始化页面获取列表
     onMounted(async () => {
       // 加载样式
@@ -858,6 +897,8 @@ export default {
       sevencloudPay,
       changeSunzeePay,
       changeSevenCloudPay,
+      orderNotice,
+      changeOrderNotice
     };
   }
 };