فهرست منبع

fix:修复《商户管理》i18n中js的翻译缺失

Mcal 1 هفته پیش
والد
کامیت
62011bff76
3فایلهای تغییر یافته به همراه149 افزوده شده و 95 حذف شده
  1. 15 1
      src/locales/en.json
  2. 15 1
      src/locales/zh.json
  3. 119 93
      src/views/merchant/index.vue

+ 15 - 1
src/locales/en.json

@@ -165,7 +165,21 @@
     "disabledLabel": "N",
     "disabled": "Disabled",
     "confirm": "Confirm",
-    "cancel": "Cancel"
+    "cancel": "Cancel",
+    "merchantNumberRequired": "The merchant number cannot be empty.",
+    "merchantNumberLengthRange": "The length of the merchant number must be between 5 and 30.",
+    "merchantNameRequired": "The merchant name cannot be empty.",
+    "merchantNameLengthRange": "The length of the merchant name must be between 2 and 50.",
+    "enable": "Enable",
+    "disable": "Disable",
+    "confirmChangeStatus": "Are you sure you want to {action} the merchant “{name}”?",
+    "statusChangeSuccess": "{action} successfully",
+    "addNewMerchant": "Add New Merchant",
+    "modifySuccess": "Modify successfully",
+    "addSuccess": "Add successfully",
+    "editMerchant": "Edit Merchant",
+    "confirmDelete": "Are you sure you want to delete the data item “{name}”?",
+    "deleteSuccess": "Delete successfully"
   },
   "storeList": {
     "list": {

+ 15 - 1
src/locales/zh.json

@@ -159,7 +159,21 @@
     "disabledLabel": "N",
     "disabled": "禁用",
     "confirm": "确定",
-    "cancel": "取消"
+    "cancel": "取消",
+    "merchantNumberRequired": "商户号不能为空",
+    "merchantNumberLengthRange": "商户号长度必须介于5至30之间",
+    "merchantNameRequired": "商户名称不能为空",
+    "merchantNameLengthRange": "商户名称长度必须介于 2 和 50 之间",
+    "enable": "启用",
+    "disable": "禁用",
+    "confirmChangeStatus": "确认要 {action} “{name}” 商户吗?",
+    "statusChangeSuccess": "{action} 成功",
+    "addNewMerchant": "新增商户",
+    "modifySuccess": "修改成功",
+    "addSuccess": "新增成功",
+    "editMerchant": "编辑商户",
+    "confirmDelete": "是否确认删除“{name}”的数据项?",
+    "deleteSuccess": "删除成功"
   },
   "storeList":{
     "list":{

+ 119 - 93
src/views/merchant/index.vue

@@ -349,18 +349,41 @@ export default {
         name: '',
         status: ''
       },
-      // 表单校验
       rules: {
-        type: [{ required: true, message: '商户号不能为空', trigger: 'blur' }],
+        type: [
+            { 
+                required: true, 
+                message: this.$t('merchant.merchantNumberRequired'), 
+                trigger: 'blur' 
+            }
+        ],
         no: [
-          { required: true, message: '商户号不能为空', trigger: 'blur' },
-          { min: 5, max: 30, message: '商户号长度必须介于5至30之间', trigger: 'blur' }
+            { 
+                required: true, 
+                message: this.$t('merchant.merchantNumberRequired'), 
+                trigger: 'blur' 
+            },
+            { 
+                min: 5, 
+                max: 30, 
+                message: this.$t('merchant.merchantNumberLengthRange'), 
+                trigger: 'blur' 
+            }
         ],
         name: [
-          { required: true, message: '商户名称不能为空', trigger: 'blur' },
-          { min: 2, max: 30, message: '商户名称长度必须介于 2 和 50 之间', trigger: 'blur' }
+            { 
+                required: true, 
+                message: this.$t('merchant.merchantNameRequired'), 
+                trigger: 'blur' 
+            },
+            { 
+                min: 2, 
+                max: 30, 
+                message: this.$t('merchant.merchantNameLengthRange'), 
+                trigger: 'blur' 
+            }
         ]
-      }
+    }
     }
   },
   created() {
@@ -369,127 +392,130 @@ export default {
   methods: {
     // 查询日志
     getList() {
-      this.loading = true
-      getMerchantList(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-        this.list = response.data.dataList.content
-        this.total = response.data.dataList.totalElements
-        this.imagePath = response.data.imagePath
-        this.typeOptions = response.data.typeList
-        this.loading = false
-      })
+        this.loading = true;
+        getMerchantList(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
+            this.list = response.data.dataList.content;
+            this.total = response.data.dataList.totalElements;
+            this.imagePath = response.data.imagePath;
+            this.typeOptions = response.data.typeList;
+            this.loading = false;
+        });
     },
     // 搜索按钮操作
     handleQuery() {
-      this.queryParams.page = 1
-      this.getList()
+        this.queryParams.page = 1;
+        this.getList();
     },
     // 重置按钮操作
     resetQuery() {
-      this.resetForm('queryForm')
-      this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
-      this.handleQuery()
+        this.resetForm('queryForm');
+        this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
+        this.handleQuery();
     },
     // 状态修改
     handleStatusChange(row) {
-      let text = row.status == '1' ? '启用' : '禁用'
-      this.$modal
-        .confirm('确认要' + text + '"' + row.name + '"商户吗?')
-        .then(function () {
-          return updateMerchantStatus(row.id, row.status)
-        })
-        .then(() => {
-          this.$modal.msgSuccess(text + '成功')
-        })
-        .catch(function () {
-          row.status = row.status === 'A' ? 'A' : 'D'
-        })
+        let text = row.status === '1' ? this.$t('merchant.enable') : this.$t('merchant.disable');
+        const confirmMsg = this.$t('merchant.confirmChangeStatus', { action: text, name: row.name });
+        this.$modal
+           .confirm(confirmMsg)
+           .then(() => {
+                return updateMerchantStatus(row.id, row.status);
+            })
+           .then(() => {
+                const successMsg = this.$t('merchant.statusChangeSuccess', { action: text });
+                this.$modal.msgSuccess(successMsg);
+            })
+           .catch(() => {
+                row.status = row.status === 'A' ? 'A' : 'D';
+            });
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id)
-      this.multiple = !selection.length
+        this.ids = selection.map((item) => item.id);
+        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('merchant.addNewMerchant');
     },
     // 表单重置
     reset() {
-      this.form = {
-        id: '',
-        no: '',
-        name: '',
-        logo: '',
-        license: '',
-        wxAppId: '',
-        wxAppSecret: '',
-        wxOfficialAppId: '',
-        wxOfficialAppSecret: '',
-        description: '',
-        status: 'A'
-      }
-      this.resetForm('form')
+        this.form = {
+            id: '',
+            no: '',
+            name: '',
+            logo: '',
+            license: '',
+            wxAppId: '',
+            wxAppSecret: '',
+            wxOfficialAppId: '',
+            wxOfficialAppSecret: '',
+            description: '',
+            status: 'A'
+        };
+        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) {
-            saveMerchant(this.form).then((response) => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
-          } else {
-            saveMerchant(this.form).then((response) => {
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.getList()
-            })
-          }
-        }
-      })
+        this.$refs['form'].validate((valid) => {
+            if (valid) {
+                if (this.form.id) {
+                    saveMerchant(this.form).then((response) => {
+                        this.$modal.msgSuccess(this.$t('merchant.modifySuccess'));
+                        this.open = false;
+                        this.getList();
+                    });
+                } else {
+                    saveMerchant(this.form).then((response) => {
+                        this.$modal.msgSuccess(this.$t('merchant.addSuccess'));
+                        this.open = false;
+                        this.getList();
+                    });
+                }
+            }
+        });
     },
     // 修改按钮操作
     handleUpdate(row) {
-      const app = this
-      app.reset()
-      const id = row.id || this.ids
-      getMerchantInfo(id).then((response) => {
-        app.form = response.data.merchantInfo
-        app.open = true
-        app.title = '编辑商户'
-      })
+        const app = this;
+        app.reset();
+        const id = row.id || this.ids;
+        getMerchantInfo(id).then((response) => {
+            app.form = response.data.merchantInfo;
+            app.open = true;
+            app.title = this.$t('merchant.editMerchant');
+        });
     },
     // 删除按钮操作
     handleDelete(row) {
-      const name = row.name || this.id
-      this.$modal
-        .confirm('是否确认删除"' + name + '"的数据项?')
-        .then(function () {
-          return updateMerchantStatus(row.id, 'D')
-        })
-        .then(() => {
-          this.getList()
-          this.$modal.msgSuccess('删除成功')
-        })
-        .catch(() => {})
+        const name = row.name || this.id;
+        const confirmMsg = this.$t('merchant.confirmDelete', { name });
+        this.$modal
+           .confirm(confirmMsg)
+           .then(() => {
+                return updateMerchantStatus(row.id, 'D');
+            })
+           .then(() => {
+                this.getList();
+                this.$modal.msgSuccess(this.$t('merchant.deleteSuccess'));
+            })
+           .catch(() => {});
     },
     handleUploadSuccess(file) {
-      this.form.logo = file.data.fileName
+        this.form.logo = file.data.fileName;
     }
   }
 }