Commit a5651e47 authored by zhengke's avatar zhengke
parents cbe51ad9 f9d8fe75
<template>
<div class="addFreeshipping">
<div class="form-box">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">包邮规则</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>添加规则</span>
</div>
</div>
<div id="pane-first">
<div class="form-box">
<el-form :model="msg" style="padding:0 50px;" :rules="rules" ref="msg" label-width="90px">
<el-form-item label="规则名称" prop="RulesName" class="is-required">
<el-input v-model="msg.RulesName" class="inputM_l"/>
</el-form-item>
<el-form-item label="包邮金额" prop="AllRegionPrice" class="is-required">
<el-tooltip class="item" effect="dark" content="订单满XXX包邮" placement="top"
style="position: absolute;left: -10px;top:13px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="msg.AllRegionPrice" class="inputM_l"/>
</el-form-item>
<el-form-item label="运费规则" class="is-required" prop="List">
<div class="gez_list el-card inputM_l" v-if="msg.List.length>0">
<div style="width: 500px;" >
<div >区域:<span v-for="(item,index) in msg.List" :key="index" class="quyu">
{{item.RegionName}}</span>
</div> </div>
<div style="width: 110px;display: flex;flex-direction: row;justify-content: space-around">
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="edit()">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b()">
</el-tooltip>
</div>
</div>
<span style="color: #409EFF;font-size: 14px;cursor: pointer;" @click="addOf" v-if="this.msg.List.length==0">+新增规则</span>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')">保存</el-button>
<el-button style="margin: 12px 0 " @click="cancel">取消</el-button>
</div>
<el-dialog title="新增规则" :visible.sync="dialogFormVisible" >
<el-form :model="msg" :rules="rules" ref="msg">
<el-form-item label="包邮地区" prop="List">
<region_Choice @event1="change($event)" ref="child"></region_Choice>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="Addto()">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import region_Choice from './view/regionChoice'
export default {
name: "addFreeshipping",
data(){
return{
msg:{
ID:0,
RulesName:'',
AllRegionPrice:0,
List:[],
},
List:[],
isedit:false,
editindex:0,
dialogFormVisible:false,
rules: {
RulesName: [
{required: true, message: "请填写包邮规则名称", trigger: "blur"}
],
AllRegionPrice: [
{required: true, message: "请输入数字", trigger: "blur"}
],
List:[
{ type: 'array', required: true, message: '请选择包邮地区', trigger: 'change' }
],
},
}
},
components:{
region_Choice,
},
created(){
if(this.$route.query.ID){
this.getLogisticsPinkage(this.$route.query.ID)
}
},
methods:{
getLogisticsPinkage(ID){
this.apipost("/api/MallBase/GetLogisticsPinkage",{'ID':ID} , res => {
if (res.data.resultCode == 1) {
this.msg.ID =res.data.data.ID;
this.msg.RulesName =res.data.data.RulesName;
this.msg.AllRegionPrice =res.data.data.AllRegionPrice;
this.msg.List =res.data.data.List;
} else {
this.Info(res.data.message);
}
})
},
cancel(){
this.$router.go(-1);//返回上一层
},
change(data){
this.List = data;
},
delete_b(){
this.msg.List=[]
},
edit(){
this.dialogFormVisible=true;
setTimeout(()=>{
this.$refs.child.Receive(this.msg.List)
},1000)
},
addOf(){
this.List=[]
this.dialogFormVisible=true;
this.isedit=false;//设置为编辑状态
setTimeout(()=>{
this.$refs.child.Receive(this.List)
},1000)
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let msg = this.msg;
for(let i=0;i<msg.List.length;i++){
delete msg.List[i].GrandpaID;
delete msg.List[i].ParentID;
}
this.msg.AllRegionPrice = parseInt(this.msg.AllRegionPrice)
this.apipost("/api/MallBase/AddOrUpdateLogisticsPinkage ",msg , res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.push({
name: 'ruleSetup',
query: {
activeName:'third',
blank: "y"
}
});
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
Addto(){
this.dialogFormVisible=false
this.msg.List =this.List;
},
},
}
</script>
<style scoped>
.addFreeshipping .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.addFreeshipping .prompt{
margin: -10px 20px 20px;
background-color: #F4F4F5;
padding: 10px 15px;
color: #909399;
display: inline-block;
font-size: 13px;
}
.addFreeshipping .gez_list{
width: 650px;
margin-bottom: 12px;
padding: 20px;
border: 1px solid #EBEEF5;
background-color: #FFF;
color: #303133;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.addFreeshipping .imgstyle{
width: 32px;
height: 32px;
margin: 0 5px;
}
.addFreeshipping .quyu{
background-color: #f4f4f5;
color: #909399;
padding: 10px;
line-height: 30px;
height: 30px;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
margin: 5px;
}
.addFreeshipping .inputM_l{
margin-left: 20px;
}
</style>
This diff is collapsed.
......@@ -16,7 +16,11 @@
<freight @AddRule="AddRule"></freight>
</el-tab-pane>
<el-tab-pane label="包邮规则" name="third">包邮规则</el-tab-pane>
<el-tab-pane label="包邮规则" name="third">
<freeShipping @AddFreeShipping = 'AddFreeShipping'></freeShipping>
</el-tab-pane>
<el-tab-pane label="起送规则" name="fourth">起送规则</el-tab-pane>
</el-tabs>
</div>
......@@ -25,6 +29,7 @@
<script>
import vlogistics from './view/logistics';
import freight from './view/freight';
import freeShipping from './view/freeShipping'
export default {
name: "ruleSetup",
......@@ -41,7 +46,8 @@
},
components:{
vlogistics,
freight
freight,
freeShipping
},
methods: {
handleClick(tab, event) {
......@@ -49,6 +55,10 @@
},
AddRule(){
this.$router.push('/addFreightRule');
},
AddFreeShipping(){
this.$router.push('/addFreeshipping');
}
}
}
......
<template>
<div class="freeShipping">
<div id="pane-first">
<div class="form-box">
<div class='table-body'>
<div style="justify-content: space-between; display: flex;">
<div class="input-item">
<el-input placeholder="请输入内容" v-model="msg.RulesName" >
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<el-button type="primary" style="margin: -5px 0px; width: 80px; height: 32px; padding: 0" @click="addRule">添加规则</el-button>
</div>
<el-table
:data="list"
border
style="width: 1707px">
<el-table-column
fixed
prop="ID"
label="ID"
width="309">
</el-table-column>
<el-table-column
fixed
prop="RulesName"
label="包邮规则名称"
width="309">
</el-table-column>
<el-table-column
fixed
prop="AllRegionPrice"
label="订单金额"
width="309">
</el-table-column>
<el-table-column
fixed
label="地区"
width="500">
<template slot-scope="scope">
<div style="display: flex;flex-direction: row;flex-wrap: wrap">
<span v-for="(item,index) in scope.row.RegionList" :key="index">{{item}}</span>
</div>
</template>
</el-table-column >
<el-table-column
fixed="right"
label="操作"
width="280">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top" >
<img src="../../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
v-if="list&&list.length>0" :current-page.sync="msg.pageIndex"
layout="total,prev, pager, next" :page-size="msg.pageSize" :total="total">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "freeShipping",
data(){
return{
list:[],
msg:{
pageIndex:1,
pageSize:20,
RulesName:'',
},
total:0,//总条数
}
},
methods:{
getLogisticsPinkagePage(){
this.apipost("/api/MallBase/GetLogisticsPinkagePage", this.msg, res => {
if (res.data.resultCode == 1) {
this.list = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
search(){
this.msg.pageIndex=1;
this.msg.pageSize=20;
this.getLogisticsPinkagePage()
},
formatterColumn(cellValue){
console.log(cellValue)
},
addRule(){
this.$emit("AddFreeShipping",);
},
Edit(row){
this.$router.push({
name: 'addFreeshipping',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/MallBase/DelPinkage",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getLogisticsPinkagePage();
} else {
that.Error(res.data.message);
}
},
);
});
},
handleCurrentChange(val){
this.msg.pageIndex = val;
this.GetLogisticsRulesPage();
}
},
mounted(){
this.getLogisticsPinkagePage()
}
}
</script>
<style scoped>
.freeShipping .form-box{
background: #fff;
padding: 10px 0px 0px;
margin-top: 10px;
}
.freeShipping .table-body{
padding: 20px;
background-color: #fff;
margin-bottom: 20px;
}
.freeShipping .input-item{
width: 250px;
margin: 0 0 20px;
}
.freeShipping .imgstyle{
width: 32px;
height: 32px;
margin: 0 5px;
}
</style>
......@@ -28,7 +28,7 @@
<div class="input-item">
<el-input placeholder="请输入内容" v-model="msg.RulesName" >
<el-button slot="append" icon="el-icon-search"></el-button>
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<el-button type="primary" style="margin: -5px 0px; width: 80px; height: 32px; padding: 0" @click="addRule">添加规则</el-button>
......@@ -69,9 +69,12 @@
</template>
</el-table-column>
</el-table>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage"
layout="total,prev, pager, next, jumper" :page-size="msg.pageSize" :total="total">
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
v-if="list&&list.length>0" :current-page.sync="msg.pageIndex"
layout="total,prev, pager, next" :page-size="msg.pageSize" :total="total">
</el-pagination>
</div>
</div>
</div>
......@@ -91,7 +94,7 @@
RulesName:'',
},
radio:'',//单选按钮绑定值
total:0,//是否有数据
total:0,//总条数
currentPage:1,//当前第几页
}
},
......@@ -100,16 +103,23 @@
this.apipost("/api/MallBase/GetLogisticsRulesPage", this.msg, res => {
if (res.data.resultCode == 1) {
this.list = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
search(){
this.msg.pageIndex=1;
this.msg.pageSize=20;
this.GetLogisticsRulesPage()
},
radioChange(){
},
handleCurrentChange(){
handleCurrentChange(val){
this.msg.pageIndex = val;
this.GetLogisticsRulesPage();
},
addRule(){
this.$emit("AddRule",);
......@@ -138,7 +148,6 @@
that.Error(res.data.message);
}
},
null
);
});
}
......
This diff is collapsed.
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