ソースを参照

feat:商品管理的语言切换

PIWALIN 1 週間 前
コミット
512fec7846

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

+ 109 - 0
src/locales/en.json

@@ -95,5 +95,114 @@
       "discountAmountForGoods": "Discount Amount for Goods",
       "quantity": "Quantity"
     }
+  },
+  "goodList":{
+    "categoryName": "Category Name",
+    "pleaseEnterCategoryName": "Please Enter Category Name",
+    "belongingShop": "Belonging Shop",
+    "publicCategory": "Public Category",
+    "categoryId": "Category ID",
+    "Name": "Name",
+    "image": "Image",
+    "creationTime": "Creation Time",
+    "updateTime": "Update Time",
+    "actions": "Actions",
+    "sortOrder": "Sort Order",
+    "remarks": "Remarks",
+    "enable": "Enable",
+    "disable": "Disable",
+    "tipOrder": "Tip: The smaller the value, the higher the ranking",
+    "tipImage": "Tip: Click the image to modify, recommended size: 128 x 128",
+    "publicAll": "Public All",
+    "enterRemarkContent": "Please enter the remark content",
+    "addProductCategory": "Add Product Category",
+    "editProductCategory": "Edit Product Category",
+    "confirmDelete": "Are you sure you want to delete?",
+    "onlyImageAllowed": "Only image files can be uploaded for this data item!",
+    "imageSizeLimit": "The uploaded image size must not exceed 20MB!",
+    "addSuccess": "Add Successful",
+    "modificationSuccess": "Modification Successful",
+    "SaveSuccessful":"Save Successful",
+    "deleteSuccess": "Delete Successful",
+    "confirm": "Confirm",
+    "cancel": "Cancel",
+    "modify": "Modify",
+    "delete": "Delete",
+    "status": "Status",
+    "search": "Search",
+    "reset": "Reset",
+    "addNew": "Add New",
+    "edit":"edit",
+    "productName": "Product Name",
+    "productNamePlaceholder": "Please enter the product name",
+    "store": "Affiliated Stores",
+    "PublicGoods":"Public Goods",
+    "productCategory": "Product Category",
+    "selectCategory": "Please select product category",
+    "productType": "Product Type",
+    "selectProductType": "Please select product type",
+    "specificationType": "Specification Type",
+    "singleSpecification": "Single Specification",  
+    "multipleSpecifications": "Multiple Specifications",
+    "shelfStatus": "Shelf Status",
+    "putOnShelf":"Put On Shelf",
+    "removeFromShelf": "Remove From Shelf",
+    "stockStatus": "Stock Status",
+    "inStock": "In Stock",  
+    "outOfStock": "Out of Stock",
+    "id": "ID",
+    "storeName": "Store",
+    "mainImage": "Main Image",
+    "remainingStock": "Remaining Stock",
+    "category": "Category",
+    "price": "Price",
+    "displaySorting": "Display sorting", 
+    "ProductStatus":"Product Status",
+    "ProductImage":"Product Image",
+    "hintSmallerValueHigherRank": "Hint: The smaller the value, the higher the rank",
+    "basicInfo": "Basic Information",  
+    "extendedInfo": "Extended Information",  
+    "productDescription": "Product Description",
+    "ProductSpecifications":"Product specifications",
+    "InventoryQuantity":"Inventory quantity",
+    "quantity":"Please enter the quantity in stock",
+    "commodityPrice":"commodity price",
+    "goodsPrice":"Please enter the price of the product",
+    "UnitYuan":"Unit:Yuan",
+    "ProductWeight":"Product weight",
+    "serviceDuration": "Service Duration",
+    "enterServiceDuration": "Please enter the service duration, unit: minutes",
+    "serviceDurationTip": "Tip: Enter numbers, unit: minutes",
+    "couponId": "Coupon ID",
+    "enterCouponId": "Please enter the purchased coupon IDs, separated by commas, e.g., 1000,1001,1002",
+    "couponIdTip": "Tip: Coupon IDs, separated by commas",
+    "Batch": "Batch Settings",
+    "skuNo": "SKU Code",
+    "randomGenerate": "Random Generate",
+    "linePrice": "Original Price",
+    "goodStock": "Stock",
+    "goodsWeight": "Weight",
+    "confirmSetting": "Confirm Settings",
+    "index": "Index",
+    "specifications": "Specifications",
+    "skuCode": "SKU Code",
+    "salesPrice": "Sales Price (Yuan)",
+    "originalPrice": "Original Price (Yuan)",
+    "stock": "Stock",
+    "weight": "Weight (kg)",
+    "addSpec": "Add Specification",
+    "specName": "Specification Name",
+    "specValue": "Specification Value",
+    "add": "Add",
+    "deleteSpec": "Delete Specification",
+    "enterSpecName": "Enter specification name",
+    "specNameRequired": "Specification name is required",
+    "enterSpecValue": "Enter specification value",
+    "addSpecValue": "Add Specification Value",
+    "specValueRequired": "Specification value is required",
+    "priceGreaterThanZero": "The product price must be greater than 0!",
+    "linePriceGreaterThanZero": "The product line price must be greater than or equal to 0!",
+    "weightGreaterThanZero": "The product weight must be greater than or equal to 0!",
+    "stockGreaterThanZero": "The product stock must be greater than or equal to 0!"
   }
 }

