Browse Source

销售单详情 A价B价

chenrui 3 years ago
parent
commit
87fcf37ceb
2 changed files with 90 additions and 39 deletions
  1. 10 0
      src/api/sales.js
  2. 80 39
      src/views/salesManagement/salesQuery/detail.vue

+ 10 - 0
src/api/sales.js

@@ -158,3 +158,13 @@ export const salesDetailExcel = params => {
     responseType: 'blob'
     responseType: 'blob'
   })
   })
 }
 }
+// 销售 详情  分类导出
+export const salesDetailTypeExcel = params => {
+  const url = `/sales/detail/typeExcel`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 80 - 39
src/views/salesManagement/salesQuery/detail.vue

@@ -4,28 +4,38 @@
       <template slot="subTitle">
       <template slot="subTitle">
         <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
         <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
       </template>
       </template>
-      <template slot="extra" v-if="$hasPermissions('B_salesPrint')">
+      <template slot="extra">
         <a-button
         <a-button
-          key="3"
+          key="4"
           type="primary"
           type="primary"
+          v-if="$hasPermissions('B_salesPrint')"
           class="button-error"
           class="button-error"
           id="salesDetail-xs-print-btn"
           id="salesDetail-xs-print-btn"
           :disabled="localDataSource.length==0"
           :disabled="localDataSource.length==0"
           @click="handlePrint('SALES_BILL')">销售打印</a-button>
           @click="handlePrint('SALES_BILL')">销售打印</a-button>
         <a-button
         <a-button
-          key="2"
+          key="3"
           type="primary"
           type="primary"
+          v-if="$hasPermissions('B_salesPrint')"
           class="button-info"
           class="button-info"
           id="salesDetail-xsfl-print-btn"
           id="salesDetail-xsfl-print-btn"
           :disabled="localDataSource.length==0"
           :disabled="localDataSource.length==0"
           @click="handlePrint('SALES_BILL_TYPE')">销售分类打印</a-button>
           @click="handlePrint('SALES_BILL_TYPE')">销售分类打印</a-button>
         <a-button
         <a-button
-          key="1"
+          key="2"
           type="primary"
           type="primary"
+          v-if="$hasPermissions('B_salesPrint')"
           class="button-warning"
           class="button-warning"
           id="salesDetail-export-btn"
           id="salesDetail-export-btn"
           :disabled="localDataSource.length==0"
           :disabled="localDataSource.length==0"
           @click="handlePrint('export')">导出Excel</a-button>
           @click="handlePrint('export')">导出Excel</a-button>
+        <a-button
+          key="1"
+          type="primary"
+          class="button-success"
+          id="salesDetail-export-btn"
+          :disabled="localDataSource.length==0"
+          @click="handlePrint('typeExport')">分类导出</a-button>
       </template>
       </template>
     </a-page-header>
     </a-page-header>
     <!-- 基础信息 -->
     <!-- 基础信息 -->
@@ -38,8 +48,8 @@
               {{ shippingAddress }}
               {{ shippingAddress }}
             </a-descriptions-item>
             </a-descriptions-item>
             <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
             <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
             <a-descriptions-item label="备注">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
             <a-descriptions-item label="备注">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
             <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
             <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
             <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
             <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
@@ -52,20 +62,25 @@
       <!-- alert -->
       <!-- alert -->
       <a-alert type="info" style="margin-bottom: 10px;">
       <a-alert type="info" style="margin-bottom: 10px;">
         <div slot="message">
         <div slot="message">
-          总销售数量:<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>;
-          已发货数量:<strong>{{ detailData&&(detailData.totalDispatchQty || detailData.totalDispatchQty==0) ? detailData.totalDispatchQty : '--' }}</strong>;
-          待发货数量:<strong>{{ detailData&&(detailData.totalUndispatchQty || detailData.totalUndispatchQty==0) ? detailData.totalUndispatchQty : '--' }}</strong>;<br/>
-          总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? detailData.totalAmount : '--' }}</strong>;
-          <span v-if="$hasPermissions('B_isShowCost')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? detailData.totalCost : '--' }}</strong>;</span>
-          总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? detailData.grossProfit : '--' }}</strong>;
-          已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? detailData.totalCancelAmount : '--' }}</strong>;
-          已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? detailData.totalPushedAmount : '--' }}</strong>;
-          待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? detailData.totalUnpushedAmount : '--' }}</strong>;
-          已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? detailData.totalDispatchAmount : '--' }}</strong>;
-          待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? detailData.totalUndispatchAmount : '--' }}</strong>;
+          <div style="display: flex;justify-content: space-between;align-items: center;">
+            <div>
+              总销售数量:<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>;
+              已发货数量:<strong>{{ detailData&&(detailData.totalDispatchQty || detailData.totalDispatchQty==0) ? detailData.totalDispatchQty : '--' }}</strong>;
+              待发货数量:<strong>{{ detailData&&(detailData.totalUndispatchQty || detailData.totalUndispatchQty==0) ? detailData.totalUndispatchQty : '--' }}</strong>;<br/>
+              总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? detailData.totalAmount : '--' }}</strong>;
+              <span v-if="$hasPermissions('B_isShowCost')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? detailData.totalCost : '--' }}</strong>;</span>
+              总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? detailData.grossProfit : '--' }}</strong>;
+              已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? detailData.totalCancelAmount : '--' }}</strong>;
+              已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? detailData.totalPushedAmount : '--' }}</strong>;
+              待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? detailData.totalUnpushedAmount : '--' }}</strong>;
+              已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? detailData.totalDispatchAmount : '--' }}</strong>;
+              待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? detailData.totalUndispatchAmount : '--' }}</strong>;
+            </div>
+            <a-checkbox v-model="isCityPrice"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
+          </div>
         </div>
         </div>
       </a-alert>
       </a-alert>
       <!-- 列表 -->
       <!-- 列表 -->
