printOrder.vue 9.2 KB

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