index.vue 8.3 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: () => clickAddOrder(),
  15. },
  16. ]"
  17. @get-list="getList"
  18. @clickReset="clickReset">
  19. <template #code="{ item }">
  20. <div>
  21. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  22. </div>
  23. </template>
  24. <template #totalAmount="{ item }">
  25. <div style="color: #409eff">{{ moneyFormat(item.totalAmount) }}</div>
  26. </template>
  27. <template #address="{ item }">
  28. <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
  29. </template>
  30. </byTable>
  31. </el-card>
  32. </div>
  33. </template>
  34. <script setup>
  35. import byTable from "@/components/byTable/index";
  36. import { ElMessage, ElMessageBox } from "element-plus";
  37. const { proxy } = getCurrentInstance();
  38. const sourceList = ref({
  39. data: [],
  40. pagination: {
  41. total: 0,
  42. pageNum: 1,
  43. pageSize: 10,
  44. departmentId: proxy.useUserStore().user.dept.deptId,
  45. code: "",
  46. wlnCode: "",
  47. status: "",
  48. settlementStatus: "",
  49. exception: "0",
  50. },
  51. });
  52. const loading = ref(false);
  53. const searchConfig = computed(() => {
  54. return [
  55. {
  56. type: "input",
  57. prop: "code",
  58. label: "订单号",
  59. },
  60. {
  61. type: "input",
  62. prop: "wlnCode",
  63. label: "万里牛单号",
  64. },
  65. {
  66. type: "select",
  67. prop: "status",
  68. dictKey: "order_status",
  69. label: "订单状态",
  70. },
  71. {
  72. type: "select",
  73. prop: "settlementStatus",
  74. label: "结算状态",
  75. data: proxy.useUserStore().allDict["settlement_status"],
  76. },
  77. ];
  78. });
  79. const config = computed(() => {
  80. return [
  81. {
  82. attrs: {
  83. label: "事业部",
  84. prop: "departmentName",
  85. width: 120,
  86. },
  87. },
  88. {
  89. attrs: {
  90. label: "订单号",
  91. slot: "code",
  92. width: 200,
  93. },
  94. },
  95. {
  96. attrs: {
  97. label: "万里牛单号",
  98. prop: "wlnCode",
  99. width: 160,
  100. },
  101. },
  102. {
  103. attrs: {
  104. label: "快递单号",
  105. prop: "expressDeliveryCode",
  106. width: 140,
  107. },
  108. },
  109. {
  110. attrs: {
  111. label: "订单状态",
  112. prop: "status",
  113. width: 120,
  114. },
  115. render(val) {
  116. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
  117. },
  118. },
  119. {
  120. attrs: {
  121. label: "结算状态",
  122. prop: "settlementStatus",
  123. width: 120,
  124. },
  125. render(val) {
  126. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_status"]);
  127. },
  128. },
  129. {
  130. attrs: {
  131. label: "税率",
  132. prop: "taxRate",
  133. width: 80,
  134. },
  135. render(val) {
  136. return val + "%";
  137. },
  138. },
  139. {
  140. attrs: {
  141. label: "订单总金额 ¥",
  142. slot: "totalAmount",
  143. width: 120,
  144. align: "right",
  145. },
  146. },
  147. {
  148. attrs: {
  149. label: "产品总金额 ¥",
  150. prop: "productTotalAmount",
  151. width: 120,
  152. align: "right",
  153. },
  154. render(val) {
  155. return proxy.moneyFormat(val);
  156. },
  157. },
  158. {
  159. attrs: {
  160. label: "定制加工费 ¥",
  161. prop: "customProcessingFee",
  162. width: 120,
  163. align: "right",
  164. },
  165. render(val) {
  166. return proxy.moneyFormat(val);
  167. },
  168. },
  169. {
  170. attrs: {
  171. label: "代发费 ¥",
  172. prop: "lssueFee",
  173. width: 120,
  174. align: "right",
  175. },
  176. render(val) {
  177. return proxy.moneyFormat(val);
  178. },
  179. },
  180. {
  181. attrs: {
  182. label: "快递包材费 ¥",
  183. prop: "deliveryMaterialsFee",
  184. width: 120,
  185. align: "right",
  186. },
  187. render(val) {
  188. return proxy.moneyFormat(val);
  189. },
  190. },
  191. {
  192. attrs: {
  193. label: "包装人工费 ¥",
  194. prop: "packingLabor",
  195. width: 120,
  196. align: "right",
  197. },
  198. render(val) {
  199. return proxy.moneyFormat(val);
  200. },
  201. },
  202. {
  203. attrs: {
  204. label: "包材费 ¥",
  205. prop: "packagingMaterialCost",
  206. width: 120,
  207. align: "right",
  208. },
  209. render(val) {
  210. return proxy.moneyFormat(val);
  211. },
  212. },
  213. {
  214. attrs: {
  215. label: "管理费 ¥",
  216. prop: "managementFee",
  217. width: 120,
  218. align: "right",
  219. },
  220. render(val) {
  221. return proxy.moneyFormat(val);
  222. },
  223. },
  224. {
  225. attrs: {
  226. label: "交期",
  227. prop: "deliveryTime",
  228. width: 160,
  229. align: "center",
  230. },
  231. },
  232. {
  233. attrs: {
  234. label: "发货时间",
  235. prop: "shippingTime",
  236. width: 160,
  237. align: "center",
  238. },
  239. },
  240. {
  241. attrs: {
  242. label: "收货人",
  243. prop: "consignee",
  244. width: 140,
  245. },
  246. },
  247. {
  248. attrs: {
  249. label: "收货人电话",
  250. prop: "consigneeNumber",
  251. width: 140,
  252. },
  253. },
  254. {
  255. attrs: {
  256. label: "收货人地址",
  257. slot: "address",
  258. width: 220,
  259. },
  260. },
  261. {
  262. attrs: {
  263. label: "操作",
  264. width: 160,
  265. align: "center",
  266. fixed: "right",
  267. },
  268. renderHTML(row) {
  269. return [
  270. row.status == 10
  271. ? {
  272. attrs: {
  273. label: "上传设计稿",
  274. type: "primary",
  275. text: true,
  276. },
  277. el: "button",
  278. click() {
  279. clickUpload(row);
  280. },
  281. }
  282. : {},
  283. row.status == 0
  284. ? {
  285. attrs: {
  286. label: "编辑",
  287. type: "primary",
  288. text: true,
  289. },
  290. el: "button",
  291. click() {
  292. clickUpdate(row);
  293. },
  294. }
  295. : {},
  296. row.status == 10
  297. ? {
  298. attrs: {
  299. label: "删除",
  300. type: "danger",
  301. text: true,
  302. },
  303. el: "button",
  304. click() {
  305. clickDelete(row);
  306. },
  307. }
  308. : {},
  309. ];
  310. },
  311. },
  312. ];
  313. });
  314. const getList = async (req, status) => {
  315. if (status) {
  316. sourceList.value.pagination = {
  317. pageNum: sourceList.value.pagination.pageNum,
  318. pageSize: sourceList.value.pagination.pageSize,
  319. };
  320. } else {
  321. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  322. }
  323. loading.value = true;
  324. proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
  325. sourceList.value.data = res.rows;
  326. sourceList.value.pagination.total = res.total;
  327. setTimeout(() => {
  328. loading.value = false;
  329. }, 200);
  330. });
  331. };
  332. getList();
  333. const clickReset = () => {
  334. getList("", true);
  335. };
  336. const clickAddOrder = () => {
  337. proxy.$router.replace({
  338. path: "/addOrder",
  339. query: {
  340. random: proxy.random(),
  341. },
  342. });
  343. };
  344. const clickCode = (row) => {
  345. proxy.$router.replace({
  346. path: "/addOrder",
  347. query: {
  348. detailId: row.id,
  349. text: "订单详情",
  350. random: proxy.random(),
  351. },
  352. });
  353. };
  354. const clickDelete = (row) => {
  355. ElMessageBox.confirm("你是否确认此操作", "提示", {
  356. confirmButtonText: "确定",
  357. cancelButtonText: "取消",
  358. type: "warning",
  359. })
  360. .then(() => {
  361. proxy.post("/orderInfo/delete", { id: row.id }).then(() => {
  362. ElMessage({ message: "删除成功", type: "success" });
  363. getList();
  364. });
  365. })
  366. .catch(() => {});
  367. };
  368. const clickUpdate = (row) => {
  369. proxy.$router.replace({
  370. path: "/addOrder",
  371. query: {
  372. id: row.id,
  373. text: "编辑订单",
  374. random: proxy.random(),
  375. },
  376. });
  377. };
  378. const clickUpload = (row) => {
  379. proxy.$router.replace({
  380. path: "/design-draft",
  381. query: {
  382. id: row.id,
  383. random: proxy.random(),
  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>