Browse Source

fix:1.处理账号修改的头像上传问题。
feat:1.员工管理的多语言添加,还有账号管理的多语言添加

suwenjiang 1 week ago
parent
commit
a9b02a9f74

+ 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'
 

+ 81 - 80
src/components/ImageUpload/index.vue

@@ -21,38 +21,32 @@
         <i class="el-icon-plus"></i>
       </slot>
       <div slot="tip" class="el-upload__tip">
-        <slot name="tip"> </slot>
+        <slot name="tip"></slot>
       </div>
     </el-upload>
 
     <!-- 上传提示 -->
     <div class="el-upload__tip" slot="tip" v-if="showTip">
-      请上传
+      {{ $t('ImageUpload.pleaseUpload') }}
       <template v-if="fileSize">
-        大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
+        {{ $t('ImageUpload.fileSizeNotExceed') }}
+        <b style="color: #f56c6c">{{ fileSize }}MB</b>
       </template>
       <template v-if="fileType">
-        格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
+        {{ $t('ImageUpload.fileFormat') }}
+        <b style="color: #f56c6c">{{ fileType.join('/') }}</b>
       </template>
-      的文件
+      {{ $t('ImageUpload.ofFile') }}
     </div>
 
-    <el-dialog
-      :visible.sync="dialogVisible"
-      title="预览"
-      width="800"
-      append-to-body
-    >
-      <img
-        :src="dialogImageUrl"
-        style="display: block; max-width: 100%; margin: 0 auto"
-      />
+    <el-dialog :visible.sync="dialogVisible" title="预览" width="800" append-to-body>
+      <img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto" />
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { getToken } from "@/utils/auth";
+import { getToken } from '@/utils/auth'
 
 export default {
   props: {
@@ -60,149 +54,156 @@ export default {
     // 图片数量限制
     limit: {
       type: Number,
-      default: 5,
+      default: 5
     },
     // 大小限制(MB)
     fileSize: {
       type: Number,
-      default: 5,
+      default: 5
     },
     // 文件类型, 例如['png', 'jpg', 'jpeg']
     fileType: {
       type: Array,
-      default: () => ["png", "jpg", "jpeg"],
+      default: () => ['png', 'jpg', 'jpeg']
     },
     // 是否显示提示
     isShowTip: {
       type: Boolean,
-      default: true,
-    },
+      default: true
+    }
   },
   data() {
     return {
       number: 0,
       uploadList: [],
-      dialogImageUrl: "",
+      dialogImageUrl: '',
       dialogVisible: false,
       hideUpload: false,
       baseUrl: process.env.VUE_APP_BASE_API,
-      uploadImgUrl: process.env.VUE_APP_SERVER_URL + "/backendApi/file/upload", // 上传的图片服务器地址
+      uploadImgUrl: process.env.VUE_APP_SERVER_URL + '/backendApi/file/upload', // 上传的图片服务器地址
       headers: {
-        "Access-Token": getToken(),
+        'Access-Token': getToken()
       },
-      fileList: [],
-    };
+      fileList: []
+    }
   },
   watch: {
     value: {
       handler(val) {
         if (val) {
           // 首先将值转为数组
-          const list = Array.isArray(val) ? val : this.value.split(",");
+          const list = Array.isArray(val) ? val : this.value.split(',')
           // 然后将数组转为对象数组
           this.fileList = list.map((item) => {
-            if (typeof item === "string") {
+            if (typeof item === 'string') {
               if (item.indexOf(this.baseUrl) === -1) {
-                item = { name: this.baseUrl + item, url: this.baseUrl + item };
+                item = { name: this.baseUrl + item, url: this.baseUrl + item }
               } else {
-                item = { name: item, url: item };
+                item = { name: item, url: item }
               }
             }
-            return item;
-          });
+            return item
+          })
         } else {
-          this.fileList = [];
-          return [];
+          this.fileList = []
+          return []
         }
       },
       deep: true,
-      immediate: true,
-    },
+      immediate: true
+    }
   },
   computed: {
     // 是否显示提示
     showTip() {
-      return this.isShowTip && (this.fileType || this.fileSize);
-    },
+      return this.isShowTip && (this.fileType || this.fileSize)
+    }
   },
   methods: {
     // 删除图片
-    handleRemove(file, fileList) {
-      const findex = this.fileList.map((f) => f.name).indexOf(file.name);
+    handleRemove(file) {
+      const findex = this.fileList.map((f) => f.name).indexOf(file.name)
       if (findex > -1) {
-        this.fileList.splice(findex, 1);
-        this.$emit("input", this.listToString(this.fileList));
+        this.fileList.splice(findex, 1)
+        this.$emit('input', this.listToString(this.fileList))
       }
     },
     // 上传成功回调
     handleUploadSuccess(res) {
-      this.uploadList.push({ name: res.fileName, url: res.url });
-      if (this.uploadList.length === this.number) {
-        this.fileList = this.fileList.concat(this.uploadList);
-        this.uploadList = [];
-        this.number = 0;
-        this.$emit("input", this.listToString(this.fileList));
-        this.$modal.closeLoading();
+      if (res && res?.data) {
+        // this.uploadList.push({ name: res.data.fileName, url: res.data.url })
+        this.uploadList.push(res.data.url)
+
+        if (this.uploadList.length === this.number) {
+          this.fileList = this.fileList.concat(this.uploadList)
+          this.uploadList = []
+          this.number = 0
+          this.$emit('input', this.listToString(this.fileList))
+          this.$modal.closeLoading()
+        }
       }
     },
     // 上传前loading加载
     handleBeforeUpload(file) {
-      let isImg = false;
+      let isImg = false
       if (this.fileType.length) {
-        let fileExtension = "";
-        if (file.name.lastIndexOf(".") > -1) {
-          fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
+        let fileExtension = ''
+        if (file.name.lastIndexOf('.') > -1) {
+          fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
         }
         isImg = this.fileType.some((type) => {
-          if (file.type.indexOf(type) > -1) return true;
-          if (fileExtension && fileExtension.indexOf(type) > -1) return true;
-          return false;
-        });
+          if (file.type.indexOf(type) > -1) return true
+          if (fileExtension && fileExtension.indexOf(type) > -1) return true
+          return false
+        })
       } else {
-        isImg = file.type.indexOf("image") > -1;
+        isImg = file.type.indexOf('image') > -1
       }
 
       if (!isImg) {
         this.$modal.msgError(
-          `文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`
-        );
-        return false;
+          `${this.$t('ImageUpload.fileFormatError')}${this.fileType.join('/')}${this.$t(
+            'ImageUpload.imageFormatFile'
+          )}`
+        )
+        return false
       }
       if (this.fileSize) {
-        const isLt = file.size / 1024 / 1024 < this.fileSize;
-        if (!isLt) {
-          this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
-          return false;
-        }
+        const isLt = file.size / 1024 / 1024 < this.fileSize
+        this.$modal.msgError(
+          `${this.$t('ImageUpload.fileSizeExceed')}${this.fileSize} ${this.$t('ImageUpload.mb')}`
+        )
+        return false
       }
-      this.$modal.loading("正在上传图片,请稍候...");
-      this.number++;
+
+      this.$modal.loading(`${this.$t('ImageUpload.uploadingImage')}`)
+      this.number++
     },
     // 文件个数超出
     handleExceed() {
-      this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
+      this.$modal.msgError(this.$t('ImageUpload.fileNumberExceed', { limit: this.limit }))
     },
     // 上传失败
     handleUploadError() {
-      this.$modal.msgError("上传图片失败,请重试");
-      this.$modal.closeLoading();
+      this.$modal.msgError(this.$t('ImageUpload.uploadImageFailed'))
+      this.$modal.closeLoading()
     },
     // 预览
     handlePictureCardPreview(file) {
-      this.dialogImageUrl = file.url;
-      this.dialogVisible = true;
+      this.dialogImageUrl = file.url
+      this.dialogVisible = true
     },
     // 对象转成指定字符串分隔
     listToString(list, separator) {
-      let strs = "";
-      separator = separator || ",";
+      let strs = ''
+      separator = separator || ','
       for (let i in list) {
-        strs += list[i].url?.replace(this.baseUrl, "") + separator;
+        strs += list[i].url?.replace(this.baseUrl, '') + separator
       }
-      return strs != "" ? strs.substr(0, strs.length - 1) : "";
-    },
-  },
-};
+      return strs != '' ? strs.substr(0, strs.length - 1) : ''
+    }
+  }
+}
 </script>
 <style scoped lang="scss">
 // .el-upload--picture-card 控制加号部分

