Fix:新增地址保存防抖处理

This commit is contained in:
modendeveloper
2025-03-06 20:53:58 +08:00
parent ed9ae77ead
commit 45b8d065ae
@@ -51,7 +51,7 @@
</view> </view>
</view> </view>
<view class="dialog-footer"> <view class="dialog-footer">
<u-button type="primary" color="#C52733" shape="circle" @click="handleSave">立即保存</u-button> <u-button type="primary" :disabled="loading" :loading="loading" color="#C52733" shape="circle" @click="handleSave">立即保存</u-button>
</view> </view>
</view> </view>
</u-popup> </u-popup>
@@ -80,6 +80,7 @@ export default {
detail: '', detail: '',
isDefault: 0 isDefault: 0
}, },
loading: false,
address: {}, address: {},
isWechat: isWeixin(), isWechat: isWeixin(),
addressText: "", addressText: "",
@@ -212,6 +213,8 @@ export default {
is_default: isDefault ? true : false, is_default: isDefault ? true : false,
post_code: "" post_code: ""
}; };
uni.showLoading();
this.loading = true
postAddress(data).then((res) => { postAddress(data).then((res) => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@@ -219,6 +222,8 @@ export default {
duration: 2000 duration: 2000
}); });
this.$emit('save', res.data.id) this.$emit('save', res.data.id)
}).finally(() => {
this.loading = false
}); });
} catch (err) { } catch (err) {
uni.showToast({ uni.showToast({
@@ -226,6 +231,7 @@ export default {
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
uni.hideLoading();
} }
}, },
//获取当前定位地址 //获取当前定位地址