dev
wxy 2024-05-10 17:30:33 +08:00
parent daf1864ba8
commit 94eb782211
6 changed files with 170 additions and 121 deletions

View File

@ -29,7 +29,7 @@ export function addAttrInfo(data) {
// 修改品牌信息
export function updateAttrInfo(data) {
return request({
url: '/product/attrInfo/'+data.id,
url: '/product/attrInfo/',
method: 'put',
data: data
})

View File

@ -1,12 +1,12 @@
<template>
<div class="app-container">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="品牌名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入品牌名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@ -24,8 +24,9 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['brand:brand:add']"
>新增</el-button>
v-hasPermi="['product:brand:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -35,8 +36,9 @@
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['brand:brand:edit']"
>修改</el-button>
v-hasPermi="['product:brand:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -46,8 +48,9 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['brand:brand:remove']"
>删除</el-button>
v-hasPermi="['product:brand:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -56,35 +59,30 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['brand:brand:export']"
>导出</el-button>
v-hasPermi="['product:brand:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-card>
<el-card>
<i class="el-icon-tickets">品牌数据列表</i>
</el-card>
<el-card>
<el-table v-loading="loading" :data="brandList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="品牌名称" align="center" prop="name" />
<el-table-column label="品牌描述" align="center" prop="productDesc" />
<el-table v-loading="loading" :data="infoList" @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="品牌名称" align="center" prop="name"/>
<el-table-column label="品牌描述" align="center" prop="productDesc"/>
<el-table-column label="品牌介绍" align="center" prop="content">
<template slot-scope="scope">
<img :src="scope.row.content" alt="品牌介绍" width="80px" height="80px"/>
<img :src="scope.row.content">
</template>
</el-table-column>
<el-table-column label="品牌logo" align="center" prop="logo">
<template slot-scope="scope">
<img :src="scope.row.logo" alt="品牌logo" width="50px" height="50px" />
</template>
</el-table-column>
<el-table-column label="品牌状态" align="center" prop="status" >
<el-table-column label="品牌logo" align="center" prop="logo" style="height: 50px">
<template slot-scope="scope">
<img :src="scope.row.logo">
</template>
</el-table-column>
<el-table-column label="品牌状态" align="center" prop="status">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
@ -101,6 +99,7 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -108,15 +107,17 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['brand:brand:edit']"
>修改</el-button>
v-hasPermi="['product:brand:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['brand:brand:remove']"
>删除</el-button>
v-hasPermi="['product:brand:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -133,38 +134,35 @@
<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="品牌名称" prop="name">
<el-input v-model="form.name" placeholder="请输入品牌名称" />
<el-input v-model="form.name" placeholder="请输入品牌名称"/>
</el-form-item>
<el-form-item label="品牌描述" prop="productDesc">
<el-input v-model="form.productDesc" placeholder="请输入品牌描述" />
<el-input v-model="form.productDesc" placeholder="请输入品牌描述"/>
</el-form-item>
<el-form-item label="品牌介绍">
<image-upload v-model="form.content" placeholder="请输入品牌logo" :limit="1" :is-show-tip="false"/>
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="品牌logo" prop="logo">
<ImageUpload v-model="form.logo" placeholder="请输入品牌logo"/>
</el-form-item>
<el-col>
<el-form-item label="品牌logo" prop="image">
<image-upload v-model="form.logo" placeholder="请输入品牌logo" :limit="1" :is-show-tip="false"/>
</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { listBrand, getBrand, delBrand, addBrand, updateBrand } from "@/api/product/brand";
import {listBrand, getBrand, delBrand, addBrand, updateBrand} from "@/api/product/brand";
import {updateInfo} from "@/api/product/info";
import ImageUpload from "@/components/ImageUpload"
export default {
components: {ImageUpload},
name: "Brand",
components:{ImageUpload},
name: "Info",
data() {
return {
value: true,
//
loading: true,
//
@ -178,7 +176,7 @@ export default {
//
total: 0,
//
brandList: [],
infoList: [],
//
title: "",
//
@ -194,13 +192,10 @@ export default {
//
rules: {
createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" }
{required: true, message: "创建人不能为空", trigger: "blur"}
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
name: [
{ required: true, message: "请输入品牌名称", trigger: "blur" }
{required: true, message: "创建时间不能为空", trigger: "blur"}
],
}
};
@ -209,16 +204,15 @@ export default {
this.getList();
},
methods: {
updateBrandStatus(params){
console.log(params);
const {id,status} = params;
this.handleUpdate(id,status);
updateBrandStatus(params) {
const {id, status} = params
this.updateInfoById({id, status})
},
/** 查询商品品牌列表 */
getList() {
this.loading = true;
listBrand(this.queryParams).then(response => {
this.brandList = response.data.list;
this.infoList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
@ -236,7 +230,7 @@ export default {
productDesc: null,
content: null,
logo: null,
status: null,
status: "0",
revision: null,
createBy: null,
createTime: null,
@ -258,7 +252,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -282,7 +276,7 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
this.updateBrandInfoById(this.form)
this.updateInfoById(this.form)
} else {
addBrand(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
@ -293,28 +287,31 @@ export default {
}
});
},
updateBrandInfoById(data){
updateInfoById(data) {
updateBrand(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除商品品牌编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除商品品牌编号为"' + ids + '"的数据项?').then(function () {
return delBrand(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/brand/export', {
...this.queryParams
}, `brand_${new Date().getTime()}.xlsx`)
}, `info_${new Date().getTime()}.xlsx`)
}
}
};

View File

@ -66,7 +66,11 @@
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="商品名称" align="center" prop="productId" />
<el-table-column label="商品SKU" align="center" prop="productRuleCententId" />
<el-table-column label="商品评价图片" align="center" prop="reviewImages" />
<el-table-column label="商品评价图片" align="center" prop="reviewImages" >
<template slot-scope="scope">
<img :src="scope.row.reviewImages" alt="加载失败" width="80px" height="80px"/>
</template>
</el-table-column>
<el-table-column label="商品评价信息" align="center" prop="content" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">

View File

@ -1,5 +1,6 @@
<template>
<div class="app-container">
<el-card class="box-card">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="商品名称" prop="name">
<el-input
@ -60,12 +61,13 @@
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-card>
<el-card>
<i class="el-icon-tickets">商品信息数据列表</i>
</el-card>
<el-card>
<el-card class="box-card">
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="60" align="center" />
<el-table-column label="ID" align="center" prop="id" />
@ -97,7 +99,23 @@
<el-table-column label="商品评论数" align="center" prop="commentCount" />
<el-table-column label="商品收藏人气" align="center" prop="collectCount" />
<el-table-column label="品牌信息" align="center" prop="brand" />
<el-table-column label="商品状态" align="center" prop="status" />
<el-table-column label="品牌状态" align="center" prop="status">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="上架"
inactive-text="下架"
inactive-value="0"
active-value="1"
@change="updateInfoStatus(scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit" />
<el-table-column label="搜索关键字" align="center" prop="keywords" />
<el-table-column label="规格信息" align="center" prop="ruleId" />
@ -179,11 +197,10 @@
<el-col :span="12">
<div class="grid-content bg-purple">
<el-form-item label="分类" prop="brand">
<el-form-item label="分类" prop="type">
<el-cascader
v-model="form.type"
:options="categoryList"
:options="typeList"
:props="{ expandTrigger: 'hover' ,value:'catId',label:'name',children:'childrenList'}"
@change="handleChange"></el-cascader>
</el-form-item>
@ -256,9 +273,9 @@
<el-col :span="5">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="onClear"></el-button>
<el-button type="warning" @click="onClear"></el-button>
</el-col>
</el-row>>
</el-row>
</el-form>
@ -267,20 +284,14 @@
<el-table
:data="tableBodyTemplate"
style="width: 100%">
<!-- <el-table-column label="商品轮播图" align="center" prop="carouselImages" >-->
<!-- <template slot-scope="scope">-->
<!-- <img :src="scope.row.carouselImages" alt="加载失败" width="80px" height="80px"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column v-for="column in tableColumnHeaderTemplate"
:prop="column.prop"
:label="column.label">
<template slot-scope="scope">
{{scope.row[column.prop]}}
<el-input-number v-if="column.prop.indexOf('image') == -1 && column.prop.indexOf('xxx') == -1"
v-model="scope.row[column.prop]" :min="1" :max="9999999999" label="描述" style="width: 120px" ></el-input-number>
<ImageUpload v-else-if="column.prop.indexOf('image') > -1 " v-model="scope.row[column.prop]" :limit="1" style="width: 120px "></ImageUpload>
<span v-else>{{scope.row[column.prop]}}</span>
</template>
</el-table-column>
@ -290,9 +301,8 @@
<div v-show="active==2">
<el-form-item label="商品描述" prop="productDesc">
<el-input v-model="form.productDesc" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-button @click="pc = true; move =false">商品描述</el-button>
<editor v-if="pc" v-model="form.productDesc" :min-height="150"/>
</div>
@ -310,36 +320,34 @@
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/product/info";
import ImageUpload from "@/components/ImageUpload"
import { listBrand } from "@/api/product/brand"
import {listBrand, updateBrand} from "@/api/product/brand"
import { listRule } from "@/api/product/rule"
import { listType } from "@/api/product/type"
export default {
components:{ImageUpload},
name: "Info",
data() {
return {
categoryList: [],
//
pc:true,
move:false,
typeList: [],
tableColumnHeaderTemplate:[],
tableBodyTemplate:[
// {'stock':'1',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'2',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'3',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'4',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'5',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'6',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'7',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'8',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
// {'stock':'9',price: "1",purchasePrice:"1",sellingPrice:"1",image:"1",number:"1",weight:"1",volume:"1"},
],
tableBodyTemplate:[],
active: 0,
rule: [],
ruleAttrList:[],
brandList:[],
ruleList:[],
tableData:[],
MallProductInfoList: [],
stepsMap: {
0: '添加商品信息',
1: '添加规格信息',
2: '添加描述信息',
},
skuFormTemplate:{
'stock': '0',
'price': '0',
@ -394,11 +402,20 @@ export default {
this.getList();
this.initBrandListInfo();
this.initRuleListInfo();
this.initTypeListInfo();
},
methods: {
handleChange() {
handleChange(){
},
updateInfoStatus(params) {
const {id, status} = params
this.updateInfoById({id, status})
},
onSubmit() {
this.settingsOrnClear(true)
},
@ -411,7 +428,7 @@ export default {
for (let skuFormTemplateKey in this.skuFormTemplate) {
this.tableBodyTemplate.forEach(item=>{
for (let itemKey in item) {
if(skuFormTemplateKey==itemKey){
if(skuFormTemplateKey===itemKey){
if(flag){
item[itemKey]=this.skuFormTemplate[skuFormTemplateKey]
}else{
@ -451,6 +468,7 @@ export default {
for (let i = 0; i < ruleAttrJson[index].ruleAttrList.length; i++) {
const updatedCurrent = {...current}; // Create a copy of current object
updatedCurrent[`xxx${index}`] = ruleAttrJson[index].ruleAttrList[i];
current['image'] = '';
cartesian(ruleAttrJson, index + 1, updatedCurrent);
}
};
@ -468,6 +486,17 @@ export default {
{prop:'volume',label:'体积'},
)
},
/** 查询商品类型**/
initTypeListInfo() {
let prams = {
status : 0
};
listType(prams).then(res => {
if(200 == res.code){
this.typeList = res.data.list;
}
});
},
/**查询商品规格**/
initRuleListInfo() {
let params = {
@ -490,22 +519,45 @@ export default {
}
});
},
//
step() {
this.active--;
},
//
next() {
this.active++;
},
/** 查询商品信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then(response => {
this.infoList = response.data.list;
let productInfoList = response.data.list;
productInfoList.forEach(item => {
let num = item.step;
item.step = this.switchStepByNum(num)
})
this.infoList = productInfoList;
this.total = response.data.total;
this.loading = false;
});
},
//
// numstep
switchStepByNum(num) {
if (num == null || num == '' || num == undefined) {
this.$modal.msgError("num is NULL");
return;
}
for (let stepsMapKey in this.stepsMap) {
if (num == stepsMapKey) {
return this.stepsMap[stepsMapKey];
}
}
},
// *
cancel() {
this.open = false;
this.reset();
@ -574,11 +626,7 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
this.updateInfoById(this.form)
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
@ -589,6 +637,15 @@ export default {
}
});
},
updateInfoById(data) {
updateInfo(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;

View File

@ -14,7 +14,6 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@ -67,7 +66,6 @@
<el-table-column label="商品" align="center" prop="productId" />
<el-table-column label="商品SKU" align="center" prop="productRuleCententId" />
<el-table-column label="录入库存数量" align="center" prop="stockNum" />
<el-table-column label="乐观锁" align="center" prop="revision" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button

View File

@ -80,8 +80,7 @@
<span style="margin-left: 10px" v-if="scope.row.catLevel==3"></span>
</template>
</el-table-column>
<el-table-column align="center" prop="showStatus" >
<el-table-column label="是否显示" align="center" prop="showStatus" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.showStatus"
@ -89,8 +88,8 @@
inactive-color="#ff4949"
active-text="显式"
inactive-text="不显示"
inactive-value="1"
active-value="0"
inactive-value="0"
active-value="1"
@change="updateShowStatus(scope.row)"
>
</el-switch>
@ -98,14 +97,9 @@
</el-table-column>
<el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="图标地址" align="center" prop="icon">
<template slot-scope="scope">
<img :src="scope.row.icon">
</template>
</el-table-column>
<el-table-column label="图标地址" align="center" prop="icon" style="width: 35px" />
<el-table-column label="计量单位" align="center" prop="productUnit" />
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -151,7 +145,7 @@
<el-input v-model="form.sort" placeholder="请输入排序" />
</el-form-item>
<el-form-item label="图标地址" prop="icon">
<el-input v-model="form.icon" placeholder="请输入图标地址" />
<ImageUpload v-model="form.icon" placeholder="请输入图标地址" />
</el-form-item>
<el-form-item label="计量单位" prop="productUnit">
<el-input v-model="form.productUnit" placeholder="请输入计量单位" />
@ -171,9 +165,10 @@
<script>
import {listType, getType, delType, addType, updateType} from "@/api/product/type";
import ImageUpload from "@/components/ImageUpload/index.vue";
export default {
components:{ImageUpload},
name: "Category",
data() {
return {
@ -213,7 +208,6 @@ export default {
},
methods: {
updateShowStatus(params){
const {catId,showStatus}=params
this.updateInfoByCategoryId({catId,showStatus})
@ -317,7 +311,6 @@ export default {
updateType(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
},
}