diff --git a/assets/img/active.gif b/assets/img/active.gif new file mode 100644 index 0000000..74ce8f1 Binary files /dev/null and b/assets/img/active.gif differ diff --git a/assets/img/edit.png b/assets/img/edit.png new file mode 100644 index 0000000..dfca640 Binary files /dev/null and b/assets/img/edit.png differ diff --git a/assets/img/redirect.png b/assets/img/redirect.png new file mode 100644 index 0000000..f0d9fcf Binary files /dev/null and b/assets/img/redirect.png differ diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index f38df9f..851f70b 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -103,7 +103,7 @@ Page({ if (res.data.endTime){ that.countdown(res.data.endTime); //当前时间与优惠券下架时间做计算 - var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dddd hh:mm:ss"); + var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); if (util.timechuo(endTime).indexOf('-') == 0) { that.setData({ endtime: "活动已结束", diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index 11a67bf..6f5f01c 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -66,9 +66,9 @@ Page({ }); } that.setData({ - expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dddd hh:mm:ss"), - updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"), - createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss") + expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), + updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), + createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") }); }); } @@ -89,9 +89,9 @@ Page({ data: res.data }); that.setData({ - expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dddd hh:mm:ss"), - updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"), - createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss") + expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), + updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), + createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") }); util.barcode("barcode", options.quancode, 510, 100); util.qrcode("qrcode", options.quancode, 350, 350); diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 7e86e21..d49df5a 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -13,7 +13,8 @@ Page({ items: [ { name: 1, value: '男', checked: false }, { name: 2, value: '女', checked: false }, - ] + ], + username: "" }, /** * 获得生日 @@ -34,7 +35,7 @@ Page({ console.log(res); that.setData({ name: res.name, - address: res, + address: JSON.stringify(res), }) }, fail: function (error) { @@ -60,15 +61,15 @@ Page({ var sex = that.data.sex; } if (that.data.address) { - var address = JSON.stringify(that.data.address); + var address = that.data.address; } else { var address = null; } - console.log(e.detail.value.username) if (e.detail.value.username) { var username = e.detail.value.username; - } else if (that.data.username) { + } + else if (that.data.username) { var username = that.data.username; } else { @@ -79,11 +80,6 @@ Page({ } else { var birthdate = null; } - console.log(username); - console.log(address); - console.log(sex); - console.log(birthdate); - if (username == null || address == null || sex == 0 || birthdate == null) { wx.showModal({ title: '提示', @@ -91,6 +87,10 @@ Page({ showCancel: false }) } else { + console.log(username) + console.log(address) + console.log(sex) + console.log(birthdate) Http.post({ url: config.api.updateInfo, data: { @@ -114,7 +114,6 @@ Page({ }) }) } - }, radioChange: function (e) { console.log(e.detail.value) @@ -128,80 +127,51 @@ Page({ */ onLoad: function (options) { let that = this; - that.setData({ - username: options.name, - sex: options.sex, - date: util.fmtDate(parseInt(options.birthdate)), - name: JSON.parse(options.address).name, - address: JSON.parse(options.address), - flag: 2 - }); - if (options.sex == "1") { - var checked = 'items[' + 0 + '].checked' - that.setData({ - [checked]: true - }) - that.setData({ - flagsex: 1 - }) - } else if (options.sex == "2") { - var checked = 'items[' + 1 + '].checked' - that.setData({ - [checked]: true - }) - that.setData({ - flagsex: 1 - }) - console.log(that.data.items); - } - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - console.log("oShow") - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + Http.get({ + url: config.api.getScore, + data: {} + }).then(res => { + console.log(res); + if (res.data.address && JSON.parse(res.data.address).name) { + that.setData({ + address: res.data.address, + name: JSON.parse(res.data.address).name, + }) + } + if (!JSON.parse(res.data.address).name) { + that.setData({ + name: null, + }) + } + if (res.data.name) { + that.setData({ + username: res.data.name + }) + } + if (res.data.sex) { + if (res.data.sex == 1) { + var checked = 'items[' + 0 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } else if (res.data.sex == 2) { + var checked = 'items[' + 1 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } + that.setData({ + sex: res.data.sex + }) + } + if (res.data.birthdate) { + that.setData({ + date: util.fmtDate(parseInt(res.data.birthdate)), + flag: 2 + }) + } + }) } }) \ No newline at end of file diff --git a/pages/edit/edit.wxml b/pages/edit/edit.wxml index 952c31f..48ff95f 100644 --- a/pages/edit/edit.wxml +++ b/pages/edit/edit.wxml @@ -2,7 +2,7 @@ 姓名 - + 生日 diff --git a/pages/index/index.js b/pages/index/index.js index c7dd268..07dd747 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,3 +1,4 @@ + const Http = require("../../utils/HttpBasics"); const config = require("../../config/config"); let app = getApp(); @@ -26,6 +27,7 @@ Page({ url: '../game/index', }) }, + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -159,7 +161,7 @@ Page({ } Http.setToken(res.data.token); that.checkUserCarStatus(); - // that.getUserInfo(); + that.getUserInfo(); that.getBannerlist(); if (app.couponChannelListCallback) { app.couponChannelListCallback(app.globalData.token); @@ -273,7 +275,6 @@ Page({ wx.getUserInfo({ success: res => { // 可以将 res 发送给后台解码出 unionId - debugger console.log("getUserInfo", res); } }); diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 936062a..32a4334 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,11 +1,13 @@ + - + + \ No newline at end of file diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index dde4692..3e02bea 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -77,7 +77,7 @@ Page({ }); //createDate 创建时间 - var createDate = util.formatTime(res.data.createDate, "yyyy-MM-dddd hh:mm:ss"); + var createDate = util.formatTime(res.data.createDate, "yyyy-MM-dd hh:mm:ss"); console.log(createDate); that.setData({ createDate: createDate diff --git a/pages/order/index/index.js b/pages/order/index/index.js index 45e1094..328e592 100644 --- a/pages/order/index/index.js +++ b/pages/order/index/index.js @@ -105,7 +105,7 @@ Page({ for (let i = 0; i < that.data.list.length; i++) { - var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dddd hh:mm:ss"); + var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss"); /** * 修改list的endtime * 渲染到页面 diff --git a/pages/passCar/choicecoupon/choicecoupon.js b/pages/passCar/choicecoupon/choicecoupon.js index 966a00f..7e3bdd2 100644 --- a/pages/passCar/choicecoupon/choicecoupon.js +++ b/pages/passCar/choicecoupon/choicecoupon.js @@ -56,7 +56,7 @@ Page({ res.data.list.map(file => { file.expiredTime = format.formatTime( file.expiredTime, - "yyyy-MM-dddd hh:mm:ss" + "yyyy-MM-dd hh:mm:ss" ); }); if (pageNum > res.data.pages) { diff --git a/pages/passCar/couponDetail/couponDetail.js b/pages/passCar/couponDetail/couponDetail.js index 01dff39..e3b5a04 100644 --- a/pages/passCar/couponDetail/couponDetail.js +++ b/pages/passCar/couponDetail/couponDetail.js @@ -36,8 +36,8 @@ Page({ }); that.setData({ expiredTime: util.fmtDate(that.data.data.expiredTime), - updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"), - createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss") + updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), + createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") }); util.barcode("barcode", options.quancode, 510, 100); util.qrcode("qrcode", options.quancode, 350, 350); diff --git a/pages/passCar/couponDetail/couponDetail.wxml b/pages/passCar/couponDetail/couponDetail.wxml index 665d66e..0500566 100644 --- a/pages/passCar/couponDetail/couponDetail.wxml +++ b/pages/passCar/couponDetail/couponDetail.wxml @@ -1,36 +1,36 @@ - - - - - - - - 优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券 - {{data.subTitle}} - - ¥{{data.salePrice/100}} - {{data.price/100}}小时 - 满{{data.usePrice/100}}元可用 - 仅限本店使用 - - - - - - 下单时间{{createDate}} - 核销时间{{updateDate}} - 过期时间{{updateDate}} - 退款时间{{updateDate}} - 有效期至:{{expiredTime}} - 订单编号{{data.orderId}} - 实付金额{{data.couponPrice/100}}元 - - - - 购买须知 - - - {{data.remark}} - - + + + + + + + {{data.title}} + {{data.subTitle}} + + ¥{{data.salePrice/100}} + + {{data.price/100}}小时 + 满{{data.usePrice/100}}元可用 + 仅限本店使用 + + + + + + 下单时间{{createDate}} + 核销时间{{updateDate}} + 过期时间{{updateDate}} + 退款时间{{updateDate}} + 有效期至:{{expiredTime}} + 订单编号{{data.orderId}} + 实付金额{{data.couponPrice/100}}元 + + + + 购买须知 + + + {{data.remark}} + + \ No newline at end of file diff --git a/pages/passCar/couponDetail/couponDetail.wxss b/pages/passCar/couponDetail/couponDetail.wxss index 0262613..9e59aa9 100644 --- a/pages/passCar/couponDetail/couponDetail.wxss +++ b/pages/passCar/couponDetail/couponDetail.wxss @@ -131,7 +131,7 @@ font-size: 26rpx; color: #999; width: 420rpx; - height: 32rpx; + height: 40rpx; white-space: nowrap; text-overflow:ellipsis; overflow: hidden; diff --git a/pages/passCar/couponList/couponList.js b/pages/passCar/couponList/couponList.js index faffdc6..9b78762 100644 --- a/pages/passCar/couponList/couponList.js +++ b/pages/passCar/couponList/couponList.js @@ -61,7 +61,7 @@ Page({ title: "加载中" }); Http.get({ - url: config.api.couponOrderList + "?type=5", + url: config.api.couponOrderCarList + "?type=5", data: { pageNum: pageNum, pageSize: 8, @@ -72,7 +72,7 @@ Page({ res.data.list.map(file => { file.expiredTime = format.formatTime( file.expiredTime, - "yyyy-MM-dddd hh:mm:ss" + "yyyy-MM-dd hh:mm:ss" ); }); console.log("姐姐的订单列表"); diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 544efe8..7668ea4 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -1,480 +1,484 @@ -let config = require("../../config/config.js"); -let Http = require("../../utils/HttpBasics"); -let Util = require("../../utils/util"); -let app = getApp(); -Page({ - data: { - park: null, - carList: [], - payList: [], - addCar: null, - tcq: 2, - flag: "", - extraData: {}, - desc: '', - title: '', - indicatorDots: true, - autoplay: false, - interval: 5000, - duration: 1000, - current: 0, - stopFees: {}, - canIUse: wx.canIUse("navigator") - }, - /** - * 车牌轮播滑动 - */ - onSlideChangeEnd: function(e) { - var that = this; - /** - * 获得当前的车牌号码 - */ - var listCardNum = (that.data.carList)[e.detail.current].carNumber; - console.log(listCardNum); - that.setData({ - listCardNum: listCardNum - }); - /** - * 获得停车费用 - */ - that.getStopFee(listCardNum); - }, - gotomange: function() { - wx.navigateTo({ - url: '/pages/managelicenseplate/managelicenseplate', - }) - }, - gotoetcp:function(){ - wx.navigateToMiniProgram({ - appId:'wx192b7d2e8dcbefd0', - extraData: this.data.extraData, - envVersion:'release' - }) - }, - showquan: function() { - wx.navigateTo({ - url: '/pages/passCar/couponList/couponList', - }) - }, - /** - * 待完成 - */ - gotodetail: function(e) { - console.log(e.target.dataset.rule); - wx.showModal({ - title: '缴费规则', - content: e.target.dataset.rule, - showCancel: false, - }) - }, - onShow: function(options) { - var that = this; - that.getList(); - that.init(); - /** - * 只有用户选择了优惠券 - * 才会进行券和车牌的绑定 - */ - if (wx.getStorageSync("chosed") && that.data.quanid) { - that.bindCoupon(that.data.quanid); - wx.setStorage({ - key: 'chosed', - data: '', - }) - }; - that.initUsrCarList(); - if (that.data.addCar) { - // 绑车牌 - if (app.globalData.carLogin) { - that.bindCar(that.data.addCar); - } else { - that.bindCar(that.data.addCar); - } - that.setData({ - addCar: null - }); - } - }, - onLoad: function(options) { - var that = this; - /** - * 获得分享小程序的 - * title - * desc - */ - Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, - } - }) - .then(res => { - let weapNote = JSON.parse(res.data.weapNote); - that.setData({ - desc: weapNote.carpage.desc, - title: weapNote.carpage.title - }) - }); - }, - - - jumpToAdd: function() { - wx.navigateTo({ - url: `/pages/addPark/addPark?flags=managepalte` - }); - }, - passc: function() { - wx.navigateTo({ - url: '/pages/ques/ques', - }) - }, - - - /** - * 券绑定车牌 - */ - bindCoupon: function(quanid) { - var that = this; - /** - * etcp - */ - var etcpData = { - etcpToken: app.globalData.etcpToken, - carNumber: that.data.listCardNum, - couponOrderId: quanid - }; - console.log(etcpData); - /** - * 停简单 - */ - var tjdData = { - carNumber: that.data.listCardNum - }; - var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; - Http.post({ - url: config.api.getCarCoupon, - data: postCouponData - }) - .then(res => { - that.initUsrCarList(); - }) - .catch(error => { - wx.showModal({ - content: error.message, - showCancel: false, - confirmText: "确定", - }) - console.log(error); - }) - }, - /** - * 选择优惠券 - */ - gotoquan: function() { - let that = this; - console.log(that.data.quanid); - if (that.data.quanid) { - wx.navigateTo({ - url: `/pages/passCar/choicecoupon/choicecoupon?quanid=${that.data.quanid}`, - }) - } else { - wx.navigateTo({ - url: '/pages/passCar/choicecoupon/choicecoupon', - }) - } - - }, - - //获取名下停车券列表 - getList() { - var that = this; - Http.get({ - url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", - data: { - pageNum: 1, - pageSize: 8, - couponOrderStatus: 0 - } - }).then(res => { - console.log(res); - that.setData({ - couponList: res.data.list - }); - }); - }, - - - /** - * 共同登录 - */ - init: function(carNumber) { - var that = this; - app.parkInitCallback = token => { - that.initPark(); - that.getParkStatus(); - if (!app.globalData.carLogin) { - /** - * 判断是否授权手机号 - */ - Http.post({ - url: config.api.checkPhoneStatus, - data: {} - }) - .then(res => { - console.log(res); - Http.post({ - url: config.api.carInit, - data: { - phone: app.globalData.phone - } - }).then(res => { - console.log(res); - app.globalData.carLogin = true; - app.globalData.parkVendor = res.data.vendor; - if (res.data.token) { - app.globalData.etcpToken = res.data.token; - } - /** - * 获得停车费用 - */ - that.initUsrCarList("flags"); - console.log(app.globalData.etcpToken); - }); - }) - .catch(err => { - console.log(err); - if (err.code == 11005) { - // 用户手机未授权 - /** - * 将值传到用户手机号授权的页面 - * - */ - wx.redirectTo({ - url: "/pages/getphoneInfo/index" - }); - } else if (err.code == 11006) { - // 用户手机已加密 - wx.redirectTo({ - url: "/pages/phoneinput/phoneinput" - }); - } - }) - } - }; - if (app.globalData.token && app.globalData.token != null) { - app.parkInitCallback(app.globalData.token); - } - }, - /** - * 绑定车牌 - */ - // bindCar: function(carNum) { - // var that = this; - // // ETCP - // var etcpData = { - // etcpToken: app.globalData.etcpToken, - // carNumber: carNum - // }; - // var tjdData = { - // carNumber: carNum - // }; - // var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; - // Http.post({ - // url: config.api.bindCar, - // data: postData - // }) - // .then(res => { - // console.log(res); - // // that.initUsrCarList(); - // wx.showModal({ - // title: "提示", - // showCancel: false, - // content: "绑车牌成功!", - // success: function() {} - // }); - // }) - // .catch(error => { - // console.log(error); - // wx.showModal({ - // title: "提示", - // showCancel: false, - // content: error.message, - // success: function() {} - // }); - // }); - // }, - - bindCar: function (carNum) { - var that = this; - // ETCP - var etcpData = { - etcpToken: app.globalData.etcpToken, - carNumber: carNum - }; - var tjdData = { - carNumber: carNum - }; - var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; - Http.post({ - url: config.api.bindCar, - data: postData - }) - .then(res => { - console.log(res); - that.setData({ - addCar: null - }); - that.initUsrCarList(); - wx.showModal({ - title: "提示", - showCancel: false, - content: "绑车牌成功!", - success: function () { } - }); - }) - .catch(error => { - console.log(error); - wx.showModal({ - title: "提示", - showCancel: false, - content: error.data.message, - success: function () { } - }); - }); - }, - /** - * 车场信息获取 - */ - initPark: function() { - var that = this; - Http.get({ - url: config.api.getParkInfo, - data: {} - }).then(res => { - that.setData({ - park: res.data - }); - }); - }, - - /** - * 车场状态获取 - */ - getParkStatus: function() { - var that = this; - Http.get({ - url: config.api.getParkStatus, - }) - .then(res => { - console.log(res); - }); - }, - - - /** - * 绑定车获取 - */ - initUsrCarList: function(flag) { - console.log(flag); - var that = this; - Http.get({ - url: config.api.getUserCarList, - data: {} - }).then(res => { - console.log(res) - that.setData({ - carList: res.data - }); - /** - * flag ==flags - * 表示从首页onShow进来的 - */ - if (flag == "flags" && res.data.length > 0) { - var listCardNum = res.data[0].carNumber; - console.log(listCardNum); - that.setData({ - listCardNum: listCardNum - }) - /** - * 获得停车费用 - */ - that.getStopFee(listCardNum); - } - }) - }, - - /** - * 获得停车费用修改 - */ - getStopFee: function(carNumber) { - var that = this; - var postData = - app.globalData.parkVendor == 1 ? { - etcpToken: app.globalData.etcpToken, - carNumber: carNumber - } : { - carNumber: carNumber, - outCarId: outCarId - }; - Http.post({ - url: config.api.getCarStopFee, - data: postData - }) - .then(res => { - var extraDataStr = { - params: { - token: app.globalData.etcpToken, - syncId: res.data.orderId, - payType: 6, // 小程序支付 - CarNumber: carNumber, - returnUrl: "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback", - source: "FUMAO-001", - actionId: "1" //操作ID,1:小程序支付 - } - }; - that.setData({ - extraData: extraDataStr - }); - that.setData({ - stopFees: res.data - }) - that.setData({ - timecha: Util.timecha(res.data.exitTime, res.data.entranceTime) - }) - }) - .catch(error => { - console.log(error); - wx.showModal({ - title: '提示', - content: error.message, - showCancel: false - }) - that.setData({ - stopFees: {} - }) - }); - }, - - /** - * 下拉刷新 - */ - onPullDownRefresh: function(e) { - let that = this; - that.initUsrCarList("flags"); - wx.stopPullDownRefresh(); - }, - // 用户点击右上角分享 - onShareAppMessage: function() { - return { - title: this.data.title, - desc: this.data.desc, - success: function(res) { - wx.showToast({ - title: "分享成功", - duration: 1000, - icon: "success" - }); - } - } - } +let config = require("../../config/config.js"); +let Http = require("../../utils/HttpBasics"); +let Util = require("../../utils/util"); +let app = getApp(); +Page({ + data: { + park: null, + carList: [], + payList: [], + addCar: null, + tcq: 2, + flag: "", + extraData: {}, + desc: '', + title: '', + indicatorDots: true, + autoplay: false, + interval: 5000, + duration: 1000, + current: 0, + stopFees: {}, + canIUse: wx.canIUse("navigator") + }, + /** + * 车牌轮播滑动 + */ + onSlideChangeEnd: function(e) { + var that = this; + /** + * 获得当前的车牌号码 + */ + var listCardNum = (that.data.carList)[e.detail.current].carNumber; + console.log(listCardNum); + that.setData({ + listCardNum: listCardNum + }); + /** + * 获得停车费用 + */ + that.getStopFee(listCardNum); + }, + gotomange: function() { + wx.navigateTo({ + url: '/pages/managelicenseplate/managelicenseplate', + }) + }, + gotoetcp:function(){ + wx.navigateToMiniProgram({ + appId:'wx192b7d2e8dcbefd0', + extraData: this.data.extraData, + envVersion:'release' + }) + }, + showquan: function() { + wx.navigateTo({ + url: '/pages/passCar/couponList/couponList', + }) + }, + gotodetail: function(e) { + console.log(e.target.dataset.rule); + wx.showModal({ + title: '缴费规则', + content: e.target.dataset.rule, + showCancel: false, + }) + }, + onShow: function(options) { + var that = this; + that.getList(); + that.init(); + /** + * 只有用户选择了优惠券 + * 才会进行券和车牌的绑定 + */ + if (wx.getStorageSync("chosed") && that.data.quanid) { + that.bindCoupon(that.data.quanid); + wx.setStorage({ + key: 'chosed', + data: '', + }) + }; + that.initUsrCarList(); + if (that.data.addCar) { + // 绑车牌 + if (app.globalData.carLogin) { + that.bindCar(that.data.addCar); + } else { + that.bindCar(that.data.addCar); + } + that.setData({ + addCar: null + }); + } + }, + onLoad: function(options) { + var that = this; + /** + * 获得分享小程序的 + * title + * desc + */ + Http.get({ + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) + .then(res => { + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + desc: weapNote.carpage.desc, + title: weapNote.carpage.title + }) + }); + }, + + + jumpToAdd: function() { + wx.navigateTo({ + url: `/pages/addPark/addPark?flags=managepalte` + }); + }, + passc: function() { + wx.navigateTo({ + url: '/pages/ques/ques', + }) + }, + + + /** + * 券绑定车牌 + */ + bindCoupon: function(quanid) { + var that = this; + /** + * etcp + */ + var etcpData = { + etcpToken: app.globalData.etcpToken, + carNumber: that.data.listCardNum, + couponOrderId: quanid + }; + console.log(etcpData); + /** + * 停简单 + */ + var tjdData = { + carNumber: that.data.listCardNum + }; + var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; + Http.post({ + url: config.api.getCarCoupon, + data: postCouponData + }) + .then(res => { + that.initUsrCarList(); + }) + .catch(error => { + wx.showModal({ + content: error.message, + showCancel: false, + confirmText: "确定", + }) + console.log(error); + }) + }, + /** + * 选择优惠券 + */ + gotoquan: function() { + let that = this; + console.log(that.data.quanid); + if (that.data.quanid) { + wx.navigateTo({ + url: `/pages/passCar/choicecoupon/choicecoupon?quanid=${that.data.quanid}`, + }) + } else { + wx.navigateTo({ + url: '/pages/passCar/choicecoupon/choicecoupon', + }) + } + + }, + + //获取名下停车券列表 + getList() { + var that = this; + Http.get({ + url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", + data: { + pageNum: 1, + pageSize: 8, + couponOrderStatus: 0 + } + }).then(res => { + console.log(res); + that.setData({ + couponList: res.data.list + }); + }); + }, + + + /** + * 共同登录 + */ + init: function(carNumber) { + var that = this; + app.parkInitCallback = token => { + that.initPark(); + that.getParkStatus(); + if (!app.globalData.carLogin) { + /** + * 判断是否授权手机号 + */ + Http.post({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + console.log(res); + Http.post({ + url: config.api.carInit, + data: { + phone: app.globalData.phone + } + }).then(res => { + console.log(res); + app.globalData.carLogin = true; + app.globalData.parkVendor = res.data.vendor; + if (res.data.token) { + app.globalData.etcpToken = res.data.token; + } + /** + * 获得停车费用 + */ + that.initUsrCarList("flags"); + console.log(app.globalData.etcpToken); + }); + }) + .catch(err => { + console.log(err); + if (err.code == 11005) { + // 用户手机未授权 + /** + * 将值传到用户手机号授权的页面 + * + */ + wx.redirectTo({ + url: "/pages/getphoneInfo/index" + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: "/pages/phoneinput/phoneinput" + }); + } + }) + } + }; + if (app.globalData.token && app.globalData.token != null) { + app.parkInitCallback(app.globalData.token); + } + }, + /** + * 绑定车牌 + */ + // bindCar: function(carNum) { + // var that = this; + // // ETCP + // var etcpData = { + // etcpToken: app.globalData.etcpToken, + // carNumber: carNum + // }; + // var tjdData = { + // carNumber: carNum + // }; + // var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; + // Http.post({ + // url: config.api.bindCar, + // data: postData + // }) + // .then(res => { + // console.log(res); + // // that.initUsrCarList(); + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: "绑车牌成功!", + // success: function() {} + // }); + // }) + // .catch(error => { + // console.log(error); + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: error.message, + // success: function() {} + // }); + // }); + // }, + + bindCar: function (carNum) { + var that = this; + // ETCP + var etcpData = { + etcpToken: app.globalData.etcpToken, + carNumber: carNum + }; + var tjdData = { + carNumber: carNum + }; + var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; + Http.post({ + url: config.api.bindCar, + data: postData + }) + .then(res => { + console.log(res); + that.setData({ + addCar: null + }); + that.initUsrCarList(); + wx.showModal({ + title: "提示", + showCancel: false, + content: "绑车牌成功!", + success: function () { } + }); + }) + .catch(error => { + console.log(error); + wx.showModal({ + title: "提示", + showCancel: false, + content: error.data.message, + success: function () { } + }); + }); + }, + /** + * 车场信息获取 + */ + initPark: function() { + var that = this; + Http.get({ + url: config.api.getParkInfo, + data: {} + }) + .then(res => { + that.setData({ + park: res.data + }) + }) + .catch(error=>{ + console.log(error) + }) + }, + + /** + * 车场状态获取 + */ + getParkStatus: function() { + var that = this; + Http.get({ + url: config.api.getParkStatus, + }) + .then(res => { + console.log(res); + }) + .catch(error=>{ + console.log(error) + }) + }, + + + /** + * 绑定车获取 + */ + initUsrCarList: function(flag) { + console.log(flag); + var that = this; + Http.get({ + url: config.api.getUserCarList, + data: {} + }).then(res => { + console.log(res) + that.setData({ + carList: res.data + }); + /** + * flag ==flags + * 表示从首页onShow进来的 + */ + if (flag == "flags" && res.data.length > 0) { + var listCardNum = res.data[0].carNumber; + console.log(listCardNum); + that.setData({ + listCardNum: listCardNum + }) + /** + * 获得停车费用 + */ + that.getStopFee(listCardNum); + } + }) + }, + + /** + * 获得停车费用修改 + */ + getStopFee: function(carNumber) { + var that = this; + var postData = + app.globalData.parkVendor == 1 ? { + etcpToken: app.globalData.etcpToken, + carNumber: carNumber + } : { + carNumber: carNumber, + outCarId: outCarId + }; + Http.post({ + url: config.api.getCarStopFee, + data: postData + }) + .then(res => { + var extraDataStr = { + params: { + token: app.globalData.etcpToken, + syncId: res.data.orderId, + payType: 6, // 小程序支付 + CarNumber: carNumber, + returnUrl: "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback", + source: "FUMAO-001", + actionId: "1" //操作ID,1:小程序支付 + } + }; + that.setData({ + extraData: extraDataStr + }); + that.setData({ + stopFees: res.data + }) + that.setData({ + timecha: Util.timecha(res.data.exitTime, res.data.entranceTime) + }) + }) + .catch(error => { + console.log(error); + wx.showModal({ + title: '提示', + content: error.message, + showCancel: false + }) + that.setData({ + stopFees: {} + }) + }); + }, + + /** + * 下拉刷新 + */ + onPullDownRefresh: function(e) { + let that = this; + that.initUsrCarList("flags"); + wx.stopPullDownRefresh(); + }, + // 用户点击右上角分享 + onShareAppMessage: function() { + return { + title: this.data.title, + desc: this.data.desc, + success: function(res) { + wx.showToast({ + title: "分享成功", + duration: 1000, + icon: "success" + }); + } + } + } }); \ No newline at end of file diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index 2f5162a..b73bda8 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -65,7 +65,7 @@ Page({ list: tmpArr }) for (let i = 0; i < that.data.list.length; i++) { - var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dddd hh:mm:ss"); + var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dd hh:mm:ss"); var alsell = Math.floor((that.data.list[i].inventory - (that.data.list[i].remainInventory))/(that.data.list[i].inventory)*100); util.timechuo(startTime); console.log(alsell); diff --git a/pages/user/index.js b/pages/user/index.js index a31da60..1010671 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -1,156 +1,118 @@ -var config = require("../../config/config.js"); -var app = getApp(); -const Http = require("../../utils/HttpBasics"); -Page({ - /** - * 页面的初始数据 - */ - data: { - canIUse: wx.canIUse('official-account'), - flag: 'hidden', - score:'0' - }, - /** - * 跳转到成长值的页面 - */ - gotograde:function(){ - wx.navigateTo({ - url: '/pages/grade/grade', - }) - }, - // getrun:function(){ - // let that = this; - // wx.getWeRunData({ - // success: function (res) { - // console.log(res); - // Http.post({ - // url: config.api.getWeRunData, - // data: { - // encryptedData: res.encryptedData, - // iv: res.iv - // } - // }).then(res => { - // console.log(res); - // that.setData({ - // step: res.data.stepInfoList[30].step - // }) - // }) - // } - // }) - // }, - /** - * - */ - // getxinghao:function(){ - // wx.getSystemInfo({ - // success:function(res){ - // console.log(res); - // wx.showModal({ - // content: res.brand, - // }) - // } - // }) - // }, - navigateTo() { - wx.navigateTo({ - url: `/pages/login/index` - }); - }, - showVersion: function() { - /** - * 长按显示版本号 - */ - let that = this; - if (that.data.flag == 'hidden') { - that.setData({ - flag: 'show' - }); - } - console.log(that.data.flag) - }, - gotoedit:function(){ - wx.navigateTo({ - url: `/pages/edit/edit?name=${this.data.name}&birthdate=${this.data.birthdate}&sex=${this.data.sex}&address=${this.data.address}`, - }) - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() {}, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - let that = this; - let num = wx.getStorageSync('couponNum'); - wx.hideTabBarRedDot({ - index: 2 - }); - console.log("我是渲染") - if (num == 'couponNum1') { - wx.setStorage({ - key: 'couponNum', - data: "couponNum1", - }) - that.setData({ - couponNum: "couponNum1" - }) - } else if (num == 'couponNum') { - that.setData({ - couponNum: "couponNum" - }) - }; - Http.get({ - url: config.api.getScore, - data: {} - }).then(res=>{ - console.log(res); - that.setData({ - score: res.data.score, - levelName: res.data.levelName - }) - if(res.data.address&&res.data.name&&res.data.sex&&res.data.birthdate){ - that.setData({ - address: res.data.address, - name: res.data.name, - sex: res.data.sex, - birthdate: res.data.birthdate - }) - } - }); - // that.getrun(); - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() {}, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() {}, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() {}, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() {}, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() {} +var config = require("../../config/config.js"); +var app = getApp(); +const Http = require("../../utils/HttpBasics"); +Page({ + /** + * 页面的初始数据 + */ + data: { + canIUse: wx.canIUse('official-account'), + flag: 'hidden', + score:'0', + name:"", + birthdate:"", + sex:"" + }, + /** + * 跳转到成长值的页面 + */ + gotograde:function(){ + wx.navigateTo({ + url: '/pages/grade/grade', + }) + }, + // getrun:function(){ + // let that = this; + // wx.getWeRunData({ + // success: function (res) { + // console.log(res); + // Http.post({ + // url: config.api.getWeRunData, + // data: { + // encryptedData: res.encryptedData, + // iv: res.iv + // } + // }).then(res => { + // console.log(res); + // that.setData({ + // step: res.data.stepInfoList[30].step + // }) + // }) + // } + // }) + // }, + /** + * + */ + // getxinghao:function(){ + // wx.getSystemInfo({ + // success:function(res){ + // console.log(res); + // wx.showModal({ + // content: res.brand, + // }) + // } + // }) + // }, + navigateTo() { + wx.navigateTo({ + url: `/pages/login/index` + }); + }, + showVersion: function() { + /** + * 长按显示版本号 + */ + let that = this; + if (that.data.flag == 'hidden') { + that.setData({ + flag: 'show' + }); + } + console.log(that.data.flag) + }, + gotoedit:function(){ + wx.navigateTo({ + url: '/pages/edit/edit', + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + let that = this; + let num = wx.getStorageSync('couponNum'); + wx.hideTabBarRedDot({ + index: 2 + }); + console.log("我是渲染") + if (num == 'couponNum1') { + wx.setStorage({ + key: 'couponNum', + data: "couponNum1", + }) + that.setData({ + couponNum: "couponNum1" + }) + } else if (num == 'couponNum') { + that.setData({ + couponNum: "couponNum" + }) + }; + Http.get({ + url: config.api.getScore, + data: {} + }).then(res=>{ + console.log(res); + that.setData({ + score: res.data.score, + levelName: res.data.levelName, + address: res.data.address, + birthdate: res.data.birthdate, + name: res.data.name, + address: res.data.sex, + }) + }); + // that.getrun(); + } }); \ No newline at end of file diff --git a/pages/user/index.wxml b/pages/user/index.wxml index 52d3c2d..5584be8 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -1,77 +1,77 @@ - - - - - - - - - - - 完善个人信息(获得成长值) - - - 当前成长值 - {{score}} - - - {{levelName}} - - - - - - - 我的订单 - - 查看全部 - - - - - - - 待付款 - - - - - - - - 已完成 - - - - - - - - - 券包 - - - - - - - - - - 智能停车 - - - - - - - - - - 版本号:2.1.8 - - - - - + + + + + + + + + + + {{levelName}} + 成长值{{score}} + + + + + + + + + + + + + 我的订单 + + 查看全部 + + + + + + + 待付款 + + + + + + + + 已完成 + + + + + + + + + 券包 + + + + + + + + + + 智能停车 + + + + + + + + + + 版本号:2.1.9 + + + + + \ No newline at end of file diff --git a/pages/user/index.wxss b/pages/user/index.wxss index 13f6f34..ed52daa 100644 --- a/pages/user/index.wxss +++ b/pages/user/index.wxss @@ -1,22 +1,25 @@ -.icons{ +.icons { width: 40rpx; margin-right: 20rpx; vertical-align: middle; } + .user { background: #fff; min-height: 100vh; } -.navigator-hover{ - opacity: 1!important; + +.navigator-hover { + opacity: 1 !important; background: #fff; } + .user-title { position: relative; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10); border-radius: 8px; - width: 698rpx; - padding: 0 30rpx; + width: 728rpx; + padding-left: 30rpx; display: flex; flex-direction: row; box-sizing: border-box; @@ -34,7 +37,8 @@ overflow: hidden; border: 1px solid red; } */ -.version{ + +.version { width: 600rpx; height: 300rpx; line-height: 300rpx; @@ -87,16 +91,18 @@ } .chengzhang { - font-size: 22rpx; - color: #999; - line-height: 40rpx; + font-size: 24rpx; + font-weight: 400; + color: rgba(122, 122, 122, 1); + margin-left: 10rpx; } .chengzhang1 { position: absolute; - right: 24rpx; + right: 0; bottom: 0; - top: 19rpx; + /* top: 19rpx; */ + top: 42rpx; } .chengzhang1 text { @@ -109,17 +115,21 @@ vertical-align: top; } -.chengzhang1 .view { - font-size: 44rpx; +.view { + font-size: 24rpx; color: #01bffe; - line-height: 67rpx; } - +.view image{ + width: 12rpx; + vertical-align: middle; + margin-top: -6rpx; +} .chengzhang1 text { text-align: center; - font-size: 24rpx; + font-size: 26rpx; color: #333; line-height: 33rpx; + margin-right: 30rpx; } .bannerbg { @@ -205,23 +215,33 @@ .user-out-btn::after { opacity: 0; } -.gzh{ + +.gzh { display: none; position: absolute; bottom: 6%; width: 90%; left: 0; right: 0; - margin: auto; + margin: auto; z-index: 1000000; background: #ccc; border-radius: 16rpx; overflow: hidden; - box-shadow:0 6px 20px 0 rgba(0,0,0,0.15); + box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.15); } -.act{ + +.act { display: none; } -.of{ + +.of { display: block; } +.activeimg{ + width: 176rpx!important; + position: absolute; + bottom: 0; + right: 0; + z-index: 10000; +} \ No newline at end of file