您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OrderList.vue 3.8 KiB

2 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="boxMain">
  3. <inc-search :listInput="listInput" :loadSoBn="tableLoad" :onSearch="filterSearch" :orderType="orderType"></inc-search>
  4. <a-table class="tablesa" :columns="tableColumns" :data-source="tableData" :rowKey="lists => lists.id" :pagination="pagination" :loading="tableLoad" @change="filterSearch">
  5. <router-link slot="orderNo" slot-scope="text,record" :to="'detail?id='+record.orderId"><a-icon type="file-text" /> {{text}}</router-link>
  6. <span class="amount" slot="amount" slot-scope="text,record">金额:<span>${{ text }}</span><br>已付:<span>${{record.paidAmount||0}}</span></span>
  7. <span slot="creationTime" slot-scope="text">{{formatDateTime(text)}}</span>
  8. <div class="files" slot="files" slot-scope="text">
  9. <ul>
  10. <li v-for="(file,fid) in text" :key="fid"><a :href="file.url" :title="file.name" target="_blank"><a-icon type="link" /> {{file.name}}</a></li>
  11. </ul>
  12. </div>
  13. </a-table>
  14. </div>
  15. </template>
  16. <script>
  17. import IncSearch from "@/pages/Common/search";
  18. import {formatDate, resOrderStatus, resProTypes} from "@/services/Common";
  19. import {OrderList} from "@/services/order/Order";
  20. export default {
  21. name: 'OrderList',
  22. components: {IncSearch},
  23. data(){
  24. return{
  25. orderType:[],
  26. listInput:[
  27. {type:'input',name:'OrderNo',title:'订单编号',value:''},
  28. {type:'select',name:'orderStatus',title:'订单状态',value:'', width:'120px',
  29. option:resOrderStatus(),
  30. },
  31. ],
  32. pagination: {
  33. pageSize: 10,
  34. current: 1,
  35. showQuickJumper: true,
  36. showTotal: (total) => `总计 ${total} 条`,
  37. },
  38. tableLoad: false,
  39. tableColumns:[
  40. {title: '订单编号',dataIndex: 'orderNo',key: 'orderNo',width:'260px',scopedSlots: { customRender: 'orderNo' },},
  41. {title: '状态',dataIndex: 'orderStatusValue',key: 'orderStatusValue',width:'100px'},
  42. {title: '创建时间',dataIndex: 'creationTime',key: 'creationTime',width:'160px',scopedSlots: { customRender: 'creationTime' },},
  43. {title: '下单时间',dataIndex: 'orderTime',key: 'orderTime',width:'160px'},
  44. {title: '时效',dataIndex: 'deliveryTime',key: 'deliveryTime',width:'120px'},
  45. {title: '数量',dataIndex: 'qty',key: 'qty',width:'80px'},
  46. {title: '文件',dataIndex: 'files',key: 'files',width:'300px',scopedSlots: { customRender: 'files' },},
  47. {title: '金额',dataIndex: 'amount',key: 'amount',scopedSlots: { customRender: 'amount' }},
  48. ],
  49. tableData:[],
  50. }
  51. },
  52. mounted() {
  53. var reg = /\/order\/((\w|-|\s)+)\//ig;
  54. let routePath = this.$route.path.replace(reg, function() {
  55. return arguments[1];
  56. });
  57. this.orderType = resProTypes(routePath);
  58. this.filterSearch()
  59. },
  60. methods:{
  61. getOrderStatus(key){
  62. return resOrderStatus(key);
  63. },
  64. filterSearch(page){
  65. // console.log(page)
  66. // console.log(this.listInput)
  67. if(typeof(page)=='object'){
  68. this.pagination.current = page.current;
  69. }
  70. let count = (this.pagination.current-1)*this.pagination.pageSize;
  71. let params={
  72. orderType:this.orderType.proType,
  73. orderNo:this.listInput[0].value,
  74. orderStatus:this.listInput[1].value,
  75. // sorting:this.listInput[2].value,
  76. skipCount:count,
  77. maxResultCount:this.pagination.pageSize,
  78. }
  79. // console.log(params)
  80. this.fetch(params);
  81. },
  82. fetch(params = {}) {
  83. this.tableLoad = true;
  84. OrderList(params).then(data=>{
  85. const pagination = { ...this.pagination};
  86. pagination.total = data.totalCount;
  87. this.tableLoad = false;
  88. this.tableData = data.items;
  89. this.pagination = pagination;
  90. }).catch(err=>{
  91. this.tableLoad = false;
  92. })
  93. },
  94. formatDateTime(time){
  95. return formatDate(time,'yyyy-MM-dd hh:mm');
  96. },
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. </style>