C端小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

1026 righe
25 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  3. let app = getApp();
  4. const format = require("../utils/util.js");
  5. let config = require("../config/config.js");
  6. let Http = require("../utils/HttpBasics");
  7. let Util = require("../utils/util");
  8. const imgurl = require("../utils/imgurl");
  9. Page({
  10. data: {
  11. navigationBarHeight,
  12. jianUrl: imgurl.jian.url,
  13. jiaofeiwm: imgurl.jiaofeiwm.url,
  14. parkUrl: imgurl.park.url,
  15. guanliHr: imgurl.guanliHr.url,
  16. qidaiUrl: imgurl.qidai.url,
  17. addUrl: imgurl.add.url,
  18. tingcheHr: imgurl.tingcheHr.url,
  19. cheUrl: imgurl.che.url,
  20. jiaofei: imgurl.jiaofei.url,
  21. wentiHr: imgurl.wentiHr.url,
  22. stopThat: imgurl.stopThat.url,
  23. park: null,
  24. carList: [],
  25. payList: [],
  26. addCar: null,
  27. tcq: 2,
  28. flag: "",
  29. extraData: {},
  30. desc: '',
  31. title: '',
  32. indicatorDots: true,
  33. autoplay: false,
  34. interval: 5000,
  35. duration: 1000,
  36. current: 0,
  37. stopFees: {},
  38. scroll: true,
  39. ifHaveCarModular: "",
  40. canIUse: wx.canIUse("navigator"),
  41. showTicketModal: false,
  42. ticketList: [],
  43. noCoupon: imgurl.noCoupon.url,
  44. loadingUrl: imgurl.loading.url,
  45. allow_load: true,
  46. curPageNum: 1,
  47. curPageSize: 15,
  48. curTotalpageNum: 0,
  49. quantitle: '',
  50. quanid: '',
  51. gouHr: imgurl.gouHr.url,
  52. totalTicketNum: 0,
  53. remark: '',
  54. generalPayPath: '',
  55. generalExtraData: {},
  56. goHomeUrl: "",
  57. supportPay: ""
  58. },
  59. getMoreList(e) {
  60. let totalNum = this.data.ticketList.length;
  61. if (this.data.curPageNum < this.data.curTotalpageNum) {
  62. this.setData({
  63. curPageNum: this.data.curPageNum + 1
  64. })
  65. this.getTicketList(0, this.data.curPageNum);
  66. }
  67. },
  68. /**
  69. * 选择使用的优惠券
  70. */
  71. choicecoupon: function (e) {
  72. var that = this;
  73. wx.showModal({
  74. title: '确定是否使用停车券',
  75. content: '使用后无法撤销',
  76. success(res) {
  77. if (res.confirm) {
  78. var quantitle = e.currentTarget.dataset.title;
  79. var quanid = e.currentTarget.dataset.id;
  80. that.setData({
  81. quanid: quanid,
  82. showTicketModal: false,
  83. });
  84. that.bindCoupon(that.data.quanid, quantitle);
  85. } else if (res.cancel) {
  86. console.log('用户点击取消')
  87. }
  88. }
  89. })
  90. },
  91. /*
  92. */
  93. getTicketList(key, pageNum) {
  94. var that = this;
  95. if (that.data.allow_load) {
  96. wx.showLoading({
  97. title: "加载中"
  98. });
  99. Http.get({
  100. url: config.api.couponOrderCarList,
  101. data: {
  102. pageNum: pageNum,
  103. pageSize: 15,
  104. couponOrderStatus: key
  105. }
  106. }).then(res => {
  107. that.setData({
  108. curTotalpageNum: res.data.pages,
  109. curPageNum: res.data.pageNum,
  110. totalTicketNum: res.data.total
  111. })
  112. res.data.list.map(file => {
  113. file.expiredTime = format.formatTime(
  114. file.expiredTime,
  115. "yyyy-MM-dd hh:mm:ss"
  116. );
  117. });
  118. setTimeout(function () {
  119. wx.hideLoading();
  120. }, 1200);
  121. if (pageNum >= res.data.pages) {
  122. that.setData({
  123. allow_load: false
  124. });
  125. }
  126. /**
  127. * 先赋值后渲染页面
  128. * concat 不会改变原数组值
  129. * push 会改变原数组值,但不会一条一条插入,而是整个数组插入
  130. */
  131. if (pageNum == 1) {
  132. that.setData({
  133. ticketList: res.data.list,
  134. curPageNum: pageNum
  135. });
  136. } else {
  137. that.setData({
  138. ticketList: that.data.ticketList.concat(res.data.list)
  139. });
  140. }
  141. // that.data.ticketList = that.data.ticketList.concat(res.data.list);
  142. wx.hideLoading();
  143. })
  144. .catch(err => {
  145. setTimeout(function () {
  146. wx.hideLoading();
  147. }, 1200);
  148. wx.showToast({
  149. title: err.errMsg,
  150. icon: 'none',
  151. duration: 2000,
  152. mask: false
  153. });
  154. })
  155. } else { }
  156. },
  157. //点击跳转到券详情页面
  158. gotouse: function (e) {
  159. wx.navigateTo({
  160. url: `/pages/passCar/couponDetail/couponDetail?quancode=${e.currentTarget.dataset.quancode
  161. }`,
  162. success: function (res) {
  163. // success
  164. },
  165. fail: function () {
  166. // fail
  167. },
  168. complete: function () {
  169. // complete
  170. }
  171. });
  172. },
  173. /**
  174. * 车牌轮播滑动
  175. */
  176. onSlideChangeEnd: function (e) {
  177. var that = this;
  178. /**
  179. * 获得当前的车牌号码
  180. */
  181. var listCardNum = (that.data.carList)[e.detail.current].carNumber;
  182. that.setData({
  183. listCardNum: listCardNum
  184. });
  185. /**
  186. * 获得停车费用
  187. */
  188. if (that.data.scroll) {
  189. that.getStopFee(listCardNum);
  190. }
  191. },
  192. callPay(data) {
  193. wx.requestPayment({
  194. timeStamp: data.timeStamp,
  195. nonceStr: data.nonceStr,
  196. package: data.package,
  197. signType: data.signType ? data.signType : "MD5",
  198. paySign: res.data.paySign,
  199. success: res => {
  200. wx.showLoading({
  201. title: '订单正在处理中...',
  202. })
  203. this.showList()
  204. },
  205. fail: res => {
  206. wx.hideLoading();
  207. wx.showToast({
  208. title: '支付失败',
  209. icon: 'error'
  210. })
  211. /**
  212. * 支付失败,需要更新订单的状态
  213. */
  214. },
  215. complete: res => { }
  216. });
  217. },
  218. //停车费用为0
  219. paySuccess: function () {
  220. wx.showModal({
  221. title: '支付成功',
  222. content: '请15分钟内离场',
  223. showCancel: false
  224. })
  225. },
  226. // supportPay等于1时
  227. goToPay() {
  228. Http.post({
  229. url: '/car/createPayOrder',
  230. data: {
  231. carNumber: this.data.listCardNum,
  232. carFee: String(this.data.stopFees.remainingFee * 100)
  233. }
  234. }).then(res => {
  235. const data = res.data
  236. this.callPay(data)
  237. }).catch(err => {
  238. })
  239. },
  240. gotomange: function () {
  241. wx.navigateTo({
  242. url: '/pages/managelicenseplate/managelicenseplate',
  243. })
  244. },
  245. bindfail: function (res) {
  246. console.log(123)
  247. console.log(res)
  248. },
  249. gotoCarMini: function (e) {
  250. console.log(478)
  251. var that = this
  252. // etcp parkVendor1
  253. // 泊链停车 parkVendor5
  254. if (e.target.dataset.flag == 'parkVendor1') {
  255. wx.navigateToMiniProgram({
  256. appId: that.data.etcpAppId,
  257. extraData: that.data.extraData,
  258. envVersion: that.data.carMiniVersion,
  259. path: that.data.payPath
  260. })
  261. } else if (e.target.dataset.flag == 'parkVendor5') {
  262. wx.navigateToMiniProgram({
  263. appId: that.data.bolinkAppId,
  264. extraData: that.data.extraData,
  265. envVersion: that.data.carMiniVersion,
  266. path: that.data.payPath
  267. })
  268. }
  269. },
  270. showquan: function () {
  271. wx.navigateTo({
  272. url: '/pages/passCar/couponList/couponList',
  273. })
  274. },
  275. showList: function () {
  276. wx.navigateTo({
  277. url: '/pages/passCar/showList/showList',
  278. })
  279. },
  280. gotodetail: function (e) {
  281. wx.showModal({
  282. title: '缴费规则',
  283. content: e.target.dataset.rule,
  284. showCancel: false,
  285. })
  286. },
  287. onShow: function (options) {
  288. this.setData({
  289. goHomeUrl: app.globalData.goHomeUrl
  290. })
  291. if (typeof this.getTabBar === 'function' &&
  292. this.getTabBar()) {
  293. this.getTabBar().setData({
  294. selected: 2
  295. })
  296. }
  297. var that = this;
  298. that.setData({
  299. etcpAppId: extConfig.attr.car.etcp.etcpAppId,
  300. carMiniVersion: extConfig.attr.car.version,
  301. etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl,
  302. payPath: extConfig.attr.car.etcp.payPath,
  303. ifHaveCarModular: extConfig.attr.ifHaveCarModular
  304. })
  305. console.log(this.data.ifHaveCarModular, 'ifHaveCarModular');
  306. if (app.globalData.token) {
  307. that.getList();
  308. that.init();
  309. } else {
  310. that.init();
  311. }
  312. /**
  313. * 只有用户选择了优惠券
  314. * 才会进行券和车牌的绑定
  315. */
  316. /* if (wx.getStorageSync("chosed") && that.data.quanid) {
  317. that.getStopFee(that.data.listCardNum);
  318. that.bindCoupon(that.data.quanid);
  319. wx.setStorage({
  320. key: 'chosed',
  321. data: '',
  322. })
  323. }; */
  324. if (app.globalData.token) {
  325. // that.initUsrCarList();
  326. that.initUsrCarList("flags");
  327. that.setData({
  328. current: 0
  329. })
  330. }
  331. if (that.data.addCar) {
  332. // 绑车牌
  333. if (app.globalData.carLogin) {
  334. that.bindCar(that.data.addCar);
  335. } else {
  336. that.bindCar(that.data.addCar);
  337. }
  338. that.setData({
  339. addCar: null
  340. });
  341. }
  342. this.getTicketList(0, 1);
  343. },
  344. cancelMove: function () {
  345. console.log(111)
  346. return false;
  347. },
  348. onHide: function () {
  349. this.setData({
  350. allow_load: true,
  351. showTicketModal: false,
  352. curPageNum: 1,
  353. ticketList: []
  354. })
  355. },
  356. onLoad: function (options) {
  357. var that = this;
  358. /**
  359. * 获得分享小程序的
  360. * title
  361. * desc
  362. */
  363. Http.get({
  364. url: config.api.getWeapNote,
  365. data: {
  366. appId: config.weapp.AppId,
  367. }
  368. })
  369. .then(res => {
  370. let weapNote = JSON.parse(res.data.weapNote);
  371. that.setData({
  372. desc: weapNote.carpage.desc,
  373. title: weapNote.carpage.title
  374. })
  375. })
  376. .catch(err => {
  377. console.log(err);
  378. })
  379. // 登录
  380. var scene = decodeURIComponent(options.scene);
  381. that.setData({
  382. scene: scene
  383. });
  384. if (app.globalData.token) { } else {
  385. // app.getLocation();
  386. that.userLogin()
  387. }
  388. },
  389. /**
  390. * 用户登录
  391. */
  392. userLogin: function () {
  393. var that = this;
  394. // 登录
  395. wx.login({
  396. success: ({
  397. code
  398. }) => {
  399. wx.getSystemInfo({
  400. success: function (res) {
  401. that.setData({
  402. systemInfo: JSON.stringify(res)
  403. })
  404. }
  405. })
  406. var usrdata = {
  407. appId: config.weapp.AppId,
  408. code: code,
  409. sceneAddress: app.globalData.sceneAddress,
  410. scene: that.data.scene,
  411. systemInfo: that.data.systemInfo
  412. };
  413. if (app.globalData.locationInfo) {
  414. usrdata = {
  415. appId: config.weapp.AppId,
  416. code: code,
  417. sceneAddress: app.globalData.sceneAddress,
  418. latitude: "" + app.globalData.locationInfo.latitude,
  419. longitude: "" + app.globalData.locationInfo.longitude,
  420. scene: that.data.scene,
  421. systemInfo: that.data.systemInfo
  422. };
  423. }
  424. Http.post({
  425. url: config.api.login,
  426. data: usrdata
  427. })
  428. .then(res => {
  429. app.globalData.token = res.data.token;
  430. Http.setToken(res.data.token);
  431. that.checkUserCarStatus();
  432. that.getList();
  433. that.init();
  434. that.initUsrCarList();
  435. return Http.get({
  436. url: config.api.checkUserStatus,
  437. data: {}
  438. });
  439. })
  440. .then(res => { })
  441. .catch(err => {
  442. if (err.code == 11004) {
  443. // 用户昵称未授权
  444. wx.redirectTo({
  445. url: "/pages/getuserinfo/index"
  446. });
  447. } else {
  448. wx.showModal({
  449. title: '提示',
  450. content: err.errMsg,
  451. showCancel: false
  452. })
  453. }
  454. });
  455. }
  456. });
  457. },
  458. /**
  459. * 检查用户是否有车
  460. */
  461. checkUserCarStatus: function () {
  462. var that = this;
  463. Http.get({
  464. url: config.api.userCarCount,
  465. data: {}
  466. }).then(res => {
  467. if (res.data > 0) {
  468. // 用户名下有车
  469. app.globalData.phone = res.data.phone;
  470. app.globalData.supportCar = true;
  471. // 共同登录
  472. that.userCarLogin();
  473. }
  474. })
  475. .catch(err => { })
  476. },
  477. jumpToAdd: function () {
  478. wx.navigateTo({
  479. url: `/pages/addPark/addPark?flags=managepalte`
  480. });
  481. },
  482. passc: function () {
  483. wx.navigateTo({
  484. url: '/pages/ques/ques',
  485. })
  486. },
  487. goExplain: function () {
  488. wx.navigateTo({
  489. url: '/pages/tcExplain/tcExplain',
  490. })
  491. },
  492. /**
  493. * 券绑定车牌
  494. */
  495. bindCoupon: function (quanid, quantitle) {
  496. wx.showLoading({
  497. title: '使用中...',
  498. })
  499. var that = this;
  500. /**
  501. * etcp
  502. */
  503. var postCouponData = {
  504. etcpToken: app.globalData.etcpToken,
  505. carNumber: that.data.listCardNum,
  506. couponOrderId: quanid
  507. };
  508. if (app.globalData.parkVendor == 2) {
  509. // 停简单
  510. postCouponData = {
  511. carNumber: that.data.listCardNum
  512. }
  513. }
  514. if (app.globalData.parkVendor == 4) {
  515. // 尚安
  516. postCouponData = {
  517. carNumber: that.data.listCardNum,
  518. couponOrderId: quanid
  519. }
  520. }
  521. if (app.globalData.parkVendor == 5) {
  522. // 泊链
  523. postCouponData = {
  524. carNumber: that.data.listCardNum,
  525. orderId: that.data.bolinkOrderId,
  526. couponOrderId: quanid
  527. }
  528. }
  529. if (app.globalData.parkVendor >= 6) {
  530. console.log(123456789)
  531. postCouponData = {
  532. carNumber: that.data.listCardNum,
  533. // orderId: that.data.bolinkOrderId,
  534. couponOrderId: quanid,
  535. parkOrderId: that.data.stopFees.orderId
  536. }
  537. }
  538. Http.post({
  539. url: config.api.getCarCoupon,
  540. data: postCouponData
  541. })
  542. .then(res => {
  543. wx.hideLoading()
  544. // if(res.data){
  545. that.getStopFee(that.data.listCardNum);
  546. that.initUsrCarList();
  547. that.setData({
  548. quantitle: quantitle, //接口条用成功后在赋值
  549. })
  550. // }else{
  551. // wx.showToast({
  552. // title: res.message,
  553. // icon: 'none',
  554. // duration: 3000,
  555. // mask: false
  556. // });
  557. // }
  558. })
  559. .catch(err => {
  560. wx.hideLoading()
  561. if (err.message != undefined) {
  562. wx.showToast({
  563. title: err.message,
  564. icon: 'none',
  565. duration: 3000,
  566. mask: false
  567. });
  568. }
  569. })
  570. },
  571. /**
  572. * 选择优惠券
  573. */
  574. // gotoquan: function () {
  575. // let that = this;
  576. // if (that.data.quanid) {
  577. // wx.navigateTo({
  578. // url: `/pages/passCar/choicecoupon/choicecoupon?quanid=${that.data.quanid}`,
  579. // })
  580. // } else {
  581. // wx.navigateTo({
  582. // url: '/pages/passCar/choicecoupon/choicecoupon',
  583. // })
  584. // }
  585. // },
  586. closeTicketModal: function () {
  587. this.setData({
  588. showTicketModal: false
  589. })
  590. },
  591. /**
  592. * 停车券 弹框
  593. */
  594. openTicketModal: function () {
  595. this.setData({
  596. showTicketModal: true,
  597. allow_load: true,
  598. ticketList: [],
  599. curPageNum: 1,
  600. })
  601. this.getTicketList(0, 1);
  602. /* if (!this.data.ticketList.length){
  603. this.getTicketList(0, 1);
  604. } */
  605. },
  606. //获取名下停车券列表
  607. getList() {
  608. var that = this;
  609. Http.get({
  610. url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0",
  611. data: {
  612. pageNum: 1,
  613. pageSize: 15,
  614. couponOrderStatus: 0
  615. }
  616. }).then(res => {
  617. that.setData({
  618. couponList: res.data.list
  619. });
  620. })
  621. .catch(err => {
  622. console.log(err)
  623. })
  624. },
  625. /**
  626. * 共同登录
  627. */
  628. init: function (carNumber) {
  629. var that = this;
  630. app.parkInitCallback = token => {
  631. that.initPark();
  632. that.getParkStatus();
  633. if (!app.globalData.carLogin) {
  634. Http.get({
  635. url: config.api.checkUserStatus,
  636. data: {}
  637. }).then(res => {
  638. app.globalData.type = 'pc'
  639. /**
  640. * 判断是否授权手机号
  641. */
  642. Http.get({
  643. url: config.api.checkPhoneStatus,
  644. data: {}
  645. })
  646. .then(res => {
  647. Http.post({
  648. url: config.api.carInit,
  649. data: {
  650. phone: app.globalData.phone
  651. }
  652. }).then(res => {
  653. app.globalData.carLogin = true;
  654. app.globalData.parkVendor = res.data.vendor;
  655. if (res.data.token) {
  656. app.globalData.etcpToken = res.data.token;
  657. }
  658. if (res.data.supportPay && res.data.supportPay == 1) {
  659. that.setData({
  660. supportPay: 1
  661. })
  662. } else {
  663. that.setData({
  664. supportPay: 0
  665. })
  666. }
  667. /**
  668. * 获得停车费用
  669. */
  670. that.initUsrCarList("flags");
  671. });
  672. })
  673. .catch(err => {
  674. if (err.code == 11005) {
  675. // 用户手机未授权
  676. /**
  677. * 将值传到用户手机号授权的页面
  678. *
  679. */
  680. wx.redirectTo({
  681. url: "/pages/getphoneInfo/index"
  682. });
  683. } else if (err.code == 11006) {
  684. // 用户手机已加密
  685. wx.redirectTo({
  686. url: "/pages/phoneinput/phoneinput"
  687. });
  688. } else {
  689. wx.showToast({
  690. title: err.errMsg,
  691. icon: 'none',
  692. duration: 2000,
  693. mask: false
  694. });
  695. }
  696. })
  697. }).catch(err => {
  698. app.globalData.type = 'pc'
  699. if (err.code == 11004) {
  700. // 用户昵称未授权
  701. wx.redirectTo({
  702. url: "/pages/getuserinfo/index"
  703. });
  704. } else {
  705. wx.showModal({
  706. title: '提示',
  707. content: err.errMsg,
  708. showCancel: false
  709. })
  710. }
  711. });
  712. }
  713. };
  714. if (app.globalData.token && app.globalData.token != null) {
  715. app.parkInitCallback(app.globalData.token);
  716. }
  717. },
  718. bindCar: function (carNum) {
  719. var that = this;
  720. // ETCP
  721. var etcpData = {
  722. etcpToken: app.globalData.etcpToken,
  723. carNumber: carNum
  724. };
  725. var otherData = {
  726. carNumber: carNum
  727. };
  728. var postData = app.globalData.parkVendor == 1 ? etcpData : otherData;
  729. Http.post({
  730. url: config.api.bindCar,
  731. data: postData
  732. })
  733. .then(res => {
  734. that.setData({
  735. addCar: null
  736. });
  737. that.initUsrCarList();
  738. wx.showModal({
  739. title: "提示",
  740. showCancel: false,
  741. content: "绑车牌成功!",
  742. success: function () { }
  743. });
  744. })
  745. .catch(error => {
  746. wx.showModal({
  747. title: "提示",
  748. showCancel: false,
  749. content: error.data.message,
  750. success: function () { }
  751. });
  752. });
  753. },
  754. /**
  755. * 车场信息获取
  756. */
  757. initPark: function () {
  758. var that = this;
  759. Http.get({
  760. url: config.api.getParkInfo,
  761. data: {}
  762. })
  763. .then(res => {
  764. that.setData({
  765. park: res.data
  766. })
  767. if (res.data) {
  768. app.globalData.parkVendor = res.data.vendorType;
  769. if (app.globalData.parkVendor == 1) {
  770. console.log("payPath: " + extConfig.attr.car.etcp.payPath)
  771. // etcp
  772. that.setData({
  773. parkVendor: app.globalData.parkVendor,
  774. etcpAppId: extConfig.attr.car.etcp.etcpAppId,
  775. carMiniVersion: extConfig.attr.car.version,
  776. etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl,
  777. payPath: extConfig.attr.car.etcp.payPath
  778. })
  779. } else if (app.globalData.parkVendor == 2) {
  780. // TJD
  781. var vendorObj = JSON.parse(res.data.vendorParams)
  782. that.setData({
  783. parkVendor: app.globalData.parkVendor,
  784. tjdAppId: extConfig.attr.car.tjd.tjdAppId,
  785. carMiniVersion: extConfig.attr.car.version,
  786. payPath: extConfig.attr.car.tjd.payPath
  787. })
  788. } else if (app.globalData.parkVendor == 5) {
  789. // 泊链
  790. var vendorObj = JSON.parse(res.data.vendorParams)
  791. console.log("payPath: " + extConfig.attr.car.bolink.payPath)
  792. that.setData({
  793. parkVendor: app.globalData.parkVendor,
  794. bolinkAppId: extConfig.attr.car.bolink.bolinkAppId,
  795. carMiniVersion: extConfig.attr.car.version,
  796. payPath: extConfig.attr.car.bolink.payPath,
  797. bolinkComId: vendorObj.comid,
  798. bolinkUnionId: vendorObj.union_id
  799. })
  800. }
  801. }
  802. })
  803. .catch(err => {
  804. console.log(err);
  805. // wx.showToast({
  806. // title: err.message,
  807. // icon: 'none',
  808. // duration: 2000,
  809. // mask: false
  810. // });
  811. })
  812. },
  813. /**
  814. * 车场状态获取
  815. */
  816. getParkStatus: function () {
  817. var that = this;
  818. Http.get({
  819. url: config.api.getParkStatus,
  820. })
  821. .then(res => {
  822. console.log(res)
  823. })
  824. .catch(err => {
  825. console.log(err)
  826. // wx.showToast({
  827. // title: err.message,
  828. // icon:"none"
  829. // })
  830. })
  831. },
  832. /**
  833. * 绑定车获取
  834. */
  835. initUsrCarList: function (flag) {
  836. var that = this;
  837. Http.get({
  838. url: config.api.getUserCarList,
  839. data: {}
  840. }).then(res => {
  841. that.setData({
  842. carList: res.data
  843. });
  844. /**
  845. * flag ==flags
  846. * 表示从首页onShow进来的
  847. */
  848. if (flag == "flags" && res.data.length > 0) {
  849. var listCardNum = res.data[0].carNumber;
  850. that.setData({
  851. listCardNum: listCardNum
  852. })
  853. /**
  854. * 获得停车费用
  855. */
  856. that.getStopFee(listCardNum);
  857. }
  858. })
  859. .catch(err => {
  860. wx.showToast({
  861. title: err.message,
  862. icon: 'none',
  863. duration: 2000,
  864. mask: false
  865. });
  866. })
  867. },
  868. /**
  869. * 获得停车费用修改
  870. */
  871. getStopFee: function (carNumber) {
  872. let that = this;
  873. let postData =
  874. app.globalData.parkVendor == 1 ? {
  875. etcpToken: app.globalData.etcpToken,
  876. carNumber: carNumber
  877. } : {
  878. carNumber: carNumber
  879. };
  880. Http.post({
  881. url: config.api.getCarStopFee,
  882. data: postData
  883. })
  884. .then(res => {
  885. console.log(res)
  886. if (app.globalData.parkVendor == 1) { // ETCP
  887. var extraDataStr = {
  888. params: {
  889. token: app.globalData.etcpToken,
  890. syncId: res.data.orderId,
  891. payType: 6, // 小程序支付
  892. CarNumber: carNumber,
  893. returnUrl: that.data.etcpCallbackUrl,
  894. source: "FUMAO-001",
  895. actionId: "1" //操作ID,1:小程序支付
  896. }
  897. }
  898. that.setData({
  899. parkVendor: app.globalData.parkVendor,
  900. extraData: extraDataStr,
  901. stopFees: res.data,
  902. timecha: Util.timecha(res.data.exitTime, res.data.entranceTime)
  903. });
  904. } else if (app.globalData.parkVendor == 2) { // TJD // TODO
  905. var extraDataStr = {
  906. prePayType: that.data.prePayType,
  907. channel: res.data.channel,
  908. isShowDetail: true,
  909. orderId: res.data.orderId
  910. }
  911. that.setData({
  912. parkVendor: app.globalData.parkVendor,
  913. extraData: extraDataStr,
  914. stopFees: {
  915. orderId: res.data.orderId,
  916. entranceTime: res.data.start_time,
  917. remainingFee: res.data.money
  918. },
  919. timecha: res.data.duration
  920. });
  921. } else if (app.globalData.parkVendor == 5) { // BoLink
  922. var extraDataStr = {
  923. union_id: that.data.bolinkUnionId,
  924. order_id: res.data.order_id,
  925. park_id: that.data.bolinkComId,
  926. plate_number: res.data.plate_number,
  927. money: res.data.money,
  928. park_name: res.data.park_name
  929. }
  930. that.setData({
  931. parkVendor: app.globalData.parkVendor,
  932. bolinkOrderId: res.data.order_id,
  933. extraData: extraDataStr,
  934. stopFees: {
  935. orderId: res.data.order_id,
  936. entranceTime: res.data.start_time,
  937. remainingFee: res.data.money
  938. },
  939. timecha: res.data.duration
  940. });
  941. } else { // *#06#
  942. // var extraDataStr = {
  943. // params: {
  944. // token: app.globalData.etcpToken,
  945. // syncId: res.data.orderId,
  946. // payType: 6, // 小程序支付
  947. // CarNumber: carNumber,
  948. // returnUrl: that.data.etcpCallbackUrl,
  949. // source: "FUMAO-001",
  950. // actionId: "1",//操作ID,1:小程序支付
  951. // },
  952. // }
  953. that.setData({
  954. parkVendor: app.globalData.parkVendor,
  955. // extraData: extraDataStr,
  956. stopFees: res.data,
  957. timecha: Util.timecha(res.data.exitTime, res.data.entranceTime),
  958. remark: res.data.remark,
  959. generalAppId: res.data.appId,
  960. generalPayPath: res.data.payPath,
  961. generalExtraData: res.data.extraData,
  962. extraDataFlag: JSON.stringify(res.data.extraData)
  963. });
  964. console.log(that.data.extraDataFlag, "123456789")
  965. }
  966. that.setData({
  967. scroll: true
  968. })
  969. })
  970. .catch(error => {
  971. that.setData({
  972. stopFees: {},
  973. scroll: true
  974. })
  975. });
  976. },
  977. /**
  978. * 下拉刷新
  979. */
  980. onPullDownRefresh: function (e) {
  981. let that = this;
  982. that.initUsrCarList("flags");
  983. that.setData({
  984. current: 0
  985. })
  986. wx.stopPullDownRefresh();
  987. }
  988. });