Blame view

src/components/pay.vue 22.3 KB
9cc3457d   liuqimichale   payType 34
1
2
  <template>
    <div>
9cc3457d   liuqimichale   payType 34
3
  
b89c7412   刘淇   赤峰出场码
4
5
6
7
8
9
      <ul class="tabWrap">
        <li v-for="(i,index) in tabList"
            :key="i.id"
            :class="{tabActive:currentTabActive == index}"
            @click="tabHandle(index)"
        >{{i.text}}
9cc3457d   liuqimichale   payType 34
10
        </li>
b89c7412   刘淇   赤峰出场码
11
      </ul>
9cc3457d   liuqimichale   payType 34
12
  
b89c7412   刘淇   赤峰出场码
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
      <div v-show="currentTabActive==0">
  
        <div v-if="currentNeed">
          <div class="car-wrap">
            <div class="carBG carBlue">
              <p class="carNumber">{{carNumber}}</p>
              <p class="payFee">{{(orderFee/100).toFixed(2)}}元</p>
            </div>
          </div>
  
  
          <ul class="fee-wrap">
            <li>
              <span>停车场</span>
              <span>{{ parkName }}</span>
            </li>
            <li>
              <span>入场时间</span>
              <span>{{ inparktime }}</span>
            </li>
            <li>
              <span>出场时间</span>
              <span>{{ outtime }}</span>
            </li>
  
            <li>
              <span>停车时长</span>
              <span>{{ $utils.dateFormat(staytime) }}</span>
            </li>
  
            <li>
              <span>总金额</span>
              <span>{{(due/100).toFixed(2)}} 元</span>
            </li>
  
            <li>
              <span>优惠金额</span>
              <span>{{(discountFee/100).toFixed(2)}} 元</span>
            </li>
  
  
            <li>
              <span>待缴金额</span>
              <span>{{(orderFee/100).toFixed(2)}} 元</span>
            </li>
  
          </ul>
          <div style="padding: 20px 18px">
            <div class="toPay" @click="toPay(101)">{{clientBrowser}}支付</div>
          </div>
        </div>
9cc3457d   liuqimichale   payType 34
64
  
da4c69a8   刘淇   赤峰出场码
65
        <p v-else  style="padding-top: 30px;text-align: center">
b89c7412   刘淇   赤峰出场码
66
67
          无需缴费
        </p>
9cc3457d   liuqimichale   payType 34
68
  
9cc3457d   liuqimichale   payType 34
69
  
b89c7412   刘淇   赤峰出场码
70
      </div>
9cc3457d   liuqimichale   payType 34
71
  
b89c7412   刘淇   赤峰出场码
72
73
      <div v-show="currentTabActive==1" class="history-con">
        <div v-if="historyList.length>0">
9cc3457d   liuqimichale   payType 34
74
  
da4c69a8   刘淇   赤峰出场码
75
76
          <p style="padding: 10px;color: #ac2525;">温馨提示:只展示车牌号    {{carNumber}}   所有历史欠费信息中的最多30条,核实车牌号是否正确,无误后确认缴费,此缴费不支持退款。</p>
  
b89c7412   刘淇   赤峰出场码
77
78
          <ul class="his-wrap">
            <li v-for="(i, index) in historyList" :key="i.id" class="history-main">
9cc3457d   liuqimichale   payType 34
79
  
da4c69a8   刘淇   赤峰出场码
80
81
82
              <p>
                <span>车场名称:{{i.parkName}}</span>
                <span><b style="color: #0564CC">¥{{(i.unPayFee/100).toFixed(2)}}元</b></span>
9cc3457d   liuqimichale   payType 34
83
  
da4c69a8   刘淇   赤峰出场码
84
              </p>
b89c7412   刘淇   赤峰出场码
85
  
da4c69a8   刘淇   赤峰出场码
86
87
88
89
              <p>
                <span>进场:{{i.parkInTime}}</span>
                <span>出场:{{i.parkOutTime}}</span>
              </p>
b89c7412   刘淇   赤峰出场码
90
91
92
  
            </li>
          </ul>
da4c69a8   刘淇   赤峰出场码
93
94
  
          <div class="toPay payAll" @click="toPayHisrory">近期欠费{{(sumHis/100).toFixed(2)}}元。确认补缴</div>
b89c7412   刘淇   赤峰出场码
95
96
97
  
        </div>
  
