index.vue 13 KB

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