blob: 0525ae3875bdd6f1f1684bef536c102112544648 [file] [log] [blame]
guangchao.xu070005a2020-12-07 09:56:40 +08001<template>
2 <view class="bindBankCard">
3 <view class="bindBankCard-list">
guangchao.xu6cdd45e2021-04-16 17:44:30 +08004 <u-field v-model="name" label="姓名" placeholder="请输入您的真实姓名" placeholder-style="color:#999999;font-family:PingFang-SC-Regular"
5 clear-size="40"></u-field>
guangchao.xu070005a2020-12-07 09:56:40 +08006 <u-field @click="showPicker" v-model="cardtype" :disabled="true" label="证件类型" clear-size="40"></u-field>
7 <u-field v-model="idno" label="证件号" placeholder="请输入您的证件号" placeholder-style="color:#999999" clear-size="40"></u-field>
8 <u-field v-model="cardno" label="银行卡号" placeholder="请输入市民卡对应的银行卡号" placeholder-style="color:#999999" clear-size="40"></u-field>
9 </view>
10 <u-button :custom-style="bindBankCardBtn" @click="bindBackCard">下一步</u-button>
11 <u-picker mode="selector" v-model="isShowPicker" :default-selector="[5]" :range="cardtypeList" @confirm="getCard"></u-picker>
12 </view>
13</template>
14
15<script>
16 export default {
17 data() {
18 return {
19 name: "",
20 idno: "",
21 cardno: "",
22 code: "",
23 codeText: "获取验证码",
24 cardtype: "请选择证件类型",
25 cardtypeList: [],
26 isShowPicker: false,
27 checked: false,
28 arr: [],
guangchao.xu6cdd45e2021-04-16 17:44:30 +080029 idtype: "",
30 disabled: false,
31 signed: "",
32 bindBankCardBtn: {
guangchao.xu070005a2020-12-07 09:56:40 +080033 width: '600rpx',
34 backgroundColor: '#2FA8E1',
35 color: '#FFFFFF',
36 fontFamily: "PingFang-SC-Medium",
37 fontSize: '30rpx',
38 marginTop: '100rpx',
39 padding: '50rpx 0'
40 }
41 }
42 },
43 computed: {
44
45 },
46 onLoad() {
47 this.getType()
48 let signed = wx.getStorageSync("signed")
guangchao.xu6cdd45e2021-04-16 17:44:30 +080049 if (signed == "no") {
guangchao.xu070005a2020-12-07 09:56:40 +080050 this.signed = false
guangchao.xu6cdd45e2021-04-16 17:44:30 +080051 } else {
guangchao.xu070005a2020-12-07 09:56:40 +080052 this.signed = true
53 }
54 },
55 methods: {
guangchao.xu6cdd45e2021-04-16 17:44:30 +080056 bindBackCard() {
57 let that = this
58 let {
59 cardno,
60 idtype,
61 name,
62 idno,
63 checked,
64 code
65 } = that
guangchao.xu070005a2020-12-07 09:56:40 +080066 if (name == "") {
67 uni.showToast({
68 title: "请填写您的姓名",
69 duration: 800,
70 icon: "none"
71 })
72 return false
73 }
74 if (idno == "") {
75 uni.showToast({
76 title: "请输入您的证件号",
77 duration: 800,
78 icon: "none"
79 })
80 return false
81 }
82 if (cardno == "") {
83 uni.showToast({
84 title: "请输入您的市民卡号",
85 duration: 800,
86 icon: "none"
87 })
88 return false
89 }
90 if (idtype == "") {
91 uni.showToast({
92 title: "请选择您的证件类型",
93 duration: 800,
94 icon: "none"
95 })
96 return false
97 }
98 if (idtype == "") {
99 uni.showToast({
100 title: "请选择您的证件类型",
101 duration: 800,
102 icon: "none"
103 })
104 return false
105 }
106 var param = {
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800107 "cardno": cardno.trim(),
108 "idtype": idtype,
109 "name": name,
110 "idno": idno.trim()
guangchao.xu070005a2020-12-07 09:56:40 +0800111 }
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800112 that.$u.post("/v1/bindcard", param).then((res) => {
113 let isBind = res.signed
114 uni.setStorageSync("name", name)
guangchao.xu070005a2020-12-07 09:56:40 +0800115 uni.setStorageSync("cardno", cardno.trim())
116 uni.setStorageSync("idtype", idtype)
117 uni.setStorageSync("idno", idno.trim())
118 uni.setStorageSync("phoneX", res.phonex)
119 uni.setStorageSync("personid", res.personid)
120 uni.setStorageSync("userid", res.personid)
121 uni.setStorageSync("signed", res.signed)
122 uni.setStorageSync("paypwdset", res.paypwdset)
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800123 if (isBind == 'yes') {
124 uni.showToast({
125 title: '账户已绑定',
126 icon: 'none',
127 duration: 800,
128 success(res) {
129 setTimeout(() => {
130 uni.navigateBack({
131 delta: 1
132 })
133 }, 1500)
134 }
135 })
136 } else {
137 uni.showToast({
138 title: "绑定成功",
139 icon: "none",
140 duration: 800,
141 complete(res) {
142 setTimeout(() => {
143 uni.navigateTo({
144 url: "/pages/sub_mine/bindSxy"
145 })
146 }, 1500)
147 }
148 })
149 }
150
guangchao.xu070005a2020-12-07 09:56:40 +0800151 })
152 },
153 getType() {
154 let that = this
155 that.$u.post("/v1/idtypes", {}).then((res) => {
156 let arr = []
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800157 let arr1 = []
guangchao.xu070005a2020-12-07 09:56:40 +0800158 for (let i in res.idtypes) {
159 let obj = {
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800160 name: i,
161 value: res.idtypes[i]
guangchao.xu070005a2020-12-07 09:56:40 +0800162 }
163 arr.push(obj)
164 arr1.push(res.idtypes[i])
165 }
166 that.cardtypeList = arr1
167 that.cardtype = arr1[5]
168 that.idtype = 'idcard'
169 that.arr = arr
170 })
171 },
172 showPicker() {
173 this.isShowPicker = true
174 },
175 getCard(e) {
176 let that = this
177 that.cardtype = that.cardtypeList[e[0]]
178 that.idtype = that.arr[e[0]].name
179 },
180 }
181 }
182</script>
183
184<style lang="scss" scoped>
185 .bindBankCard {
186 width: 100vw;
187 // height: 100vh;
188 background-color: #F3F3F3;
189 overflow: hidden;
190 padding-bottom: 30rpx;
guangchao.xu6cdd45e2021-04-16 17:44:30 +0800191
192 &-toast {
guangchao.xu070005a2020-12-07 09:56:40 +0800193 display: flex;
194 padding: 20rpx 30rpx;
195 font-family: "PingFang-SC-Medium";
196 font-size: 26rpx;
197 justify-content: space-between;
198 color: #999999;
199 }
200
201 &-list {
202 margin-top: 30rpx;
203 background-color: #FFFFFF;
204 }
205
206 &-lay {
207 font-family: "PingFang-SC-Regular";
208 color: #666666;
209 margin: 10rpx 30rpx;
210
211 &-text {
212 color: #2FA8E1;
213 }
214 }
215
216 &-btn {
217 width: 600rpx;
218 background-color: #2FA8E1;
219 color: #FFFFFF;
220 font-family: "PingFang-SC-Medium";
221 font-size: 30rpx;
222 margin-top: 30rpx;
223 padding: 50rpx 0;
224 }
225 }
226
227 .btn {
228 color: #2FA8E1;
229 background-color: #FFFFFF;
230 border-color: #2FA8E1;
231 border-width: 1rpx;
232 border-style: solid;
233 font-family: "PingFang-SC-Regular";
234 }
235</style>