| @@ -27,7 +27,7 @@ | |||
| <i-button i-class="coupons-btn-gm" wx:if="{{data.salePriceStr==0&&data.remainInventory!=0}}" data-date='{{data}}'>免费领</i-button> | |||
| <i-button i-class="coupons-btn-gm" wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}" data-date='{{data}}'>马上购</i-button> | |||
| <i-button i-class="coupons-btn-gms" wx:if="{{data.remainInventory==0}}" data-date='{{data}}'>已售罄</i-button> | |||
| <i-button i-class="coupons-btn-gms" wx:if="{{data.status==1}}" data-date='{{data}}' disabled>已下架</i-button> | |||
| <i-button i-class="coupons-btn-gms" wx:if="{{data.status==1}}" data-date='{{data}}'>已下架</i-button> | |||
| </view> | |||
| <view class="coupons-info-name sy">剩余{{data.remainInventory}}</view> | |||
| <view class="coupons-border"></view> | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| }); | |||
| @@ -5,6 +5,10 @@ | |||
| <image src='{{data.coverImg}}'></image> | |||
| </view> | |||
| <view class='coupons_info'> | |||
| <view class='fenxiang'> | |||
| <image class="fenxiang" src='./../../../assets/img/fenxiang.png' mode="widthFix"></image> | |||
| <button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||
| </view> | |||
| <view> | |||
| <text class='title'>{{data.title}}</text> | |||
| <text class="subTitle">{{data.subTitle}}</text> | |||
| @@ -16,19 +20,24 @@ | |||
| </view> | |||
| <text class="restNum fr">剩余<text>{{data.remainInventory}}件</text></text> | |||
| </view> | |||
| <view class='rest' wx:if="{{data.endTime!=undefined&&data.endTime>=0&&data.type!=5}}"> | |||
| <view class='rest' wx:if="{{data.targetAd==2&&data.endTime!=undefined&&data.type!=5}}"> | |||
| <text class='txt01'>距结束:</text> | |||
| <text class='time'>{{endtime}}</text> | |||
| </view> | |||
| <view class="rest" wx:if="{{data.endTime!=undefined&&0>=data.endTime&&data.type!=5}}">剩余时间: | |||
| <text class='time'>即将到期</text> | |||
| <view class='rest' wx:if="{{data.validType==2}}">有效期:自领取之日起 | |||
| <text class='time'>{{validDays}}</text>天内有效</view> | |||
| <view class='rest' wx:if="{{data.validType==1}}">有效期: | |||
| <text class='time'>{{validStartDate}}至{{validEndDate}}</text> | |||
| </view> | |||
| <view class='rest' wx:if="{{data.endTime==undefined}}">自领取之日起 | |||
| <text class='time'>{{data.validDays}}</text>天内有效</view> | |||
| <view class='rest' wx:if="{{data.type==5}}"> | |||
| <text class='time'>当次有效</text> | |||
| </view> | |||
| <view class='rest' wx:if="{{data.type==1}}"> | |||
| <text class='txt01'>使用条件:</text> | |||
| <text class='time'>满{{data.usePriceStr}}元可用</text> | |||
| </view> | |||
| <view class='rest'> | |||
| <text class='txt01'>限购条件:</text> | |||
| <text class='time'>每人{{data.useLimitQuantity}}张</text> | |||
| @@ -48,8 +57,6 @@ | |||
| <image bindtap='phone' class="tel" src="./../../../assets/img/tel.jpg" mode="widthFix" /> | |||
| </view> | |||
| </view> | |||
| <view class='notes'> | |||
| <view> | |||
| <text>购买须知</text> | |||
| @@ -60,9 +67,10 @@ | |||
| </view> | |||
| </view> | |||
| <view class="buy-view app-border-top"> | |||
| <button bindtap='orderFunc' hover-class='active' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}"><text class='txt'>{{data.salePriceStr}}元</text>马上购买</button> | |||
| <button bindtap='orderFunc' class='buy' wx:elif="{{data.salePriceStr==0&&data.remainInventory!=0}}">免费领取</button> | |||
| <button class='buy' wx:elif="{{data.remainInventory==0}}" style="background:#999;color: #fff;">已售罄</button> | |||
| <button class='buy' wx:elif="{{data.status==1}}" style="background:#999;color: #fff;">已下架</button> | |||
| <button bindtap='orderFunc' hover-class='active' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0&&endtime!='活动已结束'}}"> | |||
| <text class='txt'>{{data.salePriceStr}}元</text>马上购买</button> | |||
| <button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr==0&&data.remainInventory!=0&&endtime!='活动已结束'}}">免费领取</button> | |||
| <button class='buy' wx:if="{{data.remainInventory==0&&endtime!='活动已结束'}}" style="background:#999;color: #fff;">已售罄</button> | |||
| <button class='buy' wx:if="{{endtime=='活动已结束'}}" style="background:#999;color: #fff;">活动已结束</button> | |||
| </view> | |||
| </view> | |||
| @@ -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; | |||
| @@ -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) | |||
| }); | |||
| } | |||
| } | |||
| }); | |||
| @@ -1,7 +1,6 @@ | |||
| <!-- 限时抢购 查看更多对应的页面 --> | |||
| <view class='flashSale'> | |||
| <view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" | |||
| data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index"> | |||
| <view wx:for="{{list}}" wx:if="{{item.targetA!='end'}}" class='flashSaleItemWrap' wx:key="index"> | |||
| <view class='flashSaleItem'> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| @@ -13,8 +12,7 @@ | |||
| <text class='small'>{{item.subTitle}}</text> | |||
| </view> | |||
| <view class='flashSaleItemTopRBottom'> | |||
| <text class='presentPrice'><text class='sale'>售价:</text>{{item.salePriceStr}}<text class='yuan'>元</text></text> | |||
| <text class='originalPrice'>{{item.priceStr}}元</text> | |||
| <text class='presentPrice'><text class='sale'>售价:</text>{{item.salePriceStr}}<text class='yuan'>元</text></text><text class='originalPrice'>{{item.priceStr}}元</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| @@ -22,15 +20,17 @@ | |||
| <view class='flashSaleItemBottom'> | |||
| <view class='flashSaleItemBottomTop'> | |||
| <text class='remainingTime'>距结束:</text> | |||
| <text class='realRemainingTime'>{{item.endtime}}</text> | |||
| <text wx:if="{{item.flags=='end'}}" class='realRemainingTime'>活动已结束</text> | |||
| <text wx:if="{{item.flags!='end'}}" class='realRemainingTime'>{{item.endtime}}</text> | |||
| </view> | |||
| <view class='flashSaleItemBottomBottm'> | |||
| <view class="view1"> | |||
| <text class="remainingNumber">剩余:</text> | |||
| <text class='realnumber'>{{item.remainInventory}}张</text> | |||
| </view> | |||
| <view class='buy' hover-class='active' wx:if="{{item.salePriceStr!=0}}">购买</view> | |||
| <view class='buy' hover-class='active' wx:if="{{item.salePriceStr==0}}">领取</view> | |||
| <view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr!=0}}">购买</view> | |||
| <view class='buy' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" hover-class='active' wx:if="{{item.salePriceStr==0}}">领取</view> | |||
| <view class='buy' wx:if="{{item.flags=='end'}}" style='background:#999;color:#fff;border:1px solid #999;'>已结束</view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| @@ -110,7 +110,6 @@ | |||
| } | |||
| .realRemainingTime { | |||
| margin-left: 10rpx; | |||
| color: #FF4949; | |||
| font-size: 28rpx; | |||
| } | |||
| @@ -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(); | |||
| }, | |||
| /** | |||