Commit d6645b9f authored by zhangjianguo's avatar zhangjianguo

包邮规则

parent 67bc466d
<template>
<div class="addAddress">
<div class="form-box" style="margin-top: 0">
<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 class="form-box">
<el-form :model="msg" style="padding:0 50px;" :rules="rules" ref="msg" label-width="120px">
<el-form-item label="收件人姓名" prop="Name" class="is-required">
<el-input v-model="msg.Name" placeholder="请输入收件人姓名"/>
</el-form-item>
<el-form-item label="联系方式" prop="Mobile" class="is-required">
<el-input v-model="msg.Mobile" placeholder="请输入联系方式"/>
</el-form-item>
<el-form-item label="省市区" prop="Mobile" class="is-required" >
<!--<el-cascader-->
<!--v-if="options.length>0"-->
<!--v-model="selectedOptions"-->
<!--:options="cascaderData"-->
<!--@change="handleChange"></el-cascader>-->
</el-form-item>
<el-form-item label="详细地址" prop="Address" class="is-required">
<el-input v-model="msg.Address" placeholder="请输入详细地址"/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="msg.Remarks" placeholder="请输入退货备注"/>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')">保存</el-button>
</div>
</template>
<script>
export default {
name: "addAddress",
data(){
return{
props:{
label:'Name',
value:'ID',
},
Name:[],
msg:{
ID:0,
Name:'',
Mobile:'',
Address:'',
Remarks:'',
ProvinceId:11,
CityId:12,
DistrictId:3587,
},
options:[],
cityindex:0,
rules:{
Name:[
{required: true, message: "请输入收件人姓名", trigger: "blur"}
],
Mobile:[
{required: true, message: "请输入联系方式", trigger: "blur"}
],
Address:[
{required: true, message: "请输入详细地址", trigger: "blur"}
],
}
}
},
created(){
if(this.$route.query.ID){
this.getLogisticsDelivery(this.$route.query.ID)
}
},
methods:{
cancel(){
this.$router.go(-1);//返回上一层
},
getLogisticsDelivery(ID){
this.apipost("/api/MallBase/GetLogisticsDelivery",{'ID':ID} , res => {
if (res.data.resultCode == 1) {
this.msg =res.data.data
} else {
this.Info(res.data.message);
}
})
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.apipost("/api/MallBase/AddOrUpdateLogisticsDelivery",this.msg , res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
handleChange(value){
}
},
mounted(){
this.getNodes()
}
}
</script>
<style scoped>
.addAddress .form-box{
padding: 20px 0;
background-color: #fff;
margin-bottom: 20px;
padding-right: 50%;
margin-top: 10px;
}
.addAddress .el-input__inner{
height: 32px;
line-height: 32px
}
</style>
<template>
<div class="addFreeshipping">
<div class="form-box">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">包邮规则</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
......@@ -9,7 +9,7 @@
</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 :model="msg" style="padding:0 50px;" :rules="rules" ref="msg" label-width="110px">
<el-form-item label="规则名称" prop="RulesName" class="is-required">
<el-input v-model="msg.RulesName" class="inputM_l"/>
</el-form-item>
......@@ -221,7 +221,8 @@
}
.addFreeshipping .inputM_l{
margin-left: 20px;
margin-left: 5px;
}
</style>
......@@ -47,7 +47,7 @@
</style>
<template>
<div class="addFreightRule">
<div class="form-box">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">运费规则</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
......@@ -306,20 +306,6 @@
},
isNumber(rule, value, callback) {
if (value === '') {
return callback();
} //这是用来判断如果不是必须输入的,则直接跳出
const r = /^\+?[0-9][0-9]*$/; // 正整数
// 如果判断不符合正则,则不是正整数不能提交
if (!r.test(value)) {
return callback(new Error('请输入数字'));
} else {
return callback();
}
},
},
......
<template>
<el-cascader
v-model="selectVal"
:options="AccList"
:props="AccListProps"
@change="handleItemChange">
</el-cascader>
</template>
<script>
export default {
name: 'demo',
data () {
return {
selectVal:[],
AccList:[],
AccListProps: {
value:'ID',
label:'Name',
children: 'children'
},
getAccListMsg:{
Id:2,
},
}
},
methods: {
handleItemChange(obj){
let obj1 = this.AccList[obj[0]],
obj2 = this.AccList[obj[0]].children[obj[1]],
obj3 = this.AccList[obj[0]].children[obj[1]].children[obj[2]];
let addMsgList = {
ID:0,
AccountId:obj3.ID,
Type:obj2.ID,
AccountType:obj1.ID,
Direct:0,
Name:obj3.Name + (obj3.BankNo?obj3.BankNo:''),
IsPublic:obj1.IsPublic,
isInCheckbox:obj3.Is_Income?true:false,
isOutCheckbox:obj3.Is_Outcome?true:false,
allName:obj3.Name + (obj3.BankNo?obj3.BankNo:''),
}
this.addMsg.list.push(addMsgList);
this.selectVal = [];
},
getAccList(){
this.apipost("/api/Destination/GetChildList",this.getAccListMsg , res => {
if(res.data.resultCode==1){
function addNum (obj) {
for (let i = 0; i < obj.length; i++) {
obj[i]['ID'] = i;
console.log(obj[i])
if (obj[i].hasOwnProperty('children')){
obj[i].children = addNum(obj[i].children)
}
}
return obj
}
this.AccList = addNum(res.data.data)
}else{
}
},null)
},
},
mounted () {
this.getAccList();
},
}
</script>
<template>
<div class="returnAddressList">
<div class="el-card__header">
<span>地址列表</span>
<el-button type="primary" style="margin: -5px 0px; width: 80px; height: 32px; padding: 0" @click="address">添加地址</el-button>
</div>
<div class="search_s">
<div class="input-item">
<el-input placeholder="请输入收件人姓名或联系方式" v-model="msg.Name" style="width: 300px;font-size: 10px;height: 32px">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
</div>
<div class='table-body'>
<el-table
:data="list"
border
style="width: 1707px">
<el-table-column
fixed
prop="ID"
label="ID"
width="100">
</el-table-column>
<el-table-column
fixed
prop="Name"
label="收件人姓名"
width="120">
</el-table-column>
<el-table-column
fixed
prop="Mobile"
label="联系方式"
width="120">
</el-table-column>
<el-table-column
fixed
prop="Address"
label="详细地址"
width="400">
</el-table-column>
<el-table-column
fixed
prop="Remarks"
label="备注"
width="484">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<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>
</div>
</div>
</template>
<script>
export default {
name: "returnAddressList",
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
Name:'',
},
list:[],
total:0,
}
},
methods:{
getLogisticsDeliveryPage(){
this.apipost("/api/MallBase/GetLogisticsDeliveryPage", 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.getLogisticsDeliveryPage()
},
Edit(row){
this.$router.push({
name: 'addAddress',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/MallBase/DelDelivery",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getLogisticsDeliveryPage();
} else {
that.Error(res.data.message);
}
},
);
});
},
address(){
this.$router.push('/addAddress');
}
},
mounted(){
this.getLogisticsDeliveryPage()
}
}
</script>
<style scoped>
.returnAddressList .el-card__header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.returnAddressList .search_s{
width: 100%;
padding: 18px 20px;
background: white;
margin-top: 15px
}
.returnAddressList .table-body{
padding: 0 20px 20px;
background-color: #fff;
margin-bottom: 20px;
}
</style>
......@@ -21,7 +21,9 @@
<freeShipping @AddFreeShipping = 'AddFreeShipping'></freeShipping>
</el-tab-pane>
<el-tab-pane label="起送规则" name="fourth">起送规则</el-tab-pane>
<el-tab-pane label="起送规则" name="fourth">
<riseGiveRule></riseGiveRule>
</el-tab-pane>
</el-tabs>
</div>
</template>
......@@ -29,7 +31,8 @@
<script>
import vlogistics from './view/logistics';
import freight from './view/freight';
import freeShipping from './view/freeShipping'
import freeShipping from './view/freeShipping';
import riseGiveRule from './view/riseGiveRule';
export default {
name: "ruleSetup",
......@@ -47,7 +50,8 @@
components:{
vlogistics,
freight,
freeShipping
freeShipping,
riseGiveRule
},
methods: {
handleClick(tab, event) {
......
......@@ -54,7 +54,7 @@
<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)">
......@@ -107,9 +107,7 @@
this.msg.pageSize=20;
this.getLogisticsPinkagePage()
},
formatterColumn(cellValue){
console.log(cellValue)
},
addRule(){
this.$emit("AddFreeShipping",);
......
......@@ -58,7 +58,7 @@
<el-table-column
fixed="right"
label="操作"
width="180">
>
<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)">
......
This diff is collapsed.
<template>
<div class="riseGiveRule">
<div id="pane-first">
<div class="form-box">
<el-form :model="msg" style="padding:0 50px;" :rules="rules" ref="msg" label-width="150px">
<el-form-item label="是否开启" prop="IsOpenMinPrice">
<el-switch
class="inputM_l"
:active-value="1"
:inactive-value="0"
v-model="msg.IsOpenMinPrice"
active-text=""
inactive-text="">
</el-switch>
</el-form-item>
<el-form-item label="全地区起送金额设置" prop="IsOpenAllRegionPrice" v-if="msg.IsOpenMinPrice==1">
<el-switch
class="inputM_l"
:active-value="1"
:inactive-value="0"
v-model="msg.IsOpenAllRegionPrice"
active-text=""
inactive-text="">
</el-switch>
</el-form-item>
<el-form-item label="全地区起送金额" prop="AllRegionPrice" class="is-required" v-if="msg.IsOpenMinPrice==1&&msg.IsOpenAllRegionPrice==1">
<el-input v-model="msg.AllRegionPrice" class="inputM_l" min="0" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="运费规则" v-if="msg.IsOpenMinPrice==1">
<div class="gez_list el-card" v-for="(item,index) in msg.Detail" :key="index">
<div style="width: 500px;">
<span>起送金额:{{item.FirstPrice}}元</span>
<div>区域:<span v-for="(item2,index2) in item.List" :key="index2" class="quyu">
{{item2.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(index,item)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img src="../../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(index)">
</el-tooltip>
</div>
</div>
<span style="color: #409EFF;font-size: 14px;cursor: pointer;" @click="addOf">+新增规则</span>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')">保存</el-button>
</div>
<el-dialog title="新增规则" :visible.sync="dialogFormVisible" >
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" >
<el-form-item label="起送金额" prop="FirstPrice" class="is-required" label-width="100px">
<el-input v-model="ruleForm.FirstPrice" class="inputM_l" min="0" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="地区选择" prop="List" label-width="100px">
<region_Choice @event1="change($event)" :List="ruleForm.List" 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('ruleForm')">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import region_Choice from './regionChoice'
export default {
name: "riseGiveRule",
data(){
return{
msg:{
ID:0,
IsOpenMinPrice:0,
IsOpenAllRegionPrice:1,
AllRegionPrice:0,
Detail:[],
},
ruleForm:{
ID:0,
FirstPrice:0,
List:[],
},
dialogFormVisible:false,
isedit:false,
editindex:0,
rules:{
IsOpenMinPrice: [
{required: true, message: "", trigger: "blur"}
],
IsOpenAllRegionPrice: [
{required: true, message: "", trigger: "blur"}
],
AllRegionPrice: [
{required: true, message: "请输入数字", trigger: "blur"}
],
List:[
{ type: 'array', required: true, message: '请选择地区', trigger: 'change' }
]
}
}
},
components:{
region_Choice,
},
methods:{
GetMinPriceInfo(){//获取起送规则
this.apipost("/api/MallBase/GetMinPriceInfo",{} , res => {
if (res.data.resultCode == 1) {
this.msg.ID = res.data.data.ID;
this.msg.IsOpenMinPrice = res.data.data.IsOpenMinPrice;
this.msg.IsOpenAllRegionPrice = res.data.data.IsOpenAllRegionPrice;
this.msg.AllRegionPrice = res.data.data.AllRegionPrice;
this.msg.Detail = res.data.data.Detail;
} else {
this.Info(res.data.message);
}
})
},
addOf(){
this.ruleForm={
FirstPrice:0,
List:[],
}
this.dialogFormVisible=true;
this.isedit=false;//设置为编辑状态
let M_List= this.msg.Detail
let cM_List=[]
if(M_List.length>0){
for(let i=0;i<M_List.length;i++){
cM_List = cM_List.concat(M_List[i].List)
if(i==M_List.length-1){
setTimeout(()=>{
this.$refs.child.Receive([],cM_List,true) //帅选出哪里不可以再次选择
},1000)
}
}
}else {
setTimeout(()=>{
this.$refs.child.Receive([],[])
},1000)
}
},
edit(index,data){
this.isedit=true;//设置为编辑状态
this.editindex=index;//编辑的索引
this.ruleForm = data
this.dialogFormVisible=true;
let M_List= this.msg.Detail
let cM_List=[]
for(let i=0;i<M_List.length;i++){
if(i!=index){
cM_List = cM_List.concat(M_List[i].List)
}
if(i==M_List.length-1){
setTimeout(()=>{
this.$refs.child.Receive(this.ruleForm.List,cM_List,true) //帅选出哪里不可以再次选择
},1000)
}
}
},
delete_b(index){
this.msg.Detail.splice(index,1)
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let msg = this.msg;
for(let i=0;i<msg.Detail.length;i++){
for(let j = 0;j<msg.Detail[i].List.length;j++){
delete msg.Detail[i].List[j].GrandpaID;
delete msg.Detail[i].List[j].ParentID;
}
}
this.apipost("/api/MallBase/AddOrUpdateMinPrice",msg , res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
Addto(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.dialogFormVisible=false
let Detail = {
'ID':0,
'FirstPrice':parseInt(this.ruleForm.FirstPrice),
'List':this.ruleForm.List,
}
if( this.isedit==true){
this.msg.Detail[this.editindex] =Detail;
this.isedit=false //编辑之后复原
}else {
this.msg.Detail.push(Detail)
}
} else {
return false;
}
});
},
change(data){
this.ruleForm.List = data;
},
},
mounted(){
this.GetMinPriceInfo()
}
}
</script>
<style scoped>
.riseGiveRule .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.riseGiveRule .quyu{
background-color: #f4f4f5;
color: #909399;
padding: 10px;
line-height: 30px;
height: 30px;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
margin: 5px;
}
.riseGiveRule .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;
}
.riseGiveRule .imgstyle{
width: 32px;
height: 32px;
margin: 0 5px;
}
</style>
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