发布商品修改
parent
31295d7cb2
commit
4d7b4eb2b4
|
@ -17,14 +17,14 @@ export default {
|
||||||
* @description api请求基础路径
|
* @description api请求基础路径
|
||||||
*/
|
*/
|
||||||
api_dev: {
|
api_dev: {
|
||||||
// common: "https://common-api.pickmall.cn",
|
common: "https://common-api.pickmall.cn",
|
||||||
// buyer: "https://buyer-api.pickmall.cn",
|
buyer: "https://buyer-api.pickmall.cn",
|
||||||
// seller: "https://store-api.pickmall.cn",
|
seller: "https://store-api.pickmall.cn",
|
||||||
// manager: "https://admin-api.pickmall.cn"
|
manager: "https://admin-api.pickmall.cn"
|
||||||
common: 'http://192.168.0.109:8890',
|
// common: 'http://192.168.0.109:8890',
|
||||||
buyer: 'http://192.168.0.109:8888',
|
// buyer: 'http://192.168.0.109:8888',
|
||||||
seller: 'http://192.168.0.109:8889',
|
// seller: 'http://192.168.0.109:8889',
|
||||||
manager: 'http://192.168.0.109:8887'
|
// manager: 'http://192.168.0.109:8887'
|
||||||
},
|
},
|
||||||
api_prod: {
|
api_prod: {
|
||||||
common: "https://common-api.pickmall.cn",
|
common: "https://common-api.pickmall.cn",
|
||||||
|
|
|
@ -132,13 +132,13 @@ export const delSpec = (id, params) => {
|
||||||
return deleteRequest(`/goods/spec/del/${id}`, params);
|
return deleteRequest(`/goods/spec/del/${id}`, params);
|
||||||
};
|
};
|
||||||
// 获取商品规格值列表
|
// 获取商品规格值列表
|
||||||
export const getSpecValuesListData = (id, params) => {
|
// export const getSpecValuesListData = (id, params) => {
|
||||||
return getRequest(`/goods/spec-values/values/${id}`, params);
|
// return getRequest(`/goods/spec-values/values/${id}`, params);
|
||||||
};
|
// };
|
||||||
// 添加商品规格值
|
// 添加商品规格值
|
||||||
export const saveSpecValues = (id, params) => {
|
// export const saveSpecValues = (id, params) => {
|
||||||
return postRequest(`/goods/spec-values/save/${id}`, params);
|
// return postRequest(`/goods/spec-values/save/${id}`, params);
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 查询某分类下的全部子分类列表
|
// 查询某分类下的全部子分类列表
|
||||||
export const getGoodsCategory = parent_id => {
|
export const getGoodsCategory = parent_id => {
|
||||||
|
|
|
@ -22,10 +22,10 @@ export default {
|
||||||
// buyer: 'https://buyer-api.pickmall.cn',
|
// buyer: 'https://buyer-api.pickmall.cn',
|
||||||
// seller: 'https://store-api.pickmall.cn',
|
// seller: 'https://store-api.pickmall.cn',
|
||||||
// manager: 'https://admin-api.pickmall.cn',
|
// manager: 'https://admin-api.pickmall.cn',
|
||||||
common: 'http://192.168.0.109:8890',
|
common: 'http://192.168.0.100:8890',
|
||||||
buyer: 'http://192.168.0.109:8888',
|
buyer: 'http://192.168.0.100:8888',
|
||||||
seller: 'http://192.168.0.109:8889',
|
seller: 'http://192.168.0.100:8889',
|
||||||
manager: 'http://192.168.0.109:8887'
|
manager: 'http://192.168.0.100:8887'
|
||||||
},
|
},
|
||||||
api_prod: {
|
api_prod: {
|
||||||
common: 'https://common-api.pickmall.cn',
|
common: 'https://common-api.pickmall.cn',
|
||||||
|
|
|
@ -185,10 +185,7 @@
|
||||||
<div class="sku-item" v-for="(item, $index) in skuInfo" :key="$index">
|
<div class="sku-item" v-for="(item, $index) in skuInfo" :key="$index">
|
||||||
<Card :bordered="true">
|
<Card :bordered="true">
|
||||||
<FormItem label="规格名:" class="sku-item-content-name">
|
<FormItem label="规格名:" class="sku-item-content-name">
|
||||||
<AutoComplete style="width: 150px" v-model="item.name" :maxlength="30" :data="specListSelected" placeholder="请输入规格项名称" :filter-method="filterMethod"
|
<AutoComplete style="width: 150px" v-model="item.name" :maxlength="30" :data="specListSelected" placeholder="请输入规格项名称" />
|
||||||
@on-change="skuItemChange(item.name, $index)" @keyup.enter.native="editSkuItem(item, $index)" @on-focus="
|
|
||||||
getActiveSkuItem(index, $index, item, val)
|
|
||||||
" @on-blur="editSkuItem(item, $index)" />
|
|
||||||
<Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)">删除
|
<Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)">删除
|
||||||
</Button>
|
</Button>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
@ -197,22 +194,8 @@
|
||||||
<!--规格值文本列表-->
|
<!--规格值文本列表-->
|
||||||
<div v-for="(val, index) in item.spec_values" :key="index" style="padding: 0px 20px 10px 0px; float: left">
|
<div v-for="(val, index) in item.spec_values" :key="index" style="padding: 0px 20px 10px 0px; float: left">
|
||||||
<div>
|
<div>
|
||||||
<AutoComplete style="width: 150px; float: left" v-model="val.value" :maxlength="30" :data="skuValue" placeholder="请输入规格值名称" :filter-method="filterMethod" @on-change="
|
<AutoComplete style="width: 150px; float: left" v-model="val.value" :maxlength="30" :data="skuValue" placeholder="请输入规格值名称"></AutoComplete>
|
||||||
skuValueChange(val.value, index, item)
|
<Button type="error" style="float: left; margin-left: 10px" @click="handleCloseSkuValue($index, index)">删除</Button>
|
||||||
" @on-focus="
|
|
||||||
getActiveSkuValueItem(
|
|
||||||
index,
|
|
||||||
$index,
|
|
||||||
item,
|
|
||||||
val
|
|
||||||
)
|
|
||||||
" @keyup.enter.native="
|
|
||||||
editSkuIValue(item, val, $index, index)
|
|
||||||
" @on-blur="
|
|
||||||
editSkuIValue(item, val, $index, $index)
|
|
||||||
"></AutoComplete>
|
|
||||||
<Button type="error" style="float: left; margin-left: 10px" @click="handleCloseSkuValue($index, index)">删除
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left">
|
<div style="float: left">
|
||||||
|
@ -853,6 +836,7 @@ export default {
|
||||||
fieldData.unshift(fieldData.splice(index, 1)[0]);
|
fieldData.unshift(fieldData.splice(index, 1)[0]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 获取商品模板
|
||||||
GET_GoodsTemplate() {
|
GET_GoodsTemplate() {
|
||||||
let searchParams = {
|
let searchParams = {
|
||||||
saveType: "TEMPLATE",
|
saveType: "TEMPLATE",
|
||||||
|
@ -865,6 +849,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 编辑sku图片
|
||||||
editSkuPicture(row) {
|
editSkuPicture(row) {
|
||||||
console.log(row);
|
console.log(row);
|
||||||
if (row.images && row.images.length > 0) {
|
if (row.images && row.images.length > 0) {
|
||||||
|
@ -952,26 +937,6 @@ export default {
|
||||||
}
|
}
|
||||||
return !check;
|
return !check;
|
||||||
},
|
},
|
||||||
async getActiveSkuItem(index, $index, item, val) {
|
|
||||||
this.specSelected = "";
|
|
||||||
await this.GET_SkuSpec();
|
|
||||||
},
|
|
||||||
async getActiveSkuValueItem(index, $index, item, val) {
|
|
||||||
this.specValSelected = "";
|
|
||||||
await this.GET_SkuSpecVal(item.spec_id);
|
|
||||||
},
|
|
||||||
async editSkuItem(item, $index) {
|
|
||||||
if (item.name) {
|
|
||||||
API_GOODS.insertSpecSeller({
|
|
||||||
specName: item.name,
|
|
||||||
categoryPath: this.baseInfoForm.categoryPath,
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.message !== "60001") {
|
|
||||||
this.skuItemChange(item.name, $index);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
gotoGoodsList() {
|
gotoGoodsList() {
|
||||||
this.$router.push({ name: "goods" });
|
this.$router.push({ name: "goods" });
|
||||||
|
@ -1170,25 +1135,7 @@ export default {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
async GET_SkuSpec() {
|
|
||||||
if(!this.specSelected){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let specResult = await API_GOODS.getSpecListSellerData({
|
|
||||||
pageNumber: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
specName: this.specSelected,
|
|
||||||
categoryPath: this.baseInfoForm.categoryPath,
|
|
||||||
});
|
|
||||||
if (specResult.success && specResult.result.records.length > 0) {
|
|
||||||
this.specListSelected = specResult.result.records.map(
|
|
||||||
(i) => i.specName
|
|
||||||
);
|
|
||||||
this.specList = specResult.result.records;
|
|
||||||
} else {
|
|
||||||
this.specListSelected = [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/** 添加规格项 */
|
/** 添加规格项 */
|
||||||
addSkuItem() {
|
addSkuItem() {
|
||||||
if (this.skuInfo.length >= 5) {
|
if (this.skuInfo.length >= 5) {
|
||||||
|
@ -1296,49 +1243,6 @@ export default {
|
||||||
*/
|
*/
|
||||||
this.renderTableData();
|
this.renderTableData();
|
||||||
},
|
},
|
||||||
/** 编辑规格值时触发 */
|
|
||||||
async editSkuIValue(item, val, $index, index) {
|
|
||||||
await API_GOODS.saveSpecValuesSeller(item.spec_id, {
|
|
||||||
spec_value: [val.value],
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 渲染规格详细表格
|
|
||||||
*/
|
|
||||||
this.renderTableData();
|
|
||||||
},
|
|
||||||
/** 获取编辑时的skuInfo信息 */
|
|
||||||
getSkuInfo() {
|
|
||||||
/** 下拉列表数据(skuData)存在时 检测productSkuInfo中对应的规格(spec_id)项 并且赋值于skuInfo中对应的规格项信息(描述 + 名称) */
|
|
||||||
if (this.categoryId) {
|
|
||||||
API_GOODS.getSpecValuesListData(this.categoryId, {}).then(
|
|
||||||
(response) => {
|
|
||||||
this.skuData = response;
|
|
||||||
if (
|
|
||||||
this.skuData.length > 0 &&
|
|
||||||
Array.isArray(this.productSkuInfo) &&
|
|
||||||
this.productSkuInfo.length > 0
|
|
||||||
) {
|
|
||||||
this.skuInfo = cloneObj(this.productSkuInfo);
|
|
||||||
if (this.skuInfo.length > 0) {
|
|
||||||
this.skuInfo.forEach((key) => {
|
|
||||||
this.skuData.forEach((item) => {
|
|
||||||
if (key.spec_id === item.spec_id) {
|
|
||||||
key.name = item.name;
|
|
||||||
key.spec_memo = item.spec_memo;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 渲染规格详细表格
|
|
||||||
*/
|
|
||||||
this.renderTableData();
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* 渲染table所需要的column 和 data
|
* 渲染table所需要的column 和 data
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue