f
This commit is contained in:
@@ -19,6 +19,9 @@ const formData = ref({
|
||||
clientPrice: null,
|
||||
})
|
||||
|
||||
/** 从首页报告卡片带入的 product_en,配置加载后预选 */
|
||||
const initialFeature = ref('')
|
||||
|
||||
const availableReportTypes = computed(() => {
|
||||
if (!productConfig.value?.length)
|
||||
return []
|
||||
@@ -84,6 +87,17 @@ function openPricePicker() {
|
||||
showPricePicker.value = true
|
||||
}
|
||||
|
||||
function toExampleReport() {
|
||||
const feature = formData.value.productType
|
||||
if (!feature) {
|
||||
uni.showToast({ title: '请先选择报告类型', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/report-example-webview?feature=${encodeURIComponent(feature)}`,
|
||||
})
|
||||
}
|
||||
|
||||
async function getPromoteConfig() {
|
||||
loadingConfig.value = true
|
||||
try {
|
||||
@@ -91,7 +105,10 @@ async function getPromoteConfig() {
|
||||
if (data.value && !error.value && data.value.code === 200) {
|
||||
const list = data.value.data.AgentProductConfig || []
|
||||
productConfig.value = list
|
||||
const availableType = availableReportTypes.value[0]
|
||||
const preset = initialFeature.value
|
||||
? availableReportTypes.value.find(item => item.value === initialFeature.value)
|
||||
: null
|
||||
const availableType = preset || availableReportTypes.value[0]
|
||||
if (availableType) {
|
||||
selectProductType(availableType.value)
|
||||
}
|
||||
@@ -143,6 +160,12 @@ async function generatePromotionCode() {
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
const feature = options?.feature
|
||||
if (feature)
|
||||
initialFeature.value = decodeURIComponent(String(feature))
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getPromoteConfig()
|
||||
})
|
||||
@@ -163,8 +186,14 @@ onMounted(() => {
|
||||
</view>
|
||||
<VipBanner />
|
||||
|
||||
<view class="card mb-4">
|
||||
<view class="mb-2 text-xl font-semibold">
|
||||
<view class="card mb-4 relative">
|
||||
<text
|
||||
class="absolute right-4 top-4 z-10 text-sm text-blue-600 active:opacity-70"
|
||||
@click="toExampleReport"
|
||||
>
|
||||
示例报告
|
||||
</text>
|
||||
<view class="mb-2 pr-20 text-xl font-semibold">
|
||||
生成推广码
|
||||
</view>
|
||||
<wd-form ref="promotionForm" :model="formData">
|
||||
|
||||
Reference in New Issue
Block a user