f
This commit is contained in:
@@ -440,7 +440,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 支付组件 -->
|
<!-- 支付组件 -->
|
||||||
<Payment v-model="showPayment" :data="featureData" :id="queryId" type="query" @close="showPayment = false" />
|
<Payment v-model="showPayment" :data="featureData" :id="queryId" type="query"
|
||||||
|
:hide-wechat="props.type === 'promotion'" @close="showPayment = false" />
|
||||||
<BindPhoneDialog @bind-success="handleBindSuccess" />
|
<BindPhoneDialog @bind-success="handleBindSuccess" />
|
||||||
<LoginDialog @login-success="handleLoginSuccess" />
|
<LoginDialog @login-success="handleLoginSuccess" />
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<!-- 支付方式选择 -->
|
<!-- 支付方式选择 -->
|
||||||
<div class="">
|
<div class="">
|
||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<van-cell v-if="isWeChat" title="微信支付" clickable @click="selectedPaymentMethod = 'wechat'">
|
<van-cell v-if="showWechatPay" title="微信支付" clickable @click="selectedPaymentMethod = 'wechat'">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<van-icon size="24" name="wechat-pay" color="#1AAD19" class="mr-2" />
|
<van-icon size="24" name="wechat-pay" color="#1AAD19" class="mr-2" />
|
||||||
</template>
|
</template>
|
||||||
@@ -48,18 +48,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
|
|
||||||
<!-- 开发环境:测试支付(仅开发环境显示) -->
|
<!-- 支付宝支付(非微信环境;或微信内但隐藏微信支付时,如代理推广页) -->
|
||||||
<van-cell v-if="isDev" title="测试支付(开发)" clickable @click="selectedPaymentMethod = 'test'">
|
<van-cell v-if="showAlipayPay" title="支付宝支付" clickable @click="selectedPaymentMethod = 'alipay'">
|
||||||
<template #icon>
|
|
||||||
<van-icon size="24" name="passed" color="#07c160" class="mr-2" />
|
|
||||||
</template>
|
|
||||||
<template #right-icon>
|
|
||||||
<van-radio v-model="selectedPaymentMethod" name="test" />
|
|
||||||
</template>
|
|
||||||
</van-cell>
|
|
||||||
|
|
||||||
<!-- 支付宝支付 -->
|
|
||||||
<van-cell v-if="!isWeChat" title="支付宝支付" clickable @click="selectedPaymentMethod = 'alipay'">
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<van-icon size="24" name="alipay" color="#00A1E9" class="mr-2" />
|
<van-icon size="24" name="alipay" color="#00A1E9" class="mr-2" />
|
||||||
</template>
|
</template>
|
||||||
@@ -77,7 +67,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps } from "vue";
|
import { ref, computed, watch, onMounted } from "vue";
|
||||||
import { showConfirmDialog } from "vant";
|
import { showConfirmDialog } from "vant";
|
||||||
const { isWeChat } = useEnv();
|
const { isWeChat } = useEnv();
|
||||||
const isDev = import.meta.env.DEV;
|
const isDev = import.meta.env.DEV;
|
||||||
@@ -95,20 +85,40 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
/** 为 true 时不展示微信支付(例如 /agent/promotionInquire/ 代理推广查询) */
|
||||||
|
hideWechat: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const show = defineModel();
|
const show = defineModel();
|
||||||
const selectedPaymentMethod = ref(
|
|
||||||
isDev ? "test" : isWeChat.value ? "wechat" : "alipay"
|
const showWechatPay = computed(() => isWeChat.value && !props.hideWechat);
|
||||||
);
|
const showAlipayPay = computed(() => !isWeChat.value || props.hideWechat);
|
||||||
onMounted(() => {
|
|
||||||
if (isDev) {
|
function defaultPaymentMethod() {
|
||||||
selectedPaymentMethod.value = "test";
|
if (isDev) return "test";
|
||||||
} else if (isWeChat.value) {
|
if (showWechatPay.value) return "wechat";
|
||||||
selectedPaymentMethod.value = "wechat";
|
return "alipay";
|
||||||
} else {
|
}
|
||||||
selectedPaymentMethod.value = "alipay";
|
|
||||||
|
const selectedPaymentMethod = ref(defaultPaymentMethod());
|
||||||
|
|
||||||
|
function syncSelectedPaymentMethod() {
|
||||||
|
selectedPaymentMethod.value = defaultPaymentMethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(syncSelectedPaymentMethod);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
[showWechatPay, showAlipayPay, show],
|
||||||
|
() => {
|
||||||
|
if (show.value) {
|
||||||
|
syncSelectedPaymentMethod();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
{ flush: "post" }
|
||||||
|
);
|
||||||
const orderNo = ref("");
|
const orderNo = ref("");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const discountPrice = ref(false); // 是否应用折扣
|
const discountPrice = ref(false); // 是否应用折扣
|
||||||
|
|||||||
Reference in New Issue
Block a user