Pārlūkot izejas kodu

:sparkles: 设置时区

Ritchie 1 gadu atpakaļ
vecāks
revīzija
066f5854b3

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

@@ -1418,6 +1418,8 @@
     "syncOldData": "Sync Data",
     "modifyLoc": "Modify Loc",
     "airwallex": "Airwallex",
+    "setTheTimezone": "Set timezone",
+    "setTheTimezonePlace": "Please select a timezone",
     "currencySymbol": "Currency",
     "currencySymbolPlace": "Please enter currency symbol",
     "szPayType": "Sunzee payment",
@@ -1476,6 +1478,9 @@
   "kCascader": {
     "selectRegion": "Please select your region"
   },
+  "kTimezone": {
+    "selectTimezone": "Please select your timezone"
+  },
   "paramNames": {
     "D405": "Stove low speed",
     "D406": "Stove medium speed",

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

@@ -1434,6 +1434,8 @@
         "syncOldData": "データ同期",
         "modifyLoc": "位置を修正する",
         "airwallex": "エアウォレックス",
+        "setTheTimezone": "タイムゾーンを設定する",
+        "setTheTimezonePlace": "タイムゾーンを選択してください",
         "currencySymbol": "カスタム通貨",
         "currencySymbolPlace": "カスタム通貨を入力してください",
         "szPayType": "申泽支払いプラットフォーム",
@@ -1492,6 +1494,9 @@
     "kCascader": {
         "selectRegion": "居住地域を選択してください"
     },
+    "kTimezone": {
+        "selectTimezone": "タイムゾーンを選択してください"
+    },
     "paramNames": {
         "D405": "炉頭の低速",
         "D406": "炉頭の中速",

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

@@ -1463,6 +1463,8 @@
     "syncOldData": "数据同步",
     "modifyLoc": "修改定位",
     "airwallex": "空中云汇",
+    "setTheTimezone": "设置时区",
+    "setTheTimezonePlace": "请选择时区",
     "currencySymbol": "自定义货币",
     "currencySymbolPlace": "请输入自定义货币",
     "diyPassword": "DIY使用密码",
@@ -1523,6 +1525,9 @@
   "kCascader": {
     "selectRegion": "请选择所在地区"
   },
+  "kTimezone": {
+    "selectTimezone": "请选择所在时区"
+  },
   "paramNames": {
     "D405": "炉头低速",
     "D406": "炉头中速",

+ 0 - 25
src/components/commom/kCascader/index.vue

@@ -116,31 +116,6 @@ export default {
     const selectArea = () => {
       Api_getAreaDetail({ value: selectId.value }).then(async (res) => {
         const resData = res.data;
-        // if (resData.code === "00000") {
-        //   if (resData.data.length > 0) {
-        //     let areaName = '';
-        //     // 当第二级获取完后才获取第三级,不然不会默认选中
-        //     await getAddress(
-        //       resData.data[0]["value"],
-        //       0,
-        //       resData.data[0]["children"][0]["value"]
-        //     );
-        //     // 如果存在第三级
-        //     if (resData.data[0]["children"][0]["children"]) {
-        //         areaName = `${resData.data[0]['text']}/${resData.data[0]["children"][0]['text']}/${resData.data[0]["children"][0]["children"][0]['text']}`;
-        //       // 默认选中最后一级的值
-        //       cascaderValue.value =
-        //         resData.data[0]["children"][0]["children"][0]["value"];
-        //     } else {
-        //         areaName = `${resData.data[0]['text']}/${resData.data[0]["children"][0]['text']}`;
-        //       // 如果存在第二级
-        //       // 默认选中最后一级的值
-        //       cascaderValue.value = resData.data[0]["children"][0]["value"];
-        //     }
-        //     // 回显到input
-        //     emit('getareaname',areaName);
-        //   }
-        // }
         if (resData && resData.code === "00000" && resData.data && resData.data.length > 0 && resData.data[0]["children"] && resData.data[0]["children"][0]) {
           const firstLevelValue = resData.data[0]["value"];
           const secondLevelValue = resData.data[0]["children"][0]["value"];

+ 82 - 0
src/components/commom/kTimezone/index.vue

@@ -0,0 +1,82 @@
+<template>
+    <!-- 时区弹窗 -->
+    <van-popup v-model:show="timezonePopshow" round position="bottom">
+        <van-cascader @close="timezonePopshow = false" v-model="cascaderValue" :title="$t('kTimezone.selectTimezone')"
+            :options="options" @finish="onFinish"/>
+    </van-popup>
+</template>
+
+<script>
+import { ref, watch } from "vue";
+export default {
+    setup(props, { emit }) {
+
+        const timezonePopshow = ref(false);
+        const tzFieldValue = ref('');
+        const cascaderValue = ref('');
+        const selectedTimezone = ref(props.selectId || ""); // 存储选中的时区值
+        const selectId = ref(props.selectId || "");
+        // const selectId = ref("");
+        const init = (id) => {
+            selectId.value = id;
+            // 如果有选中的时区
+            if (selectId.value) {
+                selectTimezone();
+            }
+        };
+
+        const options = ref([
+            { text: '上海', value: 'Asia/Shanghai' },
+            { text: '東京', value: 'Asia/Tokyo' },
+            { text: 'NewYork', value: 'America/New_York' },
+            { text: 'Paris', value: 'Europe/Paris' },
+            { text: 'London', value: 'Europe/London' },
+            { text: 'Madrid', value: 'Europe/Madrid' },
+            { text: 'São Paulo', value: 'America/Sao_Paulo' },
+        ]);
+
+
+        // 选择完成时
+        const onFinish = ({ selectedOptions }) => {
+            timezonePopshow.value = false;
+            const selectName = selectedOptions.map((option) => option.text).join("/");
+            const selectValue = selectedOptions[selectedOptions.length - 1].value;
+            selectedTimezone.value = selectValue; // 更新本地变量
+            emit("timezonepopfinish", { selectName, selectId: selectValue });
+        };
+        // 打开弹窗
+        const openPopup = () => {
+            timezonePopshow.value = true;
+        };
+        // 获取选中的时区
+        const selectTimezone = () => {
+            const selectedTimezoneValue = selectId.value;
+            if (selectedTimezoneValue) {
+                const option = options.value.find(item => item.value === selectedTimezoneValue);
+                if (option) {
+                    selectedTimezone.value = option.value; // 初始化本地变量
+                    emit('gettimezone', option.text); // 发送 text 值
+                }
+            }
+        };
+        watch(selectedTimezone, (newValue) => {
+            if (newValue) {
+                emit('gettimezone', options.value.find(o => o.value === newValue).text);
+            }
+        });
+
+        return {
+            timezonePopshow,
+            options,
+            onFinish,
+            cascaderValue,
+            tzFieldValue,
+            init,
+            openPopup,
+            selectTimezone
+        };
+    },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 103 - 73
src/views/user.vue

@@ -24,7 +24,6 @@
           </div>
         </div>
         <div class="userInfoBox">
-
           <!-- 地区 -->
           <div v-if="isInland && user.type != '0'">
             <div v-if="!areaShow" class="userInfo l-flex-between">
@@ -104,29 +103,6 @@
             </div>
           </div>
 
-          <!-- 关联上级 -->
-          <!-- <div v-if="isInland && user.type == '2'">
-            <div v-if="!relationType" class="userInfo l-flex-between">
-              <span class="userInfoLeft">{{ $t("user.associateParent") }}: </span>
-              <div >
-                <van-field class="relationClass" v-model="cofficentForm.associateParent"
-                  :placeholder="$t('user.associateParentPlace')">
-                  <template #button>
-                    <van-button type="primary" @click="mailboxChg(cofficentForm.associateParent, 1)">{{
-                      $t("user.confirmLog") }}
-                    </van-button>
-                  </template>
-                </van-field>
-              </div>
-              <van-icon name="edit" class="editIcon" @click="editClk(1)" />
-            </div>
-            <div v-else class="userInfo l-flex-between">
-              <span class="userInfoLeft">{{ $t("user.associateParent") }}: </span>
-              <span>{{ relationAdminName }}</span>
-              <van-icon name="edit" class="editIcon" @click="editClk(1)" />
-            </div>
-          </div> -->
-
           <!-- 自定义货币符号 -->
           <div v-if="!symbolShow" class="userInfo l-flex-between">
             <span class="userInfoLeft">{{ $t("user.currencySymbol") }}: </span>
@@ -148,6 +124,34 @@
             <span>{{ accountDetail.currencySymbol }}</span>
             <van-icon name="edit" class="editIcon" @click="editClk(5)" />
           </div>
+          <!-- 时区 -->
+          <div v-if="user.type > 1">
+            <div v-if="!timezoneShow" class="userInfo l-flex-between">
+              <span class="userInfoLeft">{{ $t("user.setTheTimezone") }}: </span>
+              <div class="cust_vantBorder">
+                <div class="filedInpPad">
+                  <van-field @click-input="tzFieldValueInpClk" readonly clearable v-model="tzFieldValue"
+                    :placeholder="$t('user.setTheTimezonePlace')">
+                    <template #right-icon>
+                      <div class="l-flex-RC">
+                        <van-icon v-if="tzFieldValue" @click="tzFieldValue = ''; accountDetail.timeZone = '';"
+                          class="o-mr-6" name="clear" />
+                        <van-icon @click="tzFieldValueInpClk" name="arrow-down" />
+                      </div>
+                    </template>
+                  </van-field>
+                </div>
+              </div>
+              <van-icon name="edit" class="editIcon" @click="editClk(7)" />
+            </div>
+            <div v-else class="userInfo l-flex-between">
+              <span class="userInfoLeft">{{ $t("user.setTheTimezone") }}: </span>
+              <span>{{ tzFieldValue }}</span>
+              <van-icon name="edit" class="editIcon" @click="editClk(7)" />
+            </div>
+          </div>
+
+          <!-- DIY使用密码 -->
           <div v-if="user.type == '0'">
             <div v-if="!diyPasswordShow" class="userInfo l-flex-between">
               <span class="userInfoLeft">{{ $t("user.diyPassword") }}: </span>
@@ -238,23 +242,6 @@
             </div>
           </div>
 
-          <!-- 提现帐号 -->
-          <!-- <div v-if="isInland" class="taskListRow flex-col" @click="pushPageList('/joinpayMch')">
-            <div class="taskIcon joinPayMchIcon"></div>
-            <div class="taskRight">
-              <div class="taskTitle">{{ $t("user.withdrawalAccountNo") }}</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="user.type == '0'" class="taskListRow flex-col" @click="pushPageList('/announcement')">
             <div class="taskIcon announcementIcon"></div>
@@ -264,14 +251,7 @@
               </div>
             </div>
           </div>
-          <!--          <div class="taskListRow flex-col" @click="pushPageList('/shandeMch')">
-                      <div class="taskIcon shandeMchIcon"></div>
-                      <div class="taskRight">
-                        <div class="taskTitle">
-                          {{ $t("user.standbyWithdrawalAccountNo") }}
-                        </div>
-                      </div>
-                    </div>-->
+
           <!-- 绑定微信 -->
           <div v-if="isInWeChat" class="taskListRow flex-col" @click="pushPageList('/bindWechat')">
             <!--          <div class="taskListRow flex-col" @click="pushPageList('/bindWechat')">-->
@@ -321,13 +301,6 @@
             </div>
           </div>
 
-          <!-- 自动充值 -->
-          <!-- <div v-if="isInland" class="taskListRow flex-col" @click="operUnipay()">
-            <div class="taskIcon selfPayIcon"></div>
-            <div class="taskRight">
-              <div class="taskTitle">{{ $t("user.selfRecharging") }}</div>
-            </div>
-          </div> -->
 
           <div class="taskListRow flex-col" @click="onperExitSys()">
             <div class="taskIcon loginOutIcon"></div>
@@ -346,12 +319,18 @@
     <!-- 地区弹窗 -->
     <kCascader @getareaname="getAreaName" :selectId="accountDetail.areaId" @areapopfinish="areaPopFinish"
       ref="kCascaderRef"></kCascader>
+    <!-- 时区弹窗 -->
+    <kTimezone @gettimezone="getTimezone" :selectId="accountDetail.timezone" @timezonepopfinish="timezonePopFinish"
+      ref="kTimezoneRef"></kTimezone>
+
   </div>
 </template>
 
 <script>
 // 导入地区弹窗
 import kCascader from "@/components/commom/kCascader/index.vue";
+// 导入时区弹窗
+import kTimezone from "@/components/commom/kTimezone/index.vue";
 // 导入接口
 import { getAdmin } from "@/service/merchantManage";
 import { updateAdmin } from "@/service/merchantManage";
@@ -371,7 +350,7 @@ import { useI18n } from "vue-i18n";
 import { styleUrl } from "../common/js/utils";
 
 export default {
-  components: { sHeader, kDialog, kCascader },
+  components: { sHeader, kDialog, kCascader, kTimezone },
   setup() {
     // 引入语言
     const { t } = useI18n();
@@ -387,6 +366,8 @@ export default {
     const symbolShow = ref(true);
     // 控制DIY使用密码显示隐藏
     const diyPasswordShow = ref(true);
+    // 控制时区显示隐藏
+    const timezoneShow = ref(true);
     // 控制切换支付平台按钮显示隐藏
     const chaSzPayShow = ref(false);
     const chaScPayShow = ref(false);
@@ -414,6 +395,7 @@ export default {
       phone: accountDetail.value.phone,
       area: "",
       currencySymbol: accountDetail.value.currencySymbol,
+      timeZone: accountDetail.value.timeZone,
     });
     // 
     const params = reactive({
@@ -431,6 +413,7 @@ export default {
           areaShow.value = true;
           symbolShow.value = true;
           diyPasswordShow.value = true;
+          timezoneShow.value = true;
           break;
         case 2:
           cofficentForm.mailBox = accountDetail.value.email;
@@ -440,6 +423,7 @@ export default {
           areaShow.value = true;
           symbolShow.value = true;
           diyPasswordShow.value = true;
+          timezoneShow.value = true;
           break;
         case 3:
           cofficentForm.phone = accountDetail.value.phone;
@@ -449,6 +433,7 @@ export default {
           areaShow.value = true;
           symbolShow.value = true;
           diyPasswordShow.value = true;
+          timezoneShow.value = true;
           break;
         case 4:
           cofficentForm.area = accountDetail.value.area;
@@ -458,6 +443,7 @@ export default {
           areaShow.value = !areaShow.value;
           symbolShow.value = true;
           diyPasswordShow.value = true;
+          timezoneShow.value = true;
           break;
         case 5:
           cofficentForm.currencySymbol = accountDetail.value.currencySymbol;
@@ -467,6 +453,7 @@ export default {
           areaShow.value = true;
           symbolShow.value = !symbolShow.value;
           diyPasswordShow.value = true;
+          timezoneShow.value = true;
           break;
         case 6:
           cofficentForm.currencySymbol = accountDetail.value.currencySymbol;
@@ -476,9 +463,22 @@ export default {
           areaShow.value = true;
           symbolShow.value = true;
           diyPasswordShow.value = !diyPasswordShow.value;
+          timezoneShow.value = true;
+          break;
+        case 7:
+          cofficentForm.timeZone = accountDetail.value.timeZone;
+          relationType.value = true;
+          mailboxShow.value = true;
+          phoneNumberShow.value = true;
+          areaShow.value = true;
+          symbolShow.value = true;
+          diyPasswordShow.value = true;
+          timezoneShow.value = !timezoneShow.value;
           break;
       }
     };
+
+
     // 点击邮箱的确定按钮
     const mailboxChg = async (e, idx) => {
       switch (idx) {
@@ -592,6 +592,8 @@ export default {
         }
         // 查询地址回显
         kCascaderRef.value.init(accountDetail.value.areaId);
+        // 查询时区回显
+        kTimezoneRef.value.init(accountDetail.value.timeZone)
       });
     };
     // 获取申泽支付平台
@@ -821,7 +823,6 @@ export default {
     };
     // 选择地区完成
     const areaPopFinish = async (e) => {
-      console.log("e", e);
       fieldValue.value = e.selectName;
       accountDetail.value.areaId = e.selectId;
       const params = {
@@ -837,6 +838,37 @@ export default {
         }, 500);
       }
     };
+    // 时区弹窗
+    const tzFieldValue = ref("");
+    const kTimezoneRef = ref(null);
+    // 点击时区输入框
+    const tzFieldValueInpClk = () => {
+      kTimezoneRef.value.openPopup();
+    };
+    // 选择时区完成
+    const timezonePopFinish = async (e) => {
+      tzFieldValue.value = e.selectName;
+      accountDetail.value.timeZone = e.selectId;
+      const params = {
+        id: user.id,
+        timeZone: e.selectId,
+      };
+      const { data } = await updateAdmin(params);
+      timezoneShow.value = true;
+      if (data.code === "00000") {
+        showToast(data.message);
+        setTimeout(() => {
+          getAcccountDetail();
+        }, 500);
+      }
+    };
+
+    const timezoneShowPicker = ref(false);
+    const timezoneOnConfirm = ({ selectedOptions }) => {
+      timezoneShowPicker.value = false;
+      tzFieldValue.value = selectedOptions[0].text;
+    };
+
     const isInWeChat = ref(false);
     const checkInWechat = () => {
       const ua = window.navigator.userAgent.toLowerCase();
@@ -855,20 +887,6 @@ 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");
@@ -889,10 +907,14 @@ export default {
       checkIsAbroad();
       haveRelationCheck();
     })
-    // 获取回显的值
+    // 获取地区回显的值
     const getAreaName = (e) => {
       fieldValue.value = e;
     };
+    // 获取时区回显的值
+    const getTimezone = (e) => {
+      tzFieldValue.value = e;
+    };
     return {
       user,
       operUnipay,
@@ -911,13 +933,20 @@ export default {
       cofficentForm,
       params,
       areaShow,
+      timezoneShow,
       accountDetail,
       fieldValue,
+      tzFieldValue,
       kCascaderRef,
+      kTimezoneRef,
       fieldValueInpClk,
+      tzFieldValueInpClk,
       areaPopFinish,
+      timezonePopFinish,
+      timezoneShowPicker,
       isInWeChat,
       getAreaName,
+      getTimezone,
       isAbroad,
       haveRelation,
       checkIsAbroad,
@@ -935,6 +964,7 @@ export default {
       changeOrderNotice,
       onOffNotice,
       changeOnOffNotice,
+      timezoneOnConfirm,
     };
   }
 };