浏览代码

fix(prodList,prodInfo): bug fix, 调整列宽度, 界面美化

furffico 1 年之前
父节点
当前提交
cede1ca4de

+ 31 - 31
src/avue/crud/category.ts

@@ -1,33 +1,33 @@
 export const tableOption = {
 export const tableOption = {
-    searchMenuSpan: 6,
-    columnBtn: false,
-    border: true,
-    selection: true,
-    stripe: true,
-    menuAlign: 'center',
-    menuFixed: false,
-    align: 'center',
-    refreshBtn: false,
-    searchSize: 'mini',
-    addBtn: true,
-    editBtn: true,
-    delBtn: true,
-    viewBtn: false,
-    props: {
-      label: 'label',
-      value: 'value'
-    },
-    column: [
-    {
-      label: "#",
-      prop: "id",
-      editDisabled: true,
-      addDisplay: false
-    }, {
-      label: '分类名',
-      prop: 'name',
-      search: true,
-      align: "left",
-      minWidth: 300,
-    }]
+  searchMenuSpan: 6,
+  columnBtn: false,
+  border: true,
+  selection: false,
+  stripe: true,
+  menuAlign: 'center',
+  menuFixed: false,
+  align: 'center',
+  refreshBtn: false,
+  searchSize: 'mini',
+  addBtn: true,
+  editBtn: true,
+  delBtn: true,
+  viewBtn: false,
+  props: {
+    label: 'label',
+    value: 'value'
+  },
+  column: [{
+    label: "#",
+    prop: "id",
+    editDisabled: true,
+    addDisplay: false,
+    width: 70,
+  }, {
+    label: '分类名',
+    prop: 'name',
+    search: true,
+    // align: "left",
+    minWidth: 300,
+  }]
 }
 }

+ 48 - 0
src/avue/crud/liveroomList.ts

@@ -0,0 +1,48 @@
+export const tableOption = {
+  searchMenuSpan: 6,
+  columnBtn: true,
+  border: true,
+  selection: false,
+  stripe: true,
+  menuAlign: 'center',
+  menuFixed: false,
+  align: 'center',
+  refreshBtn: true,
+  searchSize: 'mini',
+  addBtn: false,
+  editBtn: false,
+  delBtn: false,
+  viewBtn: false,
+  menuWidth: 360,
+  props: {
+    label: 'label',
+    value: 'value'
+  },
+  column: [
+    {
+      label: '#',
+      prop: 'id',
+      width: 70,
+    }, {
+      label: '名称',
+      prop: 'name',
+      search: true,
+    }, {
+      label: '极光房号',
+      prop: 'roomid',
+    }, {
+      label: '分享图标',
+      prop: 'icon',
+      type: 'upload',
+      listType: 'picture-img',
+      width: 100,
+    }, {
+      label: '首页显示',
+      prop: 'display',
+      slot: true,
+      width: 100,
+    }
+  ]
+}
+
+export default tableOption

+ 9 - 1
src/avue/crud/prodList.js

@@ -23,6 +23,7 @@ export const tableOption = {
   {
   {
     label: "#",
     label: "#",
     prop: "id",
     prop: "id",
+    width: 70,
   }, {
   }, {
     label: '产品名',
     label: '产品名',
     prop: 'name',
     prop: 'name',
@@ -31,23 +32,30 @@ export const tableOption = {
     label: '商品原价',
     label: '商品原价',
     prop: 'price',
     prop: 'price',
     formatter: row_currencyFormatter,
     formatter: row_currencyFormatter,
+    width: 100,
   }, {
   }, {
     label: '商品库存',
     label: '商品库存',
     prop: 'stockAmount',
     prop: 'stockAmount',
+    width: 100,
   }, {
   }, {
     label: '运费',
     label: '运费',
     prop: 'deliverPrice',
     prop: 'deliverPrice',
     formatter: row_currencyFormatter,
     formatter: row_currencyFormatter,
+    width: 100,
   }, {
   }, {
     label: '售出',
     label: '售出',
     prop: 'soldAmount',
     prop: 'soldAmount',
+    width: 100,
   }, {
   }, {
     label: '类别',
     label: '类别',
     prop: 'kind',
     prop: 'kind',
+    slot: true,
+    width: 100,
   }, {
   }, {
     label: '产品图片',
     label: '产品图片',
     prop: 'cover',
     prop: 'cover',
     type: 'upload',
     type: 'upload',
-    listType: 'picture-img'
+    listType: 'picture-img',
+    width: 100,
   }]
   }]
 }
 }

+ 1 - 0
src/avue/crud/user.js

