Blame view

src/views/parkPay/coupon.vue 7.19 KB
6e9a3492   刘淇   江阴支付
1
  <template>
04d41f2e   刘淇   领取优惠券
2
    <div v-show="loadFlag">
92e91fa6   刘淇   江阴领取优惠券调接口
3
      <img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;">
eae77c58   刘淇   江阴领取优惠券
4
      <div style="padding: 10px 30px 50px">
331018f3   刘淇   江阴领取优惠券调接口
5
        <p>尊敬的车主您好:{{ tipText }}</p>
eae77c58   刘淇   江阴领取优惠券
6
      </div>
6e9a3492   刘淇   江阴支付
7
      <div style="padding: 0 20px">
2a4c08ca   刘淇   确定按钮在等待
8
9
10
        <mt-button size="large" type="primary" @click="toPay" style="margin-bottom: 20px;" v-show="payFlag"
                   :disabled="disabledFlag">
          {{btnText}}
331018f3   刘淇   江阴领取优惠券调接口
11
        </mt-button>
cb548001   刘淇   去缓存
12
        <!--<mt-button size="large" type="danger" @click="toBackPage">返回</mt-button>-->
2a4c08ca   刘淇   确定按钮在等待
13
  
6e9a3492   刘淇   江阴支付
14
15
      </div>
  
eae77c58   刘淇   江阴领取优惠券
16
    </div>
6e9a3492   刘淇   江阴支付
17
18
19
  </template>
  
  <script>
eae77c58   刘淇   江阴领取优惠券
20
21
  
  
331018f3   刘淇   江阴领取优惠券调接口
22
23
24
25
26
  import {
    scanCouponQR,
    queryParkingRecordPageByCarNumbers,
    appApplyParkOut,
    parkingQuery
2a4c08ca   刘淇   确定按钮在等待
27
  } from "@/api/couponPay/couponPay.js";
