|
|
|
@ -3,20 +3,19 @@ |
|
|
|
<view> |
|
|
|
<button size="default" type="default" @tap="addAddress" hover-class="is-hover">新增线路</button> |
|
|
|
</view> |
|
|
|
<view class="list-1" style="display: flex;flex-direction: column;height: 150rpx;"> |
|
|
|
<view class="list-1" style="display: flex;flex-direction: column;height: 150rpx;" v-for="(item, index) in standardList" :key="index"> |
|
|
|
<view class="name-tel" style="width: 75%;overflow: hidden;"> |
|
|
|
<text style="line-height: 75rpx;">河北省沧州市运河区</text> |
|
|
|
<text style="line-height: 75rpx;">{{item.province +'-'+ item.city+'-'+item.area}}</text> |
|
|
|
</view> |
|
|
|
<view class="name-tel" style="width: 75%;overflow: hidden;"> |
|
|
|
<text style="line-height: 75rpx;">10公斤内/30元,每公斤/20元</text> |
|
|
|
<text style="line-height: 75rpx;">{{item.chargingStandard}}</text> |
|
|
|
</view> |
|
|
|
<view class="name-edit"> |
|
|
|
<!-- <u-icon name="edit-pen-fill" size="24"></u-icon> |
|
|
|
<uni-icons color="red" type="trash" size="24"></uni-icons> --> |
|
|
|
<text @tap.stop="addAddress(item)" style='line-height: 75rpx;color: #088FEB;'>编辑</text> |
|
|
|
<text @tap.stop="delAddress(item)" style='color:red;line-height: 75rpx;'>删除</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<u-loadmore :status="status" /> |
|
|
|
<!-- 弹出输入框 --> |
|
|
|
<uni-popup ref="inputDialog" background-color="#fff"> |
|
|
|
<cc-selectDity :show="show" @sureSelectArea="onsetCity" @hideShow="onhideShow"></cc-selectDity> |
|
|
|
@ -52,7 +51,11 @@ |
|
|
|
area: '', |
|
|
|
id: '' |
|
|
|
}, |
|
|
|
show: false, |
|
|
|
show: false, |
|
|
|
standardList:[], |
|
|
|
status: 'loadmore', |
|
|
|
pages:1, |
|
|
|
total:0, |
|
|
|
rules: { |
|
|
|
address1: { |
|
|
|
rules: [{ |
|
|
|
@ -77,47 +80,136 @@ |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
if (this.pages >= this.total) return; |
|
|
|
this.status = 'loading'; |
|
|
|
this.pages = ++this.pages; |
|
|
|
this.getList(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//获取列表 |
|
|
|
getList(){ |
|
|
|
this.tui.request('/app/operatingArea/getOperatingAreaList', 'POST', { |
|
|
|
pageNum:1, |
|
|
|
pageSize:10 |
|
|
|
}, false, false).then((res) => { |
|
|
|
if (res.code == 200){ |
|
|
|
this.standardList = res.result |
|
|
|
let that = this; |
|
|
|
uni.request({ |
|
|
|
url: that.tui.interfaceUrl() + '/app/operatingArea/getOperatingAreaList', |
|
|
|
data: { |
|
|
|
pageNum:this.pages, |
|
|
|
pageSize:10 |
|
|
|
}, |
|
|
|
header: { |
|
|
|
'content-type': 'application/json', |
|
|
|
// 'Authorization': tui.getToken() |
|
|
|
'appWLToken': that.tui.getToken() |
|
|
|
}, |
|
|
|
method: 'POST', //'GET','POST' |
|
|
|
dataType: 'json', |
|
|
|
success: (res) => { |
|
|
|
this.status = 'nomore'; |
|
|
|
if (res.data.code == 200){ |
|
|
|
this.pages = res.data.result.pages |
|
|
|
this.total = res.data.result.total |
|
|
|
if (this.pages == 1) { |
|
|
|
this.standardList = res.data.result.records |
|
|
|
} else { |
|
|
|
this.standardList = [...this.standardList, ...res.data.result.records] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (res) => { |
|
|
|
that.tui.toast("网络不给力,请稍后再试") |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
//弹出弹窗 |
|
|
|
addAddress(data) { |
|
|
|
addAddress(data) { |
|
|
|
let item = this.formData = {} |
|
|
|
if(data){ |
|
|
|
item.id = data.id |
|
|
|
item.standard = data.chargingStandard |
|
|
|
item.province = data.province |
|
|
|
item.city = data.city |
|
|
|
item.area = data.area |
|
|
|
item.address1 = data.province + data.city + data.area; |
|
|
|
} |
|
|
|
this.$refs.inputDialog.open('bottom') |
|
|
|
}, |
|
|
|
//新增修改 |
|
|
|
setAddress(){ |
|
|
|
this.tui.request('/app/operatingArea/saveOrUpdateOperatingArea', 'post', { |
|
|
|
shippingType:uni.getStorageSync("signCompany"), |
|
|
|
shippingMethod:uni.getStorageSync("companyName"), |
|
|
|
shippingMethodId:uni.getStorageSync("transCompany"), |
|
|
|
province:this.formData.province, |
|
|
|
city:this.formData.city, |
|
|
|
area:this.formData.area, |
|
|
|
chargingStandard:this.formData.standard |
|
|
|
}, false, false).then(res => { |
|
|
|
if (res.code !== 200) return |
|
|
|
this.bList = res.result |
|
|
|
let item = {} |
|
|
|
if(this.formData.id != ''){ |
|
|
|
item = { |
|
|
|
shippingType:uni.getStorageSync("signCompany"), |
|
|
|
shippingMethod:uni.getStorageSync("companyName"), |
|
|
|
shippingMethodId:uni.getStorageSync("transCompany"), |
|
|
|
province:this.formData.province, |
|
|
|
city:this.formData.city, |
|
|
|
area:this.formData.area, |
|
|
|
chargingStandard:this.formData.standard, |
|
|
|
id:this.formData.id |
|
|
|
} |
|
|
|
}else{ |
|
|
|
item= { |
|
|
|
shippingType:uni.getStorageSync("signCompany"), |
|
|
|
shippingMethod:uni.getStorageSync("companyName"), |
|
|
|
shippingMethodId:uni.getStorageSync("transCompany"), |
|
|
|
province:this.formData.province, |
|
|
|
city:this.formData.city, |
|
|
|
area:this.formData.area, |
|
|
|
chargingStandard:this.formData.standard |
|
|
|
} |
|
|
|
} |
|
|
|
uni.request({ |
|
|
|
url: this.tui.interfaceUrl() + '/app/operatingArea/saveOrUpdateOperatingArea', |
|
|
|
data: item, |
|
|
|
header: { |
|
|
|
'content-type': 'application/json', |
|
|
|
// 'Authorization': tui.getToken() |
|
|
|
'appWLToken': this.tui.getToken() |
|
|
|
}, |
|
|
|
method: 'POST', //'GET','POST' |
|
|
|
dataType: 'json', |
|
|
|
success: (res) => { |
|
|
|
if (res.data.code == 200){ |
|
|
|
this.tui.toast("操作成功") |
|
|
|
this.getList(); |
|
|
|
this.$refs.inputDialog.close() |
|
|
|
this.formData = {} |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (res) => { |
|
|
|
this.tui.toast("网络不给力,请稍后再试~") |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
delAddress(){ |
|
|
|
delAddress(data){ |
|
|
|
var that = this; |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条线路吗?", |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
that.tui.toast('删除成功') |
|
|
|
uni.request({ |
|
|
|
url: that.tui.interfaceUrl() + '/app/operatingArea/deleteOperatingArea', |
|
|
|
data: { |
|
|
|
id:data.id |
|
|
|
}, |
|
|
|
header: { |
|
|
|
'content-type': 'application/x-www-form-urlencoded', |
|
|
|
'appWLToken': that.tui.getToken() |
|
|
|
}, |
|
|
|
method: 'POST', //'GET','POST' |
|
|
|
dataType: 'json', |
|
|
|
success: (res) => { |
|
|
|
if (res.data.code == 200){ |
|
|
|
that.tui.toast('删除成功') |
|
|
|
that.getList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (res) => { |
|
|
|
that.tui.toast("网络不给力,请稍后再试~") |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
that.$forceUpdate() |
|
|
|
} |
|
|
|
|