Selaa lähdekoodia

Merge branch 'develop_cuxiao' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_cuxiao

chenrui 1 vuosi sitten
vanhempi
commit
ceecbdea96

+ 3 - 3
src/api/sales.js

@@ -242,7 +242,7 @@ export const updateWarehouse = (params) => {
 
 //  按仓库查询销售单 列表  有分页
 export const queryPageForWarehouse = (params) => {
-  const url = `/sales/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
+  const url = `/salesn/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -254,14 +254,14 @@ export const queryPageForWarehouse = (params) => {
 // 获取按仓库查询销售单数量
 export const queryCountForWarehouse = (params) => {
   return axios({
-    url: '/sales/queryCountForWarehouse',
+    url: '/salesn/queryCountForWarehouse',
     method: 'post',
     data: params
   })
 }
 // 按仓库查询销售明细 列表
 export const queryPageForWarehouseDetail = (params) => {
-  const url = `/sales/detail/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
+  const url = `/salesn/detail/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({

+ 9 - 2
src/api/salesDetailNew.js

@@ -8,7 +8,14 @@ export const salesDetailDel = (params) => {
     method: 'post'
   })
 }
-
+// 销售详情 统计 正常产品
+export const salesDetaiCount = (params) => {
+  return axios({
+    url: `/salesn/detail/queryCount`,
+    data: params,
+    method: 'post'
+  })
+}
 // 批量删除
 export const salesDetailBatchDel = (params) => {
   return axios({
@@ -165,7 +172,7 @@ export const salesDetailPromoList = (params) => {
 // 促销产品统计  合计
 export const salesDetailPromoCount = (params) => {
   return axios({
-    url: `/sales/detail/queryCountByPromo`,
+    url: `/salesPromo/queryCount`,
     data: params,
     method: 'post'
   })

+ 35 - 5
src/api/salesNew.js

@@ -72,6 +72,14 @@ export const salesPromoQueryList = (params) => {
         method: 'post'
     })
 }
+// 判断是否有新的活动
+export const salesQueryUnPartPromo = (params) => {
+  return axios({
+      url: `/salesPromo/queryUnPartPromo/${params.salesBillSn}`,
+      data: params,
+      method: 'post'
+  })
+}
 // 更换促销活动
 export const queryMatchPromoProduct = (params) => {
   return axios({
@@ -81,15 +89,22 @@ export const queryMatchPromoProduct = (params) => {
   })
 }
 
-//  销售 审核
-export const salesWriteAudit = (params) => {
+//  销售 审核通过
+export const salesWriteAuditPass = (params) => {
   return axios({
-    url: '/salesn/audit',
+    url: '/salesn/auditPass',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 审核驳回
+export const salesWriteAuditReject = (params) => {
+  return axios({
+    url: '/salesn/auditReject',
     data: params,
     method: 'post'
   })
 }
-
 //  销售 一键审核下推
 export const salesWriteAuditPush = (params) => {
   return axios({
@@ -107,7 +122,22 @@ export const salesWriteSubmit = (params) => {
   })
 }
 
-
+// 查询可生成的费用报销单
+export const queryCreateBySalesBillSn = (params) => {
+  return axios({
+    url: `/expenseAccount/queryCreateBySalesBillSn/${params.salesBillSn}`,
+    data: params,
+    method: 'post'
+  })
+}
+// 保存费用报销单
+export const expenseAccountSave = (params) => {
+  return axios({
+    url: `/expenseAccount/saveCreate`,
+    data: params,
+    method: 'post'
+  })
+}
 
 //  销售 打印
 export const salesPrint = (params) => {

+ 1 - 1
src/api/waitDispatchDetail.js

@@ -48,7 +48,7 @@ export const waitDispatchDetailList = (params) => {
 
 // 列表  不分页
 export const waitDispatchDetailAllList = (params) => {
-  const url = `/dispatch/detail/query`
+  const url = `/dispatch/detail/queryPushing`
   delete params.pageNo
   delete params.pageSize
   return axios({

+ 2 - 1
src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue

@@ -96,8 +96,9 @@
           class="button-info"
           :loading="newLoading"
           @click="handleAdd(record)"
-          :disabled="!record.productPrice || record.productPrice<=0"
+          v-if="record.productPrice"
           id="productInfoList-edit-btn">添加</a-button>
+        <span v-else>--</span>
       </template>
     </s-table>
   </div>

+ 40 - 40
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -3,8 +3,10 @@
     <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}"
@@ -57,8 +59,12 @@
         },
         maxHeight:{
           type: [String,Number],
-          default: '250'
+          default: '300'
         },
+        showHeader: {
+            type: Boolean,
+            default: true
+        }
       },
       data () {
         return {
@@ -74,7 +80,8 @@
           },
           isCityPrice: false,
           outStockStr: '',
-          showEmpty: false
+          showEmpty: false,
+          showTableHead: true
         }
       },
       computed: {
@@ -87,50 +94,39 @@
             return data || data == 0 ? data : '--'
           }
           const codeFormat = function(record,data,h){
-            if(record.promotionFlag=='GIFT'){
-                return (
-                    <div>
-                        <span style="padding-right: 15px;">{data}</span>
-                        <a-badge count="促" number-style={{ backgroundColor: '#52c41a', zoom:'80%' }}></a-badge>
-                    </div>
-                )
+            let ftext = ''
+            let fcolor = ''
+            if(record.promotionFlag == 'GIFT'){
+              ftext = '促'
+              fcolor = '#52c41a'
             }
-            if(record.promotionFlag=='REGULAR'){
-                return (
-                    <div>
-                        <span style="padding-right: 15px;">{data}</span>
-                        <a-badge count="正" number-style={{ backgroundColor: '#108ee9', zoom:'80%' }}></a-badge>
-                    </div>
-                )
+            if(record.promotionFlag == 'REGULAR'){
+              ftext = '正'
+              fcolor = '#108ee9'
             }
-            if(record.promotionFlag=='DISCOUNT'){
-                return (
-                    <div>
-                        <span style="padding-right: 15px;">{data}</span>
-                        <a-badge count="特" number-style={{ backgroundColor: '#faad14', zoom:'80%' }}></a-badge>
-                    </div>
-                )
+            if(record.promotionFlag == 'DISCOUNT'){
+              ftext = '特'
+              fcolor = '#faad14'
             }
-            if(Number(record.stockQty||0) < Number(record.unpushedQty||0)){
-                return (
+            return (
                     <div>
                         <span style="padding-right: 15px;">{data}</span>
-                        <a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>
+                        {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>
                 )
-            }
           }
 
           let arr= [
-                { title: '序号', field: 'no',key: "a", width: 60, align: 'center', fixed: 'left',operationColumn: false },
-                { title: '产品编码', field: 'productCode',key: "b", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
+                { title: '序号', field: 'no',key: "a", width: 50, align: 'center', fixed: 'left',operationColumn: false },
+                { 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: 100, align: 'center',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
-                { title: '出库仓库', field: 'warehouseName',key: "e", width: 120, align: 'center',operationColumn: false,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(this.authCode + '_costPrice')) { //  成本价权限
-                arr.push({ title: '成本价', field: 'showCost', width: 100,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                arr.push({ title: '成本价', field: 'showCost', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
             }
             arr = arr.concat([
                 { title: '单位', field: 'productOrigUnit',key: "g", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
@@ -138,27 +134,27 @@
             ])
 
             if (this.$hasPermissions(this.authCode + '_provincePrice')) {
-                arr.push({ title: '省级价', field: 'provincePrice', width: 100,key: "i", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                arr.push({ title: '省级价', field: 'provincePrice', width: 80,key: "i", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
             }
             // 是否勾选市级价格
             if (this.isCityPrice) {
-                arr.push({ title: '市级价', field: 'cityPrice', width: 100,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                arr.push({ title: '市级价', field: 'cityPrice', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
-                    arr.push({ title: '销售价', field: 'price', width: 100,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                    arr.push({ title: '销售价', field: 'price', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
                 }
             } else {
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
-                    arr.push({ title: '销售价', field: 'price', width: 100,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                    arr.push({ title: '销售价', field: 'price', width: 80,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
                 }
             }
 
             if (this.showStock) { //  审核,需用到库存
-                arr.push({ title: '库存', field: 'stockQty', width: 100,key: "m", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} })
+                arr.push({ title: '库存', field: 'stockQty', width: 80,key: "m", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} })
             }
             arr = arr.concat([
-                { title: '待下推数', field: 'unpushedQty', width: 100,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-                { title: '已下推数', field: 'pushedQty', width: 100,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-                { title: '已取消数', field: 'cancelQty', width: 100,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} }
+                { title: '待下推数', field: 'unpushedQty', 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: 'cancelQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} }
             ])
           return arr
         },
@@ -216,8 +212,12 @@
                 }
                 this.showEmpty = data.length <= 0
                 this.tableHeight = (this.showEmpty ? 30 : this.maxHeight) + 'px'
+                if(!this.showEmpty && data.length < 10){
+                  this.tableHeight = 'auto'
+                }
                 this.spinning = false
                 this.dataSource = data
+                this.showTableHead = this.showHeader
               }
             })
          }

+ 20 - 5
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -219,11 +219,11 @@
         <a-alert type="info" banner :showIcon="false">
             <div slot="message" class="alert-bar">
               <div>
-                还需门槛产品金额1000/4000(5000),已选择0元(可使用8000元配额)正价产品,已选择8个正价产品(满10送2),<strong>再满2件产品,可享受优惠</strong>,差200元到订单起订金额(1800元),可选择4个促销产品,已选择2个促销产品
+                {{ countData&&countData.remarks }}
               </div>
               <div>
-                <div v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong></div>
-                <div v-if="$hasPermissions('B_salesEdit_salesPrice')">优惠金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong></div>
+                <div v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '--' }}</strong></div>
+                <div v-if="$hasPermissions('B_salesEdit_salesPrice')">优惠金额:<strong>-{{ countData&&(countData.lossAmount || countData.lossAmount==0) ? toThousands(countData.lossAmount) : '--' }}</strong></div>
               </div>
             </div>
           </a-alert>
@@ -253,7 +253,7 @@
   import chooseWarehouse from '@/views/common/chooseWarehouse'
   import ProductBrand from '@/views/common/productBrand.js'
   import productTypeAll from '@/views/common/productTypeAll.js'
-  import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
+  import { salesDetailList, salesDetailPromoCount, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
   export default {
     name: 'ProductList',
     mixins: [commonMixin],
@@ -301,6 +301,7 @@
         loadData: parameter => {
           this.disabled = true
           this.queryParam.salesBillSn = this.salesBillSn || ''
+          this.getCount()
           return salesDetailList(Object.assign(parameter, this.queryParam, {
             showStock: true, 
             promoRuleSn: this.promo.promoRuleSn,
@@ -343,7 +344,8 @@
         openUpActiveModal: false,
         descDetail: null,
         promoProductClz: null, // 活动产品分类
-        disablePromo: false
+        disablePromo: false,
+        countData: null
       }
     },
     computed: {
@@ -409,6 +411,18 @@
         this.resetSearchForm()
         this.disablePromo = true
       },
+      // 统计
+      getCount(){
+        salesDetailPromoCount(Object.assign(this.queryParam, {
+            promoRuleSn: this.promo.promoRuleSn,
+            promoSn: this.promo.promoSn,
+            salesPromoSn: this.promo.salesPromoSn
+          })).then(res => {
+          if(res.status == 200){
+            this.countData = res.data
+          }
+        })
+      },
       //  重置
       resetSearchForm (flag) {
         this.queryParam.productCode = ''
@@ -419,6 +433,7 @@
         this.queryParam.productTypeSn2 = ''
         this.queryParam.productTypeSn3 = ''
         this.productType = []
+        this.$refs.table.clearSelected()
         this.$refs.table.refresh(!!flag)
       },
       // 删除全部产品

+ 23 - 4
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -156,9 +156,9 @@
         <!-- 总计 -->
         <a-alert type="info" banner :showIcon="false">
           <div slot="message">
-              <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
-              总款数:<strong>{{ detailData&&(detailData.totalCommonCategory || detailData.totalCommonCategory==0) ? detailData.totalCommonCategory : '--' }}</strong>;
-              总数量:<strong>{{ detailData&&(detailData.totalCommonQty || detailData.totalCommonQty==0) ? detailData.totalCommonQty : '--' }}</strong>;
+              <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '--' }}</strong>;</span>
+              总款数:<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : '--' }}</strong>;
+              总数量:<strong>{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : '--' }}</strong>;
           </div>
         </a-alert>
       </template>
@@ -179,7 +179,16 @@
   import chooseWarehouse from '@/views/common/chooseWarehouse'
   import ProductBrand from '@/views/common/productBrand.js'
   import productTypeAll from '@/views/common/productTypeAll.js'
-  import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, addPromoGoods, salesBatchInsert } from '@/api/salesDetailNew'
+  import { 
+    salesDetailList, 
+    salesDetailInsert, 
+    salesDetailUpdateQty, 
+    salesDetailDel, 
+    salesDetailBatchDel, 
+    deleteAll, 
+    updateWarehouse, 
+    salesDetaiCount, 
+    salesBatchInsert } from '@/api/salesDetailNew'
   export default {
     name: 'ProductList',
     mixins: [commonMixin],
@@ -218,6 +227,7 @@
         loadData: parameter => {
           this.disabled = true
           this.queryParam.salesBillSn = this.salesBillSn || ''
+          // this.getCount()
           return salesDetailList(Object.assign(parameter, this.queryParam, {showStock: true})).then(res => {
             let data
             if (res.status == 200) {
@@ -251,6 +261,7 @@
         productType: [],
         rowSelectionInfo: null,
         warehouseDataList: [],
+        countData: null,
         isInster: false
       }
     },
@@ -294,6 +305,14 @@
       openCpModal(){
         this.$emit('openCpModal', 0, 'productNormalList')
       },
+      // 统计
+      getCount(){
+        salesDetaiCount(Object.assign(this.queryParam, {showStock: true})).then(res => {
+          if(res.status == 200){
+            this.countData = res.data
+          }
+        })
+      },
       handleBatchDelAll () {
         const _this = this
         if (_this.dataSource.length == 0) {

+ 27 - 15
src/views/salesManagement/salesQueryNew/detail.vue

@@ -107,16 +107,17 @@
             </a-row>
           </a-form>
         </div>
-        <!-- 列表 -->
-        <detailProductList 
-        ref="normalProduct" 
-        :detailData="detailData" 
-        :warehouseSn="warehouseSn"
-        :salesBillSn="$route.params.sn || bizSn" 
-        :authCode="authCode"
-        :maxHeight="activeList.length?'250':pageHeight"
-        :showCityPrice="isCityPrice"></detailProductList> 
-
+        <!-- 正常产品列表 -->
+        <div style="margin-bottom: 10px;">
+          <detailProductList 
+          ref="normalProduct" 
+          :detailData="detailData" 
+          :warehouseSn="warehouseSn"
+          :salesBillSn="$route.params.sn || bizSn" 
+          :authCode="authCode"
+          :maxHeight="activeList.length?'300':pageHeight"
+          :showCityPrice="isCityPrice"></detailProductList> 
+        </div>
         <!-- 活动列表 -->
         <div 
         v-for="item in activeList" 
@@ -124,7 +125,7 @@
         >
         <div class="active-title">
           <div>
-            <strong style="margin-right:10px;font-size:14px;">{{item.promotion.title}}</strong> ({{item.promotionRule.description}})
+            <strong style="margin-right:10px;font-size:14px;">{{item.promotion.title}} ({{item.promotionRule.description}})</strong>
             <span style="margin-left:10px;color:#00aaff;cursor: pointer;"  @click="(event) => {showDesc(event, item)}">
               <a-icon title="查看活动详情" type="eye"/> 活动详情
             </span>
@@ -138,6 +139,7 @@
         <detailProductList 
         :ref="'active-'+item.promoRuleSn" 
         :promo="item"
+        :showHeader="false"
         :detailData="detailData" 
         :warehouseSn="warehouseSn"
         :salesBillSn="$route.params.sn || bizSn" 
@@ -225,7 +227,16 @@ import stockOutDetail from './stockOutDetailModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import detailProductList from './comps/detailProductList.vue'
 // 接口
-import { salesDetailBySn, salesPromoQueryList, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/salesNew'
+import { 
+  salesDetailBySn, 
+  salesPromoQueryList, 
+  salesDetailPrint, 
+  salesDetailExcel, 
+  salesDetailTypeExcel, 
+  salesWriteAuditPass, 
+  salesWriteAuditReject, 
+  salesWriteAuditPush 
+} from '@/api/salesNew'
  
 export default {
   name: 'SalesDetailNew',
@@ -377,7 +388,8 @@ export default {
     // 审核
     auditOrder (billStatus) {
       this.spinningAudit = true
-      salesWriteAudit({
+      const auditFun = billStatus =='AUDIT_PASS' ? salesWriteAuditPass : salesWriteAuditReject
+      auditFun({
         salesBillSn: this.bizSn || this.$route.params.sn,
         billStatus: billStatus
       }).then(res => {
@@ -388,7 +400,7 @@ export default {
           const _this = this
           this.$nextTick(() => {
             if (billStatus == 'AUDIT_PASS' && !_this.auditText) {
-              _this.$router.push({ name: 'waitDispatch', params: { salesBillSn: _this.bizSn || _this.$route.params.sn } })
+              _this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: _this.bizSn || _this.$route.params.sn } })
             } else {
               //  关闭详情跳列表
               _this.handleBack()
@@ -484,7 +496,7 @@ export default {
       align-items: center;
       justify-content: space-between;
       padding: 10px;
-      background: #dafafa;
+      background: #f3f8fa;
     }
     .flexBox{
       display: flex;

+ 37 - 11
src/views/salesManagement/salesQueryNew/edit.vue

@@ -138,7 +138,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 } from '@/api/salesNew'
+import { salesDetailBySn, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
   mixins: [commonMixin],
@@ -186,7 +186,6 @@ export default {
       this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
     },
     tooglePanel(item){
-      console.log(1)
       item.isActive=!item.isActive
       this.activeList.splice()
     },
@@ -200,16 +199,43 @@ export default {
       })
     },
     // 获取销售单参与的活动列表
-    getActiveList(){
-      salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => {
-        if(res.status == 200){
-          this.activeList = res.data || []
-          this.activeList.map(item => {
-            item.isActive = true
-            this.activeDesKey['search-'+item.promoRuleSn] = false
-          })
-        }
+    async getActiveList(){
+      const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn }).then(res => res.data)
+      console.log(hasNewActive)
+      // 有新活动
+      if(hasNewActive.length){
+        this.showNewActiveModal(hasNewActive)
+      }
+      this.activeList = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      this.activeList.map(item => {
+        item.isActive = true
+        this.activeDesKey['search-'+item.promoRuleSn] = false
+      })
+    },
+    // 新活动确认弹框
+    showNewActiveModal(data){
+      let arr = []
+      data.map(item => {
+        arr.push(item.title)
       })
+      this.$confirm({
+        title: '新活动提醒',
+        centered: true,
+        class:'confirm-center',
+        content: <div>
+          <div style="padding:10px 0;text-align:center;">
+            系统发布新的促销活动:
+          </div>
+          <div style="text-align:center;color:#00aaff;">{arr.join(',')}</div>
+          <div style="padding:10px 0;text-align:center;">
+            是否将现有产品识别到新的活动中吗?
+          </div>
+        </div>,
+        onOk() {
+           
+        },
+        onCancel() {},
+      });
     },
     // 添加产品,包括正常和活动的产品
     closeProductModal(){

+ 43 - 31
src/views/salesManagement/salesQueryNew/list.vue

@@ -251,7 +251,7 @@
               type="link"
               class="button-warning"
               v-if="record.billStatus=='FINISH'"
-              @click="handleToExpense(record)"
+              @click="handleExpense(record)"
             >转费用报销单</a-button>
           </div>
         </template>
@@ -295,7 +295,7 @@ import commonModal from '@/views/common/commonModal.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import reportModal from '@/views/common/reportModal.vue'
-import { salesList, salesDel,salesCancle, salesCount } from '@/api/salesNew'
+import { salesList, salesDel,salesCancle, salesCount, queryCreateBySalesBillSn, expenseAccountSave } from '@/api/salesNew'
 import { hdExportExcel } from '@/libs/exportExcel'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import { findBySalesBillSn, dispatchBatchPrintStatus, queryBySalesBillSn } from '@/api/dispatch'
@@ -509,37 +509,49 @@ export default {
       })
     },
     // 转费用单
-    handleToExpense(){
+    async handleExpense(row){
       const _this = this
-      this.$confirm({
-        title: '转费用报销单?',
-        centered: true,
-        class:'confirm-center',
-        content: <div>
-          <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
-          <div style="padding:0 0 10px 0;text-align:center;">
-            <aRadioGroup onChange={_this.changeDaOpt}>
-              <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="1">
-                采购额结余
-              </aRadio>
-              <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="2">
-                采购额超出
-              </aRadio>
-            </aRadioGroup>
-          </div>
-        </div>,
-        onOk() {
-          if(_this.expenseOption){
+      const hasExpense = await queryCreateBySalesBillSn({salesBillSn: row.salesBillSn}).then(res => res.data||[])
+      console.log(hasExpense)
+      // 有2个以上采购额时
+      if(hasExpense && hasExpense.length > 1){
+        _this.$confirm({
+          title: '转费用报销单?',
+          centered: true,
+          class:'confirm-center',
+          content: <div>
+            <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
+            <div style="padding:0 0 10px 0;text-align:center;">
+              <aRadioGroup onChange={_this.changeDaOpt}>
+                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="1">
+                  采购额结余
+                </aRadio>
+                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="2">
+                  采购额超出
+                </aRadio>
+              </aRadioGroup>
+            </div>
+          </div>,
+          onOk() {
+            if(_this.expenseOption){
+              _this.expenseOption = null
+              _this.expenseSave(hasExpense,_this.expenseOption)
+            }else{
+              _this.$message.info("请选择费用报销单类型!")
+            }
+          },
+          onCancel() {
             _this.expenseOption = null
-          }else{
-            _this.$message.info("请选择费用报销单类型!")
-            return true
-          }
-        },
-        onCancel() {
-          _this.expenseOption = null
-        },
-      });
+          },
+        });
+      }else{
+        // 直接转费用单
+        _this.expenseSave(hasExpense,_this.expenseOption)
+      }
+    },
+    // 转费用单
+    expenseSave(data){
+
     },
     changeDaOpt(e){
       this.expenseOption = e.target.value

+ 6 - 2
src/views/salesManagement/waitDispatch/edit.vue

@@ -199,7 +199,8 @@ export default {
         updateQty({
           dispatchBillDetailSn: record.dispatchBillDetailSn,
           qty: record.qty,
-          salesBillSn: _this.salesBillSn
+          salesBillSn: _this.salesBillSn,
+          dispatchBillSn: _this.productForm.dispatchBillSn
         }).then(res => {
           if (res.status == 200) {
             _this.$refs.partQuery.resetCurForm()
@@ -264,7 +265,10 @@ export default {
       const _this = this
       _this.delLoading = true
       _this.spinning = true
-      deleteBatch(type == 0 ? [row.dispatchBillDetailSn] : row).then(res => {
+      deleteBatch({
+        dispatchBillSn: this.productForm.dispatchBillSn,
+        dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
+      }).then(res => {
         if (res.status == 200) {
           _this.resetSearchForm()
           _this.$refs.partQuery.resetCurForm()

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

@@ -105,11 +105,11 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import dsModal from './dsModal.vue'
-import { salesDetailBySn } from '@/api/sales'
-import { salesDetailDispatchByOneKey, insertBatchOfWaitDispatch, salesDetailUpdateCancelQty } from '@/api/salesDetail'
+import { salesDetailBySn } from '@/api/salesNew'
+import { salesDetailDispatchByOneKey, insertBatchOfWaitDispatch, salesDetailUpdateCancelQty } from '@/api/salesDetailNew'
 import { deleteBatch, pushDown, waitDispatchDetailAllList, updateQty } from '@/api/waitDispatchDetail'
 import { findBySalesBillSn } from '@/api/dispatch'
-import { keys } from 'core-js/fn/array'
+
 export default {
   name: 'WaitDispatch',
   mixins: [commonMixin],
@@ -195,7 +195,8 @@ export default {
         updateQty({
           dispatchBillDetailSn: record.dispatchBillDetailSn,
           qty: record.qty,
-          salesBillSn: _this.salesBillSn
+          salesBillSn: _this.salesBillSn,
+          dispatchBillSn: _this.productForm.dispatchBillSn
         }).then(res => {
           if (res.status == 200) {
             _this.$refs.partQuery.resetCurForm()
@@ -260,12 +261,15 @@ export default {
       const _this = this
       _this.delLoading = true
       _this.spinning = true
-      deleteBatch(type == 0 ? [row.dispatchBillDetailSn] : row).then(res => {
+      deleteBatch({
+        dispatchBillSn: this.productForm.dispatchBillSn,
+        dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
+      }).then(res => {
         if (res.status == 200) {
           _this.resetSearchForm()
           _this.$refs.partQuery.resetCurForm()
           if (type == 1) { //  批量操作
-            _this.$refs.table.clearSelected() // 清空表格选中项
+            // 清空表格选中项
           } else if (type == 0) { //  单条
             const ind = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.findIndex(item => item == row.id)
             _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.splice(ind, 1)

+ 305 - 141
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -2,19 +2,19 @@
   <div class="productInfoList-wrap">
     <!-- 搜索条件 -->
     <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+      <a-form layout="inline" @keyup.enter.native="searchTable">
         <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>
@@ -57,17 +57,17 @@
     </div>
    
     <!-- alert -->
-    <div style="margin-bottom: 10px;display: flex;" v-if="detailData">
-      <div>
+    <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
+      <div style="display: flex;align-items: center;">
         <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
         <a-button type="danger" :disabled="newLoading" class="button-error" @click="handlePlCancel">批量取消</a-button>
-        <!-- <a-button type="default" :disabled="newLoading" @click="handleOneDispatch">有货一键下推</a-button> -->
+        <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
       </div>
       <div style="padding-left: 20px;">
         总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
         已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
         已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
-        待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;<br/>
+        待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
         <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
         <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
@@ -76,62 +76,35 @@
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
       </div>
     </div>
-     
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: record.surplusQty<=0 }})}"
-      @rowSelection="rowSelectionFun"
-      :columns="columns"
-      :showPagination="false"
-      :data="loadData"
-      :scroll="{ y: 300 }"
-      :defaultLoadData="false"
-      bordered>
-      <!-- 取消数量 -->
-      <template slot="nums" slot-scope="text, record">
-        <div v-if="record.surplusQty>0" @dblclick.stop>
-          <a-input-number
-            size="small"
-            v-model="record.cancelNums"
-            :precision="0"
-            :min="0"
-            :max="record.surplusQty"
-            style="width: 100%;"
-            placeholder="请输入" />
-        </div>
-        <div v-else>--</div>
-      </template>
-      <!-- 产品编码 -->
-      <template slot="productCode" slot-scope="text, record">
-        <a-badge count="促" v-if="record.promotionFlag == 1">
-          <div style="padding-right: 15px;">{{ text }}</div>
-        </a-badge>
-        <span v-else>{{ text }}</span>
-      </template>
-      <!-- 操作 -->
-      <template slot="action" slot-scope="text, record">
-        <a-button
-          size="small"
-          type="link"
-          class="button-info"
-          :loading="newLoading"
-          @click="handleAdd(record)"
-          v-if="record.surplusQty>0"
-          id="productInfoList-edit-btn">添加</a-button>
-        <span v-else>--</span>
-      </template>
-    </s-table>
+    
+    <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 { salesDetailAllStockList } from '@/api/salesDetail'
+import { salesPromoQueryList } from '@/api/salesNew'
+import { salesDetailAllList } from '@/api/salesDetailNew'
 import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 export default {
@@ -139,17 +112,22 @@ export default {
   mixins: [commonMixin],
   components: { STable, VSelect, chooseWarehouse },
   props: {
-    newLoading: Boolean
-  },
-  watch: {
-    data (newValue, oldValue) {
-      this.resetSearchForm()
+    newLoading: {
+        type: Boolean,
+        default: false
+    },
+    maxHeight:{
+          type: [String,Number],
+          default: '300'
+        },
+    showHeader: {
+        type: Boolean,
+        default: true
     }
   },
   data () {
     return {
       advanced: true, // 高级搜索 展开/关闭
-      showSetting: false, // 设置弹框
       productType: [],
       salesBillSn: '',
       detailData: null,
@@ -166,81 +144,257 @@ export default {
         warehouseSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        this.queryParam.salesBillSn = this.salesBillSn
-        return salesDetailAllStockList(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            if (data) {
-              // 根据类型过滤数据
-              data = data.filter(item => {
-                if (this.queryParam.ptype == '1') {
-                  return item != null && item.surplusQty > 0
-                }
-                if (this.queryParam.ptype == '2') {
-                  return item != null && item.surplusQty > 0 && item.surplusQty <= item.stockQty
-                }
-                if (this.queryParam.ptype == '3') {
-                  return item != null && item.surplusQty > item.stockQty
-                }
-                if (this.queryParam.ptype == '0') {
-                  return item != null
-                }
-              })
-              // 增加编号
-              const no = 0
-              for (var i = 0; i < data.length; i++) {
-                data[i].no = no + i + 1
-                data[i].cancelNums = data[i].surplusQty
-              }
-              this.disabled = false
+      activeList: [], // 活动列表
+      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";
             }
-          }
-          return data
-        })
+        },
+      },
+      columnWidthResizeOption: {
+          // default false
+          enable: true,
+          // column resize min width
+          minWidth: 50
+      },
+      cellSpanOption: {
+          bodyCellSpan: this.bodyCellSpan,
       },
-      rowSelectionInfo: null
+      checkboxOption:{
+          disableSelectedRowKeys: this.disableSelectedRowKeys,
+          selectedRowKeys: this.selectedRowKeys,
+          // 行选择改变事件
+          selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+            this.selectedRowChange({ row, isSelected, selectedRowKeys })
+          },
+          // 全选改变事件
+          selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+            this.selectedAllChange({ isSelected, selectedRowKeys })
+          },
+      },
+      showEmpty: false,
+      showTableHead: true,
+      disableSelectedRowKeys: [],
+      selectedRowKeys: []
     }
   },
   computed: {
     columns () {
-      const arr = [
-        // { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '14%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '出库仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '可用库存', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已取消', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已下推', dataIndex: 'pushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '待下推数量', dataIndex: 'surplusQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '取消数量', dataIndex: 'cancelNums', scopedSlots: { customRender: 'nums' }, width: '7%', align: 'center' },
-        { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
-      ]
+      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="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="(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: "", 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.splice(3, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        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')) {
-        const ind = this.$hasPermissions('B_salesDispatch_salesPrice') ? 4 : 3
-        arr.splice(ind, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
-      }
+        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: {
-    // 表格选中项
-    rowSelectionFun (obj) {
-      this.rowSelectionInfo = obj || null
+    // 合并活动分类单元格
+    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 = this.dataSource.map((x) => x.rowKey);
+    },
+    // 获取销售单参与的活动列表
+    getActiveList(){
+      salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
+        if(res.status == 200){
+          this.activeList = res.data || []
+        }
+        this.$nextTick(()=>{
+          this.searchTable()
+        })
+      })
+    },
+    async searchTable(){
+        this.dataSource = []
+        this.disabled = true
+        this.spinning = true
+        this.queryParam.salesBillSn = this.salesBillSn
+        this.queryParam.showStock = true
+        const params = this.queryParam
+        // 正常产品
+        const proList = await salesDetailAllList(params).then(res => res.data)
+        let listData = [{
+            id: 'promo-normal',
+            // 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 aclist = await salesDetailAllList(params).then(res => res.data)
+          // 获取活动产品统计
+          //const acTotal = await salesDetailCount(params).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
+        }
+
+        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 || '--'
+        })
+        this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
+        this.spinning = false
+        this.disabled = false
     },
-    // 类型变化,过滤列表
-    handlePtypeChange () {},
     //  重置
     resetSearchForm () {
       this.queryParam.ptype = '0'
@@ -253,22 +407,21 @@ export default {
       this.queryParam.productTypeSn3 = ''
       this.queryParam.warehouseSn = undefined
       this.productType = []
-      this.$refs.table.refresh(true)
+      this.dataSource = []
+      this.searchTable()
     },
     pageInit (salesBillSn, detailData) {
       this.salesBillSn = salesBillSn
       this.detailData = detailData
-      this.$refs.table.clearSelected()
-      this.resetSearchForm()
+      // 获取活动列表
+      this.getActiveList()
     },
     clearTable () {
-      this.rowSelectionInfo = null
-      this.$refs.table.clearSelected()
+       
     },
     // 刷新当前页面
     resetCurForm () {
-      this.$refs.table.clearSelected() // 清空表格选中项
-      this.$refs.table.refresh()
+       
     },
     // 添加
     handleAdd (row) {
@@ -323,10 +476,6 @@ export default {
 
       this.$emit('cancelProduct', obj)
     },
-    // 一键下推
-    handleOneDispatch () {
-      this.$emit('oneDispatch')
-    },
     //  产品分类  change
     changeProductType (val, opt) {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
@@ -336,3 +485,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>

+ 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,