parkingFeeForm.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <template>
  2. <scroll-view scroll-y="true" class="scroll-Y">
  3. <wx-points-commit ref='wxPointsCommit'></wx-points-commit>
  4. <view class="wrap">
  5. <view class="form">
  6. <view class="form-item">
  7. <text class="label">车牌</text>
  8. <text>{{parkOrderEntity.carno}}</text>
  9. </view>
  10. <view class="form-item">
  11. <text class="label">入场时间</text>
  12. <text>{{parkOrderEntity.entertime}}</text>
  13. </view>
  14. <view class="form-item">
  15. <text class="label">停车时长</text>
  16. <text>{{parkOrderEntity.servicehour}}小时</text>
  17. </view>
  18. <view class="form-item">
  19. <text class="label"></text>
  20. <text>订单金额:¥{{parkOrderEntity.servicefee}}</text>
  21. </view>
  22. </view>
  23. <view class="form">
  24. <view class="form-item" @click="openPark" v-if="parkInfoEntity.isuseticket == 1">
  25. <text class="label">停车券</text>
  26. <view>
  27. <text>{{parkingCouponName}}</text>
  28. <uni-icons type="arrowright" size="20" class="arrowright"></uni-icons>
  29. </view>
  30. </view>
  31. <view class="form-item" v-if="couponfee">
  32. <text class="label">停车券抵扣</text>
  33. <text style="color: #ed1c24;">¥{{couponfee}}元</text>
  34. </view>
  35. <view class="form-item" @click="openIntegral" v-if="parkInfoEntity.isuseintegral == 1">
  36. <text class="label">积分抵扣</text>
  37. <view>
  38. <text>{{integralName}}</text>
  39. <uni-icons type="arrowright" size="20" class="arrowright"></uni-icons>
  40. </view>
  41. </view>
  42. <view class="form-item" v-if="bonusfee">
  43. <text class="label">积分抵扣</text>
  44. <text style="color: #ed1c24;">¥{{bonusfee}}元</text>
  45. </view>
  46. </view>
  47. <!-- 福州 -->
  48. <view class="tip" v-if="mallid === '000586'">注:每次支付最多抵扣{{parkInfoEntity.maxonetimediscount}}元</text></view>
  49. <!-- 天津 -->
  50. <view class="tip" v-if="mallid === '000719'">注:每次支付最多抵扣{{parkInfoEntity.maxonetimediscount}}元</text></view>
  51. <!-- 慈溪 -->
  52. <view class="tip" v-if="mallid === '00000914'">注:周一每次支付最多抵扣50元,周二至周日每次支付最多抵扣6元</text></view>
  53. <view class="tip" v-if="mallid !== '000586' && mallid !== '000719' && mallid !== '00000914'">注:卡券和积分每天累计最多抵扣<text>{{parkInfoEntity.maxonedaydiscount}}元</text>,<text>每次支付最多抵扣{{parkInfoEntity.maxonetimediscount}}元,今日已抵扣{{todayDiscountMoney}}元</text>
  54. </view>
  55. </view>
  56. <!-- 底部导航 -->
  57. <view class="submit_bar">
  58. <view class="submit_text">
  59. <view class="text_top">
  60. <text>实付款:</text>
  61. <text class="price">¥ {{total}}</text>
  62. </view>
  63. <view class="text_bottom" v-if="parkingCouponName !== '' || integralName !== ''">
  64. <text v-if="parkingCouponName && !integralName">已选择:{{parkingCouponName}}</text>
  65. <text v-if="integralName && !parkingCouponName">已选择:{{integralName}}</text>
  66. <text v-if="parkingCouponName && integralName">已选择:{{parkingCouponName+'/'+integralName}}</text>
  67. </view>
  68. </view>
  69. <uni-button class="mini-btn" type="warn" size="mini" @click="onSubmit">立即支付</uni-button>
  70. </view>
  71. <!-- 停车券弹窗 -->
  72. <view class="parking_pop popup">
  73. <uni-popup ref="parkingCoupon_popup" type="bottom" class="uni-popup" style="z-index: 1000">
  74. <view class="popup_wrap parkingCoupon_wrap">
  75. <div class="popup_title">
  76. <text>选择停车券</text>
  77. <uni-icons type="clear" size="30" color="#d4d4d4" class="clear" @click="closePark"></uni-icons>
  78. </div>
  79. <view class="popup_content">
  80. <scroll-view scroll-y="true" style="height: 500rpx;" class="scroll">
  81. <view class="radio-group">
  82. <view class="uni-list-cell uni-list-cell-pd" @click="parkChange(index, item)"
  83. v-for="(item, index) in memberTicketList" :key="index">
  84. <view style="color: #999; font-size: 28rpx;">{{item.ticketName}}</view>
  85. <image v-if="item.checked" :src="localimgPic + 'car-checked.png'" mode="widthFix" />
  86. <image v-else :src="localimgPic + 'pay-unchecked.png'" mode="widthFix" />
  87. </view>
  88. </view>
  89. </scroll-view>
  90. <view class="popup_button">
  91. <text class="cancel_btn" @click="closePark">取消</text>
  92. <text class="ok_btn" @click="doParkOK">确定</text>
  93. </view>
  94. </view>
  95. <!-- <view v-html="formText">{{formText}}</view> -->
  96. </view>
  97. </uni-popup>
  98. </view>
  99. <!-- 积分抵扣弹窗 -->
  100. <view class="integral_pop popup">
  101. <uni-popup ref="integral_popup" type="bottom" class="uni-popup" style="z-index: 1000">
  102. <view class="popup_wrap integral_wrap">
  103. <div class="popup_title">
  104. <view style="display: flex;align-items: center;justify-content: space-between;flex: 1;">
  105. <text>选择积分抵扣</text>
  106. <text style="color: #ed1c24;">我的积分:{{exintegral || 0}}</text>
  107. </view>
  108. <uni-icons type="clear" size="30" color="#d4d4d4" class="clear" @click="closeIntegral">
  109. </uni-icons>
  110. </div>
  111. <view class="popup_content">
  112. <scroll-view scroll-y="true" style="height: 500rpx;" class="scroll">
  113. <radio-group class="radio-group" @change="integralChange">
  114. <label class="uni-list-cell uni-list-cell-pd"
  115. v-for="(item, index) in parkIntegraltomoneyList" :key="index">
  116. <view style="color: #999; font-size: 28rpx;">{{item.name}}</view>
  117. <view>
  118. <radio :value="item.value" color="#ed1c24" />
  119. </view>
  120. </label>
  121. </radio-group>
  122. </scroll-view>
  123. <view class="popup_button">
  124. <text class="cancel_btn" @click="closeIntegral">取消</text>
  125. <text class="ok_btn" @click="doIntegralOK">确定</text>
  126. </view>
  127. </view>
  128. </view>
  129. </uni-popup>
  130. </view>
  131. </scroll-view>
  132. </template>
  133. <script>
  134. import uniPop from '@/components/uni-popup/uni-popup.vue'
  135. const app = getApp()
  136. export default {
  137. components: {
  138. uniPop
  139. },
  140. data() {
  141. return {
  142. parkOrderEntity: {}, // 停车信息
  143. parkInfoEntity: {},
  144. price: 0,
  145. parkingCouponVal: '',
  146. parkingCouponName: '',
  147. integralVal: '',
  148. integralName: '',
  149. carno: '', // 车牌号
  150. todayDiscountMoney: 0, // 今日抵扣金额
  151. memberTicketList: [{
  152. ticketValue: 0,
  153. ticketName: '不使用'
  154. }], //会员停车券
  155. parkIntegraltomoneyList: [{
  156. integral: 0,
  157. name: '不使用',
  158. value: 0
  159. }], //积分抵现
  160. bonus: '', // 积分
  161. bonusfee: 0, // 积分抵钱
  162. couponcode: '', // 停车券
  163. couponfee: 0, // 停车抵钱
  164. payfee: '', // 微信钱
  165. ind: '', // 停车券索引
  166. total: 0, // 实付款
  167. localimgPic: '',
  168. formText: '',
  169. mallid: '',
  170. exintegral: '' // 我的积分
  171. }
  172. },
  173. // 分享好友
  174. onShareAppMessage: function(res) {
  175. return {
  176. title: '停车缴费', // 分享标题
  177. // desc: this.params.shareDescribe, // 分享描述
  178. imageUrl: '', // 分享图标
  179. path: `/pages/parkingFee/parkingFeeForm?carno=${this.carno}&mallid=${app.globalData.mallid}`
  180. }
  181. },
  182. // 分享朋友圈
  183. onShareTimeline: function(res) {
  184. return {
  185. title: '停车缴费', // 分享标题
  186. // desc: this.params.shareDescribe, // 分享描述
  187. imageUrl: '', // 分享图标
  188. path: `/pages/parkingFee/parkingFeeForm?carno=${this.carno}&mallid=${app.globalData.mallid}`
  189. }
  190. },
  191. onLoad(option) {
  192. this.localimgPic = this.$staticPicUrl + '/wxminilocalimg/parkingFee/'
  193. this.carno = option.carno
  194. this.mallid = app.globalData.mallid
  195. // #ifdef H5
  196. app.globalData.member = JSON.parse(uni.getStorageSync('member'))
  197. app.globalData.userInfo = JSON.parse(uni.getStorageSync('userinfo'))
  198. app.globalData.openId = app.globalData.userInfo.openid
  199. this.getTicket()
  200. // #endif
  201. // 场景二维码记录(是否扫码进入)
  202. app.globalData.paramsScene = {}
  203. this.$saveSceneQrcodeDetail('page', 'parkingFeeForm', '停车缴费', '', '', '', '')
  204. this.createParkOrder()
  205. this.getVoterBonus()
  206. },
  207. methods: {
  208. // h5获取配置---公众号支付
  209. getTicket: function() {
  210. let self = this
  211. var datas = {
  212. groupId: app.globalData.groupId,
  213. mallid: app.globalData.mallid,
  214. url: window.location.href.split("#")[0]
  215. }
  216. self.$md(datas)
  217. uni.request({
  218. url: self.$baseURL + "api/1.0/login/getTicket",
  219. method: 'POST',
  220. data: datas,
  221. header: JSON.parse(uni.getStorageSync('handleUser')),
  222. success: (res) => {
  223. if (res.data.code == 0) {
  224. self.$wx.config({
  225. debug: false, // 开启调试模式
  226. appId: res.data.data.appId, // 必填,公众号的唯一标识
  227. timestamp: res.data.data.timestamp, // 必填,生成签名的时间戳
  228. nonceStr: res.data.data.nonceStr, // 必填,生成签名的随机串
  229. signature: res.data.data.signature, // 必填,签名
  230. jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表
  231. });
  232. self.$wx.ready(function() {
  233. self.$wx.checkJsApi({
  234. jsApiList: ['chooseWXPay'],
  235. success: res => {
  236. console.log('checked api:', res)
  237. },
  238. fail: err => {
  239. console.log('check api fail:', err)
  240. }
  241. })
  242. });
  243. self.$wx.error(function(res) {
  244. console.log('err', res)
  245. });
  246. } else {
  247. uni.showToast({
  248. title: res.data.msg,
  249. duration: 2000,
  250. icon: 'none'
  251. })
  252. }
  253. }
  254. });
  255. },
  256. // 获取积分
  257. getVoterBonus: function() {
  258. var params = {
  259. groupId: app.globalData.groupId,
  260. mallid: app.globalData.mallid,
  261. mobile: app.globalData.member.mobile
  262. }
  263. this.$md(params)
  264. this.$request({
  265. method: "POST",
  266. url: this.$baseURL + "api/1.0/member/getMemberInfo",
  267. header: JSON.parse(uni.getStorageSync('handleUser')),
  268. data: params,
  269. }).then((r) => {
  270. if (r.data.code == 0) {
  271. var result = r.data.data;
  272. this.exintegral = result.currnentintegral + '';
  273. } else {
  274. uni.showToast({
  275. title: r.data.msg,
  276. duration: 2000,
  277. icon: 'none'
  278. })
  279. }
  280. }).catch(err => {
  281. console.log(err)
  282. });
  283. },
  284. // 创建订单
  285. createParkOrder: function() {
  286. this.parkIntegraltomoneyList = []
  287. this.memberTicketList = []
  288. uni.showLoading({
  289. title: '加载中'
  290. });
  291. let params = {
  292. mallid: app.globalData.mallid,
  293. vipcode: app.globalData.member.vipcode,
  294. groupId: app.globalData.groupId,
  295. carno: this.carno,
  296. openId: app.globalData.openId
  297. }
  298. this.$md(params)
  299. this.$request({
  300. url: this.$baseURL + 'api/1.0/park/createParkOrder',
  301. data: params,
  302. method: 'POST',
  303. header: JSON.parse(uni.getStorageSync('handleUser')),
  304. }).then((res) => {
  305. uni.hideLoading();
  306. if (res.data.code === 0) {
  307. const data = res.data.data
  308. this.parkOrderEntity = data.parkOrderEntity
  309. this.parkInfoEntity = data.parkInfoEntity
  310. if (data.parkIntegraltomoneyList) {
  311. this.parkIntegraltomoneyList.push(...data.parkIntegraltomoneyList)
  312. }
  313. console.log('积分', this.parkIntegraltomoneyList)
  314. if (data.memberTicketList) {
  315. this.memberTicketList.push(...data.memberTicketList)
  316. this.memberTicketList.map(t => {
  317. t.checked = false
  318. })
  319. }
  320. this.parkOrderEntity.servicefee = this.parkOrderEntity.servicefee / 100
  321. this.total = this.parkOrderEntity.servicefee
  322. this.bonus = 0
  323. this.payfee = 0
  324. this.couponfee = 0
  325. this.bonusfee = 0
  326. this.ind = 0
  327. setTimeout(() => {
  328. this.createParkOrder()
  329. }, 180000)
  330. } else {
  331. uni.showToast({
  332. title: res.data.msg,
  333. duration: 2000,
  334. icon: 'none'
  335. })
  336. }
  337. }).catch(err => {
  338. console.log(err)
  339. });
  340. },
  341. // 打开停车券
  342. openPark: function() {
  343. this.$refs['parkingCoupon_popup'].open()
  344. },
  345. // 关闭停车券
  346. closePark: function() {
  347. this.$refs['parkingCoupon_popup'].close()
  348. },
  349. // 停车券选择
  350. parkChange: function(index, item) {
  351. item.checked = !item.checked
  352. if (index === 0 && item.checked) {
  353. this.memberTicketList.map(t => {
  354. t.checked = false
  355. })
  356. this.memberTicketList[index].checked = true
  357. } else {
  358. this.memberTicketList[0].checked = false
  359. }
  360. this.ind = index
  361. this.$forceUpdate()
  362. },
  363. // 确定停车券
  364. doParkOK: function() {
  365. const filter_data = this.memberTicketList.filter(t => t.checked == true && t.ticketValue !== 0)
  366. if (this.todayDiscountMoney == this.parkInfoEntity.maxonedaydiscount) {
  367. uni.showToast({
  368. title: '今日抵扣金额上限',
  369. icon: 'none'
  370. })
  371. } else {
  372. let couponcode = ''
  373. let couponfee = 0
  374. if (filter_data.length === 0) { //不使用
  375. this.couponfee = 0
  376. this.couponcode = ''
  377. let price = Math.round(this.bonusfee * 100 + this.couponfee * 100) / 100
  378. this.total = Math.round((this.parkOrderEntity.servicefee - price) * 100) / 100
  379. // console.log('停车券积分', this.couponcode)
  380. // console.log('不使用停车券抵扣', this.couponfee)
  381. // console.log('不使用停车券-价钱', this.total)
  382. this.closePark()
  383. } else { // 使用
  384. filter_data.map(t => {
  385. couponcode += t.couponCode + '#'
  386. couponfee += t.ticketValue
  387. })
  388. this.couponfee = couponfee
  389. this.couponcode = couponcode
  390. let price = this.bonusfee + this.couponfee
  391. if (price > this.parkInfoEntity.maxonetimediscount) {
  392. uni.showToast({
  393. title: '每次最多抵扣'+this.parkInfoEntity.maxonetimediscount+'元',
  394. icon: 'none'
  395. })
  396. // 对选中不满足条件的进行删除
  397. this.memberTicketList[this.ind].checked = false
  398. this.couponfee = Math.round(this.couponfee - this.memberTicketList[this.ind].ticketValue)
  399. let couponcodeSplit = this.couponcode.split('#')
  400. couponcodeSplit.map((t, i) => {
  401. if (t.couponcode === this.memberTicketList[this.ind].couponcode) {
  402. couponcodeSplit.splice(i, 1)
  403. }
  404. })
  405. this.couponcode = couponcodeSplit.join("#")
  406. // console.log(this.couponcode)
  407. // console.log(this.couponfee)
  408. } else {
  409. this.price = price
  410. // 抵扣金额超出订单金额,实付款为0
  411. if (this.price > this.parkOrderEntity.servicefee) {
  412. this.total = 0
  413. } else {
  414. this.total = Math.round((this.parkOrderEntity.servicefee - price) * 100) / 100
  415. }
  416. // console.log('停车券积分', this.couponcode)
  417. // console.log('停车券抵扣', this.couponfee)
  418. // console.log('价钱', this.total)
  419. this.closePark()
  420. }
  421. }
  422. }
  423. },
  424. // 打开抵扣积分
  425. openIntegral: function() {
  426. this.$refs['integral_popup'].open()
  427. },
  428. // 关闭抵扣积分
  429. closeIntegral: function() {
  430. this.$refs['integral_popup'].close()
  431. },
  432. // 抵扣积分选择
  433. integralChange: function(e) {
  434. let val = e.detail.value
  435. this.bonusfee = Number(val)
  436. this.parkIntegraltomoneyList.map(t => {
  437. if (t.value == val) {
  438. this.bonus = t.integral
  439. }
  440. })
  441. },
  442. // 确定抵扣积分
  443. doIntegralOK: function() {
  444. let price = Math.round(this.bonusfee * 100 + this.couponfee * 100) / 100
  445. if (this.todayDiscountMoney == this.parkInfoEntity.maxonedaydiscount) {
  446. uni.showToast({
  447. title: '今日抵扣金额上限',
  448. icon: 'none'
  449. })
  450. } else {
  451. if (price > this.parkInfoEntity.maxonetimediscount) {
  452. uni.showToast({
  453. title: '每次最多抵扣'+this.parkInfoEntity.maxonetimediscount+'元',
  454. icon: 'none'
  455. })
  456. } else {
  457. this.price = price
  458. // 抵扣金额超出订单金额,实付款为0
  459. if (this.price > this.parkOrderEntity.servicefee) {
  460. this.total = 0
  461. } else {
  462. this.total = Math.round(this.parkOrderEntity.servicefee * 100 - price * 100) / 100
  463. }
  464. console.log('积分抵扣', this.bonusfee)
  465. console.log('价钱', this.total)
  466. this.closeIntegral()
  467. }
  468. }
  469. },
  470. // 支付
  471. onSubmit: function() {
  472. uni.showLoading({
  473. title: '加载中'
  474. });
  475. let params = {
  476. mallid: app.globalData.mallid,
  477. groupId: app.globalData.groupId,
  478. orderno: this.parkOrderEntity.orderno,
  479. // #ifdef MP-WEIXIN
  480. createuser: 'sys_miniprogram'
  481. // #endif
  482. // #ifdef H5
  483. createuser: 'sys_gzh'
  484. // #endif
  485. }
  486. let url = ''
  487. // 是否微信支付
  488. if (this.total !== 0) {
  489. params.payfee = this.total * 100
  490. url = 'api/1.0/park/weixinPay'
  491. // 广福路
  492. if (app.globalData.groupId === '1329609284362932225' && app.globalData.mallid === '000002') {
  493. url = 'interfaceController/park/icbcPay'
  494. }
  495. } else {
  496. url = 'api/1.0/park/notWeixinPay'
  497. }
  498. // 是否积分抵扣
  499. if (this.bonus) {
  500. params.bonus = this.bonus
  501. params.bonusfee = this.bonusfee * 100
  502. }
  503. // 是否停车券抵扣
  504. if (this.couponcode) {
  505. params.couponcode = this.couponcode
  506. params.couponfee = this.couponfee * 100
  507. }
  508. // 积分+卡券+微信
  509. if (this.bonus && this.couponcode && this.total !== 0) {
  510. params.paytype = 7
  511. }
  512. // 卡券+微信
  513. if (!this.bonus && this.couponcode && this.total !== 0) {
  514. params.paytype = 6
  515. }
  516. // 积分+微信
  517. if (this.bonus && !this.couponcode && this.total !== 0) {
  518. params.paytype = 5
  519. }
  520. // 积分+卡券
  521. if (this.bonus && this.couponcode && this.total == 0) {
  522. params.paytype = 4
  523. }
  524. // 微信
  525. if (!this.bonus && !this.couponcode && this.total !== 0) {
  526. params.paytype = 3
  527. }
  528. // 卡券
  529. if (!this.bonus && this.couponcode && this.total == 0) {
  530. params.paytype = 2
  531. }
  532. // 积分
  533. if (this.bonus && !this.couponcode && this.total == 0) {
  534. params.paytype = 1
  535. }
  536. console.log('支付', params)
  537. this.$md(params)
  538. const that = this
  539. this.$request({
  540. url: that.$baseURL + url,
  541. data: params,
  542. method: 'POST',
  543. header: JSON.parse(uni.getStorageSync('handleUser')),
  544. }).then((res) => {
  545. uni.hideLoading();
  546. if (res.data.code === 0) {
  547. // 需要微信支付传参
  548. if (that.total !== 0) {
  549. // #ifdef MP-WEIXIN
  550. var prepayJson = JSON.parse(res.data.data);
  551. uni.requestPayment({
  552. provider: 'wxpay',
  553. timeStamp: prepayJson.timeStamp,
  554. nonceStr: prepayJson.nonceStr,
  555. package: prepayJson.package1,
  556. signType: prepayJson.signType,
  557. paySign: prepayJson.paySign,
  558. success: function(res) {
  559. console.log(that.parkOrderEntity.orderno)
  560. uni.navigateTo({
  561. url: './parkingFeeDetail?orderno=' + that
  562. .parkOrderEntity.orderno
  563. })
  564. },
  565. fail: function(err) {
  566. uni.showToast({
  567. title: '支付已取消!',
  568. icon: 'none',
  569. duration: 2000
  570. })
  571. }
  572. });
  573. // #endif
  574. // #ifdef H5
  575. if (app.globalData.groupId === '1329609284362932225' && app.globalData
  576. .mallid === '000002') {
  577. that.formText = res.data.data
  578. that.$nextTick(() => {
  579. document.querySelector('body').innerHTML = that.formText;
  580. document.forms[0].submit()
  581. // document.forms['alipaysubmit'].submit()
  582. // console.log('idauto_submit_form', document.forms['alipaysubmit'])
  583. // document.getElementByName('idauto_submit_form').submit()
  584. })
  585. } else {
  586. var prepayJson = JSON.parse(res.data.data);
  587. that.$wx.chooseWXPay({
  588. timestamp: result.prepayId.timeStamp, // 支付签名时间戳
  589. nonceStr: result.prepayId.nonceStr, // 支付签名随机串,不长于 32 位
  590. package: result.prepayId
  591. .package1, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
  592. signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  593. paySign: result.prepayId.paySign, // 支付签名
  594. success(res) {
  595. // 支付成功后的回调函数
  596. console.log(that.parkOrderEntity.orderno)
  597. uni.navigateTo({
  598. url: './parkingFeeDetail?orderno=' + that
  599. .parkOrderEntity.orderno
  600. })
  601. // cb(res);
  602. },
  603. fail(err) {
  604. uni.showToast({
  605. title: '支付已取消!',
  606. icon: 'none',
  607. duration: 2000
  608. })
  609. }
  610. });
  611. }
  612. // #endif
  613. } else {
  614. uni.navigateTo({
  615. url: './parkingFeeDetail?orderno=' + that.parkOrderEntity
  616. .orderno
  617. })
  618. }
  619. } else {
  620. uni.showToast({
  621. title: res.data.msg,
  622. duration: 2000,
  623. icon: 'none'
  624. })
  625. }
  626. }).catch(err => {
  627. console.log(err)
  628. });
  629. }
  630. }
  631. }
  632. </script>
  633. <style lang="less" scoped>
  634. .scroll-Y {
  635. width: 100%;
  636. display: flex;
  637. flex-direction: column;
  638. height: 100vh;
  639. background: #f2f2f2;
  640. }
  641. .wrap {
  642. display: flex;
  643. flex-direction: column;
  644. width: 100%;
  645. .form {
  646. margin-top: 10rpx;
  647. display: flex;
  648. flex-direction: column;
  649. background: #fff;
  650. .form-item {
  651. display: flex;
  652. justify-content: space-between;
  653. align-items: center;
  654. padding: 25rpx 35rpx;
  655. box-sizing: border-box;
  656. border-bottom: 1px solid #f2f2f2;
  657. text {
  658. font-size: 28rpx;
  659. color: #999;
  660. }
  661. .label {
  662. color: #000;
  663. }
  664. view {
  665. display: flex;
  666. align-items: center;
  667. }
  668. }
  669. }
  670. .tip {
  671. padding: 17rpx 38rpx;
  672. color: #999;
  673. font-size: 28rpx;
  674. text {
  675. color: #999;
  676. font-size: 28rpx;
  677. }
  678. }
  679. }
  680. // 底部导航
  681. .submit_bar {
  682. position: fixed;
  683. bottom: 0;
  684. left: 0;
  685. z-index: 99;
  686. width: 100%;
  687. padding-bottom: env(safe-area-inset-bottom);
  688. background-color: #fff;
  689. user-select: none;
  690. display: flex;
  691. justify-content: space-between;
  692. align-items: center;
  693. .submit_text {
  694. padding: 0 40rpx;
  695. box-sizing: border-box;
  696. display: flex;
  697. flex-direction: column;
  698. flex: 1;
  699. text {
  700. font-size: 28rpx;
  701. color: #999;
  702. }
  703. .text_top {
  704. display: flex;
  705. align-items: center;
  706. text {
  707. color: #000;
  708. }
  709. .price {
  710. color: #ed1c24;
  711. font-size: 30rpx;
  712. }
  713. }
  714. .text_bottom {}
  715. }
  716. button {
  717. margin: 0;
  718. padding: 0;
  719. height: 100rpx;
  720. background: linear-gradient(to right, #ff6034, #ee0a24);
  721. width: 220rpx;
  722. font-weight: 500;
  723. border: none;
  724. border-radius: 0;
  725. line-height: 100rpx;
  726. text-align: center;
  727. transition: opacity .2s;
  728. }
  729. }
  730. // 弹窗
  731. .popup {
  732. .popup_wrap {
  733. width: 100%;
  734. display: flex;
  735. flex-direction: column;
  736. background: #fff;
  737. border-radius: 20rpx 20rpx 0 0;
  738. text {
  739. color: #999;
  740. font-size: 28rpx;
  741. }
  742. }
  743. .popup_title {
  744. width: 100%;
  745. display: flex;
  746. justify-content: space-between;
  747. align-items: center;
  748. padding: 30rpx 42rpx;
  749. box-sizing: border-box;
  750. border-bottom: 1px solid #f2f2f2;
  751. }
  752. .popup_content {
  753. width: 100%;
  754. display: flex;
  755. flex-direction: column;
  756. flex: 1;
  757. .radio-group {
  758. display: flex;
  759. flex-direction: column;
  760. width: 100%;
  761. padding: 0 42rpx;
  762. box-sizing: border-box;
  763. image {
  764. width: 48rpx;
  765. height: 48rpx;
  766. }
  767. .uni-list-cell-pd {
  768. display: flex;
  769. justify-content: space-between;
  770. padding: 42rpx 0;
  771. box-sizing: border-box;
  772. align-items: center;
  773. border-bottom: 1px solid #f2f2f2;
  774. margin: 0;
  775. .radio {
  776. display: flex;
  777. justify-content: space-between;
  778. align-items: center;
  779. width: 100%;
  780. }
  781. }
  782. }
  783. }
  784. .popup_button {
  785. width: 100%;
  786. display: flex;
  787. align-items: center;
  788. text {
  789. width: 50%;
  790. height: 110rpx;
  791. line-height: 110rpx;
  792. text-align: center;
  793. }
  794. .cancel_btn {
  795. background: #fff;
  796. color: #ed1c24;
  797. }
  798. .ok_btn {
  799. background: #ed1c24;
  800. color: #fff;
  801. }
  802. }
  803. }
  804. </style>