sql数据流,amdin业务逻辑接入
This commit is contained in:
@@ -73,17 +73,63 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { reactive } from 'vue'
|
||||
import { reactive, onMounted, ref } from 'vue'
|
||||
import { fetchRechargeConfig, saveRechargeConfig, RechargeConfig } from '@/services/admin/marketingService.uts'
|
||||
|
||||
const isLoading = ref(false)
|
||||
const isSaving = ref(false)
|
||||
|
||||
const config = reactive({
|
||||
balance_enabled: true,
|
||||
notice: '充值后账户的金额不能提现,可用于商城消费使用\n佣金导入账户之后不能再次导出、不可提现\n账户充值出现问题可联系商城客服',
|
||||
notice: '',
|
||||
mp_recharge: false,
|
||||
min_amount: 0.01
|
||||
})
|
||||
|
||||
const handleSave = () => {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
onMounted(() => {
|
||||
loadConfig()
|
||||
})
|
||||
|
||||
async function loadConfig() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await fetchRechargeConfig()
|
||||
if (res != null) {
|
||||
config.balance_enabled = res.balance_enabled
|
||||
config.notice = res.recharge_notice ?? ''
|
||||
config.mp_recharge = res.mp_recharge_enabled
|
||||
config.min_amount = res.min_recharge_amount
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载配置失败', icon: 'none' })
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSave() {
|
||||
if (isSaving.value) return
|
||||
|
||||
isSaving.value = true
|
||||
const payload : RechargeConfig = {
|
||||
balance_enabled: config.balance_enabled,
|
||||
recharge_notice: config.notice,
|
||||
mp_recharge_enabled: config.mp_recharge,
|
||||
min_recharge_amount: config.min_amount
|
||||
}
|
||||
|
||||
try {
|
||||
const success = await saveRechargeConfig(payload)
|
||||
if (success) {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
} else {
|
||||
uni.showToast({ title: '保存失败', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '保存异常', icon: 'none' })
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user