+ 110 - 0
src/locales/zh.json

@@ -89,5 +89,115 @@
       "discountAmountForGoods": "优惠金额",
       "quantity": "数量"
     }
+  },
+  "goodList":{
+    "categoryName": "分类名称",
+    "pleaseEnterCategoryName": "请输入分类名称",
+    "belongingShop": "所属店铺",
+    "publicCategory": "公共分类",
+    "categoryId": "分类ID",
+    "Name": "名称",
+    "image": "图片",
+    "creationTime": "创建时间",
+    "updateTime": "更新时间",
+    "actions": "操作",
+    "sortOrder": "排序",
+    "remarks": "备注信息",
+    "enable": "启用",
+    "disable": "禁用",
+    "tipOrder": "提示:数值越小,排行越靠前",
+    "tipImage": "提示:点击图片修改,建议尺寸,128 x 128",
+    "publicAll": "公共所有",
+    "enterRemarkContent": "请输入备注内容",
+    "addProductCategory": "新增商品分类",
+    "editProductCategory": "编辑商品分类",
+    "confirmDelete": "是否确认删除",
+    "onlyImageAllowed": "数据项 只能上传图片文件!",
+    "imageSizeLimit": "上传图片大小不能超过 20MB!",
+    "addSuccess": "新增成功",
+    "modificationSuccess": "修改成功",
+    "SaveSuccessful":"保存成功!",
+    "deleteSuccess": "删除成功",
+    "confirm": "确定",
+    "cancel": "取消",
+    "modify": "修改",
+    "delete": "删除",
+    "status": "状态",
+    "search": "搜索",
+    "reset": "重置",
+    "addNew": "新增",
+    "edit":"编辑",
+    "productName": "商品名称",
+    "productNamePlaceholder": "请输入商品名称",
+    "store": "所属店铺",
+    "PublicGoods": "公共商品",
+    "productCategory": "商品分类",
+    "selectCategory": "请选择商品分类",
+    "productType": "商品类型",
+    "selectProductType": "请选择商品类型",
+    "specificationType": "规格类型",
+    "singleSpecification": "单规格", 
+    "multipleSpecifications": "多规格",  
+    "shelfStatus": "上架状态",
+    "putOnShelf":"上架",
+    "removeFromShelf": "下架",
+    "stockStatus": "库存状态",
+    "inStock": "有库存", 
+    "outOfStock": "无库存",
+    "id": "ID",
+    "storeName": "所属店铺",
+    "mainImage": "主图",
+    "remainingStock": "剩余库存",
+    "category": "所属分类",
+    "price": "价格",
+    "ProductStatus":"商品状态",
+    "ProductImage":"商品图片",
+    "displaySorting": "显示排序",
+    "hintSmallerValueHigherRank":"提示:数值越小,排行越靠前",
+    "basicInfo": "基础信息",  
+    "extendedInfo": "扩展信息",  
+    "productDescription": "商品介绍",
+    "ProductSpecifications":"商品规格",
+    "InventoryQuantity":"库存数量",
+    "quantity":"请输入库存数量",
+    "commodityPrice":"商品价格",
+    "goodsPrice":"请输入商品价格",
+    "UnitYuan":"单位:元",
+    "ProductWeight":"商品重量",
+    "serviceDuration": "服务时长",
+    "enterServiceDuration": "请输入服务时长,单位:分钟",
+    "serviceDurationTip": "提示:输入数字,单位:分钟",
+    "couponId": "卡券ID",
+    "enterCouponId": "请输入购买的卡券ID,英文逗号分隔,如:1000,1001,1002",
+    "couponIdTip": "提示:购买的卡券ID,英文逗号分隔",
+    "Batch": "批量设置",
+    "skuNo": "SKU编码",
+    "randomGenerate": "随机生成",
+    "linePrice": "划线价格",
+    "goodStock": "商品库存",
+    "goodsWeight": "商品重量",
+    "confirmSetting": "确认设置",
+    "index": "序号",
+    "specifications": "规格",
+    "skuCode": "SKU编码",
+    "salesPrice": "销售价格(元)",
+    "originalPrice": "划线价格(元)",
+    "stock": "商品库存",
+    "weight": "重量(千克)",
+
+    "addSpec": "添加规格",
+    "specName": "规格名",
+    "specValue": "规格值",
+    "add": "添加",
+    "deleteSpec": "删除规格",
+    "enterSpecName": "请输入规格名称",
+    "specNameRequired": "规格名称不能为空",
+    "enterSpecValue": "请输入规格值",
+    "addSpecValue": "添加规格值",
+    "specValueRequired": "规格值不能为空",
+    "priceGreaterThanZero": "商品价格须大于0!",
+    "linePriceGreaterThanZero": "商品划线价格须大于等于0!",
+    "weightGreaterThanZero": "商品重量须大于等于0!",
+    "stockGreaterThanZero": "商品库存须大于等于0!"
   }
 }

+ 43 - 43
src/views/goods/cate/index.vue

@@ -9,23 +9,23 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="分类名称" prop="name">
+      <el-form-item :label="$t('goodList.categoryName')" prop="name">
         <el-input
           v-model="queryParams.name"
-          placeholder="请输入分类名称"
+          :placeholder="$t('goodList.pleaseEnterCategoryName')"
           clearable
           style="width: 240px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="所属店铺" prop="store">
