Commit 241fff1c authored by Mac's avatar Mac

商品详情修改

parent d5e7972d
...@@ -1526,7 +1526,7 @@ ...@@ -1526,7 +1526,7 @@
let obj = { let obj = {
Name: "", Name: "",
SpecificationValueList: [], SpecificationValueList: [],
Sort: that.SpecificationList.length + 1, Sort:that.SpecificationList.length>0? that.SpecificationList[that.SpecificationList.length-1].Sort + 1: that.SpecificationList.length + 1,
Id: 0, Id: 0,
EnabledImage: 2 EnabledImage: 2
}; };
...@@ -1538,7 +1538,8 @@ ...@@ -1538,7 +1538,8 @@
Id: 0, Id: 0,
Image: "", Image: "",
Name: "", Name: "",
Sort: item.SpecificationValueList.length + 1 // Sort: item.SpecificationValueList.length + 1
Sort: item.SpecificationValueList.length>0 ? item.SpecificationValueList[item.SpecificationValueList.length-1].Sort + 1:item.SpecificationValueList.length + 1
}; };
this.SpecificationList[index].SpecificationValueList.push(obj); this.SpecificationList[index].SpecificationValueList.push(obj);
}, },
...@@ -2145,8 +2146,8 @@ ...@@ -2145,8 +2146,8 @@
if (this.addMsg.PresentFXGrade == 0) { if (this.addMsg.PresentFXGrade == 0) {
this.addMsg.PresentFXGrade = '' this.addMsg.PresentFXGrade = ''
} }
if (!this.addMsg.MarketingLogo||this.addMsg.MarketingLogo == null) {
if (!this.addMsg.MarketingLogo||this.addMsg.MarketingLogo == null ) {
this.addMsg.MarketingLogo = { this.addMsg.MarketingLogo = {
iswords: 0, iswords: 0,
words: "", words: "",
...@@ -2154,7 +2155,15 @@ ...@@ -2154,7 +2155,15 @@
wordsBack: "", wordsBack: "",
ico: "" ico: ""
} }
} else { } else if(this.addMsg.MarketingLogo.indexOf('iswords')==-1){
this.addMsg.MarketingLogo = {
iswords: 0,
words: "",
wordsColor: "",
wordsBack: "",
ico: ""
}
}else {
let MarketingLogo = JSON.parse(this.addMsg.MarketingLogo) let MarketingLogo = JSON.parse(this.addMsg.MarketingLogo)
let obj=MarketingLogo let obj=MarketingLogo
this.addMsg.MarketingLogo = obj this.addMsg.MarketingLogo = obj
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<div class="content"> <div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:60%"> <el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:60%">
<el-form-item label="站点名称" prop="Name" class="is-required"> <el-form-item label="站点名称" prop="SiteName" class="is-required">
<el-input v-model="addMsg.SiteName" placeholder="请输入包邮名称" /> <el-input v-model="addMsg.SiteName" placeholder="请输入站点名称" />
</el-form-item> </el-form-item>
...@@ -21,125 +21,34 @@ ...@@ -21,125 +21,34 @@
<div style="margin-top:20px"> <div style="margin-top:20px">
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button> <el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
</div> </div>
<!-- 选择分类 -->
<el-dialog custom-class="app-add-cat" title="选择分类" :visible.sync="flDig" width="1100px">
<el-row>
<el-col :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">一级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in fenleiData" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild2(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
</div>
</el-col>
<el-col v-show="childList2.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">二级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList2" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i v-if="item.ChildList.length>0" @click="getChild3(item.ChildList)" class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
</div>
</el-col>
<el-col v-show="childList3.length>0" :span="8" style="padding:0 10px;box-sizing:border-box">
<h3 style="padding:15px 0">三级分类</h3>
<div class="app-goods-cat-list active">
<el-checkbox-group v-model="NewCategoryList" @change="handleCheckChange">
<div v-for="(item,index) in childList3" :key="index" flex="dir:left box:first" class="cat-item">
<el-checkbox :label="item.Id">
<span style="display: none;">{{item.Name}}</span>
</el-checkbox>
<div flex="box:last cross:center">
<span>{{item.Name}}</span>
<i class="el-icon-arrow-right"></i>
</div>
</div>
</el-checkbox-group>
</div>
</el-col>
</el-row>
<div class="tag-box">
<el-tag @close="exitCheck(item)" v-for="(item,index) in addMsg.CategoryList" :key="index" type="warning"
closable style="margin-right:5px">{{item.Name}}</el-tag>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="flDig=false,addMsg.CategoryList=keepCategoryList,ExitCateList()">取 消</el-button>
<el-button @click="flDig = false" size="small" type="primary">确 定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
checkAll: false,
checkedCities: [],
cities: [],
cityOptions: [],
isIndeterminate: true,
flDig: false,
rulesType:1,
addMsg: { addMsg: {
Id: 0, ID: 0,
FullNumPinkage:0, SiteName:'',
FullMoneyPinkage:0, RegionList:[],
IsEnable: 0, IsEnable:0
Name:'',
CategoryList: [],
FreeShippingUrl:'',
}, },
rules: { rules: {
FullNumPinkage: [{
required: true, SiteName: [{
message: '请输入件数',
trigger: 'blur'
}],
Name: [{
required: true, required: true,
message: '请输入包邮名称', message: '请输入站点名称',
trigger: 'blur' trigger: 'blur'
}], }],
FullMoneyPinkage: [{
required: true,
message: '请选择额度',
trigger: 'change'
}],
IsEnable: [{
required: true,
message: '请选择是否启用',
trigger: 'change'
}],
}, },
loading: false, loading: false,
fenleiData:[],
childList2: [],
childList3: [],
keepCategoryList: [],
NewCategoryList: [],
}; };
}, },
created() { created() {
this.getTree();
if(this.$route.query.ID){ if(this.$route.query.ID){
this.getData(this.$route.query.ID) this.getData(this.$route.query.ID)
} }
...@@ -151,23 +60,6 @@ ...@@ -151,23 +60,6 @@
Save(formName) { Save(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if (this.addMsg.CategoryList.length == 0) {
this.Error("请选择分类!");
return;
}
if(this.addMsg.FullNumPinkage == 0 && this.addMsg.FullMoneyPinkage == 0){
this.Error("包邮件数和满额额度至少一个大于0");
return;
}
let List = []
this.addMsg.CategoryList.forEach(x=>{
let obj = {}
obj.CategoryId = x.CategoryId;
obj.CategoryName = x.CategoryName;
List.push(obj)
})
this.addMsg.CategoryList = List
this.apipost("/api/MallBase/AddOrUpdateFreeShipping", this.addMsg, res => { this.apipost("/api/MallBase/AddOrUpdateFreeShipping", this.addMsg, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.CommonJump('mailRules'); this.CommonJump('mailRules');
...@@ -181,75 +73,9 @@ ...@@ -181,75 +73,9 @@
} }
}); });
}, },
ExitCateList() {
this.NewCategoryList = [];
this.addMsg.CategoryList.forEach(item => {
item.Name = item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
},
handleCheckChange() {
this.addMsg.CategoryList = [];
this.NewCategoryList.forEach(list => {
this.fenleiData.forEach(item => {
if (list == item.Id) {
item.CategoryId = item.Id;
this.addMsg.CategoryList.push(item)
}
item.ChildList.forEach(item2 => {
if (list == item2.Id) {
item2.CategoryId = item2.Id;
this.addMsg.CategoryList.push(item2)
}
item2.ChildList.forEach(item3 => {
if (list == item3.Id) {
item3.CategoryId = item3.Id;
this.addMsg.CategoryList.push(item3)
}
})
})
})
})
},
exitCheck(item, index) {
this.addMsg.CategoryList.forEach((list, k) => {
if (list.Id == item.Id) {
this.addMsg.CategoryList.splice(k, 1);
}
})
this.ExitCateList();
},
getChild3(ChildList) {
this.childList3 = ChildList;
},
getChild2(ChildList) {
this.childList2 = ChildList;
},
getTree() {
let msg1 = {
Id: 0,
Name: '',
Tier: 0,
ParentId: 0,
Enabled: 1,
IsShow: 1,
}
this.apipost("/api/product/GetProductCategoryTreeList", msg1, res => {
if (res.data.resultCode == 1) {
let pageData = res.data.data;
this.fenleiData = pageData;
this.fenleiData.forEach(item => {
item.CategoryName = item.Name;
item.ChildList.forEach(item2 => {
item2.CategoryName = item2.Name;
item2.ChildList.forEach(item3 => {
item3.CategoryName = item3.Name;
})
})
})
}
})
},
getData(ID) { getData(ID) {
this.loading = true; this.loading = true;
this.apipost("/api/MallBase/GetFreeShippingModel", { this.apipost("/api/MallBase/GetFreeShippingModel", {
...@@ -257,15 +83,7 @@ ...@@ -257,15 +83,7 @@
}, res => { }, res => {
this.loading = false; this.loading = false;
this.addMsg = res.data.data; this.addMsg = res.data.data;
if(this.addMsg.FullMoneyPinkage!=0 && this.addMsg.FullNumPinkage==0){
this.rulesType=2
}
this.NewCategoryList = [];
this.addMsg.CategoryList.forEach(item => {
item.Name = item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
this.checkedCities = [];
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment