index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '复制万里牛单号',
  14. action: () => clickCopyWLNCode(),
  15. },
  16. ]"
  17. @get-list="getList"
  18. @clickReset="clickReset">
  19. <template #orderCode="{ item }">
  20. <div>
  21. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.orderCode }}</a>
  22. </div>
  23. </template>
  24. <template #blueprint="{ item }">
  25. <div>图片</div>
  26. </template>
  27. <template #subtotal="{ item }">
  28. <div style="color: #409eff">{{ subtotal(item) }}</div>
  29. </template>
  30. <template #wlnCreateTime="{ item }">
  31. <div>{{ item.wlnCreateTime || item.createTime }}</div>
  32. </template>
  33. </byTable>
  34. </el-card>
  35. </div>
  36. </template>
  37. <script setup>
  38. import byTable from "/src/components/byTable/index";
  39. import { ElMessage } from "element-plus";
  40. import { copyText } from "vue3-clipboard";
  41. const { proxy } = getCurrentInstance();
  42. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  43. const sourceList = ref({
  44. data: [],
  45. pagination: {
  46. total: 0,
  47. pageNum: 1,
  48. pageSize: 10,
  49. departmentId: "",
  50. skuSpecCode: "",
  51. skuSpecName: "",
  52. bomSpecCode: "",
  53. bomSpecName: "",
  54. orderCode: "",
  55. orderWlnCode: "",
  56. orderStatus: "",
  57. beginTime: "",
  58. endTime: "",
  59. },
  60. });
  61. const loading = ref(false);
  62. const searchConfig = computed(() => {
  63. return [
  64. {
  65. type: "select",
  66. prop: "departmentId",
  67. data: departmentList.value,
  68. label: "事业部",
  69. },
  70. {
  71. type: "input",
  72. prop: "skuSpecCode",
  73. label: "SKU规格编码",
  74. },
  75. {
  76. type: "input",
  77. prop: "skuSpecName",
  78. label: "SKU规格名称",
  79. },
  80. {
  81. type: "input",
  82. prop: "bomSpecCode",
  83. label: "BOM规格编码",
  84. },
  85. {
  86. type: "input",
  87. prop: "bomSpecName",
  88. label: "BOM规格名称",
  89. },
  90. {
  91. type: "input",
  92. prop: "orderCode",
  93. label: "订单号",
  94. },
  95. {
  96. type: "input",
  97. prop: "orderWlnCode",
  98. label: "万里牛单号",
  99. },
  100. {
  101. type: "select",
  102. prop: "orderStatus",
  103. dictKey: "order_status",
  104. label: "订单状态",
  105. },
  106. {
  107. type: "datetime",
  108. propList: ["beginTime", "endTime"],
  109. label: "下单时间",
  110. },
  111. ];
  112. });
  113. const config = computed(() => {
  114. return [
  115. {
  116. attrs: {
  117. label: "设计图",
  118. slot: "blueprint",
  119. width: 80,
  120. },
  121. },
  122. {
  123. attrs: {
  124. label: "产品规格编码",
  125. prop: "skuSpecCode",
  126. width: 160,
  127. },
  128. },
  129. {
  130. attrs: {
  131. label: "产品规格名称",
  132. prop: "skuSpecName",
  133. width: 240,
  134. },
  135. },
  136. {
  137. attrs: {
  138. label: "BOM规格编码",
  139. prop: "bomSpecCode",
  140. width: 160,
  141. },
  142. },
  143. {
  144. attrs: {
  145. label: "BOM规格名称",
  146. prop: "bomSpecName",
  147. width: 260,
  148. },
  149. },
  150. {
  151. attrs: {
  152. label: "事业部",
  153. prop: "departmentName",
  154. width: 120,
  155. },
  156. },
  157. {
  158. attrs: {
  159. label: "订单号",
  160. slot: "orderCode",
  161. width: 200,
  162. },
  163. },
  164. {
  165. attrs: {
  166. label: "万里牛单号",
  167. prop: "orderWlnCode",
  168. width: 160,
  169. },
  170. },
  171. {
  172. attrs: {
  173. label: "订单状态",
  174. prop: "orderStatus",
  175. width: 120,
  176. },
  177. render(val) {
  178. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
  179. },
  180. },
  181. {
  182. attrs: {
  183. label: "结算状态",
  184. prop: "orderSettlementStatus",
  185. width: 120,
  186. },
  187. render(val) {
  188. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_status"]);
  189. },
  190. },
  191. {
  192. attrs: {
  193. label: "数量",
  194. prop: "quantity",
  195. width: 80,
  196. },
  197. },
  198. {
  199. attrs: {
  200. label: "小计 ¥",
  201. slot: "subtotal",
  202. width: 120,
  203. align: "right",
  204. },
  205. },
  206. {
  207. attrs: {
  208. label: "产品单价 ¥",
  209. prop: "unitPrice",
  210. width: 120,
  211. align: "right",
  212. },
  213. render(val) {
  214. return proxy.moneyFormat(val);
  215. },
  216. },
  217. {
  218. attrs: {
  219. label: "定制加工费 ¥",
  220. prop: "customProcessingFee",
  221. width: 120,
  222. align: "right",
  223. },
  224. render(val) {
  225. return proxy.moneyFormat(val);
  226. },
  227. },
  228. {
  229. attrs: {
  230. label: "代发费 ¥",
  231. prop: "lssueFee",
  232. width: 120,
  233. align: "right",
  234. },
  235. render(val) {
  236. return proxy.moneyFormat(val);
  237. },
  238. },
  239. {
  240. attrs: {
  241. label: "快递包材费 ¥",
  242. prop: "deliveryMaterialsFee",
  243. width: 120,
  244. align: "right",
  245. },
  246. render(val) {
  247. return proxy.moneyFormat(val);
  248. },
  249. },
  250. {
  251. attrs: {
  252. label: "包装人工费 ¥",
  253. prop: "packingLabor",
  254. width: 120,
  255. align: "right",
  256. },
  257. render(val) {
  258. return proxy.moneyFormat(val);
  259. },
  260. },
  261. {
  262. attrs: {
  263. label: "包材费 ¥",
  264. prop: "packagingMaterialCost",
  265. width: 120,
  266. align: "right",
  267. },
  268. render(val) {
  269. return proxy.moneyFormat(val);
  270. },
  271. },
  272. {
  273. attrs: {
  274. label: "管理费 ¥",
  275. prop: "managementFee",
  276. width: 120,
  277. align: "right",
  278. },
  279. render(val) {
  280. return proxy.moneyFormat(val);
  281. },
  282. },
  283. {
  284. attrs: {
  285. label: "外箱包装费 ¥",
  286. prop: "outerBoxPackingFee",
  287. width: 120,
  288. align: "right",
  289. },
  290. render(val) {
  291. return proxy.moneyFormat(val);
  292. },
  293. },
  294. {
  295. attrs: {
  296. label: "下单时间",
  297. slot: "wlnCreateTime",
  298. width: 160,
  299. },
  300. },
  301. ];
  302. });
  303. const getDemandData = () => {
  304. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  305. if (res.rows && res.rows.length > 0) {
  306. departmentList.value = departmentList.value.concat(
  307. res.rows.map((item) => {
  308. return {
  309. dictKey: item.id,
  310. dictValue: item.name,
  311. };
  312. })
  313. );
  314. }
  315. });
  316. };
  317. getDemandData();
  318. const getList = async (req, status) => {
  319. if (status) {
  320. sourceList.value.pagination = {
  321. pageNum: sourceList.value.pagination.pageNum,
  322. pageSize: sourceList.value.pagination.pageSize,
  323. };
  324. } else {
  325. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  326. }
  327. loading.value = true;
  328. proxy.post("/orderSku/page", sourceList.value.pagination).then((res) => {
  329. sourceList.value.data = res.rows;
  330. sourceList.value.pagination.total = res.total;
  331. setTimeout(() => {
  332. loading.value = false;
  333. }, 200);
  334. });
  335. };
  336. getList();
  337. const clickReset = () => {
  338. getList("", true);
  339. };
  340. const clickCode = (row) => {
  341. proxy.$router.replace({
  342. path: "/order-detail",
  343. query: {
  344. detailId: row.orderId,
  345. text: "订单详情",
  346. random: proxy.random(),
  347. },
  348. });
  349. };
  350. const subtotal = (row) => {
  351. let money = 0;
  352. if (row.unitPrice) {
  353. money = Number(Math.round((money + row.unitPrice) * 100) / 100);
  354. }
  355. if (row.customProcessingFee) {
  356. money = Number(Math.round((money + row.customProcessingFee) * 100) / 100);
  357. }
  358. if (row.lssueFee) {
  359. money = Number(Math.round((money + row.lssueFee) * 100) / 100);
  360. }
  361. if (row.deliveryMaterialsFee) {
  362. money = Number(Math.round((money + row.deliveryMaterialsFee) * 100) / 100);
  363. }
  364. if (row.packingLabor) {
  365. money = Number(Math.round((money + row.packingLabor) * 100) / 100);
  366. }
  367. if (row.managementFee) {
  368. money = Number(Math.round((money + row.managementFee) * 100) / 100);
  369. }
  370. if (row.packagingMaterialCost) {
  371. money = Number(Math.round((money + row.packagingMaterialCost) * 100) / 100);
  372. }
  373. return money;
  374. };
  375. const clickCopyWLNCode = () => {
  376. ElMessage("复制数据中,请稍后");
  377. proxy.post("/orderSku/getOrderWlnCodeStr", sourceList.value.pagination).then((res) => {
  378. copyText(res, undefined, (error) => {
  379. if (error) {
  380. ElMessage.error(`复制失败: ${error} !`);
  381. } else {
  382. ElMessage.success(`复制成功!`);
  383. }
  384. });
  385. });
  386. };
  387. </script>
  388. <style lang="scss" scoped>
  389. :deep(.el-dialog) {
  390. margin-top: 10px !important;
  391. margin-bottom: 10px !important;
  392. }
  393. </style>