index.vue 13 KB

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