zhengyiming
2025-03-11 5a5af7e63a639541db5121d9fa30775b6d500108
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
41
42
43
44
45
46
47
48
49
50
51
<template>
  <GasBillRechargeStep1 v-if="current === 'step1'" />
  <GasBillRechargeStep2 v-else-if="current === 'step2'" />
  <GasBillRechargeStep3
    v-else-if="current === 'step3'"
    v-bind="props"
    @go-pay="emit('goPay', $event)"
  />
</template>
 
<script setup lang="ts">
import { computed, provide, reactive } from 'vue';
import { useStepper } from 'senin-mini/hooks';
import { GasBillRechargeContextKey } from './context';
import GasBillRechargeStep1 from './GasBillRechargeStep1.vue';
import GasBillRechargeStep2 from './GasBillRechargeStep2.vue';
import GasBillRechargeStep3 from './GasBillRechargeStep3.vue';
import { LifeRechargeConstants } from '@life-payment/core-vue';
 
defineOptions({
  name: 'GasBillRecharge',
});
 
type Props = {
  isDev?: boolean;
};
 
const props = withDefaults(defineProps<Props>(), {
  isDev: false,
});
 
const stepperInfo = useStepper(['step1', 'step2', 'step3'], 'step3');
const current = computed(() => stepperInfo.current.value);
 
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
}>();
 
const preSetForm = reactive({
  gasOrgType: '' as any as LifeRechargeConstants.GasOrgCodeEnum,
  province: '',
  city: '',
  gasAccount: '',
  remark: '',
});
 
provide(GasBillRechargeContextKey, {
  ...stepperInfo,
  preSetForm,
});
</script>