lilei 1 gadu atpakaļ
vecāks
revīzija
5ab7181568

+ 21 - 72
src/api/salesDetailNew.js

@@ -16,6 +16,14 @@ export const salesDetaiCount = (params) => {
     method: 'post'
   })
 }
+// 活动产品统计
+export const salesPromoDetailCount = (params) => {
+  return axios({
+    url: `/salesPromo/detail/queryCount`,
+    data: params,
+    method: 'post'
+  })
+}
 // 批量删除
 export const salesDetailBatchDel = (params) => {
   return axios({
@@ -116,70 +124,27 @@ export const salesDisablePromo = params => {
     })
   }
  
-
-// 缺货明细
-export const salesStockoutDetail = (params) => {
-  const url = `/sales/detail/queryPageStock`
-  delete params.pageNo
-  delete params.pageSize
-  return axios({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
- 
 // 修改销售明细取消数量
 export const salesDetailUpdateCancelQty = (params) => {
   return axios({
-    url: '/sales/detail/updateBatchCancelQty',
+    url: '/salesn/detail/cancleOfBatch',
     data: params,
     method: 'post'
   })
 }
 
-// 获取产品适用活动的促销产品列表
-export const getPromoGoodsList = (params) => {
-  const url = `/sales/detail/getPromoGoodsList/${params.pageNo}/${params.pageSize}`
-  delete params.pageNo
-  delete params.pageSize
-  return axios({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
+// 批量新增代发货信息
+export const insertBatchOfWaitDispatch = (params) => {
+    return axios({
+      url: '/salesn/detail/pushOfBatch',
+      data: params,
+      method: 'post'
+    })
+  }
 
-// 批量添加促销品
-export const addPromoGoods = (params) => {
-  return axios({
-    url: `/sales/detail/addPromoGoods`,
-    data: params,
-    method: 'post'
-  })
-}
-// 促销产品统计  列表  分页
-export const salesDetailPromoList = (params) => {
-  const url = `/sales/detail/queryPageByPromo/${params.pageNo}/${params.pageSize}`
-  delete params.pageNo
-  delete params.pageSize
-  return axios({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
-// 促销产品统计  合计
-export const salesDetailPromoCount = (params) => {
-  return axios({
-    url: `/salesPromo/queryCount`,
-    data: params,
-    method: 'post'
-  })
-}
-// 促销产品统计  详情  列表  分页
-export const salesDetailPromoProductList = (params) => {
-  const url = `/sales/detail/queryPageOfPromoProduct/${params.pageNo}/${params.pageSize}`
+// 缺货明细
+export const salesStockoutDetail = (params) => {
+  const url = `/sales/detail/queryPageStock`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -211,20 +176,4 @@ export const exportGroupStockout = params => {
     responseType: 'blob'
   })
 }
-// 批量新增代发货信息
-export const insertBatchOfWaitDispatch = (params) => {
-    return axios({
-      url: '/sales/detail/insertBatchOfWaitDispatch',
-      data: params,
-      method: 'post'
-    })
-  }
-  
-// 一键发货
-export const salesDetailDispatchByOneKey = (params) => {
-    return axios({
-    url: `/sales/detail/dispatchByOneKey/${params.salesBillSn}`,
-    data: params,
-    method: 'post'
-    })
-}
+

+ 17 - 0
src/api/salesNew.js

@@ -72,6 +72,14 @@ export const salesPromoQueryList = (params) => {
         method: 'post'
     })
 }
+// 更换促销,可更换活动列表
+export const salesPromoMatchProduct = (params) => {
+  return axios({
+      url: `/salesPromo/queryMatchProduct`,
+      data: params,
+      method: 'post'
+  })
+}
 // 判断是否有新的活动
 export const salesQueryUnPartPromo = (params) => {
   return axios({
@@ -80,6 +88,15 @@ export const salesQueryUnPartPromo = (params) => {
       method: 'post'
   })
 }
+// 活动优惠明细接口
+export const salesPromoQueryCount = (params) => {
+  return axios({
+      url: `/salesPromo/queryCount`,
+      data: params,
+      method: 'post'
+  })
+}
+
 // 更换促销活动
 export const queryMatchPromoProduct = (params) => {
   return axios({

+ 15 - 7
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -223,10 +223,10 @@
               </div>
               <div style="display: flex;">
                 <div>
-                  款数:<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? toThousands(countData.totalCategory) : '--' }}</strong>
+                  款数:<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : '--' }}</strong>
                 </div>
-                <div>
-                  数量:<strong>-{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : '--' }}</strong>
+                <div style="padding: 0 10px;">
+                  数量:<strong>{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : '--' }}</strong>
                 </div>
                 <div>
                   <div v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '--' }}</strong></div>
@@ -248,7 +248,7 @@
       <!-- 仓库设置 -->
       <setWarehouse :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
       <!-- 换促销 -->
-      <updateActiveModal :show="openUpActiveModal" @ok="upActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
+      <updateActiveModal ref="updateActive" :show="openUpActiveModal" @ok="upActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
   </div>
 </template>
 
@@ -261,7 +261,7 @@
   import chooseWarehouse from '@/views/common/chooseWarehouse'
   import ProductBrand from '@/views/common/productBrand.js'
   import productTypeAll from '@/views/common/productTypeAll.js'
-  import { salesDetailList, salesDetailPromoCount, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
+  import { salesDetailList, salesPromoDetailCount, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
   export default {
     name: 'ProductList',
     mixins: [commonMixin],
@@ -421,7 +421,8 @@
       },
       // 统计
       getCount(){
-        salesDetailPromoCount(Object.assign(this.queryParam, {
+        salesPromoDetailCount(Object.assign(this.queryParam, {
+            salesBillSn: this.salesBillSn,
             promoRuleSn: this.promo.promoRuleSn,
             promoSn: this.promo.promoSn,
             salesPromoSn: this.promo.salesPromoSn
@@ -551,10 +552,17 @@
         }
       },
       // 换促销
-      upActiveOk(data){
+      upActiveOk(data, editRow){
+        console.log(data)
+        console.log(editRow)
         this.openUpActiveModal = false
       },
       handleUpdateActive(record){
+        this.$refs.updateActive.getActiveList({
+          productSn: record.productSn, 
+          salesBillSn: this.salesBillSn, 
+          promoRuleSn: this.promo.promoRuleSn
+        },record)
         this.openUpActiveModal = true
       },
       // 已选产品  blur

+ 34 - 46
src/views/salesManagement/salesQueryNew/comps/updateActiveModal.vue

@@ -12,53 +12,30 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <div style="padding: 0 30px;">
         <aRadioGroup v-model="upActiveVal">
-          <aRadio :style="radioStyle" value="1">
+          <aRadio :style="radioStyle" value="0">
             不参加促销
           </aRadio>
-          <div>
-            <strong>520以爱之名保护你</strong> 
-            <a-popover title="活动详情">
-              <template slot="content">
-                <ul class="active-li">
-                  <li><strong>促销类型:</strong> 买产品送产品</li>
-                  <li><strong>促销门槛:</strong> 购买1000元门槛产品,可使用200元配额,采购正价产品</li>
-                  <li><strong>促销规则:</strong> 购买满10个正价产品,送10个促销产品</li>
-                  <li><strong>显示正价产品款数:</strong> 40</li>
-                  <li><strong>订单起订金额:</strong> 20000</li>
-                  <li><strong>活动经费上线:</strong> 5000</li>
-                </ul>
-              </template>
-              <a-button type="link">详情</a-button>
-            </a-popover>
+          <div v-for="(item,idx) in activeList" :key="idx">
+            <div>
+              <strong>{{ item.title }}</strong> 
+              <!-- <a-popover title="活动详情">
+                <div slot="content">
+                  <ul class="active-li">
+                    <li><strong>促销类型:</strong> 买产品送产品</li>
+                    <li><strong>促销门槛:</strong> 购买1000元门槛产品,可使用200元配额,采购正价产品</li>
+                    <li><strong>促销规则:</strong> 购买满10个正价产品,送10个促销产品</li>
+                    <li><strong>显示正价产品款数:</strong> 40</li>
+                    <li><strong>订单起订金额:</strong> 20000</li>
+                    <li><strong>活动经费上线:</strong> 5000</li>
+                  </ul>
+                </div>
+                <a-button type="link">详情</a-button>
+              </a-popover> -->
+            </div>
+            <aRadio :style="radioStyle" v-for="(sitem,sindex) in item.promotionRuleList" :key="sindex" :value="item.promotionSn+'-'+sitem.promotionRuleSn">
+              {{sindex+1}}、{{ sitem.description }}
+            </aRadio>
           </div>
-          <aRadio :style="radioStyle" value="2">
-            1、满10送2
-          </aRadio>
-          <aRadio :style="radioStyle" value="3">
-            2、满10000送500(5%)采购额
-          </aRadio>
-          <div>
-            <strong>滤清器秋季大派送</strong>
-            <a-popover title="活动详情">
-              <template slot="content">
-                <ul class="active-li">
-                  <li><strong>促销类型:</strong> 买产品送产品</li>
-                  <li><strong>促销门槛:</strong> 购买1000元门槛产品,可使用200元配额,采购正价产品</li>
-                  <li><strong>促销规则:</strong> 购买满10个正价产品,送10个促销产品</li>
-                  <li><strong>显示正价产品款数:</strong> 40</li>
-                  <li><strong>订单起订金额:</strong> 20000</li>
-                  <li><strong>活动经费上线:</strong> 5000</li>
-                </ul>
-              </template>
-              <a-button type="link">详情</a-button>
-            </a-popover>
-          </div>
-          <aRadio :style="radioStyle" value="4">
-            1、满20送5
-          </aRadio>
-          <aRadio :style="radioStyle" value="5">
-            2、特价产品,33元(8折)                                                                                                                                                                          
-          </aRadio>
         </aRadioGroup>
       </div>
         <div style="padding: 30px 0 0;text-align: center;">
@@ -71,6 +48,7 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+import { salesPromoMatchProduct } from '@/api/salesNew'
 export default {
   name: 'SetWarehouse',
   mixins: [commonMixin],
@@ -84,16 +62,26 @@ export default {
       title: '确定换促销活动?',
       confirmLoading: false,
       upActiveVal: null,
-      radioStyle:"display:block;height: '30px';lineHeight: '30px';padding:5px 0;"
+      radioStyle:"display:block;height: '30px';lineHeight: '30px';padding:5px 0;",
+      activeList: null,
+      editRow: null
     }
   },
   methods: {
+    getActiveList(data, record){
+      this.editRow = record
+      this.spinning = true
+      salesPromoMatchProduct(data).then(res => {
+        this.activeList = res.data
+        this.spinning = false
+      })
+    },
     //  保存
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
       if(_this.upActiveVal){
-        _this.$emit('ok', _this.upActiveVal)
+        _this.$emit('ok', _this.upActiveVal, _this.editRow)
       }else{
         _this.$message.info("请选择活动规则!")
       }

+ 30 - 23
src/views/salesManagement/salesQueryNew/edit.vue

@@ -78,30 +78,28 @@
           <div>
             产品总款数:<strong>{{ detailData.totalCategory }}</strong>;
             总数量:<strong>{{ detailData.totalQty }}</strong>;
-            <span style="margin-right:10px;">优惠金额:<strong>{{ toThousands(detailData.totalLossAmount) }}</strong></span>
-            <a-popover title="优惠明细">
+            <span style="margin-right:10px;">优惠金额:<strong>{{ toThousands(detailData.totalLossAmount) }}</strong></span>
+            <a-popover title="优惠明细" @visibleChange="(visible)=>{visible&&getPromYhDetail()}">
               <a-button shape="round" size="small">优惠明细</a-button>
               <div slot="content">
-                <div class="yhdetail" style="min-width:300px;">
-                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">520以爱之名保护你</div>
-                  <div style="padding-left:10px;">
-                    <div>卖产品送产品:¥<strong>220</strong></div>
-                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
-                  </div>
+                <div v-if="yhDetail">
+                    <div class="yhdetail" style="min-width:300px;margin-bottom: 5px;" v-for="(item,index) in yhDetail.promoMapList" :key="index">
+                      <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">{{ item.title }}</div>
+                      <div style="padding-left:10px;" v-for="(sitem,sindex) in item.promoRuleMapList" :key="sindex">
+                        <div style="display: flex;justify-content: space-between;">
+                          <span>{{sitem.promotionRuleTypeDictValue}}:</span>
+                          <strong>¥{{ toThousands(sitem.lossAmount) }}</strong>
+                        </div>
+                        <div class="yhdetail-d" style="color:#999;">{{ sitem.description }}</div>
+                      </div>
+                    </div>
+                    <div class="yhdetail" style="display: flex;justify-content: space-between;">
+                      <span style="font-weight: bold;font-size:14px;">优惠金额:</span>
+                      <span style="font-weight: bold;font-size:18px;">¥{{ toThousands(yhDetail.totalLossAmount) }}</span>
+                    </div>
                 </div>
-                <div class="yhdetail">
-                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">滤清器夏季大派送</div>
-                  <div style="padding-left:10px;">
-                    <div>卖产品送产品:¥<strong>220</strong></div>
-                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
-                  </div>
-                </div>
-                <div class="yhdetail">
-                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">520以爱之名保护你</div>
-                  <div style="padding-left:10px;">
-                    <div>卖产品送产品:¥<strong>220</strong></div>
-                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
-                  </div>
+                <div style="text-align: center;padding: 20px;" v-else>
+                   正在加载...
                 </div>
               </div>
             </a-popover>
@@ -137,7 +135,7 @@ import productNormalList from './comps/productNormalList.vue'
 import chooseProduct from './comps/chooseProduct.vue'
 import setPriceModal from './setPriceModal.vue'
 import { salesDisablePromo } from '@/api/salesDetailNew'
-import { salesDetailBySn, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo } from '@/api/salesNew'
+import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
   mixins: [commonMixin],
@@ -163,7 +161,8 @@ export default {
       showDetail: false,
       showCpModal: false,
       cpCurRefId: '',
-      disabledActiveOption: null
+      disabledActiveOption: null,
+      yhDetail: null
     }
   },
   computed: {
@@ -197,6 +196,14 @@ export default {
         this.getActiveList()
       })
     },
+    // 优惠明细查看
+    getPromYhDetail(){
+      salesPromoQueryCount({salesBillSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.yhDetail = res.data
+        }
+      })
+    },
     // 获取销售单参与的活动列表
     async getActiveList(){
       const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn }).then(res => res.data)

+ 404 - 0
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -0,0 +1,404 @@
+<template>
+    <div class="productInfoList-wrap">
+      <!-- alert -->
+      <div style="margin-bottom: 10px;display: flex;align-items: center;">
+        <div style="display: flex;align-items: center;">
+          <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量删除</a-button>
+          <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
+        </div>
+        <div style="padding-left: 20px;" v-if="detailData">
+          本次下推款数:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
+          本次下推数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
+        </div>
+      </div>
+      
+      <a-spin :spinning="spinning" tip="Loading...">
+          <ve-table
+                border-y
+                v-show="!showEmpty"
+                :scroll-width="0"
+                :max-height="tableHeight"
+                :show-header="showTableHead"
+                :row-style-option="{clickHighlight: true}"
+                :cellSelectionOption="{enable: false}"
+                :virtual-scroll-option="{enable: true}"
+                :columns="columns"
+                :table-data="dataSource"
+                row-key-field-name="id"
+                :cell-style-option="cellStyleOption"
+                :cell-span-option="cellSpanOption"
+                :column-width-resize-option="columnWidthResizeOption"
+                :checkbox-option="checkboxOption"
+              />
+          <div v-show="showEmpty" class="empty-data">暂无数据</div>
+      </a-spin>
+  
+    </div>
+  </template>
+  
+  <script>
+  import { commonMixin } from '@/utils/mixin'
+  import { deleteBatch, waitDispatchDetailAllList, updateQty } from '@/api/waitDispatchDetail'
+  import { findBySalesBillSn } from '@/api/dispatch'
+ 
+  import { STable, VSelect } from '@/components'
+  import chooseWarehouse from '@/views/common/chooseWarehouse'
+  export default {
+    name: 'DetailProductList',
+    mixins: [commonMixin],
+    components: { STable, VSelect, chooseWarehouse },
+    props: {
+      newLoading: {
+          type: Boolean,
+          default: false
+      },
+      maxHeight:{
+            type: [String,Number],
+            default: '300'
+          },
+      showHeader: {
+          type: Boolean,
+          default: true
+      }
+    },
+    data () {
+      return {
+        queryParam: {
+            dispatchBillSn
+        },
+        disabled: false, //  查询、重置按钮是否可操作
+        spinning: false,
+        dataSource: [],
+        tableHeight: this.maxHeight,
+        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,
+        disableSelectedRowKeys: [],
+        selectedRowKeys: []
+      }
+    },
+    computed: {
+      checkboxOption () {
+        return {
+            disableSelectedRowKeys: this.disableSelectedRowKeys,
+            selectedRowKeys: this.selectedRowKeys,
+            // 行选择改变事件
+            selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+              this.selectedRowChange({ row, isSelected, selectedRowKeys })
+            },
+            // 全选改变事件
+            selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+              this.selectedAllChange({ isSelected, selectedRowKeys })
+            },
+        }
+      },
+      columns () {
+        const _this = this
+            const priceFormat = function(data){
+              return _this.toThousands(data) || '--'
+            }
+            const numsFormat = function(data){
+              return data || data == 0 ? data : '--'
+            }
+            const codeFormat = function(record,data,h){
+              let ftext = ''
+              let fcolor = ''
+              if(record.promotionFlag == 'GIFT'){
+                ftext = '促'
+                fcolor = '#52c41a'
+              }
+              if(record.promotionFlag == 'REGULAR'){
+                ftext = '正'
+                fcolor = '#108ee9'
+              }
+              if(record.promotionFlag == 'DISCOUNT'){
+                ftext = '特'
+                fcolor = '#faad14'
+              }
+              return (
+                      <div>
+                          <span style="padding-right: 15px;">{data}</span>
+                          {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
+                          {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
+                      </div>
+                  )
+            }
+        // 输入框
+        const inputFormat = function(record,data,h) {
+          if(record.surplusQty>0){
+            return (
+              <div>
+                <a-input-number
+                  size="small"
+                  vModel={record.cancelNums}
+                  precision={0}
+                  min={0}
+                  max={record.surplusQty}
+                  style="width: 100%;"
+                  placeholder="请输入" />
+              </div>
+            )
+          }
+          return '--'
+        }
+        // 操作按钮
+        const actionFormat = function(record,data,h) {
+          if(record.surplusQty>0){
+            return (
+              <div>
+                 <a-button
+                  size="small"
+                  type="link"
+                  class="button-info"
+                  onClick={()=>_this.handleAdd(record)}
+                  >添加</a-button>
+              </div>
+            )
+          }
+          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={()=>this.showDesc(record)}>
+                        <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: "", key: "acheck", type: "checkbox", align: "center" },
+              { 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] || '--'} },
+              { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
+          ]
+        if (this.$hasPermissions('B_salesDispatch_salesPrice')) { //  售价权限
+          arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+        }
+        if (this.$hasPermissions('B_salesDispatch_costPrice')) {
+          arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+        }    
+        arr = arr.concat([
+            { title: '出库仓库', field: 'warehouseName',key: "h", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+            { title: '单位', field: 'productOrigUnit',key: "i", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+            { title: '可用库存', field: 'stockQty', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
+            { title: '销售数量', field: 'qty', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
+            { title: '已取消', field: 'cancelQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
+            { 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',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
+          ])
+        
+        return arr
+      }
+    },
+    methods: {
+      //  产品分类  change
+      changeProductType (val, opt) {
+        this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+        this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+        this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+      },
+      // 合并活动分类单元格
+      bodyCellSpan({ row, column, rowIndex }) {
+        if (row.id.indexOf('promo-')>=0) {
+          if(column.field=='no'){
+            return {
+                      rowspan: 1,
+                      colspan: 17,
+                  };
+          }else{
+            return {
+                  rowspan: 0,
+                  colspan: 0,
+              }
+          }
+        }
+      },
+      // 选择单元格
+      selectedRowChange({ row, isSelected, selectedRowKeys }){
+        // console.log(row, isSelected, selectedRowKeys);
+        this.selectedRowKeys = selectedRowKeys;
+      },
+      // 全选行
+      selectedAllChange({ isSelected, selectedRowKeys }){
+        // console.log(isSelected, selectedRowKeys);
+        this.selectedRowKeys = selectedRowKeys;
+      },
+      // 获取销售单参与的活动列表
+      getActiveList(){
+        salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
+          if(res.status == 200){
+            this.activeList = res.data || []
+          }
+          this.$nextTick(()=>{
+            this.searchTable()
+          })
+        })
+      },
+      async searchTable(){
+          this.selectedRowKeys = []
+          this.disableSelectedRowKeys = []
+          this.dataSource = []
+          this.disabled = true
+          this.spinning = true
+          this.queryParam.salesBillSn = this.salesBillSn
+          this.queryParam.showStock = true
+          const params = this.queryParam
+          // 正常产品
+          const listData = await waitDispatchDetailAllList(params).then(res => res.data)
+          const countData = await findBySalesBillSn({salesBillSn: this.salesBillSn}).then(res => res.data)
+          console.log(listData)
+          this.dataSource = listData
+  
+          // 格式化数据
+          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)
+            const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
+            item.productCode = productCode || '--'
+            item.productName = productName || '--'
+            item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
+            item.productOrigUnit = productOrigUnit || '--'
+            if(item.stockQty<0 || !item.stockQty){
+              this.disableSelectedRowKeys.push(item.id)
+            }
+          })
+          this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
+          this.spinning = false
+          this.disabled = false
+      },
+      //  重置
+      resetSearchForm () {
+        this.queryParam.ptype = '0'
+        this.queryParam.productCode = ''
+        this.queryParam.productName = ''
+        this.queryParam.promotionFlag = undefined
+        this.queryParam.brandSn = undefined
+        this.queryParam.productTypeSn1 = ''
+        this.queryParam.productTypeSn2 = ''
+        this.queryParam.productTypeSn3 = ''
+        this.queryParam.warehouseSn = undefined
+        this.productType = []
+        this.dataSource = []
+        this.searchTable()
+      },
+      pageInit (salesBillSn, detailData) {
+        this.salesBillSn = salesBillSn
+        this.detailData = detailData
+        // 获取活动列表
+        this.getActiveList()
+      },
+      // 清空选项
+      clearSelectTable () {
+         this.selectedRowKeys = []
+      },
+      // 添加
+      handleAdd (row) {
+        if (row.stockQty > 0) { //  可用库存大于0才可添加
+          this.$emit('addProduct', [row.salesBillDetailSn])
+        } else {
+          this.$message.warning('库存为0,不可添加!')
+        }
+      },
+      // 批量添加
+      handlePlAdd () {
+        const _this = this
+        const chooseList = this.selectedRowKeys
+        if (chooseList.length == 0) {
+          _this.$message.warning('请先选择产品!')
+          return
+        }
+        const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+        const obj = []
+        chooseRow && chooseRow.map(item => {
+          if (item.stockQty > 0) {
+            obj.push(item.salesBillDetailSn)
+          }
+        })
+         
+        this.$confirm({
+          title: '提示',
+          content: '确认要批量添加到待下推列表吗?',
+          centered: true,
+          closable: true,
+          onOk () {
+            _this.$emit('addProduct', obj)
+          }
+        })
+      },
+      // 批量取消
+      handlePlCancel () {
+        const _this = this
+        const chooseList = this.selectedRowKeys
+        if (chooseList.length == 0) {
+          _this.$message.warning('请先选择产品!')
+          return
+        }
+        const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+        const obj = []
+        chooseRow && chooseRow.map(item => {
+          obj.push({
+            'cancelQty': item.cancelNums,
+            'salesBillDetailSn': item.salesBillDetailSn
+          })
+        })
+  
+        this.$emit('cancelProduct', obj)
+      }
+    }
+  }
+  </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>

+ 10 - 19
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -201,7 +201,7 @@ export default {
             _this.$refs.partQuery.resetCurForm()
             _this.$message.success(res.message)
             _this.spinning = false
-            _this.resetSearchForm()
+            _this.getTotalData()
           } else {
             _this.spinning = false
           }
@@ -210,11 +210,6 @@ export default {
         record.qty = record.qtyBackups
       }
     },
-    //  重置
-    resetSearchForm () {
-      this.getTotalData()
-      this.getOrderDetail()
-    },
     //  返回
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
@@ -265,14 +260,7 @@ export default {
         dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
       }).then(res => {
         if (res.status == 200) {
-          _this.resetSearchForm()
-          _this.$refs.partQuery.resetCurForm()
-          if (type == 1) { //  批量操作
-            // 清空表格选中项
-          } else if (type == 0) { //  单条
-            const ind = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.findIndex(item => item == row.id)
-            _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.splice(ind, 1)
-          }
+          _this.getTotalData()
           _this.$message.success(res.message)
           _this.spinning = false
         } else {
@@ -297,8 +285,7 @@ export default {
         salesBillSn: this.salesBillSn
       }).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm()
-          this.$refs.partQuery.resetCurForm()
+          this.getTotalData()
           this.$message.success('添加成功', 2.5)
           this.spinning = false
         } else {
@@ -313,10 +300,13 @@ export default {
       this.$message.loading('正在批量取消产品...', 1)
       this.isInster = true
       this.spinning = true
-      salesDetailUpdateCancelQty(list).then(res => {
+      salesDetailUpdateCancelQty({
+        salesBillDetailSnList: list,
+        salesBillSn: this.salesBillSn
+      }).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm()
-          this.$refs.partQuery.resetCurForm()
+          this.getTotalData()
+          this.$refs.partQuery.resetSearchForm()
           this.$message.success(res.message, 2.5)
           this.spinning = false
         } else {
@@ -346,6 +336,7 @@ export default {
         this.$message.warning('请选择待下推产品')
       }
     },
+    // 提交下推
     handleSubmit (data) {
       this.delLoading = true
       this.isInster = true

+ 40 - 36
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -104,7 +104,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { salesPromoQueryList } from '@/api/salesNew'
-import { salesDetailAllList } from '@/api/salesDetailNew'
+import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
 import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 export default {
@@ -243,7 +243,7 @@ export default {
                 size="small"
                 type="link"
                 class="button-info"
-                onClick={_this.handleAdd(record)}
+                onClick={()=>_this.handleAdd(record)}
                 >添加</a-button>
             </div>
           )
@@ -259,15 +259,15 @@ export default {
                 {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={this.showDesc(record)}>
+                    <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>this.showDesc(record)}>
                       <a-icon title="查看活动详情" type="eye"/> 活动详情
                     </span>
                   </div>
                 ):(<div></div>)}
                 <div>
-                    总售价:<strong>12333</strong>;
-                    总款数:<strong>22</strong>;
-                    总数量:<strong>134</strong>;
+                    总售价:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;
+                    总款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
+                    总数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                 </div>
               </div>
             ):(<span>{data}</span>)}
@@ -305,6 +305,12 @@ export default {
     }
   },
   methods: {
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
     // 合并活动分类单元格
     bodyCellSpan({ row, column, rowIndex }) {
       if (row.id.indexOf('promo-')>=0) {
@@ -353,28 +359,32 @@ export default {
         const params = this.queryParam
         // 正常产品
         const proList = await salesDetailAllList(params).then(res => res.data)
+        const norTotal = await salesDetaiCount(params).then(res => res.data)
         let listData = [{
             id: 'promo-normal',
-            // total: norTotal
+            total: norTotal
           },...proList]
+        
+        // 循环获取活动产品
         const active = this.activeList
-        this.disableSelectedRowKeys.push('promo-normal')
-        // 活动产品
         for(let i=0;i<active.length;i++){
           const promo = active[i]
-          params.promoRuleSn = promo.promoRuleSn
-          params.promoSn = promo.promoSn
-          params.salesPromoSn = promo.salesPromoSn
+          const activeParams = {
+            promoRuleSn: promo.promoRuleSn,
+            promoSn: promo.promoSn,
+            salesPromoSn: promo.salesPromoSn,
+            ...params
+          }
+          
           // 获取活动产品列表
-          const aclist = await salesDetailAllList(params).then(res => res.data)
+          const aclist = await salesDetailAllList(activeParams).then(res => res.data)
           // 获取活动产品统计
-          //const acTotal = await salesDetailCount(params).then(res => res.data)
+          // const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
           const retList = [{
             id: 'promo-'+i,
             promo: promo,
             // total: acTotal
           },...aclist]
-          this.disableSelectedRowKeys.push('promo-'+i)
           listData = aclist&&aclist.length ? listData.concat(retList) : listData
         }
 
@@ -394,7 +404,8 @@ export default {
           item.productName = productName || '--'
           item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
           item.productOrigUnit = productOrigUnit || '--'
-          if(item.stockQty<0 || !item.stockQty){
+          // 库存为0或待下推数为0,不可添加
+          if(item.stockQty<0 || !item.stockQty || !item.surplusQty || item.surplusQty<0){
             this.disableSelectedRowKeys.push(item.id)
           }
         })
@@ -474,34 +485,27 @@ export default {
       chooseRow && chooseRow.map(item => {
         obj.push({
           'cancelQty': item.cancelNums,
-          'salesBillDetailSn': item.salesBillDetailSn,
-          'salesBillSn': this.salesBillSn
+          'salesBillDetailSn': item.salesBillDetailSn
         })
       })
 
       this.$emit('cancelProduct', obj)
-    },
-    //  产品分类  change
-    changeProductType (val, opt) {
-      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
-      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
-      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     }
   }
 }
 </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-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;
-} 
+  .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>

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.113:8660/ocs-admin',
+        target: 'http://192.168.2.111/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,