shop-select.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="product-select">
  3. <el-form :inline="true" :model="formData" class="demo-form-inline">
  4. <el-form-item label="">
  5. <el-input v-model="formData.keyword" maxlength="20" placeholder="店铺名称"></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" @click="onSubmit">查询</el-button>
  9. </el-form-item>
  10. </el-form>
  11. <el-table
  12. :data="tableData"
  13. max-height="500"
  14. border
  15. style="width: 100%">
  16. <el-table-column label="" width="35" align="center">
  17. <template slot-scope="scope">
  18. <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
  19. </template>
  20. </el-table-column>
  21. <el-table-column
  22. prop="shopName"
  23. label="店铺名称">
  24. </el-table-column>
  25. <el-table-column
  26. prop="phone"
  27. label="手机号">
  28. </el-table-column>
  29. </el-table>
  30. <el-pagination
  31. @size-change="handleSizeChange"
  32. @current-change="handleCurrentChange"
  33. :current-page="currentPage"
  34. :page-sizes="[10, 20, 50, 100]"
  35. :page-size="pageSize"
  36. layout="total, sizes, prev, pager, next, jumper"
  37. :total="total">
  38. </el-pagination>
  39. </div>
  40. </template>
  41. <script>
  42. import api from '@@/components/canvasShow/config/api'
  43. import {sendReqMixin} from '@@/components/canvasShow/config/mixin'
  44. export default {
  45. name: 'shop-select',
  46. mixins: [sendReqMixin],
  47. data () {
  48. return {
  49. tableRadio: '',
  50. currentPage: 1,
  51. total: 0,
  52. pageSize: 10,
  53. formData: {
  54. keyword: ''
  55. },
  56. tableData: []
  57. }
  58. },
  59. mounted () {
  60. this.getTableData()
  61. },
  62. methods: {
  63. // 获取店辅信息
  64. getTableData () {
  65. var _this = this
  66. var paramsUrl = `${api.getShops}?page=${this.currentPage}&pageSize=${this.pageSize}`
  67. if (this.formData.keyword) {
  68. paramsUrl += `&search=${this.formData.keyword}`
  69. }
  70. let params = {
  71. url: paramsUrl,
  72. method: 'GET'
  73. }
  74. this.sendReq(params, (res) => {
  75. _this.tableData = res.data.list
  76. _this.total = res.data.total
  77. })
  78. },
  79. // 搜索
  80. onSubmit () {
  81. this.getTableData()
  82. },
  83. // 每页条数改变
  84. handleSizeChange (val) {
  85. this.pageSize = val
  86. this.getTableData()
  87. },
  88. // 当前页改变
  89. handleCurrentChange (val) {
  90. this.currentPage = val
  91. this.getTableData()
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .product-select{
  98. .el-pagination{
  99. padding: 0px;
  100. margin-top: 30px;
  101. }
  102. }
  103. </style>