1748153932 12 months ago
parent 718be11d3c
commit 2e81767727
  1. 50
      src/api/user.js
  2. 210
      src/views/merchant/type/index.vue
  3. 183
      src/views/user/list/index.vue
  4. 814
      src/views/user/list2/index.vue

@ -60,6 +60,10 @@ export function getMenusApi() {
export function createUserApi() {
return request.get(`user/create`)
}
export function getCity() {
return request.get(`user/create`)
}
/**
* @description 用户分组 -- 编辑表单
* @param {Object} param params {Object} 传值参数
@ -98,6 +102,14 @@ export function labelEditApi(id) {
export function labelFormApi() {
return request.get('user/label/form')
}
// wmc
export function labelFormApi2() {
return request.get('user/label/form2')
}
/**
* @description 用户标签 -- 列表
*/
@ -113,9 +125,44 @@ export function labelDeleteApi(id) {
/**
* @description 用户列表 -- 列表
*/
export function userLstApi(data) {
return request.get('user/lst', data)
}
//wmc
export function userLstApi2(data) {
return request.get('partner/role/list', data)
}
export function userLstApi1(data) {
return request.get('store/brand/brandList', data)
}
export function userLstApi3(data) {
return request.get('store/brand/city/0', data)
}
export function userLstApi4(data) {
return request.get('store/brand/category/lst', data)
}
export function userLstApi5(data) {
return request.post('partner/role/add', data)
}
export function userLstApi6(id) {
return request.get(`partner/role/detail/${id}`)
}
export function userLstApi7(data) {
return request.post('partner/role/update', data)
}
export function userLstApi8(id) {
return request.get(`partner/role/delete/${id}`)
}
/**
* @description 用户列表 -- 设置分组
*/
@ -128,6 +175,9 @@ export function changeGroupApi(id) {
export function changelabelApi(id) {
return request.get(`user/change_label/form/${id}`)
}
export function changelabelApi2(id) {
return request.get(`user/partner/${id}`)
}
/**
* @description 用户列表 -- 编辑会员等级
*/

@ -24,7 +24,7 @@
<el-table-column prop="type_name" label="店铺保证金" min-width="200">
<template slot-scope="scope">
<span class="spBlock">{{
scope.row.is_margin ? scope.row.margin + "元" : "无"
scope.row.is_margin ? scope.row.margin + '元' : '无'
}}</span>
</template>
</el-table-column>
@ -183,7 +183,7 @@
{{
formDetailValidate.type_name
? formDetailValidate.type_name
: "暂无数据"
: '暂无数据'
}}
</span>
</el-form-item>
@ -191,13 +191,15 @@
{{
formDetailValidate.type_info
? formDetailValidate.type_info
: "暂无数据"
}}</el-form-item
: '暂无数据'
}}
</el-form-item
>
<el-form-item label="店铺保证金:">
{{
formDetailValidate.margin ? formDetailValidate.margin : "暂无数据"
}}</el-form-item
formDetailValidate.margin ? formDetailValidate.margin : '暂无数据'
}}
</el-form-item
>
<el-form-item label="店铺权限:">
<el-tree
@ -210,23 +212,25 @@
{{
formDetailValidate.description
? formDetailValidate.description
: "暂无数据"
}}</el-form-item
: '暂无数据'
}}
</el-form-item
>
<el-form-item label="创建时间:">
{{
formDetailValidate.create_time
? formDetailValidate.create_time
: "暂无数据"
}}</el-form-item
: '暂无数据'
}}
</el-form-item
>
<el-form-item label="最新修改时间:"
>{{
formDetailValidate.update_time
? formDetailValidate.update_time
: "暂无数据"
: '暂无数据'
}}
</el-form-item>
</el-form>
@ -252,21 +256,21 @@ import {
storeTypeDeleteApi,
storeJurisdictionApi,
merchantTypeMarkForm,
merchantTypeMarkApi,
} from "@/api/merchant";
import { fromList } from "@/libs/constants.js";
import { roterPre } from "@/settings";
import SettingMer from "@/libs/settingMer";
import Cookies from "js-cookie";
merchantTypeMarkApi
} from '@/api/merchant'
import { fromList } from '@/libs/constants.js'
import { roterPre } from '@/settings'
import SettingMer from '@/libs/settingMer'
import Cookies from 'js-cookie'
export default {
name: "MerchantList",
name: 'MerchantList',
data() {
return {
//
dialogDetailVisible: false,
formDetailValidate: {},
detailTypeId: "",
detailTypeId: '',
fromList: fromList,
roterPre: roterPre,
@ -275,156 +279,156 @@ export default {
permissions: [], //
tableData: {
data: [],
total: 0,
total: 0
},
tableFrom: {
page: 1,
limit: 20,
limit: 20
},
formValidate: {
type_name: "",
type_info: "",
type_name: '',
type_info: '',
is_margin: 1,
margin: 0,
auth: [],
description: "",
description: ''
},
ruleValidate: {
type_name: [
{ required: true, message: "请输入店铺类型名称", trigger: "blur" },
{ required: true, message: '请输入店铺类型名称', trigger: 'blur' }
],
auth: [
{ required: true, message: "请选择店铺权限", trigger: "change" },
],
{ required: true, message: '请选择店铺权限', trigger: 'change' }
]
},
dialogVisible: false,
isEdit: false,
typeId: "",
cccc: "",
typeId: '',
cccc: '',
props: {
multiple: true,
expandTrigger: "hover",
emitPath: false,
},
};
expandTrigger: 'hover',
emitPath: false
}
}
},
mounted() {
this.getList("");
this.getList('')
},
methods: {
//
getList(num) {
this.listLoading = true;
this.tableFrom.page = num ? num : this.tableFrom.page;
this.listLoading = true
this.tableFrom.page = num ? num : this.tableFrom.page
storeTypeLstApi(this.tableFrom)
.then((res) => {
this.tableData.data = res.data.list;
this.tableData.total = res.data.count;
this.listLoading = false;
this.jurisdiction();
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
this.jurisdiction()
})
.catch((res) => {
this.listLoading = false;
this.$message.error(res.message);
});
this.listLoading = false
this.$message.error(res.message)
})
},
pageChange(page) {
this.tableFrom.page = page;
this.getList("");
this.tableFrom.page = page
this.getList('')
},
handleSizeChange(val) {
this.tableFrom.limit = val;
this.getList(1);
this.tableFrom.limit = val
this.getList(1)
},
handleClose() {
this.dialogVisible = false;
this.dialogVisible = false
},
//
onAdd() {
this.dialogVisible = true;
this.isEdit = false;
this.dialogVisible = true
this.isEdit = false
// this.jurisdiction();
this.formValidate = {
type_name: "",
type_info: "",
type_name: '',
type_info: '',
is_margin: 1,
margin: 0,
description: "",
auth: [],
};
this.$refs.tree && this.$refs.tree.setCheckedKeys([]);
description: '',
auth: []
}
this.$refs.tree && this.$refs.tree.setCheckedKeys([])
},
//
jurisdiction() {
storeJurisdictionApi().then((res) => {
function loadData(lst) {
lst.forEach((v) => {
v.value = v.id;
v.label = v.title;
delete v.id;
delete v.title;
v.value = v.id
v.label = v.title
delete v.id
delete v.title
if (v.children) {
if (!v.children.length) {
delete v.children;
delete v.children
} else {
loadData(v.children);
loadData(v.children)
}
}
});
return lst;
})
return lst
}
this.permissions = loadData(res.data);
});
this.permissions = loadData(res.data)
})
},
handleSubmit(name) {
this.$refs[name].validate((valid) => {
if (valid) {
storeTypeCreateApi(this.formValidate)
.then(async(res) => {
this.$message.success(res.message);
this.dialogVisible = false;
this.getList("");
this.$message.success(res.message)
this.dialogVisible = false
this.getList('')
})
.catch((res) => {
this.$message.error(res.message);
});
this.$message.error(res.message)
})
} else {
return false;
return false
}
});
})
},
//
onEdit(row) {
this.isEdit = true;
this.dialogVisible = true;
this.typeId = row.mer_type_id;
this.isEdit = true
this.dialogVisible = true
this.typeId = row.mer_type_id
this.formValidate = {
type_name: row.type_name,
type_info: row.type_info,
is_margin: row.is_margin || 0,
margin: row.margin || 0,
auth: row.auth_ids,
description: row.description,
};
this.$refs.tree && this.$refs.tree.setCheckedKeys(row.auth_ids);
description: row.description
}
this.$refs.tree && this.$refs.tree.setCheckedKeys(row.auth_ids)
// this.jurisdiction();
},
//
handleDetailClose() {
this.dialogDetailVisible = false;
this.getList();
this.dialogDetailVisible = false
this.getList()
},
//
handleDetail(row) {
this.dialogDetailVisible = true;
this.detailTypeId = row.mer_type_id;
this.getDetail();
this.dialogDetailVisible = true
this.detailTypeId = row.mer_type_id
this.getDetail()
},
getDetail() {
merchantTypeMarkApi(this.detailTypeId).then((res) => {
this.formDetailValidate = res.data;
});
this.formDetailValidate = res.data
})
},
handleUpdate(name) {
@ -432,38 +436,38 @@ export default {
if (valid) {
storeTypeUpdateApi(this.typeId, this.formValidate)
.then(async(res) => {
this.$message.success(res.message);
this.dialogVisible = false;
this.getList("");
this.$message.success(res.message)
this.dialogVisible = false
this.getList('')
})
.catch((res) => {
this.$message.error(res.message);
});
this.$message.error(res.message)
})
} else {
return false;
return false
}
});
})
},
//
handleDelete(id) {
this.$modalSure("确定删除该店铺类型吗").then(() => {
this.$modalSure('确定删除该店铺类型吗').then(() => {
storeTypeDeleteApi(id)
.then(({ message }) => {
this.$message.success(message);
this.getList("");
this.$message.success(message)
this.getList('')
})
.catch(({ message }) => {
this.$message.error(message);
});
});
this.$message.error(message)
})
})
},
//
handleMark(id) {
// console.log(id,'9999999');
this.$modalForm(merchantTypeMarkForm(id)).then(() => this.getList());
},
},
};
this.$modalForm(merchantTypeMarkForm(id)).then(() => this.getList())
}
}
}
</script>
<style scoped lang="scss">

