Merge branch 'lanmao'

master
pikachu 2021-05-20 19:20:04 +08:00
commit 7fed294388
4 changed files with 73 additions and 51 deletions

View File

@ -244,6 +244,7 @@ export default {
// //
brandOperation(v) { brandOperation(v) {
getCategoryBrandListData(v.id).then((res) => { getCategoryBrandListData(v.id).then((res) => {
console.warn(res)
this.categoryId = v.id; this.categoryId = v.id;
this.modalBrandTitle = "品牌关联"; this.modalBrandTitle = "品牌关联";
this.brandForm.categoryBrands = res.result.map((item) => item.id); this.brandForm.categoryBrands = res.result.map((item) => item.id);

View File

@ -31,9 +31,7 @@
</p> </p>
<template v-if="group.params && group.params.length > 0"> <template v-if="group.params && group.params.length > 0">
<div v-for="param in group.params" :key="param.param_id" class="params"> <div v-for="param in group.params" :key="param.param_id" class="params">
<span>{{ param.paramName }} {{ <span>{{ param.paramName }}</span>
param.paramType | paramTypeFilter
}}</span>
<span> <span>
<i-button type="text" @click="handleEditParams(group, param)">编辑</i-button> <i-button type="text" @click="handleEditParams(group, param)">编辑</i-button>
@ -56,19 +54,30 @@
<FormItem label="参数名称" prop="paramName"> <FormItem label="参数名称" prop="paramName">
<Input v-model="paramForm.paramName" style="width: 100%" /> <Input v-model="paramForm.paramName" style="width: 100%" />
</FormItem> </FormItem>
<FormItem label="参数类型" prop="paramType"> <FormItem label="可选值" prop="options">
<Select :loading="userLoading" v-model="paramForm.paramType"> <Select
<Option :value="1" :key="1">输入项</Option> v-model="paramForm.options"
<Option :value="2" :key="2">选择项</Option> placeholder="输入后回车添加"
multiple
filterable
allow-create
:popper-append-to-body="false"
popper-class="spec-values-popper"
style="width: 100%; text-align: left; margin-right: 10px"
>
<Option
v-for="item in ops"
:value="item"
:key="item"
:label="item"
>
{{item}}
</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="可选值" prop="options">
<i-input v-model="paramForm.options" type="textarea" :rows="3" placeholder="请输入可选值,选择项实用逗号分隔"></i-input>
</FormItem>
<FormItem label="选项" prop="specName3"> <FormItem label="选项" prop="specName3">
<Checkbox :value="Number" v-model="paramForm.required"></Checkbox> <Checkbox label=1 v-model="paramForm.required"></Checkbox>
<Checkbox v-model="paramForm.isIndex"></Checkbox> <Checkbox label=1 v-model="paramForm.isIndex"></Checkbox>
</FormItem> </FormItem>
</Form> </Form>
@ -127,6 +136,10 @@ export default {
paramId: "", paramId: "",
// //
paramForm: {}, paramForm: {},
/** 参数值 **/
ops:{
options: []
},
paramGroupForm: {}, paramGroupForm: {},
/** 添加、编辑参数 规格 */ /** 添加、编辑参数 规格 */
formValidate: { formValidate: {
@ -170,14 +183,15 @@ export default {
handleEditParams(group, param) { handleEditParams(group, param) {
this.paramForm = { this.paramForm = {
paramName: param.paramName, paramName: param.paramName,
paramType: param.paramType, options: param.options.split(","),
options: param.options, required: param.required==1?true:false,
required: param.required, isIndex: param.isIndex==1?true:false,
isIndex: param.isIndex,
groupId: group.groupId, groupId: group.groupId,
categoryId: this.categoryId, categoryId: this.categoryId,
id: param.id, id: param.id,
}; };
console.warn(this.paramForm.options)
this.ops = this.paramForm.options
this.modalType = 1; this.modalType = 1;
this.modalTitle = "修改参数"; this.modalTitle = "修改参数";
this.dialogParamsVisible = true; this.dialogParamsVisible = true;
@ -194,7 +208,14 @@ export default {
this.dialogParamsGroupVisible = true; this.dialogParamsGroupVisible = true;
}, },
handleAddParamsGroup() { handleAddParamsGroup() {
this.paramGroupForm = {
};
this.ops = {
};
(this.paramGroupForm.categoryId = this.categoryId), (this.modalType = 0); (this.paramGroupForm.categoryId = this.categoryId), (this.modalType = 0);
this.modalTitle = "添加参数组"; this.modalTitle = "添加参数组";
this.dialogParamsGroupVisible = true; this.dialogParamsGroupVisible = true;
}, },
@ -212,6 +233,7 @@ export default {
} }
}); });
} else { } else {
console.warn(this.paramGroupForm)
updateParamsGroup(this.paramGroupForm).then((res) => { updateParamsGroup(this.paramGroupForm).then((res) => {
this.submitLoading = false; this.submitLoading = false;
if (res.success) { if (res.success) {
@ -242,6 +264,7 @@ export default {
} }
}); });
} else { } else {
console.warn(this.paramForm.isIndex)
this.paramForm.isIndex = Number(this.paramForm.isIndex); this.paramForm.isIndex = Number(this.paramForm.isIndex);
this.paramForm.required = Number(this.paramForm.required); this.paramForm.required = Number(this.paramForm.required);
updateGoodsParams(this.paramForm).then((res) => { updateGoodsParams(this.paramForm).then((res) => {

View File

@ -18,14 +18,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.100:8890', common: 'http://192.168.0.103:8890',
// buyer: 'http://192.168.0.100:8888', // buyer: 'http://192.168.0.100:8888',
// seller: 'http://192.168.0.100:8889', seller: 'http://192.168.0.103:8889',
// manager: 'http://192.168.0.100:8887' manager: 'http://192.168.0.103:8887'
}, },
api_prod: { api_prod: {
common: 'https://common-api.pickmall.cn', common: 'https://common-api.pickmall.cn',

View File

@ -576,13 +576,13 @@
</div> </div>
<div class="form-item-view-bottom"> <div class="form-item-view-bottom">
<Collapse <Collapse
active-key="1" v-model="show"
v-for="paramsgroup in goodsParams" v-for="paramsgroup in goodsParams"
:title="paramsgroup.groupName" :title="paramsgroup.groupName"
style="text-align: left" style="text-align: left"
:key="paramsgroup.groupName" :key="paramsgroup.groupName"
> >
<Panel key="1"> <Panel key="1" name="1">
{{ paramsgroup.groupName }} {{ paramsgroup.groupName }}
<p slot="content"> <p slot="content">
<FormItem <FormItem
@ -592,25 +592,15 @@
:key="index" :key="index"
:label="`${goodsParamsList.paramName}`" :label="`${goodsParamsList.paramName}`"
> >
<Input
v-if="goodsParamsList.paramType === 1"
type="text"
v-model="goodsParamsList.paramValue"
placeholder="长度为最多50个字符"
maxlength="50"
clearable
style="width: 260px"
/>
<Select <Select
v-model="goodsParamsList.paramValue" v-model="goodsParamsList.paramValue"
v-if="goodsParamsList.paramType === 2"
placeholder="请选择" placeholder="请选择"
style="width: 200px" style="width: 200px"
clearable clearable
> >
<Option <Option
v-for="option in goodsParamsList.optionList" v-for="option in goodsParamsList.optionList"
:key="option" :key="option.paramValue"
:label="option" :label="option"
:value="option" :value="option"
></Option> ></Option>
@ -772,6 +762,7 @@ export default {
}; };
return { return {
show: '1',
// //
submitLoading: false, submitLoading: false,
// //
@ -1370,18 +1361,14 @@ export default {
(ij) => ij.paramName === elem.paramName (ij) => ij.paramName === elem.paramName
) )
) { ) {
if (elem.paramType === 2) { elem.optionList = elem.options.split(",");
elem.optionList = elem.options.split(",");
}
this.baseInfoForm.goodsParamsList.push(elem); this.baseInfoForm.goodsParamsList.push(elem);
} }
if (this.$route.query.id || this.draftId) { if (this.$route.query.id || this.draftId) {
this.baseInfoForm.goodsParamsList = this.baseInfoForm.goodsParamsList.map( this.baseInfoForm.goodsParamsList = this.baseInfoForm.goodsParamsList.map(
(i) => { (i) => {
if (i.paramId === elem.id || i.id === elem.id) { if (i.paramId === elem.id || i.id === elem.id) {
if (elem.paramType === 2) { elem.optionList = elem.options.split(",");
elem.optionList = elem.options.split(",");
}
i = { i = {
...i, ...i,
...elem, ...elem,
@ -1839,19 +1826,24 @@ export default {
this.$Message.error("请上传商品图片"); this.$Message.error("请上传商品图片");
return; return;
} }
// if ( let flag = false;
// !this.baseInfoForm.storeCategoryPath || let paramValue = "";
// !this.baseInfoForm.storeCategoryPath.length this.baseInfoForm.goodsParamsList.forEach((e)=> {
// ) { if(e.required === 1 && e.paramValue === null || e.paramValue === undefined){
// this.submitLoading = false; flag = true
// this.$Message.error(""); paramValue = e.paramName
// return; }
// } });
if(flag){
this.$Message.error(paramValue +" 参数值不能为空");
this.submitLoading = false;
return;
}
// 0 // 0
if (this.baseInfoForm.freightPayer !== "BUYER") { if (this.baseInfoForm.freightPayer !== "BUYER") {
this.baseInfoForm.templateId = 0; this.baseInfoForm.templateId = 0;
} }
this.baseInfoForm.skuList = this.skuTableData.map((sku) => { this.baseInfoForm.skuList = this.skuTableData.map((sku) => {
delete sku._index; delete sku._index;
delete sku._rowKey; delete sku._rowKey;
@ -1865,6 +1857,12 @@ export default {
(i) => i.url (i) => i.url
); );
} }
/** 参数校验 **/
/* Object.keys(this.baseInfoForm.goodsParamsList).forEach((item) => {
console.warn(item.paramName)
});*/
if (this.goodsId) { if (this.goodsId) {
API_GOODS.editGoods(this.goodsId, this.baseInfoForm).then((res) => { API_GOODS.editGoods(this.goodsId, this.baseInfoForm).then((res) => {