123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <template>
- <div class="app-container">
- <div class="app-header-search">
- <el-form ref="searchForm" :inline="true" :model="searchForm" class="demo-form-inline">
- <el-form-item label="会所名称:">
- <el-input v-model="searchForm.name" placeholder="请输入会所名称" maxlength="50" style="width:200px" />
- </el-form-item>
- <el-form-item label="联系人:">
- <el-input v-model="searchForm.linkName" placeholder="请输入联系人姓名" maxlength="10" style="width:150px" />
- </el-form-item>
- <el-form-item label="手机号:">
- <el-input v-model="searchForm.mobile" placeholder="请输入手机号" maxlength="11" style="width:130px" />
- </el-form-item>
- <el-form-item label="上线状态:">
- <el-select v-model="searchForm.clubStatus" placeholder="请选择" style="width:100px">
- <el-option label="已上线" value="90" />
- <el-option label="已下线" value="91" />
- </el-select>
- </el-form-item>
- <el-form-item label="创建时间:">
- <el-date-picker
- v-model="startTime"
- type="date"
- placeholder="选择日期"
- format="yyyy 年 MM 月 dd 日"
- value-format="yyyy-MM-dd"
- />
- 至
- <el-date-picker
- v-model="endTime"
- type="date"
- placeholder="选择日期"
- format="yyyy 年 MM 月 dd 日"
- value-format="yyyy-MM-dd"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="success" @click="onSubmit">搜索</el-button>
- </el-form-item>
- <el-form-item>
- <router-link :to="'/club/form/'">
- <el-button type="primary" @click="onSubmit">上线会所</el-button>
- </router-link>
- </el-form-item>
- </el-form>
- </div>
- <el-table
- v-loading="listLoading"
- :data="list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- :header-cell-style="{background:'#eef1f6',color:'#606266'}"
- >
- <el-table-column align="center" label="序号" width="50">
- <template slot-scope="scope">
- {{ scope.$index+1 }}
- </template>
- </el-table-column>
- <el-table-column label="账号" width="150" align="center" prop="account" />
- <el-table-column label="会所名称" width="150" align="center" prop="name" />
- <el-table-column label="联系人" width="80" align="center" prop="linkMan" />
- <el-table-column label="手机号" width="110" align="center" prop="bindMobile" />
- <el-table-column class-name="status-col" label="上线状态" width="150" align="center" prop="status">
- <template slot-scope="{row}">
- <el-tag>
- {{ row.clubStatus === '91' ? '已下线' : '已上线' }}
- </el-tag>
- <el-button v-if="row.clubStatus === '91'" type="primary" size="mini" @click="handOnline(row)">上线</el-button>
- <el-button v-else type="primary" size="mini" @click="handOffline(row)">下线</el-button>
- </template>
- </el-table-column>
- <el-table-column align="center" label="会所地址" width="350" prop="address" />
- <el-table-column align="center" label="创建时间" width="180" prop="registerTime" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="{row}">
- <router-link :to="'/club/form/'">
- <el-button type="primary" size="small">编辑</el-button>
- </router-link>
- <router-link :to="{path:'/club/operateList',query:{clubID:row.clubID,userID:row.userID}}">
- <el-button type="primary" size="small">查看运营人员</el-button>
- </router-link>
- <el-button type="primary" size="small" @click="handleEdit(row)">添加运营人员</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page-size="10"
- :page.sync="listQuery.page"
- :limit.sync="listQuery.limit"
- @pagination="fetchData"
- />
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
- <el-form ref="dataForm" :rules="rules" :model="addPeople" label-position="left" label-width="70px" style="width: 400px; margin-left:24%;">
- <el-form-item label="姓名" prop="linkName">
- <el-input v-model="addPeople.linkName" maxlength="11" />
- </el-form-item>
- <el-form-item label="手机号" prop="mobile">
- <el-input v-model="addPeople.mobile" maxlength="11" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取消</el-button>
- <el-button type="primary" @click="handleCreateOperator()">保存</el-button>
- <el-button type="primary" @click="handlePreservOperator()">保存生成邀请码</el-button>
- </div>
- </el-dialog>
- <el-dialog title="系统提示" :visible.sync="dialogVisible" width="15%">
- <span>{{ dialogVisibleText }}</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="handleConfim()">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getClubList,
- createOperator,
- preservOperator,
- updateStatus,
- queryClubList
- } from '@/api/club'
- import Pagination from '@/components/Pagination'
- export default {
- components: { Pagination },
- filters: {
- statusFilter(status) {
- const statusMap = {
- 1: 'success',
- 0: 'gray'
- }
- return statusMap[status]
- }
- },
- data() {
- return {
- list: null,
- listLoading: true,
- total: 0,
- listQuery: {
- page: 1,
- limit: 10,
- importance: undefined,
- title: undefined,
- type: undefined,
- sort: '+id'
- },
- searchForm: {
- name: '',
- linkName: '',
- mobile: '',
- clubStatus: ''
- },
- startTime: '',
- endTime: '',
- addPeople: {
- linkName: '',
- mobile: ''
- },
- updateTemp: {},
- updateTatusType: '',
- dialogVisible: false,
- dialogVisibleText: '',
- dialogFormVisible: false,
- dialogStatus: '',
- textMap: {
- update: '添加运营人员',
- create: 'Create',
- titleText: '系统提示'
- },
- rules: {
- classifyName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
- telephone: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }]
- }
- }
- },
- created() {
- this.fetchData()
- },
- methods: {
- fetchData() {
- this.listLoading = true
- const params = { userOrganizeID: this.organizeID, index: 1, pageSize: 10 }
- getClubList(params).then(response => {
- if (response.code === '1') {
- const data = response.data
- this.list = data.results
- this.listLoading = false
- this.total = data.totalRecord
- } else {
- this.$message.error(response.msg)
- }
- }).catch(() => {
- // 封装静态数据
- })
- this.listLoading = false
- },
- handleEdit(row) { // 添加运营
- console.log(row)
- this.dialogStatus = 'update'
- this.dialogFormVisible = true
- this.addPeople = Object.assign({}, { clubID: row.clubID, userID: row.userID })
- this.$nextTick(() => {
- this.$refs['dataForm'].clearValidate()
- })
- },
- handleCreateOperator() { // 保存
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- const Formobj = { userOrganizeID: this.organizeID, configFlag: 1 }
- const params = Object.assign(Formobj, this.addPeople)
- createOperator(params).then(response => {
- this.dialogFormVisible = false
- this.$message({
- message: '保存成功',
- type: 'success',
- center: true
- })
- })
- }
- })
- },
- handlePreservOperator() { // 保存并生成邀请码
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- const Formobj = { userOrganizeID: this.organizeID, configFlag: 1 }
- const params = Object.assign(Formobj, this.addPeople)
- preservOperator(params).then(response => {
- this.dialogFormVisible = false
- this.$message({
- message: '生成邀请码成功',
- type: 'success',
- center: true
- })
- })
- }
- })
- },
- handOnline(row) {
- this.updateTemp = Object.assign({}, { clubID: row.clubID, userID: row.userID, clubStatus: row.clubStatus, userOrganizeID: this.organizeID })
- this.dialogVisible = true
- this.dialogVisibleText = '确定上线该会所吗?'
- this.updateTatusType = 'online'
- },
- handOffline(row) {
- console.log(row.id)
- this.updateTemp = Object.assign({}, { clubID: row.clubID, userID: row.userID, clubStatus: row.clubStatus, userOrganizeID: this.organizeID })
- this.dialogVisible = true
- this.dialogVisibleText = '确定下线该会所吗?'
- this.updateTatusType = 'offline'
- },
- handleConfim() {
- if (this.updateTatusType === 'online') {
- const params = Object.assign({}, this.updateTemp)
- updateStatus(params).then(response => {
- if (response.code === '1') {
- this.$message({ message: '上线会所成功', type: 'success', center: true })
- this.list = []
- this.fetchData()
- } else {
- this.$message.error(response.msg)
- }
- this.dialogVisible = false
- })
- } else {
- const params = Object.assign({}, this.updateTemp)
- updateStatus(params).then(response => {
- if (response.code === '1') {
- this.$message({ message: '下线会所成功', type: 'success', center: true })
- this.list = []
- this.fetchData()
- } else {
- this.$message.error(response.msg)
- }
- this.dialogVisible = false
- })
- }
- },
- onSubmit() {
- this.$refs['searchForm'].validate((valid) => {
- if (valid) {
- const Fromobj = { userOrganizeID: this.organizeID, startTime: this.startTime, endTime: this.endTime, index: 1, pageSize: 10 }
- const params = Object.assign(Fromobj, this.searchForm)
- console.log(params)
- getClubList(params).then(response => {
- if (response.code === '1') {
- const data = response.data
- this.list = data.results
- this.listLoading = false
- this.total = data.totalRecord
- } else {
- this.$message.error(response.msg)
- }
- }).catch(() => {
- // 封装静态数据
- })
- }
- })
- }
- }
- }
- </script>
|