printBOM.vue 8.1 KB

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