lilei 1 gadu atpakaļ
vecāks
revīzija
b549d3b7bd

+ 223 - 0
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -0,0 +1,223 @@
+<template>
+    <!-- 已选配件列表 -->
+    <a-spin :spinning="spinning" tip="Loading...">
+        <ve-table
+              border-y
+              :border-around="false"
+              :max-height="tableHeight+'px'"
+              :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"
+            />
+        <div v-show="showEmpty" class="empty-data">暂无数据</div>
+    </a-spin>
+  </template>
+  
+  <script>
+    import { commonMixin } from '@/utils/mixin'
+    import { salesDetailAllList } from '@/api/salesDetailNew'
+    export default {
+      name: 'DetailProductList',
+      mixins: [commonMixin],
+      components: { },
+      props: {
+        newLoading: Boolean,
+        detailData: {
+          type: Object,
+          default: function(){return null}
+        },
+        promo: {
+          type: Object,
+          default: function(){return null}
+        },
+        id: {
+          type: String,
+          default: ''
+        },
+        warehouseSn: {
+          type: String,
+          default: ''
+        },
+        salesBillSn: {
+          type: String,
+          default: ''
+        },
+        showCityPrice: {
+            type: Boolean,
+            default: false
+        },
+        authCode: {
+          type: String,
+          default: ''
+        }
+      },
+      data () {
+        return {
+          spinning: false,
+          dataSource: [],
+          tableHeight: 200,
+          cellStyleOption: {},
+          isCityPrice: false,
+          outStockStr: '',
+          showEmpty: false
+        }
+      },
+      computed: {
+        columns () {
+          const _this = this
+          const priceFormat = function(data){
+            return _this.toThousands(data) || '--'
+          }
+          const numsFormat = function(data){
+            return data || data == 0 ? data : '--'
+          }
+          const codeFormat = function(record,data,h){
+            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>
+                )
+            }
+            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=='DISCOUNT'){
+                return (
+                    <div>
+                        <span style="padding-right: 15px;">{data}</span>
+                        <a-badge count="特" number-style={{ backgroundColor: '#faad14', zoom:'80%' }}></a-badge>
+                    </div>
+                )
+            }
+            if(Number(record.stockQty||0) < Number(record.unpushedQty||0)){
+                return (
+                    <div>
+                        <span style="padding-right: 15px;">{data}</span>
+                        <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: '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] || '--'}}
+            ]
+
+            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 = 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: 100,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])} })
+                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])} })
+                }
+            } 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])} })
+                }
+            }
+
+            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 = 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])} }
+            ])
+          return arr
+        },
+        showStock(){
+            return this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')
+        }
+      },
+      watch: {
+        showCityPrice(newValue, oldValue){
+            this.isCityPrice = newValue
+        },
+        salesBillSn(newValue, oldValue){
+             
+        }
+      },
+      methods: {
+         // 获取表格数据
+         getTableData(){
+            this.spinning = true
+            const params = {
+                salesBillSn: this.salesBillSn,
+                showStock: this.showStock,
+                warehouseSn: this.warehouseSn
+            }
+            // 活动列表
+            if(this.promo){
+                params.promoRuleSn = this.promo.promoRuleSn
+                params.promoSn = this.promo.promoSn
+                params.salesPromoSn = this.promo.salesPromoSn
+            }
+            salesDetailAllList(params).then(res => {
+              let data
+              if (res.status == 200) {
+                data = res.data
+                const no = 0
+                this.outStockStr = ''
+                let str = ''
+                for (var i = 0; i < data.length; i++) {
+                    data[i].no = no + i + 1
+                    const productCode = (data[i].productEntity && data[i].productEntity.code) || (data[i].dealerProductEntity && data[i].dealerProductEntity.code)
+                    const productName = (data[i].productEntity && data[i].productEntity.name) || (data[i].dealerProductEntity && data[i].dealerProductEntity.name)
+                    const productOrigCode = (data[i].productEntity && data[i].productEntity.origCode) || (data[i].dealerProductEntity && data[i].dealerProductEntity.origCode)
+                    const productOrigUnit = (data[i].productEntity && data[i].productEntity.unit) || (data[i].dealerProductEntity && data[i].dealerProductEntity.unit)
+                    data[i].productCode = productCode || '--'
+                    data[i].productName = productName || '--'
+                    data[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
+                    data[i].productOrigUnit = productOrigUnit || '--'
+                    if (data[i].unpushedQty && (Number(data[i].stockQty) < Number(data[i].unpushedQty))) {
+                        str += data[i].productCode + '、'
+                    }
+                }
+                if (str.length > 0) {
+                    str = str.substr(0, str.length - 1)
+                    this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
+                }
+                this.showEmpty = data.length <= 0
+                this.tableHeight = this.showEmpty ? 30 : 200
+                this.spinning = false
+                this.dataSource = data
+              }
+            })
+         }
+      }
+    }
+  </script>
+  
+  <style lang="less">
+    .empty-data{
+        color: #999;
+        text-align: center;
+        padding: 20px;
+    }
+  </style>

