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