Blame view

pages/parkPay/parkPay.vue 8.37 KB
4b045f7c   刘淇   江阴初始化项目
1
  <template>
9d632cab   刘淇   购买卡券接口添加plNo参数
2
      <view>
c0558eba   刘淇   下拉框箭头
3
  
9d632cab   刘淇   购买卡券接口添加plNo参数
4
          <!-- 	<view class="order-time">
3d60bab7   刘淇   下拉框箭头
5
6
7
              剩余支付时间: {{appOrderTimeout}}
          </view> -->
  
9d632cab   刘淇   购买卡券接口添加plNo参数
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
          <view class="order-title">
              订单详情
          </view>
          <view class="order-info">
              车牌号:{{mycarNumber | tranNull}}
          </view>
          <view class="order-line"></view>
          <view class="order-info">
              停车场:{{parkName | tranNull}}
          </view>
          <view class="order-line"></view>
          <view class="order-info">
              进场时间:{{parkInTime | tranNull}}
          </view>
          <view class="order-line"></view>
          <view class="order-info">
              停车时间:{{staytime | timeFormatter}}
          </view>
          <view class="order-line"></view>
          <view class="order-info">
              总计费用:{{due |toFixed2}}元
          </view>
          <view class="order-line"></view>
83c49479   chenbiao   add 7月需求
31
  
9d632cab   刘淇   购买卡券接口添加plNo参数
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
          <view class="flex-row-justify-between">
              <view class="order-info">
                  需支付金额
              </view>
              <view class="flex-row-justify-end">
                  <view class="order-info" style="font-weight:bold;font-size:18px;">
                      {{orderFee | toFixed2}}
                  </view>
                  <view class="order-info" style="margin-right: 50upx;margin-left: 0px;">
  
                  </view>
              </view>
          </view>
          <!-- <view class="uni-list-cell-pd pos-rel">
              <input class="" type="number"
                  style="background-color: #fff;height:40px;line-height: 40px;padding-left: 15px;font-size: 20px;" v-model="rechargeNum"
                  @input="checkNum" :maxlength="maxlength" placeholder="确认支付金额(单位:元)">
              <view class="pos-abs paywarp">
  
              </view>
          </view> -->
          <view class="order-line-bold"></view>
83c49479   chenbiao   add 7月需求
54
  
9d632cab   刘淇   购买卡券接口添加plNo参数
55
56
57
58
          <view class="order-title">
              支付方法
          </view>
          <view class="order-line"></view>
83c49479   chenbiao   add 7月需求
59
  
9d632cab   刘淇   购买卡券接口添加plNo参数
60
61
62
63
64
65
          <view class="orderwaysview">
              <!--<image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image>-->
              <view class="order-info" style="margin-left: 15px;">
                  商户余额
              </view>
              <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image>
83c49479   chenbiao   add 7月需求
66
  
9d632cab   刘淇   购买卡券接口添加plNo参数
67
          </view>
83c49479   chenbiao   add 7月需求
68
  
9d632cab   刘淇   购买卡券接口添加plNo参数
69
70
71
72
          <view class="order-line"></view>
          <button @click="payClick" class="button-sp-area" type="primary" plain="true" :loading="loadingFlag"
                  :disabled="disabledFlag">{{btnText}}
          </button>
83c49479   chenbiao   add 7月需求
73
  
9d632cab   刘淇   购买卡券接口添加plNo参数
74
      </view>
4b045f7c   刘淇   江阴初始化项目
75
76
77
  </template>
  
  <script>
