diff --git a/assets/img/fenxiang.png b/assets/img/fenxiang.png new file mode 100644 index 0000000..863fa33 Binary files /dev/null and b/assets/img/fenxiang.png differ diff --git a/components/coupons/index.wxml b/components/coupons/index.wxml index 724f24f..d404d47 100644 --- a/components/coupons/index.wxml +++ b/components/coupons/index.wxml @@ -27,7 +27,7 @@ 免费领 马上购 已售罄 - 已下架 + 已下架 剩余{{data.remainInventory}} diff --git a/components/coupons/index.wxss b/components/coupons/index.wxss index d257a41..6800b83 100644 --- a/components/coupons/index.wxss +++ b/components/coupons/index.wxss @@ -139,7 +139,7 @@ white-space: nowrap; text-overflow: ellipsis; width: 300rpx; - height: 33rpx; + /* height: 33rpx; */ line-height: 33rpx; font-weight:lighter; margin-bottom: 18rpx; diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index fd43320..69dad70 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -12,7 +12,11 @@ Page({ orderId: "", day: "", hour: "", - minute: "" + minute: "", + tempFilePaths: '', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo') }, phone: function () { @@ -30,16 +34,10 @@ Page({ wx.showLoading({ title: "加载中..." }); - /** * 暂时注销 * this.orderFunc() */ - // if (options.flag) { - // // this.orderFunc(); - // } - // else { - // } that.setData({ couponChannelId: options.couponChannelId, couponId: options.couponId @@ -51,20 +49,33 @@ Page({ } }; Http.get(parmer).then(res => { - console.log(res); - console.log("details"); + console.log(res.data); //当前时间与优惠券下架时间做计算 var endTime = util.fmtDate(res.data.endTime); - util.timechuo(endTime); - that.setData({ - endtime: util.timechuo(endTime) - }); + if (util.timechuo(endTime).indexOf('-') == 0) { + that.setData({ + endtime: "活动已结束", + }); + } else { + that.setData({ + endtime: util.timechuo(endTime) + }); + } wx.hideLoading(); that.setData({ data: res.data }); + if (res.data.validType == 1) { + that.setData({ + validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dddd"), + validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dddd"), + }); + } else { + that.setData({ + validDays: res.data.validDays + }); + } }); - // } }, /** * 支付订单更新 @@ -82,82 +93,11 @@ Page({ }) .then(res => { console.log("payOrderUpdate then", res); - // wx.showToast({ - // title: "购买成功", - // duration: 2500 - // }); }) .catch(err => { console.log("payOrderUpdate catch", err); }); }, - /** - * 拉取车牌列表 - */ - // init: function () { - // var that = this - - // app.parkInitCallback = token => { - // that.initPark() - // that.initUsrCarList() - // if (!app.globalData.carLogin) { - // // 共同登录 - // Http.post({ - // url: config.api.carInit, - // data: { - // phone: app.globalData.phone - // } - // }).then(res => { - // app.globalData.carLogin = true - // app.globalData.parkVendor = res.data.vendor - // if (res.data.token != "undefined") { - // app.globalData.etcpToken = res.data.token - // console.log("etcpToken", app.globalData.etcpToken) - // } - // // 获取 停车费 - // that.getStopFee() - // }) - // } - // } - // if (app.globalData.token && app.globalData.token != null) { - // app.parkInitCallback(app.globalData.token) - // } - // }, - // getStopFee: function () { - // var that = this - // // carLogin - // for (var i = 0; i < that.data.carList.length; i++) { - // that.getStopFeeItem(that.data.carList[i], i) - // } - // // console.log(JSON.stringify(getStopFeeItem)) - // }, - // initPark: function () { - // var that = this - // // 车场信息获取 - // Http.get({ - // url: config.api.getParkInfo, - // data: {} - // }) - // .then(res => { - // console.log(res) - // that.setData({ - // park: res.data, - // }) - // }) - // }, - // initUsrCarList: function () { - // var that = this - // // 绑定车获取 - // Http.get({ - // url: config.api.getUserCarList, - // data: {} - // }).then(res => { - // console.log('>>>>>>>>>>>>>>>>>1' + JSON.stringify(res)); - // that.setData({ - // carList: res.data - // }) - // }) - // }, /** * 发起支付 */ @@ -166,7 +106,7 @@ Page({ wx.showLoading({ title: "加载中..." }); - if (that.data.data.type == 6) {} else { + if (that.data.data.type == 6) { } else { Http.post({ url: config.api.checkPhoneStatus, data: {} @@ -199,66 +139,56 @@ Page({ duration: 2000, mask: false }); - } - else if (err.code == "2013") { + } else if (err.code == "2013") { wx.showToast({ title: "商户信息禁用", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - else if (err.code == "3000") { + } else if (err.code == "3000") { wx.showToast({ title: "库存不足", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - else if (err.code == "3001") { + } else if (err.code == "3001") { wx.showToast({ title: "领取达到上限", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - else if (err.code == "3002") { + } else if (err.code == "3002") { wx.showToast({ title: "订单失败", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - else if (err.code == "3003") { + } else if (err.code == "3003") { wx.showToast({ title: "订单不存在", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - else if (err.code == "3004") { + } else if (err.code == "3004") { wx.showToast({ title: "订单不存在", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - - else if (err.code == "4003") { + } else if (err.code == "4003") { wx.showToast({ title: "卡券已作废", image: "./../../../assets/img/fail.png", duration: 2000, mask: false }); - } - - else if (err.code == 11005) { + } else if (err.code == 11005) { // 用户手机未授权 /** * 将值传到用户手机号授权的页面 @@ -270,8 +200,7 @@ Page({ "&couponId=" + that.data.couponId }); - } - else if (err.code == 11006) { + } else if (err.code == 11006) { // 用户手机已加密 wx.redirectTo({ url: "/pages/phoneinput/phoneinput?couponChannelId=" + @@ -322,24 +251,6 @@ Page({ that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 console.log(res); if (res.errMsg == "requestPayment:ok") { - // wx.showToast({ - // title: "购买成功", - // image: "./../../../assets/img/success.png", - // duration: 1000, - // mask: false, - // success: function () { - // setTimeout(function () { - // wx.hideLoading(); - // }, 2000); - // setTimeout(() => { - // wx.navigateTo({ - // url: `/pages/order/detail/index?orderId=${ - // that.data.orderId - // }` - // }); - // }, 1000) - // } - // }); setTimeout(function () { wx.hideLoading(); }, 2000); @@ -373,28 +284,9 @@ Page({ fail: res => { that.payOrderUpdate(that.data.orderId, payOrderId, 2); // 支付失败 console.log(res); - // wx.showToast({ - // title: "支付失败", - // image: "./../../../assets/img/fail.png", - // duration: 2000, - // mask: false - // }); return; }, complete: res => { - // console.log(res); - // console.log("支付完成"); - // if (res.errMsg == "requestPayment:ok") { - - // } else { - // wx.showToast({ - // title: "支付失败", - // image: "./../../../assets/img/fail.png", - // duration: 2000, - // mask: false - // }); - // } - // return; } }); /// End payment -------- @@ -411,15 +303,6 @@ Page({ key: 'couponNum', data: "couponNum" }) - // wx.showToast({ - // title: "领取成功", - // image: "./../../../assets/img/success.png", - // duration: 1000, - // mask: false, - // success: function () { - - // } - // }); setTimeout(function () { wx.navigateTo({ url: `/pages/order/detail/index?orderId=${ @@ -443,5 +326,33 @@ Page({ console.log("ERR", err); }); } + }, + onShareAppMessage: function (options) { + var that = this; + var shareObj = { + title: options.target.dataset.title, + path: '/pages/index/index', + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { + console.log(res) + } + }, + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { + console.log(error) + } else if (res.errMsg == 'shareAppMessage:fail') { + console.log(error) + } + } + }; + // 来自页面内的按钮的转发 + if (options.from == 'button') { + console.log(options) + var eData = options.target.dataset.id; + var couponId = options.target.dataset.couponid; + shareObj.path = `/pages/coupon/detail/index?couponChannelId=${eData}&couponId=${couponId}`; + } + // 返回shareObj + return shareObj; } }); \ No newline at end of file diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 9dd990b..0083946 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -5,6 +5,10 @@ + + + + {{data.title}} {{data.subTitle}} @@ -16,19 +20,24 @@ 剩余{{data.remainInventory}}件 - + + 距结束: {{endtime}} - 剩余时间: - 即将到期 + 有效期:自领取之日起 + {{validDays}}天内有效 + 有效期: + {{validStartDate}}至{{validEndDate}} - 自领取之日起 - {{data.validDays}}天内有效 当次有效 + + 使用条件: + 满{{data.usePriceStr}}元可用 + 限购条件: 每人{{data.useLimitQuantity}}张 @@ -48,8 +57,6 @@ - - 购买须知 @@ -60,9 +67,10 @@ - - - - + + + + \ No newline at end of file diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index 4ccfe60..7d2cecd 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -22,16 +22,42 @@ page { } .coupons_info { + position: relative; width: 92%; padding: 0 4%; background: #fff; border-top-left-radius: 20rpx; border-top-right-radius: 20rpx; margin-top: -25rpx; - position: relative; z-index: 100000000; } +.fenxiang { + position: absolute; + right: 36rpx; + top: 27rpx; + width: 77rpx; +} + +.fenxiang image { + width: 60rpx; + position: absolute; + top: 0; + right: 0; +} + +.user-motto { + width: 100%; + border: 0; + background: none; + height: 60rpx; + color: #fff; +} + +.user-motto::after { + border: none; +} + .title { display: block; font-size: 32rpx; @@ -48,7 +74,7 @@ page { .subTitle { display: block; width: 588rpx; - height: 37rpx; + /* height: 37rpx; */ font-size: 26rpx; color: #999; letter-spacing: 1.16rpx; diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index ab42924..6a479a1 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -69,7 +69,6 @@ Page({ that.setData({ list: tmpArr }) - console.log(tmpArr); for (let i = 0; i < that.data.list.length; i++) { var startTime = util.fmtDate(that.data.list[i].endTime); util.timechuo(startTime); @@ -78,10 +77,19 @@ Page({ * 修改list的endtime * 渲染到页面 */ - var endtime = 'list[' + i + '].endtime' - that.setData({ - [endtime]: util.timechuo(startTime) - }); + var endtime = 'list[' + i + '].endtime'; + var flags = 'list[' + i + '].flags'; + if (util.timechuo(startTime).indexOf('-')==0){ + that.setData({ + [flags]: "end", + [endtime]: util.timechuo(startTime) + }); + } + else{ + that.setData({ + [endtime]: util.timechuo(startTime) + }); + } } }); diff --git a/pages/rushToBuy/index.wxml b/pages/rushToBuy/index.wxml index b6a6656..29a7578 100644 --- a/pages/rushToBuy/index.wxml +++ b/pages/rushToBuy/index.wxml @@ -1,7 +1,6 @@ - + @@ -13,8 +12,7 @@ {{item.subTitle}} - 售价:{{item.salePriceStr}} - {{item.priceStr}}元 + 售价:{{item.salePriceStr}}{{item.priceStr}}元 @@ -22,15 +20,17 @@ 距结束: - {{item.endtime}} + 活动已结束 + {{item.endtime}} 剩余: {{item.remainInventory}}张 - 购买 - 领取 + 购买 + 领取 + 已结束 diff --git a/pages/rushToBuy/index.wxss b/pages/rushToBuy/index.wxss index c660294..c542f9d 100644 --- a/pages/rushToBuy/index.wxss +++ b/pages/rushToBuy/index.wxss @@ -110,7 +110,6 @@ } .realRemainingTime { - margin-left: 10rpx; color: #FF4949; font-size: 28rpx; } diff --git a/pages/user/index.js b/pages/user/index.js index 178c7d0..cabeece 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -18,26 +18,26 @@ Page({ 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 - }) - }) - } - }) - }, + // 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){ @@ -110,7 +110,7 @@ Page({ levelName: res.data.levelName }) }); - that.getrun(); + // that.getrun(); }, /**