From ad936ac247f55aecc8517fb4bf7cef420b9c3352 Mon Sep 17 00:00:00 2001 From: hurui Date: Mon, 29 Jul 2019 19:31:10 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=A0=8D=E4=BB=B7][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/bargainDatail/index.js | 813 ++++++++++++++++++ components/bargainDatail/index.json | 3 + components/bargainDatail/index.wxml | 80 ++ components/bargainDatail/index.wxss | 379 ++++++++ components/hot/index.js | 89 +- components/hot/index.wxml | 26 +- config/config.js | 4 + pages/bargain/bargain.js | 1 + pages/bargain/bargain.wxml | 4 +- pages/bargain/bargainDatail/bargainDatail.js | 1 + .../bargain/bargainDatail/bargainDatail.json | 4 +- .../bargain/bargainDatail/bargainDatail.wxml | 53 +- .../bargain/bargainDatail/bargainDatail.wxss | 158 ++-- pages/coupon/detail/index.js | 43 +- pages/coupon/detail/index.wxml | 10 +- pages/coupon/detail/index.wxss | 6 +- pages/spellGroup/spellGroup.wxml | 6 +- utils/imgurl.js | 4 + 18 files changed, 1533 insertions(+), 151 deletions(-) create mode 100644 components/bargainDatail/index.js create mode 100644 components/bargainDatail/index.json create mode 100644 components/bargainDatail/index.wxml create mode 100644 components/bargainDatail/index.wxss diff --git a/components/bargainDatail/index.js b/components/bargainDatail/index.js new file mode 100644 index 0000000..41c800f --- /dev/null +++ b/components/bargainDatail/index.js @@ -0,0 +1,813 @@ +var config = require("../../config/config.js"); +var app = getApp(); +const Http = require("../../utils/HttpBasics"); +const util = require("../../utils/util"); +const imgurl = require("../../utils/imgurl"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + cancelH: imgurl.cancelH.url, + bannerUrl: imgurl.banner.url, + wmhome: imgurl.wmhome.url, + wmhelp: imgurl.wmhelp.url, + wmsuccess01: imgurl.wmsuccess01.url, + fail: imgurl.fail.url, + data: null, + from: null, + day: null, + hour: null, + min: null, + sec: null, + showPage: false, + discountStatus: null, + disabled: false, + display: "block!important", + showButton1: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + let that = this; + if (options.orderId || options.orderId && options.from == 'discount') { + if (options.from) { + that.setData({ + orderId: options.orderId, + from: "discount" + }) + } else { + that.setData({ + orderId: options.orderId + }) + } + app.globalData.wmorder = options.orderId + that.pressOrderDetail(options.orderId); + } + this.getUserInfo() + }, + getUserInfo: function() { + let that = this; + // 获取用户信息 + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.setData({ + nickName: res.data.nickName, + avatarUrl: res.data.avatarUrl + }) + }) + }, + onShow: function() { + let that = this; + var todayDate = new Date().getTime(); + that.setData({ + todayDate: todayDate, + showButton1: false + }) + if (that.data.pressEndDate) { + that.countdown(that.data.pressEndDate) + } + }, + goback: function() { + wx.switchTab({ + url: '/pages/main/index', + }) + }, + /** + * 更多砍价商品 + */ + gotomore: function() { + wx.navigateTo({ + url: '/pages/bargain/bargain', + }) + }, + /** + * @param {砍价状态(1:我发起的砍价,2:未参与的砍价, 3:已参与的砍价)} orderId + */ + getPressOrderStatus: function(orderId) { + let that = this; + Http.get({ + url: config.api.getPressOrderStatus, + data: { + orderId: orderId + } + }) + .then(res => { + if (res.data.status == 1) { + that.setData({ + discountStatus: 1 + }) + } else if (res.data.status == 2) { + that.setData({ + discountStatus: 2 + }) + } else if (res.data.status == 3) { + that.setData({ + discountStatus: 3 + }) + } + wx.stopPullDownRefresh(); + }) + .catch(err => { + console.log(err) + wx.stopPullDownRefresh(); + wx.showToast({ + title: err.errMsg, + icon: "none" + }) + }) + }, + helpDiscount: function() { + let that = this; + that.pressOrderJoin(that.data.orderId); + }, + //参与砍价 + pressOrderJoin: function(orderId) { + let that = this; + Http.post({ + url: config.api.pressOrderJoin, + data: { + orderId: orderId + } + }) + .then(res => { + console.log(res); + // id 是订单号 + + that.pressOrderDetail(orderId); + }) + .catch(err => { + console.log(err) + wx.showToast({ + title: err.message, + icon: "none" + }) + }) + }, + // 订单详情 + pressOrderDetail: function(orderId) { + let that = this; + Http.get({ + url: config.api.pressOrderDetail, + data: { + orderId: orderId + } + }) + .then(res => { + console.log(res); + res.data.orderPressList.map(file => { + file.createDate = diffTime(file.createDate) + }) + that.countdown(res.data.pressEndDate); + that.setData({ + pressEndDate: res.data.pressEndDate + }) + res.data.orderPressList.map(file => { + compare(file.first); + }) + console.log(res.data.orderPressList.sort(compare('first'))) + that.setData({ + data: res.data, + already: (res.data.price / 100 - res.data.salePrice / 100 - res.data.pressCurrentValue / 100).toFixed(2), + remain: (res.data.pressCurrentValue / 100).toFixed(2), + showPage: true + }) + that.getPressOrderStatus(orderId); + }) + .catch(err => { + wx.showToast({ + title: err.message, + icon: "none" + }) + wx.stopPullDownRefresh(); + }) + }, + + setIntervalTime(end_time) { + let that = this; + var EndTime = end_time; + var NowTime = new Date().getTime(); + var total_micro_second = EndTime - NowTime || []; + // 渲染倒计时时钟 + let obj = that.dateformat(total_micro_second); + if (total_micro_second > 0) { + that.setData({ + clock: obj, + day: obj.a1, + hour: obj.b1, + min: obj.c1, + sec: obj.d1, + }) + } else { + that.setData({ + clock: "00", + day: "00", + hour: "00", + min: "00", + sec: "00", + }) + //如果倒计时结束,需要重新查询一下券的状态 + // 给getDetail一个标识 + } + total_micro_second -= 1000; + }, + countdown: function(end_time) { + let that = this; + that.setIntervalTime(end_time); + that.data.setInterval = setInterval(function() { + that.setIntervalTime(end_time); + }, 1000) + }, + + // 时间格式化输出,如11:03 25:19 每1s都会调用一次 + dateformat(micro_second) { + // 总秒数 + var second = Math.floor(micro_second / 1000); + // 天数 + var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24); + // 小时 + var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24); + // 分钟 + var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60); + // 秒 + var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60); + + // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒"; + return { + a1: day, + b1: hr, + c1: min, + d1: sec + } + }, + payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => { + let that = this; + console.log(that) + console.log(_this) + // 支付成功 + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + orderId: orderId, + status: status, + reason: reason + } + }) + .then(res => { + wx.hideLoading(); + _this.setData({ + display: "none!important", + }) + // 有价券 + if (!type && type != 'free') { + wx.navigateTo({ + url: `/pages/order/detail/index?orderId=${ + orderId + }` + }); + } else if (type == 'free') { + wx.navigateTo({ + url: `/pages/order/detail/index?orderId=${ + orderId + }` + }); + } + }) + .catch(err => { + console.log(err); + if (!type) { + setTimeout(function() { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); + }, 2000) + } + }) + }, + /** + * 按原价付款 + */ + // orderFunc1(e) { + // var that = this; + // let formId = e.detail.formId; + // that.setData({ + // showButton: true + // }) + // Http.get({ + // url: config.api.checkPhoneStatus, + // data: {} + // }) + // .then(res => { + // that.setData({ + // showButton: false + // }) + // /** + // * orderSave 下单 + // */ + // var data = { + // couponChannelId:e.currentTarget.dataset.couponchannelid, + // couponId:e.currentTarget.dataset.couponid, + // formId:formId + // } + // return Http.post({ + // url: config.api.orderSave, + // data: data + // }); + // }) + // .catch(err => { + // that.setData({ + // showButton: true + // }) + // if (err.code == 2011) { + // wx.showToast({ + // title: "商户信息没找到", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 2013) { + // wx.showToast({ + // title: "商户信息禁用", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3000) { + // wx.showToast({ + // title: "库存不足", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3001) { + // wx.showToast({ + // title: "您已超过限购", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3002) { + // wx.showToast({ + // title: "订单失败", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3003) { + // wx.showToast({ + // title: "订单不存在", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3004) { + // wx.showToast({ + // title: "订单不存在", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 4003) { + // wx.showToast({ + // title: "卡券已作废", + // image: './../../../assets/images/fail.png', + // duration: 2000, + // mask: false + // }); + // } else if (err.code == 3012) { + // wx.showModal({ + // title: '提示', + // content: "您有未支付订单进行支付", + // showCancel: false, + // success: function (res) { + // console.log(res.confirm) + // if (res.confirm) { + // } + // } + // }) + // }else if (err.code == 11005) { + // /** + // * 将值传到用户手机号授权的页面 + // * + // */ + // wx.redirectTo({ + // url: "/pages/getphoneInfo/index?couponChannelId=" + + // that.data.couponChannelId + + // "&couponId=" + + // that.data.couponId + // }); + // } else if (err.code == 11006) { + // // 用户手机已加密 + // wx.redirectTo({ + // url: "/pages/phoneinput/phoneinput?couponChannelId=" + + // that.data.couponChannelId + + // "&couponId=" + + // that.data.couponId + // }); + // } else { + // wx.showToast({ + // title: err.message, + // icon: 'none', + // duration: 2000, + // mask: false + // }); + // } + // }).then(res => { + // console.log(res); + // if (typeof(res) != "undefined") { + // let orderId = "" + res.data.id; + // that.setData({ + // orderId: orderId + // }); + // if (e.currentTarget.dataset.saleprice / 100 > 0 || e.currentTarget.dataset.price / 100 > 0) { + // /** + // * 支付订单创建 + // */ + // Http.post({ + // url: config.api.payOrderCreate, + // data: { + // orderId: orderId + // } + // }) + // .then(res => { + // var payOrderId = "" + res.data.payOrderId; + // wx.hideLoading(); + // wx.requestPayment({ + // timeStamp: res.data.timeStamp, + // nonceStr: res.data.nonceStr, + // package: res.data.package, + // signType: (res.data.signType) ? res.data.signType : "MD5", + // paySign: res.data.paySign, + // success: res => { + // wx.showLoading({ + // title: '订单正在处理中...', + // }) + // setTimeout(function() { + // wx.hideLoading() + // }, 5000) + // that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); + // if (res.errMsg == "requestPayment:ok") { + // setTimeout(function() { + // wx.hideLoading(); + // }, 2000); + // /** + // * 用户支付成功以后跳转到券包列表 + // */ + // if (that.data.cardType == 100) { + // wx.setStorage({ + // key: 'couponNum2', + // data: "couponNum2" + // }) + // } else { + // wx.setStorage({ + // key: 'couponNum', + // data: "couponNum" + // }) + // } + // } + // }, + // fail: res => { + // /** + // * 支付失败,需要更新订单的状态 + // */ + // that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that); + // that.setData({ + // showbutton: false + // }) + // return; + // }, + // complete: res => {} + // }); + // /// End payment -------- + // }) + // .catch(err => { + // console.log(err); + // wx.showToast({ + // title: err.message, + // icon: 'none', + // duration: 2000, + // mask: false + // }); + // }) + // } else { + // // 免费券 + // that.payOrderUpdate(orderId, "0", 1, '', 'free', that); + // if (that.data.cardType == 100) { + // wx.setStorage({ + // key: 'couponNum2', + // data: "couponNum2" + // }) + // } else { + // wx.setStorage({ + // key: 'couponNum', + // data: "couponNum" + // }) + // } + // } + // } + // }) + // }, + /** + * 发起支付 + */ + orderFunc(e) { + var that = this; + that.setData({ + showButton1: true + }) + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + that.setData({ + showButton1: false + }) + if (typeof(res) != "undefined") { + let orderId = "" + e.currentTarget.dataset.orderid; + that.setData({ + orderId: orderId + }); + if (e.currentTarget.dataset.saleprice / 100 > 0 || e.currentTarget.dataset.price / 100 > 0) { + /** + * 支付订单创建 + */ + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: orderId + } + }) + .then(res => { + var payOrderId = "" + res.data.payOrderId; + wx.hideLoading(); + wx.requestPayment({ + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: (res.data.signType) ? res.data.signType : "MD5", + paySign: res.data.paySign, + success: res => { + wx.showLoading({ + title: '订单正在处理中...', + }) + setTimeout(function() { + wx.hideLoading() + }, 5000) + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); + if (res.errMsg == "requestPayment:ok") { + setTimeout(function() { + wx.hideLoading(); + }, 2000); + /** + * 用户支付成功以后跳转到券包列表 + */ + if (that.data.cardType == 100) { + wx.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else { + wx.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + }, + fail: res => { + /** + * 支付失败,需要更新订单的状态 + */ + that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that); + that.setData({ + showbutton1: false + }) + return; + }, + complete: res => {} + }); + /// End payment -------- + }) + .catch(err => { + console.log(err); + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } else { + // 免费券 + that.payOrderUpdate(orderId, "0", 1, '', 'free', that); + if (that.data.cardType == 100) { + wx.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else { + wx.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + } + }) + .catch(err => { + that.setData({ + showButton1: true + }) + if (err.code == 2011) { + wx.showToast({ + title: "商户信息没找到", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 2013) { + wx.showToast({ + title: "商户信息禁用", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3000) { + wx.showToast({ + title: "库存不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3001) { + wx.showToast({ + title: "您已超过限购", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3002) { + wx.showToast({ + title: "订单失败", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3003) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3004) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 4003) { + wx.showToast({ + title: "卡券已作废", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3012) { + wx.showModal({ + title: '提示', + content: '您有未支付订单,请先进行支付', + confirmText: "去支付", + success: function (res) { + console.log(res.confirm) + if (res.confirm) { + wx.navigateTo({ + url: '/pages/order/index/index?id=all', + }) + } + } + }) + }else if (err.code == 11005) { + /** + * 将值传到用户手机号授权的页面 + * + */ + wx.redirectTo({ + url: "/pages/getphoneInfo/index?couponChannelId=" + + that.data.couponChannelId + + "&couponId=" + + that.data.couponId + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: "/pages/phoneinput/phoneinput?couponChannelId=" + + that.data.couponChannelId + + "&couponId=" + + that.data.couponId + }); + } else { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }, + onUnload: function() { + let that = this; + clearInterval(that.data.setInterval) + }, + onHide: function() { + let that = this; + clearInterval(that.data.setInterval) + }, + /** + * + * @param {朋友邀请砍价} e + */ + barginAgain: function(e) { + let that = this; + let couponChannelId = e.currentTarget.dataset.couponchannelid; + let couponId = e.currentTarget.dataset.couponid; + wx.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, + }) + }, + /** + * 刷新 + */ + onPullDownRefresh: function(e) { + let that = this; + console.log(app.globalData.wmorder); + if (app.globalData.wmorder) { + that.pressOrderDetail(app.globalData.wmorder); + } + }, + onShareAppMessage: function(options) { + var that = this; + var shareObj = { + title: that.data.nickName + '邀请您帮砍' + that.data.data.title, + path: `/pages/index/index?orderId=${that.data.data.id}&from=${"discount"}`, + success: function(res) { + if (res.errMsg == 'shareAppMessage:ok') {} + }, + fail: function(error) { + if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} + } + }; + // 来自页面内的按钮的转发 + if (options.from == 'button') { + var orderId = options.target.dataset.orderid; + shareObj.path = `/pages/index/index?orderId=${orderId}&from=${"discount"}`; + } + // 返回shareObj + return shareObj; + }, +}) + +function diffTime(startDate) { + var diff = new Date().getTime() - startDate; + var days = Math.floor(diff / (24 * 3600 * 1000)); + var leave1 = diff % (24 * 3600 * 1000); + var hours = Math.floor(leave1 / (3600 * 1000)); + var leave2 = leave1 % (3600 * 1000); + var minutes = Math.floor(leave2 / (60 * 1000)); + var leave3 = leave2 % (60 * 1000); + var seconds = Math.round(leave3 / 1000); + + var returnStr = seconds + "秒"; + if (minutes > 0) { + returnStr = minutes + "分" + returnStr; + } + if (hours > 0) { + returnStr = hours + "小时" + returnStr; + } + if (days > 0) { + returnStr = days + "天" + returnStr; + } + + if (returnStr.indexOf('-1') == -1) { + return returnStr; + } else { + return '1秒' + } +} + +function compare(property) { + return function(a, b) { + var value1 = a[property]; + var value2 = b[property]; + return value2 - value1; + } +} \ No newline at end of file diff --git a/components/bargainDatail/index.json b/components/bargainDatail/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/bargainDatail/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/bargainDatail/index.wxml b/components/bargainDatail/index.wxml new file mode 100644 index 0000000..b4ef481 --- /dev/null +++ b/components/bargainDatail/index.wxml @@ -0,0 +1,80 @@ + + + + + + + + + + + {{data.title}} + + + 可砍至{{data.salePrice/100}} + + + + + + 已砍 {{already}}元 + 还剩 {{remain}}元 + + + 还剩 {{day}}天:{{hour}}:{{min}}:{{sec}} 结束 + + 砍价已取消 + + + 好友的砍价已过期 + + + 您的砍价已过期 + + + + + + + + + + 已砍至底价 + + + + + + + + + + 砍价人数{{data.orderPressList.length}}/{{data.pressLimitNum}}人 + + + + + + + + {{item.nickName}} + 砍掉{{item.pressValue/100}}元 + {{item.createDate}}前 + + + + + +
+ + + + +
+ + + +
\ No newline at end of file diff --git a/components/bargainDatail/index.wxss b/components/bargainDatail/index.wxss new file mode 100644 index 0000000..abefd28 --- /dev/null +++ b/components/bargainDatail/index.wxss @@ -0,0 +1,379 @@ +page{ + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + overflow: hidden; + /* z-index: 10000; */ + color: #fff; +} +.cancleH{ + width: 60rpx; + height: 120rpx; + position: absolute; + right: 92rpx; + top: 60rpx; +} +.cancleH image{ + width: 60rpx; + height: 60rpx; + /* margin-top: 20rpx; */ +} +.line{ + height: 50rpx; + width: 4rpx; + background:#ccc; + margin: 0 auto; +} +.bargainDetail { + padding: 0 33rpx 0; +} + +.progress .fl { + /* width: 150rpx; */ + height: 60rpx; + border-radius:16rpx; + color: #FFF; +} +.listitem .icon { + width: 140rpx; + height: 116rpx; + position: absolute; + top: 12rpx; + right: 0; +} +.title{ + display: block; + font-size: 30rpx; + color: #fff; + height: 40rpx; + line-height: 40rpx; + padding-top: 20rpx; +} +.help{ + display: block; + text-align: center; + font-size: 28rpx; + height: 40rpx; + line-height: 40rpx; + margin-top: 47rpx; +} +.help text{ + color: red; +} +.listitem .ri { + margin-left: 26rpx; + width: 305rpx; +} + +.ri text { + display: block; + text-align: left; +} + +.ri .txt01 { + width: 100%; + color: #FFF; + line-height: 32rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + margin-top: 12rpx; +} + +.ri .txt02 { + width: 100%; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: 24rpx; + color: rgba(140, 140, 140, 1); +} + +.ri .txt03 { + width: 100%; + font-size: 24rpx; + text-decoration: line-through; + color: rgba(140, 140, 140, 1); +} + +.ri .txt04 { + width: 100%; + font-size: 24rpx; + color: #FFF; + line-height: 44rpx; + margin-top: 16rpx; +} + +.money { + display: inline-block !important; + font-size: 50rpx; + font-weight: 500; + color: #FFF; +} + +.listitem { + width: 538rpx; + height: 624rpx; + position: relative; + padding: 60rpx 40rpx; + border-radius: 15rpx; + background: linear-gradient(160deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + margin: 170rpx auto 30rpx; + display: flex; + flex-direction:column; +} +.top{ + width:548rpx; + height: 140rpx; + margin: 0 auto 20rpx; + padding: 0 20rpx; +} +.top image{ + width:120rpx; + height:120rpx; + border-radius:16rpx; + float: left; +} +.top tit{ + margin-left:26rpx; + width:305rpx; +} +.progress { + width: 519rpx; + height: 170rpx; + margin: 0 auto; +} + +.progesstext>text { + font-size: 24rpx; + color: #FFF; +} + +.progesstext text text { + color: #FFF; +} + +.time { + margin-top: 20rpx; + font-size: 24rpx; + color: #FFF; + text-align:center; +} + +.time text { + font-size: 30rpx; + color: #FD832D; + display: inline-block; + width: 40rpx; + text-align: center; + height: 40rpx; + line-height: 40rpx; + background: #FFF; + border-radius: 10rpx; + margin: 0 4px; +} +.head{ + width:52rpx; + height: 52rpx; + position: relative; + float: left +} +.head image{ + width: 52rpx; + height: 52rpx; + border-radius:26rpx; +} +.head text{ + width: 70rpx; + position: absolute; + bottom: 0; + left: 0; + right: 0; + font-size: 20rpx; + background: #ED3F2E; + color: #fff; + text-align: center; + border-radius: 20rpx; +} +.text{ + width: 85%; + padding-left: 3%; + display: inline-block; + height: 52rpx; + line-height: 52rpx; + font-size: 26rpx; +} +.text01{ + width: 70rpx; + margin-right: 6rpx; +} +.text01 text{ + width: 100rpx; + float: left; + height: 52rpx; + line-height: 52rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.text02{ + display: inline-block; +} +.text02 .fl{ + color: #FFF!important; +} +.text03{ + /* width: 180rpx; */ + text-align: right; + font-size:24rpx; + height: 52rpx; + line-height: 52rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.person{ + /* border-bottom: 1px solid #F0CDB3; */ + padding-bottom: 31rpx; + padding-top: 31rpx; + color: #fff; +} +.text02 text:nth-of-type(2){ + color: #FF3535; + text-align: left; +} +.people{ + border-radius:16rpx; + padding:0 20rpx; +} +.btns{ + padding:33rpx; + position: fixed; + left: 0; + right: 0; + bottom: 100rpx; + z-index: 100; + /* background: #fff; */ +} +.btns button{ + width: 500rpx!important; + height: 92rpx; + border-radius:32rpx; + text-align: center; + margin: 0 auto; + font-size: 32rpx; + color: #fff; + line-height: 92rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + /* box-shadow:0px 8px 8px 1px rgba(204,26,13,0.32); */ +} +.goback{ + position: fixed; + right: 50rpx; + top: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} +.helpDiscount{ + display: block; + width: 200rpx; + height: 200rpx; + border-radius:50%; + font-size: 26rpx; + text-align: center; + line-height: 200rpx; + margin: 30rpx auto 0; + color: #fff!important; +} +.helpDiscount image{ + display: block; + width: 200rpx; + height: 200rpx; +} +.helpDiscount::after{ border: none; } +.success{ + margin-top: 50rpx; +} +.success image{ + display: block; + width: 74rpx; + height: 74rpx; + margin: 0 auto; +} +.success text{ + display: block; + text-align: center; + font-size:30rpx; + line-height: 30rpx; + color:rgba(51,51,51,1); +} +.btns01{ + position: fixed; + left: 0; + right: 0; + bottom: 0; + padding: 30rpx 0; +} +.btns01 button{ + color:rgba(254,254,254,1); + width:650rpx; + height:85rpx; + line-height: 85rpx; + background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); + box-shadow:0px 8px 8px 1px rgba(246,93,51,0.32); + border-radius:43rpx; +} +.fail{ + height:166rpx; + background:rgba(226,226,226,1); + border-radius:10rpx; + font-size:30rpx; + text-align: center; + line-height: 166rpx; + color:rgba(51,51,51,1); + margin: 20rpx auto 0; +} +.status{ + width: 520rpx; + margin: 40rpx auto 0; +} +.status button{ + display: block; + width: 520rpx; + height: 95rpx; + line-height: 95rpx; + text-align: center; + border: none; +} +button::after{ border: none; } +.status button:nth-of-type(1){ + background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); + border:1px solid rgba(236,59,45,1); + border-radius:48rpx; + margin-bottom: 38rpx; + color: #fff; +} +.status button:nth-of-type(2){ + background:#fff; + border:1px solid rgba(190,190,190,1); + border-radius:48rpx; + color: #333; +} \ No newline at end of file diff --git a/components/hot/index.js b/components/hot/index.js index 97ce405..11af71b 100644 --- a/components/hot/index.js +++ b/components/hot/index.js @@ -21,11 +21,10 @@ Component({ jianUrl: imgurl.jian.url, barginicon: imgurl.barginicon.url, wangmeimeibargin: imgurl.wangmeimeibargin.url, - list: [], - pintuanList:[], - total: '', - flag:false, - page:1, + kData:[], + pData:[], + couponId:'', + couponId1: '', }, /** * 组件的方法列表 @@ -34,17 +33,15 @@ Component({ //获取砍价列表 getList() { let that = this; + let param ={ + targetAd: 6, + } Http.get({ - url: config.api.couponChannelList, - data: { - pageNum: this.data.page++, - pageSize: 1, - targetAd: 6 - } + url: config.api.change, + data:param, }).then(res => { that.setData({ - list: res.data.list, - total: res.data.total + kData:res.data }); }) .catch(err => { @@ -59,20 +56,18 @@ Component({ }, //获取拼团列表 getptList() { + let param1 = { + targetAd: 7, + } Http.get({ - url: config.api.couponChannelList, - data: { - pageNum: this.data.page++, - pageSize: 1, - targetAd: 7 - }, + url: config.api.change, + data: param1, }).then(res => { this.setData({ - pintuanList: res.data.list, - total: res.data.total, - flag: true + pData:res.data, + couponId: res.data.couponId }); - console.log(this.data.pintuanList) + console.log( this.data.couponId) }) .catch(err => { wx.showToast({ @@ -82,11 +77,53 @@ Component({ mask: false }); }) + }, - // //换一换 + // 换一换 getChange(){ - - + let param1 = { + targetAd: 7, + couponId: this.data.couponId1 + } + Http.get({ + url: config.api.change, + data: param1, + }).then(res => { + this.setData({ + pData: res.data, + couponId1: res.data.couponId + }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + let param = { + targetAd: 6, + couponId: this.data.couponId + } + Http.get({ + url: config.api.change, + data: param, + }).then(res => { + this.setData({ + kData: res.data, + couponId: res.data.couponId + }); + }) + .catch(err => { + console.log(err) + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, //跳转砍价详情 gotokjdetail: function (e) { diff --git a/components/hot/index.wxml b/components/hot/index.wxml index a330e8c..b7f1b8f 100644 --- a/components/hot/index.wxml +++ b/components/hot/index.wxml @@ -5,7 +5,7 @@ 爆款专区 - + 换一换 @@ -13,18 +13,18 @@ - + - + - {{list[0].title}} - ¥{{list[0].priceStr}} - {{list[0].salePriceStr}} + {{kData.title}} + ¥{{kData.priceStr}} + {{kData.salePriceStr}} 砍价 - + @@ -35,18 +35,18 @@ - + - + - {{pintuanList[0].title}} - ¥{{pintuanList[0].priceStr}} - {{pintuanList[0].salePriceStr}} + {{pData.title}} + ¥{{pData.priceStr}} + {{pData.salePriceStr}} 拼团 - + diff --git a/config/config.js b/config/config.js index f8864bf..480214f 100755 --- a/config/config.js +++ b/config/config.js @@ -48,6 +48,10 @@ var config = { * 频道查询 */ couponChannelList: "/wxCouponChannel/list", + /** + * 换一换change + */ + change: "/wxCouponChannel/change", /** * 下订单 */ diff --git a/pages/bargain/bargain.js b/pages/bargain/bargain.js index f340a66..ec22719 100644 --- a/pages/bargain/bargain.js +++ b/pages/bargain/bargain.js @@ -6,6 +6,7 @@ Page({ * 页面的初始数据 */ data: { + noCoupon: imgurl.noCoupon.url, orangeImg: imgurl.orange.url, blueImg: imgurl.blue.url, grayImg: imgurl.gray.url, diff --git a/pages/bargain/bargain.wxml b/pages/bargain/bargain.wxml index 2d0b08d..ce8c842 100644 --- a/pages/bargain/bargain.wxml +++ b/pages/bargain/bargain.wxml @@ -73,11 +73,11 @@ - + 暂无数据 - + 暂无数据 diff --git a/pages/bargain/bargainDatail/bargainDatail.js b/pages/bargain/bargainDatail/bargainDatail.js index f30f6c0..21303f2 100644 --- a/pages/bargain/bargainDatail/bargainDatail.js +++ b/pages/bargain/bargainDatail/bargainDatail.js @@ -9,6 +9,7 @@ Page({ * 页面的初始数据 */ data: { + cancelH: imgurl.cancelH.url, bannerUrl: imgurl.banner.url, wmhome: imgurl.wmhome.url, wmhelp: imgurl.wmhelp.url, diff --git a/pages/bargain/bargainDatail/bargainDatail.json b/pages/bargain/bargainDatail/bargainDatail.json index 6a4e232..05cc4b3 100644 --- a/pages/bargain/bargainDatail/bargainDatail.json +++ b/pages/bargain/bargainDatail/bargainDatail.json @@ -1,6 +1,6 @@ { "navigationBarTitleText": "砍价详情", - "navigationBarBackgroundColor":"#FF6F03", - "navigationBarTextStyle": "white", + "navigationBarBackgroundColor":"#F4F5F9", + "navigationBarTextStyle": "black", "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/bargain/bargainDatail/bargainDatail.wxml b/pages/bargain/bargainDatail/bargainDatail.wxml index ebd0995..b4ef481 100644 --- a/pages/bargain/bargainDatail/bargainDatail.wxml +++ b/pages/bargain/bargainDatail/bargainDatail.wxml @@ -1,23 +1,27 @@ - + + + + + - + + {{data.title}} - {{data.subTitle}} - {{data.price/100}}元 + + 可砍至{{data.salePrice/100}} - - + + + - 已砍 {{already}}元 - 还剩 {{remain}}元 + 已砍 {{already}}元 + 还剩 {{remain}}元 - - - 还剩 {{day}}天:{{hour}}:{{min}}:{{sec}} 结束 - + + 还剩 {{day}}天:{{hour}}:{{min}}:{{sec}} 结束 砍价已取消 @@ -31,26 +35,26 @@ - 还需邀请{{data.pressLimitNum-data.orderPressList.length}}位好友,帮忙砍至底价 + - - - 已砍至底价 - - - - + + + 已砍至底价 + + + + + - - + 砍价人数{{data.orderPressList.length}}/{{data.pressLimitNum}}人 - + - 发起人 + {{item.nickName}} @@ -58,6 +62,7 @@ {{item.createDate}}前 +
diff --git a/pages/bargain/bargainDatail/bargainDatail.wxss b/pages/bargain/bargainDatail/bargainDatail.wxss index c073a9a..abefd28 100644 --- a/pages/bargain/bargainDatail/bargainDatail.wxss +++ b/pages/bargain/bargainDatail/bargainDatail.wxss @@ -1,21 +1,42 @@ page{ - height: auto; - overflow: auto; - background: #FF6F03; - background-image: url('https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/bargindetailbg.jpg'); - background-size: cover; - background-repeat: no-repeat; + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + overflow: hidden; + /* z-index: 10000; */ + color: #fff; +} +.cancleH{ + width: 60rpx; + height: 120rpx; + position: absolute; + right: 92rpx; + top: 60rpx; +} +.cancleH image{ + width: 60rpx; + height: 60rpx; + /* margin-top: 20rpx; */ +} +.line{ + height: 50rpx; + width: 4rpx; + background:#ccc; + margin: 0 auto; } .bargainDetail { - padding: 0 33rpx 0; + padding: 0 33rpx 0; } -.listitem .fl { - width: 180rpx; - height: 180rpx; - border-radius:10rpx; +.progress .fl { + /* width: 150rpx; */ + height: 60rpx; + border-radius:16rpx; + color: #FFF; } - .listitem .icon { width: 140rpx; height: 116rpx; @@ -26,7 +47,7 @@ page{ .title{ display: block; font-size: 30rpx; - color: #333; + color: #fff; height: 40rpx; line-height: 40rpx; padding-top: 20rpx; @@ -54,11 +75,12 @@ page{ .ri .txt01 { width: 100%; - color: rgba(51, 51, 51, 1); - line-height: 44rpx; + color: #FFF; + line-height: 32rpx; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; + margin-top: 12rpx; } .ri .txt02 { @@ -80,75 +102,89 @@ page{ .ri .txt04 { width: 100%; font-size: 24rpx; - color: rgba(255, 50, 50, 1); + color: #FFF; line-height: 44rpx; + margin-top: 16rpx; } .money { display: inline-block !important; font-size: 50rpx; font-weight: 500; - color: rgba(255, 50, 50, 1); + color: #FFF; } .listitem { + width: 538rpx; + height: 624rpx; position: relative; - padding: 31rpx 20rpx; + padding: 60rpx 40rpx; border-radius: 15rpx; - background: #fff; - margin-bottom: 30rpx; - margin-top:20rpx; + background: linear-gradient(160deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + margin: 170rpx auto 30rpx; + display: flex; + flex-direction:column; +} +.top{ + width:548rpx; + height: 140rpx; + margin: 0 auto 20rpx; + padding: 0 20rpx; +} +.top image{ + width:120rpx; + height:120rpx; + border-radius:16rpx; + float: left; +} +.top tit{ + margin-left:26rpx; + width:305rpx; } - .progress { width: 519rpx; - padding: 30rpx 84rpx; - /* height: 136rpx; */ - background: #fff; - border-radius: 15rpx; + height: 170rpx; margin: 0 auto; } -.progesstext { - margin-bottom: 13rpx; -} - .progesstext>text { font-size: 24rpx; - color: rgba(51, 51, 51, 1); + color: #FFF; } .progesstext text text { - color: #FF3535; + color: #FFF; } .time { margin-top: 20rpx; font-size: 24rpx; - color: #333; + color: #FFF; text-align:center; } .time text { font-size: 30rpx; - color: #fff; + color: #FD832D; display: inline-block; width: 40rpx; text-align: center; height: 40rpx; line-height: 40rpx; - background: rgba(51, 51, 51, 1); + background: #FFF; border-radius: 10rpx; margin: 0 4px; } .head{ - width:10%; - height: 90rpx; + width:52rpx; + height: 52rpx; position: relative; + float: left } .head image{ - width: 70rpx; - border-radius:10rpx; + width: 52rpx; + height: 52rpx; + border-radius:26rpx; } .head text{ width: 70rpx; @@ -163,24 +199,22 @@ page{ border-radius: 20rpx; } .text{ - width: 87%; + width: 85%; padding-left: 3%; display: inline-block; - height: 90rpx; - line-height: 90rpx; + height: 52rpx; + line-height: 52rpx; font-size: 26rpx; } .text01{ - width: 100rpx; + width: 70rpx; margin-right: 6rpx; - height: 76rpx; - line-height: 76rpx; } .text01 text{ width: 100rpx; float: left; - height: 90rpx; - line-height: 90rpx; + height: 52rpx; + line-height: 52rpx; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; @@ -188,20 +222,25 @@ page{ .text02{ display: inline-block; } +.text02 .fl{ + color: #FFF!important; +} .text03{ - width: 240rpx; + /* width: 180rpx; */ text-align: right; font-size:24rpx; - height: 76rpx; - line-height: 76rpx; + height: 52rpx; + line-height: 52rpx; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } + .person{ - border-bottom: 1px solid #F0CDB3; + /* border-bottom: 1px solid #F0CDB3; */ padding-bottom: 31rpx; padding-top: 31rpx; + color: #fff; } .text02 text:nth-of-type(2){ color: #FF3535; @@ -209,31 +248,28 @@ page{ } .people{ border-radius:16rpx; - background: #FFEADA; - margin-top: 30rpx; padding:0 20rpx; - margin-bottom: 165rpx; } .btns{ padding:33rpx; position: fixed; left: 0; right: 0; - bottom: 0; + bottom: 100rpx; z-index: 100; /* background: #fff; */ } .btns button{ width: 500rpx!important; - height: 95rpx; - border-radius:48rpx; + height: 92rpx; + border-radius:32rpx; text-align: center; margin: 0 auto; - font-size: 30rpx; + font-size: 32rpx; color: #fff; - line-height: 95rpx; - background:linear-gradient(90deg,rgba(229,54,40,1) 0%,rgba(243,75,30,1) 99%); - box-shadow:0px 8px 8px 1px rgba(204,26,13,0.32); + line-height: 92rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + /* box-shadow:0px 8px 8px 1px rgba(204,26,13,0.32); */ } .goback{ position: fixed; diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 804b3bc..e2f35ff 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -5,6 +5,7 @@ const util = require("../../../utils/util"); const imgurl = require("../../../utils/imgurl"); Page({ data: { + isshowposter1: true,//是否显示发起砍价 isshowposter:false,//是否显示分享弹框 fenxiangUrl: imgurl.fenxiang.url, clockUrl: imgurl.clock.url, @@ -84,7 +85,7 @@ Page({ maxLimit:0, dispressEndDate:false }, - /** + /** * 显示分享弹框 */ showshare: function() { @@ -100,6 +101,22 @@ Page({ isshowposter: false, }) }, + /** + * 显示发起砍价 + */ + showshare1: function () { + this.setData({ + isshowposter1: true, + }) + }, + /** + * 隐藏发起砍价 + */ + hidemodal1: function () { + this.setData({ + isshowposter1: false, + }) + }, /** * 跳转到门店列表的详情页面 */ @@ -574,17 +591,17 @@ Page({ /** * 邀请好友继续砍价 */ - inviteFriend: function(e) { - let that = this; - let formId = e.detail.formId; - that.setData({ - formId: formId - }) - that.orderFunc("discount"); - that.setData({ - showbutton1: true - }) - }, + // inviteFriend: function(e) { + // let that = this; + // let formId = e.detail.formId; + // that.setData({ + // formId: formId + // }) + // that.orderFunc("discount"); + // that.setData({ + // showbutton1: true + // }) + // }, /** * 支付订单更新 */ @@ -920,7 +937,7 @@ Page({ success: function (res) { if (res.confirm) { wx.navigateTo({ - url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}`, + url: `/components/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}`, }) } } diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index 53cb0c5..6ccd833 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -45,7 +45,7 @@ {{data.title}}电子卡 {{data.subTitle}} - + {{data.salePriceStr}} {{data.creditPrice}}积分 @@ -151,11 +151,11 @@ 立即购买 -
- -
+
@@ -219,4 +219,6 @@
+ +
\ No newline at end of file diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index fbe7ada..2e0df69 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -1,7 +1,7 @@ @import "../../../app.wxss"; page { - background: #fff; + background: #F4F5F9; } button::after { @@ -740,10 +740,9 @@ button::after { } .presslimit { - width: 172rpx; + width: 300rpx; height: 34rpx; line-height: 34rpx; - background:rgba(201,201,201,0.1); margin-top: 8rpx; margin-left: 12rpx; color: #FD782D; @@ -755,6 +754,7 @@ button::after { } .presslimit text{ margin-left: 22rpx; + background:rgba(201,201,201,0.1); } checkbox-group, radio-group { diff --git a/pages/spellGroup/spellGroup.wxml b/pages/spellGroup/spellGroup.wxml index 9e61407..9938bc1 100644 --- a/pages/spellGroup/spellGroup.wxml +++ b/pages/spellGroup/spellGroup.wxml @@ -1,10 +1,10 @@ - + 暂无数据 @@ -13,7 +13,7 @@ 暂无数据 - + diff --git a/utils/imgurl.js b/utils/imgurl.js index 17de774..bc3bb55 100644 --- a/utils/imgurl.js +++ b/utils/imgurl.js @@ -661,5 +661,9 @@ module.exports = { 'url': baseUrl + "rightHr.png", 'name': '' }, + 'cancelH': { + 'url': baseUrl + "cancelH.png", + 'name': '' + }, } \ No newline at end of file