index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div class="screen-container" v-if="!!~[2].indexOf(userType)">
  5. <div class="top clearfix">
  6. <div class="title fl">条件筛选</div>
  7. </div>
  8. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
  9. <el-row :gutter="20">
  10. <el-col :xs="24" :sm="12" :lg="6">
  11. <el-form-item label="商户账号" prop="account">
  12. <el-input v-model="screenForm.account" placeholder="请输入商户账号"></el-input>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="商户昵称" prop="nickname">
  17. <el-input v-model="screenForm.nickname" placeholder="请输入商户昵称"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :lg="6">
  21. <el-form-item label="联系电话" prop="phone">
  22. <el-input v-model="screenForm.phone" placeholder="请输入联系电话"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :sm="12" :lg="6">
  26. <el-form-item label="电子邮箱" prop="email">
  27. <el-input v-model="screenForm.email" placeholder="请输入电子邮箱"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="12" :lg="6">
  31. <el-form-item label="状态" prop="state">
  32. <el-select v-model="screenForm.status" placeholder="全部">
  33. <el-option label="全部" value=""></el-option>
  34. <el-option :label="item.label" :value="item.value" v-for="(item, index) in select_status" :key="index"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  39. <el-form-item label="">
  40. <el-button size="small" @click="resetScreenForm">清空</el-button>
  41. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </el-form>
  46. </div>
  47. <div class="mymain-container">
  48. <div class="btn-group clearfix" v-if="!!~[2].indexOf(userType)">
  49. <div class="fl">
  50. <el-button size="small" type="primary" @click="toCreate()">开通账号</el-button>
  51. </div>
  52. <div class="fr">
  53. <el-button size="small" type="primary" icon="el-icon-download" @click="handleExport">导出数据</el-button>
  54. </div>
  55. </div>
  56. <div class="table">
  57. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  58. <el-table-column align="center" label="操作" width="230" fixed="right">
  59. <template slot-scope="scope">
  60. <el-button type="text" @click="toDetail(scope.row.adminUserId, 1)">详情</el-button>
  61. <el-button type="text" @click="toDetail(scope.row.adminUserId, 2)">商城配置</el-button>
  62. <template v-if="!!~[2].indexOf(userType)">
  63. <el-button type="text" @click="toDetail(scope.row.adminUserId, 3)">微信配置</el-button>
  64. <el-popconfirm v-if="scope.row.status" style="margin-left: 10px;" title="确定冻结吗?" @confirm="changeStatus(scope.row.adminUserId, 0)" >
  65. <el-button slot="reference" type="text">冻结</el-button>
  66. </el-popconfirm>
  67. <el-popconfirm v-else style="margin-left: 10px;" title="确定恢复吗?" @confirm="changeStatus(scope.row.adminUserId, 1)" >
  68. <el-button slot="reference" type="text">恢复</el-button>
  69. </el-popconfirm>
  70. </template>
  71. </template>
  72. </el-table-column>
  73. <el-table-column align="center" label="商户账号" prop="userName" min-width="100" show-overflow-tooltip>
  74. <template slot-scope="scope">
  75. <el-button type="text" @click="toAccountList(scope.row)">查看</el-button>
  76. </template>
  77. </el-table-column>
  78. <el-table-column align="center" label="商户昵称" prop="companyName" min-width="160" show-overflow-tooltip></el-table-column>
  79. <el-table-column align="center" label="负责人" prop="linkName" min-width="100" show-overflow-tooltip></el-table-column>
  80. <el-table-column align="center" label="角色" prop="roleName" min-width="160" show-overflow-tooltip></el-table-column>
  81. <el-table-column align="center" label="联系电话" prop="linkPhone" min-width="160" show-overflow-tooltip></el-table-column>
  82. <el-table-column align="center" label="到期时间" prop="expireTime" min-width="160" show-overflow-tooltip></el-table-column>
  83. <el-table-column align="center" label="电子邮箱" prop="email" min-width="160" show-overflow-tooltip></el-table-column>
  84. <el-table-column align="center" label="地址" prop="address" min-width="200" show-overflow-tooltip></el-table-column>
  85. <el-table-column align="center" label="状态" class-name="status-col">
  86. <template slot-scope="scope">
  87. <el-tag :type="scope.row.status ? 'success':'danger'">{{ scope.row.status ? '正常':'冻结' }}</el-tag>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. </div>
  92. </div>
  93. <div class="pagination clearfix">
  94. <div class="fr">
  95. <el-pagination
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange"
  98. :current-page="currentPage"
  99. :page-sizes="[10, 20, 30, 50]"
  100. :page-size="10"
  101. layout="total, sizes, prev, pager, next, jumper"
  102. :total="listTotal">
  103. </el-pagination>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import { COMMON_SELECT } from '@/utils/select_data'
  110. import {getList, changeAccountStatus} from "@/api/merchant";
  111. import {downloadFiles} from '@/utils/util'
  112. export default {
  113. data() {
  114. return {
  115. isOpen: false, // 是否展开条件筛选
  116. currentPage: 1, // 当前页码
  117. pageSize: 10, // 每页数量
  118. listTotal: 0, // 列表总数
  119. dataList: null, // 列表数据
  120. listLoading: false, // 列表加载loading
  121. screenForm: { // 筛选表单数据
  122. account: '',
  123. nickname: '',
  124. phone: '',
  125. email: '',
  126. status: '',
  127. },
  128. select_status: [ // 筛选字段 - 状态
  129. { label: '正常', value: true },
  130. { label: '冻结', value: false }
  131. ],
  132. }
  133. },
  134. computed: {
  135. userType() {
  136. return JSON.parse(localStorage.getItem('greemall_user')).type
  137. },
  138. },
  139. created() {
  140. this.getListfun();
  141. },
  142. methods: {
  143. // 查询列表
  144. getListfun() {
  145. this.listLoading = true;
  146. getList({
  147. pageNum: this.currentPage,
  148. pageSize: this.pageSize,
  149. ...this.screenForm
  150. }).then((res) => {
  151. this.dataList = res.data.records;
  152. this.listTotal = res.data.total;
  153. this.listLoading = false;
  154. })
  155. },
  156. // 提交筛选表单
  157. submitScreenForm() {
  158. this.currentPage = 1;
  159. this.getListfun();
  160. },
  161. // 重置筛选表单
  162. resetScreenForm() {
  163. this.$refs.screenForm.resetFields();
  164. this.currentPage = 1;
  165. this.getListfun();
  166. },
  167. // 更改每页数量
  168. handleSizeChange(val) {
  169. this.pageSize = val;
  170. this.currentPage = 1;
  171. this.getListfun();
  172. },
  173. // 更改当前页
  174. handleCurrentChange(val) {
  175. this.currentPage = val;
  176. this.getListfun();
  177. },
  178. // 去开通账号
  179. toCreate() {
  180. this.$router.push({
  181. name:"settledManagement",
  182. query: {}
  183. })
  184. },
  185. toAccountList(data) {
  186. this.$router.push({
  187. name:"account",
  188. query: {
  189. companyWechatId:data.companyWechatId
  190. }
  191. })
  192. },
  193. toDetail(id, type) {
  194. this.$router.push({
  195. name:"tenantDetails",
  196. query: {
  197. id, type
  198. }
  199. })
  200. },
  201. // 操作 - 更改状态(type: 禁用0,启用1)
  202. changeStatus(id, type) {
  203. type = type ? true : false
  204. changeAccountStatus({adminUserId: id, status: type}).then(res => {
  205. this.getListfun();
  206. this.$successMsg();
  207. })
  208. },
  209. // 导出
  210. handleExport() {
  211. let screenData = {
  212. userName: this.screenForm.account,
  213. nickName: this.screenForm.nickName,
  214. linkPhone: this.screenForm.phone,
  215. email: this.screenForm.email,
  216. status: this.screenForm.status,
  217. };
  218. downloadFiles('admin/user/mch/export', screenData);
  219. },
  220. }
  221. }
  222. </script>
  223. <style scoped>
  224. </style>