|
@@ -166,7 +166,7 @@
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
|
<van-switch
|
|
<van-switch
|
|
|
- @click="changeAuto"
|
|
|
|
|
|
|
+ @click="toggleAutoTrade"
|
|
|
:disabled="!isVip"
|
|
:disabled="!isVip"
|
|
|
:model-value="userVip && userVip.autoTradeEnabled"
|
|
:model-value="userVip && userVip.autoTradeEnabled"
|
|
|
/>
|
|
/>
|
|
@@ -475,35 +475,23 @@ const maxNumber = ref(0)
|
|
|
const maxPrice = ref(0)
|
|
const maxPrice = ref(0)
|
|
|
const minPrice = ref(0)
|
|
const minPrice = ref(0)
|
|
|
|
|
|
|
|
-function changeAuto() {
|
|
|
|
|
|
|
+async function toggleAutoTrade() {
|
|
|
if (!isVip.value) {
|
|
if (!isVip.value) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if (userVip.value.autoTradeEnabled) {
|
|
|
|
|
- showConfirmDialog({
|
|
|
|
|
- title: t('common.alert'),
|
|
|
|
|
- message: t('vip.sureClose'),
|
|
|
|
|
- confirmButtonText: t('common.close')
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ Toast.loading({
|
|
|
|
|
+ message: t('common.loading') + '...',
|
|
|
|
|
+ forbidClick: true
|
|
|
})
|
|
})
|
|
|
- .then(() => {
|
|
|
|
|
- Toast.loading({
|
|
|
|
|
- message: t('common.loading') + '...',
|
|
|
|
|
- forbidClick: true
|
|
|
|
|
- })
|
|
|
|
|
- return http.post('/vip/disableAutoTrade')
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- Toast.success(t('vip.closed'))
|
|
|
|
|
- getMineVip()
|
|
|
|
|
- })
|
|
|
|
|
- .catch(e => {
|
|
|
|
|
- Toast.clear()
|
|
|
|
|
- if (e && e.error) {
|
|
|
|
|
- Toast.success(e.error)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- showSetModal.value = true
|
|
|
|
|
|
|
+ await http.post(userVip.value.autoTradeEnabled ? '/vip/disableAutoTrade' : '/vip/enableAutoTrade', {
|
|
|
|
|
+ minPrice: minPrice.value,
|
|
|
|
|
+ maxPrice: maxPrice.value
|
|
|
|
|
+ })
|
|
|
|
|
+ Toast.success(userVip.value.autoTradeEnabled ? t('vip.closed') : t('vip.opened'))
|
|
|
|
|
+ getMineVip()
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ Toast.error(e?.error || t('common.error'))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|