提交 90a27164 authored 作者: 王鹏飞's avatar 王鹏飞

update

上级 e7a90348
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
:current-page.sync="page.currentPage" :current-page.sync="page.currentPage"
@size-change="pageSizeChange" @size-change="pageSizeChange"
@current-change="fetchList" @current-change="fetchList"
:hide-on-single-page="true"
v-if="hasPagination" v-if="hasPagination"
> >
</el-pagination> </el-pagination>
......
...@@ -284,7 +284,7 @@ export default { ...@@ -284,7 +284,7 @@ export default {
}, },
// 成功回调 // 成功回调
handleSuccess(data) { handleSuccess(data) {
this.$message({ message: '保存商品成功', type: 'success' }) // this.$message({ message: '保存商品成功', type: 'success' })
this.$router.push({ path: '/preview', query: { shop_id: this.shopId, id: data.spu_id } }) this.$router.push({ path: '/preview', query: { shop_id: this.shopId, id: data.spu_id } })
}, },
// 确定添加商品 // 确定添加商品
......
...@@ -9,6 +9,20 @@ ...@@ -9,6 +9,20 @@
<el-button type="primary">发布商品</el-button> <el-button type="primary">发布商品</el-button>
</router-link> </router-link>
</template> </template>
<template v-slot:table-goods="{ row }">
<div class="table-goods">
<el-image :src="imageUrl(row.chart_oss)" fit="cover" class="table-goods-pic">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<div class="table-goods-name">{{ row.spu_name }}</div>
</div>
</template>
<template v-slot:table-view="{ row }">
<p>访客数:{{ row.usesr_view }}</p>
<p>浏览量:{{ row.page_view }}</p>
</template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<el-button type="text" @click="handleUpdate(row)">编辑</el-button> <el-button type="text" @click="handleUpdate(row)">编辑</el-button>
<el-button type="text" @click="handlePromote(row)">推广</el-button> <el-button type="text" @click="handlePromote(row)">推广</el-button>
...@@ -74,27 +88,37 @@ export default { ...@@ -74,27 +88,37 @@ export default {
} }
], ],
columns: [ columns: [
{ type: 'selection', align: 'left' }, { type: 'selection' },
{ label: '商品名', prop: 'spu_name' }, { label: '商品名', prop: 'spu_name', slots: 'table-goods', minWidth: 140 },
{ label: '价格(元)', prop: 'price_zone' }, { label: '价格(元)', prop: 'price_zone', align: 'center' },
{ label: '访问量', prop: 'page_view' }, { label: '访问量', prop: 'page_view', slots: 'table-view', minWidth: 120 },
{ label: '库存', prop: 'stock' }, { label: '库存', prop: 'stock', align: 'center' },
{ label: '销量', prop: 'sales_volume' }, { label: '销量', prop: 'sales_volume', align: 'center' },
{ label: '创建时间', prop: 'create_time', width: 180 }, { label: '创建时间', prop: 'create_time', width: 110 },
{ {
label: '商品状态', label: '商品状态',
prop: 'status', prop: 'status',
align: 'center',
computed({ row }) { computed({ row }) {
const map = { 1: '仓库中', 2: '销售中', 3: '已售罄', 4: '下架', 5: '已删除' } const map = { 1: '仓库中', 2: '销售中', 3: '已售罄', 4: '下架', 5: '已删除' }
return map[row.status] return map[row.status]
} }
}, },
{ label: '操作', slots: 'table-x', width: 150 } { label: '操作', slots: 'table-x', align: 'right', width: 150 }
] ]
} }
} }
}, },
methods: { methods: {
imageUrl(value) {
try {
const imgList = value ? JSON.parse(value) : []
const [first = {}] = imgList
return first.url
} catch (error) {
return ''
}
},
beforeRequest(params) { beforeRequest(params) {
params.status = this.activeName === '0' ? '' : this.activeName params.status = this.activeName === '0' ? '' : this.activeName
return params return params
...@@ -145,3 +169,33 @@ export default { ...@@ -145,3 +169,33 @@ export default {
} }
} }
</script> </script>
<style lang="scss">
.table-goods {
display: flex;
align-items: center;
}
.table-goods-pic {
margin-right: 10px;
width: 60px;
height: 60px;
}
.table-goods-name {
flex: 1;
color: #3276fc;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: #f5f7fa;
color: #909399;
font-size: 14px;
}
</style>
差异被折叠。
...@@ -10,14 +10,22 @@ ...@@ -10,14 +10,22 @@
<el-button type="primary">新增订单</el-button> <el-button type="primary">新增订单</el-button>
</router-link> </router-link>
</template> </template>
<template v-slot:table-goods="{ row }">
<div class="table-goods">
<el-image :src="imageUrl(row.chart_oss)" fit="cover" class="table-goods-pic">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<div class="table-goods-name">{{ row.spu_name }}</div>
</div>
</template>
<template v-slot:table-price="{ row }"> <template v-slot:table-price="{ row }">
<p>{{ row.product_price }}</p> <p>{{ row.product_price }}</p>
<p>{{ row.buy_count }}</p> <p>1件</p>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<el-button type="text" @click="handleUpdate(row)">编辑</el-button> <el-button type="text" @click="handleView(row)">查看</el-button>
<el-button type="text" @click="handlePromote(row)">推广</el-button>
<el-button type="text" @click="handleCopy(row)">复制</el-button>
</template> </template>
</table-list> </table-list>
</app-card> </app-card>
...@@ -37,7 +45,7 @@ export default { ...@@ -37,7 +45,7 @@ export default {
activeName: '0', activeName: '0',
tabList: [ tabList: [
{ label: '全部', name: '0' }, { label: '全部', name: '0' },
{ label: '付款', name: '2' }, { label: '付款', name: '2' },
{ label: '待发货', name: '3' }, { label: '待发货', name: '3' },
{ label: '已发货', name: '4' }, { label: '已发货', name: '4' },
{ label: '已完成', name: '5' }, { label: '已完成', name: '5' },
...@@ -52,53 +60,118 @@ export default { ...@@ -52,53 +60,118 @@ export default {
return { return {
remote: { remote: {
httpRequest: getOrderList, httpRequest: getOrderList,
params: { shop_id: this.$store.state.shopId }, params: { shop_id: this.$store.state.shopId, spu_id: '', order_status: '' },
beforeRequest: this.beforeRequest beforeRequest: this.beforeRequest
}, },
filters: [ filters: [
{ {
type: 'input', type: 'input',
prop: 'name', prop: 'spu_id',
placeholder: '请输入商品名称' placeholder: '请输入商品编号'
}, },
{ {
type: 'select', type: 'select',
prop: 'group_id', prop: 'order_status',
options: [ options: [
{ label: '活动', value: 1 }, { label: '待付款', name: '2' },
{ label: '报名费', value: 2 }, { label: '待发货', name: '3' },
{ label: '学费', value: 3 }, { label: '已发货', name: '4' },
{ label: '活动', value: 4 } { label: '已完成', name: '5' },
] { label: '已关闭', name: '6' },
{ label: '售后中', name: '7' }
],
valueKey: 'name'
} }
], ],
columns: [ columns: [
{ label: '商品', prop: 'shop_name' }, { label: '商品', prop: 'shop_name', slots: 'table-goods', minWidth: 140 },
{ label: '单价(元)/数量', prop: 'product_price', slots: 'table-price' }, { label: '单价(元)/数量', prop: 'product_price', slots: 'table-price', align: 'right' },
{ label: '售后', prop: 'sellPrice' }, { label: '订单号', prop: 'order_id' },
{ label: '买家 / 收货人', prop: 'shipping_user' }, { label: '下单时间', prop: 'create_time', width: 110 },
{ label: '配送方式', prop: 'sellCount' }, { label: '买家 / 收货人', prop: 'shipping_user', align: 'center' },
{ label: '实收金额(元)', prop: 'payment_money' }, { label: '实收金额(元)', prop: 'payment_money', align: 'center' },
{ label: '订单状态', prop: 'order_status' }, {
{ label: '操作', slots: 'table-x' } label: '支付方式',
prop: 'payment_method',
align: 'center',
computed({ row }) {
const map = {
1: '现金',
2: '余额',
3: '网银',
4: '支付宝',
5: '微信',
7: '微信JSAPI',
8: '微信H5'
}
return map[row.payment_method]
}
},
{
label: '订单状态',
prop: 'order_status',
align: 'center',
computed({ row }) {
const map = { 1: '待付款', 2: '待发货', 3: '已发货', 4: '已完成', 5: '已关闭', 6: '售后' }
return map[row.order_status]
}
},
{ label: '操作', slots: 'table-x', align: 'right', width: 60 }
] ]
} }
} }
}, },
methods: { methods: {
imageUrl(value) {
try {
const imgList = value ? JSON.parse(value) : []
const [first = {}] = imgList
return first.url
} catch (error) {
return ''
}
},
beforeRequest(params) { beforeRequest(params) {
params.status = this.activeName === '0' ? '' : this.activeName // params.order_status = this.activeName === '0' ? '' : this.activeName
return params return params
}, },
handleClick() { handleClick() {
this.$refs.list.refetch(true) this.$refs.list.refetch(true)
}, },
// 编辑 // 查看
handleUpdate() {}, handleView(row) {
// 推广 this.$router.push({ name: 'orderDetail', params: { id: row.order_id } })
handlePromote() {}, }
// 复制
handleCopy() {}
} }
} }
</script> </script>
<style lang="scss">
.table-goods {
display: flex;
align-items: center;
}
.table-goods-pic {
margin-right: 10px;
width: 60px;
height: 60px;
}
.table-goods-name {
flex: 1;
color: #3276fc;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: #f5f7fa;
color: #909399;
font-size: 14px;
}
</style>
<template> <template>
<div class="preview"></div> <div class="preview">
<div class="preview-hd">
<div class="preview-hd-inner">
<div class="preview-hd-left">预览:<span class="active">手机版</span><span>PC版</span></div>
<div class="preview-hd-right">
<el-button size="small" type="primary" plain @click="handleEdit">编辑本商品</el-button>
<el-button size="small" type="primary" plain @click="handleAdd">发布新商品</el-button>
<el-button size="small" type="primary" @click="handleClose">关闭</el-button>
</div>
</div>
</div>
<div class="preview-bd"></div>
</div>
</template> </template>
<script> <script>
export default {} export default {
computed: {
shopId() {
return this.$route.query.shop_id
},
goodsId() {
return this.$route.query.id
}
},
methods: {
handleEdit() {
this.$router.push({ name: 'goodsEdit', params: { id: this.goodsId } })
},
handleAdd() {
this.$router.push({ name: 'goodsAdd' })
},
handleClose() {
this.$router.replace({ name: 'goodsList' })
}
}
}
</script> </script>
<style> <style lang="scss">
.preview-hd {
background-color: #fff;
border-bottom: 1px solid #c1c1c1;
}
.preview-hd-inner {
display: flex;
align-items: center;
max-width: 720px;
margin: 0 auto;
padding: 10px 0;
}
.preview-hd-left {
flex: 1;
span {
margin-right: 20px;
}
.active {
border-bottom: 1px solid #3276fc;
}
}
</style> </style>
...@@ -33,6 +33,7 @@ export default [ ...@@ -33,6 +33,7 @@ export default [
meta: { title: '商品' }, meta: { title: '商品' },
children: [ children: [
{ {
name: 'goodsList',
path: '', path: '',
component: () => import(/* webpackChunkName: "goods" */ '@/pages/goods/goods/index'), component: () => import(/* webpackChunkName: "goods" */ '@/pages/goods/goods/index'),
meta: { title: '商品列表' } meta: { title: '商品列表' }
...@@ -64,15 +65,17 @@ export default [ ...@@ -64,15 +65,17 @@ export default [
meta: { title: '订单' }, meta: { title: '订单' },
children: [ children: [
{ {
name: 'orderList',
path: '', path: '',
component: () => import(/* webpackChunkName: "order" */ '@/pages/order/index'), component: () => import(/* webpackChunkName: "order" */ '@/pages/order/index'),
meta: { title: '订单列表' } meta: { title: '订单列表' }
},
{
name: 'orderDetail',
path: 'detail/:id',
component: () => import(/* webpackChunkName: "order" */ '@/pages/order/detail'),
meta: { title: '订单详情' }
} }
// {
// path: 'detail/:id',
// component: orderDetail,
// meta: { title: '订单详情' }
// }
] ]
}, },
// 设置 // 设置
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论