printSKU.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <el-card v-loading="loading">
  3. <div style="height: calc(100vh - 264px); overflow-y: auto; overflow-x: hidden">
  4. <el-table :data="tableData" border :row-style="{ height: '35px' }" header-row-class-name="tableHeader" show-summary :summary-method="getSummaries">
  5. <el-table-column align="center">
  6. <template #header>
  7. <div style="text-align: center; font-size: 30px; padding: 8px">{{ props.rowData.departmentName }}-胜德体育对账单</div>
  8. <div style="text-align: center; font-size: 18px; padding-bottom: 8px">( 对账时间: {{ props.rowData.dimensionality }} )</div>
  9. </template>
  10. <el-table-column label="SKU品号" prop="skuSpecCode" width="180" />
  11. <el-table-column label="SKU品名" prop="skuSpecName" min-width="220" />
  12. <el-table-column label="数量(PCS)" align="center" prop="quantity" width="160" />
  13. <el-table-column label="SKU单价" align="center" prop="unitPrice" width="160" />
  14. <el-table-column label="小计" align="center" width="180">
  15. <template #default="{ row }">
  16. {{ moneyFormat(row.subtotal) }}
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="合计" align="center" width="180">
  20. <template #default="{ row }">
  21. {{ moneyFormat(row.total) }}
  22. </template>
  23. </el-table-column>
  24. </el-table-column>
  25. </el-table>
  26. </div>
  27. <div style="padding: 8px; text-align: center">
  28. <el-button @click="clickCancel" size="large">关 闭</el-button>
  29. <el-button type="primary" @click="deriveExcel()" size="large" v-preReClick>导 出</el-button>
  30. </div>
  31. </el-card>
  32. </template>
  33. <script setup>
  34. const { proxy } = getCurrentInstance();
  35. const props = defineProps({
  36. rowData: Object,
  37. });
  38. const loading = ref(false);
  39. const tableData = ref([]);
  40. onMounted(() => {
  41. if (props.rowData.idGroupConcat) {
  42. loading.value = true;
  43. proxy.post("/statementOfAccountMerge/getDocumentBySku", { idGroupConcat: props.rowData.idGroupConcat }).then(
  44. (res) => {
  45. tableData.value = Object.freeze(res);
  46. loading.value = false;
  47. },
  48. (err) => {
  49. console.log(err);
  50. loading.value = false;
  51. }
  52. );
  53. }
  54. });
  55. const labelList = ref({
  56. 2: "quantity",
  57. 5: "total",
  58. });
  59. const textList = ref({
  60. 1: "胜德体育总经理:",
  61. 2: "申请日期:",
  62. });
  63. const getSummaries = ({ columns, data }) => {
  64. const sums = [];
  65. columns.forEach((column, index) => {
  66. if (index === 0) {
  67. sums[index] = h("div", { class: "" }, [
  68. h("div", {
  69. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  70. innerHTML: "总计:",
  71. }),
  72. h("div", {
  73. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  74. innerHTML: "备注:",
  75. }),
  76. h("div", {
  77. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  78. innerHTML: "交货地点:",
  79. }),
  80. h("div", { style: { "font-size": "16px", "font-weight": 700, padding: "0 12px" }, innerHTML: "申请人:" }),
  81. ]);
  82. return;
  83. } else {
  84. sums[index] = h("div", { class: "" }, [
  85. [1, 3, 4].includes(index)
  86. ? h("div", {
  87. style: {
  88. "text-align": "center",
  89. "border-style": "solid",
  90. "border-width": "0 1px 1px 0",
  91. "border-color": "#ebeef5",
  92. color: "#ebeef5",
  93. padding: "0 12px",
  94. height: "35px",
  95. },
  96. innerHTML: ".",
  97. })
  98. : h("div", {
  99. style: {
  100. "text-align": "center",
  101. "border-style": "solid",
  102. "border-width": "0 1px 1px 0",
  103. "border-color": "#ebeef5",
  104. padding: "0 12px",
  105. height: "35px",
  106. },
  107. innerHTML: getTotal(labelList.value[index]),
  108. }),
  109. h("div", {
  110. style: {
  111. "text-align": "center",
  112. "border-style": "solid",
  113. "border-width": "0 0 1px 0",
  114. "border-color": "#ebeef5",
  115. color: "#ebeef5",
  116. padding: "0 12px",
  117. height: "35px",
  118. },
  119. innerHTML: ".",
  120. }),
  121. h("div", {
  122. style: {
  123. "text-align": "center",
  124. "border-style": "solid",
  125. "border-width": "0 0 1px 0",
  126. "border-color": "#ebeef5",
  127. color: "#ebeef5",
  128. padding: "0 12px",
  129. height: "35px",
  130. },
  131. innerHTML: ".",
  132. }),
  133. [3, 4, 5].includes(index)
  134. ? h("div", {
  135. style: {
  136. "text-align": "center",
  137. "border-style": "solid",
  138. "border-width": "0 0 1px 0",
  139. "border-color": "#ebeef5",
  140. color: "#ebeef5",
  141. padding: "0 12px",
  142. height: "35px",
  143. },
  144. innerHTML: ".",
  145. })
  146. : h("div", { style: { "font-size": "16px", "font-weight": 700, padding: "0 12px", "text-align": "left" }, innerHTML: textList.value[index] }),
  147. ]);
  148. return;
  149. }
  150. });
  151. return sums;
  152. };
  153. const getTotal = (label) => {
  154. let list = tableData.value.map((item) => item[label]);
  155. return Number(Math.round(list.reduce((acc, curr) => acc + curr, 0) * 100) / 100);
  156. };
  157. const emit = defineEmits(["clickCancel"]);
  158. const clickCancel = () => {
  159. emit("clickCancel", "");
  160. };
  161. const deriveExcel = () => {
  162. proxy
  163. .getFile("/statementOfAccountMerge/exportDocumentBySku", {
  164. idGroupConcat: props.rowData.idGroupConcat,
  165. departmentName: props.rowData.departmentName,
  166. beginDate: props.rowData.dimensionality,
  167. })
  168. .then((res) => {
  169. proxy.downloadFile(res, "SKU对账单.xlsx");
  170. });
  171. };
  172. </script>
  173. <style lang="scss" scoped>
  174. ::v-deep(.el-table thead.is-group th.el-table__cell) {
  175. background-color: white !important;
  176. }
  177. ::v-deep(.el-table__footer-wrapper tbody td.el-table__cell) {
  178. background-color: white !important;
  179. }
  180. ::v-deep(.el-table .el-table__cell) {
  181. padding: 0;
  182. }
  183. ::v-deep(.el-table__footer .cell) {
  184. padding: 0;
  185. }
  186. ::v-deep(.el-table__footer .el-table__cell) {
  187. border-right: 0px;
  188. }
  189. </style>