+      <el-form-item :label="$t('goodList.belongingShop')" prop="store">
         <el-select
           v-model="queryParams.storeId"
-          placeholder="所属店铺"
+          :placeholder="$t('goodList.belongingShop')"
           clearable
           style="width: 180px"
         >
-          <el-option :key="0" label="公共分类" v-if="!this.$store.getters.storeId" :value="0" />
+          <el-option :key="0" :label="$t('goodList.publicCategory')" v-if="!this.$store.getters.storeId" :value="0" />
           <el-option
             v-for="storeInfo in storeOptions"
             :key="storeInfo.id"
@@ -34,17 +34,17 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="状态" prop="status">
-        <el-select v-model="queryParams.status" placeholder="状态" clearable style="width: 240px">
-          <el-option key="A" label="启用" value="A" />
-          <el-option key="N" label="禁用" value="N" />
+      <el-form-item :label="$t('goodList.status')" prop="status">
+        <el-select v-model="queryParams.status" :placeholder="$t('goodList.status')" clearable style="width: 240px">
+          <el-option key="A" :label="$t('goodList.enable')" value="A" />
+          <el-option key="N" :label="$t('goodList.disable')" value="N" />
         </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
-          搜索
+          {{$t('goodList.search')}}
         </el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('goodList.reset')}}</el-button>
         <el-button
           type="primary"
           plain
@@ -53,7 +53,7 @@
           @click="handleAdd"
           v-hasPermi="['goods:cate:index']"
         >
-          新增
+        {{$t('goodList.addNew')}}
         </el-button>
       </el-form-item>
     </el-form>
@@ -66,31 +66,31 @@
       :default-sort="defaultSort"
       @sort-change="handleSortChange"
     >
-      <el-table-column label="分类ID" prop="id" width="66" />
-      <el-table-column label="所属店铺" align="center">
+      <el-table-column :label="$t('goodList.categoryId')" prop="id" width="80" />
+      <el-table-column :label="$t('goodList.belongingShop')" align="center">
         <template slot-scope="scope">
           <span v-if="scope.row.storeName">{{ scope.row.storeName }}</span>
-          <span v-else>公共所有</span>
+          <span v-else>{{$t('goodList.publicAll')}}</span>
         </template>
       </el-table-column>
-      <el-table-column label="名称" align="center" prop="name" />
-      <el-table-column label="图片" align="center" width="200">
+      <el-table-column :label="$t('goodList.Name')" align="center" prop="name" />
+      <el-table-column :label="$t('goodList.image')" align="center" width="200">
         <template slot-scope="scope">
           <!-- imagePath +  -->
           <img class="list-img" :src="scope.row.logo" />
         </template>
       </el-table-column>
-      <el-table-column label="创建时间" align="center" prop="createTime">
+      <el-table-column :label="$t('goodList.creationTime')" 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('goodList.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" prop="status">
+      <el-table-column :label="$t('goodList.status')" align="center" prop="status">
         <template slot-scope="scope">
           <el-switch
             v-model="scope.row.status"
@@ -100,7 +100,7 @@
           ></el-switch>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column :label="$t('goodList.actions')" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -110,7 +110,7 @@
             v-if="storeId == scope.row.storeId || storeId == 0"
             @click="handleUpdate(scope.row)"
           >
-            修改
+          {{$t('goodList.modify')}}
           </el-button>
           <el-button
             size="mini"
@@ -120,7 +120,7 @@
             v-if="storeId == scope.row.storeId || storeId == 0"
             @click="handleDelete(scope.row)"
           >
-            删除
+          {{$t('goodList.delete')}}
           </el-button>
         </template>
       </el-table-column>
@@ -145,8 +145,8 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-row>
           <el-col :span="24">
-            <el-form-item label="分类名称" prop="name">
-              <el-input v-model="form.name" placeholder="请输入名称" maxlength="200" />
+            <el-form-item :label="$t('goodList.categoryName')" prop="name">
+              <el-input v-model="form.name" :placeholder="$t('goodList.pleaseEnterCategoryName')" maxlength="200" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -179,15 +179,15 @@
         </el-row> -->
         <el-row>
           <el-col :span="24">
-            <el-form-item label="排序" prop="sort">
+            <el-form-item :label="$t('goodList.sortOrder')" prop="sort">
               <el-input-number v-model="form.sort" :min="0" />
-              <div class="form-tips">提示:数值越小,排行越靠前</div>
+              <div class="form-tips">{{$t('goodList.tipOrder')}}</div>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="9">
-            <el-form-item label="图片" prop="image">
+            <el-form-item :label="$t('goodList.image')" prop="image">
               <el-upload
                 :action="uploadAction"
                 :before-upload="beforeUpload"
@@ -205,33 +205,33 @@
               </el-upload>
             </el-form-item>
           </el-col>
-          <p class="form-tips">(提示:点击图片修改,建议尺寸:128 x 128)</p>
+          <p class="form-tips">{{$t('goodList.tipImage')}}</p>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="备注信息">
+            <el-form-item :label="$t('goodList.remarks')">
               <el-input
                 v-model="form.description"
                 type="textarea"
-                placeholder="请输入内容"
+                :placeholder="$t('goodList.enterRemarkContent')"
               ></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="状态">
+            <el-form-item :label="$t('goodList.status')">
               <el-radio-group v-model="form.status">
-                <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="A" value="A">{{$t('goodList.enable')}}</el-radio>
+                <el-radio key="N" label="N" value="N">{{$t('goodList.disable')}}</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('goodList.confirm')}}</el-button>
+        <el-button @click="cancel">{{$t('goodList.cancel')}}</el-button>
       </div>
     </el-dialog>
   </div>
