页面
This commit is contained in:
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||||||
// 查询商品列表
|
// 查询商品列表
|
||||||
export function listProduct(query) {
|
export function listProduct(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/product/list',
|
url: '/back/product/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@@ -12,7 +12,7 @@ export function listProduct(query) {
|
|||||||
// 查询商品详细
|
// 查询商品详细
|
||||||
export function getProduct(id) {
|
export function getProduct(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/product/' + id,
|
url: '/back/product/' + id,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ export function getProduct(id) {
|
|||||||
// 新增商品
|
// 新增商品
|
||||||
export function addProduct(data) {
|
export function addProduct(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/product',
|
url: '/back/product',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -29,7 +29,7 @@ export function addProduct(data) {
|
|||||||
// 修改商品
|
// 修改商品
|
||||||
export function updateProduct(data) {
|
export function updateProduct(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/product',
|
url: '/back/product',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -38,7 +38,7 @@ export function updateProduct(data) {
|
|||||||
// 删除商品
|
// 删除商品
|
||||||
export function delProduct(id) {
|
export function delProduct(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/product/' + id,
|
url: '/back/product/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
<el-table v-loading="loading" :data="orderList">
|
<el-table v-loading="loading" :data="orderList">
|
||||||
<el-table-column label="订单号" align="center" prop="orderId" :show-overflow-tooltip="true" />
|
<el-table-column label="订单号" align="center" prop="orderId" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="用户昵称" align="center" prop="userNickname" :show-overflow-tooltip="true" />
|
<el-table-column label="用户昵称" align="center" prop="userNickname" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机号" align="center" prop="phone" :show-overflow-tooltip="true" width="120" />
|
||||||
<el-table-column label="套餐名称" align="center" prop="packageName" :show-overflow-tooltip="true" />
|
<el-table-column label="套餐名称" align="center" prop="packageName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="金额" align="center" prop="amountYuan" width="100">
|
<el-table-column label="金额" align="center" prop="amountYuan" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="${comment}" prop="productId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.productId"
|
|
||||||
placeholder="请输入${comment}"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="商品名称" prop="name">
|
<el-form-item label="商品名称" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
@@ -17,78 +9,6 @@
|
|||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类ID" prop="categoryId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.categoryId"
|
|
||||||
placeholder="请输入分类ID"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="原价" prop="originalPrice">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.originalPrice"
|
|
||||||
placeholder="请输入原价"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="现价" prop="currentPrice">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.currentPrice"
|
|
||||||
placeholder="请输入现价"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="包月时长" prop="monthlyDuration">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.monthlyDuration"
|
|
||||||
placeholder="请输入包月时长"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="包季时长" prop="quarterlyDuration">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.quarterlyDuration"
|
|
||||||
placeholder="请输入包季时长"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存数量" prop="stock">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.stock"
|
|
||||||
placeholder="请输入库存数量"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="销量" prop="sales">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.sales"
|
|
||||||
placeholder="请输入销量"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" prop="createdAt">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="queryParams.createdAt"
|
|
||||||
type="date"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="请选择创建时间">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="更新时间" prop="updatedAt">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="queryParams.updatedAt"
|
|
||||||
type="date"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="请选择更新时间">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
@@ -128,42 +48,22 @@
|
|||||||
v-hasPermi="['system:product:remove']"
|
v-hasPermi="['system:product:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['system:product:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="商品ID" align="center" prop="id" />
|
<el-table-column label="商品ID" align="center" prop="id" />
|
||||||
<el-table-column label="${comment}" align="center" prop="productId" />
|
|
||||||
<el-table-column label="商品名称" align="center" prop="name" />
|
<el-table-column label="商品名称" align="center" prop="name" />
|
||||||
<el-table-column label="商品描述" align="center" prop="description" />
|
<el-table-column label="商品描述" align="center" prop="description" />
|
||||||
<el-table-column label="分类ID" align="center" prop="categoryId" />
|
<el-table-column label="原价(元)" align="center" prop="originalPrice">
|
||||||
<el-table-column label="商品类型:1-包月,2-包季,3-半年 " align="center" prop="productType" />
|
|
||||||
<el-table-column label="状态:0-下架,1-上架" align="center" prop="status" />
|
|
||||||
<el-table-column label="原价" align="center" prop="originalPrice" />
|
|
||||||
<el-table-column label="现价" align="center" prop="currentPrice" />
|
|
||||||
<el-table-column label="包月时长" align="center" prop="monthlyDuration" />
|
|
||||||
<el-table-column label="包季时长" align="center" prop="quarterlyDuration" />
|
|
||||||
<el-table-column label="库存数量" align="center" prop="stock" />
|
|
||||||
<el-table-column label="销量" align="center" prop="sales" />
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
|
<span>{{ (scope.row.originalPrice / 100).toFixed(2) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="更新时间" align="center" prop="updatedAt" width="180">
|
<el-table-column label="现价(元)" align="center" prop="currentPrice">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
|
<span>{{ (scope.row.currentPrice / 100).toFixed(2) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
@@ -197,52 +97,18 @@
|
|||||||
<!-- 添加或修改商品对话框 -->
|
<!-- 添加或修改商品对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="${comment}" prop="productId">
|
|
||||||
<el-input v-model="form.productId" placeholder="请输入${comment}" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="商品名称" prop="name">
|
<el-form-item label="商品名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入商品名称" />
|
<el-input v-model="form.name" placeholder="请输入商品名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品描述" prop="description">
|
<el-form-item label="商品描述" prop="description">
|
||||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类ID" prop="categoryId">
|
<el-form-item label="原价(元)" prop="originalPrice">
|
||||||
<el-input v-model="form.categoryId" placeholder="请输入分类ID" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="原价" prop="originalPrice">
|
|
||||||
<el-input v-model="form.originalPrice" placeholder="请输入原价" />
|
<el-input v-model="form.originalPrice" placeholder="请输入原价" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="现价" prop="currentPrice">
|
<el-form-item label="现价(元)" prop="currentPrice">
|
||||||
<el-input v-model="form.currentPrice" placeholder="请输入现价" />
|
<el-input v-model="form.currentPrice" placeholder="请输入现价" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="包月时长" prop="monthlyDuration">
|
|
||||||
<el-input v-model="form.monthlyDuration" placeholder="请输入包月时长" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="包季时长" prop="quarterlyDuration">
|
|
||||||
<el-input v-model="form.quarterlyDuration" placeholder="请输入包季时长" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存数量" prop="stock">
|
|
||||||
<el-input v-model="form.stock" placeholder="请输入库存数量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="销量" prop="sales">
|
|
||||||
<el-input v-model="form.sales" placeholder="请输入销量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" prop="createdAt">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="form.createdAt"
|
|
||||||
type="date"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="请选择创建时间">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="更新时间" prop="updatedAt">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="form.updatedAt"
|
|
||||||
type="date"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="请选择更新时间">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
@@ -281,20 +147,7 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
productId: null,
|
name: null
|
||||||
name: null,
|
|
||||||
description: null,
|
|
||||||
categoryId: null,
|
|
||||||
productType: null,
|
|
||||||
status: null,
|
|
||||||
originalPrice: null,
|
|
||||||
currentPrice: null,
|
|
||||||
monthlyDuration: null,
|
|
||||||
quarterlyDuration: null,
|
|
||||||
stock: null,
|
|
||||||
sales: null,
|
|
||||||
createdAt: null,
|
|
||||||
updatedAt: null
|
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
@@ -328,20 +181,10 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
productId: null,
|
|
||||||
name: null,
|
name: null,
|
||||||
description: null,
|
description: null,
|
||||||
categoryId: null,
|
|
||||||
productType: null,
|
|
||||||
status: null,
|
|
||||||
originalPrice: null,
|
originalPrice: null,
|
||||||
currentPrice: null,
|
currentPrice: null
|
||||||
monthlyDuration: null,
|
|
||||||
quarterlyDuration: null,
|
|
||||||
stock: null,
|
|
||||||
sales: null,
|
|
||||||
createdAt: null,
|
|
||||||
updatedAt: null
|
|
||||||
}
|
}
|
||||||
this.resetForm("form")
|
this.resetForm("form")
|
||||||
},
|
},
|
||||||
@@ -373,6 +216,13 @@ export default {
|
|||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getProduct(id).then(response => {
|
getProduct(id).then(response => {
|
||||||
this.form = response.data
|
this.form = response.data
|
||||||
|
// 将分转换为元显示
|
||||||
|
if (this.form.originalPrice) {
|
||||||
|
this.form.originalPrice = (this.form.originalPrice / 100).toFixed(2)
|
||||||
|
}
|
||||||
|
if (this.form.currentPrice) {
|
||||||
|
this.form.currentPrice = (this.form.currentPrice / 100).toFixed(2)
|
||||||
|
}
|
||||||
this.open = true
|
this.open = true
|
||||||
this.title = "修改商品"
|
this.title = "修改商品"
|
||||||
})
|
})
|
||||||
@@ -381,14 +231,25 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// 创建提交数据的副本
|
||||||
|
const submitData = { ...this.form }
|
||||||
|
|
||||||
|
// 将元转换为分发送到接口
|
||||||
|
if (submitData.originalPrice) {
|
||||||
|
submitData.originalPrice = Math.round(parseFloat(submitData.originalPrice) * 100)
|
||||||
|
}
|
||||||
|
if (submitData.currentPrice) {
|
||||||
|
submitData.currentPrice = Math.round(parseFloat(submitData.currentPrice) * 100)
|
||||||
|
}
|
||||||
|
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateProduct(this.form).then(response => {
|
updateProduct(submitData).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功")
|
this.$modal.msgSuccess("修改成功")
|
||||||
this.open = false
|
this.open = false
|
||||||
this.getList()
|
this.getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addProduct(this.form).then(response => {
|
addProduct(submitData).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功")
|
this.$modal.msgSuccess("新增成功")
|
||||||
this.open = false
|
this.open = false
|
||||||
this.getList()
|
this.getList()
|
||||||
@@ -407,12 +268,6 @@ export default {
|
|||||||
this.$modal.msgSuccess("删除成功")
|
this.$modal.msgSuccess("删除成功")
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('system/product/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `product_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user