da4c69a8   刘淇   赤峰出场码
98
        <p v-else style="padding-top: 30px;text-align: center">
b89c7412   刘淇   赤峰出场码
99
          暂无欠费记录
9cc3457d   liuqimichale   payType 34
100
101
102
103
        </p>
      </div>
  
  
b89c7412   刘淇   赤峰出场码
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
      <!--<div v-if="appOrderTimeout.length>0">-->
      <!--<p class="tip">-->
      <!--温馨提示:-->
      <!--</p>-->
      <!--<p style="color: #666;padding: 0 18px;">-->
      <!--{{appOrderTimeout}}-->
      <!--</p>-->
      <!--</div>-->
  
      <div class="parentBox" v-if="loadingFlag">
        <svg class="scalableBox" viewBox="0 0 128 256" width="128px" height="256px" xmlns="http://www.w3.org/2000/svg">
          <defs>
            <linearGradient id="ap-grad1" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0%" stop-color="hsl(223,90%,55%)"/>
              <stop offset="100%" stop-color="hsl(253,90%,55%)"/>
            </linearGradient>
            <linearGradient id="ap-grad2" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0%" stop-color="hsl(193,90%,55%)"/>
              <stop offset="50%" stop-color="hsl(223,90%,55%)"/>
              <stop offset="100%" stop-color="hsl(253,90%,55%)"/>
            </linearGradient>
          </defs>
          <circle class="apringBox" r="56" cx="64" cy="192" fill="none" stroke="#ddd" stroke-width="16"
                  stroke-linecap="round"/>
          <circle class="apwormOneBox" r="56" cx="64" cy="192" fill="none" stroke="url(#ap-grad1)" stroke-width="16"
                  stroke-linecap="round"
                  stroke-dasharray="87.96 263.89"/>
          <path class="apwormTwoBox" d="M120,192A56,56,0,0,1,8,192C8,161.07,16,8,64,8S120,161.07,120,192Z" fill="none"
                stroke="url(#ap-grad2)"
                stroke-width="16" stroke-linecap="round" stroke-dasharray="87.96 494"/>
        </svg>
      </div>
  
9cc3457d   liuqimichale   payType 34
137
138
139
140
141
    </div>
  </template>
  
  <script>
  
b89c7412   刘淇   赤峰出场码
142
143
  let Base64 = require("js-base64").Base64;
  import { parkRecordList, historyQuery, aliPay, getOpenId, vxPayQuery, bankH5Pay } from "@/api/orderPay/orderPay";
