Quellcode durchsuchen

fix:修改《货币管理》js中i18n的缺失

Mcal vor 1 Woche
Ursprung
Commit
5d2a6a6a5b
3 geänderte Dateien mit 111 neuen und 98 gelöschten Zeilen
  1. 11 1
      src/locales/en.json
  2. 11 1
      src/locales/zh.json
  3. 89 96
      src/views/currency/list.vue

+ 11 - 1
src/locales/en.json

@@ -111,7 +111,17 @@
     "pleaseEnterCurrencyName": "Please enter the currency name",
     "pleaseEnterCurrencySymbol": "Please enter the currency symbol",
     "confirm": "Confirm",
-    "cancel": "Cancel"
+    "cancel": "Cancel",
+    "currencyNameRequired": "The currency name cannot be empty.",
+    "currencySymbolRequired": "The currency symbol cannot be empty.",
+    "enable": "Enable",
+    "disable": "Disable",
+    "confirmChangeStatus": "Are you sure you want to {action} the store “{name}”?",
+    "statusChangeSuccess": "{action} successfully",
+    "addNewCurrency": "Add New Currency",
+    "modifySuccess": "Modify successfully",
+    "addSuccess": "Add successfully",
+    "editCurrency": "Edit Currency"
   },
   "merchant": {
     "merchantNumber": "Merchant Number",

+ 11 - 1
src/locales/zh.json

@@ -105,7 +105,17 @@
     "pleaseEnterCurrencyName": "请输入货币名称",
     "pleaseEnterCurrencySymbol": "请输入货币符号",
     "confirm": "确定",
-    "cancel": "取消"
+    "cancel": "取消",
+    "currencyNameRequired": "货币名称不能为空",
+    "currencySymbolRequired": "货币符号不能为空",
+    "enable": "启用",
+    "disable": "禁用",
+    "confirmChangeStatus": "确认要 {action} “{name}” 店铺吗?",
+    "statusChangeSuccess": "{action} 成功",
+    "addNewCurrency": "新增货币",
+    "modifySuccess": "修改成功",
+    "addSuccess": "新增成功",
+    "editCurrency": "编辑货币"
   },
   "merchant":{
     "merchantNumber": "商户号",

+ 89 - 96
src/views/currency/list.vue

@@ -140,7 +140,7 @@
     getStoreInfo,
     saveStore,
   } from "@/api/store";
