liangjin
2021-03-22 39f63c38738cd40b142458708dee9bfbf8d1db1a
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!--
 * @Author: 小明丶
 * @Date: 2019-10-21 17:19:32
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-11-16 10:54:36
 * @Description:
 -->
<template>
  <div class="hbhy-big-box">
    <!-- <van-nav-bar title="办理套餐" left-arrow @click-left="onClickLeft" /> -->
    <!-- <x-header title="办理套餐" :left-options="{backText:''}"></x-header> -->
    <v-navbar title="办理套餐" fixed></v-navbar>
    <div class="color-box"></div>
    <div class="user-information">
      <div class="tit">
        <p>用户信息</p>
      </div>
      <div class="user-name">
        <van-field
          v-model="userName"
          label="用户姓名"
          placeholder="请输入用户姓名"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="user-number">
        <van-field
          v-model="userNumber"
          maxlength="11"
          label="入网号码"
          placeholder="请输入用户入网号码"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="user-number">
        <van-field
          v-model="tradeName"
          label="商品名称"
          placeholder="请输入商品名称"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
    </div>
    <div class="package-information">
      <div class="tit">
        <p>套餐信息</p>
      </div>
      <div class="package-tariff">
        <van-field
        class="myStyle"
          disabled
          custom-style="color:#333333"
          v-model="query.packageTariff"
          label="套餐资费"
          placeholder="请输入套餐资费"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="total-repayment">
        <van-field
        class="myStyle"
          disabled
          v-model="query.totalRepayment"
          label="总还款额"
          placeholder="请输入总还款额"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="monthly-repayment">
        <van-field
        class="myStyle"
          disabled
          v-model="query.monthlyRepayment"
          label="每月还款"
          placeholder="请输入每月还款"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="trim">
        <van-field
        class="myStyle"
          disabled
          v-model="query.trim"
          label="还款期数"
          placeholder="请输入还款期数"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
      <div class="merchant-arrival">
        <van-field
          disabled
          v-model="query.merchantArrival"
          label="商户到账"
          placeholder="请输入商户到账"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
        <van-field
          disabled
          v-model="platRatePr"
          label="智享服务费率"
          label-width="150px"
          placeholder="请输入智享服务费率"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
        <van-field
          disabled
          v-model="zfbRatePr"
          label="花呗分期手续费率"
          label-width="150px"
          placeholder="请输入花呗分期手续费率"
          input-align="right"
          label-class="input-text"
          style="font-size: 14px;
        color: rgba(102, 102, 102, 1);
        font-family:PingFang SC;"
        />
      </div>
    </div>
    <van-button
      round
      type="default"
      color="#896EDB"
      style="margin-left:10%;margin-top:120px;width:80%;background:#896EDB;color:#fff"
      @click="createdQRCode"
    >生成二维码</van-button>
    <Vdialog @cancel="cancel" :show="showDia"></Vdialog>
  </div>
