商品信息列表

master
2812875475 2024-03-14 15:22:57 +08:00
parent 2fff485751
commit 4fca053825
6 changed files with 43 additions and 16 deletions

View File

@ -12,11 +12,14 @@ export function listInfo(query) {
// 查询商品信息详细 // 查询商品信息详细
export function getInfo(id) { export function getInfo(id) {
return request({ return request({
url: '/product/info/' + id, url: '/product/info/product/' + id,
method: 'get' method: 'get'
}) })
} }
// 新增商品信息 // 新增商品信息
export function addInfo(data) { export function addInfo(data) {
return request({ return request({

View File

@ -67,9 +67,11 @@ import {listAttribute} from "@/api/product/attribute";
export default { export default {
name: "CheckAttribute", name: "CheckAttribute",
props: { props: {
value: { items: {
type: Array, type: Array,
default: [] default: function() {
return ['item1', 'item2', 'item3'];
}
}, },
checkedList: { checkedList: {
type: Array, type: Array,
@ -109,6 +111,7 @@ export default {
attributeTotal: 0, attributeTotal: 0,
attributeList: [], attributeList: [],
total: 0, total: 0,
value: []
} }
}, },
created() { created() {

View File

@ -67,9 +67,11 @@ import {listAttributeGroup} from "@/api/product/attributeGroup";
export default { export default {
name: "CheckAttributeGroup", name: "CheckAttributeGroup",
props: { props: {
value: { items: {
type: Array, type: Array,
default: [] default: function() {
return ['item1', 'item2', 'item3'];
}
}, },
checkedList: { checkedList: {
type: Array, type: Array,
@ -109,6 +111,7 @@ export default {
attributeGroupTotal: 0, attributeGroupTotal: 0,
attributeGroupList: [], attributeGroupList: [],
total: 0, total: 0,
value:[]
} }
}, },
created() { created() {

View File

@ -67,9 +67,11 @@ import {listBrand} from "@/api/product/brand";
export default { export default {
nam: "CheckBrand", nam: "CheckBrand",
props: { props: {
value: { items: {
type: Array, type: Array,
default: [] default: function() {
return ['item1', 'item2', 'item3'];
}
}, },
checkedList: { checkedList: {
type: Array, type: Array,
@ -109,6 +111,7 @@ export default {
brandTotal: 0, brandTotal: 0,
brandList: [], brandList: [],
total: 0, total: 0,
value:[]
} }
}, },
created() { created() {

View File

@ -148,7 +148,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-tabs value=""> <el-tabs>
<el-tab-pane label="商品属性" name="attribute"> <el-tab-pane label="商品属性" name="attribute">
<Attribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/> <Attribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/>
</el-tab-pane> </el-tab-pane>
@ -184,6 +184,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "Category", name: "Category",
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
components: { components: {

View File

@ -97,7 +97,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['product:info:edit']" v-hasPermi="['product:info:query']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
@ -366,7 +366,6 @@
<div v-if="active==4"> <div v-if="active==4">
<el-form-item label="商品备注"> <el-form-item label="商品备注">
<editor v-model="form.remark" :min-height="192"/> <editor v-model="form.remark" :min-height="192"/>
</el-form-item> </el-form-item>
@ -438,6 +437,7 @@ export default {
templateAttributeGroupList: [], templateAttributeGroupList: [],
templateAttributeList: [], templateAttributeList: [],
attributeList: [] attributeList: []
}, },
ruleAddFormStatus: false, ruleAddFormStatus: false,
addRulePropertyValue: null, addRulePropertyValue: null,
@ -476,7 +476,13 @@ export default {
brandId: null, brandId: null,
}, },
// //
form: {}, form: {
ruleId:[],
skuList:[],
templateAttributeGroupList:[],
attributeCheckedList:[],
templateAttributeList:[],
},
// //
rules: { rules: {
name: [ name: [
@ -525,7 +531,6 @@ export default {
}, },
"form.type": { "form.type": {
handler(value) { handler(value) {
console.log(value)
if (value != null) { if (value != null) {
getTemplateAttribute(value).then(response => { getTemplateAttribute(value).then(response => {
console.log(response) console.log(response)
@ -547,7 +552,6 @@ export default {
methods: { methods: {
onSubmit() { onSubmit() {
this.skuList.forEach(skuInfo => { this.skuList.forEach(skuInfo => {
console.log(this.oneSettingValue)
skuInfo.image = this.oneSettingValue.image; skuInfo.image = this.oneSettingValue.image;
skuInfo.stock = this.oneSettingValue.stock; skuInfo.stock = this.oneSettingValue.stock;
skuInfo.price = this.oneSettingValue.price; skuInfo.price = this.oneSettingValue.price;
@ -557,9 +561,11 @@ export default {
this.skuList=[] this.skuList=[]
}, },
changeRule(ruleId) { changeRule(ruleId) {
this.titleList = [] this.titleList = []
let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId); let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId);
const {ruleAttrList} = ruleInfo; const {ruleAttrList} = ruleInfo;
let skuTotal = 1; let skuTotal = 1;
for (let ruleAttrListKey in ruleAttrList) { for (let ruleAttrListKey in ruleAttrList) {
let ruleAttrInfo = ruleAttrList[ruleAttrListKey]; let ruleAttrInfo = ruleAttrList[ruleAttrListKey];
@ -597,8 +603,6 @@ export default {
let counter = 0; let counter = 0;
for (let forIndex = 0; forIndex < forSize; forIndex++) { for (let forIndex = 0; forIndex < forSize; forIndex++) {
const {ruleList} = ruleAttrInfo; const {ruleList} = ruleAttrInfo;
console.log(ruleList)
ruleList.forEach(value => { ruleList.forEach(value => {
for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) { for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) {
this.skuList[counter++]["prop" + currentIndex] = value; this.skuList[counter++]["prop" + currentIndex] = value;
@ -657,7 +661,6 @@ export default {
listCategory().then(response => { listCategory().then(response => {
this.categoryOptions = [] this.categoryOptions = []
this.categoryOptions = this.handleTree(response.data, "id", "parentId"); this.categoryOptions = this.handleTree(response.data, "id", "parentId");
console.log(this.categoryOptions);
}) })
}, },
next() { next() {
@ -728,7 +731,13 @@ export default {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getInfo(id).then(response => { getInfo(id).then(response => {
console.log(response)
this.form = response.data; this.form = response.data;
this.changeRule(response.data.ruleId)
this.form.type=parseInt(response.data.type)
this.form.mianType=parseInt(response.data.mianType)
this.form.parentType=parseInt(response.data.parentType)
this.CategoryTree()
this.open = true; this.open = true;
this.title = "修改商品信息"; this.title = "修改商品信息";
}); });
@ -744,6 +753,11 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
this.form.templateAttributeGroupList=this.categoryCommonElement.templateAttributeGroupList
this.form.attributeCheckedList=this.attributeCheckedList
this.form.skuList=this.skuList
this.form.templateAttributeList=this.categoryCommonElement.templateAttributeList
addInfo(this.form).then(response => { addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;