+ 69 - 0
src/locales/en.json

@@ -166,5 +166,74 @@
     "disabled": "Disabled",
     "confirm": "Confirm",
     "cancel": "Cancel"
+  },
+  "employee":{
+   "employeeCategory": "Employee Category",
+  "selectEmployeeCategory": "Please select employee category",
+  "name": "Name",
+  "inputName": "Please enter name",
+  "mobilePhone": "Mobile Phone",
+  "inputMobilePhone": "Please enter mobile phone",
+  "status": "Status",
+  "enabled": "Enabled",
+  "disabled": "Disabled",
+  "search": "Search",
+  "reset": "Reset",
+  "addEmployee": "Add Employee",
+  "id": "ID",
+  "category": "Category",
+  "associatedMemberId": "Associated Member ID",
+  "belongingStore": "Belonging Store",
+  "none": "None",
+  "createTime": "Create Time",
+  "updateTime": "Update Time",
+  "operation": "Operation",
+  "modify": "Modify",
+  "delete": "Delete",
+  "selectBelongingStore": "Please select belonging store",
+  "allStores": "All Stores",
+  "remark": "Remark",
+  "inputContent": "Please enter content",
+  "confirm": "Confirm",
+  "cancel": "Cancel",
+  "nameRequired": "Name cannot be empty",
+  "nameLengthLimit": "The length of the name must be between 2 and 30",
+  "mobileRequired": "Mobile phone number cannot be empty",
+  "mobileLengthLimit": "The length of the mobile phone number must be 11",
+  "storeIdRequired": "Please select the belonging store",
+
+  "confirmStatusChange": "Are you sure you want to {status} \"{name}\"?",
+  "statusChangeSuccess": "{status} successfully",
+  "addSuccess": "Added successfully",
+  "modifySuccess": "Modified successfully",
+  "editEmployeeInfo": "Edit employee information",
+  "confirmDelete": "Are you sure you want to delete the data item of \"{name}\"?",
+  "deleteSuccess": "Deleted successfully",
+  "ImageUpload":{
+    "pleaseUpload": "Please upload",
+    "fileSizeNotExceed": "with a size not exceeding",
+    "fileFormat": "in the format of",
+    "ofFile": "files",
+    "fileFormatError": "The file format is incorrect. Please upload",
+     "imageFormatFile": "image format file!",
+    "fileSizeExceed": "The size of the uploaded avatar image cannot exceed",
+    "mb":"MB!",
+    "uploadingImage": "Uploading the image, please wait...",
+    "fileNumberExceed": "The number of uploaded files cannot exceed {limit}!",
+    "uploadImageFailed": "Failed to upload the image. Please try again."
+  },
+ "account":{
+  "basicInfo": "Basic Information",
+  "edit": "Edit",
+  "account": "Account",
+  "password": "Password",
+  "avatar": "Avatar",
+  "userInfo": "User Information",
+  "save": "Save",
+  "close": "Close",
+  "pleaseInputPassword": "Please enter your password",
+  "passwordFormat": "The password must consist of at least 6 letters or numbers",
+  "passwordChangeSuccess": "Password changed successfully"
+  }
   }
 }

