| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <div id="">
- <search-box-new
- ref="searchBox"
- :formData="formData"
- :formList="formList"
- @search="search"
- @init="init"
- />
- <table-list
- rowKey="userId"
- ref="tableList"
- :tableSets="tableSet"
- :tableData="tableData"
- :navText="navText"
- :loading="loading"
- >
- <template slot="customize">
- <el-button type="primary" @click="dialogVisibleVipOpen = true">
- 会员卡开通
- </el-button>
- <el-button type="primary" @click="batch(1)"> 会员充值 </el-button>
- <el-button type="primary" @click="batch(2)"> 会员恢复 </el-button>
- <el-button @click="batch(3)"> 注销会员 </el-button>
- <el-button @click="exportData"> 导出excel </el-button>
- </template>
- <template slot="btn" slot-scope="props">
- <el-button
- type="text"
- @click="addClick([props.scope.row.userId])"
- :disabled="props.scope.row.vipTag !== 1"
- >充值</el-button
- ><el-button type="text" @click="cancellation(props.scope.row)">{{
- props.scope.row.vipTag == 1
- ? "注销"
- : props.scope.row.vipTag == 2
- ? "恢复"
- : ""
- }}</el-button
- ><el-button type="text" @click="record(props.scope.row)"
- >记录</el-button
- >
- </template>
- </table-list>
- <pagination
- :total="total"
- :pageSize.sync="formData.pageSize"
- :currentPage.sync="formData.pageNum"
- @search="search"
- />
- <dislog
- :dialogVisible.sync="dialogVisible"
- @search="search"
- :activeData="activeData"
- ></dislog>
- <vip-open
- :dialogVisible.sync="dialogVisibleVipOpen"
- @search="search"
- ></vip-open>
- <record
- :dialogVisible.sync="dialogRecordVisible"
- @search="search"
- :activeData="activeData"
- ></record>
- </div>
- </template>
- <script>
- import { exportFn } from "@/utils/index.js";
- import dislog from "./dislog.vue";
- import vipOpen from "./vipOpen.vue";
- import record from "./record.vue";
- import searchBoxNew from "@/components/searchBoxNew";
- import tableList from "@/components/tableList";
- import pagination from "@/components/pagination";
- export default {
- name: "MembershipCard",
- components: { searchBoxNew, tableList, pagination, dislog, record, vipOpen },
- data() {
- return {
- loading: false,
- navText: {
- title: "会员卡",
- index: 0,
- ch: "条",
- num: true,
- choice: true,
- addHide: true,
- custom: false,
- openCheckMore: true,
- },
- formList: [
- {
- prop: "vipTag",
- placeholder: "会员状态",
- scope: "select",
- options: [
- {
- label: "已开通",
- value: 1,
- },
- {
- label: "已注销",
- value: 2,
- },
- ],
- },
- {
- prop: "telphone",
- placeholder: "输入手机号码",
- },
- {
- prop: "idCard",
- placeholder: "输入身份证号",
- },
- ],
- formData: {},
- tableSet: [
- {
- label: "会员状态",
- prop: "vipTag",
- hidden: true,
- scope: "isOptions",
- options: [
- {
- label: "已开通",
- value: 1,
- },
- {
- label: "已注销",
- value: 2,
- },
- ],
- },
- {
- label: "会员来源",
- prop: "vipFrom",
- hidden: true,
- scope: "isOptions",
- options: [
- {
- label: "云学堂PC",
- value: 1,
- },
- {
- label: "云学堂H5",
- value: 2,
- },
- {
- label: "云学堂小程序",
- value: 3,
- },
- {
- label: "e管证",
- value: 4,
- },
- {
- label: "教育智慧管理系统",
- value: 5,
- },
- {
- label: "中正总平台",
- value: 6,
- },
- ],
- },
- {
- label: "关联机构",
- prop: "tenantName",
- hidden: true,
- },
- {
- label: "姓名",
- prop: "realname",
- hidden: true,
- },
- {
- label: "性别",
- prop: "sex",
- hidden: true,
- scope: "isOptions",
- options: [
- {
- label: "男",
- value: 1,
- },
- {
- label: "女",
- value: 2,
- },
- ],
- },
- {
- label: "身份证号",
- prop: "idCard",
- hidden: true,
- },
- {
- label: "手机号码",
- prop: "telphone",
- hidden: true,
- },
- {
- label: "当前积分",
- prop: "pointsValue",
- hidden: true,
- },
- {
- label: "累计充值",
- prop: "rechargeMoney",
- hidden: true,
- },
- {
- label: "累计退款",
- prop: "refundMoney",
- hidden: true,
- },
- {
- label: "开通时间",
- prop: "vipOpenTime",
- hidden: true,
- scope: "aTimeList",
- },
- {
- label: "注销时间",
- prop: "vipCloseTime",
- hidden: true,
- scope: "aTimeList",
- },
- ],
- tableData: [],
- total: 0,
- dialogVisible: false,
- dialogRecordVisible: false,
- dialogVisibleVipOpen: false,
- activeData: {},
- };
- },
- created() {
- this.search(2);
- },
- methods: {
- exportData() {
- this.$api.appuserlistExport(this.formData).then((res) => {
- if (res.msg) {
- exportFn(res.msg, `导出数据`);
- } else {
- this.$message.error("导出失败");
- }
- });
- },
- batch(i) {
- if (this.$refs.tableList.allCheckData.length === 0) {
- this.$message.error("请勾选数据");
- return;
- }
- if (i == 1) {
- if (this.$refs.tableList.allCheckData.every((k) => k.vipTag === 1)) {
- this.addClick(this.$refs.tableList.allCheckData.map((k) => k.userId));
- } else {
- this.$message.error("只能对会员状态为已开通的会员进行充值");
- return;
- }
- } else if (i == 2 || i == 3) {
- const alist = this.$refs.tableList.allCheckData.filter((item) => {
- if (i == 2) {
- return item.vipTag == 2;
- }
- if (i == 3) {
- return item.vipTag == 1;
- }
- });
- if (alist.length === 0) {
- this.$message.warning(
- `选中的数据中不存在可${i == 2 ? "恢复" : "注销"}的会员`
- );
- return;
- }
- this.$confirm(`是否${i == 2 ? "恢复" : "注销"}选中的会员`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$api[
- i == 2 ? "appuserrestoreBatchVip" : "appusercloseBatchVip"
- ]({
- userIdList: alist.map((k) => k.userId),
- }).then((res) => {
- this.$message.success("操作成功");
- this.search(3);
- });
- })
- .catch(() => {});
- }
- },
- addClick(data) {
- this.activeData = {
- userIdList: data,
- };
- this.dialogVisible = true;
- },
- search(v) {
- this.loading = true;
- if (v === 2) {
- this.formData = {
- pageSize: 10,
- pageNum: 1,
- };
- this.$nextTick(() => {
- this.$refs.tableList.clearMoreActive();
- });
- }
- if (v === 3) {
- this.$nextTick(() => {
- this.$refs.tableList.clearMoreActive();
- });
- }
- this.$api
- .appuservipUserList(this.formData)
- .then((res) => {
- this.tableData = res.rows;
- this.total = res.total;
- this.navText.index = res.total;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- init() {
- this.search(2);
- },
- //注销/恢复会员
- cancellation(row) {
- this.$alert(
- `确定${
- row.vipTag === 1 ? "注销" : row.vipTag === 2 ? "恢复" : ""
- }该会员吗?`,
- "提示",
- {
- dangerouslyUseHTMLString: true,
- }
- )
- .then(() => {
- this.$api[
- row.vipTag === 1
- ? "appusercloseBatchVip"
- : row.vipTag === 2
- ? "appuserrestoreBatchVip"
- : ""
- ]({
- userIdList: [row.userId],
- }).then((res) => {
- this.$message.success("操作成功");
- this.search(3);
- });
- })
- .catch(() => {});
- },
- record(data) {
- this.activeData = data || {};
- this.dialogRecordVisible = true;
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|