lilei 1 year ago
parent
commit
9ea34f7c08

+ 8 - 91
src/config/router.config.js

@@ -119,7 +119,7 @@ export const asyncRouterMap = [
       // 销售管理
       {
         path: '/salesManagement',
-        redirect: '/salesManagement/salesQuery',
+        redirect: '/salesManagement/salesQueryNew',
         component: PageView,
         meta: {
           title: '销售管理',
@@ -127,96 +127,13 @@ export const asyncRouterMap = [
           permission: 'M_salesManagement'
         },
         children: [
-          {
-            path: '/salesManagement/salesQuery',
-            redirect: '/salesManagement/salesQuery/list',
-            name: 'salesQuery',
-            component: BlankLayout,
-            meta: {
-              title: '销售单查询',
-              icon: 'monitor',
-              permission: 'M_salesQueryList'
-            },
-            hideChildrenInMenu: true,
-            children: [
-              {
-                path: 'list',
-                name: 'salesQueryList',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/list.vue'),
-                meta: {
-                  title: '销售单列表',
-                  icon: 'monitor',
-                  hidden: true,
-                  permission: 'M_salesQueryList'
-                }
-              },
-              {
-                path: 'detail/:sn',
-                name: 'salesDetail',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/detail.vue'),
-                meta: {
-                  title: '销售单详情',
-                  icon: 'monitor',
-                  hidden: true,
-                  replaceTab: true,
-                  permission: 'B_salesDetail'
-                }
-              },
-              {
-                path: 'detail/:sn',
-                name: 'salesDetailAudit',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/detail.vue'),
-                meta: {
-                  title: '销售单审核',
-                  icon: 'monitor',
-                  hidden: true,
-                  replaceTab: true,
-                  permission: 'B_salesAudit'
-                }
-              },
-              {
-                path: 'add/:sn',
-                name: 'salesAdd',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
-                meta: {
-                  title: '新增销售单',
-                  icon: 'monitor',
-                  hidden: true,
-                  permission: 'B_salesEdit'
-                }
-              },
-              {
-                path: 'edit/:sn',
-                name: 'salesEdit',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
-                meta: {
-                  title: '编辑销售单',
-                  icon: 'monitor',
-                  hidden: true,
-                  permission: 'B_salesEdit'
-                }
-              },
-              {
-                path: 'waitDispatch/:salesBillSn',
-                name: 'waitDispatch',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/waitDispatch/edit.vue'),
-                meta: {
-                  title: '下推销售单',
-                  icon: 'monitor',
-                  replaceTab: true,
-                  hidden: true,
-                  permission: 'B_salesDispatch'
-                }
-              }
-            ]
-          },
           {
             path: '/salesManagement/salesQueryNew',
             redirect: '/salesManagement/salesQueryNew/list',
             name: 'salesQueryNew',
             component: BlankLayout,
             meta: {
-              title: '销售单查询(新版)',
+              title: '销售单查询',
               icon: 'monitor',
               permission: 'M_salesQueryList'
             },
@@ -227,7 +144,7 @@ export const asyncRouterMap = [
                 name: 'salesQueryNewList',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQueryNew/list.vue'),
                 meta: {
-                  title: '销售单列表(新版)',
+                  title: '销售单列表',
                   icon: 'monitor',
                   hidden: true,
                   permission: 'M_salesQueryList'
@@ -238,7 +155,7 @@ export const asyncRouterMap = [
                 name: 'salesNewDetail',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQueryNew/detail.vue'),
                 meta: {
-                  title: '销售单详情(新版)',
+                  title: '销售单详情',
                   icon: 'monitor',
                   hidden: true,
                   replaceTab: true,
@@ -250,7 +167,7 @@ export const asyncRouterMap = [
                 name: 'salesNewDetailAudit',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQueryNew/detail.vue'),
                 meta: {
-                  title: '销售单审核(新版)',
+                  title: '销售单审核',
                   icon: 'monitor',
                   hidden: true,
                   replaceTab: true,
@@ -262,7 +179,7 @@ export const asyncRouterMap = [
                 name: 'salesNewAdd',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQueryNew/edit.vue'),
                 meta: {
-                  title: '新增销售单(新版)',
+                  title: '新增销售单',
                   icon: 'monitor',
                   hidden: true,
                   permission: 'B_salesEdit'
@@ -273,7 +190,7 @@ export const asyncRouterMap = [
                 name: 'salesNewEdit',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQueryNew/edit.vue'),
                 meta: {
-                  title: '编辑销售单(新版)',
+                  title: '编辑销售单',
                   icon: 'monitor',
                   hidden: true,
                   permission: 'B_salesEdit'
@@ -284,7 +201,7 @@ export const asyncRouterMap = [
                 name: 'waitDispatchNew',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/waitDispatchNew/edit.vue'),
                 meta: {
-                  title: '下推销售单(新版)',
+                  title: '下推销售单',
                   icon: 'monitor',
                   replaceTab: true,
                   hidden: true,

+ 18 - 8
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -93,7 +93,8 @@
           isCityPrice: false,
           outStockStr: '',
           showEmpty: false,
-          showTableHead: true
+          showTableHead: true,
+          colspanNums: 13
         }
       },
       computed: {
@@ -143,9 +144,9 @@
                       </div>
                     ):(<div></div>)}
                     <div>
-                        {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总售价:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
-                        总款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
-                        总数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
+                        款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
+                        数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
+                        {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
                     </div>
                   </div>
                 ):(<span>{data}</span>)}
@@ -159,33 +160,41 @@
                 { 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] || '--'}}
             ]
-
+            this.colspanNums = 5
             if (this.$hasPermissions(this.authCode + '_costPrice')) { //  成本价权限
-                arr.push({ title: '成本价', field: 'showCost', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+              this.colspanNums = this.colspanNums + 1
+              arr.push({ title: '成本价', field: 'showCost', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
             }
+            this.colspanNums = this.colspanNums + 2
             arr = arr.concat([
                 { title: '单位', field: 'productOrigUnit',key: "g", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
                 { title: '销售数量', field: 'qty', width: 80,key: "h", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} }
             ])
 
             if (this.$hasPermissions(this.authCode + '_provincePrice')) {
-                arr.push({ title: '省级价', field: 'provincePrice', width: 80,key: "i", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+              this.colspanNums = this.colspanNums + 1
+              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) {
+              this.colspanNums = this.colspanNums + 1
                 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')) { //  售价权限
+                  this.colspanNums = this.colspanNums + 1
                     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')) { //  售价权限
+                  this.colspanNums = this.colspanNums + 1
                     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) { //  审核,需用到库存
+              this.colspanNums = this.colspanNums + 1
                 arr.push({ title: '库存', field: 'stockQty', width: 80,key: "m", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} })
             }
+            this.colspanNums = this.colspanNums + 3
             arr = arr.concat([
                 { 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])} },
@@ -209,7 +218,7 @@
             if(column.field=='no'){
               return {
                         rowspan: 1,
-                        colspan: column.length,
+                        colspan: this.colspanNums,
                     };
             }else{
               return {
@@ -301,6 +310,7 @@
                 str = str.substr(0, str.length - 1)
                 this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
             }
+            this.showEmpty = this.dataSource.length <= 0
             this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
             this.spinning = false
             this.disabled = false

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

@@ -29,13 +29,13 @@
             </div>
           </a-descriptions-item>
           <a-descriptions-item label="显示正价产品款数">
-            40
+            {{ descDetail.restrictCategory||'--' }}
           </a-descriptions-item>
           <a-descriptions-item label="订单起订金额">
-            {{ descDetail.minOrderAmount }}
+            {{ descDetail.minOrderAmount||'--' }}
           </a-descriptions-item>
           <a-descriptions-item label="活动经费上线">
-            {{ descDetail.upperLimitAmount }}
+            {{ descDetail.upperLimitAmount||'--' }}
           </a-descriptions-item>
         </a-descriptions>
     </div>
@@ -230,7 +230,7 @@
                 </div>
                 <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 v-if="$hasPermissions('B_salesEdit_salesPrice')">优惠金额:<strong>{{ countData&&(countData.lossAmount || countData.lossAmount==0) ? toThousands(countData.lossAmount) : '--' }}</strong></div>
                 </div>
               </div>
             </div>
@@ -461,6 +461,7 @@
             deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: _this.promo.salesPromoSn }).then(res => {
               if (res.status == 200) {
                 _this.resetSearchForm(true)
+                _this.$emit('insterOk','promo')
                 _this.$message.success(res.message)
               }
               _this.spinning = false
@@ -492,6 +493,7 @@
             }).then(res => {
               if (res.status == 200) {
                 _this.resetSearchForm(true)
+                _this.$emit('insterOk','promo')
                 _this.$message.success(res.message)
               }
               _this.spinning = false
@@ -572,8 +574,9 @@
             salesBillSn: _this.salesBillSn,
             salesPromoSn: _this.promo.salesPromoSn
           }).then(res => {
-            _this.resetSearchForm(true)
             if (res.status == 200) {
+              _this.resetSearchForm(true)
+              _this.$emit('insterOk','promo')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -629,7 +632,7 @@
             this.$emit("upActive",editRow, data)
           }else{
             // 刷下正常产品列表
-            this.$emit('insterOk')
+            this.$emit('insterOk', 'promo')
           }
         }
         this.openUpActiveModal = false
@@ -674,7 +677,7 @@
           if (res.status == 200) {
             this.resetSearchForm()
             this.$message.success('产品添加成功', 2.5)
-            this.$emit('insterOk')
+            this.$emit('insterOk','promo')
           }
           this.spinning = false
           this.isInster = false

+ 9 - 10
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -227,7 +227,7 @@
         loadData: parameter => {
           this.disabled = true
           this.queryParam.salesBillSn = this.salesBillSn || ''
-          // this.getCount()
+          this.getCount()
           return salesDetailList(Object.assign(parameter, this.queryParam, {showStock: true})).then(res => {
             let data
             if (res.status == 200) {
@@ -328,7 +328,7 @@
             deleteAll({ salesBillSn: _this.salesBillSn }).then(res => {
               if (res.status == 200) {
                 _this.resetSearchForm(true)
-                // _this.$refs.promotable.resetCurForm()
+                _this.$emit('insterOk','normal')
                 _this.$message.success(res.message)
               }
               _this.spinning = false
@@ -359,7 +359,7 @@
             }).then(res => {
               if (res.status == 200) {
                 _this.resetSearchForm(true)
-                // _this.$refs.promotable.resetCurForm()
+                _this.$emit('insterOk','normal')
                 _this.$message.success(res.message)
               }
               _this.spinning = false
@@ -397,7 +397,6 @@
           if (res.status == 200) {
             _this.openWarehouseModal = false
             _this.resetSearchForm(true)
-            // _this.$refs.promotable.resetCurForm()
             _this.$message.success(res.message)
           }
           _this.$refs.table.refresh(true)
@@ -436,9 +435,9 @@
             qty: record.qty,
             salesBillSn: _this.salesBillSn
           }).then(res => {
-            _this.resetSearchForm(true)
-            // _this.$refs.promotable.resetCurForm()
             if (res.status == 200) {
+              _this.resetSearchForm(true)
+              _this.$emit('insterOk','normal')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -473,8 +472,8 @@
             salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
               if (res.status == 200) {
                 _this.resetSearchForm(true)
-                // _this.$refs.promotable.resetCurForm()
                 _this.$message.success(res.message)
+                _this.$emit('insterOk','normal')
               }
               _this.delLoading = false
               _this.spinning = false
@@ -515,12 +514,12 @@
           if (res.status == 200) {
             this.resetSearchForm()
             this.$message.success('产品添加成功', 2.5)
-            this.spinning = false
-          } else {
-            this.spinning = false
+            this.$emit('insterOk','normal')
           }
+          this.spinning = false
           this.isInster = false
         }).catch(err => {
+          this.spinning = false
           this.isInster = false
         })
       },

+ 1 - 1
src/views/salesManagement/salesQueryNew/detail.vue

@@ -83,7 +83,7 @@
                 <span v-if="$hasPermissions(authCode + '_salesPrice')">已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? toThousands(detailData.totalDispatchAmount) : '--' }}</strong>;</span>
                 <span v-if="$hasPermissions(authCode + '_salesPrice')">待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? toThousands(detailData.totalUndispatchAmount) : '--' }}</strong>;</span>
                 <span v-if="isCityPrice">市级总售价:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? toThousands(detailData.totalCityAmount) : '--' }}</strong>;</span>
-                <span v-if="$hasPermissions(authCode + '_salesPrice')">优惠金额:<strong style="color: red;">{{ detailData&&(detailData.totalLossAmount || detailData.totalLossAmount==0) ? toThousands(detailData.totalLossAmount) : '--' }}</strong>;</span>
+                <span v-if="$hasPermissions(authCode + '_salesPrice')" style="color: red;">优惠金额:<strong>{{ detailData&&(detailData.totalLossAmount || detailData.totalLossAmount==0) ? toThousands(detailData.totalLossAmount) : '--' }}</strong>;</span>
               </div>
               <div>
                 <a-button v-if="detailData && (detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'HQ_CHANGE')" type="link" @click="openStockOut">缺货明细</a-button>

+ 18 - 4
src/views/salesManagement/salesQueryNew/edit.vue

@@ -33,6 +33,7 @@
         <div style="padding: 10px;">
           <productNormalList 
           ref="productNormalList" 
+          @insterOk="insterActiveOk"
           @openCpModal="openProductModal" 
           :detailData="detailData" 
           :warehouseSn="warehouseSn" 
@@ -46,6 +47,7 @@
       class="salesEdit-cont" 
       v-for="item in activeList" 
       :key="item.promoRuleSn" 
+      v-if="activeList.length"
       >
         <div slot="title" style="display: inline-block;width:100%;">
           <strong style="margin-right:10px;font-size:14px;">{{item.promotion.title}}</strong> ({{item.promotionRule.description}})
@@ -199,7 +201,9 @@ export default {
         if (res.status == 200) {
           this.detailData = res.data
         }
-        this.getActiveList()
+        if(flag){
+          this.getActiveList()
+        }
       })
     },
     // 优惠明细查看
@@ -263,9 +267,19 @@ export default {
         this.showCpModal = true
     },
     // 添加活动产品成功的回调
-    insterActiveOk(){
-      // 刷新正常产品列表
-      this.$refs.productNormalList.resetSearchForm()
+    insterActiveOk(type){
+      if(type == 'promo'){
+        // 刷新正常产品列表
+        this.$refs.productNormalList.resetSearchForm()
+      }
+      if(type == 'normal'){
+        // 刷新活动产品列表
+        this.activeList.map(item => {
+          this.$refs['productList-' + item.promoRuleSn][0].resetSearchForm()
+        })
+      }
+      
+      this.getOrderDetail()
     },
     // 新增产品
     insterProduct(row, promotionFlag, type){

+ 8 - 9
src/views/salesManagement/salesQueryNew/list.vue

@@ -88,7 +88,7 @@
               <a-col :md="6" :sm="24">
                 <a-form-item label="促销单">
                   <v-select
-                    v-model="queryParam.cxFlag"
+                    v-model="queryParam.promoFlag"
                     ref="cxFlag"
                     code="FLAG"
                     placeholder="请选择是否促销单"
@@ -162,13 +162,10 @@
         bordered>
         <!-- 销售单号 -->
         <template slot="salesBillNo" slot-scope="text, record">
-          <div v-if="$hasPermissions('B_salesDetail')">
-            <a-badge :count="'改'+record.changeTimes" :offset="[16,-13]" v-if="record.changeTimes>0" class="badge-con-t">
-              <span class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
-            </a-badge>
-            <span v-else class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
-          </div>
-          <div v-else>{{ record.salesBillNo }}</div>
+          <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
+          <span v-else>{{ record.salesBillNo }}</span>
+          <a-badge :count="'改'+record.changeTimes" :number-style="{ zoom:'80%' }" v-if="record.changeTimes>0"></a-badge>
+          <a-badge count="促" v-if="record.promoFlag==1" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
         </template>
         <!-- 出库仓库 -->
         <template slot="warehouseBox" slot-scope="text, record">
@@ -335,7 +332,8 @@ export default {
           subareaAreaSn: undefined
         },
         shippingAddrProvinceSn: undefined,
-        warehouseSn: undefined
+        warehouseSn: undefined,
+        promoFlag: undefined
       },
       totalData: {
         totalAmount: 0,
@@ -623,6 +621,7 @@ export default {
       this.queryParam.subareaArea.subareaAreaSn = undefined
       this.queryParam.shippingAddrProvinceSn = undefined
       this.queryParam.warehouseSn = undefined
+      this.queryParam.promoFlag = undefined
       if (this.advanced) {
         this.$refs.subarea.clearData()
       }

+ 118 - 153
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -1,17 +1,16 @@
 <template>
     <div class="productInfoList-wrap">
       <!-- alert -->
-      <div style="margin-bottom: 10px;display: flex;align-items: center;">
+      <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="!showEmpty">
         <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-info" @click="delSalerDetailAll">批量删除</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 style="padding-left: 20px;">
+          <slot name="total"></slot>
         </div>
       </div>
-      
+
       <a-spin :spinning="spinning" tip="Loading...">
           <ve-table
                 border-y
@@ -30,7 +29,7 @@
                 :column-width-resize-option="columnWidthResizeOption"
                 :checkbox-option="checkboxOption"
               />
-          <div v-show="showEmpty" class="empty-data">暂无数据</div>
+          <div v-show="showEmpty" class="empty-data">暂无待下推产品</div>
       </a-spin>
   
     </div>
@@ -39,7 +38,6 @@
   <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'
@@ -63,8 +61,8 @@
     },
     data () {
       return {
-        queryParam: {
-            dispatchBillSn
+        productForm: {
+            dispatchBillSn: ''
         },
         disabled: false, //  查询、重置按钮是否可操作
         spinning: false,
@@ -89,7 +87,9 @@
         showEmpty: false,
         showTableHead: true,
         disableSelectedRowKeys: [],
-        selectedRowKeys: []
+        selectedRowKeys: [],
+        detailData: null,
+        activeList: []
       }
     },
     computed: {
@@ -122,10 +122,10 @@
                 ftext = '促'
                 fcolor = '#52c41a'
               }
-              if(record.promotionFlag == 'REGULAR'){
-                ftext = '正'
-                fcolor = '#108ee9'
-              }
+              // if(record.promotionFlag == 'REGULAR'){
+              //   ftext = '正'
+              //   fcolor = '#108ee9'
+              // }
               if(record.promotionFlag == 'DISCOUNT'){
                 ftext = '特'
                 fcolor = '#faad14'
@@ -145,9 +145,10 @@
               <div>
                 <a-input-number
                   size="small"
-                  vModel={record.cancelNums}
+                  value={record.qty}
+                  onChange={e => _this.cancelNumsChange(e,record)}
                   precision={0}
-                  min={0}
+                  min={1}
                   max={record.surplusQty}
                   style="width: 100%;"
                   placeholder="请输入" />
@@ -164,75 +165,31 @@
                  <a-button
                   size="small"
                   type="link"
-                  class="button-info"
-                  onClick={()=>_this.handleAdd(record)}
-                  >添加</a-button>
+                  class="button-error"
+                  onClick={()=>_this.handleDel(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: 'no',key: "a", width: 50, align: 'center', 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: 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] || '--'}}
+              { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+              { title: '待下推数量', field: 'surplusQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
+              { title: '本次下推数', field: 'qty', width: 80,key: "r", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
+              { title: '单位', field: 'productOrigUnit',key: "i", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+              { 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)} }
           ]
-        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) {
@@ -259,29 +216,15 @@
         // 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 params = this.productForm
+          // 带下推产品
           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
   
@@ -294,100 +237,122 @@
             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)
+            const warehouseName = item.dispatchBill && item.dispatchBill.warehouseName || ''
             item.productCode = productCode || '--'
             item.productName = productName || '--'
             item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
             item.productOrigUnit = productOrigUnit || '--'
-            if(item.stockQty<0 || !item.stockQty){
-              this.disableSelectedRowKeys.push(item.id)
-            }
+            item.warehouseName = warehouseName || '--'
+            item.qtyBackups = item.qty
           })
-          this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
+          this.showEmpty = this.dataSource.length <= 0
+          this.tableHeight = (this.showEmpty ? 300 : 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.clearSelectTable()
         this.searchTable()
       },
-      pageInit (salesBillSn, detailData) {
-        this.salesBillSn = salesBillSn
+      pageInit (productForm, detailData, activeList) {
+        this.productForm = Object.assign(this.productForm,productForm)
         this.detailData = detailData
+        this.activeList = activeList
         // 获取活动列表
-        this.getActiveList()
+        this.resetSearchForm()
       },
       // 清空选项
       clearSelectTable () {
          this.selectedRowKeys = []
       },
-      // 添加
-      handleAdd (row) {
-        if (row.stockQty > 0) { //  可用库存大于0才可添加
-          this.$emit('addProduct', [row.salesBillDetailSn])
+      // 已选产品  blur
+      cancelNumsChange (val, record) {
+        const _this = this
+        if (val && val != record.qtyBackups) {
+          _this.spinning = true
+          updateQty({
+            dispatchBillDetailSn: record.dispatchBillDetailSn,
+            qty: record.qty,
+            salesBillSn: _this.detailData.salesBillSn,
+            dispatchBillSn: _this.productForm.dispatchBillSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.spinning = false
+              _this.$emit('refashTable')
+            } else {
+              _this.spinning = false
+            }
+          })
         } else {
-          this.$message.warning('库存为0,不可添加!')
+          record.qty = record.qtyBackups
         }
       },
-      // 批量添加
-      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)
+       // 删除产品
+        handleDel (row) {
+          const _this = this
+          this.$confirm({
+            title: '提示',
+            content: '确认要删除吗?',
+            centered: true,
+            closable: true,
+            onOk () {
+              _this.deleteFun(row, 0)
+            }
+          })
+        },
+        // 移除操作
+        deleteFun (row, type) {
+          const _this = this
+          _this.spinning = true
+          deleteBatch({
+            dispatchBillSn: this.productForm.dispatchBillSn,
+            dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$emit('refashTable')
+              _this.$message.success(res.message)
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        },
+        // 批量删除
+        delSalerDetailAll () {
+          const _this = this
+          const chooseList = this.selectedRowKeys
+          if (chooseList.length == 0) {
+            _this.$message.warning('请选择待下推产品!')
+            return
           }
-        })
-      },
-      // 批量取消
-      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
+          const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+          const obj = []
+          chooseRow && chooseRow.map(item => {
+            obj.push(item.dispatchBillDetailSn)
           })
-        })
-  
-        this.$emit('cancelProduct', obj)
-      }
+
+          this.$confirm({
+            title: '提示',
+            content: '确认要批量删除吗?',
+            centered: true,
+            closable: true,
+            onOk () {
+              _this.deleteFun(obj, 1)
+            }
+          })
+        },
     }
   }
   </script>
   <style lang="less">
+  .empty-data{
+        color: #999;
+        text-align: center;
+        padding: 20px;
+    }
     .ve-table-body-td{
       .active-title{
         display: flex;

+ 26 - 187
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -23,64 +23,13 @@
           </div>
         </div>
 
-        <div style="margin: 0 0 10px 0;">
-          <a-button
-            type="danger"
-            @click="delSalerDetailAll"
-            :loading="delLoading"
-            id="waitDispatch-del-all">批量移除</a-button>
-
-            <div style="display: inline-block;margin-left: 15px;">
-              本次下推款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
-              本次下推数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
-            </div>
-        </div>
-        
         <!-- 已选配件列表 -->
-        <s-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.id"
-          :row-selection="{ columnWidth: 40 }"
-          @rowSelection="rowSelectionFun"
-          :columns="columns"
-          :data="loadData"
-          :showPagination="false"
-          :scroll="{ y: 300 }"
-          :defaultLoadData="false"
-          bordered>
-          <!-- 产品编码 -->
-          <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="salesNums" slot-scope="text, record">
-            <a-input-number
-              id="salesReturn-qty"
-              size="small"
-              v-model="record.qty"
-              :precision="0"
-              :min="1"
-              :max="record.surplusQty"
-              placeholder="请输入"
-              @blur="e => onCellBlur(e.target.value, record)"
-              style="width: 100%;" />
-          </template>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button
-              size="small"
-              type="link"
-              :loading="delLoading"
-              class="button-error"
-              @click="handleDel(record)"
-            >移除</a-button>
+        <detailProductList ref="waitProduct" @refashTable="refashTable">
+          <template slot="total">
+            本次下推款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
+            本次下推数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
           </template>
-        </s-table>
+        </detailProductList>
       </a-card>
     </a-spin>
     <div class="affix-cont">
@@ -101,18 +50,19 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { STable, VSelect } from '@/components'
+import { VSelect } from '@/components'
 import queryPart from './queryPart.vue'
+import detailProductList from './detailProductList.vue'
 import dsModal from './dsModal.vue'
 import { salesDetailBySn } from '@/api/salesNew'
 import { insertBatchOfWaitDispatch, salesDetailUpdateCancelQty } from '@/api/salesDetailNew'
-import { deleteBatch, pushDown, waitDispatchDetailAllList, updateQty } from '@/api/waitDispatchDetail'
+import { pushDown } from '@/api/waitDispatchDetail'
 import { findBySalesBillSn } from '@/api/dispatch'
 
 export default {
   name: 'WaitDispatch',
   mixins: [commonMixin],
-  components: { STable, VSelect, queryPart, dsModal },
+  components: { detailProductList, VSelect, queryPart, dsModal },
   data () {
     return {
       showDsModal: false,
@@ -123,152 +73,36 @@ export default {
       delLoading: false, // 是否正在移除产品
       loading: false, // 是否下推中
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
-      dataSource: [],
       productForm: {
         dispatchBillSn: ''
       },
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '26%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '29%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '出库仓库', dataIndex: 'dispatchBill.warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '待下推数量', dataIndex: 'surplusQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本次下推数', scopedSlots: { customRender: 'salesNums' }, width: '11%', align: 'center' },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        // 查询统计
-        return waitDispatchDetailAllList(Object.assign(parameter, this.productForm)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = 0
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = no + i + 1
-              data[i].qtyBackups = data[i].qty
-            }
-            this.disabled = false
-            this.dataSource = data
-          }
-          return data
-        })
-      },
-      totalData: null,
-      rowSelectionInfo: null
+      totalData: null
     }
   },
   methods: {
-    // 表格选中项
-    rowSelectionFun (obj) {
-      this.rowSelectionInfo = obj || null
-    },
     // 统计查询
-    getTotalData () {
+    getTotalData (flag) {
       findBySalesBillSn({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
         if (res.status == 200) {
           this.totalData = res.data || null
           if (res.data && Object.keys(res.data).length > 0) {
             this.productForm.dispatchBillSn = res.data.dispatchBillSn
             const _this = this
-            this.$nextTick(() => {
-              _this.$refs.table.refresh()
-            })
-          } else {
-            this.dataSource = []
-            this.$refs.table.clearTable()
+            if(flag){
+              _this.$refs.waitProduct.pageInit(this.productForm, this.detailData, this.$refs.partQuery.activeList)
+            }else{
+              _this.$refs.waitProduct.resetSearchForm()
+            }
           }
         } else {
           this.totalData = null
         }
       })
     },
-    // 已选产品  blur
-    onCellBlur (val, record) {
-      const _this = this
-      if (val && val != record.qtyBackups) {
-        _this.spinning = true
-        updateQty({
-          dispatchBillDetailSn: record.dispatchBillDetailSn,
-          qty: record.qty,
-          salesBillSn: _this.salesBillSn,
-          dispatchBillSn: _this.productForm.dispatchBillSn
-        }).then(res => {
-          if (res.status == 200) {
-            _this.$refs.partQuery.resetCurForm()
-            _this.$message.success(res.message)
-            _this.spinning = false
-            _this.getTotalData()
-          } else {
-            _this.spinning = false
-          }
-        })
-      } else {
-        record.qty = record.qtyBackups
-      }
-    },
     //  返回
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
     },
-    // 批量删除
-    delSalerDetailAll () {
-      const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
-        _this.$message.warning('请在选择待下推产品!')
-        return
-      }
-      const obj = []
-      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
-        if (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.indexOf(item.id) != -1) {
-          obj.push(item.dispatchBillDetailSn)
-        }
-      })
-      this.$confirm({
-        title: '提示',
-        content: '确认要批量删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.deleteFun(obj, 1)
-        }
-      })
-    },
-    // 删除产品
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.deleteFun(row, 0)
-        }
-      })
-    },
-    // 移除操作
-    deleteFun (row, type) {
-      const _this = this
-      _this.delLoading = true
-      _this.spinning = true
-      deleteBatch({
-        dispatchBillSn: this.productForm.dispatchBillSn,
-        dispatchBillDetailList : type == 0 ? [row.dispatchBillDetailSn] : row
-      }).then(res => {
-        if (res.status == 200) {
-          _this.getTotalData()
-          _this.$message.success(res.message)
-          _this.spinning = false
-        } else {
-          _this.spinning = false
-        }
-        _this.delLoading = false
-      })
-    },
     // 添加产品
     insterProduct (list) {
       // 防止多次添加产品
@@ -286,6 +120,7 @@ export default {
       }).then(res => {
         if (res.status == 200) {
           this.getTotalData()
+          this.$refs.partQuery.clearSelectTable()
           this.$message.success('添加成功', 2.5)
           this.spinning = false
         } else {
@@ -315,18 +150,24 @@ export default {
         this.isInster = false
       })
     },
+    refashTable(){
+      this.getTotalData()
+      // this.$refs.partQuery.resetSearchForm()
+    },
     //  销售单详情
     getOrderDetail () {
-      salesDetailBySn({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
+      salesDetailBySn({ salesBillSn: this.salesBillSn }).then(res => {
         if (res.status == 200) {
           this.detailData = res.data
-          this.$refs.partQuery.pageInit(this.$route.params.salesBillSn, this.detailData)
+          this.getTotalData(true)
+          this.$refs.partQuery.pageInit(this.salesBillSn, this.detailData)
         }
       })
     },
     // 提交下推
     handleDispatch () {
-      if (this.dataSource.length) {
+      const dataSource = this.$refs.waitProduct.dataSource
+      if (dataSource.length) {
         this.showDsModal = true
         this.detailData.dispatchBillCount = this.totalData.dispatchBillCount
         this.detailData.receiverName = this.totalData.receiverName ? this.totalData.receiverName : ''
@@ -355,11 +196,9 @@ export default {
       })
     },
     pageInit () {
-      this.rowSelectionInfo = null
       this.$refs.partQuery.clearSelectTable()
       this.salesBillSn = this.$route.params.salesBillSn
       this.getOrderDetail()
-      this.getTotalData()
     }
   },
   mounted () {

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

@@ -14,17 +14,17 @@
               <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="4" :sm="24">
             <a-form-item label="是否促销品">
               <v-select
                 code="FLAG"
-                id="productInfoList-promotionFlag"
-                v-model="queryParam.promotionFlag"
+                id="productInfoList-promoFlag"
+                v-model="queryParam.promoFlag"
                 allowClear
                 placeholder="请选择是否"
               ></v-select>
             </a-form-item>
-          </a-col> -->
+          </a-col>
           <a-col :md="4" :sm="24">
             <a-form-item label="类型">
               <a-select v-model.trim="queryParam.ptype" :dropdownMatchSelectWidth="false" >
@@ -135,7 +135,7 @@ export default {
         ptype: '0', // 类型
         productCode: '', //  产品编码
         productName: '', //  产品名称
-        promotionFlag: undefined, //  是否促销品
+        promoFlag: undefined, //  是否促销品
         brandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
@@ -167,7 +167,8 @@ export default {
       showEmpty: false,
       showTableHead: true,
       disableSelectedRowKeys: [],
-      selectedRowKeys: []
+      selectedRowKeys: [],
+      colspanNums: 16
     }
   },
   computed: {
@@ -266,9 +267,9 @@ export default {
                   </div>
                 ):(<div></div>)}
                 <div>
-                    {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总售价:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
-                    总款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
-                    总数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
+                    款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
+                    数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
+                    {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
                 </div>
               </div>
             ):(<span>{data}</span>)}
@@ -284,12 +285,16 @@ export default {
             { 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] || '--'}}
         ]
+      this.colspanNums = 6
       if (this.$hasPermissions('B_salesDispatch_salesPrice')) { //  售价权限
+        this.colspanNums = this.colspanNums + 1
         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')) {
+        this.colspanNums = this.colspanNums + 1
         arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
       }    
+      this.colspanNums = this.colspanNums + 8
       arr = arr.concat([
           { 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])} },
@@ -317,7 +322,7 @@ export default {
         if(column.field=='no'){
           return {
                     rowspan: 1,
-                    colspan: column.length,
+                    colspan: this.colspanNums,
                 };
         }else{
           return {
@@ -414,6 +419,7 @@ export default {
             this.disableSelectedRowKeys.push(item.id)
           }
         })
+        this.showEmpty = this.dataSource.length <= 0
         this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
         this.spinning = false
         this.disabled = false
@@ -431,6 +437,7 @@ export default {
       this.queryParam.warehouseSn = undefined
       this.productType = []
       this.dataSource = []
+      this.clearSelectTable()
       this.searchTable()
     },
     pageInit (salesBillSn, detailData) {
@@ -500,6 +507,11 @@ export default {
 }
 </script>
 <style lang="less">
+    .empty-data{
+        color: #999;
+        text-align: center;
+        padding: 20px;
+    }
   .ve-table-body-td{
     .active-title{
       display: flex;