From e2ccc8b23fc43ace6ede9160689358d9591b0623 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Mon, 15 Oct 2018 17:18:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E6=83=A0=E5=88=B8=E8=AF=A6=E6=83=85?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=86=E4=BA=AB][=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0]:=E4=BC=98=E6=83=A0=E5=88=B8=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=97=B6=E9=97=B4=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E5=88=86=E4=BA=AB=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/img/fenxiang.png | Bin 0 -> 3235 bytes components/coupons/index.wxml | 2 +- components/coupons/index.wxss | 2 +- pages/coupon/detail/index.js | 215 ++++++++++----------------------- pages/coupon/detail/index.wxml | 30 +++-- pages/coupon/detail/index.wxss | 30 ++++- pages/rushToBuy/index.js | 18 ++- pages/rushToBuy/index.wxml | 14 +-- pages/rushToBuy/index.wxss | 1 - pages/user/index.js | 42 +++---- 10 files changed, 153 insertions(+), 201 deletions(-) create mode 100644 assets/img/fenxiang.png diff --git a/assets/img/fenxiang.png b/assets/img/fenxiang.png new file mode 100644 index 0000000000000000000000000000000000000000..863fa333c5b54735a562af8e757af1f8414a8afe GIT binary patch literal 3235 zcmYjUc{CJi*nem2#xg_poybU$A~G|f$=V`H8j+>!b7jlUpqMF3WlAR7olCZB5Mw7a z^f8#`Ui;0G5*b@u*}^yXeE)pEbKdtk=l9QZ-t#=a=l8rM`zuzW!t%lZ08txjtOGX^ z{yT#F-1|Mog9(6$zYW&>dZgQO9xUzl4Y?2RRtHzQmONqW&r@ed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Bu>}A9x%F67UVr3#4CHwLxGV0pU@+h|u6P=sUcGy+214aR6=rAH!JoGzp zJI$)W@5gL+OeEeTNaEPjlIwaKV8#|;Da-ubJ3Wp|lifvvJeaxNm`D)ZX8E&JOA zMzg8!{l?+^{QN)o1q2F$Tv+&v`WQ_7$AAAl6BJL+OjQ(zsbOX{v-JQjK&+^hT><~k z-fj*I4r0!nIm4(4zzf?Xvf1qY+oR|V;&1w6D-SB+v*l)BsQy-rG@`{~G3$iUQNHqF zouHU4YgMp)w{kNa+>f$euIol5{82F|2u?n1aN#5Dwf=0{s_0h^%7hZPcVaQDAJ5~mP64`Ar;hrByV}~Y;ad@G z7@hp~?gSwP%ve}iS`L~q28d$;IMTqVG+#M3>>2ra_6LQM6i6vrEb^{BwBsJJu_PF8 zpaemP|$^8sp2d7O|MP)iBI(k70knt$=DUeJK>x9CwZM?Yw5NiU-yxAQh zNOgk_(!tRVhN^2d;Ju~?na2SMch9FMok3D*HX-x`5Yj(oEpq^4zBK-)m2zOk{d@qM Mi&wBT3-_e|1#2SncmMzZ literal 0 HcmV?d00001 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(); }, /**