Browse Source

商品管理新增添加商品组

qymljy 2 years ago
parent
commit
6ad10bc8e7

+ 1 - 1
src/HDrpManagement/ProductMag/detail/index.vue

@@ -92,7 +92,7 @@
         </saleClass>
       </div>
       <div slot="slot2">
-        <productGroup ref="productGroup" :data="mainData">
+        <productGroup :data="mainData">
         </productGroup>
       </div>
       <div slot="slot3">

+ 25 - 16
src/HDrpManagement/ProductMag/modules/productGroup.vue

@@ -1,25 +1,33 @@
 <template>
   <div>
-    <el-table
-      :data="list"
-      style="width: 100%"
-      size="small"
-      border>
-      <el-table-column
-        prop="groupnum"
-        label="商品组号">
-      </el-table-column>
-      <el-table-column
-        prop="groupname"
-        label="商品组名称">
-      </el-table-column>
-    </el-table>
+    <productGroupAdd v-if="tool.checkAuth($route.name,'addGroup')" :data="data" @onSuccess="listData"></productGroupAdd>
+    <div style="margin-top: 15px">
+      <el-table
+          :data="list"
+          style="width: 100%"
+          size="small"
+          border>
+        <el-table-column
+            prop="groupnum"
+            label="商品组号">
+        </el-table-column>
+        <el-table-column
+            prop="groupname"
+            label="商品组名称">
+        </el-table-column>
+      </el-table>
+    </div>
+
   </div>
 </template>
 
 <script>
+import productGroupAdd from "@/HDrpManagement/ProductMag/modules/productGroupAdd";
 export default {
-  name: "productPrice",
+  props:['data'],
+  components:{
+    productGroupAdd
+  },
   data(){
     return {
       tablecols:[],
@@ -30,6 +38,7 @@ export default {
           "pageNumber": 1,
           "pageSize": 99999999,
           "itemid": '',
+          "isexist":0,
           "where": {
               "condition": ""
           }
@@ -48,7 +57,7 @@ export default {
     this.listData()
   },
   created() {
-    this.tablecols = this.tool.tabelCol(this.$route.name)['commodityPriceGradeTable'].tablecols
+    // this.tablecols = this.tool.tabelCol(this.$route.name)['commodityPriceGradeTable'].tablecols
   }
 }
 </script>

+ 191 - 0
src/HDrpManagement/ProductMag/modules/productGroupAdd.vue

@@ -0,0 +1,191 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" @click="onShow">添加商品组</el-button>
+    <el-drawer
+        title="设置商品组"
+        :visible.sync="drawer"
+        size="700px"
+        direction="rtl"
+        append-to-body
+        :show-close="false">
+      <div class="drawer__panel">
+        <el-row>
+          <el-col :span="3">
+              <span style="font-size: 14px">选择商品组</span>
+          </el-col>
+          <el-col :span="10">
+            <el-input size="small" v-model="param.content.where.condition" placeholder="输入商品组名称" @change="listData"></el-input>
+          </el-col>
+        </el-row>
+        <el-row style="margin-top: 20px" v-if="list.length === 0">
+          <el-col :span="7">
+            <el-select v-model="sa_brandid" placeholder="请选择品牌" style="width: 100%" size="small" @change="brandChange">
+              <el-option v-for="item in brandList" :key="item.sa_brandid" :label="item.brandname"
+                         :value="item.sa_brandid" >
+              </el-option>
+            </el-select>
+          </el-col>
+          <el-col :span="7">
+            <el-input size="small" v-model="sequence" style="margin-left: 16px" placeholder="输入序号" ></el-input>
+          </el-col>
+          <el-col :span="5">
+            <el-button size="small" style="margin-left: 32px"  type="primary" @click="creatGroup">创建商品组</el-button>
+          </el-col>
+        </el-row>
+        <el-row>
+          <div style="margin-top: 20px">
+            <el-table
+                @row-click="rowClick"
+                :data="list"
+                style="width: 100%"
+                size="small"
+                border>
+              <el-table-column
+                  prop="groupnum"
+                  label="商品组编码">
+              </el-table-column>
+              <el-table-column
+                  prop="groupname"
+                  label="商品组名称">
+              </el-table-column>
+              <el-table-column
+                  prop="createdate"
+                  label="创建时间">
+              </el-table-column>
+              <el-table-column
+                  prop="brandname"
+                  label="品牌">
+              </el-table-column>
+            </el-table>
+            <div  class="container normal-panel" style="text-align:right">
+              <el-pagination
+                  background
+                  @size-change="handleSizeChange"
+                  @current-change="handleCurrentChange"
+                  :current-page="currentPage"
+                  :page-sizes="[20, 50, 100, 200]"
+                  :page-size="20"
+                  layout="total,sizes, prev, pager, next, jumper"
+                  :total="total">
+              </el-pagination>
+            </div>
+          </div>
+        </el-row>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "productGroupAdd",
+  props:['data'],
+  data() {
+    return {
+      drawer:false,
+      list:[],
+      total:0,
+      currentPage:0,
+      brandList:[],
+      sa_brandid:'',
+      sequence:'',
+      param:{
+        id:'20221216102302',
+        content:{
+          "itemid":'',
+          "isexist":1,
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where":{
+            "condition":''
+          }
+        }
+      }
+    }
+  },
+  methods:{
+    onShow(){
+      this.drawer = true
+      this.listData()
+      this.queryBrand()
+    },
+    async listData(){
+      this.param.content.itemid = this.$route.query.id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    selectChange(){
+     this.listData()
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+    rowClick(val){
+      console.log(val,'选择商品组')
+      this.onSubmit(val)
+    },
+    async onSubmit(item){
+      const res = await this.$api.requested({
+        "id":20230331094304,
+        "content":{
+          "itemid":this.$route.query.id,
+          "itemno":this.data.itemno,
+          "sa_itemgroupid":item.sa_itemgroupid,
+          "sa_brandid":item.sa_brandid,
+          "groupname":item.groupname,
+          "sequence":item.sequence
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.drawer = false
+        this.$emit('onSuccess')
+      })
+    },
+    onClose(){
+      this.param.content.where.condition = ''
+      this.drawer = false
+      this.$emit('onSuccess')
+    },
+    /*获取品牌*/
+    async queryBrand(){
+      const res = await this.$api.requested({
+        "id":20220922085103,
+        "content":{}
+      })
+      this.brandList = res.data
+    },
+    /*创建商品组*/
+    creatGroup(){
+      console.log(this.sa_brandid)
+      if (this.sa_brandid !== '' && this.sequence !== ''){
+        const item = {
+          "sa_itemgroupid":0,
+          "sa_brandid":this.sa_brandid,
+          "groupname":this.param.content.where.condition,
+          "sequence":this.sequence
+        }
+        this.onSubmit(item)
+      }else {
+        this.$message.error('品牌和序号不能为空');
+      }
+
+    },
+    brandChange(){
+      console.log(this.sa_brandid,'brand')
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 2
vue.config.js

@@ -15,8 +15,8 @@ module.exports = {
       proxy: {
         '/apis': {
           // target: 'http://61.164.207.46:8000',  // target host*/
-          // target: 'http://192.168.3.9:8090',  // target host*!
-          target: 'https://oms.idcgroup.com.cn:8079/',  // target host
+          target: 'http://192.168.3.9:8090',  // target host*!
+          // target: 'https://oms.idcgroup.com.cn:8079/',  // target host
           // target: 'localhost:8080',  // target host
           ws: true,  // proxy websockets 
           changeOrigin: true,  // needed for virtual hosted sites