com-dialog-store-user.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. /**
  3. * @link:http://www.gdqijianshi.com/
  4. * @copyright: Copyright (c) 2020 广东七件事集团
  5. * Created by PhpStorm
  6. * Author: ganxiaohao
  7. * Date: 2020-04-24
  8. * Time: 19:33
  9. */
  10. ?>
  11. <style>
  12. .com-dialog-dialog {
  13. min-width: 700px;
  14. }
  15. .search-form {
  16. display: flex;
  17. }
  18. .search-form-input {
  19. width: 180px;
  20. margin-right: 30px;
  21. }
  22. </style>
  23. <template id="com-dialog-store-user">
  24. <div class="com-dialog-store-user">
  25. <el-dialog append-to-body :title="title" :visible.sync="visible" :close-on-click-modal="false"
  26. custom-class="com-dialog-dialog" :before-close="close" @close="close">
  27. <div>
  28. <el-form class="search-form" label-width="100px">
  29. <el-input size="small" class="search-form-input" v-model="user_id" placeholder="请输入用户ID"></el-input>
  30. <el-input size="small" class="search-form-input" v-model="keyword" placeholder="请输入用户昵称/手机号"></el-input>
  31. <el-button type="primary" size="small" @click="getDetail(1)">查 询</el-button>
  32. </el-form>
  33. <el-table border v-loading="listLoading" :data="list" style="margin-top: 24px;"
  34. @selection-change="handleSelectionChange">
  35. <el-table-column type="selection" width="60px" label="ID" props="id" align="center" v-if="multiple">
  36. </el-table-column>
  37. <el-table-column width="60px" label="ID" props="id" align="center" v-else>
  38. <template slot-scope="props">
  39. <el-radio-group v-model="radioSelection" @change="handleSelectionChange(props.row)">
  40. <el-radio></el-radio>
  41. </el-radio-group>
  42. </template>
  43. </el-table-column>
  44. <el-table-column width="90" label="ID" prop="id" align="center"></el-table-column>
  45. <el-table-column label="名称" align="center">
  46. <template slot-scope="props">
  47. <div style="display: flex;">
  48. <com-image class="head-pic" mode="aspectFill" :src="props.row.avatar_url? props.row.avatar_url:'/resources/img/common/default-avatar.png'"></com-image>
  49. <div>
  50. <com-ellipsis :line="2">{{props.row.nickname}}</com-ellipsis>
  51. <com-ellipsis :line="2">{{props.row.mobile}}</com-ellipsis>
  52. </div>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column width="110" label="等级" prop="level_name" align="center"></el-table-column>
  57. </el-table>
  58. </div>
  59. <div style="margin-top: 24px;">
  60. <el-row>
  61. <el-pagination
  62. v-if="pagination"
  63. style="display: inline-block;"
  64. background
  65. :page-size="pagination.pageSize"
  66. @current-change="getDetail"
  67. layout="prev, pager, next"
  68. :total="pagination.total_count">
  69. </el-pagination>
  70. <el-button type="primary" size="small" style="float: right" @click="confirm">选择</el-button>
  71. </el-row>
  72. </div>
  73. </el-dialog>
  74. <div @click="click" style="display: inline-block">
  75. <slot></slot>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. Vue.component('com-dialog-store-user', {
  81. template: '#com-dialog-store-user',
  82. props: {
  83. /* visible : {
  84. type: String,
  85. }, */
  86. url: {
  87. type: String,
  88. default: 'store/store/select-store-user'
  89. },
  90. multiple: Boolean,//是否开启选
  91. title: {
  92. type: String,
  93. default: '门店选择'
  94. },
  95. listKey: { //键值
  96. type: String,
  97. default: 'goods_name'
  98. },
  99. params: Object,
  100. display: Boolean,
  101. extraSearch: Object,
  102. },
  103. data() {
  104. return {
  105. visible: false,
  106. listLoading: false,
  107. list: [],
  108. total_count:1,
  109. pageSize:20,
  110. pagination: null,
  111. radioSelection: 0,
  112. keyword: null,
  113. user_id:'',
  114. multipleSelection: []
  115. }
  116. },
  117. methods: {
  118. close(){
  119. this.visible=false;
  120. this.$emit('close');
  121. },
  122. click() {
  123. this.getDetail(1);
  124. this.visible = !this.visible;
  125. },
  126. getDetail(page) {
  127. this.list = [];
  128. this.listLoading = true;
  129. let params = Object.assign({
  130. r: this.url,
  131. keyword: this.keyword,
  132. user_id:this.user_id,
  133. page: page
  134. }, this.params);
  135. console.log(params);
  136. request({
  137. params: params
  138. }).then(e => {
  139. this.listLoading = false;
  140. //console.log("门店的数据=="+JSON.stringify(e))
  141. if (e.data.code === 0) {
  142. this.list = e.data.data.list;
  143. this.pagination = e.data.data.pagination;
  144. this.pagination.pageSize = e.data.data.page_size;
  145. this.pagination.total_count = this.pagination.totalCount;
  146. } else {
  147. this.$message.error(e.data.msg);
  148. }
  149. }).catch(e => {
  150. this.listLoading = false;
  151. });
  152. },
  153. handleSelectionChange(val) {
  154. this.multipleSelection = val;
  155. },
  156. confirm() {
  157. console.log(this.multipleSelection);
  158. this.visible = false;
  159. this.$emit('selected', this.multipleSelection);
  160. this.$emit('input', this.multipleSelection);
  161. }
  162. }
  163. });
  164. </script>