9d632cab   刘淇   购买卡券接口添加plNo参数
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
  export default {
    data() {
      return {
        loadingFlag: false,
        disabledFlag: false,
        btnText:'确认支付',
        businessId: '',
        orderId: '',
        mycarNumber: '',
        parkName: '',
        parkInTime: '',
        staytime: '',
        due: '',
        orderFee: '',
        // appOrderTimeout:'0',
        totalFee: '', //应收
        // rechargeNum: '',
        // maxlength: 6 //默认一个长度
      }
    },
    onLoad(params) {
      wx.showShareMenu({
        withShareTicket: true
      })
      let data = JSON.parse(params.optionData)
      this.mycarNumber = data.carNumber
      this.parkName = data.parkName;
      this.parkInTime = data.parkInTime;
      this.staytime = data.parkDuration;
      this.due = data.totalFee;
      this.orderFee = data.unPayFee;
      // this.rechargeNum = data.unPayFee / 100;
      this.orderId = data.orderId;
    },
    onShow() {
    },
    methods: {
      checkNum(e) {
        let value = e.detail.value;
        let dot = value.indexOf('.'); //包含小数点
        let reg = /^[0-9]+$/; //正整数
        if (dot > -1) {
          this.maxlength = dot + 3; //长度是小数点后两位
          if (value.length > dot + 3) {
          }
        }
        if (reg.test(value)) { //如果是正整数不包含小数点
          this.maxlength = 6;
        }
      },
      payClick() {
        let that = this;
        that.loadingFlag = true
        that.disabledFlag = true
        that.btnText = '支付中,请稍后'
        let orderFee = that.orderFee;
        let paramsData = {
          payType: '35',
          paySrcType: '101',
          orderId: that.orderId,
          payFee: orderFee,
        }
        // 获取 接口
        that.$myRequest({
          url: that.$common.accountPay,
          method: 'POST',
          data: that.$common.requestSign(paramsData)
        }).then(res => {
          console.log(res)
          console.log('1')
83c49479   chenbiao   add 7月需求
148
  
9d632cab   刘淇   购买卡券接口添加plNo参数
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
          that.loadingFlag = false
          that.disabledFlag = false
          if(res.code == '0'){
            that.btnText = '支付完成'
            console.log('余额支付:' + res)
            uni.showToast({
              title: "支付成功",
              icon: 'success',
              duration: 500
            });
            setTimeout(function () {
              let pages = getCurrentPages(); //当前页
              let beforePage = pages[pages.length - 2];
              uni.navigateBack({
                success: function () {
                  beforePage.onLoad();
                }
              })
            }, 1000);
          }else {
            that.btnText = '支付失败,重新支付'
          }
3fe29bf3   chenbiao   add 8月需求
171
  
9d632cab   刘淇   购买卡券接口添加plNo参数
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
        })
      },
      // payClick() {
      // 	let that = this;
      // 	let orderFee = that.orderFee;
      // 	let rechargeNum = that.rechargeNum;
      // 	if (rechargeNum <= 0) {
      // 		return uni.showToast({
      // 			title: '不能输入小于等于0的金额',
      // 			icon: 'error'
      // 		})
      // 	} else if (rechargeNum === " ") {
      // 		return uni.showToast({
      // 			title: '金额不能为空',
      // 			icon: 'error'
      // 		})
      // 	} else if (rechargeNum > orderFee) {
      // 		return uni.showToast({
      // 			title: '金额不能大于需支付金额',
      // 			icon: 'error'
      // 		})
      // 	} else {
      // 		let paramsData = {
      // 			payType: '35',
      // 			paySrcType: '101',
      // 			orderId: that.orderId,
      // 			payFee: (rechargeNum * 100).toString(),
      // 		}
      // 		// 获取 接口
      // 		that.$myRequest({
      // 			url: that.$common.accountPay,
      // 			method: 'POST',
      // 			data: that.$common.requestSign(paramsData)
      // 		}).then(res => {
      // 			console.log('余额支付:' + res)
      // 			uni.showToast({
      // 				title: "支付成功",
      // 				icon: 'success',
      // 				duration: 2000
      // 			});
      // 			setTimeout(function() {
      // 				let pages = getCurrentPages(); //当前页
      // 				let beforePage = pages[pages.length - 2];
      // 				uni.navigateBack({
      // 					success: function() {
      // 						beforePage.onLoad();
      // 					}
      // 				})
      // 			}, 2000);
      // 		})
      // 	}
      // },
    }
  }
4b045f7c   刘淇   江阴初始化项目
226
227
228
  </script>
  
  <style scoped lang="scss">