+ 1 - 0
src/locales/ru.json

@@ -7,4 +7,5 @@
     "welcome": "Welcome",
     "greeting": "Hello, {name}!"
     
+    
   }

+ 73 - 0
src/locales/zh.json

@@ -160,5 +160,78 @@
     "disabled": "禁用",
     "confirm": "确定",
     "cancel": "取消"
+  },
+  "employee":{
+  "employeeCategory": "员工类别",
+  "selectEmployeeCategory": "请选择员工类别",
+  "name": "姓名",
+  "inputName": "请输入姓名",
+  "mobilePhone": "手机号",
+  "inputMobilePhone": "请输入手机号",
+  "status": "状态",
+  "enabled": "启用",
+  "disabled": "禁用",
+  "search": "搜索",
+  "reset": "重置",
+  "addEmployee": "新增员工",
+  "id": "ID",
+  "category": "类别",
+  "associatedMemberId": "关联会员ID",
+  "belongingStore": "所属店铺",
+  "none": "无",
+  "createTime": "创建时间",
+  "updateTime": "更新时间",
+  "operation": "操作",
+  "modify": "修改",
+  "delete": "删除",
+  "selectBelongingStore": "请选择所属店铺",
+  "allStores": "全部店铺",
+  "remark": "备注信息",
+  "inputContent": "请输入内容",
+  "confirm": "确定",
+  "cancel": "取消",
+  "nameRequired": "姓名不能为空",
+  "nameLengthLimit": "姓名长度必须介于 2 和 30 之间",
+  "mobileRequired": "手机号不能为空",
+  "mobileLengthLimit": "手机号长度必须为 11",
+  "storeIdRequired": "请选择所属店铺",
+ 
+  "confirmStatusChange": "确认要{status}\"{name}\"吗?",
+  "statusChangeSuccess": "{status}成功",
+  
+  "addSuccess": "新增成功",
+  "modifySuccess": "修改成功",
+  "editEmployeeInfo": "编辑员工信息",
+  "confirmDelete": "是否确认删除\"{name}\"的数据项?",
+  "deleteSuccess": "删除成功"
+  },
+  "ImageUpload":{
+    "pleaseUpload": "请上传",
+    "fileSizeNotExceed": "大小不超过",
+    "fileFormat": "格式为",
+    "ofFile": "的文件",
+    "fileFormatError": "文件格式不正确, 请上传",
+    "imageFormatFile": "图片格式文件!",
+    "fileSizeExceed": "上传头像图片大小不能超过",
+    "mb":"MB!",
+    "uploadingImage": "正在上传图片,请稍候...",
+    "fileNumberExceed": "上传文件数量不能超过",
+    "ge":"个!",
+    "uploadImageFailed": "上传图片失败,请重试"
+
+  },
+  
+  "account":{
+    "basicInfo": "基本信息",
+  "edit": "编辑",
+  "account": "账号",
+  "password": "密码",
+  "avatar": "头像",
+  "userInfo": "用户信息",
+  "save": "保存",
+  "close": "关闭",
+  "pleaseInputPassword": "请输入密码",
+  "passwordFormat": "密码至少由6个字母或数字",
+  "passwordChangeSuccess": "密码修改成功"
   }
 }

