Browse Source

fix:修改《订单列表》js中i18n的缺失

Mcal 1 tuần trước cách đây
mục cha
commit
737834c29f
4 tập tin đã thay đổi với 328 bổ sung252 xóa
  1. 2 2
      .env.development
  2. 22 0
      src/locales/en.json
  3. 23 0
      src/locales/zh.json
  4. 281 250
      src/views/order/index.vue

+ 2 - 2
.env.development

@@ -12,8 +12,8 @@ VUE_APP_PUBLIC_PATH = '/'
 
 # 后端接口地址
 # 黄  雯后台
-VUE_APP_SERVER_URL = 'http://192.168.1.44:8080'
+# VUE_APP_SERVER_URL = 'http://192.168.1.44:8080'
 
 # 彭正高后台
-# VUE_APP_SERVER_URL = 'http://192.168.1.110:8080'
+VUE_APP_SERVER_URL = 'http://192.168.1.110:8080'
 

+ 22 - 0
src/locales/en.json

@@ -71,6 +71,28 @@
     "pleaseEnterRefundRemark": "Please enter the refund remark",
     "confirm": "Confirm",
     "cancel": "Cancel",
+    "totalAmountRequired": "The total amount cannot be empty.",
+    "verifyCodeRequired": "The verification code cannot be empty.",
+    "expressCompanyRequired": "The express company cannot be empty.",
+    "expressNoRequired": "The express number cannot be empty.",
+    "refundAmountRequired": "The refund amount cannot be empty.",
+    "correctRefundAmount": "Please enter a correct refund amount.",
+    "enable": "Enable",
+    "disable": "Disable",
+    "confirmChangeOrderStatus": "Are you sure you want to {action} the order with order number “{orderSn}”?",
+    "statusChangeSuccess": "{action} successfully",
+    "verifySuccess": "Verification successful!",
+    "modifySuccess": "Modification successful!",
+    "modifyError": "An error occurred during modification.",
+    "modifyOrder": "Modify Order",
+    "requestProcessing": "Request is being processed...",
+    "submitExpressSuccess": "Logistics information submitted successfully!",
+    "refundAmountExceed": "The refund amount cannot exceed the total order amount!",
+    "submitRefundSuccess": "Refund submitted successfully!",
+    "confirmDeleteOrder": "Are you sure you want to delete the data item with order number “{orderSn}”?",
+    "deleteSuccess": "Delete successfully",
+    "printSendSuccess": "Printing sent successfully!",
+    "printSendFail": "Printing sent failed!",
     "detail": {
       "basicInfo": "Basic Information",
       "orderNumber": "Order Number",

+ 23 - 0
src/locales/zh.json

@@ -65,6 +65,29 @@
     "pleaseEnterRefundRemark": "请输入退款备注",
     "confirm": "确定",
     "cancel": "取消",
+    "totalAmountRequired": "总金额不能为空",
+    "verifyCodeRequired": "核销码不能为空",
+    "expressCompanyRequired": "物流公司不能为空",
+    "expressNoRequired": "物流单号不能为空",
+    "refundAmountRequired": "退款金额不能为空",
+    "correctRefundAmount": "请输入正确的退款金额",
+    "enable": "启用",
+    "disable": "禁用",
+    "confirmChangeOrderStatus": "确认要 {action} 订单号为 “{orderSn}” 的订单吗?",
+    "statusChangeSuccess": "{action} 成功",
+    "verifySuccess": "核销成功!",
+    "modifySuccess": "修改成功!",
+    "modifyError": "修改出错啦",
+    "modifyOrder": "修改订单",
+    "requestProcessing": "请求处理中...",
+    "submitExpressSuccess": "提交物流信息成功!",
+    "refundAmountExceed": "退款金额不能大于订单总金额!",
+    "submitRefundSuccess": "提交退款成功!",
+    "confirmDeleteOrder": "是否确认删除订单号为 “{orderSn}” 的数据项?",
+    "deleteSuccess": "删除成功",
+    "printSendSuccess": "打印发送成功!",
+    "printSendFail": "打印发送失败!",
+    
     "detail":{
       "basicInfo": "基础信息",
       "orderNumber": "订单号",

+ 281 - 250
src/views/order/index.vue

@@ -596,25 +596,53 @@ export default {
       },
       // 表单校验
       rules: {
-        amount: [{ required: true, message: '总金额不能为空', trigger: 'blur' }]
+          amount: [
+              { 
+                  required: true, 
+                  message: this.$t('orderList.totalAmountRequired'), 
+                  trigger: 'blur' 
+              }
+          ]
       },
       // 核销表单校验
       vFormRules: {
-        verifyCode: [{ required: true, message: '核销码不能为空', trigger: 'blur' }]
+          verifyCode: [
+              { 
+                  required: true, 
+                  message: this.$t('orderList.verifyCodeRequired'), 
+                  trigger: 'blur' 
+              }
+          ]
       },
       eFormRules: {
-        expressCompany: [{ required: true, message: '物流公司不能为空', trigger: 'blur' }],
-        expressNo: [{ required: true, message: '物流单号不能为空', trigger: 'blur' }]
+          expressCompany: [
+              { 
+                  required: true, 
+                  message: this.$t('orderList.expressCompanyRequired'), 
+                  trigger: 'blur' 
+              }
+          ],
+          expressNo: [
+              { 
+                  required: true, 
+                  message: this.$t('orderList.expressNoRequired'), 
+                  trigger: 'blur' 
+              }
+          ]
       },
       rFormRules: {
-        refundAmount: [
-          { required: true, message: '退款金额不能为空', trigger: 'blur' },
-          {
-            pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/,
-            message: `请输入正确的退款金额`,
-            trigger: 'blur'
-          }
-        ]
+          refundAmount: [
+              { 
+                  required: true, 
+                  message: this.$t('orderList.refundAmountRequired'), 
+                  trigger: 'blur' 
+              },
+              {
+                  pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/,
+                  message: this.$t('orderList.correctRefundAmount'),
+                  trigger: 'blur'
+              }
+          ]
       }
     }
   },
@@ -624,321 +652,324 @@ export default {
   methods: {
     // 查询订单
     getList() {
-      const app = this
-      app.loading = true
-      app.queryParams.storeIds = app.storeIds ? app.storeIds.join(',') : ''
-      getOrderList(app.queryParams).then((response) => {
-        this.list = response.data.paginationResponse.content
-        this.total = response.data.paginationResponse.totalElements
-        this.typeList = response.data.typeList
-        this.statusList = response.data.statusList
-        this.payStatusList = response.data.payStatusList
-        this.orderModeList = response.data.orderModeList
-        this.payTypeList = response.data.payTypeList
-        this.storeList = response.data.storeList
-        this.expressCompanyList = response.data.expressCompanyList
-        this.loading = false
-      })
+        const app = this;
+        app.loading = true;
+        app.queryParams.storeIds = app.storeIds ? app.storeIds.join(',') : '';
+        getOrderList(app.queryParams).then((response) => {
+            this.list = response.data.paginationResponse.content;
+            this.total = response.data.paginationResponse.totalElements;
+            this.typeList = response.data.typeList;
+            this.statusList = response.data.statusList;
+            this.payStatusList = response.data.payStatusList;
+            this.orderModeList = response.data.orderModeList;
+            this.payTypeList = response.data.payTypeList;
+            this.storeList = response.data.storeList;
+            this.expressCompanyList = response.data.expressCompanyList;
+            this.loading = false;
+        });
     },
     // 搜索按钮操作
     handleQuery(isExport) {
-      this.queryParams.page = 1
-      if (isExport) {
-        this.exportExcel()
-      } else {
-        this.getList()
-      }
+        this.queryParams.page = 1;
+        if (isExport) {
+            this.exportExcel();
+        } else {
+            this.getList();
+        }
     },
     // 导出excel
     exportExcel() {
-      this.download('backendApi/order/export', {
-        ...this.queryParams
-      })
+        this.download('backendApi/order/export', {
+           ...this.queryParams
+        });
     },
     // 重置按钮操作
     resetQuery() {
-      this.queryParams.status = ''
-      this.queryParams.mobile = ''
-      this.queryParams.orderMode = ''
-      this.queryParams.orderSn = ''
-      this.queryParams.storeIds = ''
-      this.storeIds = []
-      this.resetForm('queryForm')
-      this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
-      this.handleQuery()
+        this.queryParams.status = '';
+        this.queryParams.mobile = '';
+        this.queryParams.orderMode = '';
+        this.queryParams.orderSn = '';
+        this.queryParams.storeIds = '';
+        this.storeIds = [];
+        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.orderSn + '"吗?')
-        .then(function () {
-          return updateOrderStatus(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('orderList.enable') : this.$t('orderList.disable');
+        const confirmMsg = this.$t('orderList.confirmChangeOrderStatus', { action: text, orderSn: row.orderSn });
+        this.$modal
+           .confirm(confirmMsg)
+           .then(() => {
+                return updateOrderStatus(row.id, row.status);
+            })
+           .then(() => {
+                const successMsg = this.$t('orderList.statusChangeSuccess', { action: text });
+                this.$modal.msgSuccess(successMsg);
+            })
+           .catch(() => {
+                row.status = row.status === 'N' ? 'A' : 'N';
+            });
     },
     // 多选框选中数据
     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();
     },
     // 表单重置
     reset() {
-      this.form = {
-        orderId: '',
-        orderSn: '',
-        status: 'A',
-        amount: '',
-        discount: '',
-        remark: '',
-        orderMode: 'oneself'
-      }
-      this.resetForm('form')
+        this.form = {
+            orderId: '',
+            orderSn: '',
+            status: 'A',
+            amount: '',
+            discount: '',
+            remark: '',
+            orderMode: 'oneself'
+        };
+        this.resetForm('form');
     },
     // 取消按钮
     cancel() {
-      this.open = false
-      this.reset()
+        this.open = false;
+        this.reset();
     },
     // 取消核销按钮
     cancelVForm() {
-      this.openVerify = false
-      this.vForm.orderId = ''
-      this.vForm.orderSn = ''
-      this.vForm.verifyCode = ''
+        this.openVerify = false;
+        this.vForm.orderId = '';
+        this.vForm.orderSn = '';
+        this.vForm.verifyCode = '';
     },
     // 提交核销按钮
     submitVForm: function () {
-      this.$refs['vForm'].validate((valid) => {
-        if (valid) {
-          verifyOrder(this.vForm).then((response) => {
-            this.$modal.msgSuccess('核销成功!')
-            this.cancelVForm()
-            this.getList()
-          })
-        }
-      })
+        this.$refs['vForm'].validate((valid) => {
+            if (valid) {
+                verifyOrder(this.vForm).then((response) => {
+                    this.$modal.msgSuccess(this.$t('orderList.verifySuccess'));
+                    this.cancelVForm();
+                    this.getList();
+                });
+            }
+        });
     },
     // 提交修改按钮
     submitForm: function () {
-      this.$refs['form'].validate((valid) => {
-        if (valid) {
-          saveOrder(this.form)
-            .then((response) => {
-              this.$modal.msgSuccess('修改成功!')
-              this.open = false
-              this.getList()
-            })
-            .catch(function () {
-              this.$modal.msgError('修改出错啦')
-            })
-        }
-      })
+        this.$refs['form'].validate((valid) => {
+            if (valid) {
+                saveOrder(this.form)
+                   .then((response) => {
+                        this.$modal.msgSuccess(this.$t('orderList.modifySuccess'));
+                        this.open = false;
+                        this.getList();
+                    })
+                   .catch(() => {
+                        this.$modal.msgError(this.$t('orderList.modifyError'));
+                    });
+            }
+        });
     },
     // 查看详情按钮操作
     handleView(row) {
-      this.$router.push({ path: '/order/detail?orderId=' + row.id })
+        this.$router.push({ path: '/order/detail?orderId=' + row.id });
     },
     // 修改按钮操作
     handleUpdate(row) {
-      const app = this
-      app.reset()
-      const id = row.id || this.ids
-      getOrderInfo(id).then((response) => {
-        let orderInfo = response.data.orderInfo
-        if (orderInfo) {
-          app.form.orderId = orderInfo.id
-          app.form.orderSn = orderInfo.orderSn
-          app.form.amount = orderInfo.amount
-          app.form.discount = orderInfo.discount
-          app.form.remark = orderInfo.remark
-          app.form.status = orderInfo.status
-          app.form.orderMode = orderInfo.orderMode + ''
-        }
-        this.open = true
-        this.title = '修改订单'
-      })
+        const app = this;
+        app.reset();
+        const id = row.id || this.ids;
+        getOrderInfo(id).then((response) => {
+            let orderInfo = response.data.orderInfo;
+            if (orderInfo) {
+                app.form.orderId = orderInfo.id;
+                app.form.orderSn = orderInfo.orderSn;
+                app.form.amount = orderInfo.amount;
+                app.form.discount = orderInfo.discount;
+                app.form.remark = orderInfo.remark;
+                app.form.status = orderInfo.status;
+                app.form.orderMode = orderInfo.orderMode + '';
+            }
+            this.open = true;
+            this.title = this.$t('orderList.modifyOrder');
+        });
     },
     // 核销按钮操作
     handleVerify(row) {
-      const app = this
-      const id = row.id || this.ids
-      getOrderInfo(id).then((response) => {
-        let orderInfo = response.data.orderInfo
-        if (orderInfo) {
-          app.vForm.orderId = orderInfo.id
-          app.vForm.orderSn = orderInfo.orderSn
-          app.vForm.remark = orderInfo.remark
-        }
-        app.openVerify = true
-      })
+        const app = this;
+        const id = row.id || this.ids;
+        getOrderInfo(id).then((response) => {
+            let orderInfo = response.data.orderInfo;
+            if (orderInfo) {
+                app.vForm.orderId = orderInfo.id;
+                app.vForm.orderSn = orderInfo.orderSn;
+                app.vForm.remark = orderInfo.remark;
+            }
+            app.openVerify = true;
+        });
     },
     // 发货按钮
     handleExpress(row) {
-      const app = this
-      const id = row.id || this.ids
-      getOrderInfo(id).then((response) => {
-        let orderInfo = response.data.orderInfo
-        if (orderInfo) {
-          app.eForm.orderId = orderInfo.id
-          app.eForm.orderSn = orderInfo.orderSn
-          app.eForm.expressNo = orderInfo.expressInfo ? orderInfo.expressInfo.expressNo : ''
-          app.eForm.expressCompany = orderInfo.expressInfo
-            ? orderInfo.expressInfo.expressCompany
-            : ''
-        }
-        app.openExpress = true
-      })
+        const app = this;
+        const id = row.id || this.ids;
+        getOrderInfo(id).then((response) => {
+            let orderInfo = response.data.orderInfo;
+            if (orderInfo) {
+                app.eForm.orderId = orderInfo.id;
+                app.eForm.orderSn = orderInfo.orderSn;
+                app.eForm.expressNo = orderInfo.expressInfo ? orderInfo.expressInfo.expressNo : '';
+                app.eForm.expressCompany = orderInfo.expressInfo
+                   ? orderInfo.expressInfo.expressCompany
+                    : '';
+            }
+            app.openExpress = true;
+        });
     },
     // 取消发货按钮
     cancelEForm() {
-      this.openExpress = false
-      this.eForm.orderId = ''
-      this.eForm.orderSn = ''
-      this.eForm.expressCompany = ''
-      this.eForm.expressNo = ''
+        this.openExpress = false;
+        this.eForm.orderId = '';
+        this.eForm.orderSn = '';
+        this.eForm.expressCompany = '';
+        this.eForm.expressNo = '';
     },
     // 提交发货按钮
     submitEForm: function () {
-      const app = this
-      if (app.loading) {
-        app.$modal.msgError('请求处理中...')
-      }
-      app.$refs['eForm'].validate((valid) => {
-        if (valid) {
-          app.loading = true
-          const param = {
-            orderId: app.eForm.orderId,
-            orderSn: app.eForm.orderSn,
-            expressCompany: app.eForm.expressCompany,
-            expressNo: app.eForm.expressNo
-          }
-          delivered(param).then((response) => {
-            app.$modal.msgSuccess('提交物流信息成功!')
-            app.cancelEForm()
-            app.getList()
-            app.loading = false
-          })
+        const app = this;
+        if (app.loading) {
+            app.$modal.msgError(this.$t('orderList.requestProcessing'));
         }
-      })
+        app.$refs['eForm'].validate((valid) => {
+            if (valid) {
+                app.loading = true;
+                const param = {
+                    orderId: app.eForm.orderId,
+                    orderSn: app.eForm.orderSn,
+                    expressCompany: app.eForm.expressCompany,
+                    expressNo: app.eForm.expressNo
+                };
+                delivered(param).then((response) => {
+                    app.$modal.msgSuccess(this.$t('orderList.submitExpressSuccess'));
+                    app.cancelEForm();
+                    app.getList();
+                    app.loading = false;
+                });
+            }
+        });
     },
     // 取消退款按钮
     cancelRForm() {
-      this.openRefundDialog = false
-      this.rForm.orderId = ''
-      this.rForm.orderSn = ''
-      this.rForm.payAmount = ''
-      this.rForm.payType = ''
-      this.rForm.refundAmount = ''
-      this.rForm.remark = ''
+        this.openRefundDialog = false;
+        this.rForm.orderId = '';
+        this.rForm.orderSn = '';
+        this.rForm.payAmount = '';
+        this.rForm.payType = '';
+        this.rForm.refundAmount = '';
+        this.rForm.remark = '';
     },
     // 提交退款按钮
     submitRForm: function () {
-      const app = this
-      if (app.loading) {
-        app.$modal.msgError('请求处理中...')
-      }
-      if (parseFloat(app.rForm.refundAmount) > parseFloat(app.rForm.amount)) {
-        app.$modal.msgError('退款金额不能大于订单总金额!')
-        return false
-      }
-      app.$refs['rForm'].validate((valid) => {
-        if (valid) {
-          app.loading = true
-          doRefund(app.rForm).then((response) => {
-            app.$modal.msgSuccess('提交退款成功!')
-            app.cancelRForm()
-            app.getList()
-            app.loading = false
-          })
+        const app = this;
+        if (app.loading) {
+            app.$modal.msgError(this.$t('orderList.requestProcessing'));
+        }
+        if (parseFloat(app.rForm.refundAmount) > parseFloat(app.rForm.amount)) {
+            app.$modal.msgError(this.$t('orderList.refundAmountExceed'));
+            return false;
         }
-      })
+        app.$refs['rForm'].validate((valid) => {
+            if (valid) {
+                app.loading = true;
+                doRefund(app.rForm).then((response) => {
+                    app.$modal.msgSuccess(this.$t('orderList.submitRefundSuccess'));
+                    app.cancelRForm();
+                    app.getList();
+                    app.loading = false;
+                });
+            }
+        });
     },
     // 删除按钮操作
     handleDelete(row) {
-      const name = row.orderSn
-      this.$modal
-        .confirm('是否确认删除订单号为"' + name + '"的数据项?')
-        .then(function () {
-          return deleteOrder(row.id)
-        })
-        .then(() => {
-          this.getList()
-          this.$modal.msgSuccess('删除成功')
-        })
-        .catch(() => {})
+        const name = row.orderSn;
+        const confirmMsg = this.$t('orderList.confirmDeleteOrder', { orderSn: name });
+        this.$modal
+           .confirm(confirmMsg)
+           .then(() => {
+                return deleteOrder(row.id);
+            })
+           .then(() => {
+                this.getList();
+                this.$modal.msgSuccess(this.$t('orderList.deleteSuccess'));
+            })
+           .catch(() => {});
     },
     // 打印小票(本地打印)
     handlePrint(row) {
-      const app = this
-      app.orderInfo = {}
-      app.storeInfo = {}
-      const id = row.id || this.ids
-      getOrderInfo(id).then((response) => {
-        let orderInfo = response.data.orderInfo
-        if (orderInfo) {
-          app.orderInfo = orderInfo
-          app.storeInfo = orderInfo.storeInfo
-        }
-        app.openOrderPrintDialog = true
-      })
+        const app = this;
+        app.orderInfo = {};
+        app.storeInfo = {};
+        const id = row.id || this.ids;
+        getOrderInfo(id).then((response) => {
+            let orderInfo = response.data.orderInfo;
+            if (orderInfo) {
+                app.orderInfo = orderInfo;
+                app.storeInfo = orderInfo.storeInfo;
+            }
+            app.openOrderPrintDialog = true;
+        });
     },
     // 打印小票(云打印)
     handlePrintCloud(row) {
-      const app = this
-      const orderId = row.id || this.ids
-      doPrint(orderId).then((response) => {
-        let result = response.data
-        if (result) {
-          app.$modal.msgSuccess('打印发送成功!')
-        } else {
-          app.$modal.msgError('打印发送失败!')
-        }
-      })
+        const app = this;
+        const orderId = row.id || this.ids;
+        doPrint(orderId).then((response) => {
+            let result = response.data;
+            if (result) {
+                app.$modal.msgSuccess(this.$t('orderList.printSendSuccess'));
+            } else {
+                app.$modal.msgError(this.$t('orderList.printSendFail'));
+            }
+        });
     },
     // 退款
     handleRefund(row) {
-      const app = this
-      app.rForm.orderId = row.id
-      app.rForm.orderSn = row.orderSn
-      app.rForm.payAmount = row.payAmount
-      app.rForm.payType = getName(app.payTypeList, row.payType)
-      app.openRefundDialog = true
+        const app = this;
+        app.rForm.orderId = row.id;
+        app.rForm.orderSn = row.orderSn;
+        app.rForm.payAmount = row.payAmount;
+        app.rForm.payType = getName(app.payTypeList, row.payType);
+        app.openRefundDialog = true;
     },
     // 关掉打印对话框
     closePrintDialog() {
-      this.openOrderPrintDialog = false
+        this.openOrderPrintDialog = false;
     },
     // 更多操作触发
     handleCommand(command, row) {
-      switch (command) {
-        case 'handleDelete':
-          this.handleDelete(row)
-          break
-        case 'handlePrint':
-          this.handlePrint(row)
-          break
-        case 'handlePrintCloud':
-          this.handlePrintCloud(row)
-          break
-        case 'handleRefund':
-          this.handleRefund(row)
-          break
-        default:
-          this.handleView(row)
-          break
-      }
+        switch (command) {
+            case 'handleDelete':
+                this.handleDelete(row);
+                break;
+            case 'handlePrint':
+                this.handlePrint(row);
+                break;
+            case 'handlePrintCloud':
+                this.handlePrintCloud(row);
+                break;
+            case 'handleRefund':
+                this.handleRefund(row);
+                break;
+            default:
+                this.handleView(row);
+                break;
+        }
     }
   }
 }