90 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <section class="AppPortalAccount">
 | |
|     <ai-list>
 | |
|       <ai-title slot="title" title="用户账号" isShowBottomBorder/>
 | |
|       <template #content>
 | |
|         <ai-search-bar>
 | |
|           <template #left>
 | |
|             <ai-select v-model="search.enterpriseStatus" :selectList="dict.getDict('enterpriseStatus')"
 | |
|                        placeholder="认证状态"/>
 | |
|             <ai-select v-model="search.status" :selectList="dict.getDict('portalUserStatus')" placeholder="账号状态"/>
 | |
|           </template>
 | |
|           <template #right>
 | |
|             <el-input size="small" placeholder="搜索姓名、手机号" v-model="search.name" clearable
 | |
|                       @change="page.current=1,getTableData()"/>
 | |
|           </template>
 | |
|         </ai-search-bar>
 | |
|         <ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
 | |
|                   @getList="getTableData" :col-configs="colConfigs" :dict="dict">
 | |
|           <el-table-column slot="options" label="操作" fixed="right" align="center">
 | |
|             <template slot-scope="{row}">
 | |
|               <el-button v-if="row.status==0" type="text" @click="handleEnable(row)">启用</el-button>
 | |
|               <el-button v-else-if="row.status==1" type="text" @click="handleEnable(row)">禁用</el-button>
 | |
|               <el-button type="text">详情</el-button>
 | |
|             </template>
 | |
|           </el-table-column>
 | |
|         </ai-table>
 | |
|       </template>
 | |
|     </ai-list>
 | |
|   </section>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| export default {
 | |
|   name: "AppPortalAccount",
 | |
|   label: "用户账号(经营主体)",
 | |
|   props: {
 | |
|     instance: Function,
 | |
|     dict: Object,
 | |
|     permissions: Function
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       search: {name: "",},
 | |
|       page: {current: 1, size: 10, total: 0},
 | |
|       tableData: [],
 | |
|       colConfigs: [
 | |
|         {label: "用户账号", prop: "phone"},
 | |
|         {label: "企业注册数量", prop: ""},
 | |
|         {label: "认证状态", prop: ""},
 | |
|         {label: "注册时间", prop: ""},
 | |
|         {label: "账号状态", prop: ""},
 | |
|         {slot: "options"}
 | |
|       ]
 | |
|     }
 | |
|   },
 | |
|   methods: {
 | |
|     getTableData() {
 | |
|       this.instance.post("/appportaluser/list", null, {
 | |
|         params: {...this.page, ...this.search}
 | |
|       }).then(res => {
 | |
|         if (res?.data) {
 | |
|           this.tableData = res.data?.records
 | |
|           this.page.total = res.data.total
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     handleEnable(row) {
 | |
|       let status = (++row.status) % 2
 | |
|       this.$confirm(`是否要${this.dict.getLabel('status', status)}账号?`).then(() => {
 | |
|         this.instance.post("/appportaluser/addOrUpdate", {...row, status}).then(res => {
 | |
|           if (res?.code == 0) {
 | |
|             this.$message.success(this.dict.getLabel('status', status) + "成功!")
 | |
|             this.getTableData()
 | |
|           }
 | |
|         })
 | |
|       }).catch(() => 0)
 | |
|     }
 | |
|   },
 | |
|   created() {
 | |
|     this.dict.load("portalUserStatus", "enterpriseStatus")
 | |
|     this.getTableData()
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| .AppPortalAccount {
 | |
| }
 | |
| </style>
 |