Commit 60089f9f authored by 黄媛媛's avatar 黄媛媛

新包邮规则

parent 00e04a7a
<template>
<div class="mailRules PeaceDistribution">
<div class="head-title">
包邮规则
<el-button @click="CommonJump('mailRulesSet')" style="float:right;margin-top: -5px;" size="small" type="primary">
新增包邮规则
</el-button>
</div>
<div class="content">
<div >
<span style='margin-right:10px'>是否开启全局分类包邮规则</span>
<el-switch v-model="IsFreeShipping" active-color="#409EFF" :active-value="1"
:inactive-value="0" @change="changeEnabled_all()">
</el-switch>
</div>
<el-table
:data="tableData"
v-loading="loading"
border
style="width: 100%;margin:20px 0">
<el-table-column
prop="ID"
width="90"
label="编号">
</el-table-column>
<el-table-column
prop="FullMoneyPinkage"
width="150"
label="满额金额">
</el-table-column>
<el-table-column
prop="FullNumPinkage"
width="150"
label="满件数">
</el-table-column>
<el-table-column
prop="GradeName"
width="150"
label="是否启用">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsEnable" active-color="#409EFF" :active-value="1"
:inactive-value="0" @change="changeEnabled(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column
prop="GradeName"
label="分类信息">
<template slot-scope="scope">
<el-tag style="margin:0 5px 5px 0" size="mini" v-for="(item,index) in scope.row.CategoryList" :key="index">
{{item.CategoryName}}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="address"
width="150"
label="操作">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
<img @click="CommonJump('mailRulesSet',{ID:scope.row.ID})" style="width:32px;height:32px" src="../../assets/img/userman/edit.png" alt="">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img @click="Delete(scope.row,1)" style="width:32px;height:32px;margin:0 10px" src="../../assets/img/userman/del.png" alt="">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:current-page.sync="msg.pageIndex"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
export default {
data() {
return {
czType:1,
czjfDig:false,
changeState:false,
loading:false,
isIndeterminate: true,
value:'',
options:[],
tableData:[],
msg:{
pageIndex:1,
pageSize:15,
},
total:0,
cateList:[],
IsFreeShipping:0,
MallBaseId:0
};
},
created() {
this.getList();
this.getSetup();
this.MallBaseId = this.getLocalStorage()?this.getLocalStorage().MallBaseId:0
},
methods: {
changeEnabled(item){
this.apipost("/api/MallBase/AddOrUpdateIsEnable",{Id:item.ID,IsEnable:item.IsEnable}, res => {
if(res.data.resultCode==1){
this.Success(res.data.message)
this.getList()
}
})
},
changeEnabled_all(){
this.apipost("/api/MallBase/AddOrUpdateIsFreeShipping",{Id:this.MallBaseId,IsFreeShipping:this.IsFreeShipping}, res => {
if(res.data.resultCode==1){
this.Success(res.data.message)
this.getList()
}else{
this.Error(res.data.message);
this.getSetup();
}
})
},
Delete(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/MallBase/DelFreeShipping",
{ Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getList();
} else {
that.Error(res.data.message);
}
},
null
);
});
},
EditgoUrl(){
this.$router.push({
name: 'PsetDistributorLevel',
});
},
getList(){
this.loading=true;
this.apipost("/api/MallBase/GetFreeShippingList", this.msg, res => {
this.loading=false;
if(res.data.resultCode==1){
this.total=res.data.data.count;
let pageData=res.data.data.pageData;
this.tableData=pageData;
}
})
},
getSetup(){
this.apipost("/api/MallBase/GetMallBaseInfo", {}, res => {
if (res.data.resultCode == 1) {
if( res.data.data && res.data.data.IsFreeShipping){
this.IsFreeShipping = res.data.data.IsFreeShipping
}
} else {
this.Info(res.data.message);
}
})
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
},
mounted() {
}
};
</script>
<style>
.mailRules .remark_name {
color: #888888;
font-size: 12px;
margin-left: 10px;
float: right;
}
.mailRules .app-image{
background-position: center center;
width: 50px;
height: 50px;
border-radius:0%;
float: left;
margin-right: 8px;
}
.mailRules .blue{
color:#409EFF;
}
.mailRules .content .searchInput{
border: 1px solid #DCDFE6;
border-radius: 4px;
}
.mailRules .content .searchInput .el-input__inner{
border:none;outline:none;
height: 30px;
line-height: 30px;
}
.mailRules .content .searchInput{
line-height: normal;
display: inline-table;
width: 100%;
border-collapse: separate;
border-spacing: 0;
width:250px;
margin-right: 20px;
}
.mailRules .content{
background: #fff;
margin-top:10px;
padding: 20px;
box-sizing: border-box;
}
</style>
<template>
<div v-loading="loading" class="setMember usersList usersListEdit">
<div class="head-title">
<span @click="CommonJump('mailRules')" class="blue point">包邮规则</span> / 编辑包邮规则
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:60%">
<el-form-item label="分类">
<template v-if="addMsg.CategoryList && addMsg.CategoryList.length>0">
<el-tag type="warning" style="margin-right:10px;" @close="exitCheck(item,index)"
v-for="(item,index) in addMsg.CategoryList" :key="index" closable>
{{item.CategoryName}}
</el-tag>
</template>
<el-button type="primary" @click="flDig=true,keepCategoryList=addMsg.CategoryList" style="margin:0 10px;"
size="small">选择分类</el-button>
</el-form-item>
<el-form-item label="包邮件数" prop="FullNumPinkage" class="is-required">
<el-input v-model="addMsg.FullNumPinkage" placeholder="请输入包邮件数" type='number' :min='0'/>
</el-form-item>
<el-form-item label="满额包邮" prop="FullMoneyPinkage" class="is-required">
<el-input v-model="addMsg.FullMoneyPinkage" placeholder="请输入满额度" type='number' :min='0'/>
</el-form-item>
<el-form-item label="是否启用" prop="IsEnable">
<el-radio v-model="addMsg.IsEnable" :label="1"></el-radio>
<el-radio v-model="addMsg.IsEnable" :label="0"></el-radio>
</el-form-item>
</el-form>
</div>
<div style="margin-top:20px">
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
</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>
</template>
<script>
export default {
data() {
return {
checkAll: false,
checkedCities: [],
cities: [],
cityOptions: [],
isIndeterminate: true,
flDig: false,
addMsg: {
Id: 0,
FullNumPinkage:0,
FullMoneyPinkage:0,
IsEnable: 0,
CategoryList: [],
},
rules: {
FullNumPinkage: [{
required: true,
message: '请输入件数',
trigger: 'blur'
}],
FullMoneyPinkage: [{
required: true,
message: '请选择额度',
trigger: 'change'
}],
IsEnable: [{
required: true,
message: '请选择是否启用',
trigger: 'change'
}],
},
loading: false,
childList2: [],
childList3: [],
keepCategoryList: [],
NewCategoryList: [],
};
},
created() {
this.getTree();
if(this.$route.query.ID){
this.getData(this.$route.query.ID)
}
},
methods: {
Save(formName) {
this.$refs[formName].validate((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 => {
if (res.data.resultCode == 1) {
this.CommonJump('mailRules');
this.Success(res.data.message);
} else {
this.Error(res.data.message);
}
})
} else {
return false;
}
});
},
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) {
this.loading = true;
this.apipost("/api/MallBase/GetFreeShippingModel", {
Id: ID
}, res => {
this.loading = false;
this.addMsg = res.data.data;
this.NewCategoryList = [];
this.addMsg.CategoryList.forEach(item => {
item.Name = item.CategoryName;
this.NewCategoryList.push(item.CategoryId)
})
this.checkedCities = [];
})
},
},
mounted() {
}
};
</script>
<style>
.app-add-cat .el-checkbox-group {
font-size: 14px !important;
}
.app-add-cat .el-checkbox {
margin-right: 0;
}
.app-add-cat .el-dialog__body {
padding: 10px 20px !important;
}
.app-add-cat .tag-box .tag-item {
margin-right: 5px;
}
.app-add-cat .tag-box {
margin: 20px 0;
}
.app-add-cat .app-goods-cat-list .active {
background: #FAFAFA;
}
.app-add-cat .app-goods-cat-list .cat-item {
cursor: pointer;
padding: 5px 10px;
}
.app-add-cat .app-goods-cat-list {
border: 1px solid #E8EAEE;
border-radius: 5px;
margin-top: -5px;
padding: 10px 0;
overflow: scroll;
height: 400px;
}
.usersListEdit .tip {
margin-left: 10px;
display: inline-block;
height: 30px;
line-height: 30px;
color: #ff4544;
background-color: #FEF0F0;
padding: 0 20px;
border-radius: 5px;
}
.usersListEdit .app-image {
background-size: cover;
background-position: center center;
width: 80px;
height: 80px;
border-radius: 0%;
}
.setMember .setTable .el-table__body .cell {
display: flex;
align-items: center;
}
.setMember .commonLabel .el-form-item__label {
margin-top: -4px;
}
.setMember .discount .el-form-item__label {
padding-right: 30px;
margin-top: -4px;
}
.setMember .el-form-item .elzk {
position: absolute;
left: -25px;
top: 8px;
}
.setMember .el-form-item {
position: relative;
}
.usersList .blue {
color: #409EFF;
}
.usersList .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
</style>
......@@ -653,6 +653,19 @@ export default new Router({
name: 'addElectronFaceSheet',
component: resolve => require(['@/components/setup/addElectronFaceSheet'], resolve),
},
//物流设置 新包邮规则
{
path: '/mailRules',
name: 'mailRules',
component: resolve => require(['@/components/setup/mailRules'], resolve),
},
//物流设置 新包邮规则修改/新增
{
path: '/mailRulesSet',
name: 'mailRulesSet',
component: resolve => require(['@/components/setup/mailRulesSet'], resolve),
},
//设置 上传设置
{
path: '/uploadSettings',
......
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