index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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: "deliveryTime",
  253. width: 160,
  254. align: "center",
  255. },
  256. },
  257. {
  258. attrs: {
  259. label: "发货时间",
  260. prop: "shippingTime",
  261. width: 160,
  262. align: "center",
  263. },
  264. },
  265. {
  266. attrs: {
  267. label: "收货人",
  268. prop: "consignee",
  269. width: 140,
  270. },
  271. },
  272. {
  273. attrs: {
  274. label: "收货人电话",
  275. prop: "consigneeNumber",
  276. width: 140,
  277. },
  278. },
  279. {
  280. attrs: {
  281. label: "收货人地址",
  282. slot: "address",
  283. width: 400,
  284. },
  285. },
  286. {
  287. attrs: {
  288. label: "操作",
  289. width: 160,
  290. align: "center",
  291. fixed: "right",
  292. },
  293. renderHTML(row) {
  294. return [
  295. row.status == 10 && ![14].includes(row.wlnStatus)
  296. ? {
  297. attrs: {
  298. label: "上传设计稿",
  299. type: "primary",
  300. text: true,
  301. },
  302. el: "button",
  303. click() {
  304. clickUpload(row);
  305. },
  306. }
  307. : {},
  308. row.status == 0
  309. ? {
  310. attrs: {
  311. label: "编辑",
  312. type: "primary",
  313. text: true,
  314. },
  315. el: "button",
  316. click() {
  317. clickUpdate(row);
  318. },
  319. }
  320. : {},
  321. row.status == 10
  322. ? {
  323. attrs: {
  324. label: "删除",
  325. type: "danger",
  326. text: true,
  327. },
  328. el: "button",
  329. click() {
  330. clickDelete(row);
  331. },
  332. }
  333. : {},
  334. row.status == 30
  335. ? {
  336. attrs: {
  337. label: "申请订单取消",
  338. type: "danger",
  339. text: true,
  340. },
  341. el: "button",
  342. click() {
  343. clickApplyForCancellation(row);
  344. },
  345. }
  346. : {},
  347. ];
  348. },
  349. },
  350. ];
  351. });
  352. const getList = async (req, status) => {
  353. if (status) {
  354. sourceList.value.pagination = {
  355. pageNum: sourceList.value.pagination.pageNum,
  356. pageSize: sourceList.value.pagination.pageSize,
  357. departmentId: proxy.useUserStore().user.deptId === "100" ? "" : proxy.useUserStore().user.deptId,
  358. exception: "0",
  359. };
  360. } else {
  361. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  362. }
  363. loading.value = true;
  364. proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
  365. sourceList.value.data = res.rows;
  366. sourceList.value.pagination.total = res.total;
  367. setTimeout(() => {
  368. loading.value = false;
  369. }, 200);
  370. });
  371. };
  372. getList();
  373. const clickReset = () => {
  374. getList("", true);
  375. };
  376. const clickAddOrder = () => {
  377. proxy.$router.replace({
  378. path: "/addOrder",
  379. query: {
  380. random: proxy.random(),
  381. },
  382. });
  383. };
  384. const clickCode = (row) => {
  385. proxy.$router.replace({
  386. path: "/addOrder",
  387. query: {
  388. detailId: row.id,
  389. text: "订单详情",
  390. random: proxy.random(),
  391. },
  392. });
  393. };
  394. const clickDelete = (row) => {
  395. ElMessageBox.confirm("你是否确认此操作", "提示", {
  396. confirmButtonText: "确定",
  397. cancelButtonText: "取消",
  398. type: "warning",
  399. })
  400. .then(() => {
  401. proxy.post("/orderInfo/delete", { id: row.id }).then(() => {
  402. ElMessage({ message: "删除成功", type: "success" });
  403. getList();
  404. });
  405. })
  406. .catch(() => {});
  407. };
  408. const clickUpdate = (row) => {
  409. proxy.$router.replace({
  410. path: "/addOrder",
  411. query: {
  412. id: row.id,
  413. text: "编辑订单",
  414. random: proxy.random(),
  415. },
  416. });
  417. };
  418. const clickUpload = (row) => {
  419. proxy.$router.replace({
  420. path: "/design-draft",
  421. query: {
  422. id: row.id,
  423. random: proxy.random(),
  424. },
  425. });
  426. };
  427. watch(refreshStore().refresh, (val) => {
  428. if (val.order) {
  429. getList();
  430. }
  431. });
  432. const judgeRoles = () => {
  433. let status = false;
  434. if (proxy.useUserStore().user.roles && proxy.useUserStore().user.roles.length > 0) {
  435. let list = proxy.useUserStore().user.roles.filter((item) => ["purchasingOfficer", "sypurchasing", "bzpurchasing"].includes(item.roleKey));
  436. if (list && list.length > 0) {
  437. status = true;
  438. }
  439. }
  440. return status;
  441. };
  442. const openApplyForCancellation = ref(false);
  443. const formData = reactive({
  444. data: {
  445. flowKey: "order_delete",
  446. remark: "",
  447. handleUserId: "",
  448. data: {
  449. id: "",
  450. },
  451. },
  452. });
  453. const rules = ref({
  454. remark: [{ required: true, message: "请输入订单删除原因", trigger: "blur" }],
  455. handleUserId: [{ required: true, message: "请选择处理人", trigger: "change" }],
  456. });
  457. const clickApplyForCancellation = (row) => {
  458. formData.data.remark = "";
  459. formData.data.handleUserId = "";
  460. formData.data.data.id = row.id;
  461. openApplyForCancellation.value = true;
  462. };
  463. const userList = ref([]);
  464. const openSelectUser = ref(false);
  465. const clickSubmit = () => {
  466. proxy.$refs.submit.validate((valid) => {
  467. if (valid) {
  468. proxy.post("/flowProcess/initiate", formData.data).then((res) => {
  469. if (res !== null && res.success) {
  470. ElMessage({ message: "提交成功", type: "success" });
  471. openApplyForCancellation.value = false;
  472. } else {
  473. userList.value = res.userList;
  474. openSelectUser.value = true;
  475. }
  476. });
  477. }
  478. });
  479. };
  480. const clickSubmitUser = () => {
  481. proxy.$refs.submitUser.validate((valid) => {
  482. if (valid) {
  483. proxy.post("/flowProcess/initiate", formData.data).then((res) => {
  484. if (res !== null && res.success) {
  485. ElMessage({ message: "提交成功", type: "success" });
  486. openApplyForCancellation.value = false;
  487. openSelectUser.value = false;
  488. } else {
  489. ElMessage("流程提交失败");
  490. }
  491. });
  492. }
  493. });
  494. };
  495. </script>
  496. <style lang="scss" scoped>
  497. :deep(.el-dialog) {
  498. margin-top: 10px !important;
  499. margin-bottom: 10px !important;
  500. }
  501. </style>