9cc3457d   liuqimichale   payType 34
144
  export default {
b89c7412   刘淇   赤峰出场码
145
    name: "dynCodePay",
9cc3457d   liuqimichale   payType 34
146
147
    data() {
      return {
b89c7412   刘淇   赤峰出场码
148
149
        tabList: [  // 切换数据
          { text: "本次缴费", id: 1 },
da4c69a8   刘淇   赤峰出场码
150
          { text: "历史欠费", id: 2 }
b89c7412   刘淇   赤峰出场码
151
        ],
da4c69a8   刘淇   赤峰出场码
152
        currentTabActive: 0, // 显示当前哪个
9cc3457d   liuqimichale   payType 34
153
        carWrapBG: 0,
b89c7412   刘淇   赤峰出场码
154
155
156
157
158
159
160
161
        carNumber: "",  // 车牌
        parkName: "", // 停车场名称
        inparktime: "", // 入场时间
        outtime: "", // 出场时间
        staytime: "", // 停车时长
        orderFee: "", // 需要支付的费用
        due: "", //  总金额
        discountFee: "", // 优惠金额
9cc3457d   liuqimichale   payType 34
162
163
164
        arrearageActFee: 0,
        arrearageDiscFee: 0,
        arrearageActFee: 0,
b89c7412   刘淇   赤峰出场码
165
        clientBrowser: "", // 客户端
9cc3457d   liuqimichale   payType 34
166
        paySrcType: 101, //支付的类型   101 是本次   103是历史欠费
b89c7412   刘淇   赤峰出场码
167
168
169
        orderId: "",  //支付的订单
        webAppCode: "", // 微信code
        appOrderTimeout: "", // 超时描述
da4c69a8   刘淇   赤峰出场码
170
        loadingFlag: true,
b89c7412   刘淇   赤峰出场码
171
        historyList: [],
da4c69a8   刘淇   赤峰出场码
172
173
174
175
        currentNeed: true,
        orderIds: [],
        sumHis: 0,
        tmpObjCookie:{},
b89c7412   刘淇   赤峰出场码
176
      };
9cc3457d   liuqimichale   payType 34
177
178
    },
    created() {
b89c7412   刘淇   赤峰出场码
179
180
181
182
183
184
      //
      // this.$toast({
      //   message: '加载中...',
      //   position: 'top',
      //   duration: -1 // 设置为-1表示永久显示,直到手动关闭
      // });
9cc3457d   liuqimichale   payType 34
185
      // this.carWrapBG = this.$route.query.carColor //车牌颜色
da4c69a8   刘淇   赤峰出场码
186
187
188
189
      this.tmpObjCookie = JSON.parse(sessionStorage.getItem('tmpObjCookie'))
      console.log(this.tmpObjCookie)
      console.log(this.tmpObjCookie.needPay)
      if (this.tmpObjCookie.needPay) {
b89c7412   刘淇   赤峰出场码
190
  
da4c69a8   刘淇   赤峰出场码
191
192
      }else{
        this.currentNeed = false;
b89c7412   刘淇   赤峰出场码
193
      }
da4c69a8   刘淇   赤峰出场码
194
195
      this.carNumber = this.tmpObjCookie.plateno;
      // this.carNumber = "蒙D3711K";
b89c7412   刘淇   赤峰出场码
196
      this.getRecordList();
da4c69a8   刘淇   赤峰出场码
197
198
199
200
201
202
203
      this.parkName = this.tmpObjCookie.parkName;
      this.inparktime = this.tmpObjCookie.inparktime;
      this.outtime = this.tmpObjCookie.outtime;
      this.staytime = this.tmpObjCookie.staytime;
      this.orderFee = this.tmpObjCookie.orderFee;
      this.due = this.tmpObjCookie.due;
      this.discountFee = this.tmpObjCookie.discountFee;
9cc3457d   liuqimichale   payType 34
204
205
206
      // this.arrearageTotalFee = this.$route.query.arrearageTotalFee // 应收
      // this.arrearageDiscFee = this.$route.query.arrearageDiscFee // 优惠
      // this.arrearageActFee = this.$route.query.arrearageActFee // 实收
b89c7412   刘淇   赤峰出场码
207
      this.clientBrowser = this.$utils.clientBrowser(); //支付方式
9cc3457d   liuqimichale   payType 34
208
      // this.paySrcType = this.$route.query.codeType // 实收
da4c69a8   刘淇   赤峰出场码
209
210
      this.orderId = this.tmpObjCookie.orderId;
      console.log(this.orderId)
9cc3457d   liuqimichale   payType 34
211
212
213
214
      // this.appOrderTimeout = this.$route.query.appOrderTimeout
      if (this.clientBrowser == "微信") {
        this.webAppCode = this.getCode();
      }
9cc3457d   liuqimichale   payType 34
215
216
    },
    methods: {
da4c69a8   刘淇   赤峰出场码
217
218
      toPayHisrory() {
        let me = this;
b89c7412   刘淇   赤峰出场码
219
        let salt = this.$utils.myCommonSalt(32);
da4c69a8   刘淇   赤峰出场码
220
        this.historyList.forEach(function(item) {
b89c7412   刘淇   赤峰出场码
221
          item.checked = true;
da4c69a8   刘淇   赤峰出场码
222
          me.orderIds.push(item.orderId);
b89c7412   刘淇   赤峰出场码
223
        });
da4c69a8   刘淇   赤峰出场码
224
        let list = "[" + this.orderIds + "]";
b89c7412   刘淇   赤峰出场码
225
226
227
228
229
230
231
232
        let jsondata = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          // sign: md5sign,
          sign_type: "md5",
          appId: this.$utils.myVxAppId,
          orderIds: list,
da4c69a8   刘淇   赤峰出场码
233
          terminalSource: "7",
b89c7412   刘淇   赤峰出场码
234
          payType: this.$utils.clientBrowserPayType(),
783fc946   刘淇   房山充电
235
          // orgId: this.historyList[0].orgId
da4c69a8   刘淇   赤峰出场码
236
237
238
        };
        jsondata.sign = this.$utils.signObject(jsondata);
        console.log(jsondata);
b89c7412   刘淇   赤峰出场码
239
        historyQuery(jsondata).then(response => {
da4c69a8   刘淇   赤峰出场码
240
          console.log(response);
b89c7412   刘淇   赤峰出场码
241
          if (response.code == 0) {
da4c69a8   刘淇   赤峰出场码
242
243
            let res = response.data.carArrearages[0];
            console.log(res);
b89c7412   刘淇   赤峰出场码
244
            // this.orderIds = JSON.stringify(this.orderIds)
da4c69a8   刘淇   赤峰出场码
245
246
            console.log(this.orderIds);
            me.toPay(103);
b89c7412   刘淇   赤峰出场码
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
            // this.$router.push(
            //   {
            //     path: 'orderPay',
            //     query: {
            //       carColor: this.carColor,// 车牌颜色
            //       arrearageTotalFee: res.arrearageTotalFee,// 应收
            //       arrearageDiscFee: res.arrearageDiscFee,// 优惠
            //       arrearageActFee: res.arrearageActFee,// 实收
            //       carNumber: this.carNumber, // 车牌
            //       paySrcType: 103, //支付的类型   101 是本次   103是历史欠费
            //       ordeID: this.orderIds, //支付的订单号
            //       appOrderTimeout: '',
            //       myOrgId:this.historyList[0].orgId,
            //       backDeveloperCode: response.data.inChargerCode
            //     }
            //   }
            // )
da4c69a8   刘淇   赤峰出场码
264
265
          } else {
            this.$msgbox("提示", response.message);
b89c7412   刘淇   赤峰出场码
266
          }
da4c69a8   刘淇   赤峰出场码
267
        });
b89c7412   刘淇   赤峰出场码
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
      },
      tabHandle(index) { // tab 切换
        this.currentTabActive = index;
      },
      getRecordList() {
        var salt = this.$utils.myCommonSalt(32);
        var jsondata = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          sign_type: "md5",
          pageNum: 1,
          pageSize: 1000,
          parkState: 10,
          terminalSource: 7,
          carNumber: this.carNumber,
          carNumberColor: this.carColor,
783fc946   刘淇   房山充电
285
          // orgId: this.$utils.myOrgId
b89c7412   刘淇   赤峰出场码
286
287
288
289
290
291
292
        };
        jsondata.sign = this.$utils.signObject(jsondata);
        parkRecordList(jsondata).then(response => {
          console.log(response.data.dataList);
          this.historyList = response.data.dataList.filter(item => {
            return item.parkState == "20";
          });
da4c69a8   刘淇   赤峰出场码
293
294
295
296
297
          this.historyList = this.historyList.slice(0, 30);
          this.sumHis = this.historyList.reduce((pre, cur) => {
            return Number(pre) + Number(cur.unPayFee);
          }, 0);
          console.log(this.sumHis)
b89c7412   刘淇   赤峰出场码
298
          console.log(this.historyList.length);
da4c69a8   刘淇   赤峰出场码
299
  
d40bd40b   刘淇   房山 优先本次费用支付
300
301
302
          // if(this.historyList.length>0){
          //   this.currentTabActive = 1
          // }
da4c69a8   刘淇   赤峰出场码
303
304
          this.loadingFlag = false
  
b89c7412   刘淇   赤峰出场码
305
306
        });
      },
