index.vue 7.5 KB

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