Explorar el Código

【对账单报表】增加:批量导出功能

lxf hace 2 años
padre
commit
79182c4520

+ 18 - 0
src/api/shengde/group/finance/reconciliation.js

@@ -91,6 +91,15 @@ export function getBomReconciliation(data) {
   })
 }
 
+// BOM对账单-打印详情-批量
+export function getBatchBomReconciliation(data) {
+  return request({
+    url: '/saas-group/saas/group/reconciliation/getBatchBomReconciliation',
+    method: 'post',
+    data: data,
+  })
+}
+
 // SKU对账单-打印详情
 export function getProductReconciliation(data) {
   return request({
@@ -100,6 +109,15 @@ export function getProductReconciliation(data) {
   })
 }
 
+// SKU对账单-打印详情-批量
+export function getBachProductReconciliation(data) {
+  return request({
+    url: '/saas-group/saas/group/reconciliation/getBachProductReconciliation',
+    method: 'post',
+    data: data,
+  })
+}
+
 // 终端客户: 对账单-打印详情
 export function terminalPrintDetail(data) {
   return request({

+ 9 - 0
src/api/shengde/group/finance/summary.js

@@ -18,3 +18,12 @@ export function summaryPrintDetail(data) {
     data: data,
   })
 }
+
+// 销售对账汇总-打印查询详情- 批量
+export function summaryBachPrintDetail(data) {
+  return request({
+    url: '/saas-group/saas/group/reconciliation/summaryBachPrintDetail',
+    method: 'post',
+    data: data,
+  })
+}

+ 249 - 0
src/views/shengde/group/finance/summary/batchPrint.vue

@@ -0,0 +1,249 @@
+<template>
+  <div
+    v-loading="loadingStatus"
+    element-loading-text="获取数据中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.2)"
+    ref="print"
+  >
+    <div style="border: 1px solid black; height: calc(100vh - 182px - 56px); overflow: auto" id="tableId">
+      <table class="tableOne" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <th style="width: 110px">对账月度</th>
+          <th style="width: 130px">客户</th>
+          <th style="width: 130px">订单时间</th>
+          <th style="width: 134px">订单号</th>
+          <th style="width: 130px">万里牛单号</th>
+          <th style="width: 100px">SKU品号</th>
+          <th style="min-width: 200px">SKU品名</th>
+          <th style="width: 80px">SKU数量</th>
+          <th style="width: 100px">BOM品号</th>
+          <th style="min-width: 300px">BOM品名</th>
+          <th style="width: 65px">数量</th>
+          <th style="width: 65px">单价</th>
+          <th style="width: 65px">激光LOGO</th>
+          <th style="width: 65px">激光体位线</th>
+          <th style="width: 65px">代发费</th>
+          <th style="width: 70px">快递包材费</th>
+          <th style="width: 70px">包装人工费</th>
+          <th style="width: 80px">SKU单价</th>
+          <th style="width: 80px">小计</th>
+          <th style="width: 80px">售后数量</th>
+          <th style="width: 80px">售后金额</th>
+          <th style="border-right: 0; width: 90px">合计</th>
+        </tr>
+        <tbody v-for="(item, index) in tableList" :key="index">
+          <tr v-for="(itemBom, indexBom) in item.bomDetails" :key="indexBom">
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.reconciliationTime.substr(0, 7) }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.subsidiaryName }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.contractTime }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.contractCode }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.tradeNo }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.productColorCode }}</td>
+            <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.productColorName }}</td>
+            <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span v-if="item.quantity">{{ Number(item.quantity) }}</span>
+              <span v-else>0</span>
+            </td>
+            <td style="text-align: left; word-break: break-all">{{ itemBom.bomColorCode }}</td>
+            <td style="text-align: left; word-break: break-all">{{ itemBom.bomColorName }}</td>
+            <td>
+              <span v-if="itemBom.bomColorQuantity">{{ Number(itemBom.bomColorQuantity) }}</span>
+            </td>
+            <td>
+              <span v-if="itemBom.dataResource === 1">{{ item.productPrice }}</span>
+              <span v-else>{{ itemBom.price }}</span>
+            </td>
+            <td>
+              <span v-if="item.processingLayout === '20' && itemBom.dataResource === 1 && item.processPrice && Number(item.processPrice) !== 0">{{
+                item.processPrice
+              }}</span>
+            </td>
+            <td>
+              <span v-if="item.processingLayout === '10' && itemBom.dataResource === 1 && item.processPrice && Number(item.processPrice) !== 0">{{
+                item.processPrice
+              }}</span>
+            </td>
+            <td>
+              <span v-if="itemBom.dataResource === 1 && item.deliverGoodsPrice && Number(item.deliverGoodsPrice) !== 0">{{ item.deliverGoodsPrice }}</span>
+            </td>
+            <td>
+              <span v-if="itemBom.dataResource === 1 && item.expressPrice && Number(item.expressPrice) !== 0">{{ item.expressPrice }}</span>
+            </td>
+            <td>
+              <span v-if="itemBom.dataResource === 1 && item.expensePrice && Number(item.expensePrice) !== 0">{{ item.expensePrice }}</span>
+            </td>
+            <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span>{{ item.skuPrice }}</span>
+            </td>
+            <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span>{{ subtotal(item) }}</span>
+            </td>
+            <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span v-if="item.aftermarketQuantity && Number(item.aftermarketQuantity) !== 0">{{ item.aftermarketQuantity }}</span>
+            </td>
+            <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span v-if="item.aftermarketAmount && Number(item.aftermarketAmount) !== 0">-{{ item.aftermarketAmount }}</span>
+            </td>
+            <td style="border-right: 0" v-if="indexBom === 0" :rowspan="item.bomDetails.length">
+              <span>{{ getAllCost(item) }}</span>
+            </td>
+          </tr>
+        </tbody>
+        <tr>
+          <td>总计:</td>
+          <td colspan="20"></td>
+          <td style="border-right: 0">
+            <span>{{ getAggregate() }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td>备注:</td>
+          <td colspan="21" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td>交货地点:</td>
+          <td colspan="21" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td colspan="3" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请人:</td>
+          <td colspan="5" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">胜德体育体育总经理:</td>
+          <td colspan="12" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请日期:</td>
+        </tr>
+      </table>
+    </div>
+    <div style="width: 100%; text-align: center; margin-top: 16px" class="no-print">
+      <el-button type="primary" size="small" @click="clickExcel">导出Excel</el-button>
+      <el-button type="primary" size="small" @click="clickPrint">打印</el-button>
+      <el-button size="small" @click="clickCancel">关 闭</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { summaryBachPrintDetail } from '@/api/shengde/group/finance/summary'
+import $ from 'jquery'
+
+export default {
+  name: 'summaryPrint',
+  props: {
+    excelList: Array,
+  },
+  data() {
+    return {
+      loadingStatus: false,
+      loadingText: '',
+      tableList: [],
+    }
+  },
+  created() {
+    if (this.excelList && this.excelList.length > 0) {
+      this.getDetails()
+    }
+  },
+  mounted() {},
+  methods: {
+    getDetails() {
+      this.loadingStatus = true
+      let list = this.excelList.map((item) => {
+        return item.id
+      })
+      summaryBachPrintDetail({ id: list.join(',') }).then(
+        (res) => {
+          this.tableList = res.data.data
+          this.loadingStatus = false
+        },
+        (err) => {
+          this.loadingStatus = false
+          console.log('summaryBachPrintDetail: ' + err)
+        }
+      )
+    },
+    clickPrint() {
+      this.$print(this.$refs.print)
+    },
+    clickExcel() {
+      $('#tableId').table2excel({
+        exclude: '.noExl',
+        sheetName: '销售对账汇总',
+        filename: '销售对账汇总',
+        exclude_img: false,
+        exclude_links: false,
+        exclude_inputs: true,
+      })
+    },
+    clickCancel() {
+      this.$emit('clickCancel', false)
+    },
+    getCost(item, itemBom, num) {
+      let money = 0
+      if (itemBom.dataResource === 1) {
+        if (item.productPrice) {
+          money = parseFloat(Number(money) + Number(item.productPrice)).toFixed(2)
+        }
+        if (item.processPrice && ['10', '20'].includes(item.processingLayout)) {
+          money = parseFloat(Number(money) + Number(item.processPrice)).toFixed(2)
+        }
+        if (item.deliverGoodsPrice) {
+          money = parseFloat(Number(money) + Number(item.deliverGoodsPrice)).toFixed(2)
+        }
+        if (item.expressPrice) {
+          money = parseFloat(Number(money) + Number(item.expressPrice)).toFixed(2)
+        }
+        if (item.expensePrice) {
+          money = parseFloat(Number(money) + Number(item.expensePrice)).toFixed(2)
+        }
+      } else {
+        if (itemBom.price) {
+          money = parseFloat(Number(money) + Number(itemBom.price)).toFixed(2)
+        }
+      }
+      if (num) {
+        money = parseFloat(Number(money) * Number(num)).toFixed(2)
+      }
+      return money
+    },
+    getAllCost(row) {
+      let money = 0
+      money = parseFloat(Number(row.skuPrice) * Number(row.quantity) - Number(row.aftermarketAmount)).toFixed(2)
+      return money
+    },
+    getAggregate() {
+      let allMoney = 0
+      if (this.tableList && this.tableList.length > 0) {
+        this.tableList.map((item) => {
+          allMoney = parseFloat(Number(allMoney) + Number(item.skuPrice) * Number(item.quantity) - Number(item.aftermarketAmount)).toFixed(2)
+        })
+      }
+      return allMoney
+    },
+    subtotal(item) {
+      let num = 0
+      if (item.quantity && item.skuPrice) {
+        num = parseFloat(Number(item.quantity) * Number(item.skuPrice)).toFixed(2)
+      }
+      return num
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.tableOne {
+  border-top: 1px solid black;
+  border-bottom: 1px solid black;
+  line-height: 20px;
+  overflow: auto;
+  width: 130%;
+}
+.tableOne th {
+  font-weight: 700;
+  border-right: 1px solid black;
+}
+.tableOne td {
+  border-right: 1px solid black;
+  border-top: 1px solid black;
+  text-align: center;
+  padding: 4px;
+}
+</style>

+ 235 - 0
src/views/shengde/group/finance/summary/batchPrintBOM.vue

@@ -0,0 +1,235 @@
+<template>
+  <div
+    v-loading="loadingStatus"
+    element-loading-text="获取数据中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.2)"
+    ref="print"
+  >
+    <div style="border: 1px solid black; height: calc(100vh - 182px - 56px); overflow: auto" id="tableId">
+      <table class="tableOne" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <th style="width: 110px">对账月度</th>
+          <th style="width: 130px">客户</th>
+          <th style="width: 180px">E10品号</th>
+          <th style="min-width: 200px">品名</th>
+          <th style="width: 80px">数量(pcs)</th>
+          <th style="width: 80px">BOM单价</th>
+          <th style="width: 100px">激光LOGO汇总</th>
+          <th style="width: 100px">激光体位线汇总</th>
+          <th style="width: 100px">代发费汇总</th>
+          <th style="width: 100px">快递包材费汇总</th>
+          <th style="width: 100px">包装人工费汇总</th>
+          <th style="width: 80px">小计</th>
+          <th style="width: 80px">售后数量</th>
+          <th style="width: 80px">售后金额</th>
+          <th style="border-right: 0; width: 100px">总金额</th>
+        </tr>
+        <tr v-for="(item, index) in tableList" :key="index">
+          <td style="text-align: left; word-break: break-all">{{ item.reconciliationTime.substr(0, 7) }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.subsidiaryName }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.bomColorCode }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.bomColorName }}</td>
+          <td>
+            <span v-if="item.bomColorQuantity">{{ Number(item.bomColorQuantity) }}</span>
+          </td>
+          <td>
+            <span v-if="item.price && Number(item.price) !== 0">{{ Number(item.price) }}</span>
+            <!-- <span>{{ getPrice(item) }}</span> -->
+          </td>
+          <td>
+            <span v-if="item.processLogoPrice && Number(item.processLogoPrice) !== 0">{{ Number(item.processLogoPrice) }}</span>
+          </td>
+          <td>
+            <span v-if="item.processPrice && Number(item.processPrice) !== 0">{{ Number(item.processPrice) }}</span>
+          </td>
+          <td>
+            <span v-if="item.deliverGoodsPrice && Number(item.deliverGoodsPrice) !== 0">{{ Number(item.deliverGoodsPrice) }}</span>
+          </td>
+          <td>
+            <span v-if="item.expressPrice && Number(item.expressPrice) !== 0">{{ Number(item.expressPrice) }}</span>
+          </td>
+          <td>
+            <span v-if="item.expensePrice && Number(item.expensePrice) !== 0">{{ Number(item.expensePrice) }}</span>
+          </td>
+          <td>
+            <span v-if="item.amount">{{ Number(item.amount) }}</span>
+          </td>
+          <td>
+            <span v-if="item.aftermarketQuantity && Number(item.aftermarketQuantity) !== 0">{{ Number(item.aftermarketQuantity) }}</span>
+          </td>
+          <td>
+            <span v-if="item.aftermarketAmount && Number(item.aftermarketAmount) !== 0">-{{ Number(item.aftermarketAmount) }}</span>
+          </td>
+          <td style="border-right: 0">
+            <span>{{ parseFloat(item.amount - item.aftermarketAmount).toFixed(2) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td>总计:</td>
+          <td colspan="5"></td>
+          <td>
+            <span>{{ getNumber('processLogoPrice') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('processPrice') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('deliverGoodsPrice') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('expressPrice') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('expensePrice') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('amount') }}</span>
+          </td>
+          <td>
+            <span>{{ getNumber('aftermarketQuantity') }}</span>
+          </td>
+          <td>
+            <span>-{{ getNumber('aftermarketAmount') }}</span>
+          </td>
+          <td style="border-right: 0">
+            <span>{{ parseFloat(getNumber('amount') - getNumber('aftermarketAmount')).toFixed(2) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td>备注:</td>
+          <td colspan="14" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td>交货地点:</td>
+          <td colspan="14" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td colspan="2" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请人:</td>
+          <td colspan="2" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">胜德体育体育总经理:</td>
+          <td colspan="11" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请日期:</td>
+        </tr>
+      </table>
+    </div>
+    <div style="width: 100%; text-align: center; margin-top: 16px" class="no-print">
+      <el-button type="primary" size="small" @click="clickExcel">导出Excel</el-button>
+      <el-button type="primary" size="small" @click="clickPrint">打印</el-button>
+      <el-button size="small" @click="clickCancel">关 闭</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getBatchBomReconciliation } from '@/api/shengde/group/finance/reconciliation'
+import $ from 'jquery'
+
+export default {
+  name: 'summaryPrintBOM',
+  props: {
+    excelList: Array,
+  },
+  data() {
+    return {
+      loadingStatus: false,
+      loadingText: '',
+      tableList: [],
+    }
+  },
+  created() {
+    if (this.excelList && this.excelList.length > 0) {
+      this.getDetails()
+    }
+  },
+  mounted() {},
+  methods: {
+    getDetails() {
+      this.loadingStatus = true
+      let list = this.excelList.map((item) => {
+        return item.id
+      })
+      getBatchBomReconciliation({ id: list.join(',') }).then(
+        (res) => {
+          this.tableList = res.data.data
+          this.loadingStatus = false
+        },
+        (err) => {
+          this.loadingStatus = false
+          console.log('getBatchBomReconciliation: ' + err)
+        }
+      )
+    },
+    clickPrint() {
+      this.$print(this.$refs.print)
+    },
+    clickExcel() {
+      $('#tableId').table2excel({
+        exclude: '.noExl',
+        sheetName: 'BOM对账单报表',
+        filename: 'BOM对账单报表',
+        exclude_img: false,
+        exclude_links: false,
+        exclude_inputs: true,
+      })
+    },
+    clickCancel() {
+      this.$emit('clickCancel', false)
+    },
+    getNumber(label) {
+      let allNum = 0
+      if (this.tableList && this.tableList.length > 0) {
+        this.tableList.map((item) => {
+          if (item[label]) {
+            allNum = parseFloat(Number(allNum) + Number(item[label])).toFixed(2)
+          }
+        })
+      }
+      return Number(allNum)
+    },
+    getPrice(item) {
+      let num = 0
+      if (item.amount) {
+        num = Number(item.amount)
+      }
+      if (item.processLogoPrice) {
+        num -= Number(item.processLogoPrice)
+      }
+      if (item.processPrice) {
+        num -= Number(item.processPrice)
+      }
+      if (item.deliverGoodsPrice) {
+        num -= Number(item.deliverGoodsPrice)
+      }
+      if (item.expressPrice) {
+        num -= Number(item.expressPrice)
+      }
+      if (item.expensePrice) {
+        num -= Number(item.expensePrice)
+      }
+      if (item.bomColorQuantity) {
+        num = parseFloat(Number(num) / Number(item.bomColorQuantity)).toFixed(2)
+      }
+      return num
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.tableOne {
+  border-top: 1px solid black;
+  border-bottom: 1px solid black;
+  line-height: 20px;
+  overflow: auto;
+  width: 100%;
+}
+.tableOne th {
+  font-weight: 700;
+  border-right: 1px solid black;
+}
+.tableOne td {
+  border-right: 1px solid black;
+  border-top: 1px solid black;
+  text-align: center;
+  padding: 4px;
+}
+</style>

+ 185 - 0
src/views/shengde/group/finance/summary/batchPrintSKU.vue

@@ -0,0 +1,185 @@
+<template>
+  <div
+    v-loading="loadingStatus"
+    element-loading-text="获取数据中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.2)"
+    ref="print"
+  >
+    <div style="border: 1px solid black; height: calc(100vh - 182px - 56px); overflow: auto" id="tableId">
+      <table class="tableOne" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <th style="width: 110px">对账月度</th>
+          <th style="width: 130px">客户</th>
+          <th style="width: 180px">SKU品号</th>
+          <th style="min-width: 200px">SKU品名</th>
+          <th style="width: 100px">数量 (PCS)</th>
+          <th style="width: 100px">SKU单价</th>
+          <th style="width: 80px">小计</th>
+          <th style="width: 80px">售后数量</th>
+          <th style="width: 80px">售后金额</th>
+          <th style="border-right: 0; width: 120px">合计</th>
+        </tr>
+        <tr v-for="(item, index) in tableList" :key="index">
+          <td style="text-align: left; word-break: break-all">{{ item.reconciliationTime.substr(0, 7) }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.subsidiaryName }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.specCode }}</td>
+          <td style="text-align: left; word-break: break-all">{{ item.nameChinese }}</td>
+          <td>
+            <span v-if="item.quantity">{{ Number(item.quantity) }}</span>
+          </td>
+          <td>
+            <span v-if="item.price">{{ Number(item.price) }}</span>
+          </td>
+          <td>
+            <span>{{ subtotal(item) }}</span>
+          </td>
+          <td>
+            <span v-if="item.aftermarketQuantity && Number(item.aftermarketQuantity) !== 0">{{ Number(item.aftermarketQuantity) }}</span>
+          </td>
+          <td>
+            <span v-if="item.aftermarketAmount && Number(item.aftermarketAmount) !== 0">-{{ Number(item.aftermarketAmount) }}</span>
+          </td>
+          <td style="border-right: 0">
+            <span v-if="item.amount">{{ Number(item.amount) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td>总计:</td>
+          <td></td>
+          <td></td>
+          <td></td>
+          <td>
+            <span>{{ getNumber('quantity') }}</span>
+          </td>
+          <td></td>
+          <td></td>
+          <td>
+            <span>{{ getNumber('aftermarketQuantity') }}</span>
+          </td>
+          <td>
+            <span>-{{ getNumber('aftermarketAmount') }}</span>
+          </td>
+          <td style="border-right: 0">
+            <span>{{ getNumber('amount') }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td>备注:</td>
+          <td colspan="9" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td>交货地点:</td>
+          <td colspan="9" style="border-right: 0"></td>
+        </tr>
+        <tr>
+          <td colspan="2" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请人:</td>
+          <td colspan="2" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">胜德体育体育总经理:</td>
+          <td colspan="6" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请日期:</td>
+        </tr>
+      </table>
+    </div>
+    <div style="width: 100%; text-align: center; margin-top: 16px" class="no-print">
+      <el-button type="primary" size="small" @click="clickExcel">导出Excel</el-button>
+      <el-button type="primary" size="small" @click="clickPrint">打印</el-button>
+      <el-button size="small" @click="clickCancel">关 闭</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getBachProductReconciliation } from '@/api/shengde/group/finance/reconciliation'
+import $ from 'jquery'
+
+export default {
+  name: 'summaryPrintSKU',
+  props: {
+    excelList: Array,
+  },
+  data() {
+    return {
+      loadingStatus: false,
+      loadingText: '',
+      tableList: [],
+    }
+  },
+  created() {
+    if (this.excelList && this.excelList.length > 0) {
+      this.getDetails()
+    }
+  },
+  mounted() {},
+  methods: {
+    getDetails() {
+      this.loadingStatus = true
+      let list = this.excelList.map((item) => {
+        return item.id
+      })
+      getBachProductReconciliation({ id: list.join(',') }).then(
+        (res) => {
+          this.tableList = res.data.data
+          this.loadingStatus = false
+        },
+        (err) => {
+          this.loadingStatus = false
+          console.log('getBachProductReconciliation: ' + err)
+        }
+      )
+    },
+    clickPrint() {
+      this.$print(this.$refs.print)
+    },
+    clickExcel() {
+      $('#tableId').table2excel({
+        exclude: '.noExl',
+        sheetName: 'SKU对账单',
+        filename: 'SKU对账单',
+        exclude_img: false,
+        exclude_links: false,
+        exclude_inputs: true,
+      })
+    },
+    clickCancel() {
+      this.$emit('clickCancel', false)
+    },
+    getNumber(label) {
+      let allNum = 0
+      if (this.tableList && this.tableList.length > 0) {
+        this.tableList.map((item) => {
+          if (item[label]) {
+            allNum = parseFloat(Number(allNum) + Number(item[label])).toFixed(2)
+          }
+        })
+      }
+      return Number(allNum)
+    },
+    subtotal(item) {
+      let num = 0
+      if (item.quantity && item.price) {
+        num = parseFloat(Number(item.quantity) * Number(item.price)).toFixed(2)
+      }
+      return num
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.tableOne {
+  border-top: 1px solid black;
+  border-bottom: 1px solid black;
+  line-height: 20px;
+  overflow: auto;
+  width: 100%;
+}
+.tableOne th {
+  font-weight: 700;
+  border-right: 1px solid black;
+}
+.tableOne td {
+  border-right: 1px solid black;
+  border-top: 1px solid black;
+  text-align: center;
+  padding: 4px;
+}
+</style>

+ 58 - 3
src/views/shengde/group/finance/summary/index.vue

@@ -46,7 +46,19 @@
       </el-form-item>
     </el-form>
 
-    <el-table :data="tableList" :cell-style="{ padding: '0' }" :row-style="{ height: '35px' }" v-loading="loading" header-row-class-name="tableHeader">
+    <el-row :gutter="10" style="margin-bottom: 15px">
+      <el-button size="mini" @click="batchPrint">批量打印</el-button>
+    </el-row>
+
+    <el-table
+      :data="tableList"
+      :cell-style="{ padding: '0' }"
+      :row-style="{ height: '35px' }"
+      v-loading="loading"
+      header-row-class-name="tableHeader"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="50" />
       <el-table-column label="维度" align="center" prop="reconciliationStartTime" width="180" />
       <el-table-column label="客户" prop="subsidiaryName" width="180" />
       <el-table-column label="对账金额" align="right" prop="amount" width="120">
@@ -81,6 +93,29 @@
         </el-tab-pane>
       </el-tabs>
     </el-dialog>
+
+    <!-- 批量打印 -->
+    <el-dialog title="批量打印" v-if="openBatchPrint" :visible.sync="openBatchPrint" width="96%" append-to-body>
+      <el-tabs v-model="activeName">
+        <el-tab-pane label="SKU对账单" name="third">
+          <!-- <BatchPrintSKU :excelList="excelList" v-if="activeName === 'third' && rowData.subsidiaryType == 0" @clickCancel="clickPrintCancel"></BatchPrintSKU> -->
+          <BatchPrintSKU :excelList="excelList" v-if="activeName === 'third'" @clickCancel="clickBatchPrintCancel"></BatchPrintSKU>
+          <!-- <BatchPrintTerminalSKU
+            :rowData="rowData"
+            v-if="activeName === 'third' && rowData.subsidiaryType == 1"
+            @clickCancel="clickPrintCancel"
+          ></BatchPrintTerminalSKU> -->
+        </el-tab-pane>
+        <!-- <el-tab-pane label="BOM对账单" name="second" v-if="rowData.subsidiaryType == 0"> -->
+        <el-tab-pane label="BOM对账单" name="second">
+          <BatchPrintBOM :excelList="excelList" v-if="activeName === 'second'" @clickCancel="clickBatchPrintCancel"></BatchPrintBOM>
+        </el-tab-pane>
+        <!-- <el-tab-pane label="订单对账单" name="first" v-if="rowData.subsidiaryType == 0"> -->
+        <el-tab-pane label="订单对账单" name="first">
+          <BatchPrint :excelList="excelList" v-if="activeName === 'first'" @clickCancel="clickBatchPrintCancel"></BatchPrint>
+        </el-tab-pane>
+      </el-tabs>
+    </el-dialog>
   </el-card>
 </template>
 
@@ -88,15 +123,19 @@
 import * as API from '@/api/shengde/group/finance/summary'
 import { getSubsidiaryList } from '@/api/shengde/subsidiary/bill/bill'
 import Print from './print'
-import PrintTerminal from './printTerminal'
+// import PrintTerminal from './printTerminal'
 import PrintBOM from './printBOM'
 import PrintSKU from './printSKU'
 import PrintTerminalSKU from './printTerminalSKU'
+import BatchPrint from './batchPrint'
+import BatchPrintBOM from './batchPrintBOM'
+import BatchPrintSKU from './batchPrintSKU'
+// import BatchPrintTerminalSKU from './batchPrintTerminalSKU'
 import { mapGetters } from 'vuex'
 
 export default {
   name: 'financeSummary',
-  components: { Print, PrintTerminal, PrintBOM, PrintSKU, PrintTerminalSKU },
+  components: { Print, PrintBOM, PrintSKU, PrintTerminalSKU, BatchPrint, BatchPrintBOM, BatchPrintSKU },
   data() {
     return {
       queryParams: {
@@ -114,6 +153,8 @@ export default {
       rowData: {},
       openPrint: false,
       activeName: 'third',
+      excelList: [],
+      openBatchPrint: false,
     }
   },
   created() {
@@ -169,6 +210,20 @@ export default {
     clickPrintCancel() {
       this.openPrint = false
     },
+    clickBatchPrintCancel() {
+      this.openBatchPrint = false
+    },
+    handleSelectionChange(selection) {
+      this.excelList = selection
+    },
+    batchPrint() {
+      if (this.excelList && this.excelList.length > 0) {
+        this.activeName = 'third'
+        this.openBatchPrint = true
+      } else {
+        this.msgInfo('请勾选需要批量打印的数据')
+      }
+    },
   },
 }
 </script>