This commit is contained in:
menxipeng
2025-10-28 21:39:50 +08:00
parent 8a62709759
commit 1eb298f3c9
3 changed files with 34 additions and 178 deletions

View File

@@ -43,6 +43,7 @@
<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="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="amountYuan" width="100">
<template slot-scope="scope">

View File

@@ -1,14 +1,6 @@
<template>
<div class="app-container">
<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-input
v-model="queryParams.name"
@@ -17,78 +9,6 @@
@keyup.enter.native="handleQuery"
/>
</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-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>
@@ -128,42 +48,22 @@
v-hasPermi="['system:product:remove']"
>删除</el-button>
</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>
</el-row>
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<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="description" />
<el-table-column label="分类ID" align="center" prop="categoryId" />
<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">
<el-table-column label="原价(元)" align="center" prop="originalPrice">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
<span>{{ (scope.row.originalPrice / 100).toFixed(2) }}</span>
</template>
</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">
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
<span>{{ (scope.row.currentPrice / 100).toFixed(2) }}</span>
</template>
</el-table-column>
<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-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-input v-model="form.name" placeholder="请输入商品名称" />
</el-form-item>
<el-form-item label="商品描述" prop="description">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="分类ID" prop="categoryId">
<el-input v-model="form.categoryId" placeholder="请输入分类ID" />
</el-form-item>
<el-form-item label="原价" prop="originalPrice">
<el-form-item label="原价(元)" prop="originalPrice">
<el-input v-model="form.originalPrice" placeholder="请输入原价" />
</el-form-item>
<el-form-item label="现价" prop="currentPrice">
<el-form-item label="现价(元)" prop="currentPrice">
<el-input v-model="form.currentPrice" placeholder="请输入现价" />
</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>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@@ -281,20 +147,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
productId: 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
name: null
},
// 表单参数
form: {},
@@ -328,20 +181,10 @@ export default {
reset() {
this.form = {
id: null,
productId: 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
currentPrice: null
}
this.resetForm("form")
},
@@ -373,6 +216,13 @@ export default {
const id = row.id || this.ids
getProduct(id).then(response => {
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.title = "修改商品"
})
@@ -381,14 +231,25 @@ export default {
submitForm() {
this.$refs["form"].validate(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) {
updateProduct(this.form).then(response => {
updateProduct(submitData).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addProduct(this.form).then(response => {
addProduct(submitData).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
@@ -407,12 +268,6 @@ export default {
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('system/product/export', {
...this.queryParams
}, `product_${new Date().getTime()}.xlsx`)
}
}
}
</script>