+ 215 - 238
src/views/currency/list.vue

@@ -1,5 +1,5 @@
 <template>
-     <div class="app-container">
+  <div class="app-container">
     <el-form
       :model="queryParams"
       class="main-search"
@@ -19,12 +19,7 @@
         />
       </el-form-item>
       <el-form-item>
-        <el-button
-          type="primary"
-          icon="el-icon-search"
-          size="mini"
-          @click="handleQuery"
-        >
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
           {{ $t('currency.search') }}
         </el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
@@ -72,12 +67,7 @@
         class-name="small-padding fixed-width"
       >
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-          >
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">
             {{ $t('currency.modify') }}
           </el-button>
         </template>
@@ -129,237 +119,224 @@
     </el-dialog>
     <FuintQrCode :showDialog="openQrCode" :qr="qr" @closeDialog="closeDialog" />
   </div>
-  </template>
+</template>
 
-  <script>
-  import FuintQrCode from "@/components/Fuint/QrCode";
-  import { getToken } from "@/utils/auth";
-  import {
-    getStoreList,
-    updateStoreStatus,
-    getStoreInfo,
-    saveStore,
-  } from "@/api/store";
-  import {saveCurrency,getCurrencyList} from '@/api/currency'
-  export default {
-    name: "StoreList",
-    components: {
-      FuintQrCode,
+<script>
+import FuintQrCode from '@/components/Fuint/QrCode'
+import { getToken } from '@/utils/auth'
+import { updateStoreStatus } from '@/api/store'
+import { saveCurrency, getCurrencyList, updateCurrency } from '@/api/currency'
+export default {
+  name: 'StoreList',
+  components: {
+    FuintQrCode
+  },
+  data() {
+    return {
+      // 二维码
+      qr: null,
+      // 二维码对话框
+      openQrCode: false,
+      // 遮罩层
+      loading: true,
+      // 标题
+      title: '',
+      // 选中数组
+      ids: [],
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 表格数据
+      list: [],
+      // 是否显示弹出层
+      open: false,
+      // 日期范围
+      dateRange: [],
+      // 默认排序
+      defaultSort: { prop: 'operTime', order: 'descending' },
+      // 表单参数
+      form: {
+        name: '',
+        symbol: ''
+      },
+      // 微信支付证书
+      wxCertPath: '',
+      // 上传地址
+      uploadAction: process.env.VUE_APP_SERVER_URL + '/backendApi/file/upload',
+      // 隐藏上传
+      hideUpload: false,
+      // 上传文件列表
+      uploadFiles: [],
+      uploadHeader: { 'Access-Token': getToken() },
+      merchantOptions: [],
+      // 图片根目录
+      imagePath: '',
+      // 查询参数
+      queryParams: {
+        page: 1,
+        pageSize: 10,
+        name: ''
+      },
+      // 表单校验
+      rules: {
+        name: [{ required: true, message: '货币名称不能为空', trigger: 'blur' }],
+        symbol: [{ required: true, message: '货币符号不能为空', trigger: 'blur' }]
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  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
+      })
     },
-    data() {
-      return {
-        // 二维码
-        qr: null,
-        // 二维码对话框
-        openQrCode: false,
-        // 遮罩层
-        loading: true,
-        // 标题
-        title: "",
-        // 选中数组
-        ids: [],
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        // 表格数据
-        list: [],
-        // 是否显示弹出层
-        open: false,
-        // 日期范围
-        dateRange: [],
-        // 默认排序
-        defaultSort: { prop: "operTime", order: "descending" },
-        // 表单参数
-        form: {
-          name: "",
-          symbol:''
-        },
-        // 微信支付证书
-        wxCertPath: "",
-        // 上传地址
-        uploadAction: process.env.VUE_APP_SERVER_URL + "/backendApi/file/upload",
-        // 隐藏上传
-        hideUpload: false,
-        // 上传文件列表
-        uploadFiles: [],
-        uploadHeader: { "Access-Token": getToken() },
-        merchantOptions: [],
-        // 图片根目录
-        imagePath: "",
-        // 查询参数
-        queryParams: {
-          page: 1,
-          pageSize: 10,
-          name: "",
-        },
-        // 表单校验
-        rules: {
-          name: [
-            { required: true, message: "货币名称不能为空", trigger: "blur" },
-
-          ],
-          symbol:[
-            { required: true, message: "货币符号不能为空", trigger: "blur" },
-          ]
-        },
-      };
+    // 搜索按钮操作
+    handleQuery() {
+      this.queryParams.page = 1
+      this.getList()
     },
-    created() {
-      this.getList();
+    // 重置按钮操作
+    resetQuery() {
+      this.dateRange = []
+      this.resetForm('queryForm')
+      this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
+      this.handleQuery()
     },
-    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;
-          }
-        );
-      },
-      // 搜索按钮操作
-      handleQuery() {
-        this.queryParams.page = 1;
-        this.getList();
-      },
-      // 重置按钮操作
-      resetQuery() {
-        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";
-          });
-      },
-      // 多选框选中数据
-      handleSelectionChange(selection) {
-        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();
-      },
-      // 新增按钮操作
-      handleAdd() {
-        this.reset();
-        this.open = true;
-        this.title = "新增货币";
-      },
-      // 表单重置
-      reset() {
-        this.form = {
-          id: "",
-          name: "",
-          symbol:'',
-        };
-        this.resetForm("form");
-      },
-      // 取消按钮
-      cancel() {
-        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();
-            //   });
-            // }
+    // 状态修改
+    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'
+        })
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      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()
+    },
+    // 新增按钮操作
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = '新增货币'
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: '',
+        name: '',
+        symbol: ''
+      }
+      this.resetForm('form')
+    },
+    // 取消按钮
+    cancel() {
+      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()
+            })
           }
