|
|
@@ -76,7 +76,6 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
addressId: null,
|
|
|
- userId: null,
|
|
|
saving: false,
|
|
|
form: {
|
|
|
receiverName: '',
|
|
|
@@ -91,7 +90,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- this.userId = uni.getStorageSync('userId')
|
|
|
if (options.addressId) {
|
|
|
this.addressId = parseInt(options.addressId)
|
|
|
uni.setNavigationBarTitle({ title: '编辑地址' })
|
|
|
@@ -104,7 +102,7 @@ export default {
|
|
|
loadAddress() {
|
|
|
var that = this
|
|
|
uni.request({
|
|
|
- url: config.danshop('/danshop/address/get'),
|
|
|
+ url: config.api('/api/user/address/get'),
|
|
|
method: 'POST',
|
|
|
data: { id: this.addressId },
|
|
|
header: {
|
|
|
@@ -132,7 +130,7 @@ export default {
|
|
|
// Load provinces first
|
|
|
uni.showLoading({ title: '加载地址...' })
|
|
|
uni.request({
|
|
|
- url: config.danshop('/danshop/region/provinces'),
|
|
|
+ url: config.api('/api/region/provinces'),
|
|
|
method: 'POST',
|
|
|
header: {
|
|
|
'Content-Type': 'application/json',
|
|
|
@@ -167,7 +165,7 @@ export default {
|
|
|
var that = this
|
|
|
uni.showLoading({ title: '加载城市...' })
|
|
|
uni.request({
|
|
|
- url: config.danshop('/danshop/region/cities'),
|
|
|
+ url: config.api('/api/region/cities'),
|
|
|
method: 'POST',
|
|
|
data: { parentId: provinceId },
|
|
|
header: {
|
|
|
@@ -199,7 +197,7 @@ export default {
|
|
|
var that = this
|
|
|
uni.showLoading({ title: '加载区县...' })
|
|
|
uni.request({
|
|
|
- url: config.danshop('/danshop/region/districts'),
|
|
|
+ url: config.api('/api/region/districts'),
|
|
|
method: 'POST',
|
|
|
data: { parentId: cityId },
|
|
|
header: {
|
|
|
@@ -264,7 +262,6 @@ export default {
|
|
|
|
|
|
this.saving = true
|
|
|
var data = {
|
|
|
- userId: this.userId,
|
|
|
receiverName: this.form.receiverName.trim(),
|
|
|
phone: this.form.phone.trim(),
|
|
|
province: this.form.province,
|
|
|
@@ -279,7 +276,9 @@ export default {
|
|
|
|
|
|
var that = this
|
|
|
uni.request({
|
|
|
- url: config.danshop('/danshop/address/save'),
|
|
|
+ url: this.addressId
|
|
|
+ ? config.api('/api/user/address/update')
|
|
|
+ : config.api('/api/user/address/create'),
|
|
|
method: 'POST',
|
|
|
data: data,
|
|
|
header: {
|