|
@@ -148,7 +148,7 @@
|
|
|
title: '添加收货地址成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
- that.search()
|
|
|
+ that.clearPage();
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: arr.errmsg,
|
|
@@ -166,12 +166,26 @@
|
|
|
},
|
|
|
// 设置默认
|
|
|
toDefa(e) {
|
|
|
+ const that = this;
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '确定设置该地址为默认地址吗?',
|
|
|
- success: function(res) {
|
|
|
+ success: async function(res) {
|
|
|
if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
+ const arr = await that.$api(`/address/toDefault/${e._id}`, `POST`);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '添加默认成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ that.clearPage();
|
|
|
+ that.search();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -184,15 +198,37 @@
|
|
|
},
|
|
|
// 删除
|
|
|
toDel(e) {
|
|
|
+ const that = this;
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '确定删除该地址吗?',
|
|
|
- success: function(res) {
|
|
|
+ success: async function(res) {
|
|
|
if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
+ const arr = await that.$api(`/address/${e._id}`, 'DELETE');
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '删除信息成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ that.clearPage();
|
|
|
+ that.search();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ // 清空列表
|
|
|
+ clearPage() {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `list`, [])
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
+ that.$set(that, `limit`, 5)
|
|
|
+ that.$set(that, `page`, 0)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -220,7 +256,7 @@
|
|
|
|
|
|
.name {
|
|
|
font-size: var(--font16Size);
|
|
|
- margin: 0 0 1vw 0;
|
|
|
+ margin: 0 0 2vw 0;
|
|
|
|
|
|
text {
|
|
|
padding: 0 2vw 0 0;
|