9cc3457d   liuqimichale   payType 34
307
308
309
      getCode() {
        var appID = this.$utils.myVxAppId;
        // alert(appID)
b89c7412   刘淇   赤峰出场码
310
        var code = this.getUrlParam("code");
9cc3457d   liuqimichale   payType 34
311
        var local = window.location.href;
b89c7412   刘淇   赤峰出场码
312
313
        if (code == null || code === "") {
          window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appID + "&redirect_uri=" + encodeURIComponent(local) + "&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
9cc3457d   liuqimichale   payType 34
314
315
316
317
318
        } else {
          return code;
        }
      },
      getUrlParam(name) {
b89c7412   刘淇   赤峰出场码
319
320
321
322
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
9cc3457d   liuqimichale   payType 34
323
      },
b89c7412   刘淇   赤峰出场码
324
325
      toPay(paySrcType) {
        let me = this;
da4c69a8   刘淇   赤峰出场码
326
        let _order = []
b89c7412   刘淇   赤峰出场码
327
  
da4c69a8   刘淇   赤峰出场码
328
329
330
331
332
333
334
335
        console.log(this.orderIds)
        if (paySrcType == 103) {
          console.log('1')
          // this.orderId = JSON.parse(this.orderId)
          this.orderIds.forEach(item => {
            _order.push({
              orderId: item
            })
9cc3457d   liuqimichale   payType 34
336
          })
da4c69a8   刘淇   赤峰出场码
337
338
339
          // this.orderIds = []
          // this.orderIds = _order
          this.orderId = this.orderIds;
b89c7412   刘淇   赤峰出场码
340
341
        }
        if (this.clientBrowser == "支付宝") { // 支付宝支付
9cc3457d   liuqimichale   payType 34
342
343
          var aliParams = {};
          aliParams.orderId = this.orderId;
da4c69a8   刘淇   赤峰出场码
344
          aliParams.carNumber = this.carNumber;
9cc3457d   liuqimichale   payType 34
345
346
          aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5   4微信公众号
          aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
b89c7412   刘淇   赤峰出场码
347
          aliParams.paySrcType = paySrcType;//101停车支付
783fc946   刘淇   房山充电
348
          // aliParams.orgId = this.$utils.myOrgId;
da4c69a8   刘淇   赤峰出场码
349
350
          aliParams.backType = 2;
          aliParams.recordArreaInfos = JSON.stringify( _order);
b89c7412   刘淇   赤峰出场码
351
          console.log(aliParams);
67b6417e   刘淇   房山 扫码
352
          console.log('1')
9cc3457d   liuqimichale   payType 34
353
          aliPay(aliParams).then(response => {
67b6417e   刘淇   房山 扫码
354
            console.log('12')
b89c7412   刘淇   赤峰出场码
355
            console.log(response);
9cc3457d   liuqimichale   payType 34
356
            if (response.code == 0) {//进场
12335653   刘淇   房山临时车牌
357
              localStorage.removeItem('virtualCarPlate');
9cc3457d   liuqimichale   payType 34
358
359
              document.write(response.data);//打开支付表单
            } else {//其他情况如【该卡号场内已存在】
67b6417e   刘淇   房山 扫码
360
              console.log(response);
9cc3457d   liuqimichale   payType 34
361
            }
b89c7412   刘淇   赤峰出场码
362
          });
9cc3457d   liuqimichale   payType 34
363
        }
b89c7412   刘淇   赤峰出场码
364
        if (this.clientBrowser == "立即") { // 农行支付
9cc3457d   liuqimichale   payType 34
365
366
367
368
369
          var bankabcParams = {};
          bankabcParams.orderId = this.orderId;
          bankabcParams.carNumber = this.carNumber;
          bankabcParams.payType = 34;// 1:支付宝 2:微信 3:银联 10:H5   4微信公众号
          bankabcParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
b89c7412   刘淇   赤峰出场码
370
          bankabcParams.paySrcType = paySrcType;//101停车支付
783fc946   刘淇   房山充电
371
          // bankabcParams.orgId = this.$utils.myOrgId;
b89c7412   刘淇   赤峰出场码
372
373
          bankabcParams.backType = 2;
          bankabcParams.PaymentLinkType = 1;
9cc3457d   liuqimichale   payType 34
374
          bankabcParams.recordArreaInfos = JSON.stringify(this.orderId);
b89c7412   刘淇   赤峰出场码
375
          console.log(bankabcParams);
9cc3457d   liuqimichale   payType 34
376
          bankH5Pay(bankabcParams).then(response => {
b89c7412   刘淇   赤峰出场码
377
378
379
380
381
382
383
            console.log(response);
            if (response.code == "0") {
              let res = response.data.PaymentURL;
              let _token = res.split("TOKEN=")[1];
              let OrderNo = response.data.OrderNo;
              localStorage.setItem("OrderNum", OrderNo);
              if (window.navigator.userAgent.indexOf("Bankabc/Portal") > -1) {
9cc3457d   liuqimichale   payType 34
384
                // alert('当前页面在新容器');
b89c7412   刘淇   赤峰出场码
385
386
                AlipayJSBridge.call("startApp", {
                  appId: "30603024", // 固定值
9cc3457d   liuqimichale   payType 34
387
388
389
390
391
392
393
                  param: {
                    type: "3", // 3: 掌银内H5页面,
                    tokenId: _token, //商户传过来的tokenId
                    paySystem: "", //商户传过来的paySystem, 没有则传空字符串
                    payType: "1111", //商户传过来的payType,没有则传'1111'
                    webviewURL: "https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult", //商户传过来的回跳地址
                    remark: "其他参数", //扩展备用
b89c7412   刘淇   赤峰出场码
394
395
396
397
                    showProgress: "NO",
                    backBehavior: "back"
                  }
                }, function(result) {
9cc3457d   liuqimichale   payType 34
398
399
400
401
                });
              } else {
                // alert('当前页面在旧容器');
                // 旧支付方式
b89c7412   刘淇   赤峰出场码
402
                window.location.href = "https://www.abchina.com/luascript/mobilePayLua/" + encodeURI("{\"return\":{\"tokenID\":\"" + _token + "\",\"backURL\":\"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult\",\"payType\":\"\"}}");
9cc3457d   liuqimichale   payType 34
403
404
              }
            } else {
b89c7412   刘淇   赤峰出场码
405
              me.$msgbox("提示", "支付失败");
9cc3457d   liuqimichale   payType 34
406
            }
9cc3457d   liuqimichale   payType 34
407
408
409
410
411
412
413
414
415
            // console.log(_token)
            // let _data = 'method=invokePayFromBrowser&tokenID='+_token
            // let cryData = CryptoJS.encrypt(_data, 'G9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvM3', 'EkpTEA3FbZFGGq8Y')
            //
            // let baseCRY = Base64.encode(cryData)
            // console.log(baseCRY)
            // window.location.href='bankabc:' + encodeURIComponent('{"method":"invokePayFromBrowser","param":'+baseCRY+'}')
            // // 即为加密后的数据。其中paramsEncode是需要加密的数据、
            // // keyStr是加密时使用的key,与服务端一致、hash是偏移量,是一个随机生成的16位字符串。
b89c7412   刘淇   赤峰出场码
416
          });
9cc3457d   liuqimichale   payType 34
417
        }
b89c7412   刘淇   赤峰出场码
418
        if (this.clientBrowser == "微信") { // 微信支付
9cc3457d   liuqimichale   payType 34
419
420
421
422
423
424
425
          //第一步获取openid
          var codeParams = {
            code: this.webAppCode,
            appId: this.$utils.myVxAppId
          };
          getOpenId(codeParams).then(res => {
            if (res.code == 0) {
da4c69a8   刘淇   赤峰出场码
426
              me.vxPay(res.data, _order,paySrcType);
9cc3457d   liuqimichale   payType 34
427
            } else if (res.code == 40163) { //code been used, hints[重复code问题]
b89c7412   刘淇   赤峰出场码
428
              me.$msgbox("提示", "请重新扫码");
9cc3457d   liuqimichale   payType 34
429
430
              console.log(res.message);
            } else {
b89c7412   刘淇   赤峰出场码
431
              me.$msgbox("提示", "请重新扫码");
9cc3457d   liuqimichale   payType 34
432
            }
b89c7412   刘淇   赤峰出场码
433
          });
9cc3457d   liuqimichale   payType 34
434
        }
9cc3457d   liuqimichale   payType 34
435
      },