+ 107 - 145
src/views/salesManagement/salesQueryNew/detail.vue

@@ -17,7 +17,7 @@
             class="button-info"
             id="salesDetail-xs-print-btn"
             v-if="$hasPermissions('B_salesPrint')"
-            :disabled="localDataSource.length==0"
+            :disabled="hasData"
             @click="handlePrint('SALES_BILL','B_salesPrint')">销售打印</a-button>
           <a-button
             key="2"
@@ -25,7 +25,7 @@
             class="button-info"
             id="salesDetail-xsfl-print-btn"
             v-if="$hasPermissions('B_salesTypePrint')"
-            :disabled="localDataSource.length==0"
+            :disabled="hasData"
             @click="handlePrint('SALES_BILL_TYPE','B_salesTypePrint')">销售分类打印</a-button>
           <a-divider type="vertical" />
           <a-button
@@ -34,7 +34,7 @@
             class="button-info"
             id="salesDetail-export-btn"
             v-if="$hasPermissions('B_salesDetailExport')"
-            :disabled="localDataSource.length==0"
+            :disabled="hasData"
             @click="handlePrint('export','B_salesDetailExport')">导出Excel</a-button>
           <a-button
             key="4"
@@ -42,7 +42,7 @@
             class="button-info"
             id="salesDetail-export-btn"
             v-if="$hasPermissions('B_salesTypeExport')"
-            :disabled="localDataSource.length==0"
+            :disabled="hasData"
             @click="handlePrint('typeExport','B_salesTypeExport')">销售分类导出</a-button>
         </template>
       </a-page-header>
@@ -93,51 +93,56 @@
         </a-alert>
         <!-- 查询 -->
         <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-form-item label="出库仓库">
-                  <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
+                  <chooseWarehouse ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+                <a-button type="primary" @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>
           </a-form>
         </div>
         <!-- 列表 -->