@ -30,7 +30,9 @@
<el-form-item label="会员分组:">
<el-select v-model="userFrom.group_id" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="">全部</el-option>
<el-option v-for="(item, index) in groupList" :key="index" :value="item.group_id" :label="item.group_name" />
<el-option v-for="(item, index) in groupList" :key="index" :value="item.group_id"
:label="item.group_name"
/>
</el-select>
</el-form-item>
</el-col>
@ -38,7 +40,9 @@
<el-form-item label="会员标签:">
<el-select v-model="userFrom.label_id" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="">全部</el-option>
<el-option v-for="(item, index) in labelLists" :key="index" :value="item.label_id" :label="item.label_name" />
<el-option v-for="(item, index) in labelLists" :key="index" :value="item.label_id"
:label="item.label_name"
/>
</el-select>
</el-form-item>
</el-col>
@ -104,15 +108,23 @@
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-col v-bind="grid">
<el-form-item label="访问时间:" class="timeBox">
<el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" align="right" unlink-panels format="yyyy/MM/dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" class="selWidth" :picker-options="pickerOptions" @change="onchangeTime" />
<el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" align="right" unlink-panels
format="yyyy/MM/dd" size="small" type="daterange" placement="bottom-end"
placeholder="自定义时间" class="selWidth" :picker-options="pickerOptions"
@change="onchangeTime"
/>
</el-form-item>
</el-col>
</el-col>
</template>
<el-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6" class="text-right userFrom">
<el-form-item>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="small" @click="userSearchs">搜索</el-button>
<el-button class="ResetSearch mr10" size="small" type="reset" @click="reset('userFrom')">重置</el-button>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="small"
@click="userSearchs"
>搜索
</el-button>
<el-button class="ResetSearch mr10" size="small" type="reset" @click="reset('userFrom')">重置
</el-button>
<a class="ivu-ml-8" @click="collapse = !collapse">
<template v-if="!collapse">
展开 <i class="el-icon-arrow-down"/>
@ -131,13 +143,21 @@
<el-button v-show="user_type === 'wechat'" size="mini" class="mr10" @click="sendNews">发送图文消息</el-button>
<el-button v-show="checkedIds.length != 0" size="mini" class="mr10" @click="batchGroup">批量设置分组</el-button>
<el-button v-show="checkedIds.length != 0" size="mini" @click="batchlabel">批量设置标签</el-button>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="mini" @click="sendCoupon" style="margin-bottom: 20px;">发送优惠券</el-button>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="mini" @click="sendCoupon"
style="margin-bottom: 20px;"
>发送优惠券
</el-button>
</div>
<el-alert v-if="checkedIds.length>0 || allCheck" :title="allCheck ? `已选择 ${tableData.total}` : `已选择 ${checkedIds.length}`" type="info" show-icon />
<el-alert v-if="checkedIds.length>0 || allCheck"
:title="allCheck ? `已选择 ${tableData.total} 项` : `已选择 ${checkedIds.length} 项`" type="info"
show-icon
/>
<!-- <el-alert v-if="multipleSelection.length>0" :title="`已选择 ${multipleSelection.length}`" type="info" show-icon /> -->
</div>
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row @selection-change="handleSelectionChange">
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row
@selection-change="handleSelectionChange"
>
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
@ -191,14 +211,22 @@
<template slot="header" slot-scope="scope">
<el-popover placement="top-start" width="100" trigger="hover" class="tabPop">
<div>
<span class="spBlock onHand" :class="{'check': chkName === 'dan'}" @click="onHandle('dan',scope.$index)">选中本页</span>
<span class="spBlock onHand" :class="{'check': chkName === 'dan'}"
@click="onHandle('dan',scope.$index)"
>选中本页</span>
<span class="spBlock onHand" :class="{'check': chkName === 'duo'}" @click="onHandle('duo')">选中全部</span>
</div>
<el-checkbox slot="reference" :value="(chkName === 'dan' && checkedPage.indexOf(userFrom.page) > -1) || chkName === 'duo'" @change="changeType" />
<el-checkbox slot="reference"
:value="(chkName === 'dan' && checkedPage.indexOf(userFrom.page) > -1) || chkName === 'duo'"
@change="changeType"
/>
</el-popover>
</template>
<template slot-scope="scope">
<el-checkbox :disabled="scope.row.cancel_time" :value="!scope.row.cancel_time && (checkedIds.indexOf(scope.row.uid) > -1 || (chkName === 'duo' && noChecked.indexOf(scope.row.uid) === -1))" @change="(v)=>changeOne(v,scope.row)" />
<el-checkbox :disabled="scope.row.cancel_time"
:value="!scope.row.cancel_time && (checkedIds.indexOf(scope.row.uid) > -1 || (chkName === 'duo' && noChecked.indexOf(scope.row.uid) === -1))"
@change="(v)=>changeOne(v,scope.row)"
/>
</template>
</el-table-column>
@ -206,22 +234,28 @@
<el-table-column label="头像" min-width="50">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image style="width: 36px; height: 36px" :src="scope.row.avatar ? scope.row.avatar : moren" :preview-src-list="[scope.row.avatar || moren]" />
<el-image style="width: 36px; height: 36px" :src="scope.row.avatar ? scope.row.avatar : moren"
:preview-src-list="[scope.row.avatar || moren]"
/>
</div>
</template>
</el-table-column>
<el-table-column label="昵称" min-width="150">
<template slot-scope="{row}">
<div class="acea-row">
<i v-show="row.sex===1" class="el-icon-male mr5" style="font-size: 15px; margin-top: 3px; color:#2db7f5;" />
<i v-show="row.sex===2" class="el-icon-female mr5" style="font-size: 15px; margin-top: 3px; color:#ed4014;" />
<i v-show="row.sex===1" class="el-icon-male mr5"
style="font-size: 15px; margin-top: 3px; color:#2db7f5;"
/>
<i v-show="row.sex===2" class="el-icon-female mr5"
style="font-size: 15px; margin-top: 3px; color:#ed4014;"
/>
<div v-text="row.nickname"/>
</div>
</template>
</el-table-column>
<el-table-column prop="is_svip" label="付费会员" min-width="120">
<template slot-scope="{row}">
<span>{{row.is_svip > 0 ? "是" : "否"}}</span>
<span>{{ row.is_svip > 0 ? '是' : '否' }}</span>
</template>
</el-table-column>
<el-table-column prop="phone" label="手机号" min-width="120"/>
@ -242,40 +276,62 @@
</el-table-column>
<el-table-column label="用户类型" min-width="100">
<template slot-scope="{row}">
<span>{{ row.user_type === 'routine' ? '小程序' : row.user_type === 'wechat' ? '公众号' : row.user_type === 'app' || row.user_type === 'App' ? 'App' : row.user_type === 'pc' ? 'PC' : 'H5' }}</span>
<span>{{
row.user_type === 'routine' ? '小程序' : row.user_type === 'wechat' ? '公众号' : row.user_type === 'app' || row.user_type === 'App' ? 'App' : row.user_type === 'pc' ? 'PC' : 'H5'
}}</span>
</template>
</el-table-column>
<el-table-column prop="now_money" label="余额" sortable min-width="100" :sort-method="(a,b)=>{return a.now_money - b.now_money}"/>
<el-table-column prop="now_money" label="余额" sortable min-width="100"
:sort-method="(a,b)=>{return a.now_money - b.now_money}"
/>
<el-table-column prop="integral" label="当前可用积分" min-width="100"/>
<el-table-column label="操作" min-width="130" fixed="right">
<template slot-scope="scope">
<el-button v-if="!scope.row.cancel_time" type="text" size="small" class="mr10" @click="onEdit(scope.row.uid)">编辑</el-button>
<el-button v-if="!scope.row.cancel_time" type="text" size="small" class="mr10"
@click="onEdit(scope.row.uid)"
>编辑
</el-button>
<el-dropdown>
<span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right"/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="onDetails(scope.row.uid)">用户详情</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMoney(scope.row)">设置余额</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="changeIntegral(scope.row)">设置积分</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMoney(scope.row)">设置余额
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="changeIntegral(scope.row)">设置积分
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.vip_name && !scope.row.cancel_time">清除等级</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setGroup(scope.row)">设置分组</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel(scope.row)">设置标签</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setModify(scope.row)">修改推荐人</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setPassword(scope.row)">修改密码</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMember(scope.row)">编辑会员等级</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="giveMember(scope.row)">付费会员设置</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setGroup(scope.row)">设置分组
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel(scope.row)">设置标签
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel2(scope.row)">设置用户合作方角色
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setModify(scope.row)">修改推荐人
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setPassword(scope.row)">修改密码
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMember(scope.row)">编辑会员等级
</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="giveMember(scope.row)">付费会员设置
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="userFrom.limit" :current-page="userFrom.page" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="pageChange" />
<el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="userFrom.limit" :current-page="userFrom.page"
layout="total, sizes, prev, pager, next, jumper" :total="tableData.total"
@size-change="handleSizeChange" @current-change="pageChange"
/>
</div>
</el-card>
<el-dialog title="提示" :visible.sync="visible" width="1000px" :before-close="handleClose" class="dia">
<news-category v-if="visible" :is-show-send="isShowSend" :wechat-ids="wechatIds" :user-ids="ids" :max-cols="maxCols" />
<news-category v-if="visible" :is-show-send="isShowSend" :wechat-ids="wechatIds" :user-ids="ids"
:max-cols="maxCols"
/>
<!--<span slot="footer" class="dialog-footer" />-->
</el-dialog>
<!--账户详情-->
@ -284,7 +340,9 @@
</el-dialog>
<!-- 选择优惠券 -->
<el-dialog v-if="visibleCoupon" title="优惠券列表" :visible.sync="visibleCoupon" width="1000px">
<coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds" :allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess" />
<coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds"
:allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess"
/>
</el-dialog>
</div>
</template>
@ -303,6 +361,7 @@ import {
userLstApi,
changeGroupApi,
changelabelApi,
changelabelApi2,
changeNowMoneyApi,
changeNowIntegralApi,
batchChangeGroupApi,
@ -314,7 +373,7 @@ import {
modifyUserPassword,
changeMemberApi,
createUserApi,
giveMemberApi
giveMemberApi, groupFormApi, labelFormApi
} from '@/api/user'
import newsCategory from '@/components/newsCategory/index.vue'
import userDetails from './userDetails'
@ -329,7 +388,7 @@ export default {
},
data() {
return {
moren: require("@/assets/images/f.png"),
moren: require('@/assets/images/f.png'),
pickerOptions: {
shortcuts: [{
text: '今天',
@ -490,7 +549,7 @@ export default {
}
} else {
this.chkName = ''
this.allCheck = false;
this.allCheck = false
}
const index = this.checkedPage.indexOf(this.userFrom.page)
if (this.chkName === 'dan') {
@ -510,9 +569,9 @@ export default {
})
if (this.chkName === 'duo') {
this.checkedIds = []
this.allCheck = true;
this.allCheck = true
} else if (this.chkName === 'dan') {
this.allCheck = false;
this.allCheck = false
ids.forEach(id => {
const index = this.checkedIds.indexOf(id)
if (index === -1) {
@ -548,7 +607,7 @@ export default {
if (index > -1) this.checkedIds.splice(index, 1)
}
}
console.log("分开选择",this.checkedIds)
console.log('分开选择', this.checkedIds)
},
//
@ -556,17 +615,30 @@ export default {
if (this.checkedIds.length == 0 && this.allCheck == false) {
this.$message.warning('请选择用户')
} else {
this.visibleCoupon = true;
this.visibleCoupon = true
}
},
sendSuccess() {
this.visibleCoupon = false;
this.visibleCoupon = false
},
getCoupounParmas() {
let label_id = this.userFrom.label_id == '' ? '' : this.getLabelValue(),
user_type = this.findKey(this.userFrom.user_type,{'':'','微信用户':'wechat','小程序用户':'routine','H5用户':'h5'}),
user_type = this.findKey(this.userFrom.user_type, {
'': '',
'微信用户': 'wechat',
'小程序用户': 'routine',
'H5用户': 'h5'
}),
sex = this.findKey(this.userFrom.sex, { '男': '1', '女': '2', '保密': '0', '': '' }),
pay_count = this.findKey(this.userFrom.sex,{'0次':'-1','1次以上':'0','2次以上':'1','3次以上':'2','4次以上':'3','5次以上':'4','': ''}),
pay_count = this.findKey(this.userFrom.sex, {
'0次': '-1',
'1次以上': '0',
'2次以上': '1',
'3次以上': '2',
'4次以上': '3',
'5次以上': '4',
'': ''
}),
is_promoter = this.findKey(this.userFrom.is_promoter, { '推广员': '1', '普通用户': '0', '': '' }),
user_time_type = this.userFrom.user_time_type == 'visit' ? '最后访问' : this.userFrom.user_time_type == 'add_time' ? '首次访问' : ''
this.couponForm = {
@ -658,23 +730,23 @@ export default {
},
/**获取选中的微信用户Id */
getWechatUsers(arr1, arr2) {
let newArr = [];
let newArr = []
if (this.allCheck) {
for (let i = 0; i < arr1.length; i++) {
if (arr1[i]['wechat_user_id']) {
newArr.push(arr1[i]['wechat_user_id']);
newArr.push(arr1[i]['wechat_user_id'])
}
}
} else {
for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) {
if (arr1[i]['uid'] === arr2[j] && arr1[i]['wechat_user_id']) {
newArr.push(arr2[j]);
newArr.push(arr2[j])
}
}
}
}
return newArr;
return newArr
},
handleSelectionChange(val) {
this.multipleSelection = val
@ -695,20 +767,28 @@ export default {
batchGroup() {
if (this.checkedIds.length === 0) return this.$message.warning('请先选择用户')
this.$modalForm(batchChangeGroupApi({
ids: (this.checkedIds).join(",")
ids: (this.checkedIds).join(',')
}))
},
//
batchlabel() {
if (this.checkedIds.length === 0) return this.$message.warning('请先选择用户')
this.$modalForm(batchChangelabelApi({
ids: (this.checkedIds).join(",")
ids: (this.checkedIds).join(',')
}))
},
//
setLabel(row) {
this.$modalForm(changelabelApi(row.uid)).then(() => this.getList(''))
},
setLabel2(row) {
this.$modalForm(changelabelApi2(row.uid)).then(() => this.getList(''))
},
//
onAdd() {
this.$modalForm(this.$route.path.indexOf('group') !== -1 ? groupFormApi() : labelFormApi()).then(() => this.getList())
},
//
setMember(row) {
this.$modalForm(changeMemberApi(row.uid)).then(() => this.getList(''))
@ -720,12 +800,12 @@ export default {
//
setModify(row) {
this.$modalForm(modifyUserReferrer(row.uid)).then(({ message }) => {
this.getList('');
});
this.getList('')
})
},
//
setPassword(row) {
this.$modalForm(modifyUserPassword(row.uid)).then(() => this.getList(''));
this.$modalForm(modifyUserPassword(row.uid)).then(() => this.getList(''))
},
//
setMoney(row) {
@ -738,7 +818,7 @@ export default {
//
getList(num) {
this.listLoading = true
this.userFrom.page = num ? num : this.userFrom.page;
this.userFrom.page = num ? num : this.userFrom.page
this.userFrom.user_type = this.user_type
this.userFrom.province = this.address[0]
this.userFrom.city = this.address[1]
@ -747,8 +827,8 @@ export default {
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
this.getCoupounParmas();
this.checkedIds = [];
this.getCoupounParmas()
this.checkedIds = []
}).catch(res => {
this.listLoading = false
@ -795,6 +875,7 @@ export default {
.check {
color: #00a2d4;
}
.selWidth {
// width: 100% !important;
}

@ -2,280 +2,75 @@
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-tabs v-model="user_type" @tab-click="getList(1)">
<el-tab-pane label="全部用户" name="" />
<el-tab-pane label="微信用户" name="wechat" />
<el-tab-pane label="小程序用户" name="routine" />
<el-tab-pane label="H5用户" name="h5" />
<el-tab-pane label="APP" name="app" />
<el-tab-pane label="PC" name="pc" />
</el-tabs>
<div class="container">
<el-form inline size="small" :label-position="labelPosition" label-width="100px">
<el-row>
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-form-item label="会员昵称:">
<el-input v-model="userFrom.nickname" placeholder="请输入昵称" clearable class="selWidth" />
</el-form-item>
<el-form-item label="手机号:">
<el-input v-model="userFrom.phone" placeholder="请输入手机号" clearable class="selWidth" />
</el-form-item>
<el-form-item label="用户ID:">
<el-input v-model="userFrom.uid" placeholder="请输入用户ID" clearable class="selWidth" />
</el-form-item>
</el-col>
<template v-if="collapse">
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-col v-bind="grid">
<el-form-item label="会员分组:">
<el-select v-model="userFrom.group_id" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="">全部</el-option>
<el-option v-for="(item, index) in groupList" :key="index" :value="item.group_id" :label="item.group_name" />
</el-select>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="会员标签:">
<el-select v-model="userFrom.label_id" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="">全部</el-option>
<el-option v-for="(item, index) in labelLists" :key="index" :value="item.label_id" :label="item.label_name" />
</el-select>
</el-form-item>
</el-col>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-col v-bind="grid">
<el-form-item label="性别:">
<el-radio-group v-model="userFrom.sex" type="button" class="selWidth">
<el-radio-button label="">
<span>全部</span>
</el-radio-button>
<el-radio-button label="1">
<span></span>
</el-radio-button>
<el-radio-button label="2">
<span></span>
</el-radio-button>
<el-radio-button label="0">
<span>保密</span>
</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="身份:">
<el-radio-group v-model="userFrom.is_promoter" type="button" class="selWidth">
<el-radio-button label="">
<span>全部</span>
</el-radio-button>
<el-radio-button label="1">
<span>推广员</span>
</el-radio-button>
<el-radio-button label="0">
<span>普通会员</span>
</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-col v-bind="grid">
<el-form-item label="访问情况:">
<el-select v-model="userFrom.user_time_type" placeholder="请选择" class="selWidth" clearable>
<!--<el-option value="visitno" label="时间段未访问" />-->
<el-option value="visit" label="最后访问" />
<el-option value="add_time" label="首次访问" />
</el-select>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="消费情况:">
<el-select v-model="userFrom.pay_count" placeholder="请选择" class="selWidth" clearable>
<el-option value="-1" label="0次"></el-option>
<el-option value="0" label="1次及以上"></el-option>
<el-option value="1" label="2次及以上"></el-option>
<el-option value="2" label="3次及以上"></el-option>
<el-option value="3" label="4次及以上"></el-option>
<el-option value="4" label="5次及以上"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
<el-col v-bind="grid">
<el-form-item label="访问时间:" class="timeBox">
<el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" align="right" unlink-panels format="yyyy/MM/dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" class="selWidth" :picker-options="pickerOptions" @change="onchangeTime" />
</el-form-item>
</el-col>
</el-col>
</template>
<el-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6" class="text-right userFrom">
<el-form-item>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="small" @click="userSearchs">搜索</el-button>
<el-button class="ResetSearch mr10" size="small" type="reset" @click="reset('userFrom')">重置</el-button>
<a class="ivu-ml-8" @click="collapse = !collapse">
<template v-if="!collapse">
展开 <i class="el-icon-arrow-down" />
</template>
<template v-else>
收起 <i class="el-icon-arrow-up" />
</template>
</a>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-button size="small" type="primary" @click="onadd">添加合作人角色</el-button>
</div>
<div class="mb15">
<el-button class="mr10" size="mini" @click="createUser">创建用户</el-button>
<el-button v-show="user_type === 'wechat'" size="mini" class="mr10" @click="sendNews">发送图文消息</el-button>
<el-button v-show="checkedIds.length != 0" size="mini" class="mr10" @click="batchGroup">批量设置分组</el-button>
<el-button v-show="checkedIds.length != 0" size="mini" @click="batchlabel">批量设置标签</el-button>
<el-button type="primary" icon="ios-search" label="default" class="mr15" size="mini" @click="sendCoupon" style="margin-bottom: 20px;">发送优惠券</el-button>
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row
</div>
<el-alert v-if="checkedIds.length>0 || allCheck" :title="allCheck ? `已选择 ${tableData.total}` : `已选择 ${checkedIds.length}`" type="info" show-icon />
<!-- <el-alert v-if="multipleSelection.length>0" :title="`已选择 ${multipleSelection.length}`" type="info" show-icon /> -->
</div>
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row @selection-change="handleSelectionChange">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="首次访问:">
<span>{{ props.row.create_time }}</span>
</el-form-item>
<el-form-item label="近次访问:">
<span>{{ props.row.last_time }}</span>
</el-form-item>
<el-form-item label="身份证号:">
<span>{{ props.row.card_id }}</span>
</el-form-item>
<el-form-item label="手机号:">
<span>{{ props.row.phone }}</span>
</el-form-item>
<el-form-item label="真实姓名:">
<span>{{ props.row.real_name }}</span>
</el-form-item>
<!-- <el-form-item label="社区贡献值:">-->
<!-- <span>{{ props.row.community_value }}</span>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="角色贡献值:">-->
<!-- <span>{{ props.row.role_value }}</span>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="品宣贡献值:">-->
<!-- <span>{{ props.row.brand_value }}</span>-->
<!-- </el-form-item>-->
<el-form-item label="标签:">
<span v-for="(item, index) in props.row.label" :key="index" v-text="item" />
</el-form-item>
<el-form-item label="生日:">
<span>{{ props.row.birthday }}</span>
</el-form-item>
<el-form-item label="地址:">
<span>{{ props.row.addres }}</span>
</el-form-item>
<el-form-item label="备注:">
<span>{{ props.row.mark }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<!-- <el-table-column type="selection" width="55" /> -->
<el-table-column width="50">
<template slot="header" slot-scope="scope">
<el-popover placement="top-start" width="100" trigger="hover" class="tabPop">
<div>
<span class="spBlock onHand" :class="{'check': chkName === 'dan'}" @click="onHandle('dan',scope.$index)">选中本页</span>
<span class="spBlock onHand" :class="{'check': chkName === 'duo'}" @click="onHandle('duo')">选中全部</span>
</div>
<el-checkbox slot="reference" :value="(chkName === 'dan' && checkedPage.indexOf(userFrom.page) > -1) || chkName === 'duo'" @change="changeType" />
</el-popover>
</template>
<template slot-scope="scope">
<el-checkbox :disabled="scope.row.cancel_time" :value="!scope.row.cancel_time && (checkedIds.indexOf(scope.row.uid) > -1 || (chkName === 'duo' && noChecked.indexOf(scope.row.uid) === -1))" @change="(v)=>changeOne(v,scope.row)" />
</template>
</el-table-column>
<el-table-column prop="uid" label="ID" min-width="60" />
<el-table-column label="头像" min-width="50">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image style="width: 36px; height: 36px" :src="scope.row.avatar ? scope.row.avatar : moren" :preview-src-list="[scope.row.avatar || moren]" />
</div>
</template>
</el-table-column>
<el-table-column label="昵称" min-width="150">
>
<el-table-column label="名称" min-width="150">
<template slot-scope="{row}">
<div class="acea-row">
<i v-show="row.sex===1" class="el-icon-male mr5" style="font-size: 15px; margin-top: 3px; color:#2db7f5;" />
<i v-show="row.sex===2" class="el-icon-female mr5" style="font-size: 15px; margin-top: 3px; color:#ed4014;" />
<div v-text="row.nickname" />
<i v-show="row.sex===1" class="el-icon-male mr5"
style="font-size: 15px; margin-top: 3px; color:#2db7f5;"
/>
<i v-show="row.sex===2" class="el-icon-female mr5"
style="font-size: 15px; margin-top: 3px; color:#ed4014;"
/>
<div v-text="row.name"/>
</div>
</template>
</el-table-column>
<el-table-column prop="is_svip" label="付费会员" min-width="120">
<template slot-scope="{row}">
<span>{{row.is_svip > 0 ? "是" : "否"}}</span>
</template>
</el-table-column>
<el-table-column prop="phone" label="手机号" min-width="120" />
<el-table-column label="等级" min-width="100">
<el-table-column prop="max_role_num" label="最大配置数" min-width="120"/>
<el-table-column prop="ratio" label="贡献值比例" min-width="120">
<template slot-scope="{row}">
<span>{{ row.member?row.member.brokerage_name:'-' }}</span>
<span>{{ row.ratio }}%</span>
</template>
</el-table-column>
<el-table-column label="分组" min-width="100">
<el-table-column prop="is_area" label="是否开启区域限制" min-width="120">
<template slot-scope="{row}">
<span>{{ row.group?row.group.group_name:'无' }}</span>
<span>{{ row.is_area > 0 ? '开启' : '关闭' }}</span>
</template>
</el-table-column>
<el-table-column label="推荐人" min-width="140">
<el-table-column prop="status" label="状态" min-width="120">
<template slot-scope="{row}">
<span>{{ row.spread ? row.spread.nickname + ' / ' + row.spread.uid : '-' }}</span>
<span>{{ row.status > 0 ? '开启' : '关闭' }}</span>
</template>
</el-table-column>
<el-table-column label="用户类型" min-width="100">
<el-table-column label=" 角色代理类型" min-width="100">
<template slot-scope="{row}">
<span>{{ row.user_type === 'routine' ? '小程序' : row.user_type === 'wechat' ? '公众号' : row.user_type === 'app' || row.user_type === 'App' ? 'App' : row.user_type === 'pc' ? 'PC' : 'H5' }}</span>
<span>{{
row.type == '1' ? '全部' : row.type == '2' ? '社区' : row.type == '3' ? '品牌' : row.type == '4' ? '行业' : '无'
}}</span>
</template>
</el-table-column>
<el-table-column prop="now_money" label="余额" sortable min-width="100" :sort-method="(a,b)=>{return a.now_money - b.now_money}"/>
<el-table-column prop="integral" label="当前可用积分" min-width="100" />
<el-table-column label="操作" min-width="130" fixed="right">
<template slot-scope="scope">
<el-button v-if="!scope.row.cancel_time" type="text" size="small" class="mr10" @click="onEdit(scope.row.uid)">编辑</el-button>
<el-dropdown>
<span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="onDetails(scope.row.uid)">用户详情</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMoney(scope.row)">设置余额</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="changeIntegral(scope.row)">设置积分</el-dropdown-item>
<el-dropdown-item v-if="scope.row.vip_name && !scope.row.cancel_time">清除等级</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setGroup(scope.row)">设置分组</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel(scope.row)">设置标签</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setModify(scope.row)">修改推荐人</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setPassword(scope.row)">修改密码</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMember(scope.row)">编辑会员等级</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="giveMember(scope.row)">付费会员设置</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" size="small" class="mr10" @click="getDetail(scope.row.id)">编辑</el-button>
<el-button type="text" size="small" class="mr10" @click="onDel(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="userFrom.limit" :current-page="userFrom.page" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="pageChange" />
<el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="userFrom.limit" :current-page="userFrom.page"
layout="total, sizes, prev, pager, next, jumper" :total="tableData.total"
@size-change="handleSizeChange" @current-change="pageChange"
/>
</div>
</el-card>
<el-dialog title="提示" :visible.sync="visible" width="1000px" :before-close="handleClose" class="dia">
<news-category v-if="visible" :is-show-send="isShowSend" :wechat-ids="wechatIds" :user-ids="ids" :max-cols="maxCols" />
<el-dialog title="提示" :visible.sync="visible" width="1000px" class="dia">
<news-category v-if="visible" :is-show-send="isShowSend" :wechat-ids="wechatIds" :user-ids="ids"
:max-cols="maxCols"
/>
<!--<span slot="footer" class="dialog-footer" />-->
</el-dialog>
<!--账户详情-->
@ -284,8 +79,98 @@
</el-dialog>
<!-- 选择优惠券 -->
<el-dialog v-if="visibleCoupon" title="优惠券列表" :visible.sync="visibleCoupon" width="1000px">
<coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds" :allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess" />
<coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds"
:allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess"
/>
</el-dialog>
<el-dialog :visible.sync="dialogVisible" title="合作人角色">
<el-form :model="formData" ref="form" label-width="120px">
<el-form-item label="角色名称">
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="分润比例">
<el-input v-model="formData.ratio"></el-input>
</el-form-item>
<el-form-item label="是否开启区域限制:">
<el-radio-group v-model="formData.is_area">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择区域" v-if="formData.is_area == 1">
<el-select v-model="formData.area_id" placeholder="请选择" @change="handleTypeChange1">
<el-option
v-for="item in area"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="区域等级">-->
<!-- <el-input v-model="formData.area_level"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="角色最高设置人数(0代表不限)">
<el-input v-model="formData.max_role_num"></el-input>
</el-form-item>
<el-form-item label="角色代理类型:">
<el-radio-group v-model="formData.type">
<el-radio :label="1">全部</el-radio>
<el-radio :label="2">社区</el-radio>
<el-radio :label="3">品牌</el-radio>
<el-radio :label="4">行业</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择品牌" v-if="formData.type == 3">
<el-select v-model="formData.brand_id" placeholder="请选择" @change="handleTypeChange3">
<el-option
v-for="item in brand"
:key="item.brand_id"
:label="item.brand_name"
:value="item.brand_id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择行业" v-if="formData.type == 4">
<el-select v-model="formData.trade_id" placeholder="请选择" @change="handleTypeChange4">
<el-option
v-for="item in trade"
:key="item.store_brand_category_id"
:label="item.cate_name"
:value="item.store_brand_category_id"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -301,20 +186,19 @@
// +----------------------------------------------------------------------
import {
userLstApi,
changeGroupApi,
changelabelApi,
changeNowMoneyApi,
changeNowIntegralApi,
batchChangeGroupApi,
batchChangelabelApi,
userLstApi1,
userLstApi2,
userLstApi3,
userLstApi4,
userLstApi5,
userLstApi6,
userLstApi7,
userLstApi8,
userUpdateApi,
groupLstApi,
labelLstApi,
modifyUserReferrer,
modifyUserPassword,
changeMemberApi,
createUserApi,
giveMemberApi
createUserApi
} from '@/api/user'
import newsCategory from '@/components/newsCategory/index.vue'
import userDetails from './userDetails'
@ -329,65 +213,15 @@ export default {
},
data() {
return {
moren: require("@/assets/images/f.png"),
pickerOptions: {
shortcuts: [{
text: '今天',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()))
picker.$emit('pick', [start, end])
}
},
{
text: '昨天',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1)))
end.setTime(end.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())))
picker.$emit('pick', [start, end])
}
},
{
text: '最近7天',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
},
{
text: '最近30天',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
},
{
text: '本月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), 1)))
picker.$emit('pick', [start, end])
}
},
{
text: '本年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.setTime(new Date(new Date().getFullYear(), 0, 1)))
picker.$emit('pick', [start, end])
}
}
]
},
dialogVisible: false,
formData: {},
brand: {},
area: {},
trade: {},
moren: require('@/assets/images/f.png'),
timeVal: [],
collapse: false,
visibleDetail: false,
@ -457,304 +291,118 @@ export default {
noChecked: [], //
checkedPage: [],
visibleCoupon: false,
couponForm: {
用户标签: '',
用户类型: '',
性别: '',
身份: '',
消费情况: '',
访问情况: '',
访问时间: '',
昵称: ''
},
allCheck: false,
cancel_time: null
}
},
mounted() {
this.groupLists()
this.getTagList()
this.getList('')
},
methods: {
//
onHandle(name) {
this.chkName = this.chkName === name ? '' : name
this.changeType(!(this.chkName === ''))
},
changeType(v) {
if (v) {
if (!this.chkName) {
this.chkName = 'dan'
}
} else {
this.chkName = ''
this.allCheck = false;
}
const index = this.checkedPage.indexOf(this.userFrom.page)
if (this.chkName === 'dan') {
this.checkedPage.push(this.userFrom.page)
} else if (index > -1) {
this.checkedPage.splice(index, 1)
}
this.syncCheckedId()
},
syncCheckedId() {
// const ids = this.tableData.data.map(v => v.uid)
const ids = this.tableData.data.map(v => {
if (!v.cancel_time) {
return v.uid
}
})
if (this.chkName === 'duo') {
this.checkedIds = []
this.allCheck = true;
} else if (this.chkName === 'dan') {
this.allCheck = false;
ids.forEach(id => {
const index = this.checkedIds.indexOf(id)
if (index === -1) {
this.checkedIds.push(id)
}
})
} else {
ids.forEach(id => {
const index = this.checkedIds.indexOf(id)
if (index > -1) {
this.checkedIds.splice(index, 1)
}
})
}
this.getList1()
},
//
changeOne(v, user) {
if (v) {
if (this.chkName === 'duo') {
const index = this.noChecked.indexOf(user.uid)
if (index > -1) this.noChecked.splice(index, 1)
} else {
const index = this.checkedIds.indexOf(user.uid)
if (index === -1) this.checkedIds.push(user.uid)
}
} else {
if (this.chkName === 'duo') {
const index = this.noChecked.indexOf(user.uid)
if (index === -1) this.noChecked.push(user.uid)
} else {
const index = this.checkedIds.indexOf(user.uid)
if (index > -1) this.checkedIds.splice(index, 1)
}
}
console.log("分开选择",this.checkedIds)
methods: {
handleTypeChange1(value) {
this.formData.area_id = value
},
//
sendCoupon(){
if(this.checkedIds.length == 0 && this.allCheck == false){
this.$message.warning('请选择用户')
}else{
this.visibleCoupon = true;
}
},
sendSuccess(){
this.visibleCoupon = false;
},
getCoupounParmas(){
let label_id = this.userFrom.label_id == '' ? '' : this.getLabelValue(),
user_type = this.findKey(this.userFrom.user_type,{'':'','微信用户':'wechat','小程序用户':'routine','H5用户':'h5'}),
sex = this.findKey(this.userFrom.sex,{'男':'1','女':'2','保密':'0','':''}),
pay_count = this.findKey(this.userFrom.sex,{'0次':'-1','1次以上':'0','2次以上':'1','3次以上':'2','4次以上':'3','5次以上':'4','': ''}),
is_promoter = this.findKey(this.userFrom.is_promoter,{'推广员':'1','普通用户':'0','':''}),
user_time_type = this.userFrom.user_time_type == 'visit' ? '最后访问' : this.userFrom.user_time_type == 'add_time' ? '首次访问' : ''
this.couponForm = {
用户标签: label_id,
用户类型: user_type,
性别: sex,
消费情况: pay_count,
身份: is_promoter,
访问情况: user_time_type,
访问时间: this.userFrom.user_time,
昵称: this.userFrom.nickname
}
},
findKey(value,data, compare = (a, b) => a === b) {
return Object.keys(data).find(k => compare(data[k], value))
},
getLabelValue(){
let labelName = ''
for(let i = 0; i < this.labelLists.length; i ++) {
if(this.labelLists[i]['label_id'] === this.userFrom.label_id) {
labelName = this.labelLists[i]['label_name']
return labelName
}
}
},
//
selectChange(tab) {
this.timeVal = []
this.userFrom.user_time = tab
this.getList('')
},
//
onchangeTime(e) {
this.timeVal = e
this.userFrom.user_time = e ? this.timeVal.join('-') : ''
handleTypeChange3(value) {
this.formData.brand_id = value
},
userSearchs() {
if(this.userFrom.user_time_type && (!this.userFrom.user_time)){
this.$message.error('请选择访问时间')
}else if(!this.userFrom.user_time_type && (this.userFrom.user_time)){
this.$message.error('请选择访问情况')
}else{
this.getList(1)
}
},
//
createUser() {
this.$modalForm(createUserApi()).then(() => this.getList(''))
handleTypeChange4(value) {
this.formData.trade_id = value
},
//
groupLists() {
groupLstApi({
page: 1,
limit: 9999
}).then(async res => {
this.groupList = res.data.list
submitForm() {
console.log(this.formData)
if(this.formData.id){
userLstApi7(this.formData).then(res => {
}).catch(res => {
this.$message.error(res.message)
})
},
//
getTagList() {
labelLstApi({
page: 1,
limit: 9999
}).then(res => {
this.labelLists = res.data.list
}else{
userLstApi5(this.formData).then(res => {
}).catch(res => {
this.$message.error(res.message)
})
},
//
onDetails(id) {
this.uid = id
this.cancel_time = this.tableData.data.find(item => item.uid === id).cancel_time
this.visibleDetail = true
},
Close() {
this.visibleDetail = false
},
sendNews() {
if (this.checkedIds.length === 0 && this.allCheck == false) return this.$message.warning('请先选择用户')
this.visible = true
this.wechatIds = this.getWechatUsers(this.tableData.data, this.checkedIds)
},
handleClose() {
this.visible = false
},
/**获取选中的微信用户Id */
getWechatUsers(arr1, arr2){
let newArr = [];
if(this.allCheck){
for (let i = 0; i < arr1.length; i++) {
if(arr1[i]['wechat_user_id']){
newArr.push(arr1[i]['wechat_user_id']);
}
}
}else{
for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) {
if(arr1[i]['uid'] === arr2[j] && arr1[i]['wechat_user_id']){
newArr.push(arr2[j]);
}
}
}
}
return newArr;
},
handleSelectionChange(val) {
this.multipleSelection = val
const data = []
const wechatData = []
this.multipleSelection.map((item) => {
data.push(item.uid)
wechatData.push(item.wechat_user_id)
})
this.ids = data.join(',')
this.wechatIds = wechatData.join(',')
},
//
setGroup(row) {
this.$modalForm(changeGroupApi(row.uid)).then(() => this.getList(''))
},
//
batchGroup() {
if (this.checkedIds.length === 0) return this.$message.warning('请先选择用户')
this.$modalForm(batchChangeGroupApi({
ids: (this.checkedIds).join(",")
}))
},
//
batchlabel() {
if (this.checkedIds.length === 0) return this.$message.warning('请先选择用户')
this.$modalForm(batchChangelabelApi({
ids: (this.checkedIds).join(",")
}))
},
//
setLabel(row) {
this.$modalForm(changelabelApi(row.uid)).then(() => this.getList(''))
},
//
setMember(row) {
this.$modalForm(changeMemberApi(row.uid)).then(() => this.getList(''))
},
//
giveMember(row) {
this.$modalForm(giveMemberApi(row.uid)).then(() => this.getList(''))
},
//
setModify(row){
this.$modalForm(modifyUserReferrer(row.uid)).then(({ message }) => {
this.getList('');
});
},
//
setPassword(row){
this.$modalForm(modifyUserPassword(row.uid)).then(() => this.getList(''));
},
//
setMoney(row) {
this.$modalForm(changeNowMoneyApi(row.uid)).then(() => this.getList(''))
},
//
changeIntegral(row){
this.$modalForm(changeNowIntegralApi(row.uid)).then(() => this.getList(''))
}
this.$message.success('成功')
this.dialogVisible = false //
this.getList('')
},
//
getList(num) {
this.listLoading = true
this.userFrom.page = num ? num : this.userFrom.page;
this.userFrom.page = num ? num : this.userFrom.page
this.userFrom.user_type = this.user_type
this.userFrom.province = this.address[0]
this.userFrom.city = this.address[1]
if (this.userFrom.user_type === '0') this.userFrom.user_type = ''
userLstApi(this.userFrom).then(res => {
userLstApi2(this.userFrom).then(res => {
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
this.getCoupounParmas();
this.checkedIds = [];
this.checkedIds = []
}).catch(res => {
this.listLoading = false
this.$message.error(res.message)
})
},
getList1(num) {
userLstApi1(this.userFrom).then(res => {
this.brand = res.data
}).catch(res => {
})
userLstApi3(this.userFrom).then(res => {
this.area = res.data
}).catch(res => {
})
userLstApi4(this.userFrom).then(res => {
this.trade = res.data
}).catch(res => {
})
},
onadd(){
this.formData = ''
this.dialogVisible = true //
},
getDetail(id) {
userLstApi6(id).then(res => {
this.formData = res.data
this.dialogVisible = true //
}).catch(res => {
})
},
onDel(id) {
userLstApi8(id).then(res => {
this.$message.success('成功')
this.dialogVisible = false //
this.getList('')
}).catch(res => {
})
},
pageChange(page) {
this.userFrom.page = page
this.getList('')
@ -763,10 +411,7 @@ export default {
this.userFrom.limit = val
this.getList('')
},
//
onEdit(id) {
this.$modalForm(userUpdateApi(id)).then(() => this.getList(''))
},
//
reset() {
this.userFrom = {
@ -795,6 +440,7 @@ export default {
.check {
color: #00a2d4;
}
.selWidth {
// width: 100% !important;
}

Loading…
Cancel
Save