-  import {saveCurrency,getCurrencyList} from '@/api/currency'
+  import {saveCurrency,getCurrencyList,updateCurrency} from '@/api/currency'
   export default {
     name: "StoreList",
     components: {
@@ -198,11 +198,18 @@
         // 表单校验
         rules: {
           name: [
-            { required: true, message: "货币名称不能为空", trigger: "blur" },
-
+              { 
+                  required: true, 
+                  message: this.$t('currency.currencyNameRequired'), 
+                  trigger: "blur" 
+              }
           ],
-          symbol:[
-            { required: true, message: "货币符号不能为空", trigger: "blur" },
+          symbol: [
+              { 
+                  required: true, 
+                  message: this.$t('currency.currencySymbolRequired'), 
+                  trigger: "blur" 
+              }
           ]
         },
       };
@@ -213,139 +220,125 @@
     methods: {
       // 查询列表
       getList() {
-        this.loading = true;
-        getCurrencyList(this.queryParams).then(
-          (response) => {
-            console.log('res;',response)
-            this.list = response.data
-            this.total = response.total
-            this.loading = false;
-          }
-        );
+          this.loading = true;
+          getCurrencyList(this.queryParams).then(
+              (response) => {
+                  console.log('res;', response);
+                  this.list = response.data;
+                  this.total = response.total;
+                  this.loading = false;
+              }
+          );
       },
       // 搜索按钮操作
       handleQuery() {
-        this.queryParams.page = 1;
-        this.getList();
+          this.queryParams.page = 1;
+          this.getList();
       },
       // 重置按钮操作
       resetQuery() {
-        this.dateRange = [];
-        this.resetForm("queryForm");
-        this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
-        this.handleQuery();
+          this.dateRange = [];
+          this.resetForm("queryForm");
+          this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
+          this.handleQuery();
       },
       // 状态修改
       handleStatusChange(row) {
-        let text = row.status == "A" ? "启用" : "禁用";
-        this.$modal
-          .confirm("确认要" + text + '"' + row.name + '"店铺吗?')
-          .then(function () {
-            return updateStoreStatus(row.id, row.status);
-          })
-          .then(() => {
-            this.$modal.msgSuccess(text + "成功");
-          })
-          .catch(function () {
-            row.status = row.status === "N" ? "A" : "N";
-          });
+          let text = row.status === "A" ? this.$t('currency.enable') : this.$t('currency.disable');
+          const confirmMsg = this.$t('currency.confirmChangeStatus', { action: text, name: row.name });
+          this.$modal
+            .confirm(confirmMsg)
+            .then(() => {
+                  return updateStoreStatus(row.id, row.status);
+              })
+            .then(() => {
+                  const successMsg = this.$t('currency.statusChangeSuccess', { action: text });
+                  this.$modal.msgSuccess(successMsg);
+              })
+            .catch(() => {
+                  row.status = row.status === "N" ? "A" : "N";
+              });
       },
       // 多选框选中数据
       handleSelectionChange(selection) {
-        this.ids = selection.map((item) => item.operId);
-        this.multiple = !selection.length;
+          this.ids = selection.map((item) => item.operId);
+          this.multiple = !selection.length;
       },
       // 排序触发事件
       handleSortChange(column, prop, order) {
-        this.queryParams.orderByColumn = column.prop;
-        this.queryParams.isAsc = column.order;
-        this.getList();
+          this.queryParams.orderByColumn = column.prop;
+          this.queryParams.isAsc = column.order;
+          this.getList();
       },
       // 新增按钮操作
       handleAdd() {
-        this.reset();
-        this.open = true;
-        this.title = "新增货币";
+          this.reset();
+          this.open = true;
+          this.title = this.$t('currency.addNewCurrency');
       },
       // 表单重置
       reset() {
-        this.form = {
-          id: "",
-          name: "",
-          symbol:'',
-        };
-        this.resetForm("form");
+          this.form = {
+              id: "",
+              name: "",
+              symbol: ''
+          };
+          this.resetForm("form");
       },
       // 取消按钮
       cancel() {
-        this.open = false;
-        this.reset();
+          this.open = false;
+          this.reset();
       },
       // 提交按钮
       submitForm: function () {
-        this.$refs["form"].validate((valid) => {
-          if (valid) {
-            if(this.form.id){
-              updateCurrency(this.form).then((response) => {
-                this.$modal.msgSuccess('修改成功')
-                this.open = false
-                this.getList()
-              })
-            }else{
-                saveCurrency(this.form).then(response => {
-                    this.$modal.msgSuccess("新增成功");
-                    this.open = false;
-                    this.getList();
-                });
-            }
-            // if (this.form.id) {
-            //   saveStore(this.form).then((response) => {
-            //     this.$modal.msgSuccess("修改成功");
-            //     this.open = false;
-            //     this.getList();
-            //   });
-            // } else {
-            //   saveStore(this.form).then((response) => {
-            //     this.$modal.msgSuccess("新增成功");
-            //     this.open = false;
-            //     this.getList();
-            //   });
-            // }
-          }
-        });
+          this.$refs["form"].validate((valid) => {
+              if (valid) {
+                  if (this.form.id) {
+                      updateCurrency(this.form).then((response) => {
+                          this.$modal.msgSuccess(this.$t('currency.modifySuccess'));
+                          this.open = false;
+                          this.getList();
+                      });
+                  } else {
+                      saveCurrency(this.form).then(response => {
+                          this.$modal.msgSuccess(this.$t('currency.addSuccess'));
+                          this.open = false;
+                          this.getList();
+                      });
+                  }
+              }
+          });
       },
       // 二维码
       handleQrCode(row) {
-        this.qr = { type: "store", id: row.id };
-        this.openQrCode = true;
+          this.qr = { type: "store", id: row.id };
+          this.openQrCode = true;
       },
       // 关闭二维码
       closeDialog() {
-        this.openQrCode = false;
+          this.openQrCode = false;
       },
       // 修改按钮操作
       handleUpdate(row) {
-        this.reset();
-
-        this.title = "编辑货币";
-        this.open = true;
-        const {id,name,symbol} = row
-        this.form={id,name,symbol}
-
+          this.reset();
+          this.title = this.$t('currency.editCurrency');
+          this.open = true;
+          const { id, name, symbol } = row;
+          this.form = { id, name, symbol };
       },
-
       handleUploadSuccess(file) {
-        this.form.logo = file.data.fileName;
+          this.form.logo = file.data.fileName;
       },
       handleUploadLicenseSuccess(file) {
-        this.form.license = file.data.fileName;
+          this.form.license = file.data.fileName;
       },
       handleUploadCertSuccess(file) {
-        this.form.wxCertPath = file.data.fileName;
-        this.wxCertPath = file.data.fileName;
-      },
-    },
-  };
+          this.form.wxCertPath = file.data.fileName;
+          this.wxCertPath = file.data.fileName;
+      }
+    }
+  };  
   </script>
   <style scoped>
   .common-dialog >>> .el-upload--picture-card {