index.vue 9.4 KB

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