宜呗小程序--微信小程序
Lzk
2025-08-05 b7bcaf556aa2424e808b6e6426ab22df9cfe11c1
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<script>
import sfkef from "@/components/sfkef/index.vue";
import repayTerm from "@/components/picker/repayTerm.vue";
import loanUsage from "@/components/picker/loanUsage.vue";
import plan from  '@/components/plan'
import value from "@/uni_modules/uv-text/components/uv-text/value";
import {
  xinheyuanBankcardDetail,
  xinheyuanCreditView,
  xinheyuanGetLoanElement,
  renpinH5withdrawCheck,
  xinheyuanLoanQueryByCustomerId, getCustomerInfo
} from "@/api/modules/user";
import agreement from "@/components/agreement/index.vue";
export default {
  name: "index",
  components:{agreement, loanUsage, repayTerm,plan,sfkef},
  computed: {
    customStyle() {
      return {
        height: '100rpx',
        background: '#4766FE',
        color: '#fff',
        borderRadius: '50rpx' ,
        fontSize:'34rpx'
      }
    },
    inputStyle(){
      return {
        fontWeight: 'bold',
        fontSize: '30rpx',
      }
    },
  },
  async onLoad() {
    try {
      await getCustomerInfo().then(res=>{
        this.customerInfo = res;
        uni.setStorageSync('customerZcyId', res.customerZcyId);
        uni.setStorageSync('customerBankcardId', res.customerBankcardId);
      })
    } catch (e) {
      console.log(e);
    }
 
    await  xinheyuanBankcardDetail().then(res=>{
 
      this.bankDetail = res;
    })
    await  xinheyuanCreditView().then(res=>{
      this.info = res
 
    })
    await xinheyuanGetLoanElement({
      creditNo: this.bankDetail.orderNo,
      userId: this.customerInfo.customerZcyId || uni.getStorageSync('customerZcyId'),
      customerBankcardId:this.customerInfo.customerBankcardId || uni.getStorageSync('customerBankcardId')
    }).then(res=>{
      this.BankcarIdList  = res;
      this.BankcarIdList.map(item=>{
        item.flag = true
      })
    })
  },
  data() {
    return {
      customerInfo:{},
      bankDetail:{},
      lstyle:{
        color:'#8B8D96',
        fontSize:'30rpx'
      },
      protocolChecked: [0],
      BankcarIdList:[],
      userInfo: {
        repayTermStr: "12个月",
        repayTerm: "12",
        repayPlanDayStr:`每月${new Date().getDate()}号`,
        repayPlanDay: new Date().getDate(),
        repayLoanPurposeStr: "装修",
        repayLoanPurpose: "DEC",
      },
      info:{
        totalCredit:null
      },
      timeoutID:null
    }
  },
  methods: {
    handleNumber(vla){
      const chineseDigits = ["一", "二", "三", "四", "五", "六", "七", "八", "九",];
      return chineseDigits[vla];
    },
    openPciker(dom){
      this.$refs[dom].open()
    },
    getValueRepayTerm(e){
      this.userInfo.repayTermStr = e['value'][0].text;
      this.userInfo.repayTerm = e['value'][0].value;
    },
    getValueLoanUsage(e){
      this.userInfo.repayLoanPurposeStr = e['value'][0].text
      this.userInfo.repayLoanPurpose = e
    },
    toCode(vla,index){
      uni.navigateTo({
        url: `/pages/code/index?queryType=${2}&code=${vla.code}&index=${index}`
      });
    },
    changeFlag(key){
      this.BankcarIdList.map((item,index)=>{
        if(index == key){
          item.flag = false
        }
      })
    },
    rpwithdrawCheck(){
      renpinH5withdrawCheck({orderNo:this.customerInfo.orderNo}).then(res=>{
        if (res.checkStu === 100) {
          //  审核中
          uni.showLoading({
            title: "资金匹配中",
            mask: true,
          });
          this.timeoutID = setTimeout(this.rpwithdrawCheck, 3000);
        }
        else if (res.checkStu === 200) {
          this.getXinheyuanLoanQueryByCustomerId();
        }
        else {
          uni.reLaunch({
            url: '/pages/result/not'
          })
          if(this.timeout){
            clearTimeout(this.timeoutID)
          }
        }
      })
    },
    getXinheyuanLoanQueryByCustomerId(){
      xinheyuanLoanQueryByCustomerId().then(res=>{
        if (res === "99") {
          uni.reLaunch({
            url: '/pages/loan/index'
          })
          if(this.timeout){
            clearTimeout(this.timeoutID)
          }
        }
        if (res === "04") {
 
        }
        if (res === "06") {
          uni.hideLoading();
        }
      })
    },
    submit(){
      if(!this.protocolChecked[0]){uni.showToast({title: '请阅读并同意相关协议', icon: 'none'});return;}
      if(this.userInfo.repayTerm == ''){uni.showToast({title: '请选择还款期数', icon: 'none'});return;}
      if(this.userInfo.repayLoanPurpose == ''){uni.showToast({title: '请选择借款用途', icon: 'none'});return;}
      if (this.bankDetail.bindStatusRepay !== 1 && this.bankDetail.bindStatusRepay) {uni.showToast({icon: "none", title: "请添加还款卡",});return;}
      // 判断是否所有的 资方都绑定
      const allBound = this.BankcarIdList.every((item) => item.flag === false);
      if (!allBound) {
        uni.showToast({
          icon: "none",
          title: "请先绑定收款账户",
        });
        return;
      }
      uni.showLoading({
        title: "资金匹配中",
        mask: true,
      });
      this.rpwithdrawCheck();
    },
  },
 
}
</script>
 
