index.vue 9.8 KB

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