-        });
-      },
-      // 二维码
-      handleQrCode(row) {
-        this.qr = { type: "store", id: row.id };
-        this.openQrCode = true;
-      },
-      // 关闭二维码
-      closeDialog() {
-        this.openQrCode = false;
-      },
-      // 修改按钮操作
-      handleUpdate(row) {
-        this.reset();
-
-        this.title = "编辑货币";
-        this.open = true;
-        const {id,name,symbol} = row
-        this.form={id,name,symbol}
+          // 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();
+          //   });
+          // }
+        }
+      })
+    },
+    // 二维码
+    handleQrCode(row) {
+      this.qr = { type: 'store', id: row.id }
+      this.openQrCode = true
+    },
+    // 关闭二维码
+    closeDialog() {
+      this.openQrCode = false
+    },
+    // 修改按钮操作
+    handleUpdate(row) {
+      this.reset()
 
-      },
+      this.title = '编辑货币'
+      this.open = true
+      const { id, name, symbol } = row
+      this.form = { id, name, symbol }
+    },
 
-      handleUploadSuccess(file) {
-        this.form.logo = file.data.fileName;
-      },
-      handleUploadLicenseSuccess(file) {
-        this.form.license = file.data.fileName;
-      },
-      handleUploadCertSuccess(file) {
-        this.form.wxCertPath = file.data.fileName;
-        this.wxCertPath = file.data.fileName;
-      },
+    handleUploadSuccess(file) {
+      this.form.logo = file.data.fileName
     },
-  };
-  </script>
-  <style scoped>
-  .common-dialog >>> .el-upload--picture-card {
-    width: 60px;
-    height: 50px;
-    line-height: 60px;
-  }
-  .upload-cert >>> .el-upload {
-    width: 20px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .upload-cert .file-name {
-    width: 700px;
-    text-align: left;
+    handleUploadLicenseSuccess(file) {
+      this.form.license = file.data.fileName
+    },
+    handleUploadCertSuccess(file) {
+      this.form.wxCertPath = file.data.fileName
+      this.wxCertPath = file.data.fileName
+    }
   }
-  </style>
+}
+</script>
+<style scoped>
+.common-dialog >>> .el-upload--picture-card {
+  width: 60px;
+  height: 50px;
+  line-height: 60px;
+}
+.upload-cert >>> .el-upload {
+  width: 20px;
+  height: 20px;
+  line-height: 20px;
+}
+.upload-cert .file-name {
+  width: 700px;
+  text-align: left;
+}
+</style>

+ 46 - 62
src/views/person/account.vue

@@ -1,107 +1,91 @@
 <template>
   <div class="app-container">
-    <el-descriptions title="基本信息" :column="1">
+    <el-descriptions :title="$t('account.basicInfo')" :column="1">
       <template slot="extra">
-        <el-button type="primary" size="small" @click="handleEdit"
-          >编辑</el-button
-        >
+        <el-button type="primary" size="small" @click="handleEdit">
+          {{ $t('account.edit') }}
+        </el-button>
       </template>
-      <el-descriptions-item label="账号"> {{ name }} </el-descriptions-item>
-      <el-descriptions-item label="密码"> ****** </el-descriptions-item>
-      <el-descriptions-item label="头像">
+      <el-descriptions-item :label="$t('account.account')">{{ name }}</el-descriptions-item>
+      <el-descriptions-item :label="$t('account.password')">******</el-descriptions-item>
+      <el-descriptions-item :label="$t('account.avatar')">
         <el-avatar :src="avatar"></el-avatar>
       </el-descriptions-item>
     </el-descriptions>
     <!-- 用户信息弹出层 -->
-    <el-dialog
-      title="用户信息"
-      :visible.sync="userDialog"
-      class="common-dialog"
-    >
-      <el-form
-        ref="form"
-        :rules="rules"
-        :model="form"
-        size="mini"
-        label-width="80px"
-      >
-        <el-form-item label="账号" prop="name">
+    <el-dialog :title="$t('account.userInfo')" :visible.sync="userDialog" class="common-dialog">
+      <el-form ref="form" :rules="rules" :model="form" size="mini" label-width="80px">
+        <el-form-item :label="$t('account.account')" prop="name">
           {{ name }}
         </el-form-item>
