From f24d7a3a29fc1eeee603f02077719953f82345f0 Mon Sep 17 00:00:00 2001 From: shidongli Date: Fri, 21 Oct 2022 17:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=A1=AE=E8=AE=A4=20?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=20=E6=94=AF=E4=BB=98=20=E8=AF=8A=E6=96=AD?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modifyAddress/modifyAddress.js | 18 ++- pages/modifyAddress/modifyAddress.vue | 166 +++++++++++++------------- 2 files changed, 103 insertions(+), 81 deletions(-) diff --git a/api/modifyAddress/modifyAddress.js b/api/modifyAddress/modifyAddress.js index 36a0739..c26d6ee 100644 --- a/api/modifyAddress/modifyAddress.js +++ b/api/modifyAddress/modifyAddress.js @@ -38,4 +38,20 @@ export function delnursingStation(id) { url: '/nurseApplet/nursingStationGoods/' + id, method: 'delete' }) -} \ No newline at end of file +} +// 查询 +export function getSubordinate(areaCode){ + return request({ + url: `/nurseApplet/nursingStationGoods/getSubordinateRegions?areaCode=${areaCode}`, + method: 'GET' + }) +} +//区街道list +export function getSubordinateRegions(areaCode) { + return request({ + url: `/nurseApplet/login/getRegionAndStreetInfo?areaCode=${areaCode}`, + method: 'GET' + }) +} + + diff --git a/pages/modifyAddress/modifyAddress.vue b/pages/modifyAddress/modifyAddress.vue index e881132..c1238e6 100644 --- a/pages/modifyAddress/modifyAddress.vue +++ b/pages/modifyAddress/modifyAddress.vue @@ -15,14 +15,9 @@ 删除 - - - @@ -32,25 +27,25 @@ - + - 添加收货地址 + {{shipAddress}} - + - + - - + + - + @@ -60,6 +55,8 @@ + @@ -70,6 +67,8 @@ delnursingStation, nursingStationGoodsinfo, updatenursingStation, + getSubordinateRegions, + getSubordinate } from '@/api/modifyAddress/modifyAddress.js'; import baseurl from '@/api/baseurl.js' export default { @@ -79,24 +78,26 @@ delshow: false, //删除弹框 content: '确认要删除信息吗?', show: false, //弹框 - list: { + areashow: false, //经纬度开关 + arealist: [], //区街道list + areaCode: '', + shipAddress: '添加收货地址', + infolist: { receiveName: '', receivePhone: '', receiveAddress: '', areaCode: '', patientId: 2, - + address: '', //页面所属区域 }, goodPatient: [], // 查询地址信息 patientId: 2, - // delId: '', - - } }, onLoad(options) { //获取传值 this.goodsList() + this.areaInfo() }, methods: { // 查询地址信息 @@ -108,120 +109,126 @@ }, // 保存按钮 submit() { - let that=this + let that = this if (that.isedit == true) { - addnursingStation(that.list).then(res => { + addnursingStation(that.infolist).then(res => { if (res.code == 200) { - that.$refs.uToast.show({ - title: '新增成功', - duration: 20000000 - }); - that.show = false; - // console.log(res) - that.goodsList() - that.list = {} + uni.showToast({ + title: '新增成功', + duration: 1500 + }); + that.show = false; + setTimeout(e => { + that.goodsList() + }, 1500) } }) } else { - updatenursingStation(that.list).then(res => { + updatenursingStation(that.infolist).then(res => { uni.showToast({ title: '修改成功', - duration: 2000 + duration: 1500 }); that.show = false; - // console.log(res) - that.goodsList() - // this.list = {} + setTimeout(e => { + that.goodsList() + }, 1500) }) } - - }, // 修改按钮 updata(item) { + this.shipAddress = '修改收货地址' this.isedit = false nursingStationGoodsinfo(item.id).then(res => { - console.log(item) - this.list = res.data - this.show = true + this.infolist = res.data + getSubordinate(res.data.areaCode).then(res => { + this.infolist.address = res.data.regionName + res.data.streetName + console.log(this.infolist) + this.show = true + }) }) - - }, // 新增 add() { + this.infolist = { + receiveName: '', + receivePhone: '', + receiveAddress: '', + areaCode: '', + patientId: 2, + } this.isedit = true this.show = true }, - // delconfirm() { - // // console.log(1111) - // delnursingStation(this.delId).then(res => { - // if (res.code == 200) { - // this.$refs.uToast.show({ - // title: '删除成功', - // type: 'success', - // duration: 2000 - // }) - // this.delshow = false; - // console.log(res) - // this.goodsList() - // } - // }) - // }, + // 删除 del(item) { - let that=this + let that = this uni.showModal({ title: '提示', content: '确认要删除信息吗', success: function(res) { if (res.confirm) { delnursingStation(item.id).then(res => { - - uni.showToast({ - title: '删除成功', - duration: 2000, - - }); - console.log(111), - that.delshow = false; - that.goodsList() - // console.log(this) - - + uni.showToast({ + title: '删除成功', + duration: 1500, + }); + setTimeout(e => { + that.goodsList() + }, 1500) + that.delshow = false; }) } else if (res.cancel) { console.log('用户点击取消'); } } }); - - // this.delId = item.id - // this.delshow = true }, // 取消 cencel() { this.show = false - this.list = {} - } + this.infolist = {} + // this.address="" + }, + // 选择区街道 + areaInfo() { + getSubordinateRegions(this.areaCode).then(res => { + //区下无街道添加一个空街道 + res.data.forEach(e => { + if (e.children.length == 0) { + e.children.push({ + areaCode: "", + areaName: "暂无街道", + children: null, + id: '', + }) + } + }) + this.arealist = res.data; + }) + }, + //区街道选择 + areaconfirm(e) { + this.infolist.areaCode = e[e.length - 1].value + this.address = e[0].label + '-' + e[1].label + }, } }