Bladeren bron

fix:添加语言i18n,修改输入限制,修改数据展示

Mcal 6 dagen geleden
bovenliggende
commit
3fd19fba09

+ 7 - 0
src/api/home.js

@@ -16,3 +16,10 @@ export function getStatisticData(query) {
     params: query
   })
 }
+export function getStatisticData2(query) {
+  return request({
+    url: 'backendApi/home/revenue/statistics',
+    method: 'get',
+    params: query
+  })
+}

+ 21 - 0
src/locales/en.json

@@ -30,6 +30,8 @@
 
   },
   "operational": {
+    "StoreRanking": "StoreRanking",
+    "SalesStatistics": "SalesStatistics",
     "overview": "Operational Overview",
     "totalTransactionAmount": "Total Transaction Amount (Yuan)",
     "commonFunctions": "Common Functions",
@@ -475,6 +477,25 @@
     }
   },
   "goodList":{
+      "nameRequired": "The name cannot be empty",
+      "nameLengthLimit": "The length of the name must be between 2 and 200 characters",
+      "uploadImage": "Please upload an image",
+      "productNameRequired": "The product name cannot be empty",
+      "productNameLengthLimit": "The length of the product name must be between 2 and 30 characters",
+      "productBarcodeRequired": "The product barcode cannot be empty",
+      "productBarcodeLengthLimit": "The length of the product barcode must be between 2 and 100 characters",
+      "selectProductCategory": "Please select the product category",
+      "uploadProductImages": "Please upload product images",
+      "couponIdsRequired": "Coupon ID cannot be empty",
+      "couponIdsLengthLimit": "The length of the coupon ID must be between 1 and 1000",
+      "pleaseSelect": "Please select",
+      "priceRequired": "Please enter the product price",
+      "priceMustBePositive": "The price must be greater than 0",
+      "stockRequired": "Please enter the stock quantity",
+      "stockMustBePositiveInteger": "The stock quantity must be a positive integer",
+      "initSaleMustBePositiveInteger": "The initial sales volume must be a positive integer",
+      "weightMustBeNonNegative": "The weight must be greater than or equal to 0",
+      "descriptionRequired": "Please enter the product details",
     "categoryName": "Category Name",
     "pleaseEnterCategoryName": "Please Enter Category Name",
     "belongingShop": "Belonging Shop",

+ 21 - 0
src/locales/ru.json

@@ -28,6 +28,8 @@
     },
 
     "operational": {
+          "StoreRanking": "Рейтингмагазинов",
+    "SalesStatistics": "Статистикапродаж",
       "overview": "Обзор операционной деятельности",
       "totalTransactionAmount": "Общая сумма транзакций (Юани)",
       "commonFunctions": "Основные функции",
@@ -453,6 +455,25 @@
       },
 
       "goodList": {
+          "nameRequired": "Название не может быть пустым",
+          "nameLengthLimit": "Длина названия должна быть между 2 и 200 символами",
+          "uploadImage": "Пожалуйста, загрузите изображение",
+          "productNameRequired": "Название товара не может быть пустым",
+          "productNameLengthLimit": "Длина названия товара должна быть между 2 и 30 символами",
+          "productBarcodeRequired": "Штрих-код товара не может быть пустым",
+          "productBarcodeLengthLimit": "Длина штрих-кода товара должна быть между 2 и 100 символами",
+          "selectProductCategory": "Пожалуйста, выберите категорию товара",
+          "uploadProductImages": "Пожалуйста, загрузите изображения товара",
+          "couponIdsRequired": "ID купона не может быть пустым",
+          "couponIdsLengthLimit": "Длина ID купона должна быть между 1 и 1000 символами",
+          "pleaseSelect": "Пожалуйста, выберите",
+          "priceRequired": "Пожалуйста, введите цену товара",
+          "priceMustBePositive": "Цена должна быть больше 0",
+          "stockRequired": "Пожалуйста, введите количество товара на складе",
+          "stockMustBePositiveInteger": "Количество товара на складе должно быть положительным целым числом",
+          "initSaleMustBePositiveInteger": "Начальный объем продаж должен быть положительным целым числом",
+          "weightMustBeNonNegative": "Вес должен быть больше или равен 0",
+          "descriptionRequired": "Пожалуйста, введите описание товара",
         "categoryName": "Название категории",
         "pleaseEnterCategoryName": "Пожалуйста, введите название категории",
         "belongingShop": "Принадлежащий магазин",

+ 21 - 0
src/locales/sr.json

@@ -91,6 +91,8 @@
   },
 
   "operational": {
+    "StoreRanking": "Rejtingprodavnica",
+    "SalesStatistics": "Statistikaprodaje",
     "overview": "Pregled operacija",
     "totalTransactionAmount": "Ukupna transakcijska suma (RMB)",
     "commonFunctions": "Česte funkcije",
@@ -537,6 +539,25 @@
   },
 
   "goodList": {
+      "nameRequired": "Naziv ne može biti prazan",
+      "nameLengthLimit": "Dužina naziva mora biti između 2 i 200 karaktera",
+      "uploadImage": "Molimo Vas, učitajte sliku",
+      "productNameRequired": "Naziv proizvoda ne može biti prazan",
+      "productNameLengthLimit": "Dužina naziva proizvoda mora biti između 2 i 30 karaktera",
+      "productBarcodeRequired": "Štampasti kod proizvoda ne može biti prazan",
+      "productBarcodeLengthLimit": "Dužina štampastog koda proizvoda mora biti između 2 i 100 karaktera",
+      "selectProductCategory": "Molimo Vas, odaberite kategoriju proizvoda",
+      "uploadProductImages": "Molimo Vas, učitajte slike proizvoda",
+    "couponIdsRequired": "ID kupona ne može biti prazan",
+    "couponIdsLengthLimit": "Dužina ID kupona mora biti između 1 i 1000 karaktera",
+    "pleaseSelect": "Molimo Vas, odaberite",
+    "priceRequired": "Molimo Vas, unesite cenu proizvoda",
+    "priceMustBePositive": "Cena mora biti veća od 0",
+    "stockRequired": "Molimo Vas, unesite količinu robe na lageru",
+    "stockMustBePositiveInteger": "Količina robe na lageru mora biti pozitivni ceo broj",
+    "initSaleMustBePositiveInteger": "Početni obim prodaje mora biti pozitivni ceo broj",
+    "weightMustBeNonNegative": "Težina mora biti veća ili jednaka 0",
+    "descriptionRequired": "Molimo Vas, unesite opis proizvoda",
     "categoryName": "Naziv kategorije",
     "pleaseEnterCategoryName": "Unesite naziv kategorije",
     "belongingShop": "Pripadajuća prodavnica",

+ 21 - 0
src/locales/zh.json

@@ -26,6 +26,8 @@
       "captchaRequired": "请输入验证码"
   },
   "operational": {
+    "StoreRanking": "店铺排名",
+    "SalesStatistics": "销售统计",
     "overview": "运营概况",
     "totalTransactionAmount": "总交易金额(元)",
     "commonFunctions": "常用功能",
@@ -479,6 +481,25 @@
   },
 
   "goodList":{
+      "nameRequired": "名称不能为空",
+      "nameLengthLimit": "名称长度必须介于 2 和 200 之间",
+      "uploadImage": "请上传图片",
+      "productNameRequired": "商品名称不能为空",
+      "productNameLengthLimit": "商品名称长度必须介于2和30之间",
+      "productBarcodeRequired": "商品条码不能为空",
+      "productBarcodeLengthLimit": "商品条码长度必须介于2和100之间",
+      "selectProductCategory": "请选择商品分类",
+      "uploadProductImages": "请上传商品图片",
+    "couponIdsRequired": "卡券ID不能为空",
+    "couponIdsLengthLimit": "卡券ID长度必须介于1和1000之间",
+    "pleaseSelect": "请选择",
+    "priceRequired": "请输入商品价格",
+    "priceMustBePositive": "价格必须大于0",
+    "stockRequired": "请输入库存数量",
+    "stockMustBePositiveInteger": "库存数量必须是正整数",
+    "initSaleMustBePositiveInteger": "初始销量必须是正整数",
+    "weightMustBeNonNegative": "重量必须大于等于0",
+    "descriptionRequired": "请输入商品详情",
     "categoryName": "分类名称",
     "pleaseEnterCategoryName": "请输入分类名称",
     "belongingShop": "所属店铺",

+ 4 - 1
src/views/components/charts/index.vue

@@ -89,7 +89,10 @@ export default {
     },
     headList() {
       this.initChart()
-    }
+    },
+    dataList() {
+      this.initChart()
+    },
   },
   methods: {
     initChart() {

+ 11 - 9
src/views/goods/cate/index.vue

@@ -168,7 +168,7 @@
               <el-input
                 v-model="form.name"
                 :placeholder="$t('goodList.pleaseEnterCategoryName')"
-                maxlength="200"
+                maxlength="30"
               />
             </el-form-item>
           </el-col>
@@ -320,17 +320,19 @@ export default {
       },
       // 表单校验
       rules: {
-        name: [
-          { required: true, message: '名称不能为空', trigger: 'blur' },
-          {
+    name: [
+        { required: true, message: this.$t('goodList.nameRequired'), trigger: 'blur' },
+        {
             min: 2,
             max: 200,
-            message: '名称长度必须介于2 和 200 之间',
+            message: this.$t('goodList.nameLengthLimit'),
             trigger: 'blur'
-          }
-        ],
-        logo: [{ required: true, message: '请上传图片', trigger: 'blur' }]
-      }
+        }
+    ],
+    logo: [
+        { required: true, message: this.$t('goodList.uploadImage'), trigger: 'blur' }
+    ]
+}
     }
   },
   created() {

+ 53 - 39
src/views/goods/goods/goodsForm.vue

@@ -26,7 +26,7 @@
                       class="input"
                       v-model="baseForm.name"
                       :placeholder="$t('goodList.productNamePlaceholder')"
-                      maxlength="200"
+                      maxlength="25"
                     />
                   </el-form-item>
                 </el-col>
@@ -368,50 +368,64 @@ export default {
       uploadFiles: [],
       // 基础信息表单校验
       baseRules: {
-        name: [
-          { required: true, message: '商品名称不能为空', trigger: 'blur' },
-          { min: 2, max: 30, message: '商品名称长度必须介于2和200 之间', trigger: 'blur' }
-        ],
-        goodsNo: [
-          { required: true, message: '商品条码不能为空', trigger: 'blur' },
-          { min: 2, max: 100, message: '商品条码长度必须介于2和100之间', trigger: 'blur' }
-        ],
-        cateId: [{ required: true, message: '请选择商品分类', trigger: 'blur' }],
-        images: [{ required: true, message: '请上传商品图片', trigger: 'blur' }]
-      },
+    name: [
+        { required: true, message: this.$t('goodList.productNameRequired'), trigger: 'blur' },
+        { min: 2, max: 30, message: this.$t('goodList.productNameLengthLimit'), trigger: 'blur' }
+    ],
+    goodsNo: [
+        { required: true, message: this.$t('goodList.productBarcodeRequired'), trigger: 'blur' },
+        { min: 2, max: 100, message: this.$t('goodList.productBarcodeLengthLimit'), trigger: 'blur' }
+    ],
+    cateId: [
+        { required: true, message: this.$t('goodList.selectProductCategory'), trigger: 'blur' }
+    ],
+    images: [
+        { required: true, message: this.$t('goodList.uploadProductImages'), trigger: 'blur' }
+    ]
+},
       // 扩展信息表单校验
       extendRules: {
-        couponIds: [
-          { required: true, message: '卡券ID不能为空', trigger: 'blur' },
-          { min: 1, max: 1000, message: '卡券ID长度必须介于1和100之间', trigger: 'blur' }
-        ],
-        canUsePoint: [{ required: true, message: '请选择', trigger: 'blur' }],
-        isMemberDiscount: [{ required: true, message: '请选择', trigger: 'blur' }],
-        isSingleSpec: [{ required: true, message: '请选择', trigger: 'blur' }],
-        price: [
-          { required: true, message: '请输入商品价格', trigger: 'blur' },
-          {
+    couponIds: [
+        { required: true, message: this.$t('goodList.couponIdsRequired'), trigger: 'blur' },
+        { min: 1, max: 1000, message: this.$t('goodList.couponIdsLengthLimit'), trigger: 'blur' }
+    ],
+    canUsePoint: [
+        { required: true, message: this.$t('goodList.pleaseSelect'), trigger: 'blur' }
+    ],
+    isMemberDiscount: [
+        { required: true, message: this.$t('goodList.pleaseSelect'), trigger: 'blur' }
+    ],
+    isSingleSpec: [
+        { required: true, message: this.$t('goodList.pleaseSelect'), trigger: 'blur' }
+    ],
+    price: [
+        { required: true, message: this.$t('goodList.priceRequired'), trigger: 'blur' },
+        {
             pattern: /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/,
-            message: `价格必须大于0`,
+            message: this.$t('goodList.priceMustBePositive'),
             trigger: 'blur'
-          }
-        ],
-        stock: [
-          { required: true, message: '请输入库存数量', trigger: 'blur' },
-          { pattern: /^[0-9]{1,10}$/, message: `库存数量必须是正整数`, trigger: 'blur' }
-        ],
-        initSale: [{ pattern: /^[0-9]{1,10}$/, message: `初始销量必须是正整数`, trigger: 'blur' }],
-        weight: [
-          {
+        }
+    ],
+    stock: [
+        { required: true, message: this.$t('goodList.stockRequired'), trigger: 'blur' },
+        { pattern: /^[0-9]{1,10}$/, message: this.$t('goodList.stockMustBePositiveInteger'), trigger: 'blur' }
+    ],
+    initSale: [
+        { pattern: /^[0-9]{1,10}$/, message: this.$t('goodList.initSaleMustBePositiveInteger'), trigger: 'blur' }
+    ],
+    weight: [
+        {
             pattern: /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/,
-            message: `重量必须大于等于0`,
+            message: this.$t('goodList.weightMustBeNonNegative'),
             trigger: 'blur'
-          }
-        ]
-      },
-      detailRules: {
-        description: [{ required: true, message: '请输入商品详情', trigger: 'blur' }]
-      }
+        }
+    ]
+},
+detailRules: {
+    description: [
+        { required: true, message: this.$t('goodList.descriptionRequired'), trigger: 'blur' }
+    ]
+}
     }
   },
   created() {

+ 93 - 127
src/views/statistic/index.vue

@@ -211,7 +211,57 @@
         </el-row>
       </div>
     </div>
-    <ECharts :options="chartOptions" />
+    <div class="overview" v-if="chartData3.length > 0">
+      <div class="title">{{ $t('operational.StoreRanking') }}</div>
+      <div class="content">
+        <el-row>
+          <div class="date-picker">
+            <el-form :inline="true"  class="demo-form-inline">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                v-model="timeRange2"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                type="datetimerange"
+                style="width: 400px"
+                :start-placeholder="$t('orderList.startTime')"
+                :end-placeholder="$t('orderList.endTime')"
+                :picker-options="pickerOptions"
+                ></el-date-picker>  
+              </el-form-item>
+              
+            </el-form>
+          </div>
+          <div class="do-search">
+            <el-button icon="el-icon-refresh" size="small" @click="reset2">
+              {{ $t('operational.reset') }}
+            </el-button>
+            <el-button type="primary" icon="el-icon-search" size="small" @click="getChartsData2">
+              {{ $t('operational.query') }}
+            </el-button>
+            <span class="ex" @click="setDay2(3)">{{ $t('operational.lastThreeDays') }}</span>
+            <span class="ex" @click="setDay2(7)">{{ $t('operational.lastSevenDays') }}</span>
+            <span class="ex" @click="setDay2(15)">{{ $t('operational.lastFifteenDays') }}</span>
+            <span class="ex" @click="setDay2(30)">{{ $t('operational.lastThirtyDays') }}</span>
+          </div>
+        </el-row>
+        <el-row>
+          <el-col class="item" :span="24">
+            <commonChart
+              v-if="chartData3.length > 0"
+              :title="chart3.title"
+              :color="chart3.color"
+              :chart-type="chart3.chartType"
+              :head-list="chart3.header"
+              :data-list="chartData3"
+              width="100%"
+              id="chart3"
+              height="400px"
+            />
+          </el-col>
+        </el-row>
+      </div>
+    </div>
+    <!-- <ECharts :options="chartOptions" /> -->
     <!-- <div class="overview">
       <div class="title">{{ $t('operational.dataRanking') }}</div>
       <div class="content">
@@ -266,7 +316,7 @@
 
 <script>
 import { getNumDayTime } from '@/utils/fuint'
-import { getStatisticData } from '@/api/home'
+import { getStatisticData, getStatisticData2 } from '@/api/home'
 import { getMainData, getTopData } from '@/api/statistic'
 import commonChart from '../components/charts/index'
 import ECharts  from '@/components/eCharts/eCharts'
@@ -279,130 +329,6 @@ export default {
   },
   data() {
     return {
-      // ECharts 配置示例
-      chartOptions:{
-    tooltip: {
-        trigger: 'axis',
-        axisPointer: {
-            type: 'shadow'
-        }
-    },
-    legend: {
-        data: ['Forest', 'Steppe', 'Desert', 'Wetland']
-    },
-    toolbox: {
-        show: true,
-        orient: 'vertical',
-        left: 'right',
-        top: 'center',
-        feature: {
-            mark: { show: true },
-            dataView: { show: true, readOnly: false },
-            magicType: { show: true, type: ['line', 'bar', 'stack'] },
-            restore: { show: true },
-            saveAsImage: { show: true }
-        }
-    },
-    xAxis: [
-        {
-            type: 'category',
-            axisTick: { show: false },
-            data: ['2012', '2013', '2014', '2015', '2016']
-        }
-    ],
-    yAxis: [
-        {
-            type: 'value'
-        }
-    ],
-    series: [
-        {
-            name: 'Forest',
-            type: 'bar',
-            barGap: 0,
-            label: {
-                show: true,
-                position: 'insideBottom',
-                distance: 15,
-                align: 'left',
-                verticalAlign: 'middle',
-                rotate: 90,
-                formatter: '{c}  {name|{a}}',
-                fontSize: 16,
-                rich: {
-                    name: {}
-                }
-            },
-            emphasis: {
-                focus: 'series'
-            },
-            data: [320, 332, 301, 334, 390]
-        },
-        {
-            name: 'Steppe',
-            type: 'bar',
-            label: {
-                show: true,
-                position: 'insideBottom',
-                distance: 15,
-                align: 'left',
-                verticalAlign: 'middle',
-                rotate: 90,
-                formatter: '{c}  {name|{a}}',
-                fontSize: 16,
-                rich: {
-                    name: {}
-                }
-            },
-            emphasis: {
-                focus: 'series'
-            },
-            data: [220, 182, 191, 234, 290]
-        },
-        {
-            name: 'Desert',
-            type: 'bar',
-            label: {
-                show: true,
-                position: 'insideBottom',
-                distance: 15,
-                align: 'left',
-                verticalAlign: 'middle',
-                rotate: 90,
-                formatter: '{c}  {name|{a}}',
-                fontSize: 16,
-                rich: {
-                    name: {}
-                }
-            },
-            emphasis: {
-                focus: 'series'
-            },
-            data: [150, 232, 201, 154, 190]
-        },
-        {
-            name: 'Wetland',
-            type: 'bar',
-            label: {
-                show: true,
-                position: 'insideBottom',
-                distance: 15,
-                align: 'left',
-                verticalAlign: 'middle',
-                rotate: 90,
-                formatter: '{c}  {name|{a}}',
-                fontSize: 16,
-                rich: {
-                    name: {}
-                }
-            },
-            emphasis: {
-                focus: 'series'
-            },
-            data: [98, 77, 101, 99, 40]
-        }
-    ]
-},
         // 配置日期选择器的选项
       pickerOptions: {
         disabledDate(time) {
@@ -414,6 +340,7 @@ export default {
       startTime: getNumDayTime(30),
       endTime: getNumDayTime(0),
       timeRange: [getNumDayTime(30), getNumDayTime(0)],
+      timeRange2: [getNumDayTime(30), getNumDayTime(0)],
       mainData: {
         userCount: 0,
         totalUserCount: 0,
@@ -436,8 +363,15 @@ export default {
         chartType: 'line',
         header: [this.$t('operational.memberStatistics')]
       },
+      chart3: {
+        title: this.$t('operational.StoreRanking'),
+        color: '#ff5b57',
+        chartType: 'bar',
+        header: [this.$t('operational.SalesStatistics')]
+      },
       chartData1: [],
       chartData2: [],
+      chartData3: [],
       goodsList: [],
       memberList: []
     }
@@ -445,6 +379,7 @@ export default {
   created() {
     this.getMainData()
     this.getChartsData()
+    this.getChartsData2()
     this.getTopData()
   },
   methods: {
@@ -454,6 +389,9 @@ export default {
       this.endTime = ''
       this.timeRange = [this.startTime, this.endTime]
     },
+    reset2() {
+      this.timeRange2 = [this.startTime, this.endTime]
+    },
     // 设置日期
     setDay(day) {
       this.startTime = getNumDayTime(day - 1)
@@ -462,6 +400,10 @@ export default {
       this.getMainData()
       this.getTopData()
     },
+    setDay2(day) {
+      this.timeRange2 = [getNumDayTime(day - 1), getNumDayTime(0)]
+      this.getChartsData2()
+    },
     // 查询首页数据
     getMainData() {
       this.loading = true
@@ -471,11 +413,34 @@ export default {
         this.loading = false
       })
     },
+    getChartsData2(){
+        const app = this
+        app.loading = true
+        // 查询店铺排名数据
+        getStatisticData2({startTime:this.timeRange2[0],endTime:this.timeRange2[1]}).then((response) => {
+        // console.log(response)
+        // return;
+        const data = response.data
+
+        const dataList = []
+        for(let i = 0; i<data.dataY.length; i++){
+          dataList.push({name:data.dataX[i],value0:data.dataY[i]})
+        }
+
+        // data.labels.forEach(function (label, index) {
+        //   const value1 = labelData1[index] ? labelData1[index] : 0
+        //   const value2 = labelData2[index] ? labelData2[index] : 0
+        //   dataList1.push({ name: label, value0: value1 })
+        //   dataList2.push({ name: label, value0: value2 })
+        // })
+        app.chartData3 = dataList
+        app.loading = false
+      })
+    },
     // 查询统计数据
     getChartsData() {
       const app = this
       app.loading = true
-      // 近7日订单数量和活跃会员数量
       getStatisticData({ tag: 'order,user_active' }).then((response) => {
         const data = response.data
         const labelData1 = data.data[0] ? data.data[0] : []
@@ -493,6 +458,7 @@ export default {
         app.chartData2 = dataList2
         app.loading = false
       })
+
     },
     // 查询排行榜数据
     getTopData() {

+ 1 - 1
src/views/table/index.vue

@@ -158,7 +158,7 @@
               <el-input
                 v-model="form.tableNumber"
                 :placeholder="$t('tableManagement.pleaseEnterTableEncoding')"
-                maxlength="30"
+                maxlength="10"
               />
             </el-form-item>
           </el-col>