-        <el-form-item label="密码" prop="password">
-          <el-input
-            style="width: 15rem"
-            v-model.trim="form.password"
-            show-password
-          ></el-input>
+        <el-form-item :label="$t('account.password')" prop="password">
+          <el-input style="width: 15rem" v-model.trim="form.password" show-password></el-input>
         </el-form-item>
-        <el-form-item label="头像" prop="avatar">
+        <el-form-item :label="$t('account.avatar')" prop="avatar">
           <ImageUpload class="upload" :isShowTip="false" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" :loading="loading" @click="handleSubmit"
-          >保存</el-button
-        >
-        <el-button @click="close">关闭</el-button>
+        <el-button type="primary" :loading="loading" @click="handleSubmit">
+          {{ $t('account.save') }}
+        </el-button>
+        <el-button @click="close">{{ $t('account.close') }}</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 <script>
-import ImageUpload from "@/components/ImageUpload";
-import { mapGetters } from "vuex";
-import { validateForm, validatePassword } from "@/utils/validate";
-import { resetAccountPwd } from "@/api/system/account";
+import ImageUpload from '@/components/ImageUpload'
+import { mapGetters } from 'vuex'
+import { validateForm, validatePassword } from '@/utils/validate'
+import { resetAccountPwd } from '@/api/system/account'
+
 export default {
-  name: "Account",
+  name: 'Account',
   components: { ImageUpload },
   data() {
     return {
       userDialog: false,
       loading: false,
       form: {
-        password: "",
-        avatar: "",
+        password: '',
+        avatar: ''
       },
       rules: {
         password: [
-          { required: true, message: "请输入密码", trigger: "blur" },
+          { required: true, message: this.$t('account.pleaseInputPassword'), trigger: 'blur' },
           {
-            validator: validateForm(
-              validatePassword,
-              "密码至少由6个字母或数字"
-            ),
-            trigger: "blur",
-          },
-        ],
-      },
-    };
+            validator: validateForm(validatePassword, this.$t('account.passwordFormat')),
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
   },
   computed: {
-    ...mapGetters(["avatar", "name", "userId"]),
+    ...mapGetters(['avatar', 'name', 'userId'])
   },
 
   methods: {
     handleEdit() {
-      this.userDialog = true;
+      this.userDialog = true
     },
     close() {
-      this.userDialog = false;
+      this.userDialog = false
     },
     async handleSubmit() {
-      await this.$refs["form"].validate();
-      this.loading = true;
+      await this.$refs['form'].validate()
+      this.loading = true
       await resetAccountPwd(this.userId, this.form.password)?.finally(() => {
-        this.loading = false;
-      });
-      await this.$modal.alertSuccess("密码修改成功");
-      this.$store.dispatch("LogOut").then(() => {
-        location.href = "/";
-      });
-    },
-  },
-};
+        this.loading = false
+      })
+      await this.$modal.alertSuccess(this.$t('account.passwordChangeSuccess'))
+      this.$store.dispatch('LogOut').then(() => {
+        location.href = '/'
+      })
+    }
+  }
+}
 </script>
 <style lang="scss" scoped>
 ::v-deep .upload .el-upload {

+ 91 - 61
src/views/staff/list.vue

@@ -9,8 +9,12 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="员工类别" prop="category">
-        <el-select v-model="queryParams.category" clearable placeholder="请选择员工类别">
+      <el-form-item :label="$t('employee.employeeCategory')" prop="category">
+        <el-select
+          v-model="queryParams.category"
+          clearable
+          :placeholder="$t('employee.selectEmployeeCategory')"
+        >
           <el-option
             v-for="item in categoryOptions"
             :key="item.key"
@@ -19,40 +23,42 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="姓名" prop="name">
+      <el-form-item :label="$t('employee.name')" prop="name">
         <el-input
           v-model="queryParams.realName"
-          placeholder="请输入姓名"
+          :placeholder="$t('employee.inputName')"
           clearable
           style="width: 240px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="手机号" prop="mobile">
+      <el-form-item :label="$t('employee.mobilePhone')" prop="mobile">
         <el-input
           v-model="queryParams.mobile"
-          placeholder="请输入手机号"
+          :placeholder="$t('employee.inputMobilePhone')"
           clearable
           style="width: 240px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="状态" prop="auditedStatus">
+      <el-form-item :label="$t('employee.status')" prop="auditedStatus">
         <el-select
           v-model="queryParams.auditedStatus"
-          placeholder="状态"
+          :placeholder="$t('employee.status')"
           clearable
           style="width: 240px"
         >
-          <el-option key="A" label="启用" value="A" />
-          <el-option key="N" label="禁用" value="N" />
+          <el-option :key="A" :label="$t('employee.enabled')" :value="A" />
+          <el-option :key="N" :label="$t('employee.disabled')" :value="N" />
         </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
-          搜索
+          {{ $t('employee.search') }}
+        </el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
+          {{ $t('employee.reset') }}
         </el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         <el-button
           type="primary"
           plain
@@ -61,7 +67,7 @@
           @click="handleAdd"
           v-hasPermi="['staff:list']"
         >
-          新增员工
+          {{ $t('employee.addEmployee') }}
         </el-button>
       </el-form-item>
     </el-form>
@@ -78,12 +84,12 @@
       :default-sort="defaultSort"
       @sort-change="handleSortChange"
     >
-      <el-table-column label="ID" align="center" prop="id" width="80">
+      <el-table-column :label="$t('employee.id')" align="center" prop="id" width="80">
         <template slot-scope="scope">
           <span>{{ showIdLastFour(scope.row.id) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="类别" align="center" prop="category">
+      <el-table-column :label="$t('employee.category')" align="center" prop="category">
         <template slot-scope="scope">
           <span v-if="scope.row.category">
             <span>{{ getName(categoryOptions, scope.row.category) }}</span>
@@ -91,18 +97,18 @@
           <span v-else>-</span>
         </template>
       </el-table-column>
-      <el-table-column label="姓名" align="center" prop="realName" />
-      <el-table-column label="手机号" align="center" prop="mobile" />
-      <!-- <el-table-column label="关联会员ID" align="center" prop="userId" /> -->
-      <el-table-column label="所属店铺" align="center" prop="storeName">
+      <el-table-column :label="$t('employee.name')" align="center" prop="realName" />
+      <el-table-column :label="$t('employee.mobilePhone')" align="center" prop="mobile" />
+      <!-- <el-table-column :label="$t('employee.associatedMemberId')" align="center" prop="userId" /> -->
+      <el-table-column :label="$t('employee.belongingStore')" align="center" prop="storeName">
         <template slot-scope="scope">
           <span v-if="scope.row.storeId">
             <span>{{ getName(storeOptions, scope.row.storeId) }}</span>
           </span>
-          <span v-else></span>
+          <span v-else>{{ $t('employee.none') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="状态" align="center" prop="storeName">
+      <el-table-column :label="$t('employee.status')" align="center" prop="storeName">
         <template slot-scope="scope">
           <el-switch
             v-model="scope.row.auditedStatus"
@@ -112,17 +118,21 @@
           ></el-switch>
         </template>
       </el-table-column>
-      <el-table-column label="创建时间" align="center" prop="createTime">
+      <el-table-column :label="$t('employee.createTime')" align="center" prop="createTime">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="更新时间" align="center" prop="updateTime">
+      <el-table-column :label="$t('employee.updateTime')" align="center" prop="updateTime">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.updateTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        :label="$t('employee.operation')"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -131,7 +141,7 @@
             v-hasPermi="['staff:list']"
             @click="handleUpdate(scope.row)"
           >
-            修改
+            {{ $t('employee.modify') }}
           </el-button>
           <el-button
             size="mini"
@@ -140,7 +150,7 @@
             v-hasPermi="['staff:list']"
             @click="handleDelete(scope.row)"
           >
-            删除
+            {{ $t('employee.delete') }}
           </el-button>
         </template>
       </el-table-column>
@@ -165,9 +175,16 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-row>
           <el-col :span="24">
-            <el-form-item label="员工类别" prop="category">
-              <el-select v-model="form.category" placeholder="请选择员工类别">
-                <el-option key="0" label="请选择员工类别" value="0"></el-option>
+            <el-form-item :label="$t('employee.employeeCategory')" prop="category">
+              <el-select
+                v-model="form.category"
+                :placeholder="$t('employee.selectEmployeeCategory')"
+              >
+                <el-option
+                  :key="0"
+                  :label="$t('employee.selectEmployeeCategory')"
+                  :value="0"
+                ></el-option>
                 <el-option
                   v-for="item in categoryOptions"
                   :key="item.key"
@@ -180,23 +197,31 @@
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="姓名" prop="realName">
-              <el-input v-model="form.realName" placeholder="请输入姓名" maxlength="30" />
+            <el-form-item :label="$t('employee.name')" prop="realName">
+              <el-input
+                v-model="form.realName"
+                :placeholder="$t('employee.inputName')"
+                maxlength="30"
+              />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="手机号" prop="mobile">
-              <el-input v-model="form.mobile" placeholder="请输入联系人电话" maxlength="30" />
+            <el-form-item :label="$t('employee.mobilePhone')" prop="mobile">
+              <el-input
+                v-model="form.mobile"
+                :placeholder="$t('employee.inputMobilePhone')"
+                maxlength="30"
+              />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="所属店铺" prop="storeId">
-              <el-select v-model="form.storeId" placeholder="请选择所属店铺">
-                <el-option :key="0" label="全部店铺" :value="0"></el-option>
+            <el-form-item :label="$t('employee.belongingStore')" prop="storeId">
+              <el-select v-model="form.storeId" :placeholder="$t('employee.selectBelongingStore')">
+                <el-option :key="0" :label="$t('employee.allStores')" :value="0"></el-option>
                 <el-option
                   v-for="item in storeOptions"
                   :key="item.id"
@@ -210,29 +235,33 @@
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="备注信息">
+            <el-form-item :label="$t('employee.remark')">
               <el-input
                 v-model="form.description"
                 type="textarea"
-                placeholder="请输入内容"
+                :placeholder="$t('employee.inputContent')"
               ></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="状态">
+            <el-form-item :label="$t('employee.status')">
               <el-radio-group v-model="form.auditedStatus">
-                <el-radio key="A" label="A" value="A">启用</el-radio>
-                <el-radio key="N" label="N" value="N">禁用</el-radio>
+                <el-radio :key="A" :label="$t('employee.enabled')" :value="A">
+                  {{ $t('employee.enabled') }}
+                </el-radio>
+                <el-radio :key="N" :label="$t('employee.disabled')" :value="N">
+                  {{ $t('employee.disabled') }}
+                </el-radio>
               </el-radio-group>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确定</el-button>
-        <el-button @click="cancel">取消</el-button>
+        <el-button type="primary" @click="submitForm">{{ $t('employee.confirm') }}</el-button>
+        <el-button @click="cancel">{{ $t('employee.cancel') }}</el-button>
       </div>
     </el-dialog>
   </div>
@@ -281,14 +310,14 @@ export default {
       // 表单校验
       rules: {
         realName: [
-          { required: true, message: '姓名不能为空', trigger: 'blur' },
-          { min: 2, max: 30, message: '姓名长度必须介于 2 和 20 之间', trigger: 'blur' }
+          { required: true, message: this.$t('employee.nameRequired'), trigger: 'blur' },
+          { min: 2, max: 30, message: this.$t('employee.nameLengthLimit'), trigger: 'blur' }
         ],
         mobile: [
-          { required: true, message: '手机号不能为空', trigger: 'blur' },
-          { min: 11, max: 20, message: '手机号长度必须11', trigger: 'blur' }
+          { required: true, message: this.$t('employee.mobileRequired'), trigger: 'blur' },
+          { min: 11, max: 20, message: this.$t('employee.mobileLengthLimit'), trigger: 'blur' }
         ],
-        storeId: [{ required: true, message: '请选择所属店铺', trigger: 'blur' }]
+        storeId: [{ required: true, message: this.$t('employee.storeIdRequired'), trigger: 'blur' }]
       }
     }
   },
@@ -328,16 +357,17 @@ export default {
     },
     // 状态修改
     handleStatusChange(row) {
-      let text = row.auditedStatus == 'A' ? '启用' : '禁用'
+      let text =
+        row.auditedStatus === 'A' ? this.$t('employee.enabled') : this.$t('employee.disabled')
       this.$modal
-        .confirm('确认要' + text + '"' + row.realName + '"吗?')
-        .then(function () {
+        .confirm(this.$t('employee.confirmStatusChange', { status: text, name: row.realName }))
+        .then(() => {
           return updateStaffStatus(row.id, row.auditedStatus)
         })
         .then(() => {
-          this.$modal.msgSuccess(text + '成功')
+          this.$modal.msgSuccess(this.$t('employee.statusChangeSuccess', { status: text }))
         })
-        .catch(function () {
+        .catch(() => {
           row.auditedStatus = row.auditedStatus === 'A' ? 'A' : 'N'
         })
     },
@@ -356,7 +386,7 @@ export default {
     handleAdd() {
       this.reset()
       this.open = true
-      this.title = '新增员工'
+      this.title = this.$t('employee.addEmployee')
     },
     // 表单重置
     reset() {
@@ -374,18 +404,18 @@ export default {
       this.reset()
     },
     // 提交按钮
-    submitForm: function () {
+    submitForm() {
       this.$refs['form'].validate((valid) => {
         if (valid) {
           if (!this.form.id) {
             saveStaff(this.form).then((response) => {
-              this.$modal.msgSuccess('新增成功')
+              this.$modal.msgSuccess(this.$t('employee.addSuccess'))
               this.open = false
               this.getList()
             })
           } else {
             saveStaff(this.form).then((response) => {
-              this.$modal.msgSuccess('修改成功')
+              this.$modal.msgSuccess(this.$t('employee.modifySuccess'))
               this.open = false
               this.getList()
             })
@@ -401,20 +431,20 @@ export default {
         this.form = response.data.staffInfo
         this.form.category = response.data.staffInfo.category + ''
         this.open = true
-        this.title = '编辑员工信息'
+        this.title = this.$t('employee.editEmployeeInfo')
       })
     },
     // 删除按钮操作
     handleDelete(row) {
       const name = row.realName || this.id
       this.$modal
-        .confirm('是否确认删除"' + name + '"的数据项?')
-        .then(function () {
+        .confirm(this.$t('employee.confirmDelete', { name }))
+        .then(() => {
           return deleteStaff(row.id)
         })
         .then(() => {
           this.getList()
-          this.$modal.msgSuccess('删除成功')
+          this.$modal.msgSuccess(this.$t('employee.deleteSuccess'))
         })
         .catch(() => {})
     }