9d632cab   刘淇   购买卡券接口添加plNo参数
229
230
231
232
233
234
      .order-time {
          padding: 5px 0;
          background: #f0ad4e;
          text-align: center;
          color: #fff;
      }
83c49479   chenbiao   add 7月需求
235
  
9d632cab   刘淇   购买卡券接口添加plNo参数
236
237
238
239
240
241
242
      .order-title {
          font-size: 18px;
          margin-left: 16px;
          margin-top: 15px;
          font-weight: bold;
          color: #404040;
      }
83c49479   chenbiao   add 7月需求
243
  
9d632cab   刘淇   购买卡券接口添加plNo参数
244
245
246
247
248
249
      .order-info {
          font-size: 14px;
          margin-left: 15px;
          margin-top: 12px;
          color: #404040;
      }
83c49479   chenbiao   add 7月需求
250
  
9d632cab   刘淇   购买卡券接口添加plNo参数
251
252
253
254
255
256
257
258
259
260
      .order-line {
          background: #D9D9D9;
          height: 1px;
          margin-top: 12px;
          margin-left: 15px;
          padding: 0px;
          overflow: hidden;
          /* 透明度 */
          opacity: 0.5;
      }
83c49479   chenbiao   add 7月需求
261
  
9d632cab   刘淇   购买卡券接口添加plNo参数
262
263
264
265
266
267
268
      .order-line-bold {
          background: #FAFAFA;
          height: 12px;
          margin-top: 12px;
          padding: 0px;
          overflow: hidden;
      }
83c49479   chenbiao   add 7月需求
269
  
9d632cab   刘淇   购买卡券接口添加plNo参数
270
271
272
273
274
      .flex-row-justify-between {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
      }
83c49479   chenbiao   add 7月需求
275
  
9d632cab   刘淇   购买卡券接口添加plNo参数
276
277
278
279
280
      .flex-row-justify-end {
          display: flex;
          flex-direction: row;
          /* 水平对齐*/
          align-items: baseline;
83c49479   chenbiao   add 7月需求
281
  
9d632cab   刘淇   购买卡券接口添加plNo参数
282
      }
83c49479   chenbiao   add 7月需求
283
  
9d632cab   刘淇   购买卡券接口添加plNo参数
284
285
286
287
288
      .order-discount {
          color: #C8C7CC;
          margin-right: 20 upx;
          /* margin-right: 12px ; */
          /* margin-top:12px ; */
83c49479   chenbiao   add 7月需求
289
  
9d632cab   刘淇   购买卡券接口添加plNo参数
290
      }
83c49479   chenbiao   add 7月需求
291
  
9d632cab   刘淇   购买卡券接口添加plNo参数
292
293
294
295
      .orderwaysview {
          display: flex;
          flex-direction: row;
      }
83c49479   chenbiao   add 7月需求
296
  
9d632cab   刘淇   购买卡券接口添加plNo参数
297
298
299
300
301
302
      .orderways {
          width: 18px;
          height: 18px;
          margin-left: 15px;
          margin-top: 14px;
      }
83c49479   chenbiao   add 7月需求
303
  
9d632cab   刘淇   购买卡券接口添加plNo参数
304
305
306
307
308
309
310
311
      .orderwaysSel {
          width: 16px;
          height: 16px;
          margin-left: auto;
          margin-right: 14px;
          margin-top: 14px;
          /* justify-content:flex-end; */
      }
83c49479   chenbiao   add 7月需求
312
  
9d632cab   刘淇   购买卡券接口添加plNo参数
313
314
315
316
      .button-sp-area {
          margin: 0 auto;
          width: 60%;
          margin-top: 40px;
83c49479   chenbiao   add 7月需求
317
  
9d632cab   刘淇   购买卡券接口添加plNo参数
318
      }
83c49479   chenbiao   add 7月需求
319
  
9d632cab   刘淇   购买卡券接口添加plNo参数
320
321
322
323
324
325
326
      .paywarp {
          top: 12px;
          right: 30px;
          font-size: 20px;
          height: 40px;
          line-height: 40px;
      }
4b045f7c   刘淇   江阴初始化项目
327
  </style>