lion 1 year ago
parent 1ea14113b9
commit cffc3b996b

@ -59,7 +59,8 @@ export function visitLog(params) {
return request({
method: "get",
url: "/api/admin/visit-log/index",
params
params,
paramsSerializer: customParamsSerializer,
})
}

@ -102,7 +102,7 @@
} from "@/api/customer/message.js"
import {
index as getProduct
} from "@/api/product/index.js"
} from "@/api/product/category.js"
import customerMixin from "@/mixin/customer.js"
export default {
mixins:[customerMixin],
@ -112,11 +112,14 @@
id: '',
type: 'add',
typeList: [{
id: 0,
value: 'Contact Us'
}, {
id: 1,
value: 'Question'
}, {
id: 2,
value: 'Request Free Sample'
}, {
id: 3,
value: 'Contact Us'
}],
productList:[],
form: {
@ -148,6 +151,8 @@
methods: {
async getProductList() {
const res = await getProduct({
type:2,
// is_recommend:1,
page_size: 9999,
page: 1
})
@ -195,10 +200,11 @@
product_id: '',
full_name: '',
email: '',
region: '',
region: '',
organization: '',
question: '',
additional: '',
organization: '',
product_name: '',
}
this.$refs['dialog'].reset()

@ -9,12 +9,12 @@
<!-- <div>
<el-input v-model="select.question" placeholder="Question"></el-input>
</div> -->
<div>
<!-- <div>
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
</div>
</div> -->
<!-- <div>
<el-button type="primary" size="small" @click="editNote('add')">add</el-button>
</div> -->

@ -7,7 +7,19 @@
<div slot="content">
<div class="searchwrap" style="display: flex;align-items: center;">
<div>
<el-input v-model="select.name" placeholder="Name"></el-input>
<el-input v-model="select.name" placeholder="First Name"></el-input>
</div>
<div>
<el-input v-model="select.last_name" placeholder="Last Name"></el-input>
</div>
<div>
<el-input v-model="select.email" placeholder="Email"></el-input>
</div>
<div>
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDate"
v-model="dateRange" type="datetimerange" range-separator="To" start-placeholder="Start Date"
end-placeholder="End Date">
</el-date-picker>
</div>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
@ -15,6 +27,9 @@
<div>
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="exportExcel">export</el-button>
</div>
<!-- <div>
<el-button type="primary" size="small" @click="editCustomer('add')">add</el-button>
</div> -->
@ -52,18 +67,25 @@
index,
destroy
} from "@/api/customer";
import {
download
} from "@/utils/downloadRequest";
export default {
components: {
showCustomer,
showCustomer,
addCustomer
},
data() {
return {
select: {
name: '',
last_name: '',
email: '',
page: 1,
page_size: 10,
},
dateRange: [],
range: '',
total: 0,
list: [],
table_item: [{
@ -106,8 +128,8 @@
width: 360
},
{
prop: 'Created At',
label: 'created_at',
prop: 'created_at',
label: 'Created At',
align: 'left',
width: 240
}
@ -135,15 +157,85 @@
resetSearch() {
this.select.page = 1
this.select.name = ''
this.select.last_name = ''
this.select.email = ''
this.range = ''
this.dateRange = ''
this.getList()
},
changeDate(e) {
if (e) {
console.log("e", e)
this.range = e.join(",") + ''
} else {
this.range = ''
}
},
async getList() {
const res = await index({
...this.select
...this.select,
filter: [{
key: 'first_name',
op: 'eq',
value: this.select.name
}, {
key: 'last_name',
op: 'eq',
value: this.select.last_name
}, {
key: 'email',
op: 'like',
value: this.select.email
}, {
key: 'created_at',
op: 'range',
value: this.range ? this.range : ''
}]
})
this.list = res.data
this.total = res.total
},
exportExcel() {
if (!this.range) {
this.$Message.warning('Select a time period to export')
return
}
let _export = {}
this.table_item.map(item => {
if (item.type === 'index') {
} else {
_export[item.prop] = item.label
}
})
download(
'/api/admin/user/index',
'get', {
export_fields: _export,
...this.select,
filter: [{
key: 'first_name',
op: 'eq',
value: this.select.name
}, {
key: 'last_name',
op: 'eq',
value: this.select.last_name
}, {
key: 'email',
op: 'like',
value: this.select.email
}, {
key: 'created_at',
op: 'range',
value: this.range ? this.range : ''
}],
is_export: 1,
page: 1,
page_size: 999
},
`Customer List.xlsx`)
},
editCustomer(type, id) {
if (type == 'editor') {
this.$refs.addCustomer.id = id
@ -154,8 +246,8 @@
},
deleteList(id) {
var that = this;
destroy({
id:id
destroy({
id: id
}).then(response => {
this.$Message.success('Success');
this.getList()

@ -9,6 +9,21 @@
<div>
<el-input v-model="select.question" placeholder="Question"></el-input>
</div>
<div>
<el-input v-model="select.email" placeholder="Email"></el-input>
</div>
<div>
<el-select clearable style="width:100%" v-model="select.type" placeholder="Type">
<el-option v-for="(item,index) in typeList" :key="index" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDate"
v-model="dateRange" type="datetimerange" range-separator="To" start-placeholder="Start Date"
end-placeholder="End Date">
</el-date-picker>
</div>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
</div>
@ -24,13 +39,23 @@
</lx-header>
</div>
</div>
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange"
@pageSizeChange="pageSizeChange" :table-item="table_item">
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
:table-item="table_item">
<template v-slot:type>
<el-table-column align='left' label="Type" width="180" header-align="center">
<template slot-scope="scope">
<div v-for="item in typeList">
<span v-if="item.id==scope.row.type">{{item.value}}</span>
</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' fixed="right" label="Operate" width="180" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editNote('editor',scope.row.id)">edit</el-button>
<el-popconfirm confirm-button-text="confirm" cancel-button-text="cancel" style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="Are you sure to delete it?">
<el-popconfirm confirm-button-text="confirm" cancel-button-text="cancel" style="margin:0 10px"
@confirm="deleteList(scope.row.id)" title="Are you sure to delete it?">
<el-button type="danger" size="small" slot="reference">delete</el-button>
</el-popconfirm>
</template>
@ -43,9 +68,9 @@
<script>
import addMessage from './components/addMessage.vue';
import {
index,
destroy
import {
index,
destroy
} from "@/api/customer/message.js"
export default {
components: {
@ -55,20 +80,46 @@
return {
select: {
question: '',
email: '',
type: '',
page: 1,
page_size: 10,
},
dateRange: [],
range: '',
total: 0,
list: [],
typeList: [{
id: 1,
value: 'Question'
}, {
id: 2,
value: 'Request Free Sample'
}, {
id: 3,
value: 'Contact Us'
}],
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
},{
prop: 'question',
label: 'Question',
}, {
prop: 'type',
label: 'Type',
align: 'left',
// width:240
}, {
prop: 'email',
label: 'Email',
align: 'left',
}
// width:240
}, {
prop: 'created_at',
label: 'Created At',
align: 'left',
width: 180
},
]
}
@ -80,7 +131,7 @@
editNote(type, id) {
if (type == 'editor') {
this.$refs.addMessage.id = id
}
}
this.$refs.addMessage.type = type
this.$refs.addMessage.isShow = true
},
@ -96,24 +147,48 @@
resetSearch() {
this.select.page = 1
this.select.question = ''
this.select.email = ''
this.select.type = ''
this.range = ''
this.dateRange = ''
this.getList()
},
async getList() {
const res = await index({
...this.select,
filter:[{
key:'question',
op:'like',
value:this.select.question
}]
changeDate(e) {
if (e) {
console.log("e", e)
this.range = e.join(",") + ''
} else {
this.range = ''
}
},
async getList() {
const res = await index({
...this.select,
filter: [{
key: 'question',
op: 'like',
value: this.select.question
}, {
key: 'type',
op: 'eq',
value: this.select.type
}, {
key: 'email',
op: 'like',
value: this.select.email
}, {
key: 'created_at',
op: 'range',
value: this.range ? this.range : ''
}]
})
this.list = res.data
this.total = res.total
},
deleteList(id) {
var that = this;
destroy({
id:id
destroy({
id: id
}).then(response => {
this.$Message.success('Success');
this.getList()

@ -6,15 +6,24 @@
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
<div class="searchwrap" style="display: flex;align-items: center;">
<!-- <div>
<el-input v-model="select.name" placeholder="Name"></el-input>
<div>
<el-input v-model="select.email" placeholder="Email"></el-input>
</div>
<div>
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="changeDate" v-model="dateRange" type="datetimerange" range-separator="To" start-placeholder="Start Date"
end-placeholder="End Date">
</el-date-picker>
</div>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
</div> -->
</div>
<div>
<el-button type="primary" size="small" @click="exportExcel">export</el-button>
</div>
</div>
</div>
@ -33,15 +42,22 @@
<script>
import {
visitLog
} from "@/api/customer";
} from "@/api/customer";
import {
download
} from "@/utils/downloadRequest";
export default {
components: {},
data() {
return {
select: {
return {
dateRange:[],
select: {
email:'',
page: 1,
page_size: 10,
},
},
range:'',
total: 0,
list: [],
table_item: [{
@ -93,16 +109,63 @@
},
resetSearch() {
this.select.page = 1
this.select.name = ''
this.select.email = ''
this.range = ''
this.dateRange = ''
this.getList()
},
changeDate(e){
if(e){
console.log("e",e)
this.range = e.join(",")+''
}else{
this.range= ''
}
},
async getList() {
const res = await visitLog({
...this.select,
show_relation: ['user', 'productCategory'],
email: this.select.email,
filter: [{
key: 'created_at',
op: 'range',
value: this.range ? this.range : ''
}]
})
this.list = res.data
this.total = res.total
},
exportExcel() {
if(!this.range){
this.$Message.warning('Select a time period to export')
return
}
let _export = {}
this.table_item.map(item => {
if (item.type === 'index') {
} else {
_export[item.prop] = item.label
}
})
download(
'/api/admin/visit-log/index',
'get', {
export_fields: _export,
...this.select,
show_relation: ['user', 'productCategory'],
email: this.select.email,
filter: [{
key: 'created_at',
op: 'range',
value: this.range ? this.range : ''
}],
is_export: 1,
page: 1,
page_size: 999
},
`Visit Log.xlsx`)
},
}
}

@ -50,6 +50,9 @@
</div>
<div>
<el-button type="primary" size="small" @click="editProduct('add')">add</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="exportExcel">export</el-button>
</div>
</div>
</div>
@ -94,7 +97,13 @@
} from "@/api/product/index.js"
import {
index as getCategory
} from "@/api/product/category.js"
} from "@/api/product/category.js"
import {
download
} from "@/utils/downloadRequest";
import {
getToken
} from '@/utils/auth'
export default {
components: {
addProduct
@ -159,12 +168,25 @@
label: 'List Price',
align: 'left',
width: 240
},
{
prop: 'is_top',
label: 'Top',
align: 'center',
width: 120,
is_text:true,
text_prop:'is_top_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
},
{
prop: 'is_visible',
label: 'Visible',
align: 'center',
width: 120,
width: 120,
is_text:true,
text_prop:'is_visible_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
@ -173,7 +195,9 @@
prop: 'is_sell',
label: 'Active',
align: 'center',
width: 120,
width: 120,
is_text:true,
text_prop:'is_sell_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
@ -182,7 +206,9 @@
prop: 'show_price',
label: 'Web Visibility',
align: 'center',
width: 180,
width: 180,
is_text:true,
text_prop:'show_price_text',
formatter: (cell, data, value) => {
if(value==1){
return 'Need to contact sales'
@ -268,6 +294,57 @@
})
this.list = res.data
this.total = res.total
},
exportExcel() {
let _export = {}
this.table_item.map(item => {
if (item.type === 'index') {
}else if(item.is_text){
_export[item.text_prop] = item.label
} else {
_export[item.prop] = item.label
}
})
_export['product_details'] = 'Product Details'
download(
'/api/admin/product/index',
'get', {
export_fields: _export,
...this.select,
category_id:this.select.category_id,
show_relation:['productDetails'],
sort_name:'time',
sort_type:'desc',
filter: [{
key: 'name',
op: 'like',
value: this.select.name
},{
key: 'number',
op: 'like',
value: this.select.number
},{
key: 'is_sell',
op: 'like',
value: this.select.is_sell
},{
key: 'is_top',
op: 'like',
value: this.select.is_top
},{
key: 'show_price',
op: 'like',
value: this.select.show_price
},{
key: 'is_visible',
op: 'like',
value: this.select.is_visible
}],
is_export: 1,
page: 1,
page_size: 999
},
`Products.xlsx`)
},
async getCategoryList() {
const res = await getCategory({

Loading…
Cancel
Save