@@ -367,7 +367,7 @@ export default {
     handleAdd() {
       this.reset()
       this.open = true
-      this.title = '新增商品分类'
+      this.title = this.$t('goodList.addProductCategory')
     },
     // 表单重置
     reset() {
@@ -397,13 +397,13 @@ export default {
           }
           if (this.form.id) {
             saveGoodsCate(this.form).then((response) => {
-              this.$modal.msgSuccess('修改成功')
+              this.$modal.msgSuccess(this.$t('goodList.modificationSuccess'))
               this.open = false
               this.getList()
             })
           } else {
             saveGoodsCate(this.form).then((response) => {
-              this.$modal.msgSuccess('新增成功')
+              this.$modal.msgSuccess(this.$t('goodList.addSuccess'))
               this.open = false
               this.getList()
             })
@@ -419,7 +419,7 @@ export default {
         this.form = response.data.cateInfo
         this.uploadFiles = [{ url: response.data.imagePath + this.form.logo, status: 'finished' }]
         this.open = true
-        this.title = '编辑商品分类'
+        this.title = this.$t('goodList.editProductCategory')
       })
     },
     // 删除按钮操作
@@ -432,7 +432,7 @@ export default {
         })
         .then(() => {
           this.getList()
-          this.$modal.msgSuccess('删除成功')
+          this.$modal.msgSuccess(this.$t('goodList.deleteSuccess'))
         })
         .catch(() => {})
     },
