完善用户地址列表

master
hequan_waynaqua 4 years ago
parent 4aaabb1d1c
commit 35858be6e5

@ -21,7 +21,6 @@ export default [
address: '浙江省杭州市拱墅区莫干山路 50 号'
},
{
id: '2',
name: '李四',
tel: '1310000000',
country: '',

@ -6,3 +6,19 @@ export function getAddress() {
method: 'get'
})
}
export function addAddress(data) {
return request({
url: '/address',
method: 'post',
data
})
}
export function updateAddress(data) {
return request({
url: '/address',
method: 'put',
data
})
}

@ -20,7 +20,7 @@ const actions = {
return new Promise((resolve, reject) => {
getAddress()
.then(res => {
const data = res.entry
const { data } = res.map
commit('SET_ADDRESS_LIST', data)
resolve(data)
})

@ -21,6 +21,7 @@ import { mapGetters } from 'vuex'
import NavBar from '@/components/NavBar'
import areaList from '@/utils/area.js'
import { addAddress } from '@/api/address.js'
export default {
name: 'AddressEdit',
@ -43,7 +44,10 @@ export default {
methods: {
onSave(value) {
console.log('保存地址', value)
this.$toast.success('保存成功')
addAddress(value).then(res => {
this.$toast.success('保存成功')
this.$router.go(-1)
}).catch(e => {})
},
onDelete(value) {
console.log('删除地址', value)

@ -61,12 +61,17 @@ export default {
data() {
return {
defaultId: '',
list: []
list: [],
exhibitionSettlementItemDTOs: []
}
},
async mounted() {
this.$toast.loading('加载中...')
this.list = await this.$store.dispatch('address/getList')
console.log(this.list)
this.list.forEach(item => {
item.address = item.province + item.city + item.county + ' ' + item.addressDetail
})
this.$toast.clear()
},
methods: {

@ -91,6 +91,9 @@ export default {
// all select
handleAllSelect(value) {
const data = this.list.map(item => {
const data = { id: item.id, checked: value }
updateCart(data).then(res => {
}).catch(e => {})
item.checked = value
return item
})

@ -8,7 +8,5 @@ export default {
}
</script>
<style lang="scss" scoped>
.order-list {
}
<style lang="scss" scoped>
</style>

Loading…
Cancel
Save