dcc
2024-06-13 3616db170333df7d668c97323344335b52c4153c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
  <div>
    <el-dialog
      :title="t('message.user.anquanyanzheng')"
      v-model="show"
      width="360px"
      :append-to-body="true"
      :show-close="false"
    >
      <div class="body-wrapper">
        <div class="bg-gray p-4">
          {{ t("message.user.shuruzijinmima") }}
          <div class="font-bold text-base text-center mb-2">
            <el-input
              show-password
              clearable
              :placeholder="$t('qsr_zijinmima')"
              class="mt-2"
              type="number"
              v-model="password"
              @change="pwdInputChange"
            ></el-input>
          </div>
        </div>
 
        <!-- 按钮 -->
        <div class="flex justify-center mt-4">
          <el-button
            type="primary"
            @click="onConfirm(true)"
            class="w-full btn-submit"
          >
            {{ t("message.home.queren") }}
          </el-button>
          <el-button @click="() => onConfirm(false)" class="w-full btn-submit">
            {{ t("message.home.quxiao") }}
          </el-button>
        </div>
        <!-- 资金密码不可用 -->
        <p
          class="text-center mt-2 blue-color cursor-pointer"
          @click="router.push('/my/security')"
        >
          {{ $t("message.user.enterNotPassword") }}
        </p>
      </div>
    </el-dialog>
  </div>
</template>
 
<script setup>
import { useRouter } from "vue-router";
import { ref, onBeforeMount } from "vue";
import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus";
import Axios2 from "@/api/wallet";
 
const { t } = useI18n();
const router = useRouter();
const props = defineProps({
  isShow: {
    type: Boolean,
    default: false,
  },
  payInfo: {
    type: Object,
    default: {},
  },
});
 
const password = ref();
const pay = ref({});
const show = ref();
const emits = defineEmits(["close"]);
onBeforeMount(() => {
  pay.value = props.payInfo;
  show.value = props.isShow;
});
 
watch(props, async (newprops) => {
  pay.value = newprops.payInfo;
  show.value = newprops.isShow;
});
const pwdInputChange = (val) => {};
 
// 确认
const onConfirm = (isConfirm) => {
  console.log(888888, isConfirm);
  if (!isConfirm) {
    emits("close");
    return;
  }
 
  if (password.value.length < 6) {
    ElMessage.error(t("message.user.funpasswordTips"));
    return false;
  }
 
  pay.value.safeword = password.value;
  Axios2.getBankRechargeToken()
    .then((res) => {
      pay.value.session_token = res.data.session_token;
    })
    .then(() => {
      Axios2.applyOrder(pay.value).then((res) => {
        if (res.code == 0) {
          // router.push(`/bank/orderSuccess?id=${res.data.order_no}`);
 
          emits("close", isConfirm);
        } else {
          ElMessage.error(res.msg);
        }
      });
    });
};
</script>
<style lang="scss" scoped>
$input_background: #27293b;
$text_color: #fff;
$text_color1: #868d9a; //文字浅色
$black: #000;
.pay-info {
  color: $black;
  font-size: 14px;
}
 
.title {
  text-align: center;
  color: #1f2025;
  font-weight: bold;
  font-size: 20px;
}
 
.ash {
  color: $text_color1;
}
 
.money-title {
  font-size: 24px;
  font-weight: bold;
}
.bg-gray {
  background: #fafafa;
}
.el-dialog__body {
  padding-top: 12px;
}
</style>