@@ -444,11 +444,11 @@ export default {
       console.log(file.size)
 
       if (!isImage) {
-        this.$message.error('只能上传图片文件!')
+        this.$message.error(this.$t('goodList.onlyImageAllowed'))
       }
 
       if (!isLt2M) {
-        this.$message.error('上传图片大小不能超过 20MB!')
+        this.$message.error(this.$t('goodList.imageSizeLimit'))
       }
 
       return isImage && isLt2M // 返回 true 则允许上传,返回 false 则阻止上传

+ 36 - 33
src/views/goods/components/Sku.vue

@@ -2,7 +2,7 @@
   <div class="sku-list">
     <template v-if="!disabled">
       <div class="sku-list-head">
-        <el-button type="primary" size="mini" @click="addSkuRow">添加规格</el-button
+        <el-button type="primary" size="mini" @click="addSkuRow">{{$t('goodList.addSpec')}}</el-button
         >
       </div>
       <div
@@ -12,7 +12,7 @@
       >
         <div class="sku-list-item-main">
           <div class="sku-list-item__layout">
-            <span class="span">规格名</span>
+            <span class="span">{{$t('goodList.specName')}}</span>
             <el-input
               size="small"
               v-model="item.name"
@@ -20,7 +20,7 @@
             ></el-input>
           </div>
           <div class="sku-list-item__layout">
-            <span class="span">规格值</span>
+            <span class="span">{{$t('goodList.specValue')}}</span>
             <div class="sku-list-item-tags">
               <el-tag
                 class="sku-list-item-tag"
@@ -35,7 +35,7 @@
                 size="small"
                 icon="el-icon-plus"
                 @click="addSkuAttr(index)"
-              >添加</el-button
+              >{{$t('goodList.add')}}</el-button
               >
             </div>
           </div>
@@ -45,29 +45,30 @@
           size="small"
           class="sku-list-item-removeBtn"
           @click="removeSkuRow(index)"
-        >删除规格</el-button
+        >{{$t('goodList.deleteSpec')}}</el-button
         >
       </div>
     </template>
 
     <div class="batch-setting">
-      <span class="label">批量设置</span>
-      <el-input size="small" v-model="batch.skuNo" placeholder="sku编码" class="input input-sn"></el-input>
-      <span class="create-sn" @click="createGoodsSn()">随机生成</span>
-      <el-input size="small" v-model="batch.price" placeholder="商品价格" class="input"></el-input>
-      <el-input size="small" v-model="batch.linePrice" placeholder="划线价格" class="input"></el-input>
-      <el-input size="small" v-model="batch.stock" placeholder="商品库存" class="input"></el-input>
-      <el-input size="small" v-model="batch.weight" placeholder="商品重量" class="input"></el-input>
-      <el-button size="small" type="danger" class="button" @click="batchSetSku()">确认设置</el-button>
+      <span class="label">{{ $t('goodList.Batch') }}</span>
+      <el-input size="small" v-model="batch.skuNo" :placeholder="$t('goodList.skuNo')" class="input input-sn"></el-input>
+      <span class="create-sn" @click="createGoodsSn()">{{ $t('goodList.randomGenerate') }}</span>
+      <el-input size="small" v-model="batch.price" :placeholder="$t('goodList.commodityPrice')" class="input"></el-input>
+      <el-input size="small" v-model="batch.linePrice" :placeholder="$t('goodList.linePrice')" class="input"></el-input>
+      <el-input size="small" v-model="batch.stock" :placeholder="$t('goodList.goodStock')" class="input"></el-input>
+      <el-input size="small" v-model="batch.weight" :placeholder="$t('goodList.weight')" class="input"></el-input>
+      <el-button size="small" type="danger" class="button" @click="batchSetSku()">{{ $t('goodList.confirmSetting') }}</el-button>
     </div>
 
+
     <el-table border :data="skuData.skuList">
-      <el-table-column label="序号" align="center" width="60">
+      <el-table-column :label="$t('goodList.index')" align="center" width="60">
         <template slot-scope="scope">
           <span>{{ scope.$index + 1 }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="图片" align="center" width="120">
+      <el-table-column :label="$t('goodList.image')" align="center" width="120">
         <template slot-scope="scope">
           <el-upload
             :disabled="disabled"
@@ -77,8 +78,7 @@
             :headers="uploadHeader"
             :file-list="[]"
             :limit="1"
-            :on-success="function(file) {
-               return onUploadImgSuccess(file, scope.$index) }"
+            :on-success="function(file) { return onUploadImgSuccess(file, scope.$index) }"
             :show-file-list="false"
           >
             <img
@@ -90,12 +90,14 @@
           </el-upload>
         </template>
       </el-table-column>
-      <el-table-column label="规格" align="center">
+      <el-table-column :label="$t('goodList.specifications')" align="center">
         <template slot-scope="scope">
-          <div class="spec-tag" v-for="spec in scope.row.specList"><span class="i">{{ spec.value }}</span></div>
+          <div class="spec-tag" v-for="spec in scope.row.specList">
+            <span class="i">{{ spec.value }}</span>
+          </div>
         </template>
       </el-table-column>
-      <el-table-column label="sku编码" align="center" width="160">
+      <el-table-column :label="$t('goodList.skuCode')" align="center" width="160">
         <template slot-scope="scope">
           <el-input
             :readonly="disabled"
@@ -103,7 +105,7 @@
           ></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="销售价格(元)" align="center">
+      <el-table-column :label="$t('goodList.salesPrice')" align="center">
         <template slot-scope="scope">
           <el-input
             :readonly="disabled"
@@ -111,7 +113,7 @@
           ></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="划线价格(元)" align="center">
+      <el-table-column :label="$t('goodList.originalPrice')" align="center">
         <template slot-scope="scope">
           <el-input
             :readonly="disabled"
@@ -119,17 +121,18 @@
           ></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="商品库存" align="center">
+      <el-table-column :label="$t('goodList.stock')" align="center">
         <template slot-scope="scope">
           <el-input :readonly="disabled" v-model="scope.row.stock"></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="重量(千克)" align="center">
+      <el-table-column :label="$t('goodList.weight')" align="center">
         <template slot-scope="scope">
           <el-input :readonly="disabled" v-model="scope.row.weight"></el-input>
         </template>
-      </el-table-column>
+  </el-table-column>
     </el-table>
+
   </div>
 </template>
 
@@ -183,11 +186,11 @@ export default {
   methods: {
     // 添加规格行
     addSkuRow(i) {
-      this.$prompt("请输入规格名称", "添加规格", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
+      this.$prompt(this.$t('goodList.enterSpecName'), this.$t('goodList.addSpec'), {
+        confirmButtonText: this.$t('goodList.confirm'),
+        cancelButtonText: this.$t('goodList.cancel'),
         inputPattern: /\S+/,
-        inputErrorMessage: "规格名称不能为空",
+        inputErrorMessage: this.$t('goodList.specNameRequired'),
         closeOnClickModal: false,
       }).then(({ value }) => {
           saveSpecName({ goodsId: this.goodsId, name: value }).then(response => {
@@ -222,11 +225,11 @@ export default {
     },
     // 添加规格属性值
     addSkuAttr(i) {
-      this.$prompt("请输入规格值", "添加规格值", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
+      this.$prompt(this.$t('goodList.enterSpecValue'), this.$t('goodList.addSpecValue'), {
+        confirmButtonText: this.$t('goodList.confirm'),
+        cancelButtonText: this.$t('goodList.cancel'),
         inputPattern: /\S+/,
-        inputErrorMessage: "规格值不能为空",
+        inputErrorMessage:this.$t('goodList.specValueRequired'),
         closeOnClickModal: false,
       }).then(({ value }) => {
           saveSpecValue({ goodsId: this.goodsId, specName: this.skuData.attrList[i].name, value: value }).then(response => {

+ 35 - 34
src/views/goods/goods/goodsForm.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <div class="main-panel">
       <el-tabs v-model="activeTab" @tab-click="handleTabClick">
-        <el-tab-pane label="基础信息" name="base">
+        <el-tab-pane :label="$t('goodList.basicInfo')" name="base">
           <div class="content">
             <el-form ref="baseForm" :model="baseForm" :rules="baseRules" label-width="120px">
               <!-- <el-row>
@@ -21,11 +21,11 @@
               </el-row> -->
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="商品名称" prop="name">
+                  <el-form-item :label="$t('goodList.productName')" prop="name">
                     <el-input
                       class="input"
                       v-model="baseForm.name"
-                      placeholder="请输入商品名称"
+                      :placeholder="$t('goodList.productNamePlaceholder')"
                       maxlength="200"
                     />
                   </el-form-item>
@@ -46,8 +46,8 @@
               </el-row> -->
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="商品分类" prop="cateId">
-                    <el-select class="input" v-model="baseForm.cateId" placeholder="请选择商品分类">
+                  <el-form-item :label="$t('goodList.productCategory')" prop="cateId">
+                    <el-select class="input" v-model="baseForm.cateId" :placeholder="$t('goodList.selectCategory')">
                       <el-option
                         v-for="item in cateOptions"
                         :key="item.id"
@@ -83,7 +83,7 @@
               </el-row> -->
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="商品图片" prop="images">
+                  <el-form-item :label="$t('goodList.ProductImage')" prop="images">
                     <el-upload
                       class="form__head-icon-upload"
                       :action="uploadAction"
@@ -105,18 +105,18 @@
               </el-row>
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="显示排序" prop="sort">
+                  <el-form-item :label="$t('goodList.displaySorting')" prop="sort">
                     <el-input-number v-model="baseForm.sort" :min="0" />
-                    <div class="form-tips">提示:数值越小,排行越靠前</div>
+                    <div class="form-tips">{{$t('goodList.hintSmallerValueHigherRank')}}</div>
                   </el-form-item>
                 </el-col>
               </el-row>
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="商品状态">
+                  <el-form-item :label="$t('goodList.ProductStatus')">
                     <el-radio-group v-model="baseForm.status">
-                      <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="A" value="A">{{$t('goodList.putOnShelf')}}</el-radio>
+                      <el-radio key="N" label="N" value="N">{{$t('goodList.removeFromShelf')}}</el-radio>
                     </el-radio-group>
                   </el-form-item>
                 </el-col>
@@ -124,7 +124,7 @@
             </el-form>
           </div>
         </el-tab-pane>
-        <el-tab-pane label="扩展信息" name="extend">
+        <el-tab-pane :label="$t('goodList.extendedInfo')" name="extend">
           <div class="content">
             <el-form ref="extendForm" :model="extendForm" :rules="extendRules" label-width="120px">
               <!-- <el-row>
@@ -149,10 +149,10 @@
               </el-row> -->
               <el-row>
                 <el-col :span="24">
-                  <el-form-item label="规格类型" prop="isSingleSpec">
+                  <el-form-item :label="$t('goodList.specificationType')" prop="isSingleSpec">
                     <el-radio-group v-model="extendForm.isSingleSpec">
-                      <el-radio key="Y" label="Y" value="Y">单规格</el-radio>
-                      <el-radio key="N" label="N" value="N">多规格</el-radio>
+                      <el-radio key="Y" label="Y" value="Y">{{$t('goodList.singleSpecification')}}</el-radio>
+                      <el-radio key="N" label="N" value="N">{{$t('goodList.multipleSpecifications')}}</el-radio>
                     </el-radio-group>
                   </el-form-item>
                 </el-col>
@@ -160,7 +160,7 @@
 
               <el-row v-if="extendForm.isSingleSpec == 'N'">
                 <el-col :span="24">
-                  <el-form-item label="商品规格" prop="goodsSpec">
+                  <el-form-item :label="$t('goodList.ProductSpecifications')" prop="goodsSpec">
                     <Sku
                       ref="Sku"
                       :skuData="skuData"
@@ -174,41 +174,42 @@
 
               <el-row v-if="baseForm.type == 'service'">
                 <el-col :span="24">
-                  <el-form-item label="服务时长" prop="serviceTime">
+                  <el-form-item :label="$t('goodList.serviceDuration')" prop="serviceTime">
                     <el-input
                       v-model="extendForm.serviceTime"
                       class="min-input"
-                      placeholder="请输入服务时长,单位:分钟"
+                      :placeholder="$t('goodList.enterServiceDuration')"
                       maxlength="50"
                     />
-                    <div class="form-tips">提示:输入数字,单位:分钟</div>
+                    <div class="form-tips">{{ $t('goodList.serviceDurationTip') }}</div>
                   </el-form-item>
                 </el-col>
               </el-row>
 
               <el-row v-if="baseForm.type == 'coupon'">
                 <el-col :span="24">
-                  <el-form-item label="卡券ID" prop="couponIds">
+                  <el-form-item :label="$t('goodList.couponId')" prop="couponIds">
                     <el-input
                       v-model="extendForm.couponIds"
                       class="input"
                       rows="2"
                       type="textarea"
-                      placeholder="请输入购买的卡券ID,英文逗号分隔,如:1000,1001,1002"
+                      :placeholder="$t('goodList.enterCouponId')"
                       maxlength="1000"
                     />
-                    <div class="form-tips">提示:购买的卡券ID,英文逗号分隔</div>
+                    <div class="form-tips">{{ $t('goodList.couponIdTip') }}</div>
                   </el-form-item>
                 </el-col>
               </el-row>
 
+
               <el-row v-if="extendForm.isSingleSpec == 'Y'">
                 <el-col :span="24">
-                  <el-form-item label="库存数量" prop="stock">
+                  <el-form-item :label="$t('goodList.InventoryQuantity')" prop="stock">
                     <el-input
                       v-model="extendForm.stock"
                       class="min-input"
-                      placeholder="请输入库存数量"
+                      :placeholder="$t('goodList.quantity')"
                       maxlength="50"
                     />
                   </el-form-item>
@@ -217,14 +218,14 @@
 
               <el-row v-if="extendForm.isSingleSpec == 'Y'">
                 <el-col :span="24">
-                  <el-form-item label="商品价格" prop="price">
+                  <el-form-item :label="$t('goodList.commodityPrice')" prop="price">
                     <el-input
                       v-model="extendForm.price"
                       class="min-input"
-                      placeholder="请输入商品价格"
+                      :placeholder="$t('goodList.goodsPrice')"
                       maxlength="50"
                     />
-                    <div class="form-tips">单位:元</div>
+                    <div class="form-tips">{{$t('goodList.UnitYuan')}}</div>
                   </el-form-item>
                 </el-col>
               </el-row>
@@ -256,7 +257,7 @@
               </el-row> -->
               <el-row v-if="extendForm.isSingleSpec == 'Y' && baseForm.type == 'product'">
                 <el-col :span="24">
-                  <el-form-item label="商品重量" prop="weight">
+                  <el-form-item :label="$t('goodList.ProductWeight')" prop="weight">
                     <el-input
                       v-model="extendForm.weight"
                       class="min-input"
@@ -282,7 +283,7 @@
             </el-form>
           </div>
         </el-tab-pane>
-        <el-tab-pane label="商品介绍" name="detail">
+        <el-tab-pane :label="$t('goodList.productDescription')" name="detail">
           <div class="content" style="width: 375px; margin-left: 80px">
             <el-form ref="detailForm" :model="detailForm" :rules="detailRules" label-width="120px">
               <editor v-model="detailForm.description" :min-height="550" />
@@ -291,8 +292,8 @@
         </el-tab-pane>
       </el-tabs>
       <div slot="footer" class="footer">
-        <el-button type="primary" @click="submitForm">确定</el-button>
-        <el-button @click="cancel">取消</el-button>
+        <el-button type="primary" @click="submitForm">{{$t('goodList.confirm')}}</el-button>
+        <el-button @click="cancel">{{$t('goodList.cancel')}}</el-button>
       </div>
     </div>
   </div>
@@ -481,7 +482,7 @@ export default {
         app.$refs['baseForm'].validate((valid) => {
           if (valid) {
             saveGoods(app.baseForm).then((response) => {
-              app.$modal.msgSuccess('保存成功!')
+              app.$modal.msgSuccess(this.$t('goodList.SaveSuccessful'))
               app.getGoodsInfo(response.data.goodsInfo.id)
             })
           }
@@ -527,7 +528,7 @@ export default {
         app.$refs['extendForm'].validate((valid) => {
           if (valid) {
             saveGoods(app.extendForm).then((response) => {
-              app.$modal.msgSuccess('保存成功!')
+              app.$modal.msgSuccess(this.$t('goodList.SaveSuccessful'))
               app.getGoodsInfo(response.data.goodsInfo.id)
             })
           }
@@ -541,7 +542,7 @@ export default {
         app.$refs['detailForm'].validate((valid) => {
           if (valid) {
             saveGoods(app.detailForm).then((response) => {
-              app.$modal.msgSuccess('保存成功!')
+              app.$modal.msgSuccess(this.$t('goodList.SaveSuccessful'))
               app.getGoodsInfo(response.data.goodsInfo.id)
             })
           }

+ 38 - 38
src/views/goods/goods/index.vue

@@ -9,23 +9,23 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="商品名称" prop="name">
+      <el-form-item :label="$t('goodList.productName')" prop="name">
         <el-input
           v-model="queryParams.name"
-          placeholder="请输入商品名称"
+          :placeholder="$t('goodList.productNamePlaceholder')"
           clearable
           style="width: 240px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="所属店铺" prop="store">
+      <el-form-item :label="$t('goodList.store')" prop="store">
         <el-select
           v-model="queryParams.storeId"
-          placeholder="所属店铺"
+          :placeholder="$t('goodList.store')"
           clearable
           style="width: 180px"
         >
-          <el-option :key="0" label="公共商品" v-if="!storeId" :value="0" />
+          <el-option :key="0" :label="$t('goodList.PublicGoods')" v-if="!storeId" :value="0" />
           <el-option
             v-for="storeInfo in storeOptions"
             :key="storeInfo.id"
@@ -34,12 +34,12 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="商品分类" prop="cateId">
+      <el-form-item :label="$t('goodList.productCategory')" prop="cateId">
         <el-select
           class="input"
           v-model="queryParams.cateId"
           clearable
-          placeholder="请选择商品分类"
+          :placeholder="$t('goodList.selectCategory')"
         >
           <el-option
             v-for="item in cateList"
@@ -59,8 +59,8 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item> -->
-      <el-form-item label="商品类型" prop="type">
-        <el-select class="input" v-model="queryParams.type" clearable placeholder="请选择商品类型">
+      <el-form-item :label="$t('goodList.productType')" prop="type">
+        <el-select class="input" v-model="queryParams.type" clearable :placeholder="$t('goodList.selectProductType')">
           <el-option
             v-for="item in typeOptions"
             :key="item.key"
@@ -69,44 +69,44 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="规格类型" prop="isSingleSpec">
+      <el-form-item :label="$t('goodList.specificationType')" prop="isSingleSpec">
         <el-select
           v-model="queryParams.isSingleSpec"
-          placeholder="规格类型"
+          :placeholder="$t('goodList.specificationType')"
           clearable
           style="width: 120px"
         >
-          <el-option key="Y" label="单规格" value="Y" />
-          <el-option key="N" label="多规格" value="N" />
+          <el-option key="Y" :label="$t('goodList.singleSpecification')" value="Y" />
+          <el-option key="N" :label="$t('goodList.multipleSpecifications')" value="N" />
         </el-select>
       </el-form-item>
-      <el-form-item label="上架状态" prop="status">
+      <el-form-item :label="$t('goodList.shelfStatus')" prop="status">
         <el-select
           v-model="queryParams.status"
-          placeholder="上架状态"
+          :placeholder="$t('goodList.shelfStatus')"
           clearable
           style="width: 120px"
         >
-          <el-option key="A" label="上架" value="A" />
-          <el-option key="N" label="下架" value="N" />
+          <el-option key="A" :label="$t('goodList.putOnShelf')" value="A" />
+          <el-option key="N" :label="$t('goodList.removeFromShelf')" value="N" />
         </el-select>
       </el-form-item>
-      <el-form-item label="库存状态" prop="stock">
+      <el-form-item :label="$t('goodList.stockStatus')" prop="stock">
         <el-select
           v-model="queryParams.stock"
-          placeholder="库存状态"
+          :placeholder="$t('goodList.stockStatus')"
           clearable
           style="width: 120px"
         >
-          <el-option key="Y" label="有库存" value="Y" />
-          <el-option key="N" label="无库存" value="N" />
+          <el-option key="Y" :label="$t('goodList.inStock')" value="Y" />
+          <el-option key="N" :label="$t('goodList.outOfStock')" value="N" />
         </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
-          搜索
+          {{$t('goodList.search')}}
         </el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('goodList.reset')}}</el-button>
         <el-button
           type="primary"
           plain
@@ -115,7 +115,7 @@
           @click="handleAdd"
           v-hasPermi="['goods:goods:add']"
         >
-          新增
+        {{$t('goodList.addNew')}}
         </el-button>
       </el-form-item>
     </el-form>
@@ -128,33 +128,33 @@
       :default-sort="defaultSort"
       @sort-change="handleSortChange"
     >
-      <el-table-column label="ID" prop="id" width="100" />
-      <el-table-column label="所属店铺" align="center">
+      <el-table-column :label="$t('goodList.id')" prop="id" width="100" />
+      <el-table-column :label="$t('goodList.storeName')" align="center">
         <template slot-scope="scope">
           <span v-if="scope.row.storeInfo">{{ scope.row.storeInfo.name }}</span>
           <span v-else>公共所有</span>
         </template>
       </el-table-column>
-      <el-table-column label="商品名称" align="center" min-width="200" prop="name" />
-      <el-table-column label="主图" align="center" width="100">
+      <el-table-column :label="$t('goodList.productName')" align="center" min-width="200" prop="name" />
+      <el-table-column :label="$t('goodList.mainImage')" align="center" width="100">
         <template slot-scope="scope">
           <img class="list-img" :src="scope.row.logo" />
         </template>
       </el-table-column>
       <!-- <el-table-column label="商品条码" align="center" prop="goodsNo" width="140"/> -->
-      <el-table-column label="剩余库存" align="center" prop="stock" width="100" />
-      <el-table-column label="所属分类" align="center">
+      <el-table-column :label="$t('goodList.remainingStock')" align="center" prop="stock" width="100" />
+      <el-table-column :label="$t('goodList.productCategory')" align="center">
         <template slot-scope="scope">
           <span>{{ scope.row.cateInfo.name }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="价格" align="center" width="80">
+      <el-table-column :label="$t('goodList.price')" align="center" width="80">
         <template slot-scope="scope">
           <span v-if="scope.row.price">{{ scope.row.price.toFixed(2) }}</span>
           <span v-else>0.00</span>
         </template>
       </el-table-column>
-      <el-table-column label="上架状态" align="center" prop="status">
+      <el-table-column :label="$t('goodList.shelfStatus')" align="center" prop="status">
         <template slot-scope="scope">
           <el-switch
             v-model="scope.row.status"
@@ -164,17 +164,17 @@
           ></el-switch>
         </template>
       </el-table-column>
-      <el-table-column label="创建时间" align="center" width="150" prop="createTime">
+      <el-table-column :label="$t('goodList.creationTime')" align="center" width="150" prop="createTime">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="更新时间" align="center" width="150" prop="updateTime">
+      <el-table-column :label="$t('goodList.updateTime')" align="center" width="150" prop="updateTime">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.updateTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" width="120" fixed="right">
+      <el-table-column :label="$t('goodList.actions')" align="center" width="120" fixed="right">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -184,7 +184,7 @@
             @click="handleUpdate(scope.row)"
             v-if="storeId == scope.row.storeId || storeId == 0"
           >
-            编辑
+          {{$t('goodList.edit')}}
           </el-button>
           <el-button
             size="mini"
@@ -194,7 +194,7 @@
             v-if="storeId == scope.row.storeId || storeId == 0"
             @click="handleDelete(scope.row)"
           >
-            删除
+          {{$t('goodList.delete')}}
           </el-button>
         </template>
       </el-table-column>
@@ -340,7 +340,7 @@ export default {
         })
         .then(() => {
           this.getList()
-          this.$modal.msgSuccess('删除成功')
+          this.$modal.msgSuccess(this.$t('goodList.deleteSuccess'))
         })
         .catch(() => {})
     },