init
This commit is contained in:
209
src/views/cai/userInvite/index.vue
Normal file
209
src/views/cai/userInvite/index.vue
Normal file
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="蜜瓜号" prop="usercode">
|
||||
<el-input
|
||||
v-model="queryParams.usercode"
|
||||
placeholder="请输入蜜瓜号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input
|
||||
v-model="queryParams.mobile"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="邀请人蜜瓜号" prop="inviteUsercode">
|
||||
<el-input
|
||||
v-model="queryParams.inviteUsercode"
|
||||
placeholder="请输入邀请人蜜瓜号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="邀请人手机号" prop="inviteMobile">
|
||||
<el-input
|
||||
v-model="queryParams.inviteMobile"
|
||||
placeholder="请输入邀请人手机号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工会名称" prop="unionName">
|
||||
<el-input
|
||||
v-model="queryParams.unionName"
|
||||
placeholder="请输入邀请人手机号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="userInviteList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="蜜瓜号" align="center" prop="usercode"/>
|
||||
<el-table-column label="手机号" align="center" prop="mobile"/>
|
||||
<el-table-column label="所属工会" align="center" prop="unionName"/>
|
||||
<el-table-column label="邀请人蜜瓜号" align="center" prop="inviteUsercode"/>
|
||||
<el-table-column label="邀请人手机号" align="center" prop="inviteMobile"/>
|
||||
<el-table-column label="邀请人为会长" align="center" prop="inviteIsUnion">
|
||||
<template v-slot="scope">
|
||||
<cai-dict-tag :options="isAnchorList" :value="scope.row.inviteIsUnion"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="好友守护分成" align="center" prop="guardIncomeRate" />
|
||||
<el-table-column label="好友礼物分成" align="center" prop="giftIncomeRate" />
|
||||
<el-table-column label="好友视频分成" align="center" prop="videoIncomeRate" />
|
||||
<el-table-column label="好友充值分成" align="center" prop="payIncomeRate" />
|
||||
<el-table-column label="是否有效" align="center" prop="enableRate" >
|
||||
<template v-slot="scope">
|
||||
<cai-dict-tag :options="booleanList" :value="scope.row.enableRate"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
v-if="!scope.row.enableRate"
|
||||
@click="handleEnableRate(scope.row,true)"
|
||||
v-hasPermi="['cai:userInvite:edit']"
|
||||
>开启</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
v-if="scope.row.enableRate"
|
||||
@click="handleEnableRate(scope.row,false)"
|
||||
v-hasPermi="['cai:userInvite:edit']"
|
||||
>关闭</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['cai:userInvite:edit']"
|
||||
>修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<update-invite-dialog v-if="updateInviteDialogVisible" ref="updateInviteDialog" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listUserInvite, updateUserInvite} from "@/api/cai/userInvite";
|
||||
import {booleanList, isAnchorList} from "@/constant/statusMap";
|
||||
import UpdateInviteDialog from "@/views/cai/userInvite/update-invite-dialog";
|
||||
|
||||
export default {
|
||||
name: "UserInvite",
|
||||
components: {
|
||||
UpdateInviteDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isAnchorList,booleanList,
|
||||
updateInviteDialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 用户邀请表格数据
|
||||
userInviteList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
usercode: undefined,
|
||||
mobile: undefined,
|
||||
inviteUsercode: undefined,
|
||||
inviteMobile: undefined,
|
||||
unionName: undefined,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询用户邀请列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listUserInvite(this.queryParams).then(response => {
|
||||
this.userInviteList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleUpdate(row){
|
||||
this.updateInviteDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.updateInviteDialog.init(row)
|
||||
})
|
||||
},
|
||||
handleEnableRate(row,enableRate) {
|
||||
let message = enableRate ? '开启' : '关闭';
|
||||
this.$modal.confirm('是否确认'+message+'用户"' + row.usercode + '"的好友邀请奖励?').then(() => {
|
||||
this.loading = true;
|
||||
return updateUserInvite({
|
||||
id:row.id,
|
||||
enableRate:enableRate
|
||||
});
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
99
src/views/cai/userInvite/update-invite-dialog.vue
Normal file
99
src/views/cai/userInvite/update-invite-dialog.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="蜜瓜号" prop="usercode">
|
||||
<el-input v-model="form.usercode" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="好友守护分成" prop="guardIncomeRate">
|
||||
<el-input v-model="form.guardIncomeRate" />
|
||||
</el-form-item>
|
||||
<el-form-item label="好友礼物分成" prop="giftIncomeRate">
|
||||
<el-input v-model="form.giftIncomeRate" />
|
||||
</el-form-item>
|
||||
<el-form-item label="好友视频分成" prop="videoIncomeRate">
|
||||
<el-input v-model="form.videoIncomeRate" />
|
||||
</el-form-item>
|
||||
<el-form-item label="好友充值分成" prop="payIncomeRate">
|
||||
<el-input v-model="form.payIncomeRate" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ImageUpload from '@/components/ImageUpload/index'
|
||||
import {getUserInvite, updateUserInviteRate} from "@/api/cai/userInvite";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
open: false,
|
||||
title: '',
|
||||
form:{
|
||||
id: undefined,
|
||||
usercode: undefined,
|
||||
guardIncomeRate: undefined,
|
||||
giftIncomeRate: undefined,
|
||||
videoIncomeRate: undefined,
|
||||
payIncomeRate: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
guardIncomeRate: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
giftIncomeRate: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
videoIncomeRate: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
payIncomeRate: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
buttonLoading: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
init (row) {
|
||||
let id = row.id
|
||||
this.form.id = id || undefined;
|
||||
this.title = "修改用户好友提成";
|
||||
this.open = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].resetFields();
|
||||
getUserInvite(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.usercode = row.usercode
|
||||
});
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
submitForm () {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
updateUserInviteRate(this.form).then(data => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.buttonLoading = false;
|
||||
this.open = false
|
||||
this.$emit('refreshDataList')
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user