6e9a3492   刘淇   江阴支付
28
29
  export default {
    name: "coupon",
eae77c58   刘淇   江阴领取优惠券
30
31
    data() {
      return {
2a4c08ca   刘淇   确定按钮在等待
32
33
34
35
36
        imgurl: require("../../assets/images/successIcon.png"),
        successiconUrl: require("../../assets/images/successIcon.png"),
        loseiconUrl: require("../../assets/images/loseIcon.png"),
        carNum: "",
        carNumberColor: "",
331018f3   刘淇   江阴领取优惠券调接口
37
        parkingData: [],
2a4c08ca   刘淇   确定按钮在等待
38
39
40
        carType: "",
        codeType: "",
        tipText: "",
7e244ba4   刘淇   领取优惠券
41
        payFlag: true,
2a4c08ca   刘淇   确定按钮在等待
42
43
44
45
46
47
        couponsType: 1,// 1:按次优惠,2:按时优惠,3:折扣优惠(打折),4:满减优惠'
        cardRuleName: "",
        loadFlag: false,  //
        disabledFlag: false,
        btnText: "去查询停车费用"
      };
6e9a3492   刘淇   江阴支付
48
    },
eae77c58   刘淇   江阴领取优惠券
49
    created() {
2a4c08ca   刘淇   确定按钮在等待
50
51
52
53
      this.carNum = this.$route.query.carNumber;
      this.carType = this.$route.query.carType;
      this.codeType = this.$route.query.codeType;
      this.cardRelParkNo = this.$route.query.cardRelParkNo;
eae77c58   刘淇   江阴领取优惠券
54
55
56
57
58
59
60
61
      // this.carNum = this.$route.query.carNumber  // 获取车牌号
      // this.carNumberColor = this.$route.query.carNumberColor  // 获取颜色   0:蓝牌;1:黄牌;2:白牌;3:黑牌;4:绿色
      // this.currentTabActive = this.$route.query.parkFlag ? this.$route.query.parkFlag : 0
      // console.log(this.currentTabActive)
      // console.log(this.carNumber)
      this.scanCouponQR()
    },
    methods: {
331018f3   刘淇   江阴领取优惠券调接口
62
      scanCouponQR() {
331018f3   刘淇   江阴领取优惠券调接口
63
        let url = process.env.VUE_APP_API;
2a4c08ca   刘淇   确定按钮在等待
64
        console.log(url);
eae77c58   刘淇   江阴领取优惠券
65
66
67
68
69
70
        var salt = this.$utils.myCommonSalt(32);
        var jsondata = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          sign_type: "md5",
2a4c08ca   刘淇   确定按钮在等待
71
          carType: "2",
331018f3   刘淇   江阴领取优惠券调接口
72
73
74
          codeType: this.codeType,
          cardRelParkNo: this.cardRelParkNo,
          key: this.$route.query.key,
6e7e8785   刘淇   江阴领券
75
          encryptTime: this.$route.query.encryptTime,
eae77c58   刘淇   江阴领取优惠券
76
77
78
          carNum: this.carNum,
          // carNumberColor: this.carNumberColor,
          orgId: this.$utils.myOrgId,
2a4c08ca   刘淇   确定按钮在等待
79
          terminalSource: "7"
eae77c58   刘淇   江阴领取优惠券
80
          // token:'e2c1e43722dd43a5b7e268001b39e6f0'
2a4c08ca   刘淇   确定按钮在等待
81
82
83
84
85
        };
        jsondata.sign = this.$utils.signObject(jsondata);
        console.log(jsondata);
        scanCouponQR(url, jsondata).then(response => {
          console.log(response);
331018f3   刘淇   江阴领取优惠券调接口
86
          if (response.code == 0) {
2a4c08ca   刘淇   确定按钮在等待
87
88
89
90
91
92
            this.payFlag = true;
            this.imgurl = this.successiconUrl;
            this.tipText = "领取优惠券成功";
            this.cardRuleName = response.data.cardRuleName;
            this.couponsType = response.data.cardType;
            console.log(this.couponsType);
331018f3   刘淇   江阴领取优惠券调接口
93
          } else {
2a4c08ca   刘淇   确定按钮在等待
94
95
96
            this.payFlag = false;
            this.imgurl = this.loseiconUrl;
            this.tipText = response.message;
92e91fa6   刘淇   江阴领取优惠券调接口
97
          }
04d41f2e   刘淇   领取优惠券
98
          setTimeout(() => {
2a4c08ca   刘淇   确定按钮在等待
99
            this.loadFlag = true;
04d41f2e   刘淇   领取优惠券
100
          }, 300);
331018f3   刘淇   江阴领取优惠券调接口
101
          // this.tipText =
2a4c08ca   刘淇   确定按钮在等待
102
        });
eae77c58   刘淇   江阴领取优惠券
103
104
      },
      toPay() {
90296161   刘淇   领取券 跳转
105
106
107
108
109
        let url = `https://park.jycrtc.com/wxgzh/xp/index.html#/parkRecord?carNumber=${this.carNum}&carNumberColor=${this.$route.query.carNumberColor}`
        window.location.href = url
  
        // window.location = ''
        // this.parkRecordList();
92e91fa6   刘淇   江阴领取优惠券调接口
110
111
112
        // this.$router.push({
        //   path: 'couponPay'
        // })
6e9a3492   刘淇   江阴支付
113
      },
eae77c58   刘淇   江阴领取优惠券
114
      toBackPage() {
2a4c08ca   刘淇   确定按钮在等待
115
        this.$router.back();
92e91fa6   刘淇   江阴领取优惠券调接口
116
117
      },
      parkRecordList() {  // 获取停车记录数据
2a4c08ca   刘淇   确定按钮在等待
118
119
        this.disabledFlag = true
        this.btnText = "查询中,请等待"
331018f3   刘淇   江阴领取优惠券调接口
120
        let url = process.env.VUE_APP_PAYAPI;
92e91fa6   刘淇   江阴领取优惠券调接口
121
122
123
124
125
126
        var salt = this.$utils.myCommonSalt(32);
        var jsondata = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          sign_type: "md5",
2a4c08ca   刘淇   确定按钮在等待
127
128
129
130
          pageNum: "1",
          pageSize: "1000",
          parkState: "10",
          terminalSource: "7",
92e91fa6   刘淇   江阴领取优惠券调接口
131
132
133
          // parkState:'10',
          carNumber: this.carNum,
          // carNumberColor: '1',
2a4c08ca   刘淇   确定按钮在等待
134
135
136
          orgId: this.$utils.myOrgId
        };
        jsondata.sign = this.$utils.signObject(jsondata);
92e91fa6   刘淇   江阴领取优惠券调接口
137
        // jsondata.sign = md5sign
2a4c08ca   刘淇   确定按钮在等待
138
139
140
141
142
        console.log("停车记录传参  " + JSON.stringify(jsondata));
        queryParkingRecordPageByCarNumbers(url, jsondata).then(response => {
          console.log(response);
          this.disabledFlag = false
          this.btnText = "去查询停车费用"
92e91fa6   刘淇   江阴领取优惠券调接口
143
          // this.parkList = response.data.dataList
92e91fa6   刘淇   江阴领取优惠券调接口
144
          this.parkingData = response.data.dataList.filter(item => {
2a4c08ca   刘淇   确定按钮在等待
145
146
147
148
149
            return item.parkState == "10";
          });
          console.log(this.parkingData);
          this.toPayCurrent(this.parkingData);
        });
92e91fa6   刘淇   江阴领取优惠券调接口
150
151
      },
      toPayCurrent(i) { // 缴纳本次在停费用
331018f3   刘淇   江阴领取优惠券调接口
152
        let url = process.env.VUE_APP_PAYAPI;
92e91fa6   刘淇   江阴领取优惠券调接口
153
154
155
156
157
158
159
        var salt = this.$utils.myCommonSalt(32);
        var params = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          sign_type: "md5",
          orderId: i[0].orderId,
2a4c08ca   刘淇   确定按钮在等待
160
161
162
163
164
165
166
          payOrderType: "101",
          terminalSource: "7"
        };
        params.sign = this.$utils.signObject(params);
        appApplyParkOut(url, params).then(response => {
          console.log(response);
          if (response.code == "5005") {
92e91fa6   刘淇   江阴领取优惠券调接口
167
168
169
170
171
172
173
174
175
            var salt = this.$utils.myCommonSalt(32);
            var jsondata = {
              app_id: this.$utils.myVarAppid,
              deviceInfo: this.$utils.myDeviceInfo,
              salt: salt,
              sign_type: "md5",
              payType: this.$utils.clientBrowsePayType(),
              appId: this.$utils.myVxAppId,
              orderId: i[0].orderId,
2a4c08ca   刘淇   确定按钮在等待
176
              terminalSource: "7",
92e91fa6   刘淇   江阴领取优惠券调接口
177
              parkCode: i[0].parkCode,
2a4c08ca   刘淇   确定按钮在等待
178
179
180
181
182
183
184
185
186
              carNumber: this.carNum
            };
            jsondata.sign = this.$utils.signObject(jsondata);
            parkingQuery(url, jsondata).then(result => {
              console.log(result);
              let res = result.data;
              let _dis = res.discountFee;
              let discountFee = _dis.slice(1, _dis.length - 1);
              sessionStorage.setItem("couponPark", JSON.stringify(result.data));
331018f3   刘淇   江阴领取优惠券调接口
187
188
              this.$router.push(
                {
2a4c08ca   刘淇   确定按钮在等待
189
                  path: "couponPay",
331018f3   刘淇   江阴领取优惠券调接口
190
191
192
193
194
195
196
197
198
                  query: {
                    carColor: this.carColor,// 车牌颜色
                    arrearageTotalFee: res.orderTotalFee,// 应收
                    arrearageDiscFee: discountFee * 100,// 优惠
                    arrearageActFee: res.orderFee,// 实收
                    carNumber: this.carNumber, // 车牌
                    paySrcType: 101, //支付的类型   101 是本次   103是历史欠费
                    ordeID: i.orderId, //支付的订单号
                    appOrderTimeout: res.appOrderTimeout, // 超时描述
2a4c08ca   刘淇   确定按钮在等待
199
                    couponsType: this.couponsType
92e91fa6   刘淇   江阴领取优惠券调接口
200
                  }
331018f3   刘淇   江阴领取优惠券调接口
201
                }
2a4c08ca   刘淇   确定按钮在等待
202
203
              );
            });
331018f3   刘淇   江阴领取优惠券调接口
204
205
          } else {
            //$('.dialog-out').show()
2a4c08ca   刘淇   确定按钮在等待
206
            this.$msgbox("提示", "成功领取" + this.cardRuleName + ",离场时自动抵扣");
331018f3   刘淇   江阴领取优惠券调接口
207
          }
2a4c08ca   刘淇   确定按钮在等待
208
209
        });
      }
6e9a3492   刘淇   江阴支付
210
211
212
213
214
215
216
    }
  };
  </script>
  
  <style scoped>
  
  </style>