Просмотр исходного кода

Merge branch 'xiaoqin' into mergeBranch

codeMan 2 лет назад
Родитель
Сommit
cf6db06015

+ 1 - 1
src/HDrpManagement/ProductGroupMag/modules/addGroupDetail.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-button type="text" size="small" @click="detailBtn">明细</el-button>
-    <el-dialog title="产品组明细" append-to-body :visible.sync="dialogTableVisible" width="70%">
+    <el-dialog title="产品组商品明细" append-to-body :visible.sync="dialogTableVisible" width="70%">
       <add-btn v-if="tool.checkAuth($route.name,'insert')" @onSuccess="getDetail" style="margin-bottom:16px" :id="rowData.sa_itemgroupid" />
       <tableLayout v-if="dialogTableVisible" :layout="tablecols" :data="list" :opwidth="200" :custom="true" height="40vh" fixedName="operation">
         <template v-slot:customcol="scope">

+ 33 - 57
src/HDrpManagement/ProductGroupMag/modules/addGroupDetailBtn.vue

@@ -1,23 +1,13 @@
 <template>
   <div>
-    <el-button type="primary" size="small" @click="dialogTableVisible=true">新增明细</el-button>
-    <el-dialog title="产品组明细" append-to-body :visible.sync="dialogTableVisible" width="30%">
-      <el-form label-position="right" ref="form" :rules="rules" inline label-width="100px" :model="form" size="small">
-        <el-form-item label="商品" prop="product">
-          <el-select v-model="form.product" multiple placeholder="请选择商品">
-            <el-option
-              v-for="item in productList()"
-              :key="item.itemid"
-              :label="item.itemname"
-              :value="item.itemid">
-            </el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
+    <el-button type="primary" size="small" @click="dialogTableVisible=true">新增商品</el-button>
+    <el-dialog title="产品组商品新增" append-to-body :visible.sync="dialogTableVisible" width="50%">
+      <table1 v-if="productList()" @checkboxCallBack="checkboxCallBack" :layout="tablecols" :data="productList()" :opwidth="200" :custom="false" :height="300" :checkbox="true">
+      </table1>
       <span slot="footer" class="dialog-footer">
         <div>
           <el-button @click="dialogTableVisible = false" size="small">取 消</el-button>
-          <el-button type="primary" @click="submit" size="small">确 定</el-button>
+          <el-button type="primary" @click="submit" size="small" :disabled="product.length == 0">确 定</el-button>
         </div>
       </span>
     </el-dialog>
@@ -26,18 +16,13 @@
 
 <script>
 import { log } from '@antv/g2plot/lib/utils'