@@ -24,6 +24,7 @@ export const tableOption = {
       label: '#',
       label: '#',
       prop: 'id',
       prop: 'id',
       search: false,
       search: false,
+      width: 70,
     },
     },
     {
     {
       label: '用户昵称',
       label: '用户昵称',

+ 2 - 1
src/utils/currency.ts

@@ -1,6 +1,7 @@
+import { toInteger, toSafeInteger } from "lodash"
 
 
 export type DatabaseCurrency = number
 export type DatabaseCurrency = number
 // 因为数据库表内价格是以分为单位的整数,因此在展示与请求时需要转换
 // 因为数据库表内价格是以分为单位的整数,因此在展示与请求时需要转换
 // 以下为转换函数
 // 以下为转换函数
 export const database2real = (n: DatabaseCurrency): number => n / 100
 export const database2real = (n: DatabaseCurrency): number => n / 100
-export const real2database = (n: number): DatabaseCurrency => n * 100
+export const real2database = (n: number): DatabaseCurrency => toInteger((n * 100).toFixed(0))

+ 17 - 6
src/views/modules/prod/prodInfo.vue

@@ -22,6 +22,11 @@ interface ISelection {
   hidden?: boolean
   hidden?: boolean
 }
 }
 
 
+interface ICategoryProdRelation {
+  goodsId: number
+  goodsTypeId: number
+}
+
 export default Vue.extend({
 export default Vue.extend({
   data() {
   data() {
     return {
     return {
@@ -61,7 +66,13 @@ export default Vue.extend({
       this.new = false
       this.new = false
       this.id = id
       this.id = id
       this.form.title = '修改商品'
       this.form.title = '修改商品'
-      httpx.post(
+      this.getProductInfo(id)
+    }
+  },
+
+  methods: {
+    getProductInfo(id: number) {
+      return httpx.post(
         httpx.makeurl("/goods/editGood"),
         httpx.makeurl("/goods/editGood"),
         id
         id
       ).then(({ data }) => {
       ).then(({ data }) => {
@@ -69,7 +80,8 @@ export default Vue.extend({
           this.notFound()
           this.notFound()
         }
         }
         const item = data.goodList[0]
         const item = data.goodList[0]
-        const categories = data?.goodsGoodsTypesEntityList || []
+        const categories_raw: ICategoryProdRelation[] = data?.goodsGoodsTypesEntityList || []
+        const categories = categories_raw.map(v => v.goodsTypeId)
         this.form = {
         this.form = {
           name: item.name,
           name: item.name,
           desc: item.desc,
           desc: item.desc,
@@ -87,10 +99,7 @@ export default Vue.extend({
           title: `修改商品 ${item.name}`,
           title: `修改商品 ${item.name}`,
         }
         }
       })
       })
-    }
-  },
-
-  methods: {
+    },
     getCategoryList(name: string = "") {
     getCategoryList(name: string = "") {
       return httpx.post(httpx.makeurl("/goodsTypes/queryGoodsTypeList"), {
       return httpx.post(httpx.makeurl("/goodsTypes/queryGoodsTypeList"), {
         name: name, limit: 1000, page: 1
         name: name, limit: 1000, page: 1
@@ -107,6 +116,8 @@ export default Vue.extend({
       data.deliverPrice = real2database(data.deliverPrice)
       data.deliverPrice = real2database(data.deliverPrice)
       // @ts-ignore
       // @ts-ignore
       data.cover = data.cover[0] || ""
       data.cover = data.cover[0] || ""
+      // @ts-ignore
+      delete data.title;
 
 
       console.log(data)
       console.log(data)
 
 

+ 5 - 0
src/views/modules/prod/prodList.vue

@@ -7,6 +7,11 @@
         :disabled="dataListSelections.length <= 0">批量删除</el-button-->
         :disabled="dataListSelections.length <= 0">批量删除</el-button-->
     </template>
     </template>
 
 
+    <template slot-scope="scope" slot="kind">
+      <el-tag v-if="scope.row.kind" size="small" :type="scope.row.kind === '自营' ? 'primary' : 'success'">{{ scope.row.kind
+      }}</el-tag>
+    </template>
+
     <template slot-scope="{row,index}" slot="menu">
     <template slot-scope="{row,index}" slot="menu">
       <el-button type="primary" icon="el-icon-edit" size="small" @click="addOrUpdateHandle(row.id)">修改</el-button>
       <el-button type="primary" icon="el-icon-edit" size="small" @click="addOrUpdateHandle(row.id)">修改</el-button>
       <el-button type="danger" icon="el-icon-delete" size="small" @click="deleteGood(row.id)">删除</el-button>
       <el-button type="danger" icon="el-icon-delete" size="small" @click="deleteGood(row.id)">删除</el-button>