@@ -76,7 +91,7 @@
         :rowKey="(record) => record.id"
         :rowKey="(record) => record.id"
         :columns="columns"
         :columns="columns"
         :data="loadData"
         :data="loadData"
-        :scroll="{ x: 1440 }"
+        :scroll="{ x: 1290 }"
         bordered>
         bordered>
         <!-- 产品编码 -->
         <!-- 产品编码 -->
         <template slot="productCode" slot-scope="text, record">
         <template slot="productCode" slot-scope="text, record">
@@ -122,7 +137,7 @@
 import moment from 'moment'
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import printModal from './printModal.vue'
 import printModal from './printModal.vue'
-import { salesDetailBySn, salesDetailPrint, salesDetailExcel } from '@/api/sales'
+import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel } from '@/api/sales'
 import { salesDetailList } from '@/api/salesDetail'
 import { salesDetailList } from '@/api/salesDetail'
 export default {
 export default {
   name: 'SalesDetail',
   name: 'SalesDetail',
@@ -155,7 +170,8 @@ export default {
       localDataSource: [],
       localDataSource: [],
       openModal: false,
       openModal: false,
       detailData: null, //  详情数据
       detailData: null, //  详情数据
-      nowType: null
+      nowType: null,
+      isCityPrice: false //  是否显示市级价
     }
     }
   },
   },
   computed: {
   computed: {
@@ -172,19 +188,24 @@ export default {
     },
     },
     columns () {
     columns () {
       const arr = [
       const arr = [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 220, scopedSlots: { customRender: 'productCode' }, align: 'center' },
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center', fixed: 'left' },
+        { title: '产品编码', dataIndex: 'productCode', width: 180, scopedSlots: { customRender: 'productCode' }, align: 'center' },
         { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productOrigUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已取消数', dataIndex: 'cancelQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已下推数', dataIndex: 'pushedQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '待下推数', dataIndex: 'unpushedQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省级价', dataIndex: 'productEntity.provincePrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '销售价', dataIndex: 'price', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productOrigUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售数量', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已取消数', dataIndex: 'cancelQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已下推数', dataIndex: 'pushedQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '待下推数', dataIndex: 'unpushedQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       ]
       if (this.$hasPermissions('B_isShowCost')) {
       if (this.$hasPermissions('B_isShowCost')) {
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      if (this.isCityPrice) {
+        const ind = this.$hasPermissions('B_isShowCost') ? 6 : 5
+        arr.splice(ind, 0, { title: '市级价', dataIndex: 'productEntity.cityPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
       }
       return arr
       return arr
     }
     }
@@ -211,17 +232,32 @@ export default {
     },
     },
     // 打印导出
     // 打印导出
     handlePrint (type) {
     handlePrint (type) {
-      this.nowType = type
-      this.openModal = true
+      if (type == 'typeExport') {
+        this.nowType = type
+        this.handleOk()
+      } else {
+        this.nowType = type
+        this.openModal = true
+      }
     },
     },
     handleOk (objs) {
     handleOk (objs) {
       const _this = this
       const _this = this
+      let params
       let url = salesDetailPrint //  打印
       let url = salesDetailPrint //  打印
       if (this.nowType == 'export') { //  导出
       if (this.nowType == 'export') { //  导出
         url = salesDetailExcel
         url = salesDetailExcel
+        params = JSON.parse(JSON.stringify(objs))
+        delete params.type
+      } else if (this.nowType == 'typeExport') { //  分类导出
+        url = salesDetailTypeExcel
+        params = {
+          salesBillSn: this.$route.params.sn,
+          showCostFlag: this.$hasPermissions('B_isShowCost')
+        }
+      } else { //  打印
+        params = JSON.parse(JSON.stringify(objs))
+        delete params.type
       }
       }
-      const params = JSON.parse(JSON.stringify(objs))
-      delete params.type
       _this.spinning = true
       _this.spinning = true
       url(params).then(res => {
       url(params).then(res => {
         _this.spinning = false
         _this.spinning = false
@@ -236,7 +272,7 @@ export default {
           })
           })
           reader.readAsText(res)
           reader.readAsText(res)
         } else {
         } else {
-          if (this.nowType == 'export') {
+          if (this.nowType == 'export' || this.nowType == 'typeExport') {
             this.download(res)
             this.download(res)
           } else {
           } else {
             this.print(res, objs.type)
             this.print(res, objs.type)
@@ -264,7 +300,12 @@ export default {
       link.style.display = 'none'
       link.style.display = 'none'
       link.href = url
       link.href = url
       const a = moment().format('YYYYMMDDHHmmss')
       const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '销售' + a
+      let fname = ''
+      if (this.nowType == 'typeExport') {
+        fname = '销售分类' + a
+      } else {
+        fname = '销售' + a
+      }
       link.setAttribute('download', fname + '.xlsx')
       link.setAttribute('download', fname + '.xlsx')
       document.body.appendChild(link)
       document.body.appendChild(link)
       link.click()
       link.click()