-        <s-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :defaultLoadData="false"
-          :showPagination="false"
-          bordered>
-          <!-- 产品编码 -->
-          <template slot="productCode" slot-scope="text, record">
-            <div v-if="(record.promotionFlag == 1) || (Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
-              <span>{{ text }}</span>
-              <!-- <a-badge count="促" :number-style="{ backgroundColor: '#f90' }" v-if="record.promotionFlag == 1"></a-badge> -->
-              <!-- 可审核时才可显示“缺”货产品 -->
-              <a-badge count="缺" v-if="(Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
-              </a-badge>
-            </div>
-            <span v-if="!(record.promotionFlag == 1 || ((Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))))">{{ text }}</span>
-          </template>
-          <!-- 当前库存 -->
-          <template slot="stockQty" slot-scope="text, record">
-            <div v-if="record.stockQty || record.stockQty==0">
-              <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty) - Number(record.stockQty) }}</span>)</p>
-              <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
-            </div>
-            <span v-else>--</span>
-          </template>
-        </s-table>
+        <detailProductList 
+        ref="normalProduct" 
+        :detailData="detailData" 
+        :warehouseSn="warehouseSn"
+        :salesBillSn="$route.params.sn || bizSn" 
+        :authCode="authCode"
+        :showCityPrice="isCityPrice"></detailProductList> 
+
+        <!-- 活动列表 -->
+        <div 
+        v-for="item in activeList" 
+        :key="item.promoRuleSn" 
+        >
+        <div class="active-title">
+          <div>
+            <strong style="margin-right:10px;font-size:14px;">{{item.promotion.title}}</strong> ({{item.promotionRule.description}})
+            <span style="margin-left:20px;color:#00aaff;cursor: pointer;"  @click="(event) => {showDesc(event, item)}">
+              <a-icon title="查看活动详情" type="eye"/> 活动详情
+            </span>
+          </div>
+          <div>
+            <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>;
+          </div>
+        </div>
+        <detailProductList 
+        :ref="'active-'+item.promoRuleSn" 
+        :promo="item"
+        :detailData="detailData" 
+        :warehouseSn="warehouseSn"
+        :salesBillSn="$route.params.sn || bizSn" 
+        :authCode="authCode"
+        :showCityPrice="isCityPrice"></detailProductList> 
+        </div>
       </a-card>
     </a-spin>
     <div class="affix-cont">
@@ -214,15 +219,17 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import printModal from './printModal.vue'
 import auditModal from '@/views/common/auditModal.vue'
-import dsModal from '@/views/salesManagement/waitDispatch/dsModal.vue'
+import dsModal from '@/views/salesManagement/waitDispatchNew/dsModal.vue'
 import stockOutDetail from './stockOutDetailModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
-import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/salesNew'
-import { salesDetailAllList } from '@/api/salesDetailNew'
+import detailProductList from './comps/detailProductList.vue'
+// 接口
+import { salesDetailBySn, salesPromoQueryList, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/salesNew'
+ 
 export default {
-  name: 'SalesDetail',
+  name: 'SalesDetailNew',
   mixins: [commonMixin],
-  components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse },
+  components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList },
   props: {
     bizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -235,49 +242,8 @@ export default {
       disabled: false,
       showDsModal: false,
       showStockOut: false,
-      authCode: '',
-      queryParam: {
-        warehouseSn: undefined
-      },
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        const params = Object.assign(parameter, { salesBillSn: this.bizSn || this.$route.params.sn, warehouseSn: this.queryParam.warehouseSn })
-        if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { //  审核,需用到库存
-          params.showStock = true
-        } 
-        return salesDetailAllList(params).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = 0
-            this.outStockStr = ''
-            let str = ''
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = no + i + 1
-              const productCode = (data[i].productEntity && data[i].productEntity.code) || (data[i].dealerProductEntity && data[i].dealerProductEntity.code)
-              const productName = (data[i].productEntity && data[i].productEntity.name) || (data[i].dealerProductEntity && data[i].dealerProductEntity.name)
-              const productOrigCode = (data[i].productEntity && data[i].productEntity.origCode) || (data[i].dealerProductEntity && data[i].dealerProductEntity.origCode)
-              const productOrigUnit = (data[i].productEntity && data[i].productEntity.unit) || (data[i].dealerProductEntity && data[i].dealerProductEntity.unit)
-              data[i].productCode = productCode || '--'
-              data[i].productName = productName || '--'
-              data[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
-              data[i].productOrigUnit = productOrigUnit || '--'
-              if (data[i].unpushedQty && (Number(data[i].stockQty) < Number(data[i].unpushedQty))) {
-                str += data[i].productCode + '、'
-              }
-            }
-            if (str.length > 0) {
-              str = str.substr(0, str.length - 1)
-              this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
-            }
-            this.localDataSource = data
-            this.disabled = false
-          }
-          return data
-        })
-      },
-      localDataSource: [],
+      authCode: '',  // 权限码
+      hasData: false, // 是否有数据
       showDetail: false,
       openModal: false,
       detailData: null, //  详情数据
