发布商品页面bug修改

master
mabo 2021-06-25 11:29:48 +08:00
parent 712e3cd2f2
commit bb51771898
1 changed files with 56 additions and 44 deletions

View File

@ -27,7 +27,6 @@
</Modal> </Modal>
<div class="step-list"> <div class="step-list">
<steps :current="activestep" simple style="height:60px;margin-top: 10px" process-status="process"> <steps :current="activestep" simple style="height:60px;margin-top: 10px" process-status="process">
<div class="step-view"> <div class="step-view">
@ -194,7 +193,7 @@
<AutoComplete style="width: 150px" v-model="item.name" :maxlength="30" <AutoComplete style="width: 150px" v-model="item.name" :maxlength="30"
placeholder="请输入规格项名称" placeholder="请输入规格项名称"
:filter-method="filterMethod" :data="skuData" :filter-method="filterMethod" :data="skuData"
@on-change="editSkuItem"> @on-change="throttle(editSkuItem($index, item.name), 1000)">
</AutoComplete> </AutoComplete>
<Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)"> <Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)">
</Button> </Button>
@ -209,7 +208,7 @@
:maxlength="30" placeholder="请输入规格值名称" :maxlength="30" placeholder="请输入规格值名称"
:filter-method="filterMethod" :data="skuVal" :filter-method="filterMethod" :data="skuVal"
@on-focus="changeSkuVals(item.name)" @on-focus="changeSkuVals(item.name)"
@on-change="skuValueChange(val.value, $index, item)"> @on-change="throttle(skuValueChange(val.value, $index, item), 1000)">
</AutoComplete> </AutoComplete>
<Button type="error" style="margin-left: 10px" <Button type="error" style="margin-left: 10px"
@ -842,6 +841,7 @@ export default {
* @paramsGroup 参数分组 * @paramsGroup 参数分组
* @groupIndex 参数分组下标 * @groupIndex 参数分组下标
* @params 参数选项 * @params 参数选项
* @paramIndex 参数下标值
* @value 参数选项值 * @value 参数选项值
*/ */
selectParams(paramsGroup, groupIndex, params, paramsIndex, value) { selectParams(paramsGroup, groupIndex, params, paramsIndex, value) {
@ -871,7 +871,6 @@ export default {
isIndex: params.isIndex, isIndex: params.isIndex,
required: params.required, required: params.required,
} }
console.log(this.baseInfoForm.goodsParamsDTOList);
}, },
// sku // sku
@ -977,6 +976,7 @@ export default {
} }
); );
}, },
//
GET_GoodsUnit() { GET_GoodsUnit() {
API_GOODS.getGoodsUnitList().then((res) => { API_GOODS.getGoodsUnitList().then((res) => {
if (res.success) { if (res.success) {
@ -984,6 +984,7 @@ export default {
} }
}); });
}, },
//
GET_ShopGoodsLabel() { GET_ShopGoodsLabel() {
API_GOODS.getShopGoodsLabelListSeller().then((res) => { API_GOODS.getShopGoodsLabelListSeller().then((res) => {
if (res.success) { if (res.success) {
@ -1122,7 +1123,6 @@ export default {
this.skuTableData = skus; this.skuTableData = skus;
}, },
/** 根据当前分类id查询商品应包含的参数 */ /** 根据当前分类id查询商品应包含的参数 */
GET_GoodsParams() { GET_GoodsParams() {
API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then( API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then(
@ -1166,7 +1166,6 @@ export default {
); );
}, },
/** 添加规格项 */ /** 添加规格项 */
addSkuItem() { addSkuItem() {
if (this.skuInfo.length >= 5) { if (this.skuInfo.length >= 5) {
@ -1183,15 +1182,17 @@ export default {
this.renderTableData(); this.renderTableData();
}, },
// //
editSkuItem() { editSkuItem(index,name) {
// this.skuTableColumn[index].title = name
// this.skuTableColumn[index].key = 'sku' + index
this.renderTableData(); this.renderTableData();
}, },
// //
async skuValueChange(val, index, item) { async skuValueChange(val, index, item) {
/** 更新skuInfo数据 */ /** 更新skuInfo数据 */
let _arr = cloneObj(item); // let _arr = cloneObj(item);
this.$set(item, "name", _arr.name); // this.$set(item, "name", _arr.name);
this.$set(this.skuInfo, index, _arr); // this.$set(this.skuInfo, index, _arr);
/** /**
* 渲染规格详细表格 * 渲染规格详细表格
*/ */
@ -1272,18 +1273,17 @@ export default {
renderTableData() { renderTableData() {
this.skuTableColumn = []; this.skuTableColumn = [];
this.skuTableData = []; this.skuTableData = [];
let pushData = [];
// //
this.skuInfo.forEach((sku) => { this.skuInfo.forEach((sku,index) => {
// //
let columnName = sku.name; let columnName = sku.name;
this.skuTableColumn.push({ pushData.push({
title: columnName, title: columnName,
key: columnName, key: columnName,
}); });
}); });
let pushData = [];
pushData.push(...this.skuTableColumn);
this.baseInfoForm.goodsType != "VIRTUAL_GOODS" this.baseInfoForm.goodsType != "VIRTUAL_GOODS"
? pushData.push({ ? pushData.push({
title: "重量", title: "重量",
@ -1314,27 +1314,55 @@ export default {
); );
this.skuTableColumn = pushData; this.skuTableColumn = pushData;
// //
let cloneTemp = cloneObj(this.skuInfo); let cloneTemp = cloneObj(this.skuInfo);
// //
this.skuTableData = []; this.skuTableData = [];
// //
if (cloneTemp[0]) { if (cloneTemp[0]) {
// //
let result = []; let result = [];
// sku // sku
cloneTemp[0].spec_values.forEach((specItem) => { cloneTemp[0].spec_values.forEach((specItem) => {
result.push({ result.push({
[specItem.name]: specItem.value, [cloneTemp[0].name]: specItem.value,
images: this.baseInfoForm.goodsGalleryFiles || [], images: this.baseInfoForm.goodsGalleryFiles || [],
}); });
}); });
cloneTemp.splice(0, 1); cloneTemp.splice(0, 1);
result = this.specIterator(result, cloneTemp); result = this.specIterator(result, cloneTemp);
this.skuTableData = result; this.skuTableData = result;
console.log(this.skuTableData);
} }
},
/**
* 迭代属性形成表格
* result 渲染的数据
* array spec数据
*/
specIterator(result, cloneTemp) {
//
if (cloneTemp.length > 0) {
let table = [];
result.forEach((resItem) => {
cloneTemp[0].spec_values.forEach((valItem) => {
let obj = cloneObj(resItem);
obj[cloneTemp[0].name] = valItem.value;
table.push(obj);
});
});
result = [];
table.forEach((t) => {
result.push(t);
});
//
cloneTemp.splice(0, 1);
} else {
return result;
}
return this.specIterator(result, cloneTemp);
}, },
/** 根据分类id获取系统设置规格信息*/ /** 根据分类id获取系统设置规格信息*/
Get_SkuInfoByCategory(categoryId) { Get_SkuInfoByCategory(categoryId) {
@ -1355,34 +1383,18 @@ export default {
filterMethod(value, option) { filterMethod(value, option) {
return option.toUpperCase().indexOf(value.toUpperCase()) !== -1; return option.toUpperCase().indexOf(value.toUpperCase()) !== -1;
}, },
//
/** throttle (fn,time) {
* 迭代属性形成表格 let startTime = new Date();//
* result 渲染的数据 return function(){
* array spec数据 let time_ = (new Date() - startTime) >= time;//time
*/ if(time_){
specIterator(result, cloneTemp) { fn.apply(this);
// startTime = new Date();//
if (cloneTemp.length > 0) { }
let table = [];
result.forEach((resItem) => {
cloneTemp[0].spec_values.forEach((valItem) => {
let obj = cloneObj(resItem);
obj[valItem.name] = valItem.value;
table.push(obj);
});
});
result = [];
table.forEach((t) => {
result.push(t);
});
//
cloneTemp.splice(0, 1);
} else {
return result;
} }
return this.specIterator(result, cloneTemp);
}, },
// //
handleSpan({row, column, rowIndex, columnIndex}) { handleSpan({row, column, rowIndex, columnIndex}) {
}, },