Browse Source

下推页面

lilei 1 year ago
parent
commit
147d506ef0
1 changed files with 96 additions and 22 deletions
  1. 96 22
      src/views/salesManagement/waitDispatchNew/queryPart.vue

+ 96 - 22
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -4,17 +4,17 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
+          <a-col :md="4" :sm="24">
             <a-form-item label="产品名称">
               <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24">
+          <a-col :md="4" :sm="24">
             <a-form-item label="产品编码">
               <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24">
+          <!-- <a-col :md="6" :sm="24">
             <a-form-item label="是否促销品">
               <v-select
                 code="FLAG"
@@ -24,8 +24,8 @@
                 placeholder="请选择是否"
               ></v-select>
             </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
+          </a-col> -->
+          <a-col :md="4" :sm="24">
             <a-form-item label="类型">
               <a-select v-model.trim="queryParam.ptype" :dropdownMatchSelectWidth="false" >
                 <a-select-option value="0">
@@ -43,13 +43,13 @@
               </a-select>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24">
+          <a-col :md="4" :sm="24">
             <a-form-item label="出库仓库">
               <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
             </a-form-item>
           </a-col>
-          <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-            <a-button type="primary" class="button-info" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+          <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" class="button-info" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
           </a-col>
         </a-row>
@@ -91,6 +91,7 @@
               :table-data="dataSource"
               row-key-field-name="id"
               :cell-style-option="cellStyleOption"
+              :cell-span-option="cellSpanOption"
               :column-width-resize-option="columnWidthResizeOption"
             />
         <div v-show="showEmpty" class="empty-data">暂无数据</div>
@@ -146,13 +147,22 @@ export default {
       spinning: false,
       dataSource: [],
       tableHeight: this.maxHeight,
-      cellStyleOption: {},
+      cellStyleOption: {
+        bodyCellClass: ({ row, column, rowIndex }) => {
+            if (row.id.indexOf('promo-')>=0 && column.field === "no") {
+                return "table-body-cell-no";
+            }
+        },
+      },
       columnWidthResizeOption: {
           // default false
           enable: true,
           // column resize min width
           minWidth: 50
       },
+      cellSpanOption: {
+          bodyCellSpan: this.bodyCellSpan,
+      },
       showEmpty: false,
       showTableHead: true
     }
@@ -223,8 +233,33 @@ export default {
         }
         return '--'
       }
+      // 编号,并且格式化活动分类行
+      const noFormat = function(record,data,h){
+        return (
+          <div>
+            {record.id.indexOf('promo-')>=0 ? (
+              <div class="active-title">
+                {record.promo?(
+                  <div>
+                    <strong style="margin-right:10px;font-size:14px;">{record.promo.promotion.title} ({record.promo.promotionRule.description})</strong>
+                    <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick="(event) => {showDesc(event, item)}">
+                      <a-icon title="查看活动详情" type="eye"/> 活动详情
+                    </span>
+                  </div>
+                ):(<div></div>)}
+                <div>
+                    总售价:<strong>12333</strong>;
+                    总款数:<strong>22</strong>;
+                    总数量:<strong>134</strong>;
+                </div>
+              </div>
+            ):(<span>{data}</span>)}
+          </div>
+        )
+      }
+
       let arr= [
-            { title: '序号', field: 'no',key: "a", width: 50, align: 'center', fixed: 'left',operationColumn: false },
+            { title: '序号', field: 'no',key: "a", width: 50, align: 'center', operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row,row[column.field],h)} },
             { title: '产品编码', field: 'productCode',key: "b", width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
             { title: '产品名称', field: 'productName',key: "c", width: 250, align: 'center',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
             { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'center',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
@@ -245,16 +280,28 @@ export default {
           { title: '已下推', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
           { title: '待下推', field: 'surplusQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
           { title: '取消数量', field: 'surplusQty', width: 80,key: "r", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
-          { title: '操作', field: 'action', width: 80,key: "s", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
+          { title: '操作', field: 'action', width: 80,key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
         ])
       
       return arr
     }
   },
   methods: {
-    // 表格选中项
-    rowSelectionFun (obj) {
-      this.rowSelectionInfo = obj || null
+    // 合并活动分类单元格
+    bodyCellSpan({ row, column, rowIndex }) {
+      if (row.id.indexOf('promo-')>=0) {
+        if(column.field=='no'){
+          return {
+                    rowspan: 1,
+                    colspan: 16,
+                };
+        }else{
+          return {
+                rowspan: 0,
+                colspan: 0,
+            }
+        }
+      }
     },
     // 获取销售单参与的活动列表
     getActiveList(){
@@ -269,12 +316,17 @@ export default {
     },
     async searchTable(){
         this.disabled = true
+        this.spinning = true
         this.queryParam.salesBillSn = this.salesBillSn
         this.queryParam.showStock = true
         const params = this.queryParam
         // 正常产品
-        const list0 = await salesDetailAllList(params).then(res => res.data)
-        const list1 = [], active = this.activeList;
+        const proList = await salesDetailAllList(params).then(res => res.data)
+        let listData = [{
+            id: 'promo-normal',
+            // total: norTotal
+          },...proList]
+        const active = this.activeList
         // 活动产品
         for(let i=0;i<active.length;i++){
           const promo = active[i]
@@ -285,19 +337,23 @@ export default {
           const aclist = await salesDetailAllList(params).then(res => res.data)
           // 获取活动产品统计
           //const acTotal = await salesDetailCount(params).then(res => res.data)
-          list1[i] = [{
+          const retList = [{
+            id: 'promo-'+i,
             promo: promo,
             // total: acTotal
           },...aclist]
+
+          listData = aclist&&aclist.length ? listData.concat(retList) : listData
         }
 
-        console.log(list0)
-        console.log(list1)
-        this.dataSource = list0
+        console.log(listData)
+        this.dataSource = listData
 
         // 格式化数据
-        this.dataSource.map(item => {
-          data[i].no = no + i + 1
+        let f = 0
+        this.dataSource.map((item,i) => {
+          if(item.id.indexOf('promo-')>=0){f = f - 1}
+          item.no = i + 1 + f
           const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
           const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
           const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
@@ -307,6 +363,9 @@ export default {
           item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
           item.productOrigUnit = productOrigUnit || '--'
         })
+        this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
+        this.spinning = false
+        this.disabled = false
     },
     //  重置
     resetSearchForm () {
@@ -401,3 +460,18 @@ export default {
   }
 }
 </script>
+<style lang="less">
+.ve-table-body-td{
+  .active-title{
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 10px;
+    background: #f3f8fa;
+  }
+}
+.ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no, 
+.ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
+  padding: 0;
+} 
+</style>