Bläddra i källkod

feat: "自定义货币符号"

Ritchie 1 år sedan
förälder
incheckning
2b88c850b2

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

@@ -1250,7 +1250,9 @@
     "corrEmailPlace": "Please enter the correct email address",
     "corrPhonePlace": "Please enter the correct mobile number",
     "bindWechat": "Bind WeChat",
-    "airwallex": "Airwallex"
+    "airwallex": "Airwallex",
+    "currencySymbol": "Custom Currency",
+    "currencySymbolPlace": "Please enter currency symbol"
   },
   "bindWechat": {
     "cancel": "Cancel",

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

@@ -1264,7 +1264,9 @@
     "corrEmailPlace": "请输入正确的邮箱",
     "corrPhonePlace": "请输入正确的手机号",
     "bindWechat": "绑定微信",
-    "airwallex": "空中云汇"
+    "airwallex": "空中云汇",
+    "currencySymbol": "自定义货币",
+    "currencySymbolPlace": "请输入自定义货币"
   },
   "bindWechat": {
     "cancel": "取消",

+ 14 - 1
src/views/device/modifyPrice/index.vue

@@ -27,7 +27,9 @@
             <van-field type="number" label-width="0" :border="false" v-model="item.rmbPrice" clearable label=" " />
           </div>
           <div v-else class="c-text-15" style="color: #df5e4c">
-            <span>¥</span>
+            <!-- 商品价格调整¥ -->
+            <!-- <span>¥</span> -->
+            <span>{{ currencySymbol }}</span>
             <span>{{ item.rmbPrice }}</span>
           </div>
           <div v-if="!item.isEdit" @click="editClk(item, 1)" class="l-flex-RC o-ml-20">
@@ -142,6 +144,16 @@ export default {
       price: "",
       type: "",
     });
+    // 自定义货币符号
+    const currencySymbol = ref('¥');
+    const loginUserStr = localStorage.getItem('loginUser');
+    const loginUser = JSON.parse(loginUserStr);
+    if (loginUser.currencySymbol) { 
+      currencySymbol.value = loginUser.currencySymbol;
+    } else {
+      currencySymbol.value = '¥';
+    }
+
     // 点击修改
     const editClk = (row, idx) => {
       // 如果点击的是修改
@@ -182,6 +194,7 @@ export default {
       noticeClk,
       confirmClk,
       equipmentName,
+      currencySymbol,
     };
   },
 };

+ 15 - 2
src/views/home/index.vue

@@ -42,7 +42,9 @@
             <div class="outerBox flex-row">
               <div class="main4 flex-col justify-between">
                 <div class="main5 flex-row justify-center">
-                  <span class="word8">&yen;</span>
+                  <!-- 首页 - 订单数据 - 收入总额¥ -->
+                  <!-- <span class="word8">&yen;</span> -->
+                  <span class="word8">{{ currencySymbol }}</span>
                   <span class="word9">{{ salesVolume }}</span>
                 </div>
                 <span class="info5">{{ $t("home.totalIncome") }}</span>
@@ -187,6 +189,16 @@ export default {
     const router = useRouter();
     const userName = ref(user.name);
     const sys = ref(null);
+
+    // 自定义货币符号
+    const currencySymbol = ref("¥");
+    if (user.currencySymbol) {
+      currencySymbol.value = user.currencySymbol;
+    } else {
+      currencySymbol.value = "¥";
+    }
+    console.log("currencySymbol是》》》" + user.currencySymbol);
+
     // 图表对象
     const chartBox = ref();
     let chartObj = null;
@@ -554,7 +566,8 @@ export default {
       showLogo,
       dateSelect,
       Format_time,
-      showDataDiv
+      showDataDiv,
+      currencySymbol,
     };
   },
 

+ 20 - 4
src/views/orderCenter/index.vue

@@ -36,7 +36,9 @@
               <div class="outerBox flex-row">
                 <div class="main4 flex-col justify-between">
                   <div class="main5 flex-row justify-center">
