printOrder.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. // proxy.downloadFile(res, "订单对账单.xlsx");
  140. loading.value = false;
  141. },
  142. (err) => {
  143. console.log(err);
  144. loading.value = false;
  145. }
  146. );
  147. };
  148. const columns = computed(() => {
  149. return [
  150. {
  151. dataKey: "wlnCreateTime",
  152. key: "column-0",
  153. title: "订单时间",
  154. width: 150,
  155. rowIndex: 1,
  156. },
  157. {
  158. dataKey: "code",
  159. key: "column-1",
  160. title: "订单号",
  161. width: 160,
  162. },
  163. {
  164. dataKey: "wlnCode",
  165. key: "column-2",
  166. title: "万里牛单号",
  167. width: 140,
  168. },
  169. {
  170. dataKey: "skuSpecCode",
  171. key: "column-3",
  172. title: "SKU品号",
  173. width: 140,
  174. },
  175. {
  176. dataKey: "skuSpecName",
  177. key: "column-4",
  178. title: "SKU品名",
  179. width: 220,
  180. },
  181. {
  182. dataKey: "quantitySKU",
  183. key: "column-5",
  184. title: "SKU数量",
  185. width: 80,
  186. },
  187. {
  188. dataKey: "bomSpecCode",
  189. key: "column-6",
  190. title: "BOM品号",
  191. width: 140,
  192. },
  193. {
  194. dataKey: "bomSpecName",
  195. key: "column-7",
  196. title: "BOM品名",
  197. width: 260,
  198. },
  199. {
  200. dataKey: "quantityBOM",
  201. key: "column-8",
  202. title: "BOM数量",
  203. width: 80,
  204. },
  205. {
  206. dataKey: "unitPriceBOM",
  207. key: "column-9",
  208. title: "单价",
  209. width: 100,
  210. },
  211. {
  212. dataKey: "laserLogoSummary",
  213. key: "column-10",
  214. title: "激光LOGO",
  215. width: 100,
  216. },
  217. {
  218. dataKey: "laserMitochondrialSummary",
  219. key: "column-11",
  220. title: "激光体位线",
  221. width: 100,
  222. },
  223. {
  224. dataKey: "lssueFeeSummary",
  225. key: "column-12",
  226. title: "代发费",
  227. width: 100,
  228. },
  229. {
  230. dataKey: "deliveryMaterialsFeeSummary",
  231. key: "column-13",
  232. title: "快递包材费",
  233. width: 100,
  234. },
  235. {
  236. dataKey: "packingLaborSummary",
  237. key: "column-14",
  238. title: "包装人工费",
  239. width: 100,
  240. },
  241. {
  242. dataKey: "managementFeeSummary",
  243. key: "column-15",
  244. title: "管理费",
  245. width: 100,
  246. },
  247. {
  248. dataKey: "unitPriceSKU",
  249. key: "column-16",
  250. title: "SKU单价",
  251. width: 100,
  252. },
  253. {
  254. dataKey: "subtotal",
  255. key: "column-17",
  256. title: "小计",
  257. width: 120,
  258. },
  259. {
  260. dataKey: "total",
  261. key: "column-18",
  262. title: "合计",
  263. width: 120,
  264. },
  265. ];
  266. });
  267. const mergeColumnOne = [0, 1, 2, 18];
  268. const mergeColumnTwo = [3, 4, 5, 16, 17];
  269. const Row = ({ rowData, cells }) => {
  270. if (rowData.indexOne > 1) {
  271. for (let i = 0; i < mergeColumnOne.length; i++) {
  272. const cell = cells[mergeColumnOne[i]];
  273. const style = {
  274. ...cell.props.style,
  275. backgroundColor: "#fff",
  276. height: `${rowData.indexOne * 35 - 1}px`,
  277. alignSelf: "flex-start",
  278. zIndex: 1,
  279. };
  280. cells[mergeColumnOne[i]] = cloneVNode(cell, { style });
  281. }
  282. }
  283. if (rowData.indexTwo > 1) {
  284. for (let i = 0; i < mergeColumnTwo.length; i++) {
  285. const cell = cells[mergeColumnTwo[i]];
  286. const style = {
  287. ...cell.props.style,
  288. backgroundColor: "#fff",
  289. height: `${rowData.indexTwo * 35 - 1}px`,
  290. alignSelf: "flex-start",
  291. zIndex: 1,
  292. };
  293. cells[mergeColumnTwo[i]] = cloneVNode(cell, { style });
  294. }
  295. }
  296. return cells;
  297. };
  298. </script>
  299. <style lang="scss" scoped>
  300. ::v-deep(.el-table-v2__header-cell) {
  301. background-color: #eeeeee !important;
  302. }
  303. ::v-deep(.el-card__body) {
  304. padding: 10px !important;
  305. }
  306. </style>