</template>
<script>
import Vue from "vue";
import { NavBar } from "vant";
import { Field } from "vant";
import { Button } from "vant";
import { Notify } from "vant";
import Vdialog from "@/components/common/v-dialog.vue";
Vue.use(Notify);
Vue.use(Button);
Vue.use(Field);
Vue.use(NavBar);
export default {
  components:{
    Vdialog
  },
  data() {
    return {
      showDia:false,
      query: {
        zfbRate:'',
        platRate:'',
        merchantArrival: "", //商户到账
        trim: "", //分期期数
        monthlyRepayment: "", //每月还款
        totalRepayment: "", //总还款额
        packageTariff: "", //套餐资费
        contId: "", //套餐id
        contName: "" //套餐名称
      },
      userName: "", //用户名
      userNumber: "", //用户手机号
      tradeName: "" //商品名称
    };
  },
  computed:{
            zfbRatePr(){
                if(this.query.zfbRate){
                    return this.query.zfbRate + '%'
                }else{
                    return ''
                }
                
            },
            platRatePr(){
                if(this.query.platRate){
                    return this.query.platRate + '%'
                }else{
                    return ''
                }
                
            }
        },
  created(){
    if(sessionStorage.hb_session_info&&this.$route.query.isCreateOrderPush){
        let hb_session_info = JSON.parse(sessionStorage.hb_session_info)
        this.tradeName=hb_session_info.tradeName
        this.userName=hb_session_info.userName
        this.userNumber=hb_session_info.userNumber
    }
  },     
  mounted() {
    this.query = this.$route.query;
    console.log(this.query);
  },
  methods: {
    cancel(val){
      this.showDia = val
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    createdQRCode() {
      if (
        this.userName == "" ||
        this.userNumber == "" ||
        this.tradeName == ""
      ) {
        Notify({ type: "primary", message: "姓名、入网号码、商品名称不能为空" });
        return;
      }
      let hb_session_info = {
        userName:this.userName,
        userNumber:this.userNumber,
        tradeName:this.tradeName
      }
      sessionStorage.hb_session_info=JSON.stringify(hb_session_info)
 
      let params = {
        contId: this.query.contId,
        goodsName: this.tradeName,
        userName: this.userName,
        userMblNo: this.userNumber,
        zfbVersion: this.$route.query.zfbVersion
      };
      this.$api.hbhyjCreate(params).then(res => {
        let body = res.body;
        this.orderId = body.orderId;
        this.payQrCodeUrl = body.payQrCodeUrl;
        this.totalAmount = body.totalAmount;
        // this.trial.repayPerMonth = body.repayPerMonth;
        // this.trial.feeRate = body.feeRate;
        this.zfbRate = body.zfbRate
        this.platRate = body.platRate
        this.capitalAmt = body.capitalAmt
        this.showConfirm = true;
        if (body.payQrCodeUrl) {
          sessionStorage.setItem("hbpayQrCodeUrl", body.payQrCodeUrl);
        }
        this.$router.push({
          path: "/hb-getHBQRCode",
          query: {
            orderId: body.orderId,
            payQrCodeUrl: body.payQrCodeUrl,
            totalAmount: body.totalAmount,
            term: this.query.trim,
            typeId: this.query.typeId || "",
            zfbRate: this.zfbRate,
            platRate: this.platRate,
            capitalAmt:this.capitalAmt
          }
        });
      },err=>{
        if(err.errorCode === 30006007){
          console.log(111)
          this.showDia = true
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
.hbhy-big-box {
  & {
    position: relative;
    background-color: #f5f5f5;
    height: auto;
    padding-bottom: 70px;
  }
  .color-box {
    width: 100%;
    height: 260px;
    background: linear-gradient(
      180deg,
      rgba(85, 78, 128, 1),
      rgba(66, 61, 93, 1)
    );
  }
  .user-information {
    & {
      position: absolute;
      width: 90%;
      //height: 220px;
      background-color: white;
      left: 5%;
      top: 98px;
      border-radius: 6px;
    }
    div {
      height: 50px;
      width: 100%;
      border-bottom: 1px solid #f5f5f5;
    }
    .tit {
      p {
        color: #333333;
        font-size: 16px;
        font-weight: bold;
        line-height: 50px;
        margin-left: 5px;
      }
      p::before {
        width: 3px;
        height: 16px;
        content: "";
        background: rgba(137, 110, 219, 1);
        border-radius: 0px 3px 0px 3px;
        // left: -8px;
        // top: 24px;
        // position: absolute;
        display: inline-block;
        margin-right: 5px;
      }
    }
  }
  .package-information {
    & {
      width: 90%;
      height: 302px;
      background-color: white;
      margin: auto;
      margin-top: 65px;
      border-radius:6px;
    }
    div:not(:last-child) {
      height: 50px;
      width: 100%;
      border-bottom: 1px solid #f5f5f5;
    }
    /deep/ .van-field__control:disabled {
        //color: #333333;
        -webkit-text-fill-color: #333333!important;
        background-color: transparent;
        opacity: 1;
      }
    .tit {
      p {
        color: #333333;
        font-size: 16px;
        font-weight: bold;
        line-height: 50px;
        margin-left: 5px;
      }
      p::before {
        width: 3px;
        height: 16px;
        content: "";
        background: rgba(137, 110, 219, 1);
        border-radius: 0px 3px 0px 3px;
        // left: -8px;
        // top: 24px;
        // position: absolute;
        display: inline-block;
        margin-right: 5px;
      }
    }
  }
}
</style>