-                    <span class="word8">&yen;</span>
+                    <!-- 订单中心 - 收入总额¥ -->
+                    <!-- <span class="word8">&yen;</span> -->
+                    <span class="word8">{{ currencySymbol }}</span>
                     <span class="word9">{{ salesVolume }}</span>
                   </div>
                   <span class="info5">{{ $t("home.totalIncome") }}</span>
@@ -100,11 +102,16 @@
                     <template #price>
                       <div class="pricBox flex-row align-end" :class="{ orderError: item.status === 0 }">
                         <span class="txt9">{{ item.statusText }}:</span>
-                        <span class="info5">&yen;</span>
+                        <!-- 订单明细 - 线下支付 ¥ -->
+                        <!-- <span class="info5">&yen;</span> -->
+                        <span class="info5">{{ currencySymbol }}</span>
                         <span class="word12" v-if="item.status === 3">{{ item.price.toFixed(2) }}</span>
                         <span class="word12" v-else>{{ item.refundAmount == null ? item.price.toFixed(2) : (item.price -
                           item.refundAmount).toFixed(2) }}</span>
-                        <span class="word14">{{ $t('orderCenter.dividingDomesticService') }}:&yen;{{ showSubcom(item)
+                          <!-- 分佣¥ -->
+                          <!-- <span class="word14">{{ $t('orderCenter.dividingDomesticService') }}:&yen;{{ showSubcom(item)
+                        }}</span> -->
+                        <span class="word14">{{ $t('orderCenter.dividingDomesticService') }}:{{ currencySymbol }}{{ showSubcom(item)
                         }}</span>
                       </div>
                     </template>
@@ -230,7 +237,8 @@
           <van-checkbox class="checkAllBtn o-mt-5" v-model="checkedAll" @click="checkAll">全选</van-checkbox>
           <div class="o-mt-5">
             <span class="">{{ $t('orderCenter.totalRefund') }}:</span>
-            <span class="totalRefund o-pr-15">&yen; {{ totalRefund.toFixed(2) }}</span>
+            <!-- <span class="totalRefund o-pr-15">&yen; {{ totalRefund.toFixed(2) }}</span> -->
+            <span class="totalRefund o-pr-15">{{ currencySymbol }} {{ totalRefund.toFixed(2) }}</span>
           </div>
         </div>
       </template>
@@ -457,6 +465,13 @@ export default {
       }
     };
 
+    // 自定义货币符号
+    const currencySymbol = ref("¥");
+    if (user.currencySymbol) {
+      currencySymbol.value = user.currencySymbol;
+    } else {
+      currencySymbol.value = "¥";
+    }
 
     // 页面列表查询参数
     let searchParams = reactive({
@@ -821,6 +836,7 @@ export default {
       minusRefundGood,
       // isLoading,
       isRefund,
+      currencySymbol,
     };
   },
 };

+ 15 - 1
src/views/orderExport/index.vue

@@ -58,7 +58,9 @@
             :immediate-check="false">
             <div v-for="(item, index) in tableData" :key="index" class="orderItem">
               <div class="mod9 flex-row">
-                <span class="info7">&yen;</span>
+                <!-- 自定义货币符号¥ -->
+                <!-- <span class="info7">&yen;</span> -->
+                <span class="info7">{{ currencySymbol }}</span>
                 <span class="info8">{{ item.priceTotal }}</span>
                 <span class="word9">{{ $t("orderExport.totalSales") }}</span>
               </div>
@@ -420,6 +422,17 @@ export default {
       getList();
       // onRefresh(1);
     };
+
+    // 自定义货币符号
+    const currencySymbol = ref('¥');
+    const loginUserStr = localStorage.getItem('loginUser');
+    const loginUser = JSON.parse(loginUserStr);
+    if (loginUser.currencySymbol) { 
+      currencySymbol.value = loginUser.currencySymbol;
+    } else {
+      currencySymbol.value = '¥';
+    }
+
     return {
       ...toRefs(searchParams),
       companyTypePopConfirm,
@@ -453,6 +466,7 @@ export default {
       tableData,
       error,
       // ...toRefs(ruleData),
+      currencySymbol,
     };
   },
 };

+ 58 - 2
src/views/user.vue