<template>
  <view style="background: #F7F7F7;min-height: 100vh">
 
    <view class="content">
      <view class="head">
        <view class="title">借款金额(元)</view>
        <view class="money">{{info.totalCredit}}
          <view style="display: flex;justify-content: end"><image class="icon" :src="`${$images}/static/img/details/bi.png`"></image></view></view>
        <view class="tips">单利利息,年化综合费率16%</view>
      </view>
      <view class="form-box" >
        <uv-form  style="padding: 0 38rpx;" :labelStyle='lstyle' labelPosition="left" :model="userInfo"  ref="form" labelWidth="100">
          <uv-form-item class="item" label="还款期数" prop="repayTermStr" borderBottom @click="openPciker('repayTerm')">
            <uv-input  :customStyle="inputStyle" disabled disabledColor="none" inputAlign="right" v-model="userInfo.repayTermStr" border="none" placeholder="请选择"></uv-input>
            <template v-slot:right>
              <uv-icon name="arrow-right" size="12"></uv-icon>
            </template>
          </uv-form-item>
          <uv-form-item class="item" label="还款计划" prop="repayPlanDayStr" borderBottom @click="openPciker('plan')">
            <uv-input  :customStyle="inputStyle"  disabled disabledColor="none"  inputAlign="right" v-model="userInfo.repayPlanDayStr" border="none" placeholder="请选择"></uv-input>
            <template v-slot:right>
              <uv-icon name="arrow-right" size="12"></uv-icon>
            </template>
          </uv-form-item>
          <uv-form-item class="item" label="借款用途" prop="repayLoanPurposeStr" @click="openPciker('loanUsage')">
            <uv-input  :customStyle="inputStyle" inputAlign="right" v-model="userInfo.repayLoanPurposeStr" border="none" placeholder="请选择"></uv-input>
            <template v-slot:right>
              <uv-icon name="arrow-right" size="12"></uv-icon>
            </template>
          </uv-form-item>
        </uv-form>
      </view>
      <view class="notes" >
        为了确保资金到账,应资方要求,对收款账户进行短信确认
      </view>
 
      <view class="code">
        <view class="li" v-for="(item,index) in BankcarIdList" >
          <template  v-if="item.flag">
            <uv-icon  color="#4766FE" name="plus-circle-fill" size="20"></uv-icon>
            <view @click="toCode(item,index)" class="writing" >请点击确认收款账户({{handleNumber(index)}})</view>
          </template>
 
          <template v-else>
            <uv-icon  color="#4766FE" name="checkmark-circle-fill" size="20"></uv-icon>
            <view class="writing">已确认</view>
          </template>
        </view>
 
      </view>
 
      <view >
        <view style="display: flex;flex-direction: row">
          <uv-checkbox-group
              v-model="protocolChecked">
            <uv-checkbox size="14" :name="1">
            </uv-checkbox>
          </uv-checkbox-group>
          <text class="protocol-text" >
            我已同意并签署<text style="font-size: 24rpx;" class="link-text"  @click="openPciker('agreement')">《相关协议》</text>同意保送贷款相关信息至金融信用信息基础数据库(人行征信系统)
          </text>
        </view>
 
      </view>
 
 
      <view class="but">
        <uv-button @click="submit" :customStyle="customStyle" shape="circle" color="#4766FE">提交借款</uv-button>
        <view class="pack">会员礼包 <uv-icon size="18" name="checkmark-circle" style="margin-left: 32rpx;"></uv-icon></view>
      </view>
    </view>
 
    <repayTerm ref="repayTerm" @confirm="getValueRepayTerm"></repayTerm>
 
    <loanUsage ref="loanUsage"   @confirm="getValueLoanUsage"></loanUsage>
 
    <agreement ref="agreement"></agreement>
 
    <uv-popup mode="bottom" round="20" ref="plan" v-if="info.totalCredit">
      <plan :amount="info.totalCredit"></plan>
    </uv-popup>
    <sfkef></sfkef>
  </view>
 
