batchPrint.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div
  3. v-loading="loadingStatus"
  4. element-loading-text="获取数据中,请稍后"
  5. element-loading-spinner="el-icon-loading"
  6. element-loading-background="rgba(0, 0, 0, 0.2)"
  7. ref="print"
  8. >
  9. <div style="border: 1px solid black; height: calc(100vh - 182px - 56px); overflow: auto" id="tableId">
  10. <table class="tableOne" border="0" cellpadding="0" cellspacing="0">
  11. <tr>
  12. <th style="width: 110px">对账月度</th>
  13. <th style="width: 130px">客户</th>
  14. <th style="width: 130px">订单时间</th>
  15. <th style="width: 134px">订单号</th>
  16. <th style="width: 130px">万里牛单号</th>
  17. <th style="width: 100px">SKU品号</th>
  18. <th style="min-width: 200px">SKU品名</th>
  19. <th style="width: 80px">SKU数量</th>
  20. <th style="width: 100px">BOM品号</th>
  21. <th style="min-width: 300px">BOM品名</th>
  22. <th style="width: 65px">数量</th>
  23. <th style="width: 65px">单价</th>
  24. <th style="width: 65px">激光LOGO</th>
  25. <th style="width: 65px">激光体位线</th>
  26. <th style="width: 65px">代发费</th>
  27. <th style="width: 70px">快递包材费</th>
  28. <th style="width: 70px">包装人工费</th>
  29. <th style="width: 70px">管理费</th>
  30. <th style="width: 80px">SKU单价</th>
  31. <th style="width: 80px">小计</th>
  32. <th style="width: 80px">售后数量</th>
  33. <th style="width: 80px">售后金额</th>
  34. <th style="border-right: 0; width: 90px">合计</th>
  35. </tr>
  36. <tbody v-for="(item, index) in tableList" :key="index">
  37. <tr v-for="(itemBom, indexBom) in item.bomDetails" :key="indexBom">
  38. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.reconciliationTime.substr(0, 7) }}</td>
  39. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.subsidiaryName }}</td>
  40. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.contractTime }}</td>
  41. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.contractCode }}</td>
  42. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.tradeNo }}</td>
  43. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.productColorCode }}</td>
  44. <td style="text-align: left; word-break: break-all" v-if="indexBom === 0" :rowspan="item.bomDetails.length">{{ item.productColorName }}</td>
  45. <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  46. <span v-if="item.quantity">{{ Number(item.quantity) }}</span>
  47. <span v-else>0</span>
  48. </td>
  49. <td style="text-align: left; word-break: break-all">{{ itemBom.bomColorCode }}</td>
  50. <td style="text-align: left; word-break: break-all">{{ itemBom.bomColorName }}</td>
  51. <td>
  52. <span v-if="itemBom.bomColorQuantity">{{ Number(itemBom.bomColorQuantity) }}</span>
  53. </td>
  54. <td>
  55. <span v-if="itemBom.dataResource === 1">{{ item.productPrice }}</span>
  56. <span v-else>{{ itemBom.price }}</span>
  57. </td>
  58. <td>
  59. <span v-if="item.processingLayout === '20' && itemBom.dataResource === 1 && item.processPrice && Number(item.processPrice) !== 0">{{
  60. item.processPrice
  61. }}</span>
  62. </td>
  63. <td>
  64. <span v-if="item.processingLayout === '10' && itemBom.dataResource === 1 && item.processPrice && Number(item.processPrice) !== 0">{{
  65. item.processPrice
  66. }}</span>
  67. </td>
  68. <td>
  69. <span v-if="itemBom.dataResource === 1 && item.deliverGoodsPrice && Number(item.deliverGoodsPrice) !== 0">{{ item.deliverGoodsPrice }}</span>
  70. </td>
  71. <td>
  72. <span v-if="itemBom.dataResource === 1 && item.expressPrice && Number(item.expressPrice) !== 0">{{ item.expressPrice }}</span>
  73. </td>
  74. <td>
  75. <span v-if="itemBom.dataResource === 1 && item.expensePrice && Number(item.expensePrice) !== 0">{{ item.expensePrice }}</span>
  76. </td>
  77. <td>
  78. <span v-if="itemBom.dataResource === 1 && item.managementFeesPrice && Number(item.managementFeesPrice) !== 0">{{ item.managementFeesPrice }}</span>
  79. </td>
  80. <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  81. <span>{{ item.skuPrice }}</span>
  82. </td>
  83. <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  84. <span>{{ subtotal(item) }}</span>
  85. </td>
  86. <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  87. <span v-if="item.aftermarketQuantity && Number(item.aftermarketQuantity) !== 0">{{ item.aftermarketQuantity }}</span>
  88. </td>
  89. <td v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  90. <span v-if="item.aftermarketAmount && Number(item.aftermarketAmount) !== 0">-{{ item.aftermarketAmount }}</span>
  91. </td>
  92. <td style="border-right: 0" v-if="indexBom === 0" :rowspan="item.bomDetails.length">
  93. <span>{{ getAllCost(item) }}</span>
  94. </td>
  95. </tr>
  96. </tbody>
  97. <tr>
  98. <td>总计:</td>
  99. <td colspan="21"></td>
  100. <td style="border-right: 0">
  101. <span>{{ getAggregate() }}</span>
  102. </td>
  103. </tr>
  104. <tr>
  105. <td>备注:</td>
  106. <td colspan="22" style="border-right: 0"></td>
  107. </tr>
  108. <tr>
  109. <td>交货地点:</td>
  110. <td colspan="22" style="border-right: 0"></td>
  111. </tr>
  112. <tr>
  113. <td colspan="3" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请人:</td>
  114. <td colspan="5" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">胜德体育总经理:</td>
  115. <td colspan="13" style="padding: 8px 4px; font-size: 16px; font-weight: 700; text-align: left; border-right: 0">申请日期:</td>
  116. </tr>
  117. </table>
  118. </div>
  119. <div style="width: 100%; text-align: center; margin-top: 16px" class="no-print">
  120. <el-button type="primary" size="small" @click="clickExcel">导出Excel</el-button>
  121. <el-button type="primary" size="small" @click="clickPrint">打印</el-button>
  122. <el-button size="small" @click="clickCancel">关 闭</el-button>
  123. </div>
  124. </div>
  125. </template>
  126. <script>
  127. import { summaryBachPrintDetail } from '@/api/shengde/group/finance/summary'
  128. import $ from 'jquery'
  129. export default {
  130. name: 'summaryPrint',
  131. props: {
  132. excelList: Array,
  133. },
  134. data() {
  135. return {
  136. loadingStatus: false,
  137. loadingText: '',
  138. tableList: [],
  139. }
  140. },
  141. created() {
  142. if (this.excelList && this.excelList.length > 0) {
  143. this.getDetails()
  144. }
  145. },
  146. mounted() {},
  147. methods: {
  148. getDetails() {
  149. this.loadingStatus = true
  150. let list = this.excelList.map((item) => {
  151. return item.id
  152. })
  153. summaryBachPrintDetail({ id: list.join(',') }).then(
  154. (res) => {
  155. this.tableList = res.data.data
  156. this.loadingStatus = false
  157. },
  158. (err) => {
  159. this.loadingStatus = false
  160. console.log('summaryBachPrintDetail: ' + err)
  161. }
  162. )
  163. },
  164. clickPrint() {
  165. this.$print(this.$refs.print)
  166. },
  167. clickExcel() {
  168. $('#tableId').table2excel({
  169. exclude: '.noExl',
  170. sheetName: '销售对账汇总',
  171. filename: '销售对账汇总',
  172. exclude_img: false,
  173. exclude_links: false,
  174. exclude_inputs: true,
  175. })
  176. },
  177. clickCancel() {
  178. this.$emit('clickCancel', false)
  179. },
  180. getCost(item, itemBom, num) {
  181. let money = 0
  182. if (itemBom.dataResource === 1) {
  183. if (item.productPrice) {
  184. money = parseFloat(Number(money) + Number(item.productPrice)).toFixed(2)
  185. }
  186. if (item.processPrice && ['10', '20'].includes(item.processingLayout)) {
  187. money = parseFloat(Number(money) + Number(item.processPrice)).toFixed(2)
  188. }
  189. if (item.deliverGoodsPrice) {
  190. money = parseFloat(Number(money) + Number(item.deliverGoodsPrice)).toFixed(2)
  191. }
  192. if (item.expressPrice) {
  193. money = parseFloat(Number(money) + Number(item.expressPrice)).toFixed(2)
  194. }
  195. if (item.expensePrice) {
  196. money = parseFloat(Number(money) + Number(item.expensePrice)).toFixed(2)
  197. }
  198. if (item.managementFeesPrice) {
  199. money = parseFloat(Number(money) + Number(item.managementFeesPrice)).toFixed(2)
  200. }
  201. } else {
  202. if (itemBom.price) {
  203. money = parseFloat(Number(money) + Number(itemBom.price)).toFixed(2)
  204. }
  205. }
  206. if (num) {
  207. money = parseFloat(Number(money) * Number(num)).toFixed(2)
  208. }
  209. return money
  210. },
  211. getAllCost(row) {
  212. let money = 0
  213. money = parseFloat(Number(row.skuPrice) * Number(row.quantity) - Number(row.aftermarketAmount)).toFixed(2)
  214. return money
  215. },
  216. getAggregate() {
  217. let allMoney = 0
  218. if (this.tableList && this.tableList.length > 0) {
  219. this.tableList.map((item) => {
  220. allMoney = parseFloat(Number(allMoney) + Number(item.skuPrice) * Number(item.quantity) - Number(item.aftermarketAmount)).toFixed(2)
  221. })
  222. }
  223. return allMoney
  224. },
  225. subtotal(item) {
  226. let num = 0
  227. if (item.quantity && item.skuPrice) {
  228. num = parseFloat(Number(item.quantity) * Number(item.skuPrice)).toFixed(2)
  229. }
  230. return num
  231. },
  232. },
  233. }
  234. </script>
  235. <style lang="scss" scoped>
  236. .tableOne {
  237. border-top: 1px solid black;
  238. border-bottom: 1px solid black;
  239. line-height: 20px;
  240. overflow: auto;
  241. width: 130%;
  242. }
  243. .tableOne th {
  244. font-weight: 700;
  245. border-right: 1px solid black;
  246. }
  247. .tableOne td {
  248. border-right: 1px solid black;
  249. border-top: 1px solid black;
  250. text-align: center;
  251. padding: 4px;
  252. }
  253. </style>