diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index a65ec6c..6828e95 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -167,10 +167,11 @@ Page({ wx.showLoading({ title: "加载中..." }); - if (that.data.data.type == 5) { + if (that.data.data.type == 6) { this.initUsrCarList() // 领取 5.停车券 // TODO 选取用户下的车牌 + console.log(1111111111111) } else { Http.post({ @@ -349,6 +350,16 @@ Page({ console.log(res); console.log("支付完成"); if (res.errMsg == "requestPayment:ok") { + if (that.data.data.type == 5) { + setTimeout(() => { + wx.switchTab({ + url: '/pages/passCar/passCar' + }); + }, 1600); + // this.initUsrCarList() + // 领取 5.停车券 + // TODO 选取用户下的车牌 + } } else { wx.showToast({ title: "支付失败", @@ -370,11 +381,21 @@ Page({ } else { // 免费券 that.payOrderUpdate(orderId, "0", 1); + wx.showToast({ title: "领取成功", duration: 3000, image: "./../../../assets/img/success.png" }); + //////////////////////////停车券 + console.log(that.data.data.type) + if (that.data.data.type == 5) { + setTimeout(() => { + wx.switchTab({ + url: '/pages/passCar/passCar' + }); + }, 1600); + } } } }) diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index 153f578..0e0ad4a 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -25,11 +25,13 @@ Page({ }); //获得优惠券的详情 - if ( - options.quancode != null && - (options.quancode != "" && options.quancode) != undefined - ) { - that.data.setInter = setInterval(function(){ + that.data.setInter = setInterval(function() { + if ( + options.quancode != null && + options.quancode != "" && + options.quancode != undefined && + options.couponorderstatus == 0 + ) { Http.get({ url: config.api.couponOrderDetail, data: { @@ -46,10 +48,29 @@ Page({ createDate: util.fmtDate(that.data.data.createDate) }); }); - }, 200); - } - util.barcode("barcode", options.quancode, 510, 100); - util.qrcode("qrcode", options.quancode, 350, 350); + } + }, 2000); + + // if (options.couponorderstatus != "0") { + Http.get({ + url: config.api.couponOrderDetail, + data: { + couponOrderId: options.quancode + } + }).then(res => { + console.log(res); + that.setData({ + data: res.data + }); + that.setData({ + expiredTime: util.fmtDate(that.data.data.expiredTime), + updateDate: util.fmtDate(that.data.data.updateDate), + createDate: util.fmtDate(that.data.data.createDate) + }); + util.barcode("barcode", options.quancode, 510, 100); + util.qrcode("qrcode", options.quancode, 350, 350); + }); + // } }, phone: function() { let that = this; diff --git a/pages/couponorder/index/index.js b/pages/couponorder/index/index.js index b718208..c453a1f 100644 --- a/pages/couponorder/index/index.js +++ b/pages/couponorder/index/index.js @@ -35,22 +35,21 @@ Page({ //点击跳转到券详情页面 gotouse: function(e) { - console.log(e.currentTarget.dataset.quancode); + console.log(e.currentTarget.dataset.couponorderstatus); console.log("点击跳转到券详情"); wx.navigateTo({ url: `/pages/couponorder/detail/index?quancode=${ - e.currentTarget.dataset.quancode - }` + e.currentTarget.dataset.quancode}&couponorderstatus=${e.currentTarget.dataset.couponorderstatus}` }); }, getList(key, pageNum) { var that = this; - console.log(key); - console.log(pageNum); + // console.log(key); + // console.log(pageNum); if (that.data.allow_load) { that.setData({ loading: true, - content: "小主,我在玩命加载中..." + content: "小主,我在玩命加载中...", }); Http.get({ url: config.api.couponOrderList, diff --git a/pages/couponorder/index/index.wxml b/pages/couponorder/index/index.wxml index 340a8ec..8525e4d 100644 --- a/pages/couponorder/index/index.wxml +++ b/pages/couponorder/index/index.wxml @@ -12,7 +12,7 @@ - + - 立即使用 - 查看 + 立即使用 + 查看 diff --git a/pages/index/index.js b/pages/index/index.js index db85539..c94f220 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -24,7 +24,7 @@ Page({ }, onShow: function() { - this.userLogin() + this.userLogin(); }, onGetCode: function(e) { @@ -42,33 +42,32 @@ Page({ var that = this; // 登录 wx.login({ - success: ({ - code - }) => { + success: ({ code }) => { var usrdata = { appId: config.weapp.AppId, code: code, - sceneAddress: app.globalData.sceneAddress, - } + sceneAddress: app.globalData.sceneAddress + }; if (app.globalData.locationInfo) { usrdata = { appId: config.weapp.AppId, code: code, sceneAddress: app.globalData.sceneAddress, - latitude: '' + app.globalData.locationInfo.latitude, - longitude: '' + app.globalData.locationInfo.longitude, - } + latitude: "" + app.globalData.locationInfo.latitude, + longitude: "" + app.globalData.locationInfo.longitude + }; } Http.post({ - url: config.api.login, - data: usrdata - }) + url: config.api.login, + data: usrdata + }) .then(res => { console.log("userlogin:app", res); app.globalData.token = res.data.token; Http.setToken(res.data.token); that.checkUserCarStatus(); that.getUserInfo(); + that.getBannerlist(); if (app.couponChannelListCallback) { app.couponChannelListCallback(app.globalData.token); } @@ -99,6 +98,25 @@ Page({ }); }, + /** + * banner + */ + getBannerlist: function() { + let that = this; + Http.get({ + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 10 + } + }).then(res => { + console.log(res); + that.setData({ + list: res.data.list + }); + console.log(res.data.list); + }); + }, /** * 检查用户是否有车 */ diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index 5316b27..bc70beb 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -29,7 +29,7 @@ Page({ // 2 已过期 // 3 已经退款 console.log(e); - if (that.data.mystatus == null || that.data.mystatus == undefined) { + if (that.data.mystatus == "" || that.data.mystatus == undefined) { wx.navigateTo({ url: `/pages/orderquanma/index?quancode=${ e.currentTarget.dataset.quancode @@ -213,7 +213,6 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onShow: function() { - console.log(this.data.mystatus) }, /** diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js index 3bce14b..4f70f7e 100644 --- a/pages/orderquanma/index.js +++ b/pages/orderquanma/index.js @@ -11,6 +11,8 @@ Page({ let that = this; util.barcode("barcode", options.quancode, 500, 100); util.qrcode("qrcode", options.quancode, 350, 350); + + console.log("zhuangtai"); that.setData({ code: options.quancode, title: options.title, @@ -18,6 +20,12 @@ Page({ remark: options.remark, couponorderstatus: options.couponorderstatus }); + + console.log(options.couponorderstatus); + console.log("我是状态"); + /** + * 如果没有核销 + */ that.data.setInter = setInterval(function() { if (that.data.couponorderstatus == 0) { Http.get({ @@ -30,20 +38,38 @@ Page({ that.setData({ couponorderstatus: res.data.CouponOrderStatus }); - - /** - * 动态改变上一级页面的核销状态 - */ - var pages = getCurrentPages(); - var currPage = pages[pages.length - 1]; //当前页面 - var prevPage = pages[pages.length - 2]; //上一个页面 - //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 - prevPage.setData({ - mystatus:res.data.CouponOrderStatus - }); + if (res.data.CouponOrderStatus == 1) { + /** + * 动态改变上一级页面的核销状态 + */ + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2]; //上一个页面 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 + prevPage.setData({ + mystatus: res.data.CouponOrderStatus + }); + } }); } }, 2000); + + if (that.data.couponorderstatus == 1) { + /** + * 如果已经核销 + * 不需要循环 + */ + Http.get({ + url: config.api.getStatus, + data: { + couponOrderId: options.quancode + } + }).then(res => { + console.log(res); + that.setData({ + couponorderstatus: res.data.CouponOrderStatus + }); + }); + } /** * couponorderstatus * 0 没有核销 diff --git a/pages/passCar/couponList/couponList.wxml b/pages/passCar/couponList/couponList.wxml index 9990206..17b5cb5 100644 --- a/pages/passCar/couponList/couponList.wxml +++ b/pages/passCar/couponList/couponList.wxml @@ -30,7 +30,7 @@ - + \ No newline at end of file diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index ceee941..aebba2a 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -6,8 +6,10 @@ Page({ data: { park: null, carList: [], + payList:[], addCar: null, - tcq: 2 + tcq: 2, + flag:'' }, // ready() { // app.couponChannelListCallback = token => { @@ -41,6 +43,7 @@ Page({ onLoad: function (options) { var that = this that.init(); + this.getList(); }, onShow: function (options) { var that = this @@ -78,27 +81,130 @@ Page({ url: '/pages/addPark/addPark', }); }, - jumpToPay: function () { - console.log("停车支付去") - //wx.redirectTo({ - // url: '/pages/pay/pay', - //}) - }, - passb: function () { - wx.showToast({ - title: '货物在路上~', - }) - }, passc: function () { wx.showToast({ title: '宝宝最可爱~', }) }, - orderPay: function () { - wx.redirectTo({ - url: '/pages/pay/pay' - }); + // orderPay: function () { + // wx.redirectTo({ + // url: '/pages/pay/pay' + // }); + // }, + + //券绑定卡 + bindCoupon: function () { + var that = this + // ETCP + for(let car of that.data.carList){ + if (car.stopFee.remainingFee){ + that.data.payList.push(car) + console.log(car) + } + } + // if (that.data.payList.length==0){ + // wx.showModal({ + // title: '提示', + // showCancel: false, + // content: "您还没有在场车辆!", + // }) + // return + // } + var etcpData = { + etcpToken: app.globalData.etcpToken, + carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber:'', + couponFreeId:5655, + merchantId: 5655, + } + console.log('--->>>'+JSON.stringify(etcpData)) + // 停简单 + var tjdData = { + carNumber: that.data.payList[0].carNumber, + } + var postCouponData = (app.globalData.parkVendor == 1) ? etcpData : tjdData + // that.setData({ + // loading: true, + // content: "正在进行车牌绑定券,请稍后...", + // }); + // wx.showToast({ + // title: '00000', + // }) + Http.post({ + url: config.api.getCoupon, + data: postCouponData, + }) + .then(res => { + that.initUsrCarList() + wx.showModal({ + title: '提示', + showCancel: false, + content: "车牌绑定优免券成功!", + success: function (res) { + console.log(res); + that.setData({ + // flag:res.data. + }) + } + }) + }) + .catch(error => { + console.log(error) + wx.showModal({ + title: '提示', + showCancel: false, + content: error.message, + success: function () { } + }) + }) + }, + + +//获取名下停车券列表 + getList() { + var that = this; + console.log('1111111111111111111111.......'); + // console.log(key); + // console.log(pageNum); + if (1) { + // wx.showLoading({ + // title: "加载中" + // }); + Http.get({ + url: config.api.couponOrderList + "?type=5", + data: { + pageNum: 1, + pageSize: 8, + couponOrderStatus: 0 + } + }).then(res => { + console.log('>>>>>>>>>>>>>>Res'+JSON.stringify(res)) + that.setData({ + couponList: res.data.list + }) + console.log("姐姐的订单列表"); + setTimeout(function () { + wx.hideLoading(); + }, 1200); + // if (pageNum >= res.data.pages) { + // that.setData({ + // allow_load: false + // }); + // } + /** + * 先赋值后渲染页面 + * concat 不会改变原数组值 + * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 + */ + // that.data.list = that.data.list.concat(res.data.list); + // that.setData({ + // list: that.data.list + // }); + }); + } else { + console.log("加载完成allow_load设置成false"); + } }, + bindCar: function (carNum) { var that = this // ETCP diff --git a/pages/passCar/passCar.wxml b/pages/passCar/passCar.wxml index 613822e..8febe5c 100644 --- a/pages/passCar/passCar.wxml +++ b/pages/passCar/passCar.wxml @@ -13,11 +13,11 @@ 我的爱车 - + - + {{item.carNumber}} @@ -28,13 +28,16 @@ - 待缴金额:¥{{item.stopFee.remainingFee}} + 入场时间:{{item.stopFee.entranceTime}} - + + 待缴金额:¥{{item.stopFee.remainingFee}} + + - + - - - - 我的停车券 - - - + + + + 我的停车券 + + + + - - - + + + + + + \ No newline at end of file diff --git a/pages/passCar/passCar.wxss b/pages/passCar/passCar.wxss index 3c34d5a..29de3ee 100644 --- a/pages/passCar/passCar.wxss +++ b/pages/passCar/passCar.wxss @@ -63,12 +63,14 @@ color: transparent; } .carNumber{ - padding: 50rpx; - height: 50rpx; - line-height: 50rpx; - font-size: 28rpx; - color: #cbcbcb; - background-color: white; + height:50rpx; + line-height:50rpx; + font-size:50rpx; + color:#cbcbcb; + background-color:white; + text-align:right; + margin:0 0 0 440rpx; + font-weight:800; } .addBox{ width: 750rpx; @@ -92,7 +94,7 @@ color: transparent; } .bottonBox{ width: 750rpx; - margin-top: 26rpx; + margin-top: 50rpx; } .textStyle{ background-color: white; @@ -121,11 +123,10 @@ color: transparent; } .passNumber{ width: 400rpx; - height: 150rpx; - + height: 100rpx; font-size: 32rpx; font-weight: 600; - line-height: 150rpx; + line-height: 100rpx; left: 55rpx; position: absolute; } @@ -149,6 +150,12 @@ color: transparent; right: 30rpx; position: absolute; transform: translate(0,-50%); + color: white; + background-color: #00c0ff!important; + +} +.deleteButton button{ + background-color: #00c0ff!important; } .detail{ width: 32rpx; @@ -167,37 +174,39 @@ color: transparent; .voucher{ width: 90%; padding: 0 5%; - background-color: rgb(255, 178, 50); + background-color: #fff; /* background-color: #cbcbcb; */ height: 80rpx; position: relative; - margin: 24rpx 0; + margin: 0 0 12rpx 0; border-bottom: 2rpx #fff solid; display: flex; justify-content: space-between; - } .textV1,.textV2{ height: 58rpx; - width: 225rpx; + width: 100rpx; padding-top: 22rpx; text-align: center; line-height: 80rxp; font-size: 28rpx; - color: #fff; + color: #333; } .textV2{ margin-top: -1rpx; padding: 0; /* background-color: rgb(0, 192, 255); */ border-radius: 10rpx; - width: 221rpx; + width: 300rpx; height: 80rpx; line-height: 80rpx; - font-size: 36rpx; + font-size: 28rpx; border: 4rpx #fff solid; margin-bottom: 22rpx; } +.textV3{ + width: 225rpx; +} /* .textV1{ position: absolute; left: 10rpx; @@ -235,7 +244,7 @@ color: transparent; background: #00c0ff; height: 88rpx; width: 98%; - margin: 30rpx auto; + margin: 0 auto; color: #fff; font-size: 36rpx; line-height: 88rpx; @@ -256,11 +265,11 @@ color: transparent; .passUp { width: 100%; - height: 150rpx; + height: 100rpx; position: relative; } .priceBox{ - width: 500rpx; + width: 420rpx; } .priceBox text{ margin-top: 35rpx; @@ -289,3 +298,20 @@ input{ button::after{ border:none; } +.right{ + width: 328rpx; +} +.textRight{ + margin-left: 0; + margin-right: 25rpx; + text-align: right; + font-size: 30rpx!important; + color: red!important; +} +.buyBox{ + width: 750rpx; + height: 88rpx; + position:absolute; + left: 0; + top: 0; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index e71147c..d7c39ff 100644 --- a/project.config.json +++ b/project.config.json @@ -1,5 +1,5 @@ { - "description": "项目配置文件。", + "description": "项目配置文件", "packOptions": { "ignore": [] }, @@ -11,9 +11,9 @@ "newFeature": true }, "compileType": "miniprogram", - "libVersion": "2.2.4", + "libVersion": "2.2.5", "appid": "wxb11603577a84a86d", - "projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2%E6%B5%8B%E8%AF%95", + "projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2", "isGameTourist": false, "condition": { "search": {