Browse Source

修改完善信息页面

pangqijun 1 year ago
parent
commit
bc7cdccfd3

+ 36 - 0
src/option/groupon/grouponPerfact.js

@@ -0,0 +1,36 @@
+export const goodsTableOption = {
+    menuWidth: 90,
+    refreshBtn: false,
+    columnBtn: false,
+    addBtn: false,
+    viewBtn: false,
+    editBtn: false,
+    delBtn: false,
+    sortable: true,
+    menu: false,
+    column: [
+        {
+            label: '商品图片',
+            prop: 'goodsCover',
+            type: 'img',
+            width: 70,
+        },
+        {
+            label: '商品名称',
+            prop: 'goodsName',
+        },
+        {
+            label: '规格',
+            prop: 'goodsSpec',
+        },
+    //     {
+    //     label: '供应商',
+    //     prop: 'supplierName',
+    // },
+        {
+          label: '团购价',
+          prop: 'grouponPrice',
+          slot: true,
+        }
+    ]
+}

+ 2 - 2
src/option/platform/userapp.js

@@ -1,6 +1,6 @@
 export const selfTakeOption = {
-    height:'auto',
-        calcHeight: 30,
+    // height:'auto',
+        // calcHeight: 30,
         tip: false,
         searchShow: true,
         searchMenuSpan: 6,

+ 7 - 5
src/views/groupon/groupon.vue

@@ -249,11 +249,13 @@ export default {
         }, {
           label: '供应商',
           prop: 'supplierName',
-        }, {
-          label: '团购价',
-          prop: 'grouponPrice',
-          slot:true
-        }]
+        },
+        //   {
+        //   label: '团购价',
+        //   prop: 'grouponPrice',
+        //   slot:true
+        // }
+        ]
       },
       option: {
         // dialogType: 'drawer',

+ 56 - 0
src/views/groupon/groupon_perfact.vue

@@ -32,6 +32,22 @@
 
       </template>
 
+      <!--  添加商品插槽    -->
+      <template slot="goodsForm">
+        <avue-crud :option="goodsTableOption"
+                   :data="tableData"
+                   ref="crudGoods">
+          <template #menu="{row,index,size}">
+            <el-button type="danger"
+                       size="mini"
+                       @click="rowDelGoods(row,index)">删除</el-button>
+          </template>
+          <template slot="grouponPrice" slot-scope="scope" >
+            <avue-input-number precision="2" v-model="scope.row.grouponPrice"></avue-input-number>
+          </template>
+        </avue-crud>
+      </template>
+
     </avue-crud>
   </basic-container>
 </template>
@@ -39,10 +55,13 @@
 <script>
   import {getList, getDetail, add, update, remove, perfect} from "@/api/groupon/groupon";
   import {mapGetters} from "vuex";
+  import {goodsTableOption} from "../../option/groupon/grouponPerfact"
 
   export default {
     data() {
       return {
+        goodsTableOption: goodsTableOption,
+        tableData: [],
         form: {},
         query: {},
         loading: true,
@@ -172,6 +191,16 @@
               },
               action: "/api/blade-resource/oss/endpoint/put-file-attach"
             },
+            {
+              label: "团购商品",
+              prop: "goods",
+              labelWidth: 120,
+              span: 24,
+              fromslot: true,
+              // editDisplay: false,
+              // viewDisplay: false,
+              hide: true
+            },
           ]
         },
         data: []
@@ -210,6 +239,11 @@
         });
       },
       rowUpdate(row, index, done, loading) {
+        this.tableData.forEach(e => {
+          e.sort = e.$index;
+        })
+        console.log("2--", this.tableData)
+        row.goodsList = this.tableData;
         perfect(row).then(() => {
           this.onLoad(this.page);
           this.$message({
@@ -263,8 +297,22 @@
       },
       beforeOpen(done, type) {
         if (["edit", "view"].includes(type)) {
+          this.tableData = [];
           getDetail(this.form.id).then(res => {
             this.form = res.data.data;
+            res.data.data.goodsList.forEach(e => {
+              let goods = {
+                id: e.id,
+                goodsId: e.id,
+                goodsName: e.goodsName,
+                goodsCover: e.goodsCover,
+                goodsSpec: e.goodsSpec,
+                supplierName: e.supplierName,
+                grouponPrice: e.grouponPrice
+              }
+              this.tableData.push(goods)
+            })
+            console.log("1--", this.tableData)
           });
         }
         done();
@@ -309,6 +357,14 @@
         this.$message.error('上传失败:' + error)
         console.log(error, column)
       },
+      /**
+       * 删除商品
+       * @param row
+       * @param index
+       */
+      rowDelGoods(row, index) {
+        this.tableData.splice(index, 1);
+      },
     }
   };
 </script>