channelTicket.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <el-dialog title="选择门店" :visible.sync="channelShow" min-width="800px" :before-close="close">
  3. <el-form :model="queryParams" ref="queryForm" label-width="80px" size="small">
  4. <el-row :gutter="10">
  5. <el-col :span="7">
  6. <el-form-item label="上级渠道" prop="parentId">
  7. <el-select
  8. v-model="queryParams.parentId"
  9. placeholder="请选择上级渠道"
  10. style="width: 100%;"
  11. filterable
  12. clearable
  13. :filter-method="dataFilter"
  14. @change="handleQuery"
  15. >
  16. <el-option
  17. v-for="(item, index) in channelList"
  18. :key="item.channelId"
  19. :label="item.name"
  20. :value="item.channelId">
  21. <div>
  22. <span style="float: left;">{{item.name}} </span>
  23. <span style="float: right;">{{item.mobile}}</span>
  24. </div>
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="7">
  30. <el-form-item label="门店名称">
  31. <el-input
  32. v-model="queryParams.name"
  33. placeholder="请输入门店名称"
  34. clearable
  35. @change="handleQuery"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="7">
  40. <el-form-item label="手机号码">
  41. <el-input
  42. v-model="queryParams.mobile"
  43. placeholder="请输入手机号码"
  44. clearable
  45. @change="handleQuery"
  46. />
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="3">
  50. <el-form-item label-width="0">
  51. <el-button type="primary" icon="el-icon-search" @click="handleQuery" >搜索</el-button>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </el-form>
  56. <el-table v-loading="loading" :data="tableData" row-key="channelId" @selection-change="handleSelectionChange">
  57. <el-table-column type="selection" width="55" :reserve-selection="true" />
  58. <el-table-column label="门店编号" prop="channelId" min-width="90" />
  59. <el-table-column label="门店名称" prop="name" />
  60. <el-table-column label="手机号码" prop="mobile" />
  61. <el-table-column label="上级渠道" prop="parentsName"/>
  62. <el-table-column label="认证状态" prop="status">
  63. <template slot-scope="{row}">
  64. <el-tag :type="row.certifyStatus && JSON.parse(row.certifyStatus).value === 'y' ? 'success' : 'info'">{{ row.certifyStatus && JSON.parse(row.certifyStatus).desc }}</el-tag>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
  69. <span slot="footer">
  70. <el-button type="info" plain @click="close">取消</el-button>
  71. <el-button type="primary" @click="update">确定</el-button>
  72. </span>
  73. </el-dialog>
  74. </template>
  75. <script>
  76. import { listSaleSite } from "@/api/admin/salesite";
  77. import { publicFileGetUrl } from "@/api/common"
  78. import { listAllChannel} from "@/api/admin/channel"
  79. export default {
  80. name: "ChannelTicket",
  81. props: {
  82. value: {
  83. type: Array,
  84. default: []
  85. },
  86. channelShow: {
  87. type: Boolean,
  88. default: false,
  89. },
  90. excludeChannelIds:{
  91. type: Array,
  92. default: []
  93. },
  94. },
  95. data() {
  96. return {
  97. IMG_URL: publicFileGetUrl,
  98. loading: false,
  99. tableData: [],
  100. queryParams: {},
  101. total: 0,
  102. selection: [],
  103. // 上级渠道列表
  104. channelList:[],
  105. }
  106. },
  107. created() {
  108. this.getChannelList()
  109. this.listSaleSite();
  110. },
  111. methods: {
  112. /** 搜索按钮操作 */
  113. handleQuery() {
  114. this.channelList = this.channelCopyList;
  115. this.queryParams.pageNum = 1;
  116. this.getList();
  117. },
  118. listSaleSite() {
  119. this.getList(true)
  120. this.selection = this.value
  121. // this.$refs.table.toggleRowSelection(this.selection)
  122. },
  123. getList(reset) {
  124. if (this.loading) {
  125. return
  126. }
  127. this.loading = true
  128. if (reset) {
  129. this.queryParams = { pageNum: 1, pageSize: 10 }
  130. }
  131. if(this.excludeChannelIds){
  132. this.queryParams.excludeChannelIds = this.excludeChannelIds
  133. }
  134. listSaleSite('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
  135. this.loading = false
  136. if (res.code === 0) {
  137. this.tableData = res.rows
  138. this.total = res.total
  139. }
  140. }).catch(() => {
  141. this.loading = false
  142. })
  143. },
  144. handleSelectionChange(val) {
  145. this.selection = val
  146. },
  147. update() {
  148. this.$emit('channelTicket', this.selection);
  149. this.close()
  150. },
  151. close() {
  152. this.$emit("close");
  153. },
  154. dataFilter(val) {
  155. if (val) { //val存在
  156. this.channelList = this.channelCopyList.filter((item) => {
  157. if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())
  158. || !!~item.name.indexOf(val) || !!~item.name.indexOf(val)) {
  159. return true
  160. }
  161. })
  162. } else { //val为空时,还原数组
  163. this.channelList = this.channelCopyList;
  164. }
  165. },
  166. // 获取上级渠道下拉列表
  167. getChannelList(){
  168. listAllChannel().then(response => {
  169. this.channelList = response.data || [];
  170. this.channelCopyList = response.data || [];
  171. });
  172. },
  173. }
  174. }
  175. </script>