printOrder.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <el-card v-loading="loading">
  3. <div style="text-align: center; font-size: 30px; padding: 8px; font-weight: 700">{{ props.rowData.departmentName }}-胜德体育对账单</div>
  4. <div style="text-align: center; font-size: 18px; padding-bottom: 8px; font-weight: 700">( 对账时间: {{ props.rowData.dimensionality }} )</div>
  5. <div style="height: calc(100vh - 264px - 88px); overflow-y: auto; overflow-x: hidden">
  6. <el-auto-resizer>
  7. <template #default="{ height, width }">
  8. <el-table-v2 :columns="columns" :data="tableData" :width="width" :height="height" fixed :cache="20" :header-height="35" :row-height="35">
  9. <template #row="props">
  10. <Row v-bind="props" />
  11. </template>
  12. </el-table-v2>
  13. </template>
  14. </el-auto-resizer>
  15. </div>
  16. <div style="padding: 8px; text-align: center">
  17. <el-button @click="clickCancel" size="large">关 闭</el-button>
  18. <el-button type="primary" @click="deriveExcel()" size="large" v-preReClick>导 出</el-button>
  19. </div>
  20. </el-card>
  21. </template>
  22. <script setup>
  23. import { cloneVNode } from "vue";
  24. const { proxy } = getCurrentInstance();
  25. const props = defineProps({
  26. rowData: Object,
  27. });
  28. const loading = ref(false);
  29. const tableData = ref([]);
  30. const getAggregate = (data) => {
  31. let total = 0;
  32. if (data && data.length > 0) {
  33. for (let i = 0; i < data.length; i++) {
  34. if (data[i].total) {
  35. total = Number(Math.round((total + data[i].total) * 100) / 100);
  36. }
  37. }
  38. }
  39. return total;
  40. };
  41. onMounted(() => {
  42. if (props.rowData && props.rowData.idGroupConcat) {
  43. loading.value = true;
  44. proxy.post("/statementOfAccountMerge/getDocumentByOrder", { idGroupConcat: props.rowData.idGroupConcat }).then(
  45. (res) => {
  46. let total = getAggregate(proxy.deepClone(res));
  47. let list = [];
  48. if (res && res.length > 0) {
  49. for (let i = 0; i < res.length; i++) {
  50. if (res[i].skuSpecList && res[i].skuSpecList.length > 0) {
  51. for (let j = 0; j < res[i].skuSpecList.length; j++) {
  52. if (res[i].skuSpecList[j].bomSpecList && res[i].skuSpecList[j].bomSpecList.length > 0) {
  53. for (let y = 0; y < res[i].skuSpecList[j].bomSpecList.length; y++) {
  54. let indexOne = 0;
  55. if (j === 0 && y === 0) {
  56. for (let z = 0; z < res[i].skuSpecList.length; z++) {
  57. if (res[i].skuSpecList[z].bomSpecList && res[i].skuSpecList[z].bomSpecList.length > 0) {
  58. indexOne = Number(indexOne + res[i].skuSpecList[z].bomSpecList.length);
  59. }
  60. }
  61. }
  62. let indexTwo = 0;
  63. if (y === 0) {
  64. indexTwo = res[i].skuSpecList[j].bomSpecList.length;
  65. }
  66. list.push({
  67. wlnCreateTime: res[i].wlnCreateTime,
  68. code: res[i].code,
  69. wlnCode: res[i].wlnCode,
  70. skuSpecCode: res[i].skuSpecList[j].skuSpecCode,
  71. skuSpecName: res[i].skuSpecList[j].skuSpecName,
  72. quantitySKU: res[i].skuSpecList[j].quantity,
  73. subtotal: res[i].skuSpecList[j].subtotal,
  74. bomSpecCode: res[i].skuSpecList[j].bomSpecList[y].bomSpecCode,
  75. bomSpecName: res[i].skuSpecList[j].bomSpecList[y].bomSpecName,
  76. quantityBOM: res[i].skuSpecList[j].bomSpecList[y].quantity,
  77. unitPriceBOM: res[i].skuSpecList[j].bomSpecList[y].unitPrice,
  78. laserLogoSummary: res[i].skuSpecList[j].bomSpecList[y].laserLogoSummary,
  79. laserMitochondrialSummary: res[i].skuSpecList[j].bomSpecList[y].laserMitochondrialSummary,
  80. lssueFeeSummary: res[i].skuSpecList[j].bomSpecList[y].lssueFeeSummary,
  81. deliveryMaterialsFeeSummary: res[i].skuSpecList[j].bomSpecList[y].deliveryMaterialsFeeSummary,
  82. packingLaborSummary: res[i].skuSpecList[j].bomSpecList[y].packingLaborSummary,
  83. managementFeeSummary: res[i].skuSpecList[j].bomSpecList[y].managementFeeSummary,
  84. unitPriceSKU: res[i].skuSpecList[j].unitPrice,
  85. outerBoxPackingFee: res[i].outerBoxPackingFee,
  86. total: res[i].total,
  87. indexOne: indexOne,
  88. indexTwo: indexTwo,
  89. });
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. list.push({
  97. indexOne: 1,
  98. indexTwo: 1,
  99. total: total,
  100. wlnCreateTime: "总计:",
  101. });
  102. tableData.value = Object.freeze(list);
  103. loading.value = false;
  104. },
  105. (err) => {
  106. console.log(err);
  107. loading.value = false;
  108. }
  109. );
  110. }
  111. });
  112. const emit = defineEmits(["clickCancel"]);
  113. const clickCancel = () => {
  114. emit("clickCancel", "");
  115. };
  116. const deriveExcel = () => {
  117. proxy
  118. .getFile("/statementOfAccountMerge/exportDocumentByOrder", {
  119. idGroupConcat: props.rowData.idGroupConcat,
  120. departmentName: props.rowData.departmentName,
  121. beginDate: props.rowData.dimensionality,
  122. })
  123. .then((res) => {
  124. proxy.downloadFile(res, "订单对账单.xlsx");
  125. });
  126. };
  127. const columns = computed(() => {
  128. return [
  129. {
  130. dataKey: "wlnCreateTime",
  131. key: "column-0",
  132. title: "订单时间",
  133. width: 150,
  134. rowIndex: 1,
  135. },
  136. {
  137. dataKey: "code",
  138. key: "column-1",
  139. title: "订单号",
  140. width: 160,
  141. },
  142. {
  143. dataKey: "wlnCode",
  144. key: "column-2",
  145. title: "万里牛单号",
  146. width: 140,
  147. },
  148. {
  149. dataKey: "skuSpecCode",
  150. key: "column-3",
  151. title: "SKU品号",
  152. width: 140,
  153. },
  154. {
  155. dataKey: "skuSpecName",
  156. key: "column-4",
  157. title: "SKU品名",
  158. width: 220,
  159. },
  160. {
  161. dataKey: "quantitySKU",
  162. key: "column-5",
  163. title: "SKU数量",
  164. width: 80,
  165. },
  166. {
  167. dataKey: "bomSpecCode",
  168. key: "column-6",
  169. title: "BOM品号",
  170. width: 140,
  171. },
  172. {
  173. dataKey: "bomSpecName",
  174. key: "column-7",
  175. title: "BOM品名",
  176. width: 260,
  177. },
  178. {
  179. dataKey: "quantityBOM",
  180. key: "column-8",
  181. title: "BOM数量",
  182. width: 80,
  183. },
  184. {
  185. dataKey: "unitPriceBOM",
  186. key: "column-9",
  187. title: "单价",
  188. width: 100,
  189. },
  190. {
  191. dataKey: "laserLogoSummary",
  192. key: "column-10",
  193. title: "激光LOGO",
  194. width: 100,
  195. },
  196. {
  197. dataKey: "laserMitochondrialSummary",
  198. key: "column-11",
  199. title: "激光体位线",
  200. width: 100,
  201. },
  202. {
  203. dataKey: "lssueFeeSummary",
  204. key: "column-12",
  205. title: "代发费",
  206. width: 100,
  207. },
  208. {
  209. dataKey: "deliveryMaterialsFeeSummary",
  210. key: "column-13",
  211. title: "快递包材费",
  212. width: 100,
  213. },
  214. {
  215. dataKey: "packingLaborSummary",
  216. key: "column-14",
  217. title: "包装人工费",
  218. width: 100,
  219. },
  220. {
  221. dataKey: "managementFeeSummary",
  222. key: "column-15",
  223. title: "管理费",
  224. width: 100,
  225. },
  226. {
  227. dataKey: "unitPriceSKU",
  228. key: "column-16",
  229. title: "SKU单价",
  230. width: 100,
  231. },
  232. {
  233. dataKey: "subtotal",
  234. key: "column-17",
  235. title: "小计",
  236. width: 120,
  237. },
  238. {
  239. dataKey: "total",
  240. key: "column-18",
  241. title: "合计",
  242. width: 120,
  243. },
  244. ];
  245. });
  246. const mergeColumnOne = [0, 1, 2, 18];
  247. const mergeColumnTwo = [3, 4, 5, 16, 17];
  248. const Row = ({ rowData, cells }) => {
  249. if (rowData.indexOne > 1) {
  250. for (let i = 0; i < mergeColumnOne.length; i++) {
  251. const cell = cells[mergeColumnOne[i]];
  252. const style = {
  253. ...cell.props.style,
  254. backgroundColor: "#fff",
  255. height: `${rowData.indexOne * 35 - 1}px`,
  256. alignSelf: "flex-start",
  257. zIndex: 1,
  258. };
  259. cells[mergeColumnOne[i]] = cloneVNode(cell, { style });
  260. }
  261. }
  262. if (rowData.indexTwo > 1) {
  263. for (let i = 0; i < mergeColumnTwo.length; i++) {
  264. const cell = cells[mergeColumnTwo[i]];
  265. const style = {
  266. ...cell.props.style,
  267. backgroundColor: "#fff",
  268. height: `${rowData.indexTwo * 35 - 1}px`,
  269. alignSelf: "flex-start",
  270. zIndex: 1,
  271. };
  272. cells[mergeColumnTwo[i]] = cloneVNode(cell, { style });
  273. }
  274. }
  275. return cells;
  276. };
  277. </script>
  278. <style lang="scss" scoped>
  279. ::v-deep(.el-table-v2__header-cell) {
  280. background-color: #eeeeee !important;
  281. }
  282. </style>