salesSlipTable.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view style="font-size: 32rpx;">
  3. <table style="width: 100%;">
  4. <!-- 表头行 -->
  5. <tr>
  6. <th align="center" colspan="4">{{tenantName}}销售单</th>
  7. </tr>
  8. <tr>
  9. <th align="left" colspan="4">NO.{{form.sysNo}}</th>
  10. </tr>
  11. <tr>
  12. <th align="left" colspan="2">客户:{{form.corpsName}}</th>
  13. <th align="right" colspan="2">销售日期:{{form.businesDate?form.businesDate.slice(0, 10):''}}</th>
  14. </tr>
  15. <!-- 表格数据行 -->
  16. <tr>
  17. <td align="center" style="width: 25%;">产品</td>
  18. <td align="center" style="width: 25%;">数量</td>
  19. <td align="center" style="width: 25%;">单价</td>
  20. <td align="center" style="width: 25%;">金额</td>
  21. </tr>
  22. <tr v-for="(item,index) in form.orderItemsList" :key="index">
  23. <td align="left" colspan="4" style="padding: 0;border: none;">
  24. <table style="width: 100%;border-collapse: collapse;">
  25. <tr>
  26. <td align="left" colspan="4">{{item.cname}}</td>
  27. </tr>
  28. <tr style="border-bottom: 1rpx solid #000;">
  29. <td align="center" style="width: 25%;"></td>
  30. <td align="center" style="width: 25%;">{{Number(item.storageInQuantity)}}</td>
  31. <td align="center" style="width: 25%;">{{Number(item.price).toFixed(2)}}</td>
  32. <td align="center" style="width: 25%;">{{item.amount}}</td>
  33. </tr>
  34. </table>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td colspan="2">合计金额(小):{{amountNumber.amount}}</td>
  39. <td colspan="2">合计金额(大):{{amountNumber.amountDX}}</td>
  40. </tr>
  41. <tr>
  42. <td colspan="4">订货电话:{{form.clientAttn}}</td>
  43. </tr>
  44. <tr>
  45. <!-- <td colspan="2">制单人:{{form.client}}</td> -->
  46. <td colspan="2">制单人:{{userInfoName}}</td>
  47. <td colspan="2">收货人(签字):</td>
  48. </tr>
  49. </table>
  50. </view>
  51. </template>
  52. <script>
  53. import {
  54. DX
  55. } from '@/common/dateFormat.js';
  56. export default {
  57. data() {
  58. return {
  59. form:{},
  60. amountNumber:{},
  61. tenantName:'',
  62. userInfoName:'',
  63. }
  64. },
  65. onLoad(options) {
  66. this.tenantName = uni.getStorageSync('information').tenantName
  67. this.userInfoName = uni.getStorageSync('userInfo').account
  68. this.form = JSON.parse(options.data)
  69. this.amountNumber = {
  70. deliveryAll: 0, //送货总数量
  71. cost: 0, //成本
  72. grossProfit: 0, //毛利
  73. delivery: 0, //送货
  74. saleAll: 0, //销售数量
  75. amount: 0
  76. }
  77. for (let item of this.form.orderItemsList) {
  78. this.amountNumber.saleAll += Number(item.storageInQuantity)
  79. this.amountNumber.cost += Number(item.storageInQuantity) * Number(item.purchasePrice)
  80. this.amountNumber.delivery += Number(item.actualQuantity)
  81. this.amountNumber.deliveryAll += Number(item.actualQuantity)
  82. this.amountNumber.amount += Number(item.amount)
  83. this.amountNumber.grossProfit += Number(item.amount) - (item.purchasePrice ? Number(item.storageInQuantity) * Number(item.purchasePrice) : 0)
  84. }
  85. this.form.purchaseAmount = this.amountNumber.amount
  86. this.amountNumber.amountDX = DX(this.amountNumber.amount)
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. page {
  92. background-color: #fff !important;
  93. }
  94. </style>