Commit 1bce1eea by xinla

Merge branch 'develop' of https://e.coding.net/linkwechat/linkwechat-front/linkwechat into develop

2 parents e70774e9 0e93337c
...@@ -71,7 +71,7 @@ export function add(data) { ...@@ -71,7 +71,7 @@ export function add(data) {
* 修改 * 修改
* @param {*} data 同新增 * @param {*} data 同新增
*/ */
export function update(id, data) { export function update(data, id) {
return request({ return request({
url: service + '/update/' + id, url: service + '/update/' + id,
method: 'put', method: 'put',
...@@ -85,7 +85,30 @@ export function update(id, data) { ...@@ -85,7 +85,30 @@ export function update(id, data) {
*/ */
export function remove(ids) { export function remove(ids) {
return request({ return request({
url: service + '/' + ids, url: service + '/delete/' + ids,
method: 'DELETE', method: 'DELETE',
}) })
} }
// 商品详情统计
export function getDetailTotal(id) {
return request({
url: service + '/statistics/' + id,
})
}
// 商品详情折线图
export function getDetailChart(data) {
return request({
url: service + '/lineChart',
data,
method:'post'
})
}
// 商品详情top5
export function getDetailTable(id) {
return request({
url: service + '/top5/' + id
})
}
\ No newline at end of file \ No newline at end of file
<template>
<div class="search">
<div class="item">
<el-button-group>
<el-button size="mini" @click="setType(1)" :type="active === 1 ? 'primary' : ''">近一周</el-button>
<el-button size="mini" @click="setType(2)" :type="active === 2 ? 'primary' : ''">近一月</el-button>
<el-button size="mini" @click="setType(3)" :type="active === 3 ? 'primary' : ''">自定义</el-button>
</el-button-group>
</div>
<div class="item" v-if="active === 3">
<el-date-picker
style="width: 250px;"
@change="setTime"
size="mini"
clearable
v-model="value"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>
</div>
</template>
<script>
import moment from 'moment'
export default {
name: 'search-title',
props: {},
data() {
return {
active: 1,
value: [],
options: [{ value: 10, label: '1123' }],
value2: [],
data: {
beginTime: '',
endTime: ''
},
sceneList: [],
customerList: [],
manList: []
}
},
methods: {
submit() {
this.$emit('search', this.data)
},
setTime(e) {
if (e) {
this.data.beginTime = moment(e[0]).format('YYYY-MM-DD')
this.data.endTime = moment(e[1]).format('YYYY-MM-DD')
} else {
this.data.beginTime = ''
this.data.endTime = ''
}
this.submit()
},
setType(type) {
this.active = type
if (type === 1) {
const weekStart = moment().subtract(6, 'days').format('YYYY-MM-DD')
const weekEnd = moment().format('YYYY-MM-DD')
this.data.beginTime = weekStart
this.data.endTime = weekEnd
this.submit()
} else if (type === 2) {
this.data.endTime = moment().format('YYYY-MM-DD')
this.data.beginTime = moment().subtract(29, 'days').format('YYYY-MM-DD')
this.submit()
}
}
},
created() {
this.setType(1)
}
}
</script>
<style lang="scss" scoped>
.search {
display: flex;
align-items: center;
.item {
margin-right: 20px;
}
}
</style>
...@@ -51,36 +51,6 @@ const devRoutes = [ ...@@ -51,36 +51,6 @@ const devRoutes = [
}, },
], ],
}, },
{
path: '/commodityCenter',
component: Layout,
hidden: true,
meta: {
title: '商品中心',
},
children: [
{
path: 'commodityManage',
name: 'group-code-analyse',
component: (resolve) => require(['@/views/commodityCenter/commodityManage/list'], resolve),
meta: {
title: '商品管理',
activeMenu: '/commodityCenter/commodityManage',
breadcrumb: true,
},
},
{
path: 'detail',
name: 'group-code-analyse',
component: (resolve) => require(['@/views/commodityCenter/commodityManage/detail'], resolve),
meta: {
title: '商品管理',
activeMenu: '/commodityCenter/commodityManage',
breadcrumb: true,
},
},
],
},
] ]
// 公共路由 // 公共路由
......
<script> <script>
import RemoteDataView from '@/components/RemoteDataView' import CardGroupIndex from '@/components/CardGroupIndex'
import CardGroupIndex from '@/components/CardGroupIndex' import TimeSearchTitle from '@/components/common/TimeSearchTitle'
import * as api from '@/api/commodityCenter/commodityManage' import ChartLine from '@/components/ChartLine.vue'
export default { import * as api from '@/api/commodityCenter/commodityManage'
name: '', export default {
components: { RemoteDataView, CardGroupIndex }, name: '',
data() { components: { TimeSearchTitle, CardGroupIndex, ChartLine },
return { data() {
cardData: [], return {
active: 0, loading: false,
api, list: [],
} legend: ['订单总额', '退款总额', '净收入'],
}, xData: [],
computed: {}, series: [],
watch: {}, cardData: [],
created() { active: 0,
this.getList() api,
}, form: {
mounted() {}, picture: '',
methods: { price: 1,
getList() { describe: '',
this.loading = true attachments: []
api }
.getDetail() }
.then(({ data }) => { },
this.cardData = [ computed: {},
{ watch: {},
title: '订单总数', created() {
value: data.totalCnt, this.getDetail()
}, this.getList()
{ this.getTop5Fn()
title: '订单总额(元)', },
value: data.tdCnt, mounted() {},
}, methods: {
{ getDetail() {
title: '退款总额(元)', api.getDetail(this.$route.query.id).then((res) => {
value: data.tdLostCnt, this.form = res.data
}, this.form.attachments = this.form.attachments.split(',')
{
title: '净收入(元)',
value: data.tdNetCnt,
},
{
title: '昨日发送申请',
value: data.ydNewApplyCnt,
},
]
})
.catch((e) => {
console.log(e)
}) })
.finally(() => { },
getTop5Fn() {
this.loading = true
api.getDetailTable(this.$route.query.id).then((res) => {
if (res.code === 200) {
this.list = res.data
}
this.loading = false this.loading = false
}) })
}, },
dealDataFun(res, series, xData) { getList() {
xData = res.map((e) => e.xtime) this.loading = true
series.push(res.map((e) => e.addCnt)) api
series.push(res.map((e) => e.lostCnt)) .getDetailTotal(this.$route.query.id)
series.push(res.map((e) => e.lostCnt)) .then(({ data }) => {
}, this.cardData = [
}, {
} title: '订单总数',
value: data.orderNum
},
{
title: '订单总额(元)',
value: data.orderFee
},
{
title: '退款总额(元)',
value: data.refundFee
},
{
title: '净收入(元)',
value: data.netIncome
}
]
})
.catch((e) => {})
.finally(() => {})
},
getLineData(data) {
let val = {
type: 'customization',
startDate: data.beginTime,
endDate: data.endTime,
productId: this.$route.query.id
}
api.getDetailChart(val).then((res) => {
this.xData = res.data.xAxis.data
this.legend = res.data.legend.data
let arr1 = []
let arr2 = []
let arr3 = []
if (res.data.series && res.data.series.length) {
arr1 = res.data.series[0].data
arr2 = res.data.series[1].data
arr3 = res.data.series[2].data
}
this.series = [arr1, arr2, arr3]
})
}
}
}
</script> </script>
<template> <template>
<div> <div>
<CardGroupIndex :data="cardData"></CardGroupIndex> <el-row :gutter="10" type="flex">
<el-col :span="18">
<div class="g-card g-pad20" style="margin-top: 0"> <CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="title">数据趋势</div> <div class="g-card g-pad20" style="margin-top: 0;">
<RemoteDataView <div class="title">数据趋势</div>
type="lineChart" <time-search-title @search="getLineData"></time-search-title>
:legend="['订单总额(', '退款总额', '净收入']" <chart-line style="height: 300px;" :legend="legend" :xData="xData" :series="series"></chart-line>
:request="api.getTotalCnt" </div>
:dealDataFun="dealDataFun" <div class="g-card g-pad20" style="margin-top: 20px;">
></RemoteDataView> <div class="title">员工订单Top5</div>
</div> <el-table v-loading="loading" :data="list" style="width: 100%;">
<el-table-column label="员工" align="center" min-width="100" prop="weUserName" />
<div class="g-card g-pad20" style="margin-top: 20px"> <el-table-column label="订单总数" align="center" prop="orderNum" min-width="100"></el-table-column>
<div class="title">员工订单Top5</div> <el-table-column label="订单总额(元)" align="center" prop="totalFee" min-width="100"></el-table-column>
<RemoteDataView type="table" :request="api.getRankCnt"></RemoteDataView> </el-table>
</div> </div>
</el-col>
<el-col :span="6" style="min-width: 320px; display: flex; justify-content: space-around;">
<PhoneTemplate>
<div class="phone-content">
<el-image
class="commodity-img commodity-thumb"
style="width: 100%; height: 100px;"
:src="form.picture"
></el-image>
<div class="price">¥{{ form.price }}</div>
<div class="content">{{ form.describe }}</div>
<el-image
v-for="(item, index) in form.attachments"
class="commodity-img"
:src="item"
:key="index"
></el-image>
</div>
</PhoneTemplate>
</el-col>
</el-row>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.title { .title {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
font-weight: 600; font-weight: 600;
margin-bottom: 20px; margin-bottom: 20px;
} }
.phone-content {
padding: 10px;
}
.price {
font-weight: 500;
font-size: 20px;
margin: 10px 0;
}
.content {
margin: 10px 0;
}
.commodity-img {
width: 100%;
}
</style> </style>
<script>
import * as api from '@/api/commodityCenter/commodityManage'
export default {
components: {},
props: {},
data() {
return {
query: {
pageNum: 1,
pageSize: 10,
name: ''
},
loading: false,
dialogVisible: false,
total: 0,
list: [],
lastSyncTime: 0
}
},
computed: {},
created() {
this.getList()
},
methods: {
resetForm() {
this.query.name = 1
this.getList(1)
},
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
api
.getList(this.query)
.then(({ rows, total, lastSyncTime }) => {
this.list = rows
this.total = +total
this.lastSyncTime = lastSyncTime
this.loading = false
})
.catch(() => {
this.loading = false
})
},
sync() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
api
.sync()
.then(() => {
loading.close()
this.msgSuccess('后台开始同步数据,请稍后关注进度')
this.getList()
})
.catch(() => {
loading.close()
})
},
goRoute(row) {
this.$router.push({
path: './detail',
query: {
id: row.id
}
})
}
}
}
</script>
<template>
<div class="">
<el-form ref="queryForm" :inline="true" :model="query" label-width="110px" class="top-search">
<el-form-item label="商品名称或描述" prop="name">
<el-input v-model="query.name" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="getList(1)">查询</el-button>
<el-button type="success" @click="resetForm()">重置</el-button>
</el-form-item>
</el-form>
<div class="mid-action">
<el-button type="primary" class="mr10" @click="sync()">同步订单</el-button>
<el-button :disabled="!ids.length" type="danger">导出Excel</el-button>
</div>
<el-table v-loading="loading" :data="list">
<el-table-column label="商品" align="center" prop="" width="200">
<div slot-scope="{ row }">
<div style="display: flex;">
<el-image
style="width: 50px; height: 50px; margin-right: 3px; flex-shrink: 0;"
:src="row.picture"
></el-image>
<span class="limit_span">{{ row.describe }}</span>
</div>
</div>
</el-table-column>
<el-table-column label="单价(元)" align="center" prop="price" />
<el-table-column label="订单总数" align="center" prop="orderNum" />
<el-table-column label="订单总额(元)" align="center" prop="orderTotalAmount" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="最近操作时间" align="center" prop="updateTime" width="180"> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="{ row, index }">
<!-- <el-button type="text" @click="goRoute(row)">详情</el-button>
<el-button type="text" @click="edit(row, index)">编辑</el-button> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
<!-- 弹窗 -->
<el-dialog
:title="form.id ? '修改' : '新建'"
:visible.sync="dialogVisible"
width="800px"
:close-on-click-modal="false"
>
<el-row>
<el-col :span="12">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> </el-form>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer ar">
<el-button type="primary" v-loading="submitLoading" @click="submit">确 定</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<style lang="scss" scoped>
.tip {
color: #aaa;
font-size: 12px;
line-height: 20px;
}
.phone-content {
padding: 10px;
}
.price {
font-weight: 500;
font-size: 20px;
margin: 10px 0;
}
.content {
margin: 10px 0;
}
.commodity-img {
width: 100%;
}
.limit_span {
// width: 250px;
// overflow: hidden;
// text-overflow: ellipsis;
// // white-space: nowrap;
// display: inline-block;
white-space: pre-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
</style>
<script>
import CardGroupIndex from '@/components/CardGroupIndex'
import TimeSearchTitle from '@/components/common/TimeSearchTitle'
import ChartLine from '@/components/ChartLine.vue'
import * as api from '@/api/commodityCenter/commodityManage'
export default {
name: '',
components: { TimeSearchTitle, CardGroupIndex, ChartLine },
data() {
return {
loading: false,
list: [],
legend: ['订单总额', '退款总额', '净收入'],
xData: [],
series: [],
cardData: [],
active: 0,
api
}
},
computed: {},
watch: {},
created() {
this.getList()
this.getTop5Fn()
},
mounted() {},
methods: {
getTop5Fn() {
this.loading = true
api.getDetailTable(this.$route.query.id).then((res) => {
if (res.code === 200) {
this.list = res.data
}
this.loading = false
})
},
getList() {
this.loading = true
api
.getDetailTotal(this.$route.query.id)
.then(({ data }) => {
this.cardData = [
{
title: '订单总数',
value: data.orderNum
},
{
title: '订单总额(元)',
value: data.orderFee
},
{
title: '退款总额(元)',
value: data.refundFee
},
{
title: '净收入(元)',
value: data.netIncome
}
]
})
.catch((e) => {})
.finally(() => {})
},
getLineData(data) {
let val = {
type: 'customization',
startDate: data.beginTime,
endDate: data.endTime,
productId: this.$route.query.id
}
api.getDetailChart(val).then((res) => {
this.xData = res.data.xAxis.data
this.legend = res.data.legend.data
let arr1 = []
let arr2 = []
let arr3 = []
if (res.data.series && res.data.series.length) {
arr1 = res.data.series[0].data
arr2 = res.data.series[1].data
arr3 = res.data.series[2].data
}
this.series = [arr1, arr2, arr3]
})
}
}
}
</script>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="g-card g-pad20" style="margin-top: 0;">
<div class="title">数据趋势</div>
<time-search-title @search="getLineData"></time-search-title>
<chart-line style="height: 300px;" :legend="legend" :xData="xData" :series="series"></chart-line>
</div>
<div class="g-card g-pad20" style="margin-top: 20px;">
<div class="title">员工订单Top5</div>
<el-table v-loading="loading" :data="list" style="width: 100%;">
<el-table-column label="员工" align="center" min-width="100" prop="weUserName" />
<el-table-column label="订单总数" align="center" prop="orderNum" min-width="100"></el-table-column>
<el-table-column label="订单总额(元)" align="center" prop="totalFee" min-width="100"></el-table-column>
</el-table>
</div>
</div>
</template>
<style lang="scss" scoped>
.title {
font-size: 16px;
color: #333;
font-weight: 600;
margin-bottom: 20px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!