@@ -286,12 +252,14 @@ export default {
       visibleAudit: false,
       auditInfo: null,
       spinningAudit: false,
-      outStockStr: '', // 缺货产品信息说明
       auditText: null,
-      fromRouter: null
+      fromRouter: null,
+      activeList: [],
+      warehouseSn: undefined
     }
   },
   computed: {
+    // 地址
     shippingAddress () {
       const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
       const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
@@ -303,50 +271,6 @@ export default {
         return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
       }
     },
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
-        { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '出库仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
-        { title: '待下推数', dataIndex: 'unpushedQty', 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: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
-      ]
-      if (this.$hasPermissions(this.authCode + '_costPrice')) { //  成本价权限
-        arr.splice(5, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      }
-
-      const ind = this.$hasPermissions(this.authCode + '_costPrice') ? 6 : 5
-      if (this.$hasPermissions(this.authCode + '_provincePrice')) {
-        arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      }
-      // 是否勾选市级价格
-      if (this.isCityPrice) {
-        arr.splice(ind + 1, 0, { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
-          arr.splice(ind + 2, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        }
-      } else {
-        if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
-          arr.splice(ind + 1, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        }
-      }
-
-      if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { //  审核,需用到库存
-        arr.splice(arr.length - 3, 0, { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' })
-      }
-      return arr
-    }
   },
   methods: {
     //  返回
@@ -360,12 +284,54 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.warehouseSn = undefined
-      this.$refs.table.refresh()
+      this.warehouseSn = undefined
+      setTimeout(()=>{
+        this.searchTable()
+      },100)
+    },
+    searchTable(){
+      this.$refs.normalProduct.getTableData()
+      this.activeList.map(item => {
+        this.$refs['active-'+item.promoRuleSn][0].getTableData()
+      })
+    },
+    //  详情
+    getDetail () {
+      salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.detailData = res.data || null
+        }
+        this.getActiveList()
+      })
+    },
+    // 查看活动详情
+    showDesc(e,item){
+
+    },
+    // 获取销售单参与的活动列表
+    getActiveList(){
+      salesPromoQueryList({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
+        if(res.status == 200){
+          this.activeList = res.data || []
+          this.activeList.map(item => {
+            item.isActive = true
+          })
+        }
+        this.$nextTick(()=>{
+          this.searchTable()
+        })
+      })
     },
     // 打开缺货明细
     openStockOut () {
-      if (this.outStockStr != '') {
+      const showMoad = false
+      this.activeList.map(item => {
+        if(!showMoad){
+          showMoad = this.$refs['active-'+item.promoRuleSn][0].outStockStr != ''
+        }
+      })
+
+      if (this.$refs.normalProduct.outStockStr != ''||showMoad) {
         this.showStockOut = true
       } else {
         this.$info({
@@ -375,17 +341,6 @@ export default {
         })
       }
     },
-    //  详情
-    getDetail () {
-      salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
-        if (res.status == 200) {
-          this.detailData = res.data || null
-          this.$refs.table.refresh(true)
-        } else {
-          this.detailData = null
-        }
-      })
-    },
     // 打开审核/一键审核弹框
     handleAudit (isBatch) {
       if (isBatch) { // 一键审核
@@ -520,6 +475,13 @@ export default {
     .salesDetail-cont{
       margin-bottom: 10px;
     }
+    .active-title{
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 10px;
+      background: #e3f9ff;
+    }
     .flexBox{
       display: flex;
       justify-content: space-between;

+ 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.111/ocs-admin',
+        target: 'http://192.168.2.113:8660/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,