sql数据流,amdin业务逻辑接入

This commit is contained in:
comlibmb
2026-02-15 16:37:37 +08:00
parent ec636dc703
commit e648ff0c22
43 changed files with 5412 additions and 1024 deletions

View File

@@ -69,21 +69,72 @@
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
import { ref, reactive, onMounted } from 'vue'
import { fetchMemberConfig, saveMemberConfig, MemberConfig } from '@/services/admin/marketingService.uts'
const isSaving = ref(false)
const config = reactive({
is_open: true,
bg_img: 'https://demo26.crmeb.net/uploads/attach/2021/11/20211115/a6f3b06e9d6d5a1b3c9d6d5a1b3c9d6d.png',
bg_img: '',
expire_bg_img: '',
rules: '1. 会员有效期自购买之日起计算\n2. 会员权益仅限本人使用\n3. 会员卡一经售出,概不退换'
rules: ''
})
const handleUpload = (type: string) => {
uni.showToast({ title: '文件管理器暂未开启', icon: 'none' })
onMounted(() => {
loadConfig()
})
async function loadConfig() {
try {
const res = await fetchMemberConfig()
if (res != null) {
config.is_open = res.is_enabled
config.bg_img = res.bg_img_url ?? ''
config.expire_bg_img = res.expire_bg_img_url ?? ''
config.rules = res.rules_description ?? ''
}
} catch (e) {
uni.showToast({ title: '加载配置失败', icon: 'none' })
}
}
const handleSave = () => {
uni.showToast({ title: '保存成功', icon: 'success' })
const handleUpload = (type: string) => {
uni.chooseImage({
count: 1,
success: (res) => {
if (type === 'bg') {
config.bg_img = res.tempFilePaths[0]
} else {
config.expire_bg_img = res.tempFilePaths[0]
}
}
})
}
async function handleSave() {
if (isSaving.value) return
isSaving.value = true
const payload : MemberConfig = {
is_enabled: config.is_open,
bg_img_url: config.bg_img,
expire_bg_img_url: config.expire_bg_img,
rules_description: config.rules
}
try {
const success = await saveMemberConfig(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>