index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <template>
  2. <div>
  3. <el-card :class="props.selectStatus ? 'select-card' : '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. props.selectStatus
  13. ? {}
  14. : {
  15. text: '操作日志',
  16. action: () => viewLogs(),
  17. },
  18. props.selectStatus
  19. ? {}
  20. : {
  21. text: '复制E10单号',
  22. action: () => clickCopyWLNCode(),
  23. },
  24. props.selectStatus
  25. ? {}
  26. : {
  27. text: '同步订单',
  28. action: () => clickSynchronousOrder(),
  29. loading: btnLoading,
  30. },
  31. ]"
  32. @get-list="getList"
  33. @clickReset="clickReset">
  34. <template #code="{ item }">
  35. <div>
  36. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  37. </div>
  38. </template>
  39. <template #totalAmount="{ item }">
  40. <div style="color: #409eff">{{ moneyFormat(item.totalAmount) }}</div>
  41. </template>
  42. <template #address="{ item }">
  43. <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
  44. </template>
  45. </byTable>
  46. </el-card>
  47. <el-dialog title="操作日志" v-if="openLogs" v-model="openLogs" width="50%">
  48. <byTable
  49. :source="logsList.data"
  50. :pagination="logsList.pagination"
  51. :config="configLogs"
  52. :loading="loadingLogs"
  53. highlight-current-row
  54. @get-list="getLogsList">
  55. </byTable>
  56. <template #footer>
  57. <el-button @click="openLogs = false" size="large">关 闭</el-button>
  58. </template>
  59. </el-dialog>
  60. <el-dialog title="修改税率" v-if="openChangeTaxRate" v-model="openChangeTaxRate" width="500" style="margin-top: 20vh !important">
  61. <el-form :model="details.data" label-width="120px" ref="taxRate">
  62. <el-form-item label="税率" prop="taxRate" :rules="[{ required: true, message: '请输入税率', trigger: 'blur' }]">
  63. <el-input-number
  64. onmousewheel="return false;"
  65. v-model="details.data.taxRate"
  66. placeholder="请输入税率"
  67. style="width: 100%"
  68. :controls="false"
  69. :min="0"
  70. :precision="2"
  71. :max="100" />
  72. </el-form-item>
  73. </el-form>
  74. <template #footer>
  75. <el-button @click="openChangeTaxRate = false" size="large">取 消</el-button>
  76. <el-button type="primary" @click="submitChangeTaxRate()" size="large" v-preReClick>确 定</el-button>
  77. </template>
  78. </el-dialog>
  79. <el-dialog title="售后类型" v-if="openAfterSale" v-model="openAfterSale" width="300px" style="margin-top: 20vh !important">
  80. <template #footer>
  81. <el-button type="primary" @click="applyForAfterSale(1)" size="large" v-preReClick>退 货</el-button>
  82. <el-button @click="applyForAfterSale(2)" size="large" v-preReClick>换 货</el-button>
  83. </template>
  84. </el-dialog>
  85. <el-dialog title="送货单" v-if="openDeliveryNote" v-model="openDeliveryNote" width="1000px">
  86. <DeliveryNote :rowData="rowData" @clickCancel="clickCancel"></DeliveryNote>
  87. </el-dialog>
  88. </div>
  89. </template>
  90. <script setup>
  91. import byTable from "/src/components/byTable/index";
  92. import { ElMessage, ElMessageBox } from "element-plus";
  93. import { copyText } from "vue3-clipboard";
  94. import DeliveryNote from "/src/components/order/deliveryNote/index";
  95. const { proxy } = getCurrentInstance();
  96. const props = defineProps({
  97. selectStatus: Boolean,
  98. departmentId: String,
  99. });
  100. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  101. const sourceList = ref({
  102. data: [],
  103. pagination: {
  104. total: 0,
  105. pageNum: 1,
  106. pageSize: 10,
  107. departmentId: "",
  108. code: "",
  109. wlnCode: "",
  110. status: "",
  111. settlementStatus: "",
  112. exception: "0",
  113. },
  114. });
  115. const loading = ref(false);
  116. const searchConfig = computed(() => {
  117. return [
  118. {
  119. type: "input",
  120. prop: "code",
  121. label: "订单号",
  122. },
  123. {
  124. type: "input",
  125. prop: "wlnCode",
  126. label: "E10单号",
  127. },
  128. props.departmentId
  129. ? {}
  130. : {
  131. type: "select",
  132. prop: "departmentId",
  133. data: departmentList.value,
  134. label: "事业部",
  135. },
  136. props.departmentId
  137. ? {}
  138. : {
  139. type: "select",
  140. prop: "status",
  141. dictKey: "order_status",
  142. label: "订单状态",
  143. },
  144. {
  145. type: "select",
  146. prop: "settlementStatus",
  147. label: "结算状态",
  148. data: proxy.useUserStore().allDict["settlement_status"],
  149. },
  150. ];
  151. });
  152. const config = computed(() => {
  153. return [
  154. {
  155. attrs: {
  156. label: "事业部",
  157. prop: "departmentName",
  158. width: 120,
  159. },
  160. },
  161. {
  162. attrs: {
  163. label: "订单号",
  164. slot: "code",
  165. width: 200,
  166. },
  167. },
  168. {
  169. attrs: {
  170. label: "E10单号",
  171. prop: "wlnCode",
  172. width: 160,
  173. },
  174. },
  175. {
  176. attrs: {
  177. label: "快递单号",
  178. prop: "expressDeliveryCode",
  179. width: 140,
  180. },
  181. },
  182. {
  183. attrs: {
  184. label: "订单状态",
  185. prop: "status",
  186. width: 120,
  187. },
  188. render(val) {
  189. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
  190. },
  191. },
  192. {
  193. attrs: {
  194. label: "结算状态",
  195. prop: "settlementStatus",
  196. width: 120,
  197. },
  198. render(val) {
  199. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_status"]);
  200. },
  201. },
  202. {
  203. attrs: {
  204. label: "税率",
  205. prop: "taxRate",
  206. width: 80,
  207. },
  208. render(val) {
  209. return val + "%";
  210. },
  211. },
  212. {
  213. attrs: {
  214. label: "订单总金额 ¥",
  215. slot: "totalAmount",
  216. width: 120,
  217. align: "right",
  218. },
  219. },
  220. {
  221. attrs: {
  222. label: "产品总金额 ¥",
  223. prop: "productTotalAmount",
  224. width: 120,
  225. align: "right",
  226. },
  227. render(val) {
  228. return proxy.moneyFormat(val);
  229. },
  230. },
  231. {
  232. attrs: {
  233. label: "定制加工费 ¥",
  234. prop: "customProcessingFee",
  235. width: 120,
  236. align: "right",
  237. },
  238. render(val) {
  239. return proxy.moneyFormat(val);
  240. },
  241. },
  242. {
  243. attrs: {
  244. label: "代发费 ¥",
  245. prop: "lssueFee",
  246. width: 120,
  247. align: "right",
  248. },
  249. render(val) {
  250. return proxy.moneyFormat(val);
  251. },
  252. },
  253. {
  254. attrs: {
  255. label: "快递包材费 ¥",
  256. prop: "deliveryMaterialsFee",
  257. width: 120,
  258. align: "right",
  259. },
  260. render(val) {
  261. return proxy.moneyFormat(val);
  262. },
  263. },
  264. {
  265. attrs: {
  266. label: "包装人工费 ¥",
  267. prop: "packingLabor",
  268. width: 120,
  269. align: "right",
  270. },
  271. render(val) {
  272. return proxy.moneyFormat(val);
  273. },
  274. },
  275. {
  276. attrs: {
  277. label: "包材费 ¥",
  278. prop: "packagingMaterialCost",
  279. width: 120,
  280. align: "right",
  281. },
  282. render(val) {
  283. return proxy.moneyFormat(val);
  284. },
  285. },
  286. {
  287. attrs: {
  288. label: "管理费 ¥",
  289. prop: "managementFee",
  290. width: 120,
  291. align: "right",
  292. },
  293. render(val) {
  294. return proxy.moneyFormat(val);
  295. },
  296. },
  297. {
  298. attrs: {
  299. label: "交期",
  300. prop: "deliveryTime",
  301. width: 160,
  302. align: "center",
  303. },
  304. },
  305. {
  306. attrs: {
  307. label: "发货时间",
  308. prop: "shippingTime",
  309. width: 160,
  310. align: "center",
  311. },
  312. },
  313. {
  314. attrs: {
  315. label: "收货人",
  316. prop: "consignee",
  317. width: 140,
  318. },
  319. },
  320. {
  321. attrs: {
  322. label: "收货人电话",
  323. prop: "consigneeNumber",
  324. width: 140,
  325. },
  326. },
  327. {
  328. attrs: {
  329. label: "收货人地址",
  330. slot: "address",
  331. width: 400,
  332. },
  333. },
  334. {
  335. attrs: {
  336. label: "操作",
  337. width: 180,
  338. align: "center",
  339. fixed: "right",
  340. },
  341. renderHTML(row) {
  342. return [
  343. props.selectStatus
  344. ? {
  345. attrs: {
  346. label: "选择",
  347. type: "primary",
  348. text: true,
  349. },
  350. el: "button",
  351. click() {
  352. clickSelect(row);
  353. },
  354. }
  355. : [40, 50].includes(row.status)
  356. ? {
  357. attrs: {
  358. label: "售后",
  359. type: "primary",
  360. text: true,
  361. },
  362. el: "button",
  363. click() {
  364. clickAfterSale(row);
  365. },
  366. }
  367. : {},
  368. !props.selectStatus && row.type === 1 && row.status == 40
  369. ? {
  370. attrs: {
  371. label: "送货单",
  372. type: "primary",
  373. text: true,
  374. },
  375. el: "button",
  376. click() {
  377. clickDeliveryNote(row);
  378. },
  379. }
  380. : {},
  381. !props.selectStatus && row.status == 20
  382. ? {
  383. attrs: {
  384. label: "挂起",
  385. type: "primary",
  386. text: true,
  387. },
  388. el: "button",
  389. click() {
  390. clickHangUp(row);
  391. },
  392. }
  393. : {},
  394. !props.selectStatus && row.status == 60
  395. ? {
  396. attrs: {
  397. label: "取消挂起",
  398. type: "primary",
  399. text: true,
  400. },
  401. el: "button",
  402. click() {
  403. clickCancelHangUp(row);
  404. },
  405. }
  406. : {},
  407. !props.selectStatus && row.status && row.status != 0
  408. ? {
  409. attrs: {
  410. label: "税率",
  411. type: "primary",
  412. text: true,
  413. },
  414. el: "button",
  415. click() {
  416. clickChangeTaxRate(row);
  417. },
  418. }
  419. : {},
  420. !props.selectStatus && [0, 10, 20].includes(row.status) && proxy.useUserStore().user.userId === "1"
  421. ? {
  422. attrs: {
  423. label: "删除",
  424. type: "danger",
  425. text: true,
  426. },
  427. el: "button",
  428. click() {
  429. clickDelete(row);
  430. },
  431. }
  432. : {},
  433. !props.selectStatus && [30, 40].includes(row.status) && proxy.useUserStore().user.userId === "1"
  434. ? {
  435. attrs: {
  436. label: "删除",
  437. type: "danger",
  438. text: true,
  439. },
  440. el: "button",
  441. click() {
  442. clickDeleteTwo(row);
  443. },
  444. }
  445. : {},
  446. ];
  447. },
  448. },
  449. ];
  450. });
  451. const getDemandData = () => {
  452. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  453. if (res.rows && res.rows.length > 0) {
  454. departmentList.value = departmentList.value.concat(
  455. res.rows.map((item) => {
  456. return {
  457. dictKey: item.id,
  458. dictValue: item.name,
  459. };
  460. })
  461. );
  462. }
  463. });
  464. };
  465. getDemandData();
  466. const getList = async (req, status) => {
  467. if (status) {
  468. sourceList.value.pagination = {
  469. pageNum: sourceList.value.pagination.pageNum,
  470. pageSize: sourceList.value.pagination.pageSize,
  471. exception: "0",
  472. };
  473. } else {
  474. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  475. }
  476. if (props.selectStatus) {
  477. sourceList.value.pagination.linkedStatementOfAccount = 0;
  478. }
  479. if (props.departmentId) {
  480. sourceList.value.pagination.departmentId = props.departmentId;
  481. }
  482. loading.value = true;
  483. proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
  484. sourceList.value.data = res.rows;
  485. sourceList.value.pagination.total = res.total;
  486. setTimeout(() => {
  487. loading.value = false;
  488. }, 200);
  489. });
  490. };
  491. getList();
  492. const clickReset = () => {
  493. getList("", true);
  494. };
  495. const clickCode = (row) => {
  496. proxy.$router.replace({
  497. path: "/order-detail",
  498. query: {
  499. detailId: row.id,
  500. text: "订单详情",
  501. random: proxy.random(),
  502. },
  503. });
  504. };
  505. const clickDelete = (row) => {
  506. ElMessageBox.confirm("你是否确认此操作", "提示", {
  507. confirmButtonText: "确定",
  508. cancelButtonText: "取消",
  509. type: "warning",
  510. })
  511. .then(() => {
  512. proxy.post("/orderInfo/delete", { id: row.id }).then(() => {
  513. ElMessage({ message: "删除成功", type: "success" });
  514. getList();
  515. });
  516. })
  517. .catch(() => {});
  518. };
  519. const clickDeleteTwo = (row) => {
  520. ElMessageBox.confirm("你是否确认此操作", "提示", {
  521. confirmButtonText: "确定",
  522. cancelButtonText: "取消",
  523. type: "warning",
  524. })
  525. .then(() => {
  526. proxy.post("/orderInfo/deleteAndStore", { id: row.id }).then(() => {
  527. ElMessage({ message: "删除成功", type: "success" });
  528. getList();
  529. });
  530. })
  531. .catch(() => {});
  532. };
  533. const clickHangUp = (row) => {
  534. ElMessageBox.confirm("你是否确认此操作", "提示", {
  535. confirmButtonText: "确定",
  536. cancelButtonText: "取消",
  537. type: "warning",
  538. })
  539. .then(() => {
  540. proxy.post("/orderInfo/suspendOrder", { id: row.id }).then(() => {
  541. ElMessage({ message: "操作成功", type: "success" });
  542. getList();
  543. });
  544. })
  545. .catch(() => {});
  546. };
  547. const clickCancelHangUp = (row) => {
  548. ElMessageBox.confirm("你是否确认此操作", "提示", {
  549. confirmButtonText: "确定",
  550. cancelButtonText: "取消",
  551. type: "warning",
  552. })
  553. .then(() => {
  554. proxy.post("/orderInfo/cancelSuspendOrder", { id: row.id }).then(() => {
  555. ElMessage({ message: "操作成功", type: "success" });
  556. getList();
  557. });
  558. })
  559. .catch(() => {});
  560. };
  561. const openLogs = ref(false);
  562. const loadingLogs = ref(false);
  563. const logsList = ref({
  564. data: [],
  565. pagination: {
  566. total: 0,
  567. pageNum: 1,
  568. pageSize: 10,
  569. },
  570. });
  571. const type = ref([
  572. { dictKey: "10", dictValue: "新增订单" },
  573. { dictKey: "20", dictValue: "图稿上传" },
  574. { dictKey: "21", dictValue: "修改税率" },
  575. { dictKey: "30", dictValue: "删除订单" },
  576. ]);
  577. const configLogs = computed(() => {
  578. return [
  579. {
  580. attrs: {
  581. label: "操作时间",
  582. prop: "createTime",
  583. width: 160,
  584. align: "center",
  585. },
  586. },
  587. {
  588. attrs: {
  589. label: "操作人",
  590. prop: "userName",
  591. align: "center",
  592. },
  593. },
  594. {
  595. attrs: {
  596. label: "订单号",
  597. prop: "orderCode",
  598. align: "center",
  599. },
  600. },
  601. {
  602. attrs: {
  603. label: "行为",
  604. prop: "type",
  605. width: 100,
  606. align: "center",
  607. },
  608. render(val) {
  609. return proxy.dictKeyValue(val, type.value);
  610. },
  611. },
  612. ];
  613. });
  614. const viewLogs = () => {
  615. logsList.value.data = [];
  616. logsList.value.pagination.total = 0;
  617. openLogs.value = true;
  618. getLogsList({ pageNum: 1, pageSize: 10 });
  619. };
  620. const getLogsList = async (req) => {
  621. logsList.value.pagination = { ...logsList.value.pagination, ...req };
  622. loadingLogs.value = true;
  623. proxy.post("/orderOperatingLog/page", logsList.value.pagination).then((res) => {
  624. logsList.value.data = res.rows;
  625. logsList.value.pagination.total = res.total;
  626. setTimeout(() => {
  627. loadingLogs.value = false;
  628. }, 200);
  629. });
  630. };
  631. const details = reactive({
  632. data: {},
  633. });
  634. const openChangeTaxRate = ref(false);
  635. const clickChangeTaxRate = (item) => {
  636. proxy.post("/orderInfo/detail", { id: item.id }).then((res) => {
  637. details.data = res;
  638. openChangeTaxRate.value = true;
  639. });
  640. };
  641. const submitChangeTaxRate = () => {
  642. proxy.$refs.taxRate.validate((valid) => {
  643. if (valid) {
  644. details.data.updateType = "21";
  645. proxy.post("/orderInfo/edit", details.data).then(() => {
  646. ElMessage({ message: "修改完成", type: "success" });
  647. openChangeTaxRate.value = false;
  648. getList();
  649. });
  650. }
  651. });
  652. };
  653. const emit = defineEmits(["selectOrder"]);
  654. const clickSelect = (item) => {
  655. emit("selectOrder", item);
  656. };
  657. const clickCopyWLNCode = () => {
  658. ElMessage("复制数据中,请稍后");
  659. proxy.post("/orderInfo/getOrderWlnCodeStr", sourceList.value.pagination).then((res) => {
  660. copyText(res, undefined, (error) => {
  661. if (error) {
  662. ElMessage.error(`复制失败: ${error} !`);
  663. } else {
  664. ElMessage.success(`复制成功!`);
  665. }
  666. });
  667. });
  668. };
  669. const btnLoading = ref(false);
  670. const clickSynchronousOrder = () => {
  671. btnLoading.value = true;
  672. proxy.post("/orderHandle/bathSyncOrder", {}).then(
  673. () => {
  674. ElMessage.success("同步完成成功");
  675. btnLoading.value = false;
  676. getList();
  677. },
  678. (err) => {
  679. ElMessage.error(`同步失败: ${err} !`);
  680. btnLoading.value = false;
  681. }
  682. );
  683. };
  684. const openAfterSale = ref(false);
  685. const rowData = ref({});
  686. const clickAfterSale = (row) => {
  687. rowData.value = row;
  688. openAfterSale.value = true;
  689. };
  690. const applyForAfterSale = (type) => {
  691. openAfterSale.value = false;
  692. proxy.$router.replace({
  693. path: "/order/after-sale/initiate",
  694. query: {
  695. orderInfoId: rowData.value.id,
  696. type: type,
  697. random: proxy.random(),
  698. },
  699. });
  700. };
  701. const openDeliveryNote = ref(false);
  702. const clickDeliveryNote = (row) => {
  703. rowData.value = row;
  704. openDeliveryNote.value = true;
  705. };
  706. const clickCancel = (status) => {
  707. openDeliveryNote.value = false;
  708. if (status) {
  709. getList();
  710. }
  711. };
  712. </script>
  713. <style lang="scss" scoped>
  714. ::v-deep(.el-input-number .el-input__inner) {
  715. text-align: left;
  716. }
  717. :deep(.el-dialog) {
  718. margin-top: 10px !important;
  719. margin-bottom: 10px !important;
  720. }
  721. .select-card {
  722. height: calc(100vh - 184px);
  723. overflow-y: auto;
  724. overflow-x: hidden;
  725. }
  726. </style>