zhengyiming
2025-03-26 ea89b8937d8102a52676120ca74887fa340abb97
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
  <PhoneBillRechargeStep1 v-if="current === 'step1'" />
  <PhoneBillRechargeStep2
    v-else-if="current === 'step2'"
    v-bind="props"
    @go-pay="emit('goPay', $event)"
    @paySuccess="emit('paySuccess', $event)"
    @missName="emit('missName', $event)"
  />
</template>
 
<script setup lang="ts">
import { computed, provide, useAttrs } from 'vue';
import { useStepper } from 'senin-mini/hooks';
import { PhoneBillRechargeContextKey } from './context';
import PhoneBillRechargeStep1 from './PhoneBillRechargeStep1.vue';
import PhoneBillRechargeStep2 from './PhoneBillRechargeStep2.vue';
import { RechargeProps } from './types';
 
defineOptions({
  name: 'PhoneBillRecharge',
});
 
const props = withDefaults(defineProps<RechargeProps>(), {
  isDev: false,
});
 
const stepperInfo = useStepper(['step1', 'step2'], 'step2');
const current = computed(() => stepperInfo.current.value);
 
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
  (e: 'paySuccess', orderNo: string): void;
  (e: 'missName', userAccountId: string): void;
}>();
 
provide(PhoneBillRechargeContextKey, {
  ...stepperInfo,
});
</script>