index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="halfSon">
  3. <!-- 搜索 -->
  4. <div class="formSearch">
  5. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  6. <el-form-item label="订单id">
  7. <el-input maxlength="20" v-model="formInline.orderId" placeholder="请输入" />
  8. </el-form-item>
  9. <el-form-item>
  10. <el-button type="primary" plain @click="searchOrder">查询</el-button>
  11. <el-button type="info" plain @click="resetData">重置</el-button>
  12. </el-form-item>
  13. </el-form>
  14. </div>
  15. <!-- 表格 -->
  16. <div class="tableBox">
  17. <el-table ref="multipleTable" v-loading="tableLoading" :data="tableData" border stripe :header-cell-style="{ background: '#EEF3FF', color: '#333333' }"
  18. tooltip-effect="dark" style="width: 100%">
  19. <el-table-column prop="orderId" label="订单id" width="150">
  20. </el-table-column>
  21. <el-table-column label="消息状态" width="250">
  22. <template slot-scope="scope">
  23. <span v-if="scope.row.code == -1">下单中</span>
  24. <span v-if="scope.row.code == 1">下单成功</span>
  25. <span v-if="scope.row.code == 2">已退款</span>
  26. <span v-if="scope.row.code == -2">退款中</span>
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="msg" label="消息" width="250">
  30. </el-table-column>
  31. <el-table-column prop="systemErro" label="系统错误" width="250">
  32. </el-table-column>
  33. <el-table-column prop="createTime" label="订单创建时间" width="=300">
  34. </el-table-column>
  35. <el-table-column prop="updateTime" label="订单更新时间" width="300">
  36. </el-table-column>
  37. </el-table>
  38. <div class="fenye">
  39. <el-pagination :current-page="formInline.page" :page-sizes="[10, 20, 50, 100]" :page-size="10"
  40. layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
  41. @current-change="handleCurrentChange" />
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import { halfOrder } from "@/api/order"
  48. export default {
  49. data() {
  50. return {
  51. tableData: [],
  52. formInline:{
  53. orderId:"",
  54. page:1,
  55. pageSize:10
  56. },
  57. total:0,
  58. tableLoading:false
  59. }
  60. },
  61. created(){
  62. this.getHalfOrder()
  63. },
  64. methods: {
  65. // 请求数据的函数
  66. async getHalfOrder(){
  67. // 开始加载状态
  68. this.tableLoading = true
  69. let res = await halfOrder(this.formInline);
  70. const { data } = res
  71. this.tableData = data.records
  72. this.total = data.records.length
  73. this.tableLoading = false
  74. },
  75. // 条数的改变事件
  76. handleSizeChange(val){
  77. this.formInline.pageSize = val
  78. this.getHalfOrder()
  79. },
  80. // 分页的点击事件
  81. handleCurrentChange(val){
  82. this.formInline.page = val
  83. this.getHalfOrder()
  84. },
  85. // 查询订单
  86. searchOrder(){
  87. this.getHalfOrder()
  88. },
  89. // 重置订单
  90. resetData(){
  91. this.formInline.orderId = ""
  92. this.getHalfOrder()
  93. }
  94. },
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .halfSon {
  99. padding: 30px 0 0 30px;
  100. .formSearch {
  101. margin-bottom: 30px;
  102. }
  103. .fenye{
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. margin: 50px 0;
  108. }
  109. }
  110. ::v-deep .el-table__cell{
  111. text-align: center;
  112. }
  113. </style>