+import table1 from '@/components/table/index'
 export default {
   data () {
     return {
       dialogTableVisible:false,
-      form: {
-        product:[]
-      },
-      rules: {
-        product: [
-          { required: true, message: '请选择商品', trigger: 'blur' },
-        ],
-      }
+      product:[],
+      tablecols:[]
     }
   },
   inject: ['productList'],
@@ -45,39 +30,39 @@ export default {
   watch: {
     
   },
+  components:{table1},
   created() {
-    
+    this.tablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
   },
   methods: {
-    submit() {
-     this.$refs.form.validate(async val => {
-        if(val) {
-          this.form.product = this.form.product.map(item => {
-            return {
-              sa_itemgroupmxid:0,
-              itemid:item
-            }
-          })
-          let res = await this.$api.requested({
-            "accesstoken": "69f1a508bad99ddffdce4bc3c919a0d0",
-            "id": "20220923110303",
-            "version":1,
-            "content": {
-              "sa_itemgroupid":this.id,
-              "itemclassinfos":this.form.product
-            }
-          })
-          this.tool.showMessage(res,() => {
-            this.dialogTableVisible = false
-            this.$emit('onSuccess')
-          })
+    async submit() {
+      if(this.product.length == 0) return
+      this.product = this.product.map(item => {
+        return {
+          sa_itemgroupmxid:0,
+          itemid:item.itemid
+        }
+      })
+      let res = await this.$api.requested({
+        "accesstoken": "69f1a508bad99ddffdce4bc3c919a0d0",
+        "id": "20220923110303",
+        "version":1,
+        "content": {
+          "sa_itemgroupid":this.id,
+          "itemclassinfos":this.product
         }
-     })
+      })
+      this.tool.showMessage(res,() => {
+        this.dialogTableVisible = false
+        this.$emit('onSuccess')
+      })
     },
     handleClose(tag) {
       this.form.tag.splice(this.form.tag.indexOf(tag), 1);
     },
-    
+    checkboxCallBack(data) {
+      this.product = data
+    }
   }
 }
 
@@ -93,13 +78,4 @@ export default {
 /deep/.el-form-item__content {
   width: calc(100% - 100px) !important;
 }
-/deep/.el-select {
-  width: 100% !important;
-}
-/deep/.el-form-item {
-  width: 100% !important;
-}
-/deep/.el-input{
-  width: 100% !important;
-}
 </style>

+ 1 - 1
src/HDrpManagement/ProductGroupMag/modules/down.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="inline-16">
     <el-popconfirm title="确定下架当前数据吗?" @confirm="deleteRow()">
-      <el-button slot="reference" size="small" type="text" v-if="type=='one'">下 架</el-button>
+      <el-button slot="reference" size="small" type="text" v-if="type=='one'">下架</el-button>
       <el-button slot="reference" size="small" type="warning" v-else>批量下架</el-button>
     </el-popconfirm>
   </div>

+ 199 - 0
src/SDrpManagement/ProductGroup/index.vue

@@ -0,0 +1,199 @@
+<template>
+  <div class="group container normal-panel normal-margin">
+    <selectClass @brandChange="brandChange" @Search="Search" @clearSearch="clearSearch" :default="true"></selectClass>
+    <div class="content" v-if="Object.keys(productGroup).length > 0">
+      <div class="group-list">
+        <div class="group-item" v-for="item in productGroup" :key="item.sa_itemgroupid" @click="itemClick(item)">
+          <div class="top">
+            <el-image :src="Object.keys(item.attinfos).length > 0 ? item.attinfos[0].url : ''" fit="fill" />
+          </div>
+          <div class="bottom">
+            <p class="title">商品组名称:{{item.groupname}}</p>
+            <p class="descript">商品组编号:{{item.groupnum}}</p>
+            <p class="descript">所属营销分类:{{item.itemclassname}}</p>
+          </div>
+        </div>
+      </div>
+      <div class="page">
+        <pagination style="padding-bottom:0" :total="total" :pageSize="params.content.pageSize" :currentPage="params.content.pageNumber"
+          @pageChange="pageChange">
+        </pagination>
+      </div>
+      
+    </div>
+    <el-empty description="暂无数据" v-else></el-empty>
+    
+  </div>
+</template>
+
+<script>
+import selectClass from './modules/Select'
+import Pagination from '@/components/pagination/Pagination'
+import { log } from '@antv/g2plot/lib/utils';
+export default {
+  name: '',
+  data() {
+    return {
+      brandList:'',
+      brandId:0,
+      tablecols:[],
+      productGroup:'',
+      params: {
+        "id": "20220926142203",
+        "version":1,
+        "content": {
+          "pageSize":20,
+          "pageNumber":1,
+          "nocache":true,
+          "brandids":[],
+          "where":{
+              "condition":""
+          }
+        }
+      },
+      total:0,
+    };
+  },
+  components:{selectClass,Pagination},
+  computed:{
+  },
+  watch:{
+  },
+  created() {
+    this.getbrandList()
+    this.tablecols = this.tool.tabelCol(this.$route.name).productGroupTable.tablecols
+  },
+  methods: {
+    /* 获取品牌数据 */
+    async getbrandList() {
+      let res = await this.$api.requested({
+        "id": "20220922085103",
+        "version":1,
+        "content": {
+          "nocache":true,
+          "where":{
+              "condition":""
+          }
+        }
+      })
+      this.brandList = res.data.map(item => {
+        return {
+          label:item.brandname,
+          value:item.sa_brandid
+        }
+      })
+      this.brandId = this.brandList ? [this.brandList[0].value] : [0]
+      this.getProductGroup()
+      console.log(this.brandList,'品牌');
+    },
+    async getProductGroup() {
+      this.params.content.brandids = this.brandId
+      let res = await this.$api.requested(this.params)
+      this.productGroup = res.data
+      this.total = res.total
+      console.log(this.productGroup);
+    },
+    itemClick(id) {
+      this.$router.push({
+        path:'/groupDetail',
+        query: {
+          id:id.sa_itemgroupid,
+          brandid:id.sa_brandid
+        }
+      })
+    },
+    brandChange(id) {
+      this.brandId = id
+      this.getProductGroup()
+    },
+    pageChange(n) {
+      this.params.content.pageNumber = n
+      this.getProductGroup()
+    },
+    Search(data) {
+      this.params.content.where.condition = data
+      this.params.content.pageNumber = 1
+      this.getProductGroup()
+    },
+    clearSearch() {
+      this.params.content.where.condition = ''
+      this.params.content.pageNumber = 1
+      this.getProductGroup()
+    }
+  },
+};
+</script>
+
+<style scoped>
+*{
+  box-sizing: border-box;
+}
+.group .group-list {
+  display: flex;
+  flex-wrap: wrap;
+  margin-top: 16px;
+}
+.group .group-list .group-item {
+  width: 212px;
+  height: 250px;
+  background: #ffffff;
+  transition: all 0.1s ease-in;
+  margin: 0 16px 16px 0;
+  cursor: pointer;
+  border: 1px solid rgb(0,0,0,0.5);
+  overflow: hidden;
+}
+.group .group-list .group-item:hover {
+  border-color: red;
+}
+.group .group-list .group-item .el-image {
+  transition: transform 0.3s;
+}
+.group .group-list .group-item:hover .top .el-image {
+  transform: scale(1.3);
+}
+.group .group-list .group-item .top {
+  width: 212px;
+  height: 150px;
+  border-top-right-radius: 4px;
+  border-top-left-radius: 4px;
+  overflow: hidden;
+  display: flex;
+  justify-content: space-around;
+}
+.group .group-list .group-item .bottom {
+  padding: 10px 18px 10px 16px;
+}
+.group .group-list .group-item .bottom .title {
+  font-size: 14px;
+  font-family: PingFang SC-Bold, PingFang SC;
+  font-weight: bold;
+  color: #333333;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  width: 100%;
+  margin-bottom: 5px;
+}
+.group .group-list .group-item .bottom .descript {
+  font-size: 12px;
+  font-family: PingFang SC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #666666;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  width: 100%;
+  margin-bottom: 4px;
+}
+.group .group-list .group-item .bottom .people {
+  font-size: 10px;
+  font-family: PingFang SC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #999999;
+}
+.page {
+  display: flex;
+  flex-direction: row-reverse;
+}
+</style>

+ 185 - 0
src/SDrpManagement/ProductGroup/modules/GroupDetail/groupDetail.vue

@@ -0,0 +1,185 @@
+<template>
+  <div class="detail normal-panel" v-if="selectProduct">
+    <div class="left">
+      <el-image :src="selectProduct.attinfos[0].url" fit="fill"></el-image>
+    </div>
+    <div class="right container">
+      <div class="header">
+        <p class="title">{{selectProduct.itemname}}</p>
+        <p class="code"><span class="small">编号:</span>{{selectProduct.itemno}}</p>
+        <div class="price">
+          <span class="small">价格:</span>
+          <div class="number">
+            <span class="new">¥<span style="font-size:24px">{{this.selectProduct.gradeprice}}</span></span>
+            <span class="small"><span
+                class="old">¥{{selectProduct.oldprice}}</span>{{`(/${this.selectProduct.unitname})`}}</span>
+          </div>
+        </div>
+      </div>
+      <div class="count-box">
+        <span class="small">数量:</span>
+        <div class="count-handle">
+          <el-input-number size="small" v-model="count" @change="countChange" :min="1"></el-input-number>
+        </div>
+      </div>
+      <div class="type">
+        <span class="small">型号</span>
+        <div class="content">
+          <el-tag @click="typeClick(item)" v-for="(item,index) in detail" :key="index"
+            :style="selectProduct.itemno == item.itemno ? 'background:#2b3e68;color:#ffffff' : ''">{{item.model}}
+          </el-tag>
+        </div>
+      </div>
+      <div class="shopping">
+        <el-button size="small" type="primary" icon="el-icon-shopping-cart-1" @click="addCart">加入购物车</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { log } from '@antv/g2plot/lib/utils';
+export default {
+  name: '',
+  data () {
+    return {
+      detail: '',
+      count: 1,
+      selectProduct: ''
+    };
+  },
+  computed: {
+  },
+  watch: {
+  },
+  created () {
+    this.getDetail()
+  },
+  methods: {
+    async getDetail () {
+      let res = await this.$api.requested({
+        "id": "20220926142403",
+        "version": 1,
+        "content": {
+          "sa_itemgroupid": this.$route.query.id
+        }
+      })
+      this.detail = res.data
+      this.selectProduct = this.detail ? this.detail[0] : ''
+      console.log(this.selectProduct);
+
+    },
+    countChange (num) {
+      this.count = num
+      console.log(this.count, '数量');
+    },
+    typeClick (data) {
+      console.log(data);
+      this.selectProduct = data
+      this.count = 1
+    },
+    
+    async addCart () {
+      let res = await this.$api.requested({
+        "id": 20220924095102,
+        "content": {
+          "sa_brandid": this.$route.query.brandid, //品牌id
+          "itemid": this.selectProduct.itemid, //货品id
+          "qty": this.count, //数量
+          "itemno": this.selectProduct.itemno //货品编号
+        },
+      })
+      console.log(res);
+
+      if (res.code == 1) {
+        this.$message({
+          message: '加入购物车成功',
+          type: 'success'
+        })
+      }
+    }
+  },
+};
+</script>
+
+<style scoped>
+* {
+  box-sizing: border-box;
+}
+.detail {
+  height: calc(100vh - 100px);
+  display: flex;
+  padding: 10px 10px 0 10px;
+}
+.detail .left {
+  flex: 1.5;
+  height: 100%;
+  border: 1px solid rgba(0, 0, 0, 0.05);
+}
+.detail .right {
+  flex: 3;
+  height: 100%;
+}
+.detail .right .header {
+  padding-bottom: 12px;
+  border-bottom: 1px solid #cccccc;
+}
+.detail .right .header .title {
+  font-size: 20px;
+  font-weight: 700;
+}
+.detail .right .header .code {
+  color: #0250a3;
+  height: 50px;
+  line-height: 50px;
+}
+.detail .right .header .price {
+  display: flex;
+  height: 50px;
+  line-height: 50px;
+}
+.detail .right .header .price .number {
+}
+.detail .right .header .price .number .new {
+  color: #dc3545;
+  font-size: 12px;
+  margin-right: 12px;
+}
+.detail .right .header .price .number .old {
+  text-decoration: line-through;
+}
+
+.detail .right .count-box {
+  display: flex;
+  align-items: center;
+  height: 80px;
+  border-bottom: 1px solid #cccccc;
+  padding: 12px 0;
+  margin-bottom: 10px;
+}
+
+.detail .right .type {
+  display: flex;
+}
+.detail .right .type .content {
+  display: flex;
+  flex-wrap: wrap;
+  min-height: 100px;
+  max-height: 300px;
+  overflow-y: scroll;
+  width: 100%;
+}
+.detail .right .type .content .el-tag {
+  margin: 0 10px 10px 0;
+  cursor: pointer;
+}
+.detail .right .shopping {
+  padding-left: 100px;
+}
+
+.small {
+  font-size: 12px;
+  color: #a7a7a9;
+  width: 100px;
+}
+</style>

+ 81 - 0
src/SDrpManagement/ProductGroup/modules/Select.vue

@@ -0,0 +1,81 @@
+<template>
+  <div class="container border-bottom">
+    <div class="flex-align-center flex-between normal-margin">
+      <ul class="flex-align-center">
+        <li :class="brand_act === item.sa_brandid?'act':''" class="brand-item" v-for="item in brands" :key="item.sa_brandid" @click="clickBrand(item.sa_brandid)">{{item.brandname}}</li>
+      </ul>
+      <div class="flex-align-center">
+        <el-input size="small" v-model="value" placeholder="产品名称,编号0" @clear="clearSearch" @keyup.enter.native="change" clearable></el-input>&nbsp;
+        <slot name="add"></slot>
+      </div>
+    </div>
+    <div>
+
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data () {
+    return {
+      value:'',
+      brands:[],
+      brand_act:this.default ? this.brands ? this.brands[0].sa_brandid : 0 : 0
+    }
+  },
+  props: {
+    default: {
+      type: Boolean,
+      default:() => false
+    }
+  },
+  methods:{
+    async queryBrands () {
+      const res = await this.$api.requested({
+        "id": "20220922085103",
+        "version":1,
+        "content": {
+          "pageSize":1000,
+          "where":{
+            "condition":""
+          }
+        }
+      })
+      this.brands = res.data
+    },
+    clickBrand (id) {
+      this.brand_act = id
+      
+      this.$emit('brandChange',[id])
+    },
+    change(n) {
+      this.$emit('Search',this.value)
+    },
+    clearSearch() {
+      this.$emit('clearSearch')
+    }
+  },
+  mounted () {
+    this.queryBrands()
+  }
+}
+
+</script>
+<style>
+</style>
+<style scoped>
+.brand-item{
+  margin-right: 20px;
+  color: #768093;
+  cursor: pointer;
+  transition: .2s all linear;
+  font-size: 14px;
+}
+.act{
+  color:#000;
+}
+.border-bottom{
+  border-bottom: 1px solid #e3e5ea;
+}
+</style>

+ 20 - 6
src/components/down_select/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="select1">
     <p>{{title}}</p>
-    <el-select v-model="result" clearable @clear="clearCatory" placeholder="请选择" size="small" @change="change" width="100px">
+    <el-select v-model="result" :multiple="multiple" clearable @clear="clearCatory" placeholder="请选择" size="small" @change="change" :width="width">
       <el-option
         v-for="item in list"
         :key="item.value"
@@ -13,17 +13,34 @@
 </template>
 
 <script>
+import { log } from '@antv/g2plot/lib/utils';
 export default {
   name: '',
   data() {
     return {
-      result:this.default == true ? this.list[0] ? this.list[0].value : '' : ''
+      result:this.defalut == true ? this.list[0] ? [this.list[0].value] : '' : ''
     };
   },
-  props:['title','list','default'],
+  props: {
+    title: String,
+    list: Array,
+    defalut: Boolean,
+    multiple: {
+      type: Boolean,
+      default:() => false
+    },
+    width: {
+      type: String,
+      default:() => '100px'
+    }
+  },
   computed:{
   },
   watch:{
+  },
+  mounted() {
+    console.log(this.list);
+    
   },
   methods: {
     change() {
@@ -46,7 +63,4 @@ export default {
     font-size: 14px;
     color: #666666;
   }
-  /deep/.el-select {
-    width: 150px !important;
-  }
 </style>

+ 21 - 1
src/router/SDrpManagement.js

@@ -9,7 +9,7 @@ const SDrpManagement = [
     component: () => import(/* webpackChunkName: "about" */ '@/SDrpManagement/Products/index.vue')
   },
   {
-    path: '/ProductDetails',
+    path: '/ProductDetais',
     name: 'products',
     meta: {
       title: '商品详情',
@@ -18,5 +18,25 @@ const SDrpManagement = [
     },
     component: () => import(/* webpackChunkName: "about" */ '@/SDrpManagement/Products/modules/ProductDetails.vue')
   },
+  {
+    path: '/productgroup',
+    name: 'productgroup',
+    meta: {
+      title: '商品组查询',
+      ast_nav:true,
+      keeproute: true
+    },
+    component: () => import(/* webpackChunkName: "about" */ '@/SDrpManagement/ProductGroup/index')
+  },
+  {
+    path: '/groupDetail',
+    name: 'groupDetail',
+    meta: {
+      title: '商品详情',
+      ast_nav:true,
+      keeproute: true
+    },
+    component: () => import(/* webpackChunkName: "about" */ '@/SDrpManagement/ProductGroup/modules/GroupDetail/groupDetail')
+  }
 ]
 export default SDrpManagement