Blame view

src/views/parkPay/coupon.vue 5.81 KB
6e9a3492   刘淇   江阴支付
1
  <template>
eae77c58   刘淇   江阴领取优惠券
2
    <div>
92e91fa6   刘淇   江阴领取优惠券调接口
3
      <img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;">
eae77c58   刘淇   江阴领取优惠券
4
      <div style="padding: 10px 30px 50px">
92e91fa6   刘淇   江阴领取优惠券调接口
5
        <p>尊敬的车主您好:{{tipText}}</p>
eae77c58   刘淇   江阴领取优惠券
6
      </div>
6e9a3492   刘淇   江阴支付
7
      <div style="padding: 0 20px">
92e91fa6   刘淇   江阴领取优惠券调接口
8
        <mt-button size="large" type="primary" @click="toPay" style="margin-bottom: 20px;" v-show="payFlag">去支付</mt-button>
6e9a3492   刘淇   江阴支付
9
10
11
        <mt-button size="large" type="danger" @click="toBackPage">返回</mt-button>
      </div>
  
eae77c58   刘淇   江阴领取优惠券
12
    </div>
6e9a3492   刘淇   江阴支付
13
14
15
  </template>
  
  <script>
eae77c58   刘淇   江阴领取优惠券
16
17
  
  
92e91fa6   刘淇   江阴领取优惠券调接口
18
  import { scanCouponQR, queryParkingRecordPageByCarNumbers, appApplyParkOut, parkingQuery } from '@/api/couponPay/couponPay.js'
eae77c58   刘淇   江阴领取优惠券
19
  
6e9a3492   刘淇   江阴支付
20
21
  export default {
    name: "coupon",
eae77c58   刘淇   江阴领取优惠券
22
23
    data() {
      return {
92e91fa6   刘淇   江阴领取优惠券调接口
24
        imgurl:'',
eae77c58   刘淇   江阴领取优惠券
25
26
        successiconUrl: require('../../assets/images/successIcon.png'),
        loseiconUrl: require('../../assets/images/loseIcon.png'),
92e91fa6   刘淇   江阴领取优惠券调接口
27
28
29
30
31
32
33
        carNum: '',
        carNumberColor: '',
        parkingData:[],
        carType:'',
        codeType:'',
        tipText:'',
        payFlag:false,
6e9a3492   刘淇   江阴支付
34
35
      }
    },
eae77c58   刘淇   江阴领取优惠券
36
    created() {
92e91fa6   刘淇   江阴领取优惠券调接口
37
38
39
      this.carNum = this.$route.query.carNumber
      this.carType = this.$route.query.carType
      this.codeType = this.$route.query.codeType
eae77c58   刘淇   江阴领取优惠券
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  
      // 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: {
      scanCouponQR(){
        var salt = this.$utils.myCommonSalt(32);
        var jsondata = {
          app_id: this.$utils.myVarAppid,
          deviceInfo: this.$utils.myDeviceInfo,
          salt: salt,
          sign_type: "md5",
92e91fa6   刘淇   江阴领取优惠券调接口
56
57
          carType:this.carType,
          codeType:this.codeType,
eae77c58   刘淇   江阴领取优惠券
58
59
60
61
62
63
64
65
66
          cardRelParkNo:'123qwe',
          key:'1',
          carNum: this.carNum,
          // carNumberColor: this.carNumberColor,
          orgId: this.$utils.myOrgId,
          terminalSource:'7',
          // token:'e2c1e43722dd43a5b7e268001b39e6f0'
        }
        jsondata.sign = this.$utils.signObject(jsondata)
eae77c58   刘淇   江阴领取优惠券
67
68
        scanCouponQR(jsondata).then(response => {
          console.log(response)
92e91fa6   刘淇   江阴领取优惠券调接口
69
70
71
72
73
74
75
76
          this.tipText = response.data.message
          if(response.data.code==0){
            this.payFlag = true
            this.imgurl = this.successiconUrl
          }else{
            this.payFlag = false
            this.imgurl = this.loseiconUrl
          }
eae77c58   刘淇   江阴领取优惠券
77
78
79
        })
      },
      toPay() {
92e91fa6   刘淇   江阴领取优惠券调接口
80
81
82
83
        this.parkRecordList()
        // this.$router.push({
        //   path: 'couponPay'
        // })
6e9a3492   刘淇   江阴支付
84
      },
eae77c58   刘淇   江阴领取优惠券
85
      toBackPage() {
6e9a3492   刘淇   江阴支付
86
        this.$router.back()
92e91fa6   刘淇   江阴领取优惠券调接口
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
      },
      parkRecordList() {  // 获取停车记录数据
        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: '3',
          // parkState:'10',
          carNumber: this.carNum,
          // carNumberColor: '1',
          orgId: this.$utils.myOrgId,
  
        }
        jsondata.sign = this.$utils.signObject(jsondata)
  
        // jsondata.sign = md5sign
        console.log('停车记录传参  ' + JSON.stringify(jsondata));
        queryParkingRecordPageByCarNumbers(jsondata).then(response => {
          console.log(response)
          // this.parkList = response.data.dataList
  
          this.parkingData = response.data.dataList.filter(item => {
            return item.parkState == '10'
          })
          console.log(this.parkingData)
          this.toPayCurrent(this.parkingData)
  
        })
      },
      toPayCurrent(i) { // 缴纳本次在停费用
        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,
          payOrderType: '101',
          terminalSource: '3',
        }
        params.sign = this.$utils.signObject(params)
        appApplyParkOut(params).then(response => {
          console.log(response)
  
          if (response.code == '5005') {
            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,
              terminalSource: '7',
              parkCode: i[0].parkCode,
              carNumber: this.carNum,
            }
            jsondata.sign = this.$utils.signObject(jsondata)
            parkingQuery(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))
                this.$router.push(
                  {
                    path: 'couponPay',
                    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, // 超时描述
                    }
                  }
                )
            })
  
            } else {
              //$('.dialog-out').show()
              this.$msgbox('提示', '停车15分钟内无需缴费,申请成功。')
            }
  
        })
  
      },
6e9a3492   刘淇   江阴支付
182
183
184
185
186
187
188
    }
  };
  </script>
  
  <style scoped>
  
  </style>