da4c69a8   刘淇   赤峰出场码
436
      vxPay(openIdData, orderIdData,paySrcType) {
b89c7412   刘淇   赤峰出场码
437
        let vm = this;
9cc3457d   liuqimichale   payType 34
438
        var wxParams = {};
da4c69a8   刘淇   赤峰出场码
439
440
        wxParams.orderId = this.orderId;
        wxParams.backType = 2,
783fc946   刘淇   房山充电
441
        // wxParams.orgId = this.$utils.myOrgId,
9cc3457d   liuqimichale   payType 34
442
443
        wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5   4微信公众号
        wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
da4c69a8   刘淇   赤峰出场码
444
445
446
        wxParams.carNumber = this.carNumber;
        wxParams.paySrcType = paySrcType;//101停车支付
        wxParams.recordArreaInfos = JSON.stringify(orderIdData);
9cc3457d   liuqimichale   payType 34
447
448
449
450
451
452
453
        wxParams.openId = openIdData;
        wxParams.appId = this.$utils.myVxAppId;
        vxPayQuery(wxParams).then(res => {
          if (res.code == 0) { //
            if (res.data) {
              var data = res.data;
              console.log(JSON.stringify(data));
b89c7412   刘淇   赤峰出场码
454
              if (typeof WeixinJSBridge === "undefined") { // 微信浏览器内置对象。参考微信官方文档
9cc3457d   liuqimichale   payType 34
455
                if (document.addEventListener) {
b89c7412   刘淇   赤峰出场码
456
                  document.addEventListener("WeixinJSBridgeReady", vm.onBridgeReady(data), false);
9cc3457d   liuqimichale   payType 34
457
                } else if (document.attachEvent) {
b89c7412   刘淇   赤峰出场码
458
459
                  document.attachEvent("WeixinJSBridgeReady", vm.onBridgeReady(data));
                  document.attachEvent("onWeixinJSBridgeReady", vm.onBridgeReady(data));
9cc3457d   liuqimichale   payType 34
460
461
                }
              } else {
b89c7412   刘淇   赤峰出场码
462
463
                console.log("准备调用微信支付");
                vm.onBridgeReady(data);
9cc3457d   liuqimichale   payType 34
464
465
              }
            } else {
b89c7412   刘淇   赤峰出场码
466
              vm.$msgbox("提示", "没有找到返回值");
9cc3457d   liuqimichale   payType 34
467
468
469
            }
          } else {
            console.log(res.message);
b89c7412   刘淇   赤峰出场码
470
            vm.$msgbox("提示", res.message);
9cc3457d   liuqimichale   payType 34
471
          }
b89c7412   刘淇   赤峰出场码
472
        });
9cc3457d   liuqimichale   payType 34
473
474
      },
      onBridgeReady(params) {
b89c7412   刘淇   赤峰出场码
475
476
        let me = this;
        console.log("调用微信支付WeixinJSBridge");
9cc3457d   liuqimichale   payType 34
477
        WeixinJSBridge.invoke(
b89c7412   刘淇   赤峰出场码
478
          "getBrandWCPayRequest", params,
9cc3457d   liuqimichale   payType 34
479
480
481
482
483
484
485
486
487
          //
          // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的
          //   'appId': data.appId, // 公众号名称,由商户传入
          //   'timeStamp': data.timeStamp, // 时间戳
          //   'nonceStr': data.nonceStr, // 随机串
          //   'package': data.package, // 预支付id
          //   'signType': data.signType, // 微信签名方式
          //   'paySign': data.paySign // 微信签名
          // },
b89c7412   刘淇   赤峰出场码
488
          function(res) {
9cc3457d   liuqimichale   payType 34
489
            // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
b89c7412   刘淇   赤峰出场码
490
491
            if (res.err_msg === "get_brand_wcpay_request:ok") {
              console.log("成功");
12335653   刘淇   房山临时车牌
492
              localStorage.removeItem('virtualCarPlate');
b89c7412   刘淇   赤峰出场码
493
              me.$msgbox("提示", "支付成功");
9cc3457d   liuqimichale   payType 34
494
            } else {
b89c7412   刘淇   赤峰出场码
495
496
              console.log("失败");
              me.$msgbox("提示", "支付失败");
9cc3457d   liuqimichale   payType 34
497
498
499
              me.$router.go(-2);
            }
          }
b89c7412   刘淇   赤峰出场码
500
501
        );
      }
