print.vue 12 KB

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