@@ -106,6 +106,29 @@
             <span>{{ relationAdminName }}</span>
             <van-icon name="edit" class="editIcon" @click="editClk(1)" />
           </div>
+
+          <!-- 自定义货币符号 -->
+          <div v-if="!symbolShow" class="userInfo l-flex-between">
+            <span class="userInfoLeft">{{ $t("user.currencySymbol") }}: </span>
+            <div class="cust_vantBorder">
+              <van-field class="relationClass" v-model="cofficentForm.currencySymbol"
+                :placeholder="$t('user.currencySymbolPlace')">
+                <template #button>
+                  <van-button type="primary" @click="mailboxChg(cofficentForm.currencySymbol, 5)">{{
+                    $t("user.confirmLog") }}
+                  </van-button>
+                </template>
+              </van-field>
+            </div>
+            <van-icon name="edit" class="editIcon" @click="editClk(5)" />
+          </div>
+          <div v-else class="userInfo l-flex-between">
+            <span class="userInfoLeft">{{ $t("user.currencySymbol") }}: </span>
+            <span>{{ symbolShow }}</span>
+            <van-icon name="edit" class="editIcon" @click="editClk(5)" />
+          </div>
+
+
         </div>
       </div>
       <div class="lineBox"></div>
@@ -149,7 +172,6 @@
               </div>
             </div>
           </div>
-
           <!--          <div class="taskListRow flex-col" @click="pushPageList('/shandeMch')">
                       <div class="taskIcon shandeMchIcon"></div>
                       <div class="taskRight">
@@ -244,6 +266,8 @@ export default {
     const user = getLoginUser();
     const router = useRouter();
     const relationAdminName = ref("");
+    // 货币符号,默认¥
+    const symbolShow = ref("¥");
     const relationType = ref(true);
     const sys = ref(null);
     // 修改的个人信息
@@ -252,6 +276,7 @@ export default {
       mailBox: accountDetail.value.email,
       phone: accountDetail.value.phone,
       area: "",
+      symbol: accountDetail.value.symbol,
     });
     // 点击修改图标
     const editClk = (idx) => {
@@ -262,6 +287,7 @@ export default {
           mailboxShow.value = true;
           phoneNumberShow.value = true;
           areaShow.value = true;
+          symbolShow.value = "¥";
           break;
         case 2:
           cofficentForm.mailBox = accountDetail.value.email;
@@ -269,6 +295,7 @@ export default {
           mailboxShow.value = !mailboxShow.value;
           phoneNumberShow.value = true;
           areaShow.value = true;
+          symbolShow.value = "¥";
           break;
         case 3:
           cofficentForm.phone = accountDetail.value.phone;
@@ -276,6 +303,7 @@ export default {
           mailboxShow.value = true;
           phoneNumberShow.value = !phoneNumberShow.value;
           areaShow.value = true;
+          symbolShow.value = "¥";
           break;
         case 4:
           cofficentForm.area = accountDetail.value.area;
@@ -283,6 +311,15 @@ export default {
           mailboxShow.value = true;
           phoneNumberShow.value = true;
           areaShow.value = !areaShow.value;
+          symbolShow.value = "¥";
+          break;
+        case 5:
+          cofficentForm.symbol = accountDetail.value.symbol;
+          relationType.value = true;
+          mailboxShow.value = true;
+          phoneNumberShow.value = true;
+          areaShow.value = true;
+          symbolShow.value = !symbolShow.value;
           break;
       }
     };
@@ -346,6 +383,24 @@ export default {
             }
           }
           break;
+        case 5:
+          if (!e) {
+            Toast(t("user.currencySymbolPlace"));
+          } else {
+            const params = {
+              id: user.id,
+              currencySymbol: e,
+            };
+            const { data } = await updateAdmin(params);
+            symbolShow.value = true;
+            if (data.code === "00000") {
+              Toast(data.message);
+              setTimeout(() => {
+                getAcccountDetail();
+              }, 500);
+            }
+          }
+          break;
       }
     };
     // 获取账户详情
@@ -517,7 +572,8 @@ export default {
       getAreaName,
       isAbroad,
       checkIsAbroad,
-      isInland
+      isInland,
+      symbolShow
     };
   }
 };