9cc3457d   liuqimichale   payType 34
502
503
    },
    filters: {}
b89c7412   刘淇   赤峰出场码
504
  };
9cc3457d   liuqimichale   payType 34
505
506
507
  </script>
  
  <style scoped lang="scss">
b89c7412   刘淇   赤峰出场码
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
    .tabWrap {
      height: 50px;
      background: #FFF;
      display: flex;
      color: #666;
      font-size: 20px;
      li {
        flex: 1;
        line-height: 50px;
        text-align: center;
        border-bottom: 2px solid #DFDFDF;
      }
      .tabActive {
        color: #0564CC;
        border-bottom: 2px solid #0564CC;
        font-weight: bold;
      }
    }
  
da4c69a8   刘淇   赤峰出场码
527
    .history-con {
b89c7412   刘淇   赤峰出场码
528
529
530
      padding-bottom: 50px;
    }
  
da4c69a8   刘淇   赤峰出场码
531
    .history-main {
b89c7412   刘淇   赤峰出场码
532
      padding: 10px;
da4c69a8   刘淇   赤峰出场码
533
534
      border-top: 1px solid #e8e2e2;
      > p {
b89c7412   刘淇   赤峰出场码
535
        display: flex;
da4c69a8   刘淇   赤峰出场码
536
        justify-content: space-between
b89c7412   刘淇   赤峰出场码
537
538
539
      }
    }
  
