You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

534 lines
17 KiB

3 years ago
<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" text="会员订单统计" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div class="selector">
<div class="selector-item">
<div class="selector-item__label">关键词</div>
2 years ago
<Input v-model="select.keywords" clearable style="width: 100px;" placeholder="关键字搜索" />
3 years ago
</div>
<div class="selector-item">
<div class="selector-item__label">区域</div>
2 years ago
<Select clearable v-model="select.area" style="width: 100px;" placeholder="选择区域搜索">
2 years ago
<Option v-for="item in areas" :value="item.value">{{item.value}}</Option>
3 years ago
</Select>
</div>
<div class="selector-item">
2 years ago
<div class="selector-item__label">建卡医院</div>
<Select clearable v-model="select.hospital" style="width: 100px;" placeholder="选择建卡医院搜索">
2 years ago
<Option v-for="item in arrHospital" :value="item.value">{{item.value}}</Option>
2 years ago
</Select>
<!-- <Input clearable v-model="select.hospital" style="width: 100px;" placeholder="建卡医院搜索" /> -->
3 years ago
</div>
<div class="selector-item">
<el-checkbox v-model="select.is_phone"></el-checkbox>
2 years ago
</div>
<div class="selector-item">
2 years ago
<div class="selector-item__label">支付时间</div>
2 years ago
<el-date-picker
v-model="dateRange"
@change='dateChange'
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
2 years ago
</div>
2 years ago
<div class="selector-item">
<div class="selector-item__label">核销时间</div>
<el-date-picker
v-model="dateRangeCancel"
@change='dateChangeCancel'
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
<div class="selector-item">
<div class="selector-item__label">注册时间</div>
<el-date-picker
v-model="dateRangeReg"
@change='dateChangeReg'
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
2 years ago
<div class="selector-item">
<div class="selector-item__label">核销数</div>
<Input clearable v-model="select.write_off" style="width: 50px;margin:0 3px" placeholder="" />
<div class="selector-item__label">及以上</div>
</div>
<div class="selector-item">
<div class="selector-item__label">下单数</div>
<Input clearable v-model="select.order_count" style="width: 50px;margin:0 3px" placeholder="" />
<div class="selector-item__label">及以上</div>
2 years ago
</div>
<div class="selector-item">
<div class="selector-item__label">活动情况</div>
<Select clearable v-model="select.active_member" style="width: 100px;" placeholder="选择建卡医院搜索">
<Option v-for="item in activeStatus" :value="item.id">{{item.label}}</Option>
</Select>
3 years ago
</div>
<div class="selector-item">
<Button type="primary" @click="doSearch"></Button>
</div>
<div class="selector-item">
<Button type="primary" @click="exportExel"></Button>
</div>
</div>
</slot>
</lx-header>
</div>
<xy-table :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange" :list="list"
:table-item="table">
<template slot="btns">
<div></div>
</template>
</xy-table>
</div>
</template>
<script>
import {
index,
destroy
2 years ago
} from '@/api/member'
import {getparameteritem} from '@/api/system/dictionary.js'
3 years ago
import {
parseTime
} from "@/utils"
import {
download
} from '@/utils/downloadRequest'
import {
Message
} from 'element-ui'
export default {
components: {
},
data() {
return {
select: {
pageSize: 10,
pageIndex: 1,
keywords: "",
area: "",
hospital: "",
2 years ago
is_phone: false,
2 years ago
create_time:'',
2 years ago
over_time:'',
2 years ago
finish_start_date:'',
finish_end_date:'',
register_start_date:'',
register_end_date:'',
2 years ago
order_count:'',
write_off:'',
total_related_person:'',
start_date:'',
end_date:'',
product_pid:'',
2 years ago
product_type_list:[],
active_member:''
2 years ago
},
2 years ago
arrHospital: [],
activeStatus:[{
id:'',
label:'全部'
},{
id:1,
label:'活动下单'
},{
id:2,
label:'产品、活动下单'
}],
2 years ago
dateRange:[],
dateRangeCancel:[],
dateRangeReg:[],
2 years ago
areas: [],
statusNames:[{
id:0,
name:'申请取消'
},{
id:1,
name:'待核销'
},{
id:2,
name:'已取消'
},{
id:3,
name:'已核销'
}],
3 years ago
total: 0,
list: [],
table: [{
prop: 'name',
label: '姓名',
width: 180,
sortable: false,
fixed: 'left'
},
{
prop: 'phone',
label: '电话',
width: 220
},
{
prop: 'order_count',
label: '累计下单数',
width: 180,
customFn: (row) => {
return ( <span
style={
{
cursor: 'pointer',
color: "blue",
textDecoration: "underline"
}
}
on = {
{
['click']: (e) => {
if(row.order_count<1){
return
}
2 years ago
let url =`/admin/#/order/orderList?user_id=${row.id}`
let seeBuy = window.open(url, 'seeBuy','location=0')
// this.$router.push({
// path: `/order/orderList?user_id=${row.id}`,
// })
3 years ago
}
}
}
> {
row.order_count
} </span>)
}
},
2 years ago
{
prop: 'order_finish',
label: '核销数',
width: 180,
align:"center"
},
3 years ago
{
prop: 'order_sum',
label: '累计下单金额',
width: 180,
align:"right",
customFn:(row)=>{
return(
<span>{row.order_sum?row.order_sum:'0.00'}</span>
)
}
2 years ago
},
{
2 years ago
prop: 'order',
label: '下单详情',
width: 480,
align:"left",
customFn:(row)=>{
if(row.order.length>0){
return row.order.map((k,index)=> {
return (<div style={{'cursor':'pointer','padding':'1px'}}
on = {
{
['click']: (e) => {
2 years ago
let url =`/admin/#/order/orderList?order_item_id=${k.items.id}`
let seeBuy = window.open(url, 'seeBuy','location=0')
// this.$router.push({
// path: `/order/orderList?order_item_id=${k.items.id}`,
// })
2 years ago
}
}
}>
<div>
<span style={{'color':k.state=='finished'?'red':'#000'}}>{index+1}{k.items?.state_name}</span>-
2 years ago
<span>{k.items.updated_at}</span>-
2 years ago
<span>{ k.order_name}</span>
</div>
</div>)
})
}
2 years ago
}
},
{
prop: 'active',
label: '活动详情',
width: 480,
align:"left",
customFn:(row)=>{
if(row.order.length>0){
return row.active.map((k,index)=> {
for(let s of this.statusNames){
if(s.id===k.state){
k.state_name = s.name
}
}
return (<div style={{'padding':'1px'}}>
<div>
<span style={{'color':k.state==3?'red':'#000'}}>{index+1}{k.state_name}</span>-
<span>{ k.active_name}</span>
</div>
</div>)
})
}
2 years ago
}
3 years ago
},
{
prop: 'due_date',
label: '预产期',
width: 200
},
{
prop: 'area',
label: '所属区域',
width: 160,
},
{
prop: 'address',
label: '住址',
align: 'left',
minWidth: 300
},
{
prop: 'hospital',
label: '建卡医院',
width: 200
},
{
prop: 'promotion',
label: '推广人员',
width: 140,
customFn: (row) => {
return ( < Tag color = {
row.promotion == 1 ? 'success' : 'error'
} > {
row.promotion == 1 ? '是' : '否'
} </Tag>)
}
},
{
prop: 'created_at',
label: '注册日期',
width: 200,
fixed:'right',
formatter: (cell, data, value) => {
return parseTime(new Date(value), '{y}-{m}-{d}')
}
}
]
}
},
2 years ago
methods: {
2 years ago
2 years ago
dateChange(e){
if(e){
this.select.create_time = this.dateRange[0]
this.select.over_time = this.dateRange[1]
}else{
this.select.create_time = ''
this.select.over_time = ''
}
2 years ago
},
dateChangeCancel(e){
if(e){
this.select.finish_start_date = this.dateRangeCancel[0]
this.select.finish_end_date = this.dateRangeCancel[1]
}else{
this.select.finish_start_date = ''
this.select.finish_end_date = ''
}
},
dateChangeReg(e){
if(e){
this.select.register_start_date = this.dateRangeReg[0]
this.select.register_end_date = this.dateRangeReg[1]
}else{
this.select.register_start_date = ''
this.select.register_end_date = ''
}
2 years ago
},
3 years ago
pageSizeChange(e) {
this.select.pageSize = e
this.doSearch();
},
doSearch() {
this.select.pageIndex = 1
this.getMembers()
},
pageChange(e) {
this.select.pageIndex = e
this.getMembers()
},
2 years ago
async getArea(){
const res = await getparameteritem('area')
this.areas = res.detail
},
async getHospital(){
const res = await getparameteritem('hospital')
this.arrHospital = res.detail
},
3 years ago
async getMembers() {
const res = await index({
page_size: this.select.pageSize,
page: this.select.pageIndex,
keyword: this.select.keywords,
hospital: this.select.hospital,
area: this.select.area,
2 years ago
is_phone: this.select.is_phone ? 1 : "",
create_time:this.select.create_time,
2 years ago
finish_start_date:this.select.finish_start_date,
finish_end_date:this.select.finish_end_date,
register_start_date:this.select.register_start_date,
register_end_date:this.select.register_end_date,
2 years ago
over_time:this.select.over_time,
write_off:this.select.write_off,
order_count:this.select.order_count,
total_related_person:this.select.total_related_person,
start_date:this.select.start_date,
end_date:this.select.end_date,
product_pid:this.select.product_pid,
2 years ago
product_type_list:this.select.product_type_list,
active_member:this.select.active_member
3 years ago
})
this.total = res.total
this.list = res.data
},
exportExel() {
download('/api/admin/member/index', 'get', {
2 years ago
is_export: 2,
3 years ago
keyword: this.select.keywords,
hospital: this.select.hospital,
area: this.select.area,
2 years ago
is_phone: this.select.is_phone ? 1 : "",
create_time:this.select.create_time,
over_time:this.select.over_time,
2 years ago
finish_start_date:this.select.finish_start_date,
finish_end_date:this.select.finish_end_date,
register_start_date:this.select.register_start_date,
register_end_date:this.select.register_end_date,
2 years ago
write_off:this.select.write_off,
order_count:this.select.order_count,
total_related_person:this.select.total_related_person,
start_date:this.select.start_date,
end_date:this.select.end_date,
product_pid:this.select.product_pid,
2 years ago
product_type_list:this.select.product_type_list,
active_member:this.select.active_member
2 years ago
3 years ago
}, '用户列表.xlsx')
},
reloadUser(){
console.log("this.$route",this.$route)
// return
if(this.$route.query?.total_related_person){
this.select.total_related_person = this.$route.query.total_related_person
}
if(this.$route.query?.start_date){
this.select.start_date = this.$route.query.start_date
}
if(this.$route.query?.end_date){
this.select.end_date = this.$route.query.end_date
}
if(this.$route.query?.product_pid){
this.select.product_pid = this.$route.query.product_pid
}
if(this.$route.query?.product_type_list){
this.select.product_type_list = this.$route.query.product_type_list.split(',')
}
this.getMembers()
}
3 years ago
},
mounted() {
2 years ago
this.getArea()
this.getHospital()
this.reloadUser()
},
watch:{
'$route.query.total_related_person'(newval){
if(newval){
this.reloadUser()
}
},
'$route.query.start_date'(newval){
if(newval){
this.reloadUser()
}
},
'$route.query.end_date'(newval){
if(newval){
this.reloadUser()
}
},
'$route.query.product_pid'(newval){
if(newval){
this.reloadUser()
}
},
'$route.query.product_type_list'(newval){
if(newval){
console.log("newval",newval)
this.reloadUser()
}
}
3 years ago
}
}
</script>
<style scoped lang="scss">
.selector {
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
&-item {
display: flex;
align-items: center;
align-content: center;
margin-top: 6px;
margin-right: 10px;
&__label {
word-break: keep-all;
}
}
2 years ago
}
.el-range-editor.el-input__inner{
height:32px;
width:250px;
}
.el-date-editor{
::v-deep .el-range__icon{
line-height: 26px!important;
}
::v-deep .el-range-separator{
line-height: 26px!important;
}
::v-deep .el-range__close-icon{
line-height: 26px!important;
}
3 years ago
}
</style>