</template>
 
<style scoped lang="scss">
page{
  background: #F7F7F7;
  .p38{
    padding: 38rpx;
  }
  .notes{
    margin-top: 40rpx;
    margin-bottom: 20rpx;
    font-size: 24rpx;
    color: #666666;
  }
}
.content{
  padding: 40rpx 32rpx;
  .head{
    background: url(#{$iconHttps}/static/img/details/cardBack.png) no-repeat;
    background-size: 100% 100% ;
 
    color: white;
    padding: 42rpx 40rpx;
    display: flex;
    justify-content: flex-end;
    .title{
      font-size: 28rpx;
      margin-bottom: 18rpx;
    }
    .money{
      font-size: 84rpx;
      font-weight: bold;
      margin-bottom: 18rpx;
      border-bottom: 1rpx solid rgba(255,255,255,0.2);
      display: flex;
      flex-direction: row;
      position: relative;
      .icon{
        width: 28rpx;height: 28rpx;
        display: flex;
        justify-content: center;
        margin-left: 16rpx;
        position: relative;
        bottom: 18rpx;
      }
    }
    .tips{
      font-size: 24rpx;
      opacity: 0.6;
    }
  }
 
  .form-box{
    margin-top: 20rpx;
    background: white;
    border-radius: 16rpx;
  }
 
 
  .code{
    .li{
      padding: 30rpx 40rpx;
      background: white;
      border-radius: 16rpx;
      font-size: 30rpx;
      color: #4766FE;
      display: flex;
      flex-direction: row;
      font-weight: 800;
      margin-bottom: 20rpx;
      .writing{
        margin-left: 20rpx;display: flex;justify-content: center;
      }
    }
  }
 
  .but{
    padding: 66rpx 20rpx 0 20rpx;
    .pack{
      text-align: center;
      margin-top: 20rpx;
      font-size: 30rpx;
      color: #333333;
      display: flex;
      flex-direction: row;
      justify-content: center;
    }
  }
}
.protocol-text {
  text-align: center;
  width: calc( 100% - 28rpx);
  font-size: 24rpx;
  color: #8B8D96;
  line-height: 28rpx;
}
.link-text {
  color: #207ef5;
  display: inline;
}
</style>