fest: 确认单页防抖处理
This commit is contained in:
+19
-2
@@ -28,7 +28,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-32 btn">
|
||||
<view class="ai-button2" @click="sub">确认订单</view>
|
||||
<view class="ai-button2" :class="{ 'ai-button2--disabled': isSubmitting }" @click="sub"
|
||||
>确认订单</view
|
||||
>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
@@ -52,6 +54,7 @@
|
||||
let remark_value = ref();
|
||||
let spuId = ref();
|
||||
let spuPrice = ref();
|
||||
const isSubmitting = ref(false);
|
||||
|
||||
const settlementInfo = ref<any>({});
|
||||
let addressId = ref('');
|
||||
@@ -82,7 +85,12 @@
|
||||
});
|
||||
};
|
||||
const sub = async () => {
|
||||
if (isSubmitting.value) {
|
||||
return;
|
||||
}
|
||||
if (!addressId.value) return proxy.utils.toast('请选择地址');
|
||||
isSubmitting.value = true;
|
||||
try {
|
||||
let res: any = await SpuApi.createOrderOpen({
|
||||
id: addressId.value,
|
||||
spuId: spuId.value,
|
||||
@@ -97,10 +105,15 @@
|
||||
returnTo: 'aiStore_plaza',
|
||||
});
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
isSubmitting.value = false;
|
||||
} catch (e) {
|
||||
isSubmitting.value = false;
|
||||
}
|
||||
};
|
||||
const getAddress = () => {
|
||||
api.getAddressList().then((res) => {
|
||||
api.getAddressList().then((res: any) => {
|
||||
if (res.code === 0 && res.data?.length) {
|
||||
// addressState.value.addressInfo = res.data[0];
|
||||
// getSettlementInfo(res.data[0].id);
|
||||
@@ -158,4 +171,8 @@
|
||||
border-top: 1rpx solid #dfdfdf;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
.ai-button2--disabled {
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user