9cc3457d   liuqimichale   payType 34
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
    .car-wrap {
      padding: 7px 7px;
      background: #FFF;
    }
  
    .carBG {
      width: 100%;
      height: 130px;
    }
  
    .carBlue {
      background: url("../assets/images/blueBG.png") no-repeat;
      background-size: 100% 100%;
    }
  
    .carYellow {
      background: url("../assets/images/yellowBG.png") no-repeat;
      background-size: 100% 100%;
    }
  
    .carGreen {
      background: url("../assets/images/greenBG.png") no-repeat;
      background-size: 100% 100%;
    }
  
    .carWhite {
      background: url("../assets/images/whiteBG.png") no-repeat;
      background-size: 100% 100%;
    }
  
    .carBlack {
      background: url("../assets/images/blackBG.png") no-repeat;
      background-size: 100% 100%;
    }
  
    .carNumber {
      padding: 20px 0 10px;
      font-size: 30px;
      text-align: center;
b67c269c   liuqimichale   入场码
579
      color: #fff;
9cc3457d   liuqimichale   payType 34
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
    }
  
    .payFee {
      font-size: 24px;
      color: #FF7B7B;
      text-align: center;
    }
  
    .fee-wrap {
      background: #FFF;
      padding: 0 18px;
      > li {
        display: flex;
        justify-content: space-between;
        height: 30px;
        line-height: 30px;
        border-bottom: 1px solid #EAEAEA;
        &:last-child {
          border-bottom: 0;
        }
      }
  
    }
  
    .toPay {
      width: 100%;
      height: 44px;
      margin: 0 auto;
      line-height: 44px;
      text-align: center;
      background: linear-gradient(180deg, #3885D9 0%, #4194EF 100%);
      border-radius: 4px;
      border: 1px solid #0D72E2;
      font-size: 20px;
      color: #FFF;
      cursor: pointer;
    }
da4c69a8   刘淇   赤峰出场码
617
618
  
    .payAll {
b89c7412   刘淇   赤峰出场码
619
620
621
622
      position: fixed;
      bottom: 0;
      left: 0;
    }
9cc3457d   liuqimichale   payType 34
623
624
625
626
627
628
629
  
    .tip {
      padding-left: 40px;
      background: url("../assets/images/tip.png") no-repeat 18px center;
      background-size: 16px 16px;
      color: #666;
    }
b89c7412   刘淇   赤峰出场码
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
  
    .parentBox {
      height: 100%;
      width: 100%;
      position: fixed;
      top: 0;
      left: 0;
      background: rgb(31, 31, 31);
      padding: 100px;
      text-align: center;
      .scalableBox {
        width: 40px;
        height: 70px;
      }
      .apringBox {
        transition: stroke 0.3s;
      }
  
      .apwormOneBox,
      .apwormTwoBox {
        animation-duration: 3s;
        animation-iteration-count: infinite;
      }
      .apwormTwoBox {
        animation-name: worm2;
        visibility: hidden;
      }
      .apwormOneBox {
        animation-name: worm1;
      }
    }
  
    @media (prefers-color-scheme: dark) {
      :root {
        --bg: hsl(var(--hue), 10%, 10%);
        --fg: hsl(var(--hue), 10%, 90%);
      }
  
      .apringBox {
        stroke: hsla(var(--hue), 10%, 90%, 0.9);
      }
    }
  
    @keyframes worm1 {
      from {
        animation-timing-function: ease-in-out;
        stroke-dashoffset: -87.96;
      }
  
      20% {
        animation-timing-function: ease-in;
        stroke-dashoffset: 0;
      }
  
      60% {
        stroke-dashoffset: -791.68;
        visibility: visible;
      }
  
      60.1%,
      to {
        stroke-dashoffset: -791.68;
        visibility: hidden;
      }
    }
  
    @keyframes worm2 {
      from,
      60% {
        stroke-dashoffset: -87.96;
        visibility: hidden;
      }
  
      60.1% {
        animation-timing-function: cubic-bezier(0, 0, 0.5, 0.75);
        stroke-dashoffset: -87.96;
        visibility: visible;
      }
  
      77% {
        animation-timing-function: cubic-bezier(0.5, 0.25, 0.5, 0.88);
        stroke-dashoffset: -340;
        visibility: visible;
      }
  
      to {
        stroke-dashoffset: -669.92;
        visibility: visible;
      }
    }
9cc3457d   liuqimichale   payType 34
720
  </style>