commit 01abffc8d454621faff6c2a97eb1a5f91520eca2 Author: lihao Date: Mon Jan 8 23:00:01 2024 +0800 页面 diff --git a/pages/callback/couponSuccess.js b/pages/callback/couponSuccess.js new file mode 100644 index 0000000..c508629 --- /dev/null +++ b/pages/callback/couponSuccess.js @@ -0,0 +1,49 @@ +const util = require('../../utils/util.js'); +Page({ + + + data: { + shopName:'深圳巨为科技开发有限公司' + }, + + + onLoad: function (options) { + this.setData({ + msg:options.msg + }) + if (options.msg){ + var data = JSON.parse(options.msg); + + if (data.shopName) { + this.setData({ + shopName: data.shopName + }) + } + if (data.createDate){ + this.setData({ + createDate: data.createDate + }) + }else{ + console.error(data) + var createDate=util.formatTimeV(new Date(), "yyyy-MM-dd"); + this.setData({ + createDate: createDate + }) + } + } + + }, + + gotoIndex: function () { + wx.reLaunch({ + url: '/pages/tabbar/index', + }) + }, + onReady: function () { + + }, + + onShow: function () { + + } +}) \ No newline at end of file diff --git a/pages/callback/couponSuccess.json b/pages/callback/couponSuccess.json new file mode 100644 index 0000000..5b035b2 --- /dev/null +++ b/pages/callback/couponSuccess.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "核销成功" +} \ No newline at end of file diff --git a/pages/callback/couponSuccess.wxml b/pages/callback/couponSuccess.wxml new file mode 100644 index 0000000..c338ff0 --- /dev/null +++ b/pages/callback/couponSuccess.wxml @@ -0,0 +1,21 @@ + + + + + 核销成功 + 完成核销 + + + + + + + + 核销门店: + {{shopName}} + + + 核销时间: + {{createDate}} + + \ No newline at end of file diff --git a/pages/callback/couponSuccess.wxss b/pages/callback/couponSuccess.wxss new file mode 100644 index 0000000..314a340 --- /dev/null +++ b/pages/callback/couponSuccess.wxss @@ -0,0 +1,88 @@ +page { + background: white; +} + +.top { + display: flex; + justify-content: space-around; + align-content: center; + align-items: center; + flex-direction: column; + height: 50%; +} + +.top view { + text-align: center; +} + +.width100 { + width: 100%; +} + +.img image { + width: 100rpx; + height: 100rpx; +} + +.success { + height: 47rpx; + font-size: 50rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.ok { + width: 550rpx; + height: 86rpx; + border: 2rpx solid rgba(254, 182, 9, 1); + border-radius: 43rpx; + line-height: 86rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(254, 182, 9, 1); +} + +.fg { + width: 600rpx; + height: 1rpx; + background: rgba(238, 238, 238, 1); + margin: auto auto; +} + +.bottom { + display: flex; + flex-direction: column; + justify-content: space-around; + width: 80%; + height: 210rpx; + align-content: center; + align-items: center; + margin: auto auto; +} + +.item { + display: flex; + flex-direction: row; + justify-content: space-around; + align-content: center; + align-items: center; +} + +.itemLeft { + height: 28rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(102, 102, 102, 1); +} + +.itemRight { + width: 355rpx; + height: 28rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} diff --git a/pages/callback/paySuccess.js b/pages/callback/paySuccess.js new file mode 100644 index 0000000..19b4b7a --- /dev/null +++ b/pages/callback/paySuccess.js @@ -0,0 +1,50 @@ +const util = require('../../utils/util.js'); +Page({ + data: { + }, + onLoad: function(options) { + if (options.msg) { + this.setData({ + msg: options.msg + }) + var data = JSON.parse(options.msg); + + if (data.shopName) { + this.setData({ + shopName: data.shopName + }) + } + + if (data.realAmount) { + this.setData({ + realAmount: data.realAmount + }) + } + + if (data.shopNo) { + this.setData({ + shopNo: data.shopNo + }) + } + if (data.createDate) { + this.setData({ + createDate: data.createDate + }) + } else { + console.error(data) + var createDate = util.formatTimeV(new Date(), "yyyy-MM-dd"); + this.setData({ + createDate: createDate + }) + } + } + }, + onShow: function() { + + }, + gotoIndex: function() { + wx.reLaunch({ + url: '/pages/tabbar/index', + }) + } +}) \ No newline at end of file diff --git a/pages/callback/paySuccess.json b/pages/callback/paySuccess.json new file mode 100644 index 0000000..ef03e8f --- /dev/null +++ b/pages/callback/paySuccess.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "支付成功" +} \ No newline at end of file diff --git a/pages/callback/paySuccess.wxml b/pages/callback/paySuccess.wxml new file mode 100644 index 0000000..06c6d37 --- /dev/null +++ b/pages/callback/paySuccess.wxml @@ -0,0 +1,27 @@ + + + + + 支付成功 + ¥{{realAmount}} + 支付完成 + + + + + + + + 门店名称: + {{shopName}} + + + 支付时间: + {{createDate}} + + + 门店号: + {{shopNo}} + + + \ No newline at end of file diff --git a/pages/callback/paySuccess.wxss b/pages/callback/paySuccess.wxss new file mode 100644 index 0000000..0b4505e --- /dev/null +++ b/pages/callback/paySuccess.wxss @@ -0,0 +1,100 @@ +page { + background: white; +} + +.top { + display: flex; + justify-content: space-around; + align-content: center; + align-items: center; + flex-direction: column; + height: 50%; +} + +.top view { + text-align: center; +} + +.width100 { + width: 100%; +} + +.img image { + width: 100rpx; + height: 100rpx; +} + +.success { + width: 180rpx; + height: 34rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(153, 153, 153, 1); + margin-top: -90rpx; +} + +.ok { + width: 550rpx; + height: 86rpx; + border: 2rpx solid rgba(254, 182, 9, 1); + border-radius: 43rpx; + line-height: 86rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(254, 182, 9, 1); +} + +.fg { + width: 600rpx; + height: 1rpx; + background: rgba(238, 238, 238, 1); + margin: auto auto; +} + +.bottom { + display: flex; + flex-direction: column; + justify-content: space-around; + width: 80%; + height: 210rpx; + align-content: center; + align-items: center; + margin: auto auto; +} + +.item { + display: flex; + flex-direction: row; + justify-content: space-around; + align-content: center; + align-items: center; +} + +.itemLeft { + height: 28rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(102, 102, 102, 1); +} + +.itemRight { + width: 355rpx; + height: 28rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.money { + width: 294rpx; + height: 53rpx; + font-size: 70rpx; + font-family: PingFang-SC-Medium; + font-weight: bold; + color: rgba(51, 51, 51, 1); + margin-top: -40rpx; +} diff --git a/pages/card/card.js b/pages/card/card.js new file mode 100644 index 0000000..5ad3f90 --- /dev/null +++ b/pages/card/card.js @@ -0,0 +1,187 @@ +// pages/card/card.js +const app = getApp(); +const loginApi = require('../../utils/loginApi.js'); +const card = require('../../utils/card.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + isUpdate:false, + userInfo: {}, + memberInfo: {}, + storeInfo: {}, + mobile: wx.getStorageSync("mobile"), + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + that.data.mobile = wx.getStorageSync("mobile"); + var userInfo = wx.getStorageSync("userInfo"); + this.data.userInfo = userInfo; + var storeInfo = wx.getStorageSync("store"); + this.data.storeInfo = storeInfo; + + this.setData({ + nickName: userInfo.nickName, + avatarUrl: userInfo.avatarUrl, + cardNo: app.cardInfo.cardNo, + amount: app.cardInfo.totalAmount, + totalPoint: app.cardInfo.totalPoint, + }); + }, + + /** + * 会员卡二维码 + */ + cy_cardCode:function(){ + var url = "cardDetail"; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 我的地址 + */ + cy_clickMyAddress: function() { + var url = "../order/address/address" + wx.navigateTo({ + url: url, + }) + }, + + /** + * 我的订单 + */ + cy_clickMyOrder: function() { + var url = "../order/list/list" + wx.navigateTo({ + url: url, + }) + }, + + /** + * 会员卡充值纪录 + */ + clickRechargeRecord: function() { + var url = "recharge_record" + "?cardNo=" + app.memberInfo.cardNo; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 会员卡消费记录 + */ + clickConsumeRecord: function() { + var url = "consume_record" + "?cardNo=" + app.memberInfo.cardNo; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 会员卡去充值 + */ + clickCardRecharge: function() { + var url = "recharge" + "?cardNo=" + app.memberInfo.cardNo + "&mobile=" + app.memberInfo.mobile; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 领券中心 + */ + cy_couponCenter: function (e) { + var url = '../coupon/couponCenter'; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 查询卡信息 + */ + cy_selectCardInfo: function () { + var that = this; + var cardNo = app.memberInfo.cardNo; + card.wx_cardInfo(cardNo, function (json) { + var result = json.data; + if (result.status == 1) { + app.cardInfo = result.data; + that.setData({ + cardNo: result.data.cardNo, + }) + } else { + wx.showModal({ + title: '提示', + content: result.errMsg, + }); + } + }, function (err) { + wx.hideLoading(); + wx.showModal({ + title: '提示网络链接失败', + content: '网络链接失败', + }) + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + if(this.data.isUpdate){ + this.cy_selectCardInfo(); + } + this.data.isUpdate = true; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/card/card.json b/pages/card/card.json new file mode 100644 index 0000000..f6e470d --- /dev/null +++ b/pages/card/card.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "会员中心" +} \ No newline at end of file diff --git a/pages/card/card.wxml b/pages/card/card.wxml new file mode 100644 index 0000000..7883d18 --- /dev/null +++ b/pages/card/card.wxml @@ -0,0 +1,62 @@ + + + + + + {{nickName}} + + + + {{cardNo}} + + + + + + + + + + + + 我的地址 + + + + + 我的订单 + + + + + 充值记录 + + + + + 消费记录 + + + + + 去充值 + + + + 去领券 + + + + + + \ No newline at end of file diff --git a/pages/card/card.wxss b/pages/card/card.wxss new file mode 100644 index 0000000..f9c037f --- /dev/null +++ b/pages/card/card.wxss @@ -0,0 +1,120 @@ +/* pages/card/card.wxss */ + +page { + background-color: #eee; +} + +.card_info { + position: relative; + width: 100%; + height: 360rpx; + background-color: white +} + +.card_info .content { + position: absolute; + top: 10px; + right: 10px; + left: 10px; + bottom: 10px; + background-color: rgb(35, 24, 23); + border-radius: 8px; +} + +.user_head { + float: left; + margin-top: 20px; + margin-left: 20px; + width: 108rpx; + height: 108rpx; + border-radius: 50%; + background-color: #999; +} + +.user_name { + float: left; + margin-top: 20px; + color: white; + width: 125px; + height: 96rpx; + padding-left: 20rpx; + line-height: 96rpx; +} + +.user_no { + position: absolute; + color: white; + left: 0px; + right: 0px; + height: 120rpx; + bottom: 15rpx; + padding-left: 20px; + line-height: 140rpx; +} + +.user_card_info { + width: 100%; + height: 120rpx; + line-height: 120rpx; + background-color: white; +} + +.user_card_info .card_content_info { + width: 50%; + height: 100%; + float: left; +} + +.card_content_top{ + text-align: center; + width: 100%; + height: 50%; + font-size: 16px; + line-height: 60rpx; +} + +.card_content_bottom{ + text-align: center; + width: 100%; + height: 50%; + color: red; + line-height: 60rpx; +} + +.user_top_common { + margin-top: 10px; + width: 100%; + height: 100rpx; + line-height: 100rpx; + font-size: 16px; + background-color: white; +} + +.user_bottom_common { + margin-top: 1px; + width: 100%; + height: 100rpx; + font-size: 16px; + line-height: 100rpx; + background-color: white; +} + +.user_line { + margin-left: 20px; + right: 0px; + height: 1px; + background-color: #eee; +} + +.user_text { + margin-left: 20px; + float: left; +} + +.iconfont { + color: #999; + font-size: 16px; + float: right; + margin-right: 15px; +} + diff --git a/pages/card/cardDetail.js b/pages/card/cardDetail.js new file mode 100644 index 0000000..1ae7d60 --- /dev/null +++ b/pages/card/cardDetail.js @@ -0,0 +1,143 @@ +const utils = require('../../utils/util.js'); +const loginApi = require('../../utils/loginApi.js'); +var wxbarcode = require('../../utils/wxbarcode.js'); +const app = getApp(); +var timer; +Page({ + + /** + * 页面的初始数据 + */ + data: { + hidden: false, + screenBrightness: 0.5, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + // var cardNo = app.cardInfo.cardNo; + var name = app.cardInfo.name; + var amount = app.cardInfo.availableAmount; + // var payCode = cardNo.replace(/[\s]/g, '').replace(/(\d{4})(?=\d)/g, "$1 "); + that.setData({ + // hidden: true, + // payCode: payCode, + name: name, + totalAmount: amount, + }); + // wxbarcode.barcode('barcode', cardNo, 600, 180); + // wxbarcode.qrcode('qrcode', cardNo, 400, 400); + + that.cy_getPayCode(); + timer = setInterval(function() { + that.cy_getPayCode(); + }, 58 * 1000); + }, + + cy_getPayCode: function() { + var that = this; + var cardNo = app.cardInfo.cardNo; + var name = app.cardInfo.name; + var amount = app.cardInfo.availableAmount; + var params = { + 'cardNo': cardNo, + 'shopNo': app.shopNo, + 'posNo': app.posNo, + 'workerNo': app.workerNo, + 'sourceSign': app.sourceSign, + 'method': 'card.get.payCode' + } + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + var result = json.data; + if (result.status == 1) { + var openData = result.data; + var oldPayCode = openData.payCode; + var payCode = oldPayCode.replace(/[\s]/g, '').replace(/(\d{4})(?=\d)/g, "$1 "); + that.setData({ + hidden: true, + payCode: payCode, + }); + + wxbarcode.barcode('barcode', oldPayCode, 600, 160); + wxbarcode.qrcode('qrcode', oldPayCode, 400, 400); + } else { + that.setData({ + hidden: true + }); + app.msg.showMsg("提示", "付款码获取失败"); + } + }, + function(error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + }, + + refreshLoad: function() { + this.cy_getPayCode(); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + var that = this; + wx.getScreenBrightness({ + success: function(res) { + console.log(res); + that.data.screenBrightness = res.value; + wx.setScreenBrightness({ + value: 0.75, + }) + } + }); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + clearInterval(timer); + var that = this; + wx.setScreenBrightness({ + value: that.data.screenBrightness, + }) + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + clearInterval(timer); + var that = this; + wx.setScreenBrightness({ + value: that.data.screenBrightness, + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/card/cardDetail.json b/pages/card/cardDetail.json new file mode 100644 index 0000000..5198d21 --- /dev/null +++ b/pages/card/cardDetail.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "会员卡" +} \ No newline at end of file diff --git a/pages/card/cardDetail.wxml b/pages/card/cardDetail.wxml new file mode 100644 index 0000000..44d7aca --- /dev/null +++ b/pages/card/cardDetail.wxml @@ -0,0 +1,26 @@ + + + + + {{name}},您好 + 余额:¥{{totalAmount}} + + + + + + + + + {{payCode}} + + + + + + 每分钟自动更新 + + + \ No newline at end of file diff --git a/pages/card/cardDetail.wxss b/pages/card/cardDetail.wxss new file mode 100644 index 0000000..0279492 --- /dev/null +++ b/pages/card/cardDetail.wxss @@ -0,0 +1,150 @@ +page { + background-color: #004585; +} + +.page { + padding: 50rpx; +} + +.gift_card { + position: relative; + background: #fff; + overflow: hidden; +} + +.gift_dv1 { + padding: 0 1.5rem 1.2rem 1.5rem; + text-align: center; +} + +.ico_yuan { + position: relative; +} + +.ico_yuan:before { + background: #004585; +} + +.ico_yuan:before { + content: ""; + position: absolute; + bottom: -20rpx; + right: -20rpx; + width: 40rpx; + height: 40rpx; + border-radius: 40rpx; + z-index: 7; +} + +.ico_yuan:after { + background: #004585; +} + +.ico_yuan:after { + content: ""; + position: absolute; + bottom: -20rpx; + left: -20rpx; + width: 40rpx; + height: 40rpx; + border-radius: 1.5rem; + z-index: 7; +} + +.gift_cp1 { + padding: 1rem 0 0.5rem 0; + font-size: 14px; + color: #666; +} + +.gift_cp2 { + font-size: 18px; + color: #333; + letter-spacing: 8rpx; +} + +.ico_no { + position: flex; +} + +.border { + position: relative; +} + +.b_top2:before { + border-top: 1px dashed #d1d1d1; +} + +.border:before { + content: ""; + position: absolute; + left: 0; + top: 0; + right: -100%; + bottom: -100%; + pointer-events: none; +} + +.barcode { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.barnum { + width: 100%; + height: 100rpx; + text-align: center; + font-size: 20px; + letter-spacing: 2rpx; +} + +.barcode { + display: flex; + align-items: center; + justify-content: center; +} + +.barcode > canvas { + width: 600rpx; + height: 180rpx; +} + +.qrcode { + height: 400rpx; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: center; +} + +.qrcode > canvas { + width: 420rpx; + height: 400rpx; +} + +.tip_txt { + display: flex; + flex-direction: column; + align-items: center; + font-size: 0.8rem; + color: #fff; + padding: 0.6rem; +} + +.ico_refresh { + display: flex; + align-items: center; + min-height: 1rem; +} + +.shade { + background-color: #000; + opacity: 0.6; + z-index: 2; + position: fixed; + width: 100%; + height: 100%; + top: 0; +} diff --git a/pages/card/cardEquity.js b/pages/card/cardEquity.js new file mode 100644 index 0000000..541b110 --- /dev/null +++ b/pages/card/cardEquity.js @@ -0,0 +1,57 @@ +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + var params = { + 'wid': app.wid, + 'method': 'weixin.config.info' + }; + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function (json) { + console.log(json); + var result = json.data; + if (result.status == 1) { + var memBenefits = result.data.memBenefits.split("\n"); + that.setData({ + des: memBenefits + }) + } else { + that.setData({ + hidden: true + }); + app.msg.showMsg("提示", "付款码获取失败"); + } + }, + function (error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, +}) \ No newline at end of file diff --git a/pages/card/cardEquity.json b/pages/card/cardEquity.json new file mode 100644 index 0000000..b3255c0 --- /dev/null +++ b/pages/card/cardEquity.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "会员权益" +} \ No newline at end of file diff --git a/pages/card/cardEquity.wxml b/pages/card/cardEquity.wxml new file mode 100644 index 0000000..f7ea58d --- /dev/null +++ b/pages/card/cardEquity.wxml @@ -0,0 +1,17 @@ + + + 会员权益 + + + + + + + {{item}} + + + + + + diff --git a/pages/card/cardEquity.wxss b/pages/card/cardEquity.wxss new file mode 100644 index 0000000..1b3e4d2 --- /dev/null +++ b/pages/card/cardEquity.wxss @@ -0,0 +1,40 @@ +page { + background-color: white; +} + +.cy-use-back { + width: 100%; + height: auto; +} + +.cy-use-title { + width: 100%; + height: 120rpx; + font-size: 14px; +} + +.cy-view { + width: 100%; + height: 80rpx; +} + +.cy-line { + width: 80%; + height: 1px; + background-color: gainsboro; +} + +.cy-use-condition { + width: 100%; + height: auto; +} + +.cy-use-condition view { + font-size: 12px; + color: gray; +} + +.cy_des { + width: 80%; + height: auto; +} diff --git a/pages/card/cardSuitStore.js b/pages/card/cardSuitStore.js new file mode 100644 index 0000000..583a41d --- /dev/null +++ b/pages/card/cardSuitStore.js @@ -0,0 +1,270 @@ +// pages/card/cardSuitStore.js +const card = require('../../utils/card.js'); +const app = getApp(); +var firstLoad = true; +Page({ + + /** + * 页面的初始数据 + */ + data: { + hidden: false, + pageNum: 1, + pageSize:15, + totalPage: 0, + totalCount: 0, + dataList: [], + inputShowed: false, + inputVal: "", + inputFlag: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + this.cy_getUseStore(); + }, + + /** + * 获取门店信息 + */ + cy_getUseStore: function() { + var that = this; + var hide = that.data.hidden; + var dataList = that.data.dataList; + var showLength = dataList.length; + var totalCount = that.data.totalCount; + if (!firstLoad && (showLength >= totalCount)) { + return; + } + that.setData({ + hidden: hide + }); + + // 当前位置 + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function(res) { + var latitude = res.latitude + var longitude = res.longitude + that.cy_queryShops(longitude, latitude); + }, + fail: function() { + queryShops(0, 0); + } + }); + }, + + + cy_queryShops: function(longitude, latitude) { + var that = this; + var hide = that.data.hidden; + var dataList = that.data.dataList; + var pageNum = that.data.pageNum; + var pageSize = that.data.pageSize; + var keyword = that.data.inputVal; + var property = "name"; + var keyword = that.data.inputVal; + var params = { + 'groupNo': app.groupNo, + 'pageNum': pageNum, + 'pageSize': pageSize, + 'property': property, + 'keyword': keyword, + 'longitude': longitude, + 'latitude': latitude, + 'method': 'group.shop.distance.list' + }; + + var ignores = ["property", "keyword"]; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(res) { + var resData = res.data; + if (resData.status == 1) { + var totalNum = resData.totalCount; + if (dataList.length != 0 && dataList.length >= totalNum) { + that.setData({ + hidden: hide + }); + return; + } + var totalPage = resData.pageCount; + var shopList = resData.list; + var shopLength = shopList.length; + for (var value of shopList) { + value.distance = (parseFloat(value.distance) / 1000).toFixed(2); + dataList.push(value); + } + pageNum = pageNum + 1; + that.setData({ + hidden: true, + totalCount: totalNum, + totalPage: totalPage, + pageNum: pageNum, + dataList: dataList + }); + } else { + that.setData({ + hidden: hide + }); + } + }, + function(error) { + console.log(error); + } + ); + + }, + + /** + * + */ + showInput: function () { + this.setData({ + inputShowed: true + }); + }, + + /** + * + */ + hideInput: function () { + this.resetSearch(); + this.setData({ + inputVal: "", + inputShowed: false, + inputFlag: 0 + }); + }, + + /** + * + */ + clearInput: function () { + this.resetSearch(); + this.setData({ + inputVal: "", + inputFlag: 0 + }); + }, + + /** + * + */ + inputTyping: function (e) { + var inputFlag = 1; + var inputVal = e.detail.value; + this.setData({ + inputVal: inputVal, + inputFlag: inputFlag + }); + this.resetSearch(); + if (inputVal == "") { + inputFlag = 0; + this.setData({ + inputFlag: inputFlag + }); + } + }, + + /** + * + */ + resetSearch: function () { + var inputFlag = this.data.inputFlag; + var that = this; + var hide = that.data.hidden = true; + if (inputFlag == 1) { + this.setData({ + hidden: hide, + pageNum: 1, + totalPage: 0, + totalCount: 0, + dataList: [] + }); + this.cy_getUseStore(); + } + }, + + /** + * + */ + onLocation: function (e) { + var latitude = e.currentTarget.dataset.latitude; + var longitude = e.currentTarget.dataset.longitude; + if (latitude != "" && longitude != "") { + wx.openLocation({ + latitude: Number(latitude), + longitude: Number(longitude), + scale: 28 + }) + } else { + // 当前位置 + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude + wx.openLocation({ + latitude: latitude, + longitude: longitude, + scale: 28 + }) + } + }); + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + wx.showNavigationBarLoading() //在标题栏中显示加载 + this.cy_getUseStore(); + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + this.cy_getUseStore(); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/card/cardSuitStore.json b/pages/card/cardSuitStore.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/card/cardSuitStore.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/card/cardSuitStore.wxml b/pages/card/cardSuitStore.wxml new file mode 100644 index 0000000..07be2f7 --- /dev/null +++ b/pages/card/cardSuitStore.wxml @@ -0,0 +1,44 @@ + + + + + + 共{{totalCount}}个适用门店 + + + + + + + + + + + + + + + + + + + + {{item.name}} + {{item.address == '' ? '暂无地址信息' : item.address}} + + + + {{item.distance}}km + + + + + + + + \ No newline at end of file diff --git a/pages/card/cardSuitStore.wxss b/pages/card/cardSuitStore.wxss new file mode 100644 index 0000000..7d1d342 --- /dev/null +++ b/pages/card/cardSuitStore.wxss @@ -0,0 +1,33 @@ +/* pages/card/cardSuitStore.wxss */ +.zan-col { + font-size: 12px; + height: 80px; +} + +.zan-row .location { + display: flex; + align-items: center; + text-align: center; + justify-content: center; + padding: 10px; +} + +.border { + border-top: 1px solid #e6e6fa; +} + +.icon_location { + height: 32px; + width: 32px; +} + +.distance { + color: #999999; + font-size: 13px; + line-height: 1.2; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} \ No newline at end of file diff --git a/pages/card/consume_record.js b/pages/card/consume_record.js new file mode 100644 index 0000000..67a4d28 --- /dev/null +++ b/pages/card/consume_record.js @@ -0,0 +1,85 @@ +const utils = require('../../utils/utils.js'); +const loginApi = require('../../utils/loginApi.js'); +const app = getApp(); +var firstLoad = true; +Page({ + data: { + hidden: false, + totalCount: 0, + pageNum: 1, + pageSize: 10, + pageCount: 0, + cardNo: "", + dataList: [], + }, + + onLoad: function(options) { + this.setData({ + cardNo: app.cardNo, + totalAmount: app.cardInfo.totalAmount, + }) + this.loadMore(); + }, + + loadMore: function() { + var that = this; + var dataList = that.data.dataList; + var showLength = dataList.length; + var totalCount = that.data.totalCount; + if (!firstLoad && (showLength >= totalCount)) { + return; + } + that.setData({ + hidden: false + }); + var date = new Date(); + var endTime = app.utils.getFormatTime(date, 1); + date.setDate(date.getDate() - 180); + var startTime = utils.getFormatTime(date, 1); + + var pageNum = that.data.pageNum; + var cardNo = that.data.cardNo; + var pageNum = that.data.pageNum; + var cardNo = that.data.cardNo; + var params = { + "method": "card.consume.history", + "startTime": startTime, + "endTime": endTime, + "pageNum": that.data.pageNum, + "pageSize": that.data.pageSize, + "cardNo": that.data.cardNo, + }; + + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + console.log(json); + var result = json.data; + if (result.status == 1) { + var list = result.list; + that.setData({ + dataList: list, + }); + } + }, + function(error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + }, + + onPullDownRefresh: function() { + wx.showNavigationBarLoading() //在标题栏中显示加载 + this.data.pageNum = 1; + this.loadMore(); + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }, + + onReachBottom: function() { + if (this.data.dataList.length < this.data.totalCount) { + this.data.pageNum++; + this.loadMore(); + } + } +}) \ No newline at end of file diff --git a/pages/card/consume_record.json b/pages/card/consume_record.json new file mode 100644 index 0000000..d0e5e89 --- /dev/null +++ b/pages/card/consume_record.json @@ -0,0 +1,7 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "消费记录", + "enablePullDownRefresh": true, + "onReachBottomDistance": 5 +} \ No newline at end of file diff --git a/pages/card/consume_record.wxml b/pages/card/consume_record.wxml new file mode 100644 index 0000000..beb2052 --- /dev/null +++ b/pages/card/consume_record.wxml @@ -0,0 +1,35 @@ + + + + + + {{totalAmount}} + 账户余额 + + + + + 暂无消费记录 + + + + + + + + {{item.shopName}} + + + {{item.payDate}} + + + + {{item.actualAmount}}元 + + + + + + diff --git a/pages/card/consume_record.wxss b/pages/card/consume_record.wxss new file mode 100644 index 0000000..fd76a8b --- /dev/null +++ b/pages/card/consume_record.wxss @@ -0,0 +1,129 @@ +page { + font-family: Arial, Helvetica, STHeiTi, sans-serif; + background: #f2f2f2; +} + +.cy-content-top { + width: 100%; + height: 320rpx; + overflow: hidden; + background-color: white; +} + +.cy-user { + margin-top: 60rpx; + width: 100%; + height: 128rpx; + text-align: center; +} + +.zan-col { + font-size: 12px; + height: 55px; +} + +.item { + padding: 3px; + padding-left: 12px; + padding-right: 0px; +} + +zan-row:after { + content: ""; + display: table; + clear: both; +} + +.zan-row .money { + text-align: right; + padding-top: 18px; + padding-right: 10px; + font-size: 15px; +} + +.weui-media-box__title_in-text { + font-size: 15px; + color: #666; +} + +.border { + border-top: 1px solid #e6e6fa; +} + +.zan-cell { + position: relative; + padding: 12px 15px; + display: flex; + align-items: center; + line-height: 1.4; + font-size: 14px; +} + +.zan-cell__bd_title { + color: #999; + font-size: 12px; +} + +.zan-cell__bd { + flex: 1; +} + +.no_record { + display: flex; + flex-direction: column; + justify-content: center; + padding-top: 40%; + text-align: center; +} + +.no_title { + font-size: 13px; + color: #999; +} + +.weui-media-box__desc { + font-size: 12px; +} + +.table { + margin-top: 20rpx; + width: 100%; + height: 100%; +} + +.table_row { + width: 100%; + height: 180rpx; + background-color: white; + border-bottom: 1px solid gainsboro; +} + +.table_row .row_left { + width: 70%; + height: 100%; + float: left; +} + +.table_row .row_right { + width: 30%; + height: 100%; + float: left; + line-height: 180rpx; + text-align: center; +} + +.row_left .row_top { + margin-top: 35rpx; + width: 100%; + height: 70rpx; + padding-left: 20px; + font-size: 16px; +} + +.row_left .row_bottom { + width: 100%; + height: 80rpx; + padding-left: 20px; + color: #999; + font-size: 14px; +} diff --git a/pages/card/recharge.js b/pages/card/recharge.js new file mode 100644 index 0000000..d2c571b --- /dev/null +++ b/pages/card/recharge.js @@ -0,0 +1,382 @@ +const app = getApp(); +const util = require('../../utils/util.js'); +const utils = require('../../utils/utils.js'); +const loginApi = require('../../utils/loginApi.js'); +const card = require('../../utils/card.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + hidden: true, + amount: 0, + totalAmount: 0.0, + tagsList: [], + schemeData: { + minAmount: 0, + maxAmount: 0, + inputFlag: 1 + }, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + card.WxRechargeScheme(function(json) { + console.log(json); + var result = json.data; + var schemeData = {}; + if (result.status == 1) { + var data = result.data; + schemeData.schemeId = data.schemeId; + schemeData.schemeNo = data.schemeNo; + schemeData.minAmount = data.minAmount; + schemeData.maxAmount = data.maxAmount; + schemeData.inputFlag = data.inputFlag; + var discountContent = data.discountContent; + var details = data.detail; + var detailsList = []; + var desList = []; + if (discountContent && discountContent != "" && discountContent != "{}") { + console.log("----------------"); + for (var value of details) { + var des = {}; + des.amount = value.startAmount; + des.desc = value.giftAmountValue; + des.imgurl = "../../images/icon-coupon-one.png"; + desList.push(des); + } + } else { + for (var detail of details) { + var detailData = {}; + var startAmountCn = detail.startAmount; // 起始金额 + var startAmount = parseFloat(startAmountCn).toFixed(2); + var giftAmountType = detail.giftAmountType; // 赠送类型 0按比例 1固定值 + var giftAmountValue = detail.giftAmountValue; // 赠送值 + var giftAmount = giftAmountValue; + if (giftAmountType == 0) { + giftAmount = parseFloat(parseFloat(startAmount) * (parseFloat(giftAmountValue) / 100)).toFixed(2); + } else if (giftAmountType == 1) { + giftAmount = parseFloat(giftAmountValue).toFixed(2); + } + detailData.startAmountCn = startAmountCn; + detailData.startAmount = startAmount; + detailData.giftAmount = giftAmount; + detailData.giftAmountCn = parseInt(giftAmount); + detailsList.push(detailData); + } + } + + that.setData({ + schemeData: schemeData, + desList: desList, + detailsList: detailsList, + totalAmount: app.cardInfo.totalAmount, + }); + } else { + that.setData({ + totalAmount: app.cardInfo.totalAmount, + }); + } + }); + }, + + /** + * + */ + cy_rechargeRecord: function(e) { + var url = "recharge_record" + wx.navigateTo({ + url: url, + }) + }, + + /** + * + */ + cy_memberEquity: function(e) { + var url = "cardEquity" + wx.navigateTo({ + url: url, + }) + }, + + /** + * + */ + cy_consumeRecord: function(e) { + var url = "consume_record" + wx.navigateTo({ + url: url, + }) + }, + + /** + * 选择充值方案 + */ + cy_rechargeScheme: function(e) { + var index = e.currentTarget.dataset.index; + for (var map of this.data.desList) { + map.imgurl = "../../images/icon-coupon-one.png"; + } + var map = this.data.desList[index]; + map.imgurl = "../../images/icon-coupon-two.png"; + this.setData({ + amount: map.amount, + desList: this.data.desList + }); + + }, + + /** + * 确认充值 + */ + cy_onceRecharge: function(e) { + this.cy_recharge(); + }, + + /** + * + */ + cy_selectAmount: function(e) { + var index = e.currentTarget.dataset.index; + for (var i = 0; i < this.data.tagsList.length; i++) { + var map = this.data.tagsList[i]; + map.checked = false; + if (index == i) { + map.checked = true; + this.data.amount = map.amount; + } + } + + this.setData({ + tagsList: this.data.tagsList, + }) + }, + + /** + * + */ + cy_recharge: function() { + var that = this; + var rechargeAmount = parseFloat(that.data.amount); + if (rechargeAmount <= 0) { + utils.alertErrorMsg('错误提示', '充值金额不合法'); + return; + } + var totalFee = parseInt(parseFloat(rechargeAmount) * 100); + // 先创建充值订单 + var date = new Date(); + var createTime = app.utils.getFormatTime(date, 1); + var params = { + "method": "weixin.recharge.order.create", + "wid": app.memberWid, + "openid": app.openId, + "outTradeNo": card.getTradeNo(), + "createTime": createTime, + rechargeNo: that.data.schemeData.schemeNo, + requestAmount: totalFee, + cardNo: app.cardNo + }; + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + console.log(json); + var result = json.data; + if (result.status == 1) { + var outTradeNo = result.data.outTradeNo; // + // 微信统一下单 + that.wxUnifiedorder(outTradeNo, totalFee); + } else { + that.setData({ + hidden: true + }); + app.msg.showMsg("提示", "微信下单失败"); + } + }, + function(error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + }, + + /** + * 微信统一下单 + */ + wxUnifiedorder: function(outTradeNo, totalFee) { + var that = this; + var params = { + "method": 'weixin.unifiedorder', + "wid": app.memberWid, + "deviceInfo": app.sourceSign, + "body": "微信小程序充值", + "detail": "微信小程序充值", + "attach": app.memberWid, + "outTradeNo": outTradeNo, + "totalFee": totalFee, + "spbillCreateIp": "0.0.0.0", + "openid": app.openId, + } + var ignores = []; + ignores.push('deviceInfo'); + ignores.push('body'); + ignores.push('detail'); + ignores.push('attach'); + ignores.push('deviceInfo'); + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + var result = json.data; + console.log(" =============== ", result); + if (result.status == 1) { + var data = result.data; + var saobeiOrderNo = data.saobeiOrderNo; + // 微信支付查询 + var timer = setInterval(function() { + console.log("定时器查询支付结果"); + that.wxQueryOrder(outTradeNo, saobeiOrderNo, function(json) { + console.log(json); + var result = json.data; + if (result.status == 1) { + var data = result.data; + if (data.status == 1) { + clearInterval(timer); + // 微信扣款成功 + var outTradeNo = data.outTradeNo; + var transactionId = data.transactionId; + var payMode = data.payMode; + if (payMode == "fuyou") { + that.cy_selectCardInfo(); + app.msg.showMsg("提示", "会员卡充值成功"); + } else { + that.wxRechargeOrderUpdate(outTradeNo, transactionId); + } + + } + } + }, function(error) { + wx.showModal({ + title: '提示', + content: '微信支付失败', + }) + }); + }, 2000); + + wx.requestPayment({ + timeStamp: data.timeStamp, + nonceStr: data.nonceStr, + package: data.package, + signType: data.signType, + paySign: data.paySign, + "success": function(res) { + console.log("成功=============" + res); + console.log(res); + }, + "fail": function(res) { + console.log("失败=============" + res); + console.log(res); + clearInterval(timer); + that.setData({ + hidden: true + }); + app.msg.showMsg("提示", "微信支付取消"); + }, + "complete": function(res) { + console.log("结束=============" + res); + console.log(res); + } + }); + + } else { + that.setData({ + hidden: true + }); + app.msg.showMsg("提示", "微信支付失败"); + } + }, + function(error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + + }, + + // 微信订单查询 + wxQueryOrder: function(outTradeNo, saobeiOrderNo, success, fail) { + var params = { + "wid": app.memberWid, + 'outTradeNo': outTradeNo, + 'method': 'weixin.unifiedorder.query' + } + + if (saobeiOrderNo){ + params.saobeiOrderNo = saobeiOrderNo; + } + + console.log(params); + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + success(json); + }, + function(error) { + fail(error); + } + ); + }, + + /** + * 更新订单状态 + */ + wxRechargeOrderUpdate: function(outTradeNo, transactionId) { + var that = this; + var date = new Date(); + var payTime = app.utils.getFormatTime(date, 1); + var params = { + "wid": app.memberWid, + "outTradeNo": outTradeNo, + "payTime": payTime, + "transactionId": transactionId, + 'method': 'weixin.recharge.order.update' + } + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + console.log("会员卡充值成功", json); + var result = json.data; + if (result.status == 1) { + that.setData({ + hidden: true + }); + that.cy_selectCardInfo(); + app.msg.showMsg("提示", "会员卡充值成功"); + } + }, + function(error) { + fail(error); + } + ); + + }, + + /** + * 查询卡信息 + */ + cy_selectCardInfo: function() { + var that = this; + card.wx_cardInfo(app.cardNo, function(json) { + var result = json.data; + if (result.status == 1) { + app.cardInfo = result.data; + that.setData({ + totalAmount: app.cardInfo.totalAmount, + }); + } + }, function(err) { + + }); + }, + +}) \ No newline at end of file diff --git a/pages/card/recharge.json b/pages/card/recharge.json new file mode 100644 index 0000000..9803a4e --- /dev/null +++ b/pages/card/recharge.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "会员储值" +} \ No newline at end of file diff --git a/pages/card/recharge.wxml b/pages/card/recharge.wxml new file mode 100644 index 0000000..c66d846 --- /dev/null +++ b/pages/card/recharge.wxml @@ -0,0 +1,36 @@ + + + + {{totalAmount}} + 账户余额 + + + + + + ¥ + 充值金额 + + + + + + + + {{item.amount}} + + {{item.desc}} + + + + + 确认充值 + + + \ No newline at end of file diff --git a/pages/card/recharge.wxss b/pages/card/recharge.wxss new file mode 100644 index 0000000..3d7770a --- /dev/null +++ b/pages/card/recharge.wxss @@ -0,0 +1,210 @@ +.cy-content-top { + width: 100%; + height: 320rpx; + overflow: hidden; + background-color: white; +} + +.cy-user { + margin-top: 60rpx; + width: 100%; + height: 128rpx; + text-align: center; +} + +.cy-user-info { + margin-top: 40rpx; + width: 100%; + height: 100rpx; +} + +.cy-user-line { + width: 2%; + height: 60%; + float: left; + overflow: hidden; +} + +.cy-line-view { + margin-top: 5rpx; + width: 1px; + height: 35rpx; + background-color: gainsboro; +} + +.cy-user-point { + width: 30%; + height: 100%; + text-align: center; + font-size: 14px; +} + +.cy-recharge-icon { + width: 100%; + height: 100rpx; + font-size: 14px; +} + +.cy-icon { + width: 25rpx; + height: 25rpx; + border: 1px solid #004585; + border-radius: 50%; + color: #004585; + line-height: 12px; + text-align: center; + margin-right: 15rpx; + font-size: 10px; +} + +.cy-content-list { + width: 100%; + height: auto; +} + +.cy-list-item { + position: relative; + margin-left: 40rpx; + width: 670rpx; + height: 190rpx; + margin-bottom: 10rpx; +} + +.cy-list-item image{ + position: absolute; + width: 100%; + height: 100%; +} + +.cy-item-row { + position: absolute; + left: 40rpx; + bottom: 40rpx; + width: 400rpx; + height: 70rpx; + text-align: center; + +} + +.cy-item-row text{ + width: 200rpx; + height: 80rpx; + letter-spacing: 8rpx; + font-size: 14px; +} + +.cy-row-recharge { + position: absolute; + padding: 0rpx 15rpx; + right: 0rpx; + width: 120rpx; + height: 60rpx; + font-size: 28rpx; + background-color: #004585; + color: white; + border-radius: 60rpx; +} + +.cy-list-footer { + position: relative; + width: 100%; + height: auto; + padding: 0rpx 0rpx 80rpx 0rpx; +} + +.cy-recharge-tag { + position: relative; + width: 750rpx; + height: auto; + min-height: 80rpx; + text-align: center; +} + +.cy-tag-valus { + position: relative; + margin-left: 30rpx; + margin-top: 30rpx; + width: 210rpx; + height: 80rpx; + line-height: 80rpx; + text-align: center; + border-radius: 80rpx; + border: 1px solid gainsboro; +} + +.cy-normal-tag { + background-color: white; + color: black; +} + +.cy-select-tag { + background-color: #004585; + color: white; +} + +.cy-recharge-view { + width: 750rpx; + height: 80rpx; +} + +.cy-recharge-view view { + margin-top: 60rpx; + width: 440rpx; + height: 100%; + background-color: #004585; + color: white; + border-radius: 80rpx; + font-size: 16px; +} + +/* ********************* */ + +page { + background-color: #eee; +} + +.amount_title_remark { + padding: 0.5rem 0.8rem; + font-size: 12px; + color: #999; + text-align: left; +} + +.placeholder { + margin: 5px; + padding: 0 10px; + text-align: center; + background-color: #fff; + height: 3.0em; + line-height: 3.0em; + color: #333; + border-radius: 8px; + border: 1px solid #eee; +} + +.cur { + border-color: #f05350; + color: #f05350; +} + +.zan-radius { + border-radius: 8px; +} + +.no_record { + display: flex; + flex-direction: column; + justify-content: center; + padding-top: 50%; + text-align: center; +} + +.no_title { + font-size: 18px; + color: #666; +} + +.item_01 { + background-color: #f05350; + border-color: #f05350; +} diff --git a/pages/card/recharge_record.js b/pages/card/recharge_record.js new file mode 100644 index 0000000..845ee12 --- /dev/null +++ b/pages/card/recharge_record.js @@ -0,0 +1,90 @@ +const utils = require('../../utils/utils.js'); +const loginApi = require('../../utils/loginApi.js'); +const app = getApp(); +var firstLoad = true; +Page({ + data: { + hidden: false, + totalCount: 0, + pageNum: 1, + pageSize: 15, + pageCount: 0, + cardNo: "", + dataList: [], + + }, + + onLoad: function(options) { + this.setData({ + cardNo: app.cardNo, + totalAmount: app.cardInfo.totalAmount, + }) + this.loadMore(); + }, + + loadMore: function() { + var that = this; + var dataList = that.data.dataList; + var showLength = dataList.length; + var totalCount = that.data.totalCount; + if (!firstLoad && (showLength >= totalCount)) { + return; + } + that.setData({ + hidden: false + }); + var date = new Date(); + var endTime = app.utils.getFormatTime(date, 1); + date.setDate(date.getDate() - 180); + var startTime = utils.getFormatTime(date, 1); + var pageNum = that.data.pageNum; + var cardNo = that.data.cardNo; + var params = { + "method": "card.recharge.history", + "startTime": startTime, + "endTime": endTime, + "pageNum": that.data.pageNum, + "pageSize": that.data.pageSize, + "cardNo": that.data.cardNo, + }; + var ignores = []; + app.jsapi.memberApi(app.globalData.appMemberKey, app.globalData.appMemberSecret, app.globalData.serverMemberUrl).ajax(params, ignores, + function(json) { + console.log(json); + var result = json.data; + if (result.status == 1) { + that.data.totalCount = result.totalCount; + that.setData({ + dataList: result.list, + }); + } + }, + function(error) { + app.msg.showMsg("提示", "网络连接失败"); + } + ); + }, + + /** + * + */ + onPullDownRefresh: function() { + wx.showNavigationBarLoading() //在标题栏中显示加载 + if (this.data.dataList.length < this.data.totalCount) { + this.data.pageNum = 1; + this.loadMore(); + } + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }, + + /** + * + */ + onReachBottom: function() { + if (this.data.dataList.length < this.data.totalCount) { + this.data.pageNum++; + this.loadMore(); + } + } +}) \ No newline at end of file diff --git a/pages/card/recharge_record.json b/pages/card/recharge_record.json new file mode 100644 index 0000000..380def8 --- /dev/null +++ b/pages/card/recharge_record.json @@ -0,0 +1,6 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "充值记录", + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/card/recharge_record.wxml b/pages/card/recharge_record.wxml new file mode 100644 index 0000000..dce8691 --- /dev/null +++ b/pages/card/recharge_record.wxml @@ -0,0 +1,35 @@ + + + + + + {{totalAmount}} + 账户余额 + + + + + 暂无充值记录 + + + + + + + + 充值记录 + + + {{item.chargeTime}} + + + + {{item.chargeAmount}}元 + + + + + + \ No newline at end of file diff --git a/pages/card/recharge_record.wxss b/pages/card/recharge_record.wxss new file mode 100644 index 0000000..3be66c8 --- /dev/null +++ b/pages/card/recharge_record.wxss @@ -0,0 +1,131 @@ +page { + font-family: Arial, Helvetica, STHeiTi, sans-serif; + background: #f2f2f2; +} + +.cy-content-top { + width: 100%; + height: 320rpx; + overflow: hidden; + background-color: white; +} + +.cy-user { + margin-top: 60rpx; + width: 100%; + height: 128rpx; + text-align: center; +} + +.zan-col { + font-size: 12px; + height: 55px; +} + +.item { + padding: 3px; + padding-left: 12px; + padding-right: 0px; +} + +zan-row:after { + content: ""; + display: table; + clear: both; +} + +.zan-row .money { + text-align: right; + padding-top: 18px; + padding-right: 10px; + font-size: 15px; +} + +.weui-media-box__title_in-text { + font-size: 15px; + color: #666; +} + +.border { + border-top: 1px solid #e6e6fa; +} + +.zan-cell { + position: relative; + padding: 12px 15px; + display: flex; + align-items: center; + line-height: 1.4; + font-size: 14px; +} + +.zan-cell__bd_title { + color: #999; + font-size: 12px; +} + +.zan-cell__bd { + flex: 1; +} + +.no_record { + display: flex; + flex-direction: column; + justify-content: center; + padding-top: 40%; + text-align: center; +} + +.no_title { + font-size: 13px; + color: #999; +} + +.weui-media-box__desc { + font-size: 12px; +} + +.table { + margin-top: 20rpx; + width: 100%; + height: 100%; +} + +.table_row { + width: 100%; + height: 180rpx; + background-color: white; + border-bottom: 1px solid gainsboro; +} + +.table_row .row_left { + width: 70%; + height: 100%; + float: left; +} + +.table_row .row_right { + width: 30%; + height: 100%; + float: left; + line-height: 180rpx; + text-align: center; +} + +.row_left .row_top { + margin-top: 35rpx; + width: 100%; + height: 70rpx; + padding-left: 20px; + line-height: 70rpx; + font-size: 16px; +} + +.row_left .row_bottom { + width: 100%; + height: 50rpx; + line-height: 50rpx; + padding-left: 20px; + color: #999; + font-size: 14px; +} diff --git a/pages/coupon/applyShop.js b/pages/coupon/applyShop.js new file mode 100644 index 0000000..8d2a0b7 --- /dev/null +++ b/pages/coupon/applyShop.js @@ -0,0 +1,201 @@ +const card = require('../../utils/card.js'); +const util = require('../../utils/util.js'); +const app = getApp(); +var pageSize = 10; +var firstLoad = true; +var loadMore = function (that) { + var dataList = that.data.dataList; + var showLength = dataList.length; + var totalCount = that.data.totalCount; + if (!firstLoad && (showLength >= totalCount)) { + return; + } + that.setData({ + hidden: false + }); + + // 当前位置 + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude + queryShops(that, longitude, latitude); + }, + fail: function () { + queryShops(that, "", "", 0, 0); + } + }); +} + +var queryShops = function (that, longitude, latitude) { + var dataList = that.data.dataList; + var pageNum = that.data.pageNum; + var keyword = that.data.inputVal; + card.getCouponApplyShop(that.data.couponId, pageNum, pageSize, longitude, latitude,"name",keyword, function (res) { + var resData = res.data; + if (resData.status == 1) { + var totalNum = resData.totalCount; + if (dataList.length >= totalNum) { + that.setData({ + hidden: true + }); + return; + } + var totalPage = resData.pageCount; + var shopList = resData.list; + var shopLength = shopList.length; + for (var value of shopList) { + value.distance = (parseFloat(value.distance) / 1000).toFixed(2); + dataList.push(value); + } + pageNum = pageNum + 1; + that.setData({ + hidden: true, + totalCount: totalNum, + totalPage: totalPage, + pageNum: pageNum, + dataList: dataList + }); + } else { + that.setData({ + hidden: true + }); + } + }, function (res) {}); +} + +Page({ + data: { + hidden: false, + pageNum: 1, + totalPage: 0, + totalCount: 0, + dataList: [], + inputShowed: false, + inputVal: "", + inputFlag: 0, + statusBarHeight: app.statusBarHeight * 2.5, + }, + + onLoad: function (options) { + if (options.couponId) { + this.setData({ + couponId: options.couponId + }); + } else { + app.showMsg("券id不存在即将返回上一层", "none"); + wx.navigateBack({}); + } + }, + onShow: function () { + loadMore(this); + this.setData({ + color: app.globalData.color + }) + }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + wx.showNavigationBarLoading() //在标题栏中显示加载 + loadMore(this); + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + loadMore(this); + }, + + onLocation: function (e) { + var latitude = e.currentTarget.dataset.latitude; + var longitude = e.currentTarget.dataset.longitude; + console.error("--------" + latitude + "----" + latitude) + if (latitude != "" && longitude != "") { + wx.openLocation({ + latitude: Number(latitude), + longitude: Number(longitude), + scale: 28 + }) + } else { + // 当前位置 + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude + wx.openLocation({ + latitude: latitude, + longitude: longitude, + scale: 28 + }) + } + }); + } + }, + + showInput: function () { + this.setData({ + inputShowed: true + }); + }, + + hideInput: function () { + this.resetSearch(); + this.setData({ + inputVal: "", + inputShowed: false, + inputFlag: 0 + }); + }, + + clearInput: function () { + this.resetSearch(); + this.setData({ + inputVal: "", + inputFlag: 0 + }); + }, + + inputTyping: function (e) { + var inputFlag = 1; + var inputVal = e.detail.value; + this.setData({ + inputVal: inputVal, + inputFlag: inputFlag + }); + this.resetSearch(); + if (inputVal == "") { + inputFlag = 0; + this.setData({ + inputFlag: inputFlag + }); + } + }, + resetSearch: function () { + var inputFlag = this.data.inputFlag; + if (inputFlag == 1) { + this.setData({ + hidden: false, + pageNum: 1, + totalPage: 0, + totalCount: 0, + dataList: [] + }); + loadMore(this); + } + }, + phone: function (e) { + if (e.currentTarget.dataset.phone) { + wx.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.phone, + }) + } else { + app.showMsg("电话不存在", "none") + } + } +}) \ No newline at end of file diff --git a/pages/coupon/applyShop.json b/pages/coupon/applyShop.json new file mode 100644 index 0000000..d1f0899 --- /dev/null +++ b/pages/coupon/applyShop.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "适用门店" +} \ No newline at end of file diff --git a/pages/coupon/applyShop.wxml b/pages/coupon/applyShop.wxml new file mode 100644 index 0000000..65b3bf8 --- /dev/null +++ b/pages/coupon/applyShop.wxml @@ -0,0 +1,53 @@ + + + + + + + 共个{{totalCount}}适用门店 + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + {{item.address == '' ? '暂无地址信息' : item.address}} + + 营业时间:00:00-24:00 + + + + {{item.phoneNum}} + + 电话 + 导航 + + + {{item.distance}}km + + + + + + diff --git a/pages/coupon/applyShop.wxss b/pages/coupon/applyShop.wxss new file mode 100644 index 0000000..855a142 --- /dev/null +++ b/pages/coupon/applyShop.wxss @@ -0,0 +1,166 @@ +.zan-col { + font-size: 12px; + /* height: 80px; */ +} + +.zan-row .location { + display: flex; + align-items: center; + text-align: center; + justify-content: center; + padding: 10px; +} + +.border { + border-top: 1px solid #e6e6fa; + background: white; + margin: 20rpx; + box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.1); + border-radius: 15rpx; + /* min-height: 290rpx; */ +} +.flex{ + display: flex; + justify-content: center; + align-content: center; + align-items: center; + flex-direction: column; +} +.icon_location { + height: 34rpx; + width: 26rpx; +} + +.distance { + color: #999; + font-size: 11px; + line-height: 1.2; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.zan-pannel2 { + border-top: 1rpx solid #e5e5e5; + border-bottom: 1rpx solid #e5e5e5; + margin-top: 10px; + overflow: hidden; +} + +.weui-search-bar__label { + border-radius: 31rpx; + box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.1); + text-align: left; +} + +.weui-search-bar__form { + border-radius: 31rpx; + box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.1); +} + +.weui-icon-search { + margin-left: 30rpx; +} + +.weui-search-bar { + border-bottom: 0rpx; + background: #fff; +} + +.zan-panel { + border-bottom: 0rpx; +} + +.title_fixed { + width: 100%; + height: 200rpx; + background: #fff; + position: fixed; + margin-top: -230rpx; +} + +.zan-cell__bd { + width: 240rpx; + height: 25rpx; + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.margin { + margin-top: 230rpx; +} + +.distance { + float: right; + padding-top: 40rpx; +} + +.icon { + width: 26rpx; + height: 26rpx; +} + +.bottom { + display: flex; + flex-direction: row; + justify-content: space-between; + width: 130%; + text-align: center; + /* line-height: 70rpx; */ + border-top: 1px solid rgba(224, 224, 224, 1); + /* margin-top: 10rpx; */ + height: 60rpx; + margin-top: 15rpx; + padding-top: auto auto; +} + +.fontStyle { + padding-top: 10rpx; + max-width: 160%; + overflow: scroll; + /* white-space: nowrap; */ + max-height: 70rpx; + min-height: 40rpx; +} + +.phone { + width: 110rpx; + height: 56rpx; + border: 1px solid rgba(153, 153, 153, 1); + border-radius: 4rpx; + font-size: 26rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(102, 102, 102, 1); + line-height: 56rpx; + margin-left: 150rpx; + margin-top: 10rpx; +} + +.dh { + width: 110rpx; + height: 56rpx; + background: rgba(254, 182, 9, 1); + border-radius: 4rpx; + font-size: 26rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 56rpx; + margin-top: 10rpx; +} + +.num { + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(102, 102, 102, 1); + height: 56rpx; + min-width: 250rpx; + text-align: left; + padding-top: 14rpx; +} diff --git a/pages/coupon/couponCenter.js b/pages/coupon/couponCenter.js new file mode 100644 index 0000000..ae0069f --- /dev/null +++ b/pages/coupon/couponCenter.js @@ -0,0 +1,261 @@ +const app = getApp(); +const card = require('../../utils/card.js'); +const util = require('../../utils/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + couponStatus: [{ + status: 1, + title: "代金券", + select: true, + value: "CASH" + }, { + status: 2, + title: "兑换券", + select: false, + value: "GIFT" + }, { + status: 3, + title: "折扣券", + select: false, + value: "DISCOUNT" + }] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + this.cy_couponGrounp(); + this.setData({color:app.globalData.color}) + }, + cy_couponGrounp: function() { + var that = this; + var couponType = this.cy_getDefaultTitleValue(); + //2 代表免费领取 + card.couponCenter(couponType, 2, function(json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = []; + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + var list = []; + for (var item of data.list) { + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + }else{ + if(item.personLimitNum!=0){ + item.syNum=item.personLimitNum-num + } + } + }else{ + if(item.personLimitNum!=0){ + item.syNum=item.personLimitNum-num + } + } + + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + // item.amount = app.utils.getZero(parseFloat(item.reduceCost) / 100); + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + //判断是否兑换券显示图片 + if(that.data.couponStatus[2].select){ + item.showImage=true; + }else{ + item.showImage=false; + } + item.color = "#3cc271"; + + // item.condition = "满" + app.utils.getOne(parseFloat(item.leastCost) / 100) + "可用"; + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + if (item.status == 0) { + item.bgImage ="http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.useStatus = "条件不足"; + item.type=2; + } else if (item.status == 1) { + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.useStatus = "立即领取"; + item.type=1; + } + list.push(item); + } + if (list.length <= 0) { + var couponName = that.cy_getDefaultTitle(); + wx.showToast({ + title: "暂无可用" + couponName, + icon: "none" + }) + } + that.setData({ + list: list + }) + + } else { + that.setData({ + list: data.list, + }) + wx.showToast({ + title: "暂无优惠券", + icon: "none" + }) + } + } else { + wx.showToast({ + title: data.errMessage, + icon: "none" + }) + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_getDefaultTitleValue: function() { + var list = this.data.couponStatus; + for (var item of list) { + if (item.select) { + return item.value; + } + } + return list[0].value; + }, + cy_getDefaultTitle: function() { + var list = this.data.couponStatus; + for (var item of list) { + if (item.select) { + return item.title; + } + } + return list[0].title; + }, + /** + * 选择优惠券类型 + */ + cy_selectTypeCoupon: function(e) { + var status = e.currentTarget.dataset.status; + for (var item of this.data.couponStatus) { + item.select = false; + if (item.status == status) { + item.select = true; + } + } + + this.cy_couponGrounp(); + this.setData({ + couponStatus: this.data.couponStatus + }); + }, + receive: function(e) { + var status = e.currentTarget.dataset.status; + console.error(e,"...") + if (status == 0) { + util.showWaring("条件不足!") + return; + } + var schemeId = e.currentTarget.dataset.id; + var formId = e.detail.formId; + wx.showLoading({ + title: '兑换中', + }) + var that = this; + card.exchangeCouponScheme(schemeId, function(success) { + var result = success.data; + if (result.status == 1) { + wx.showToast({ + title: "兑换成功", + icon: "none", + duration: 2000 + }) + that.cy_couponGrounp(); + var codes = result.data.codes; + wx.requestSubscribeMessage({ + tmplIds: ['EtZx0oL7j8de4GvAKdvVvAp4r54FmkUgljBV6odEwP8','pGnicqZClpvzbrvHhkK5TzF486QC-TbxG4dOiMxQinA','Ztg4uD0POZyKhg2onTOUaJRGQou1dpOqxB62yIdhkds'], + success:function (params) { + console.error(" success ",params) + card.sendTemPlate("receiveCoupon", formId, codes, function(success) {}, + function(error) { + + }); + }, + fail:function (params) { + console.error(" error ",params) + } + }) + + } else { + wx.showToast({ + title: result.errMessage, + icon: "none", + duration: 3000 + }) + } + wx.hideLoading(); + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + /**测试formid + * e207fb10f83e430c821eea3301f28e5d ---- + * 4c0829e9ff5747d589711586f1aa7776 + * e7df56ef99254283b4c9fe6268f03a9c + * d9da7d9312cc414189e60acd14625150 + * 3c33ffc4783f4a3991aec0197b707770 + */ + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/coupon/couponCenter.json b/pages/coupon/couponCenter.json new file mode 100644 index 0000000..0161f45 --- /dev/null +++ b/pages/coupon/couponCenter.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "领券中心" +} \ No newline at end of file diff --git a/pages/coupon/couponCenter.wxml b/pages/coupon/couponCenter.wxml new file mode 100644 index 0000000..fba6f1a --- /dev/null +++ b/pages/coupon/couponCenter.wxml @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/pages/coupon/couponCenter.wxss b/pages/coupon/couponCenter.wxss new file mode 100644 index 0000000..eb8d068 --- /dev/null +++ b/pages/coupon/couponCenter.wxss @@ -0,0 +1,166 @@ +@import '../../template/coupon/couponTemplate.wxss'; +.use { + width: 130rpx; + text-align: center; + /* margin-top: 64rpx; */ + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: bold; + color: rgba(255, 255, 255, 1); + height: 130rpx; + background: no-repeat; + line-height: 35rpx; + left: -2rpx; +} +/* .cy-coupon-table { + position: absolute; + top: 20rpx; + left: 20rpx; + right: 20rpx; + bottom: 20rpx; +} + +.cy-coupon-table-header { + position: fixed; + width: 100%; + height: 80rpx; +} + +.cy-coupon-table-header text { + font-size: 14px; + padding-left: 40rpx; + line-height: 80rpx; + color: gray; +} + +.cy-coupon-table-row { + position: relative; + margin-bottom: 15rpx; + display: block; + width: 100%; + height: 180rpx; + border-radius: 3px; + background-color: white; +} + +.cy-coupon-no { + position: relative; + margin-top: 360rpx; + font-size: 16px; + width: 100%; + height: 80rpx; + text-align: center; + color: #c0c0c0; +} */ + +/* .cy-coupon-title { + width: 30%; + height: 100%; + color: white; + +} */ + +/* .cy-coupon-deduction { + width: 100%; + height: 60%; + color: rgb(0, 179, 103); + font-size: 20px; +} + +.cy-coupon-limit { + width: 50%; + height: 100%; + font-size: 18px; +} + +.cy-coupon-worth { + width: 100%; + height: 60%; + font-size: 16px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.cy-coupon-use-condition { + width: 100%; + height: 40%; + font-size: 13px; + text-align: center; + color: rgb(0, 179, 103); +} + +.cy-coupon-use-time { + width: 100%; + height: 40%; + font-size: 13px; + color: gray; +} + +.cy-coupon-lead { + width: 20%; + height: 100%; + font-size: 12px; + color: white; +} + +.cy-coupon-lead view { + width: 100%; + height: 60rpx; + background-color: orangered; + border-radius: 50rpx; +} */ +.cy-coupon-uses { + /* background: rgba(255, 198, 57, 1); */ + background: var(--color--); + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 36rpx; + border-radius: 10rpx; + width: 130rpx; + height: 80rpx; +} + +.cy-coupon-receive { + /* border: 2rpx solid rgba(255, 198, 57, 1); */ + border: 2rpx solid var(--color--); + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + /* color: rgba(255, 198, 57, 1); */ + color: var(--color--); + line-height: 36rpx; + width: 130rpx; + height: 80rpx; + border-radius: 10rpx; +} + +.cy-coupon-no-condition { + background: rgba(153, 153, 153, 1); + border-radius: 10rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 36rpx; + width: 130rpx; + height: 80rpx; +} + +.cy-coupon-receive-condition { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + width: 115%; + margin-left: -18rpx; +} + +.cy-color-red { + color: rgba(255, 57, 57, 1); +} + +.cy-color-default { + color: rgba(153, 153, 153, 1); +} diff --git a/pages/coupon/couponCenterNew.js b/pages/coupon/couponCenterNew.js new file mode 100644 index 0000000..3bcb1e2 --- /dev/null +++ b/pages/coupon/couponCenterNew.js @@ -0,0 +1,547 @@ +const app = getApp(); +const card = require('../../utils/card.js'); +const util = require('../../utils/util.js'); +const wxbarcode = require('../../utils/wxbarcode.js'); +const mqttMessage = require('../../utils/mqttMessage.js'); +var intercode; +Page({ + + /** + * 页面的初始数据 + */ + data: { + couponStatus: [{ + status: 1, + title: "代金券", + select: true, + value: "CASH" + }, { + status: 2, + title: "兑换券", + select: false, + value: "GIFT" + }, { + status: 3, + title: "折扣券", + select: false, + value: "DISCOUNT" + }], + title: [], + list: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.cy_queryCoupon(); + this.setData({ + color: app.globalData.color + }) + }, + /** + * 优惠券 + */ + cy_queryCoupon: function () { + var that = this; + var property = "memberId"; + var keyword = app.globalData.memberId; + var params = { + "property": property, + "keyword": keyword, + "status": 1, + "shopNo": app.globalData.shopNo, + "posNo": app.globalData.posNo, + "amount": 0, + "amountFilter": 0 + } + card.queryGroupCouponsList(params, function success(json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = []; + if (data.list.length > 0) { + for (var item of data.list) { + if (item.cardType == "DISCOUNT") { + console.log(item); + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = app.utils.getZero(parseFloat(item.reduceCost) / 100); + } else if (item.cardType == "GIFT") { + item.unitName = "兑换"; + item.amount = "券"; + item.size = "45rpx"; + item.height = "80rpx;"; + } else if (item.cardType = "PRODUCT") { + item.unitName = "商品"; + item.amount = "券"; + item.size = "45rpx"; + item.height = "80rpx;"; + } + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + if (item.status == 1) { + item.useStatus = "立即使用"; + item.color = app.globalData.color; + } else if (item.status == 2) { + // item.useStatus = "已使用"; + // item.color = "#999"; + continue; + } else if (item.status == 3) { + // item.useStatus = "已过期"; + // item.color = "#999"; + continue; + } + item.type = 0; + item.condition = "满" + app.utils.getOne(parseFloat(item.leastCost) / 100) + "可用"; + item.effective = item.beginTimestamp.split(" ")[0] + " 至 " + item.endTimestamp.split(" ")[0]; + item.useFalg = 1 + item.expireDay="剩余 "+item.expireDay+" 天过期" + list.push(item); + } + that.setData({ + list: list + }) + } + } + that.cy_GiftcouponGrounp(); + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_GiftcouponGrounp: function () { + var that = this; + card.couponCenter("GIFT", 2, function (json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = that.data.list; + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + for (var item of data.list) { + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + // item.amount = app.utils.getZero(parseFloat(item.reduceCost) / 100); + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + //判断是否兑换券显示图片 + if (that.data.couponStatus[2].select) { + item.showImage = true; + } else { + item.showImage = false; + } + item.color = app.globalData.color + + // item.condition = "满" + app.utils.getOne(parseFloat(item.leastCost) / 100) + "可用"; + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.expireDay="剩余 "+item.expireDay+" 天过期" + if (item.status == 0) { + // item.bgImage = "../../images/icon-coupon-unimage.png"; + item.type = 2; + item.useStatus = "条件不足"; + item.expireDay=item.effective + } else if (item.status == 1) { + item.useStatus = "立即领取"; + item.expireDay=item.effective + item.type = 1; + } + item.useFalg = 0 + list.push(item); + } + that.setData({ + list: list + }) + } + } + that.cy_CASHcouponGrounp(); + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_CASHcouponGrounp: function () { + var that = this; + card.couponCenter("CASH", 2, function (json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = that.data.list; + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + for (var item of data.list) { + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + // item.amount = app.utils.getZero(parseFloat(item.reduceCost) / 100); + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + //判断是否兑换券显示图片 + if (that.data.couponStatus[2].select) { + item.showImage = true; + } else { + item.showImage = false; + } + item.color = app.globalData.color + + // item.condition = "满" + app.utils.getOne(parseFloat(item.leastCost) / 100) + "可用"; + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.expireDay="剩余 "+item.expireDay+" 天过期" + if (item.status == 0) { + item.useStatus = "条件不足"; + item.type = 2; + item.expireDay=item.effective + } else if (item.status == 1) { + item.useStatus = "立即领取"; + item.expireDay=item.effective + item.type = 1; + } + item.useFalg = 0 + list.push(item); + } + that.setData({ + list: list + }) + } + } + that.cy_DISCOUNTcouponGrounp(); + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_DISCOUNTcouponGrounp: function () { + var that = this; + card.couponCenter("DISCOUNT", 2, function (json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = that.data.list; + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + for (var item of data.list) { + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + } else { + if (item.personLimitNum != 0) { + item.syNum = item.personLimitNum - num + } + } + + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + // item.amount = app.utils.getZero(parseFloat(item.reduceCost) / 100); + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + //判断是否兑换券显示图片 + if (that.data.couponStatus[2].select) { + item.showImage = true; + } else { + item.showImage = false; + } + item.color = app.globalData.color + + // item.condition = "满" + app.utils.getOne(parseFloat(item.leastCost) / 100) + "可用"; + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.expireDay="剩余 "+item.expireDay+" 天过期" + if (item.status == 0) { + item.useStatus = "条件不足"; + item.type = 2; + item.expireDay=item.effective + } else if (item.status == 1) { + item.useStatus = "立即领取"; + item.type = 1; + item.expireDay=item.effective + } + item.useFalg = 0; + list.push(item); + } + + that.setData({ + list: list, + // background:list.length>0?"#f3f3f3":"white" + }) + } + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + + queryCouponDetail: function (e) { + var index = e.currentTarget.dataset.index; + var coupon = this.data.list[index]; + if (coupon) { + console.error(coupon, ".......---"); + wx.navigateTo({ + url: 'couponDetailNew?couponDetail=' + JSON.stringify(coupon), + }) + } + }, + + useCode: function (e) { + console.error(e, "......."); + + var couponId = e.currentTarget.dataset.couponid; + var formId = e.detail.formId; + var code = e.currentTarget.dataset.code; + this.setData({ + code: code + }) + app.globalData.oldCode = code; + wxbarcode.barcode('barcode', code, 680, 200); + wxbarcode.qrcode('qrcode', code, 450, 450); + var that = this; + that.setData({ + hiden: true + }) + var i = 0; + if (intercode) + clearInterval(intercode); + + intercode = setInterval(function () { + i = i + 1; + wxbarcode.barcode('barcode', code, 680, 200); + wxbarcode.qrcode('qrcode', code, 450, 450); + if (i == 10) { + clearInterval(intercode); + } + + }, 1000) + that.subscribeCouponCode(); + that.senUseCodedMessage(formId, couponId); + }, + receive: function (e) { + var status = e.currentTarget.dataset.status; + var index = e.currentTarget.dataset.index; + var coupon = this.data.list[index]; + if (coupon) { + if (coupon.useFalg == 1) { + this.useCode(e); + return; + } + } else { + wx.showToast({ + title: '小程序获取卡券失败', + }) + return; + } + console.error(e, "...") + if (status == 0) { + util.showWaring("条件不足!") + return; + } + var schemeId = e.currentTarget.dataset.id; + var formId = e.detail.formId; + wx.showLoading({ + title: '兑换中', + }) + var that = this; + card.exchangeCouponScheme(schemeId, function (success) { + var result = success.data; + if (result.status == 1) { + wx.showToast({ + title: "兑换成功", + icon: "none", + duration: 2000 + }) + that.cy_queryCoupon(); + var codes = result.data.codes; + wx.requestSubscribeMessage({ + tmplIds:app.globalData.templateMsgList, + success:function (params) { + console.error(" success ",params) + card.sendTemPlate("receiveCoupon", formId, codes, function (success) {},function (error) {}); + }, + fail:function (params) { + console.error(" error ",params) + } + }) + + } else { + wx.showToast({ + title: result.errMessage, + icon: "none", + duration: 3000 + }) + } + wx.hideLoading(); + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_goto_myCoupon: function () { + wx.redirectTo({ + url: '/pages/mine/myCoupon', + }) + }, + /** + * 订阅优惠券核销主题 + */ + subscribeCouponCode: function () { + mqttMessage.mqttSubscribe(4); + mqttMessage.mqttOn(this); + }, + senUseCodedMessage: function (formId, couponId) { + console.error(couponId + ".......") + card.sendTemPlate("couponCode", formId, couponId, function (success) {}, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + close: function () { + this.setData({ + hiden: false + }) + clearInterval(intercode); + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + }, + onMessage: function (top, msg) { + app.globalFunction.consumeCouponCallBack(JSON.stringify(msg)); + }, + onHide: function () { + if (this.data.code) { + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + } + clearInterval(intercode); + }, + onUnload: function () { + if (this.data.code) { + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + } + clearInterval(intercode); + }, +}) \ No newline at end of file diff --git a/pages/coupon/couponCenterNew.json b/pages/coupon/couponCenterNew.json new file mode 100644 index 0000000..0161f45 --- /dev/null +++ b/pages/coupon/couponCenterNew.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "领券中心" +} \ No newline at end of file diff --git a/pages/coupon/couponCenterNew.wxml b/pages/coupon/couponCenterNew.wxml new file mode 100644 index 0000000..cbcdd18 --- /dev/null +++ b/pages/coupon/couponCenterNew.wxml @@ -0,0 +1,43 @@ + + + + + + + 我的券 + + + + 暂无优惠券 + + + + \ No newline at end of file diff --git a/pages/coupon/couponCenterNew.wxss b/pages/coupon/couponCenterNew.wxss new file mode 100644 index 0000000..e4b576b --- /dev/null +++ b/pages/coupon/couponCenterNew.wxss @@ -0,0 +1,269 @@ +@import '../../template/coupon/couponTemplate.wxss'; + +.use { + width: 130rpx; + text-align: center; + /* margin-top: 64rpx; */ + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: bold; + color: rgba(255, 255, 255, 1); + /* height: 130rpx; */ + background: no-repeat; + line-height: 35rpx; + left: -2rpx; + width: 130rpx; + height: 80rpx; +} + +/* .cy-coupon-table { + position: absolute; + top: 20rpx; + left: 20rpx; + right: 20rpx; + bottom: 20rpx; +} + +.cy-coupon-table-header { + position: fixed; + width: 100%; + height: 80rpx; +} + +.cy-coupon-table-header text { + font-size: 14px; + padding-left: 40rpx; + line-height: 80rpx; + color: gray; +} + +.cy-coupon-table-row { + position: relative; + margin-bottom: 15rpx; + display: block; + width: 100%; + height: 180rpx; + border-radius: 3px; + background-color: white; +} + +.cy-coupon-no { + position: relative; + margin-top: 360rpx; + font-size: 16px; + width: 100%; + height: 80rpx; + text-align: center; + color: #c0c0c0; +} */ + +/* .cy-coupon-title { + width: 30%; + height: 100%; + color: white; + +} */ + +/* .cy-coupon-deduction { + width: 100%; + height: 60%; + color: rgb(0, 179, 103); + font-size: 20px; +} + +.cy-coupon-limit { + width: 50%; + height: 100%; + font-size: 18px; +} + +.cy-coupon-worth { + width: 100%; + height: 60%; + font-size: 16px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.cy-coupon-use-condition { + width: 100%; + height: 40%; + font-size: 13px; + text-align: center; + color: rgb(0, 179, 103); +} + +.cy-coupon-use-time { + width: 100%; + height: 40%; + font-size: 13px; + color: gray; +} + +.cy-coupon-lead { + width: 20%; + height: 100%; + font-size: 12px; + color: white; +} + +.cy-coupon-lead view { + width: 100%; + height: 60rpx; + background-color: orangered; + border-radius: 50rpx; +} */ +.qcode-bg { + width: 660rpx; + height: 900rpx; + position: fixed; + top: 120rpx; +} + +.applytitle { + position: relative; + height: 76rpx; + width: 619rpx; + border-bottom: 1rpx solid rgba(153, 153, 153, 1); + margin-left: 20rpx; + font-size: 36rpx; + color: #666; + text-align: center; + padding-top: 100rpx; +} + +.barcode { + margin-left: 30rpx; + margin-top: 60rpx; +} + +.barcode>canvas { + width: 600rpx; + height: 180rpx; +} + +.codenumber { + margin-top: 24rpx; + color: #666; + position: relative; + text-align: center; +} + +.qrcode { + margin-left: 110rpx; +} + +.qrcode>canvas { + width: 420rpx; + height: 400rpx; +} + +.shade { + top: 0; + right: 0; + left: 0; + bottom: 0; + overflow: hidden; + opacity: 1; + background-color: rgba(0, 0, 0, 0.6); + z-index: 2; + position: fixed; + width: 100%; + height: 100%; +} + +.apply { + width: 660rpx; + height: 900rpx; + position: fixed; + top: 65rpx; + left: 45rpx; + z-index: 999; +} + +.closeapply { + width: 60rpx; + height: 60rpx; + position: absolute; + bottom: -100rpx; + left: 300rpx; +} + +.closeapply image { + width: 100%; + height: 100%; + margin-top: 50rpx; +} + +.cy-coupon-uses { + /* background: rgba(255, 198, 57, 1); */ + background: var(--color--); + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 36rpx; + border-radius: 10rpx; +} + +.cy-coupon-receive { + /* border: 2rpx solid rgba(255, 198, 57, 1); */ + border: 2rpx solid var(--color--); + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + /* color: rgba(255, 198, 57, 1); */ + color: var(--color--); + line-height: 36rpx; + width: 130rpx; + height: 80rpx; + border-radius: 10rpx; +} + +.cy-coupon-no-condition { + background: rgba(153, 153, 153, 1); + border-radius: 10rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 36rpx; +} + +.cy-coupon-receive-condition { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + width: 115%; + margin-left: -18rpx; +} + +.cy-color-red { + color: rgba(255, 57, 57, 1); +} + +.cy-color-default { + color: rgba(153, 153, 153, 1); +} +.cy-no-coupon { + width: 507rpx; + height: 401rpx; + margin: auto auto; + margin-top: 150rpx; + text-align: center; + line-height: 130rpx; + font-size: 36rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.cy-no-coupon image { + width: 100%; + height: 100%; +} + +/* page{ + background: var(--color--); +} */ \ No newline at end of file diff --git a/pages/coupon/couponDes.js b/pages/coupon/couponDes.js new file mode 100644 index 0000000..6da67c7 --- /dev/null +++ b/pages/coupon/couponDes.js @@ -0,0 +1,70 @@ +// pages/coupon/couponDes.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.hideShareMenu(); + var des = options.des.split(";"); + this.setData({ + des: des + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/coupon/couponDes.json b/pages/coupon/couponDes.json new file mode 100644 index 0000000..59f9be4 --- /dev/null +++ b/pages/coupon/couponDes.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "使用须知" +} \ No newline at end of file diff --git a/pages/coupon/couponDes.wxml b/pages/coupon/couponDes.wxml new file mode 100644 index 0000000..68fa8f0 --- /dev/null +++ b/pages/coupon/couponDes.wxml @@ -0,0 +1,17 @@ + + + 使用须知 + + + + + + + {{item}} + + + + + + \ No newline at end of file diff --git a/pages/coupon/couponDes.wxss b/pages/coupon/couponDes.wxss new file mode 100644 index 0000000..4630d1f --- /dev/null +++ b/pages/coupon/couponDes.wxss @@ -0,0 +1,35 @@ +page { + background-color: white; +} + +.cy-use-back { + width: 100%; + height: auto; +} + +.cy-use-title { + width: 100%; + height: 120rpx; + font-size: 14px; +} + +.cy-view { + width: 100%; + height: 80rpx; +} + +.cy-line { + width: 80%; + height: 1px; + background-color: gainsboro; +} + +.cy-use-condition{ + width: 100%; + height: auto; +} + +.cy-use-condition view{ + font-size: 12px; + color: gray; +} diff --git a/pages/coupon/couponDetail.js b/pages/coupon/couponDetail.js new file mode 100644 index 0000000..6195853 --- /dev/null +++ b/pages/coupon/couponDetail.js @@ -0,0 +1,132 @@ +var wxbarcode = require('../../utils/wxbarcode.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + screenBrightness: 0.5, + content: "" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.hideShareMenu(); + var content = JSON.parse(options.content); + var oldCode = content.code; + var code = oldCode.replace(/[\s]/g, '').replace(/(\d{4})(?=\d)/g, "$1 "); + this.setData({ + content: content, + title: content.title, + code: code, + useTime: content.startDate + "至" + content.endDate, + useCondition: content.useLabel + }); + wxbarcode.barcode('barcode', oldCode, 600, 160); + wxbarcode.qrcode('qrcode', oldCode, 400, 400); + }, + + /** + * 使用说明 + */ + cy_couponUseExplain: function(e) { + var coupon = this.data.content; + var code = coupon.code; + var title = coupon.title; + var subTitle = coupon.subTitle; + var startDate = coupon.startDate; + var endDate = coupon.endDate; + var couponDesc = coupon.couponDesc; + var useLabel = coupon.useLabel; + var url = "couponInstructions?title=" + title + '&startDate=' + startDate + '&endDate=' + endDate + '&couponDesc=' + couponDesc + '&useLabel=' + useLabel; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 分享转赠 + */ + cy_couponShare: function(e) { + var url = "couponShare"; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 使用门店 + */ + cy_couponUseStore: function(e) { + var coupon = this.data.content; + var url = "couponUseStore"; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + var that = this; + wx.getScreenBrightness({ + success: function(res) { + that.data.screenBrightness = res.value; + wx.setScreenBrightness({ + value: 0.75, + }) + } + }); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + var that = this; + wx.setScreenBrightness({ + value: that.data.screenBrightness, + }) + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + var that = this; + wx.setScreenBrightness({ + value: that.data.screenBrightness, + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/pages/coupon/couponDetail.json b/pages/coupon/couponDetail.json new file mode 100644 index 0000000..f568ac7 --- /dev/null +++ b/pages/coupon/couponDetail.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "卡券详情" +} \ No newline at end of file diff --git a/pages/coupon/couponDetail.wxml b/pages/coupon/couponDetail.wxml new file mode 100644 index 0000000..32db541 --- /dev/null +++ b/pages/coupon/couponDetail.wxml @@ -0,0 +1,21 @@ + + + + {{title}} + + + + + + + + + + {{code}} + + 使用条件:{{useTime}} + {{useCondition}} + + + + \ No newline at end of file diff --git a/pages/coupon/couponDetail.wxss b/pages/coupon/couponDetail.wxss new file mode 100644 index 0000000..a9431d6 --- /dev/null +++ b/pages/coupon/couponDetail.wxss @@ -0,0 +1,143 @@ +page { + background-color: #004585; +} + +.page { + padding: 40rpx; +} + +.gift_card { + position: relative; + background: #fff; + overflow: hidden; +} + +.gift_dv1 { + padding: 0 1.5rem 0.5rem 1.5rem; + text-align: center; +} + +.ico_yuan { + position: relative; +} + +.ico_yuan:before { + background: #004585; +} + +.ico_yuan:before { + content: ""; + position: absolute; + bottom: -20rpx; + right: -20rpx; + width: 40rpx; + height: 40rpx; + border-radius: 40rpx; + z-index: 7; +} + +.ico_yuan:after { + background: #004585; +} + +.ico_yuan:after { + content: ""; + position: absolute; + bottom: -20rpx; + left: -20rpx; + width: 40rpx; + height: 40rpx; + border-radius: 40rpx; + z-index: 7; +} + +.gift_cp1 { + padding: 1rem 0 0.5rem 0; + font-size: 18px; + color: #666; +} + +.gift_cp2 { + font-size: 26px; + color: #333; +} + +.ico_no { + position: flex; +} + +.border { + position: relative; +} + +.b_top2:before { + border-top: 1px dashed #d1d1d1; +} + +.border:before { + content: ""; + position: absolute; + left: 0; + top: 0; + right: -100%; + bottom: -100%; + pointer-events: none; +} + +.barcode { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.barnum { + width: 100%; + height: 100rpx; + text-align: center; + font-size: 20px; + letter-spacing: 2rpx; +} + +.barnum view { + padding: 0 25rpx; + font-size: 12px; + text-align: center; + color: #999; +} + +.barcode > canvas { + width: 600rpx; + height: 180rpx; +} + +.qrcode { + height: 420rpx; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: center; +} + +.qrcode > canvas { + width: 420rpx; + height: 420rpx; +} + +.cy-bottom { + position: relative; + top: 20rpx; + margin-bottom: 40rpx; + width: 100%; + height: 360rpx; + border-radius: 3px; + overflow: hidden; +} + +.cy-coupon-use-info { + width: 100%; + height: 119rpx; + padding-left: 25rpx; + background-color: white; + border-bottom: 1px solid #eee; +} diff --git a/pages/coupon/couponDetailNew.js b/pages/coupon/couponDetailNew.js new file mode 100644 index 0000000..71cd4c4 --- /dev/null +++ b/pages/coupon/couponDetailNew.js @@ -0,0 +1,182 @@ +var app = getApp(); +const util = require('../../utils/util.js'); +const card = require('../../utils/card.js'); +const wxbarcode = require('../../utils/wxbarcode.js'); +const mqttMessage = require('../../utils/mqttMessage.js'); +var intercode; +Page({ + + + data: { + num: 0, + fontSize: 100, + hiden:false + }, + /** + * 订阅优惠券核销主题 + */ + subscribeCouponCode: function () { + mqttMessage.mqttSubscribe(4); + mqttMessage.mqttOn(this); + }, + onHide: function () { + if (this.data.code) { + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + } + clearInterval(intercode); + }, + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: "优惠券详情", + }) + if (options.couponDetail) { + var couponDetail = JSON.parse(options.couponDetail); + this.queryCouponShopNum(couponDetail.couponId); + var time = "有效期:" + util.formatTimeV(new Date(couponDetail.beginTimestamp), "yyyy-MM-dd") + "-" + util.formatTimeV(new Date(couponDetail.endTimestamp), "yyyy-MM-dd"); + var timeLimit = couponDetail.timeLimit; + var timeDesc = "周一至周日"; + if (timeLimit != "") { + timeDesc = ""; + if (timeLimit.indexOf("MONDAY") > -1) { + timeDesc += "、周一" + } + if (timeLimit.indexOf("TUESDAY") > -1) { + timeDesc += "、周二" + } + if (timeLimit.indexOf("WEDNESDAY") > -1) { + timeDesc += "、周三" + } + if (timeLimit.indexOf("THURSDAY") > -1) { + timeDesc += "、周四" + } + if (timeLimit.indexOf("FRIDAY") > -1) { + timeDesc += "、周五" + } + if (timeLimit.indexOf("SATURDAY") > -1) { + timeDesc += "、周六" + } + if (timeLimit.indexOf("SUNDAY") > -1) { + timeDesc += "、周日" + } + timeDesc = timeDesc.substring(1, timeDesc.length); + } + couponDetail.time = time; + couponDetail.timeDesc = timeDesc; + if (couponDetail.cardType == 'CASH') { + couponDetail.prefix = "¥" + couponDetail.context = couponDetail.reduceCost; + } else if (couponDetail.cardType == 'PRODUCT') { + couponDetail.prefix = "商" + this.setData({ + fontSize: 45 + }) + couponDetail.context = couponDetail.title; + } else if (couponDetail.cardType == 'DISCOUNT') { + couponDetail.prefix = "折" + couponDetail.context = couponDetail.discount; + } else if (couponDetail.cardType == 'GIFT') { + couponDetail.prefix = "兑" + this.setData({ + fontSize: 45 + }) + couponDetail.context = couponDetail.title; + } else if (couponDetail.cardType == 'NEWPRODUCT ') { + couponDetail.prefix = "新" + this.setData({ + fontSize: 45 + }) + couponDetail.context = couponDetail.title; + } + if (couponDetail.couponDesc) { + this.setData({ + list: couponDetail.couponDesc.split('\n') + }) + } + this.setData({ + couponDetail: couponDetail + }); + } else { + app.showMsg("缺少券详情即将返回上一层", "none"); + wx.navigateBack({}) + } + + }, + queryCouponShopNum: function (id) { + var that = this; + wx.getLocation({ + type: 'gcj02', + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude + card.getCouponApplyShopNum(id, latitude, longitude, function (res) { + var result = res.data; + if (result.status == 1) { + that.setData({ + num: result.pageCount + }) + } else { + app.showMsg("获取优惠券适用门店失败=>" + result.errorMessage, "none"); + } + }, function (res) { + app.showMsg("网络异常哦", "none"); + }) + } + }) + }, + + onReady: function () { + + }, + + + onShow: function () { + this.setData({color:app.globalData.color}) + }, + + + lookShop: function (e) { + var couponId = e.currentTarget.dataset.couponid; + wx.navigateTo({ + url: 'applyShop?couponId=' + couponId, + }) + }, + userCoupon: function (e) { + var detail = this.data.couponDetail; + var code = detail.code; + var title = detail.title; + var subTitle = detail.subtitle; + app.globalData.oldCode = code; + wxbarcode.barcode('barcode', code, 680, 200); + wxbarcode.qrcode('qrcode', code, 450, 450); + var that = this; + that.setData({ + hiden: true, + code:code + }) + var i = 0; + if (intercode) + clearInterval(intercode); + + intercode = setInterval(function () { + i = i + 1; + wxbarcode.barcode('barcode', code, 680, 200); + wxbarcode.qrcode('qrcode', code, 450, 450); + if (i == 10) { + clearInterval(intercode); + } + }, 1000) + }, + close: function () { + this.setData({ + hiden: false + }) + clearInterval(intercode); + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + }, + onUnload: function () { + if (this.data.code) { + mqttMessage.mqttunSubscribe(app.getCouponConsumeCode(this.data.code)); + } + clearInterval(intercode); + }, +}) \ No newline at end of file diff --git a/pages/coupon/couponDetailNew.json b/pages/coupon/couponDetailNew.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/coupon/couponDetailNew.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/coupon/couponDetailNew.wxml b/pages/coupon/couponDetailNew.wxml new file mode 100644 index 0000000..dd4f05d --- /dev/null +++ b/pages/coupon/couponDetailNew.wxml @@ -0,0 +1,38 @@ + + + + + + + {{couponDetail.prefix}} + + + {{couponDetail.context}} + + {{couponDetail.subTitle}} + + {{couponDetail.time}} + {{couponDetail.timeDesc}} + + + + 使用说明 + + + + {{item}} + + + + + + 适用门店 + {{num}} + + + + 立即使用 + + + + diff --git a/pages/coupon/couponDetailNew.wxss b/pages/coupon/couponDetailNew.wxss new file mode 100644 index 0000000..c45edaf --- /dev/null +++ b/pages/coupon/couponDetailNew.wxss @@ -0,0 +1,248 @@ +/* pages/coupon/couponDetailNew.wxss */ +.couponDeatilContent { + width: 93%; + height: 100%; + margin: auto auto; + margin-top: 20rpx; +} + +.couponDetailBg { + width: 100%; + background-image: url(http://pos.juweiyun.cn/membercouponDetailBg.png); + height: 370rpx; + background-repeat: no-repeat; + background-size: 100% 100%; +} + +.couponDeatilDescribe { + width: 100%; + background-image: url(http://pos.juweiyun.cn/373001/file/wechatAppmemberunder%402x.png); + background-repeat: no-repeat; + background-size: 100% 100%; + min-height: 300rpx; + display: flex; + flex-direction: column; + align-content: center; + align-items: center; +} + +.useMessage { + width: 100%; + height: 40rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + margin-top: 30rpx; +} + +.couponDeatilDescribeItem { + width: 90%; +} + +.useMessageContext { + width: 100%; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(153, 153, 153, 1); + line-height: 38rpx; + margin-top: 30rpx; +} + +.item { + border-top: 1px solid rgba(224, 224, 224, 1); + margin-top: 20rpx; + min-height: 80rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-content: center; + align-items: center; +} + +.jt { + width: 16rpx; + height: 24rpx; + display: inline-block; +} + +.block { + display: inline-block; +} + +.num { + width: 70rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 84, 84, 1); +} + +.useMessage2 { + width: 100%; + height: 40rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.couponDetailUse { + width: 80%; + height: 90rpx; + background: rgba(251, 184, 41, 1); + border-radius: 16rpx; + text-align: center; + font-size: 36rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 90rpx; + margin: auto auto; + margin-top: 65rpx; + margin-bottom: 65rpx; +} + +.detail1 { + width: 90%; + height: 100rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + margin: auto auto; +} + +.text-btm { + /* margin-bottom: 10px; + padding-top: 200rpx; */ +} + +.one { + height: 41rpx; + font-size: 56rpx; + font-family: PingFang SC; + font-weight: bold; + color: rgba(255, 255, 255, 1); +} + +.detail0 { + width: 100%; + height: 180rpx; +} + +.tow { + /* width: 135rpx; */ + height: 76rpx; + /* font-size: 100rpx; */ + font-family: PingFang SC; + font-weight: bold; + color: rgba(255, 255, 255, 1); + margin-left: 10rpx; + margin-right: 25rpx; + margin-top: -60rpx; + text-align: center; +} + +.three { + /* width: 100%; */ + height: 100rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 255, 255, 1); + margin-top: 28rpx; + -webkit-line-clamp: 4; /**显示的行数**/ + overflow: hidden; /**隐藏超出的内容**/ + margin-left: 10rpx; +} + +.detail2 { + width: 90%; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(255, 255, 255, 1); + margin: auto auto; +} +.qcode-bg { + width: 660rpx; + height: 900rpx; + position: fixed; + top: 110rpx; +} + +.applytitle { + position: relative; + height: 76rpx; + width: 619rpx; + border-bottom: 1rpx solid rgba(153, 153, 153, 1); + margin-left: 20rpx; + font-size: 36rpx; + color: #666; + text-align: center; + padding-top: 100rpx; +} + +.barcode { + margin-left: 30rpx; + margin-top: 60rpx; +} + +.barcode>canvas { + width: 600rpx; + height: 180rpx; +} + +.codenumber { + margin-top: 24rpx; + color: #666; + position: relative; + text-align: center; +} + +.qrcode { + margin-left: 110rpx; +} + +.qrcode>canvas { + width: 420rpx; + height: 400rpx; +} + +.shade { + top: 0; + right: 0; + left: 0; + bottom: 0; + overflow: hidden; + opacity: 1; + background-color: rgba(0, 0, 0, 0.6); + z-index: 2; + position: fixed; + width: 100%; + height: 100%; +} + +.apply { + width: 660rpx; + height: 900rpx; + position: fixed; + top: 65rpx; + left: 45rpx; + z-index: 999; +} + +.closeapply { + width: 60rpx; + height: 60rpx; + position: absolute; + bottom: -100rpx; + left: 300rpx; +} + +.closeapply image { + width: 100%; + height: 100%; + margin-top: 50rpx; +} diff --git a/pages/coupon/couponInfo.js b/pages/coupon/couponInfo.js new file mode 100644 index 0000000..ebcd963 --- /dev/null +++ b/pages/coupon/couponInfo.js @@ -0,0 +1,71 @@ +// pages/coupon/couponInfo.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.hideShareMenu(); + var coupon = JSON.parse(options.content); + console.log(options.content); + this.setData({ + coupon: coupon, + title: coupon.title, + startDate: coupon.startDate, + endDate: coupon.endDate + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + + /** + * 立即使用 + */ + cy_once_use: function() { + var content = JSON.stringify(this.data.coupon); + var url = 'couponDetail?content=' + content; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 适用门店 + */ + cy_use_store: function() { + var url = "../store/list"; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 使用须知 + */ + cy_use_info: function() { + var url = "couponDes?des=" + this.data.coupon.couponDesc; + wx.navigateTo({ + url: url, + }) + }, +}) \ No newline at end of file diff --git a/pages/coupon/couponInfo.json b/pages/coupon/couponInfo.json new file mode 100644 index 0000000..7b669c7 --- /dev/null +++ b/pages/coupon/couponInfo.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "卡券详情" +} \ No newline at end of file diff --git a/pages/coupon/couponInfo.wxml b/pages/coupon/couponInfo.wxml new file mode 100644 index 0000000..7a5a319 --- /dev/null +++ b/pages/coupon/couponInfo.wxml @@ -0,0 +1,41 @@ + + + + + + + {{title}} + 请提前出示给服务员 + + + + + 立即使用 + + + 有效期 + {{startDate}} 至 {{endDate}} + 周一至周日 + + + + + 适用门店 + + 查看详情 + + + + + 使用须知 + + 查看详情 + + + + + + \ No newline at end of file diff --git a/pages/coupon/couponInfo.wxss b/pages/coupon/couponInfo.wxss new file mode 100644 index 0000000..ad3193b --- /dev/null +++ b/pages/coupon/couponInfo.wxss @@ -0,0 +1,87 @@ +page { + background-color: #004585; +} + +.cy-coupon-back { + margin: 40rpx; + width: 670rpx; + height: auto; + background-color: white; + overflow: hidden; +} + +.cy-coupon-top { + width: 100%; + height: 200rpx; + background-color: white; +} + +.cy-image { + margin: 30rpx 40rpx; + width: 140rpx; + height: 140rpx; +} + +.cy-coupon-content { + width: 320rpx; + height: 100%; +} + +.cy-coupon-worth { + width: 100%; + height: 50%; + font-size: 16px; +} + +.cy-coupon-bottom { + width: 100%; + height: 850rpx; + background-color: white; + border-top: 1px solid #eee; +} + +.cy-coupon-use { + width: 100%; + height: 180rpx; + background-color: white; +} + +.cy-coupon-use view { + width: 350rpx; + height: 70rpx; + font-size: 14px; + color: white; + background-color: #004585; + border-radius: 80rpx; +} + +.cy-coupon-use-time { + width: 100%; + height: 180rpx; + font-size: 10px; +} + +.cy-use-list { + width: 100%; + height: auto; +} + +.cy-use-list view { + width: 100%; + height: 80rpx; + border-top: 1px solid #eee; +} + +.cy-use-item { + width: 20rpx; + height: 100%; + line-height: 80rpx; + text-align: center; + font-size: 12px; +} + +.iconfont { + margin-left: 15rpx; + font-size: 22rpx; + font-weight: 900; +} diff --git a/pages/coupon/couponShare.js b/pages/coupon/couponShare.js new file mode 100644 index 0000000..e926945 --- /dev/null +++ b/pages/coupon/couponShare.js @@ -0,0 +1,66 @@ +// pages/coupon/couponShare.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/coupon/couponShare.json b/pages/coupon/couponShare.json new file mode 100644 index 0000000..807cc54 --- /dev/null +++ b/pages/coupon/couponShare.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "分享转赠" +} \ No newline at end of file diff --git a/pages/coupon/couponShare.wxml b/pages/coupon/couponShare.wxml new file mode 100644 index 0000000..a7db752 --- /dev/null +++ b/pages/coupon/couponShare.wxml @@ -0,0 +1,2 @@ + + diff --git a/pages/coupon/couponShare.wxss b/pages/coupon/couponShare.wxss new file mode 100644 index 0000000..c88033e --- /dev/null +++ b/pages/coupon/couponShare.wxss @@ -0,0 +1 @@ +/* pages/coupon/couponShare.wxss */ \ No newline at end of file diff --git a/pages/coupon/couponTotal.js b/pages/coupon/couponTotal.js new file mode 100644 index 0000000..bd1f004 --- /dev/null +++ b/pages/coupon/couponTotal.js @@ -0,0 +1,210 @@ +// pages/coupon/couponT.js +// var sliderWidth = 96; // 需要设置slider的宽度,用于计算中间位置 +const app = getApp(); +const card = require('../../utils/card.js'); +const util = require('../../utils/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + hidden: false, + tabs: [{ + "name": "未使用", + "checked": true, + }, + { + "name": "已使用", + "checked": false, + }, + { + "name": "已过期", + "checked": false, + } + ], + activeIndex: 0, + sliderOffset: 0, + sliderLeft: 0, + isUpdate: false, + couponList1: [], + couponList2: [], + couponList3: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + this.cy_selectCouponList(0); + }, + + /** + * 选择状态 + */ + cy_selectTypeCoupon: function(e) { + var index = e.currentTarget.dataset.index; + for (var i = 0; i < this.data.tabs.length; i++) { + var map = this.data.tabs[i]; + map.checked = false; + if (i == index) { + map.checked = true; + } + } + this.setData({ + activeIndex: index, + tabs: this.data.tabs, + hidden: false + }); + this.cy_selectCouponList(index); + + }, + + /** + * 查询优惠券信息 + */ + cy_selectCouponList: function(status) { + var that = this; + var property = "memberId"; + var keyword = app.memberId; + var status = parseInt(status) + 1; + var params = { + "property": property, + "keyword": keyword, + "status": status, + "shopNo": app.shopNo, + "posNo": app.posNo, + "amount": 0, + "amountFilter": 0 + } + + + card.queryGroupCouponsList(params, function success(json) { + var result = json.data; + if (result.status == 1) { + var couponList = result.list; + var couponDatas = []; + for (var value of couponList) { + var couponObject = {}; + couponObject.couponCount = value.couponCount; + couponObject.couponId = value.couponId; + couponObject.couponDesc = value.couponDesc; + couponObject.cardId = value.cardId; + couponObject.code = value.code; + couponObject.title = value.title; + couponObject.color = value.color; + couponObject.cardType = value.cardType; + couponObject.cardTypeCn = value.cardType == "CASH" ? "代金券" : value.cardType == "DISCOUNT" ? "折扣券" : value.cardType == "GIFT" ? "兑换券" : ""; + var worth = value.cardType == "CASH" ? value.reduceCost / 100 : value.cardType == "DISCOUNT" ? value.discount : ""; + couponObject.worth = worth; + couponObject.wxStatus = value.wxStatus; + couponObject.startDate = util.formatTimeV(new Date(value.startDate), "yyyy-MM-dd"); + couponObject.endDate = util.formatTimeV(new Date(value.endDate), "yyyy-MM-dd"); + + if (value.endTimestamp == (couponObject.endDate + " 00:00:00")) { + var endDate = value.endDate; + var endTimestampDate = new Date(endDate); + endTimestampDate.setDate(endTimestampDate.getDate() - 1); //设置天数 -1 天 + couponObject.endDate = util.formatTimeV(endTimestampDate, 'yyyy-MM-dd'); + } + couponObject.wxStatus = value.wxStatus; + if (couponObject.wxStatus == 0) { + var nowDateFormat = util.formatTimeV(new Date(), "yyyy-MM-dd"); + if (couponObject.startDate != nowDateFormat) { + couponObject.wxStatus = 2 + } + } + + var useLabel = "消费金额无限制"; + var leastCost = value.leastCost / 100; + if (leastCost && leastCost != "") { + leastCost = parseInt(leastCost); + if (leastCost > 0) { + useLabel = '满' + leastCost + '元可用'; + } + } + + couponObject.useLabel = useLabel; + couponDatas.push(couponObject); + } + + if (status == 1) { + that.setData({ + couponList1: couponDatas, + hidden: true, + }); + } else if (status == 2) { + that.setData({ + couponList1: couponDatas, + hidden: true, + }); + } else if (status == 3) { + that.setData({ + couponList1: couponDatas, + hidden: true, + }); + } + + } + }, function fail(err) { + that.setData({ + hidden: true, + }); + wx.showToast({ + title: '网络链接失败', + icon: "none" + }) + }); + + + }, + + /** + * 点击选项卡 + */ + cy_tabClick: function(e) { + var that = this; + var activeIndex = e.currentTarget.id; + that.setData({ + sliderOffset: e.currentTarget.offsetLeft, + activeIndex: activeIndex + }); + console.log(activeIndex); + this.cy_selectCouponList(activeIndex); + }, + + /** + * 优惠券明细 + */ + cy_couponDetail: function(e) { + var index = e.currentTarget.dataset.index; + var tempCoupon = this.data.couponList1[index]; + var content = JSON.stringify(tempCoupon); + var url = 'couponInfo?content=' + content; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 领券中心 + */ + cy_couponCenter: function(e) { + var url = 'couponCenter'; + wx.navigateTo({ + url: url, + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + if (this.data.isUpdate) { + this.cy_selectCouponList(this.data.activeIndex); + } + this.data.isUpdate = true; + }, + +}) \ No newline at end of file diff --git a/pages/coupon/couponTotal.json b/pages/coupon/couponTotal.json new file mode 100644 index 0000000..cb95313 --- /dev/null +++ b/pages/coupon/couponTotal.json @@ -0,0 +1,5 @@ +{ + "navigationBarBackgroundColor": "#000", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "优惠券" +} \ No newline at end of file diff --git a/pages/coupon/couponTotal.wxml b/pages/coupon/couponTotal.wxml new file mode 100644 index 0000000..014c790 --- /dev/null +++ b/pages/coupon/couponTotal.wxml @@ -0,0 +1,35 @@ + + + + + + {{item.name}} + + + + + + + + + + ¥{{item.worth}} + + + {{item.title}} + + /       + + 有效期:{{item.startDate}}~{{item.endDate}} + + + + + + 暂无优惠券,敬请关注 + + + + \ No newline at end of file diff --git a/pages/coupon/couponTotal.wxss b/pages/coupon/couponTotal.wxss new file mode 100644 index 0000000..288a798 --- /dev/null +++ b/pages/coupon/couponTotal.wxss @@ -0,0 +1,112 @@ +.cy-back { + position: absolute; + width: 100%; + height: 100%; +} + +.cy-content { + position: absolute; + width: 100%; + height: 100%; +} + +.cy-content-title { + width: 100%; + height: 100rpx; + overflow: hidden; +} + +.cy-content-item { + margin-top: 25rpx; + width: 33.3333%; + height: 80rpx; +} + +.cy-use-item { + width: auto; + height: 50rpx; + font-size: 30rpx; + text-align: center; +} + +.cy-use-line { + width: 90rpx; + height: 5rpx; + background-color: #004585; +} + +.cy-content-list { + position: relative; + width: 100%; + height: auto; + padding-bottom: 20rpx; +} + +.cy-list-item { + margin-top: 25rpx; + margin-left: 35rpx; + width: 680rpx; + height: 200rpx; + background-color: white; + border-radius: 10rpx; + overflow: hidden; +} + +.cy-item-value { + position: relative; + width: 290rpx; + height: 100%; +} + +.cy-item-value image { + width: 200rpx; + height: 120rpx; + border-radius: 8rpx; +} + +.cy-item-value text { + position: absolute; + left: 55rpx; + bottom: 38rpx; + width: auto; + height: auto; + font-size: 18px; + font-weight: 450; + letter-spacing: 3rpx; + color: #aa7e4f; +} + +.cy-item-left-value { + font-size: 22px; + border-right: 1px dashed gainsboro; +} + +.cy-item-des { + width: 380rpx; + height: 100%; +} + +.cy-item-des-title { + margin-top: 30rpx; + width: 100%; + font-size: 16px; + height: 60rpx; + letter-spacing: 8rpx; + padding-top: 5rpx; +} + +.cy-item-date { + width: 100%; + height: 55rpx; + font-size: 10px; + color: #aa7e4f; + font-weight: 300; +} + +.cy-warn-view { + margin-top: 360rpx; + width: 750rpx; + height: auto; + font-size: 14px; + color: #c0c0c0; +} diff --git a/pages/couponCenter/activeRule.js b/pages/couponCenter/activeRule.js new file mode 100644 index 0000000..6bd0eea --- /dev/null +++ b/pages/couponCenter/activeRule.js @@ -0,0 +1,47 @@ +// pages/couponCenter/activeRule.js +const card = require("../../utils/card.js") +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + onLoad: function (options) { + var that = this; + card.memberShareRule(function (success) { + var result = success.data; + if (result.status == 1) { + that.setData({ + description: result.data.description, + startDate: result.data.startDate, + endDate: result.data.endDate, + totalAwardCount: result.data.totalAwardCount, + }) + //积分 + if (result.data.awardType == 0) { + that.setData({ + content: "送 " + result.data.pointValue + " 积分" + }) + } + //优惠券 + else if (result.data.awardType == 1) { + that.setData({ + content: "送卡包 " + result.data.couponPacketName + " 一张" + }) + } + } else { + util.showWaring("暂无活动规则"); + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + } + +}) \ No newline at end of file diff --git a/pages/couponCenter/activeRule.json b/pages/couponCenter/activeRule.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/couponCenter/activeRule.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/couponCenter/activeRule.wxml b/pages/couponCenter/activeRule.wxml new file mode 100644 index 0000000..17ab9e2 --- /dev/null +++ b/pages/couponCenter/activeRule.wxml @@ -0,0 +1,57 @@ + + + + 活动时间 + {{startDate}} 至 {{endDate}} + + + 使用人群 + 参与用户:全部用户 + + 奖励内容: + 每邀请1人成功后{{content}} + + 发放时间:立即发放 + + + + 活动规则介绍 + {{description}} + + + + diff --git a/pages/couponCenter/activeRule.wxss b/pages/couponCenter/activeRule.wxss new file mode 100644 index 0000000..dfe1745 --- /dev/null +++ b/pages/couponCenter/activeRule.wxss @@ -0,0 +1,150 @@ +page { + width: 100%; + height: 100%; + background: rgba(254, 159, 83, 1); +} + +.page { + width: 90%; + height: 100%; + margin: auto auto; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-content: center; + align-items: center; +} + +.wid100 { + width: 100%; + margin-top: 30rpx; + border-radius: 10rpx; + overflow: scroll; + display: flex; + flex-direction: column; + justify-content: flex-start; + padding-top: 20rpx; + padding-left: 20rpx; +} + +.active_rule_time { + height: 120rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_old_user { + height: 230rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_new_user { + height: 240rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_describe { + height: 190rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_title { + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.active_rule_time_value { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(252, 48, 57, 1); + padding-top: 10rpx; +} + +.active_rule_value { + font-size: 26rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(102, 102, 102, 1); + margin-top: 15rpx; +} +.A1{ + display: flex; + flex-direction: row; +} +page { + width: 100%; + height: 100%; + background: rgba(254, 159, 83, 1); +} + +.page { + width: 90%; + height: 100%; + margin: auto auto; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-content: center; + align-items: center; +} + +.wid100 { + width: 100%; + margin-top: 30rpx; + border-radius: 10rpx; + overflow: scroll; + display: flex; + flex-direction: column; + justify-content: flex-start; + padding-top: 20rpx; + padding-left: 20rpx; +} + +.active_rule_time { + height: 120rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_old_user { + height: 280rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_new_user { + height: 240rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_describe { + height: 190rpx; + background: rgba(255, 255, 255, 1); +} + +.active_rule_title { + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.active_rule_time_value { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(252, 48, 57, 1); + padding-top: 10rpx; +} + +.active_rule_value { + font-size: 26rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(102, 102, 102, 1); + margin-top: 15rpx; +} +.A1{ + display: flex; + flex-direction: row; +} diff --git a/pages/couponCenter/exchangeSuccess.js b/pages/couponCenter/exchangeSuccess.js new file mode 100644 index 0000000..2468830 --- /dev/null +++ b/pages/couponCenter/exchangeSuccess.js @@ -0,0 +1,38 @@ +var app=getApp(); +Page({ + data: { + + }, + + returnIndex: function() { + wx.reLaunch({ + url: '../tabbar/index', + }) + }, + + goon: function() { + wx.navigateBack({ + delta: 1, + }) + }, + onLoad: function(options) { + this.setData({color:app.globalData.color}) + if(options.msg){ + this.setData({ + msg:options.msg, + shopType:options.shopType + }) + if (options.productName){ + this.setData({ + productName: options.productName + }) + } + } + }, + + + + onShow: function() { + + } +}) \ No newline at end of file diff --git a/pages/couponCenter/exchangeSuccess.json b/pages/couponCenter/exchangeSuccess.json new file mode 100644 index 0000000..29bfde2 --- /dev/null +++ b/pages/couponCenter/exchangeSuccess.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "兑换成功" +} \ No newline at end of file diff --git a/pages/couponCenter/exchangeSuccess.wxml b/pages/couponCenter/exchangeSuccess.wxml new file mode 100644 index 0000000..aaa2678 --- /dev/null +++ b/pages/couponCenter/exchangeSuccess.wxml @@ -0,0 +1,26 @@ + + + + + + + + 兑换成功 + + + + + 您已使用{{msg}}兑换卡券大礼包 您可在“个人中心-我的优惠券”中查看详情 + + + + 您已使用{{msg}}兑换了“{{productName}}”,我们会尽快给您发货 + + + + + 返回首页 + 继续兑换 + + + \ No newline at end of file diff --git a/pages/couponCenter/exchangeSuccess.wxss b/pages/couponCenter/exchangeSuccess.wxss new file mode 100644 index 0000000..26d8e74 --- /dev/null +++ b/pages/couponCenter/exchangeSuccess.wxss @@ -0,0 +1,87 @@ + +page { + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 1); +} + +.page { + width: 90%; + height: 600rpx; + margin: auto auto; + margin-top: 90rpx; + display: flex; + flex-direction: column; + align-content: center; + align-items: center; + justify-content: space-between; +} + +.exchange_success_image { + width: 132rpx; + height: 132rpx; +} + +.exchange_success_image image { + width: 132rpx; + height: 132rpx; +} + +.exchange_success_title { + width: 160rpx; + height: 34rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: var(--color--); + text-align: center; + margin-top: -80rpx; +} + +.exchange_success_detail { + width: 559rpx; + height: 77rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(102, 102, 102, 1); + line-height: 48rpx; + text-align: left; + padding-left: 30rpx; +} + +.exchange_success_operation { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-around; + align-content: center; + align-items: center; +} + +.exchange_success_return_index { + width: 260rpx; + height: 90rpx; + border: 2rpx solid var(--color--); + border-radius: 10rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + text-align: center; + line-height: 90rpx; +} + +.exchange_success_goto { + width: 260rpx; + height: 90rpx; + background: var(--color--); + border-radius: 10rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(255, 255, 255, 1); + text-align: center; + line-height: 90rpx; +} + diff --git a/pages/couponCenter/index.js b/pages/couponCenter/index.js new file mode 100644 index 0000000..114dc6b --- /dev/null +++ b/pages/couponCenter/index.js @@ -0,0 +1,473 @@ +const app = getApp(); +const util = require("../../utils/util.js") +const card = require('../../utils/card.js'); +Page({ + + data: { + showUpWindow: false + }, + + onLoad: function(options) { + util.setNavTitle4Color("卡券中心", "#FFF9EB"); + this.cy_couponGrounp(); + this.cy_couponPointGrounp(); + this.judgeUpWindown(); + this.hy_getProductByType(); + this.setData({color:app.globalData.color}) + }, + cy_couponPointGrounp: function() { + var that = this; + var list = []; + var len = 0; + card.couponCenter("", 1, function(json) { + var data = json.data; + if (data.status == 1) { + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + for (var item of data.list) { + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } + // else { + // continue; + // } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + } + } + + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + if (item.coverLogo){ + item.logoUrl = item.coverLogo + }else{ + item.logoUrl ="http://pos.juweiyun.cn/373001/file/wechatApp%E5%88%B8%E5%8C%85%402x.png" + } + if (item.status == 0) { + item.bgImage = "../../images/icon-coupon-unimage.png"; + item.useStatus = "条件\不足"; + } else if (item.status == 1) { + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + item.useStatus = "立即\n领取"; + } + item.color = app.globalData.color + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + item.shopType = 0; + list.push(item); + if (list.length == 4) { + break; + } + } + that.setData({ + listPackage: list + }) + } else { + that.setData({ + listPackage: data.list, + }) + } + } else { + wx.showToast({ + title: data.errMessage, + icon: "none" + }) + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + hy_getProductByType: function() { + var that = this; + card.pointAllTypeProduct( function(success) { + var result = success.data; + if (result.status == 1) { + var list = result.list; + var pointProduct=[]; + for (var i = 0; i <4; i++) { + if (list[i]) { + list[i].shopType = (parseInt(0) + 1); + list[i].logoUrl=list[i].imageUrl + pointProduct.push(list[i]); + } + } + that.setData({ + vipProduct: pointProduct + }); + } + }, function(error) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + cy_couponGrounp: function() { + var that = this; + //2 代表免费领取 + card.couponCenter("", 2, function(json) { + console.log(json) + var data = json.data; + if (data.status == 1) { + var list = []; + if (data.list.length > 0) { + var memberReceiveCoupons = data.memberReceiveCoupons; + var memberDayReceiveCoupons = data.memberDayReceiveCoupons; + var list = []; + var flag = 0; + for (var item of data.list) { + if (flag >= 2) { + break; + } + if (memberReceiveCoupons[item.id]) { + var num = memberReceiveCoupons[item.id] ? memberReceiveCoupons[item.id] : 0; + if (item.personLimitNum != 0) { + if (parseFloat(num) >= parseFloat(item.personLimitNum)) { + continue; + } + } else { + continue; + } + } + var dayPersonLimitNum = item.dayPersonLimitNum; + console.error("dayPersonLimitNum", dayPersonLimitNum," memberDayReceiveCoupons[item.id] ",memberDayReceiveCoupons[item.id]) + if (memberDayReceiveCoupons[item.id]) { + var num = memberDayReceiveCoupons[item.id] ? memberDayReceiveCoupons[item.id] : 0; + if (parseFloat(num) >= parseFloat(dayPersonLimitNum)) { + continue; + }else{ + if(item.personLimitNum!=0){ + item.syNum=item.personLimitNum-num + } + } + }else{ + if(item.personLimitNum!=0){ + item.syNum=item.personLimitNum-num + } + } + item.bgImage = "http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"; + if (item.cardType == "DISCOUNT") { + item.unitName = "折"; + item.amount = item.discount; + item.size = "60rpx"; + item.height = "90rpx;"; + } else if (item.cardType == "CASH") { + item.unitName = "¥"; + item.size = "60rpx"; + item.height = "90rpx;"; + item.amount = item.reduceCost; + } else if (item.cardType == "GIFT") { + item.unitName = "兑"; + item.amount = "换券"; + item.size = "34rpx"; + item.height = "60rpx;"; + } + if (item.status == 0) { + item.useStatus = "条件不足"; + item.type=2; + } else if (item.status == 1) { + item.useStatus = "立即领取"; + item.type=1; + } + item.color = app.globalData.color + item.condition = "满" + item.leastCost + "可用"; + item.effective = item.startDate + " 至 " + item.endDate; + list.push(item); + flag++; + } + that.setData({ + list: list + }) + } else { + that.setData({ + list: data.list, + }) + } + } else { + wx.showToast({ + title: data.errMessage, + icon: "none" + }) + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + receive: function(e) { + var status = e.currentTarget.dataset.status; + if (status==0){ + util.showWaring("条件不足!") + return ; + } + var schemeId = e.currentTarget.dataset.id; + var formId = e.detail.formId; + if (schemeId) { + var formId = e.detail.formId; + wx.showLoading({ + title: '领取中', + }) + var that = this; + card.exchangeCouponScheme(schemeId, function(success) { + var result = success.data; + wx.hideLoading(); + if (result.status == 1) { + wx.showToast({ + title: "领取成功", + icon: "none", + duration: 2000 + }) + that.cy_couponGrounp(); + var codes = result.data.codes; + card.sendTemPlate("receiveCoupon", formId, codes, function(success) {}, + function(error) { + + }); + } else { + wx.showToast({ + title: result.errMessage, + icon: "none", + duration: 3000 + }) + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + } else { + util.showWaring("数据参数异常") + } + }, + goto: function(e) { + wx.navigateTo({ + url: e.currentTarget.dataset.url, + }) + }, + + goto_detail: function(e) { + var shopType = e.currentTarget.dataset.shoptype; + var data = {}; + data.shopType = shopType; + if (shopType == 0) { + var id = e.currentTarget.dataset.id; + var list = this.data.listPackage; + data.id = id; + for (var item of list) { + if (item.id) { + if (item.id == id) { + data.couponDetail = item; + } + } + } + } else if (shopType == 1 || shopType == 2) { + var productid = e.currentTarget.dataset.productid; + var schemeid = e.currentTarget.dataset.schemeid; + data.productid = productid; + data.schemeid = schemeid; + var list = this.data.vipProduct; + for (var item of list) { + if (item.productId) { + if (item.productId == productid) { + data.couponDetail = item; + } + } + } + if (data.shopType == 2) { + data.shopType = 1; + } + } + console.error("data",data) + app.globalData.productDetailLogUrl = data.couponDetail.logoUrl; + //怕图片地址太长页面传递参数长度超过限制解析报错 + data.couponDetail.logoUrl=""; + wx.navigateTo({ + url: "productDetail?data=" + JSON.stringify(data), + }) + }, + //关闭弹窗 + closeUpWindows: function() { + this.setData({ + showUpWindow: false + }) + card.closeUpWindow(this.data.schemeId, function(success) {}, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + + + judgeUpWindown: function() { + var that = this; + card.judgeUpWindown(function(success) { + var result = success.data; + if (result.code != 1) { + if (result.data.status == 1) { + if (result.data.schemeId) { + that.setData({ + schemeId: result.data.schemeId + }) + } + var upWindowList = []; + var items = {}; + for (var item of result.data.list) { + items.title = item.title; + items.id = item.id; + items.logoUrl = "http://imgv1.jwsaas.com/" + item.logoUrl; + if (item.quantity) { + items.quantity = item.quantity + } else { + items.quantity = 0 + } + if (item.dateType == 0) { + var startTime = ""; + var endTime = ""; + if (item.beginTimestamp) { + startTime = util.formatTimeV(new Date(parseInt(item.beginTimestamp)), "yyyy-MM-dd"); + } + if (item.endTimestamp) { + endTime = util.formatTimeV(new Date(parseInt(item.endTimestamp)), "yyyy-MM-dd"); + } + items.time = startTime + " 至 " + endTime; + } else if (item.dateType == 1) { + + if (item.fixedBeginTerm || item.fixedBeginTerm == 0) { + var pre = ""; + if (item.fixedBeginTerm == 0) { + pre = "立即生效"; + } else { + pre = item.fixedBeginTerm + "天后生效"; + } + var sup = ""; + if (item.fixedTerm) { + sup = " 有效期" + item.fixedTerm + "天"; + } + items.time = pre + sup; + } + } + + items.cardTypeCn = item.cardType == "CASH" ? "代金券" : item.cardType == "DISCOUNT" ? "折扣券" : item.cardType == "GIFT" ? "兑换券" : item.cardType == "PRODUCT" ? "单品券" : ""; + var content = ""; + if (items.cardTypeCn == "兑换券") { + if (item.subTitle) { + content = item.subTitle + } + } else if (items.cardTypeCn == "代金券") { + var leastCost = 0; + var reduceCost = 0; + if (item.leastCost) leastCost = item.leastCost + if (item.reduceCost) reduceCost = item.reduceCost + content = "满" + leastCost + "元 减 " + reduceCost + " 元"; + } else if (items.cardTypeCn == "折扣券") { + if (item.discount) { + content = item.discount + "折"; + } + } else if (items.cardTypeCn == "单品券") { + if (item.grantType == '1') content = item.discount + "折" + if (item.grantType == '2') content = "满" + item.leastCost + "元 减" + item.reduceCost + "元" + } + items.content = content; + upWindowList.push(items) + items = {}; + } + var showUpWindow = false; + if (upWindowList.length > 0) { + showUpWindow = true; + } + that.setData({ + upWindowList: upWindowList, + showUpWindow: showUpWindow + }) + } + } + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + + receiveUpWindow: function() { + var that = this; + that.setData({ + receive: false + }) + var cardNo = wx.getStorageSync("memberInfo").cardNo; + var schemeId = that.data.schemeId; + card.receive(schemeId, function(success) { + var result = success.data; + that.setData({ + receive: true + }) + if (result.status == 1) { + util.showSuccessMsg("领取成功快去使用吧", "none") + } else { + util.showWaring("领取失败!", "none") + } + that.setData({ + showUpWindow: false + }) + }, function fail(err) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + + + onReady: function() { + + }, + + + onShow: function() { + + }, + + onShareAppMessage: function() { + return { + title: '卡券中心', + path: '/pages/tabbar/launch' + } + } +}) \ No newline at end of file diff --git a/pages/couponCenter/index.json b/pages/couponCenter/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/couponCenter/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/couponCenter/index.wxml b/pages/couponCenter/index.wxml new file mode 100644 index 0000000..1250534 --- /dev/null +++ b/pages/couponCenter/index.wxml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + 卡券商城 + 查看更多 + + + + + + + + + + + + + 会员周边 + 查看更多 + + + + + + + + + + + + + 领券中心 + 查看更多 + + + + + + + + + + + + 暂无商品 + + + + \ No newline at end of file diff --git a/pages/couponCenter/index.wxss b/pages/couponCenter/index.wxss new file mode 100644 index 0000000..ac91b3c --- /dev/null +++ b/pages/couponCenter/index.wxss @@ -0,0 +1,125 @@ +@import '../../template/couponPackage/package.wxss'; +@import '../../template/couponItem/item.wxss'; +@import '/components/Lucky/index.wxss'; + +.hy_coupon_center_title { + width: 100%; + height: 354rpx; +} + +.hy_coupon_center_title image { + width: 100%; + height: 354rpx; +} + +.hy_coupon_center_lucky_draw { + width: 100%; + height: 170rpx; + margin-top: 20rpx; + margin-bottom: 20rpx; +} + +.hy_coupon_center_lucky_draw image { + width: 100%; + height: 170rpx; +} + +.hy_coupon_center_shop { + width: 100%; + /* height: 1000rpx; */ + background: rgba(255, 255, 255, 1); + /* min-height: 100rpx; */ +} + +.hy_coupon_center_shop_content { + margin-top: 20rpx; + margin-bottom: 20rpx; + margin-left: 4%; + margin-right: 4%; + width: 92%; + height: 100%; + padding-top: 20rpx; + min-height: 100rpx; +} + +.shop_content_title { + width: 100%; + height: 34rpx; + line-height: 4rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(0, 0, 0, 1); + padding-top: 20rpx; +} + +.shop_content_title_move { + float: right; + width: 140rpx; + height: 34rpx; + font-size: 28rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(102, 102, 102, 1); +} + +.shop_content_title_move image { + width: 14rpx; + height: 20rpx; +} + +.hy_coupon_center_get_coupon { + width: 100%; + /* height: 400rpx; */ + background: rgba(255, 255, 255, 1); + margin-top: 40rpx; + margin-bottom: 30rpx; + min-height: 420rpx; +} + +.cy-content-view { + width: 100%; + position: relative; + top: 10rpx; + left: -30rpx; +} + +.no_card_package { + width: 100%; + height: 60%; + margin-top: -10rpx; + background: rgba(255, 255, 255, 1); +} + +.background_while { + background: rgba(255, 255, 255, 1); + height: 180rpx; + margin-bottom: 0rpx; +} +.no_card_package image{ + display: flex; + margin: auto auto; + width: 260rpx; + height: 260rpx; + padding-top: 110rpx; +} +.no_card_package_prompt{ + text-align: center; + color:darkgrey; + margin-bottom:60rpx; +} +button::after { + border: none; +} + +button { + background-color: transparent; + padding-left: 0; + padding-right: 0; + line-height: inherit; +} + +button { + border-radius: 0; +} + diff --git a/pages/couponCenter/invitationFriend.js b/pages/couponCenter/invitationFriend.js new file mode 100644 index 0000000..ab27d36 --- /dev/null +++ b/pages/couponCenter/invitationFriend.js @@ -0,0 +1,89 @@ +const app = getApp(); +const util = require("../../utils/util.js") +const card = require("../../utils/card.js") +Page({ + + data: { + count:0, + totalCouponCount:0, + totalPoint:0 + }, + + + onLoad: function(options) { + util.setNavTitle4Color("邀请有奖", "#FE9453"); + this.get_acvitationFriend_rule(); + + }, + get_acvitationFriend_rule: function() { + var that = this; + card.getInvitationFriend(function(success) { + var result = success.data; + if (result.status == 1) { + that.setData({ + title: result.data.title, + id: result.data.id + }) + that.getSendGiftNumber(result.data.id); + app.temData.invitationFriendPrizeType = result.data.awardType + app.temData.invitationFriendPrizeCouponPacketNo = result.data.couponPacketNo + app.temData.invitationFriendDescription = result.data.description + app.temData.invitationFriendStartDate = result.data.startDate + app.temData.invitationFriendEndDate = result.data.endDate + app.temData.invitationFriendId = result.data.id + app.temData.invitationFriendPrizePointValue = result.data.pointValue + app.temData.invitationFriendTotalAwardCount = result.data.totalAwardCount + } else { + util.showWaring("暂时没有分享活动") + } + }, function(error) { + console.log(error); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }); + }, + getSendGiftNumber:function(id){ + var that=this; + card.getSendGiftNumber(id,function(success){ + var result = success.data; + if (result.status==1){ + that.setData({ + count: result.data.count, + totalCouponCount: result.data.totalCouponCount, + totalPoint: result.data.totalPoint + }) + } + }, function (error) { + console.log(error); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + activeRule: function() { + if (this.data.id){ + wx.navigateTo({ + url: 'activeRule', + }) + }else{ + util.showWaring("暂时没有分享活动规则") + } + }, + onShow: function() { + + }, + + onHide: function() { + + }, + + onShareAppMessage: function(res) { + return { + title: this.data.title, + path: '/pages/tabbar/launch?&type=share&memberId=' + wx.getStorageSync("memberId") + "&activityId=" + this.data.id + "&openId=" + wx.getStorageSync("openId") + } + } +}) \ No newline at end of file diff --git a/pages/couponCenter/invitationFriend.json b/pages/couponCenter/invitationFriend.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/couponCenter/invitationFriend.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/couponCenter/invitationFriend.wxml b/pages/couponCenter/invitationFriend.wxml new file mode 100644 index 0000000..5dc486a --- /dev/null +++ b/pages/couponCenter/invitationFriend.wxml @@ -0,0 +1,31 @@ + + + + + + + + + 我的奖励 + + + + + + {{count}} + 已邀请(人) + + + {{totalCouponCount}} + 获得卡包 + + + {{totalPoint}} + 获得积分 + + + + + 活动规则 + + \ No newline at end of file diff --git a/pages/couponCenter/invitationFriend.wxss b/pages/couponCenter/invitationFriend.wxss new file mode 100644 index 0000000..82e6ac2 --- /dev/null +++ b/pages/couponCenter/invitationFriend.wxss @@ -0,0 +1,131 @@ +.invitation_friend_bg_image { + width: 100%; + height: 100%; +} + +.invitation_friend_bg_image image { + width: 100%; + height: 100%; +} + +page { + width: 100%; + height: 100%; +} + +.invatation_bottom { + width: 690rpx; + height: 350rpx; + position: absolute; + bottom: 50rpx; + left: 50%; + margin-left: -345rpx; + display: flex; + align-content: center; + align-items: center; + flex-direction: column; + justify-content: space-between; +} + +.invitation_buttom_goto { + width: 100%; + height: 85rpx; + background: linear-gradient(0deg, rgba(255, 186, 38, 1), rgba(255, 225, 164, 1)); + border-radius: 42rpx; + font-size: 40rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 85rpx; + text-align: center; +} + +.invatation_buttom_reward image { + width: 100%; + height: 240rpx; +} + +.invatation_buttom_reward { + width: 100%; + height: 240rpx; +} + +.reward_text { + position: absolute; + top: 135rpx; + /* left: 42%; */ + left: 50%; + margin-left: -345rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 17rpx; + width: 690rpx; + text-align: center; +} + +.my_reward { + width: 690rpx; + height: 120rpx; + position: absolute; + bottom: 80rpx; + left: 50%; + margin-left: -345rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + align-content: center; + align-items: center; +} + +.my_reward view { + width: 33%; + text-align: center; + border-left: 1px solid rgba(224, 224, 224, 1); + height: 65rpx; +} + +.my_reward_text { + display: block; + font-size: 26rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 17rpx; + margin: 15rpx; +} + +.my_reward_num { + font-size: 40rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(252, 48, 57, 1); + line-height: 17rpx; + display: inline-block; + height: 29rpx; + width: 100%; +} + +.active_rule { + width: 180rpx; + height: 50rpx; + background: linear-gradient(180deg, rgba(253, 183, 61, 1) 0%, rgba(255, 121, 22, 1) 100%); + border-radius: 25px 0px 0px 25px; + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 50rpx; + position: absolute; + top: 30rpx; + right: 0rpx; + text-align: center; +} +.active_rule image{ + width: 12rpx; + height: 20rpx; + float: right; + margin-top: 18rpx; + margin-right: 15rpx; +} \ No newline at end of file diff --git a/pages/couponCenter/pointExchangeConfirm.js b/pages/couponCenter/pointExchangeConfirm.js new file mode 100644 index 0000000..040f4fa --- /dev/null +++ b/pages/couponCenter/pointExchangeConfirm.js @@ -0,0 +1,210 @@ +var app = getApp(); +var address = require("../../utils/address.js"); +const point = require("../../utils/point.js"); +var util = require("../../utils/util.js"); +var inter +Page({ + + data: { + showRemark: false, + remark: "请填写备注", + addressFlag: false + }, + + onLoad: function (options) { + if (app.temData.orderPointProduct && app.temData.orderPointNum) { + var productDetail = app.temData.orderPointProduct; + var num = app.temData.orderPointNum; + if (productDetail.type == 0) { + productDetail.money = (productDetail.pointWorth).toFixed(2) + "积分"; + productDetail.totalMoney = (productDetail.pointWorth * num).toFixed(2) + "积分"; + } else if (productDetail.type == 1) { + productDetail.money = productDetail.pointWorth + "积分 " + "¥" + productDetail.amountWorth + "元 "; + productDetail.totalMoney = (productDetail.pointWorth * num).toFixed(2) + "积分 " + "¥" + (productDetail.amountWorth * num).toFixed(2) + "元 "; + } else if (productDetail.type == 2) { + productDetail.money = "¥" + productDetail.amountWorth + "元 "; + productDetail.totalMoney = "¥" + (productDetail.amountWorth * num).toFixed(2) + "元 "; + } + this.setData({ + productDetail: productDetail, + num: num + }) + } else { + wx.showLoading({ + title: '数据加载异常 请重试!', + }) + } + }, + // queryConfirmOrderAddress: function () { + // var that = this; + // address.addressInfo.queryConfirmOrderAddress(function (success) { + // var result = success.data; + // if (result.status == 1) { + // that.setData({ + // address: result.list[0], + // addressFlag: true + // }) + // app.temData.orderAddress = result.list[0]; + // } else { + // app.temData.orderAddress = "" + // that.setData({ + // address: "", + // addressFlag: false + // }) + // } + // }, function fail(error) { + // console.log(error + "------"); + // wx.showToast({ + // title: "网络连接不稳定, 请重试", + // icon: "none" + // }) + // }) + // }, + cy_loadAddress:function(e){ + if(e){ + app.temData.orderAddress = e; + } + this.setData({ + address: app.temData.orderAddress, + addressFlag: true + }) + }, + onShow: function () { + if (app.temData.orderAddress) { + // this.queryConfirmOrderAddress(); + this.cy_loadAddress(''); + } + }, + showRemark: function () { + if (this.data.remark == "请填写备注") { + this.setData({ + remark: "" + }) + } + this.setData({ + showRemark: true + }) + }, + confirmRemark(e) { + // e.detail.formId + if (!this.data.remark) { + this.setData({ + remark: "请填写备注" + }) + } + this.setData({ + showRemark: false + }) + }, + remarkInput: function (e) { + this.setData({ + remark: e.detail.value + }) + }, + gotoAddressList: function () { + wx.navigateTo({ + url: '../mine/managerAddress?flag=couponEnter', + }) + }, + onSubmit: function (e) { + wx.showLoading({ + title: '兑换中....', + }) + if (!this.data.address) { + util.showWaring("请选择收货地址"); + return; + } + var payAmount = this.data.productDetail.amountWorth * 100 * this.data.num; + var payPoint = this.data.productDetail.pointWorth * this.data.num; + var schemeId = this.data.productDetail.schemeId; + var payType = "微信"; + var addressList = this.data.address; + var num = this.data.num; + var imageUrl = this.data.productDetail.imageUrl; + var remark = this.data.remark; + if (remark == '请填写备注') { + remark = '无备注' + } + point.pointInfo.createPointProductOrder(payAmount, payPoint, schemeId, payType, addressList, num, imageUrl, remark).then(res => { + if (res.data.status == 1) { + var outTradeNo = res.data.data.outTradeNo; + var type = this.data.productDetail.type; + point.pointInfo.pullOrderParam(outTradeNo, payAmount, type, schemeId, payPoint, num).then(res => { + var result = res.data; + if (result.status == 1) { + var openData = result.data; + //开始查询订单 + this.queryPointOrder(outTradeNo); + if (this.data.productDetail.type >= 1) { + wx.requestPayment({ + 'timeStamp': openData.timeStamp, + 'nonceStr': openData.nonceStr, + 'package': openData.package, + 'signType': openData.signType, + 'paySign': openData.paySign, + 'success': function (res) { + console.log('..success..' + JSON.stringify(res)); + }, + 'fail': function (res) { + console.error(JSON.stringify(res)); + clearInterval(inter); + util.showWaring("微信支付取消") + }, + 'complete': function () { + console.log('..complete..'); + } + }) + } + } else { + wx.hideLoading(); + // app.showMsg(result.errMessage, "none"); + util.showFailureMsg(result); + } + }, res => { + wx.showLoading({ + title: '数据加载异常 请重试!', + }) + }) + } else { + wx.hideLoading(); + util.showFailureMsg(res.data); + // app.showMsg(res.data.errMessage, "none"); + } + }) + }, + queryPointOrder: function (orderNo) { + var i = 0; + var that = this; + inter = setInterval(function () { + point.pointInfo.queryPointOrder(orderNo).then(res => { + var result = res.data; + if (result.status == 1) { + that.setData({ + orderNo: orderNo + }) + app.temData.orderNo = orderNo + clearInterval(inter) + var url = '/pages/couponCenter/exchangeSuccess?shopType=1&msg=' + that.data.productDetail.totalMoney + "&productName=" + that.data.productDetail.productName; + wx.redirectTo({ + url: url, + }) + wx.hideLoading(); + } else { + i = i + 1; + if (i >= 100) { + clearInterval(inter); + util.showFailureMsg(result); + // app.showMsg("微信查询订单失败", "none") + wx.hideLoading(); + } + } + }, res => { + util.showWaring("微信查询订单失败,网络不稳定") + wx.hideLoading(); + }) + }, 1000) + }, + onUnload:function(){ + clearInterval(inter); + } +}) \ No newline at end of file diff --git a/pages/couponCenter/pointExchangeConfirm.json b/pages/couponCenter/pointExchangeConfirm.json new file mode 100644 index 0000000..d49e83c --- /dev/null +++ b/pages/couponCenter/pointExchangeConfirm.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "确认订单" +} \ No newline at end of file diff --git a/pages/couponCenter/pointExchangeConfirm.wxml b/pages/couponCenter/pointExchangeConfirm.wxml new file mode 100644 index 0000000..d5af33a --- /dev/null +++ b/pages/couponCenter/pointExchangeConfirm.wxml @@ -0,0 +1,68 @@ + + + + + {{address.receiveName}} + {{address.receiveMobile}} + + + {{address.receiveAddress}} {{address.receiveDoor}} + + + + + + + + 请添加收货地址 + + + + + + + + + {{productDetail.productName}} + x{{num}} + + {{productDetail.specName}} + {{productDetail.money}} + + + + + 商品运费 + ¥0.00 + + + + 商品总值 + {{productDetail.totalMoney}} + + + + + 备  注   + {{remark}} + + + + + + 合计: + {{productDetail.totalMoney}} + + 付款 + + + + + + 填写备注 + +
+ +
+
+
\ No newline at end of file diff --git a/pages/couponCenter/pointExchangeConfirm.wxss b/pages/couponCenter/pointExchangeConfirm.wxss new file mode 100644 index 0000000..365a3ce --- /dev/null +++ b/pages/couponCenter/pointExchangeConfirm.wxss @@ -0,0 +1,334 @@ +.contarner { + width: 100%; + height: 100%; +} + +.title { + width: 100%; + height: 164rpx; + background: rgba(255, 255, 255, 1); + border-radius: 10rpx; + margin-top: 10rpx; +} + +.titleText { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + padding-left: 40rpx; +} + +.addressDetail { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(153, 153, 153, 1); + margin-left: 40rpx; + padding-top: 10rpx; +} + +.titleBottom image { + width: 100%; + height: 10rpx; + margin-bottom: 15rpx; +} + +.jt { + position: absolute; + right: 20rpx; + width: 12rpx; + height: 20rpx; + top: 45rpx; +} + +.content { + width: 710rpx; + height: 220rpx; + margin: auto auto; + background: rgba(255, 255, 255, 1); + margin-top: 30rpx; + display: flex; + justify-content: space-around; + align-content: center; + align-items: center; + border-radius: 10rpx; +} + +.content2 { + width: 710rpx; + height: 200rpx; + margin: auto auto; + background: rgba(255, 255, 255, 1); + margin-top: 30rpx; + display: flex; + justify-content: space-around; + align-content: center; + align-items: center; + flex-direction: column; + border-radius: 10rpx; +} + +.content2 view { + width: 100%; +} + +.contentLeft { + width: 160rpx; + margin-left: 20rpx; +} + +.contentLeft image { + width: 160rpx; + height: 160rpx; + margin: auto auto; +} + +.contentRight { + width: 520rpx; + height: 80%; + display: flex; + flex-direction: column; + align-content: center; + align-items: center; + flex-wrap: wrap; + justify-content: space-around; + margin: auto auto; +} + +.contentRight view { + width: 420rpx; +} + +.contentRightTitle { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + margin-top: 20rpx; +} + +.contentRightContent { + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(153, 153, 153, 1); +} + +.contentRightBottom { + font-size: 28rpx; + font-family: PingFang-SC-Bold; + font-weight: bold; + color: rgba(254, 84, 99, 1); + margin-top: -10rpx; +} + +.num { + position: absolute; + font-size: 28rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + right: 70rpx; +} + +.content2Left { + margin-left: 30rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + display: inline-block; +} + +.content2Right { + position: absolute; + right: 70rpx; + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); +} + +.buttom { + width: 710rpx; + height: 90rpx; + background: rgba(255, 255, 255, 1); + border-radius: 10rpx; + margin: auto auto; + margin-top: 30rpx; +} + +.comment { + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(153, 153, 153, 1); + max-width: 400rpx; + overflow: scroll; + text-align: center; + margin-top: 25rpx; + height: 40rpx; +} + +.dh { + position: fixed; + width: 100%; + bottom: 1rpx; + display: flex; + justify-content: start; + align-content: center; + align-items: center; +} + +.text1 { + font-size: 30rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + margin-left: 20rpx; +} + +.text2 { + font-size: 30rpx; + font-family: PingFang-SC-Bold; + font-weight: bold; + color: rgba(255, 84, 84, 1); + margin-left: 20rpx; +} + +.money { + background: rgba(255, 255, 255, 1); + margin-bottom: -40rpx; + line-height: 130rpx; + border: 1px solid #eee; +} + +.weui-btn { + width: 100%; + height: 130rpx; + font-size: 40rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(255, 255, 255, 1); + line-height: 130rpx; + text-align: center; + background: rgba(255, 198, 57, 1); +} + +.mode_view { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + position: absolute; + top: 0; + left: 0; +} + +.phone_bg_view { + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.60); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + position: absolute; + top: 0; + left: 0; +} + +.phone_center_view { + padding: 35rpx 66rpx 36rpx 66rpx; + box-sizing: border-box; + width: 400rpx; + background-color: #fff; + border-radius: 8rpx; + display: flex; + flex-direction: column; + align-items: center; + position: relative; +} + +.mode_text1 { + /* margin-bottom: 10rpx; */ + font-family: PingFangSC-Regular; + font-size: 32rpx; + color: #333; + text-align: center; +} + +.mode_text2 { + margin-top: 50rpx; + font-family: PingFangSC-Regular; + font-size: 22rpx; + color: #999; +} + +.mode_btn { + margin-top: 30rpx; + width: 316rpx; + height: 78rpx; + border-radius: 100rpx; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + font-family: PingFangSC-Regular; + font-size: 32rpx; + color: #fff; + text-align: center; + background: rgba(255, 198, 57, 1); +} + +.login_bg_img { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.mode_text3 { + margin-top: 48rpx; + font-family: PingFangSC-Regular; + font-size: 20rpx; + color: #6692f8; + text-align: center; + border-bottom: 1rpx solid #6692f8; +} + +button::after { + border: none; +} + +.btn { + top: 330rpx; + height: 80rpx; + line-height: 80rpx; +} + +.remark { + width: 330rpx; + height: 280rpx; + border: 1px solid #999; + border-radius: 10rpx; +} + +.addressMsg { + font-family: PingFangSC-Regular; + font-size: 32rpx; + color: #333; + text-align: center; + height: 100%; + line-height: 154rpx; +} + +.fg { + border-bottom: 1rpx dashed rgba(153, 153, 153, 1); + width: 100%; + height: 1rpx; +} diff --git a/pages/couponCenter/productDetail.js b/pages/couponCenter/productDetail.js new file mode 100644 index 0000000..73eeda6 --- /dev/null +++ b/pages/couponCenter/productDetail.js @@ -0,0 +1,149 @@ +const app = getApp(); +const util = require("../../utils/util.js") +const card = require('../../utils/card.js'); +var WxParse = require('../../utils/wxParse/wxParse.js'); +Page({ + data: { + worth: 0 + }, + + onLoad: function(options) { + this.setData({color:app.globalData.color}) + if (options.data) { + var data = JSON.parse(options.data); + if (data.shopType == 0 || data.shopType == 1) { + this.setData({ + detail: data, + productDetailLogUrl:app.globalData.productDetailLogUrl + }); + if (data.shopType == 1) { + this.get_pointProductDetail(data.productid, data.schemeid); + } else { + this.setData({ + worth: data.couponDetail.worth + " 积分 " + }) + if (data.couponDetail.couponDesc) { + this.setData({ + list: data.couponDetail.couponDesc.split('\n') + }) + } + } + } else { + wx.showToast({ + title: '缺少必要参数shopType系统将自动返回', + duration: 1800, + icon: "none" + }) + setTimeout(function() { + wx.navigateBack({}) + }, 2000) + } + } else { + wx.showToast({ + title: '缺少必要参数系统将自动返回', + duration: 1800, + icon: "none" + }) + setTimeout(function() { + wx.navigateBack({}) + }, 2000) + } + + }, + get_pointProductDetail(productid, schemeid) { + if (productid != "" & productid != undefined & schemeid != "" & schemeid != undefined) { + var that = this; + card.queryPointProductDetail(productid, schemeid, function(success) { + var result = success.data; + if (result.status == 1) { + var list = result.list[0]; + var type = list.type; + var worth = 0; + if (type == 0) { + worth = list.pointWorth + " 积分 "; + } else if (type == 1) { + worth = list.pointWorth + " 积分 " + list.amountWorth + " 元"; + } else if (type == 2) { + worth = list.amountWorth + " 元"; + } + that.setData({ + productDetail: result.list[0], + worth: worth + }) + var a = WxParse.wxParse('commodityAttr', 'html', result.list[0].describe, that, 3); + } else { + util.showFailureMsg(result); + } + }, function(error) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + } else { + wx.showToast({ + title: '缺少商品参数系统将自动返回', + duration: 1800, + icon: "none" + }) + setTimeout(function() { + wx.navigateBack({}) + }, 2000) + } + }, + exchange: function() { + this.dialog = this.selectComponent("#dialog"); + this.dialog.show(); + }, + exchange_pointCoupon: function() { + var that=this; + card.exchangeCouponScheme(that.data.detail.id, function(success) { + var result = success.data; + if (result.status == 1) { + var shopType = that.data.detail.shopType; + var msg = that.data.detail.couponDetail.worth + " 积分"; + wx.navigateTo({ + url: 'exchangeSuccess?shopType=' + shopType + "&msg=" + msg, + }) + } else { + util.showFailureMsg(result); + } + }, function(error) { + console.log(err); + wx.showToast({ + title: "网络连接不稳定, 请重试", + icon: "none" + }) + }) + }, + goto: function() { + this.dialog = this.selectComponent("#dialog"); + this.dialog.hide(); + }, + cancel: function() { + this.dialog = this.selectComponent("#dialog"); + this.dialog.hide(); + var shopType = this.data.detail.shopType; + console.error(shopType + ".....") + if (shopType == 0) { + this.exchange_pointCoupon(); + } else if (shopType == 1) { + this.goto_productSureOrder(); + } + }, + goto_productSureOrder: function() { + app.temData.orderPointProduct = this.data.productDetail; + app.temData.orderPointNum = 1;; + wx.navigateTo({ + url: 'pointExchangeConfirm', + }) + }, + onShow: function() { + + }, + + onHide: function() { + + } +}) \ No newline at end of file diff --git a/pages/couponCenter/productDetail.json b/pages/couponCenter/productDetail.json new file mode 100644 index 0000000..9441ab4 --- /dev/null +++ b/pages/couponCenter/productDetail.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "卡券详情", + "usingComponents": { + "dialog": "/components/dialog/dialog" + } +} \ No newline at end of file diff --git a/pages/couponCenter/productDetail.wxml b/pages/couponCenter/productDetail.wxml new file mode 100644 index 0000000..8f601cf --- /dev/null +++ b/pages/couponCenter/productDetail.wxml @@ -0,0 +1,124 @@ + + + + + + + + + + {{detail.couponDetail.title}} + + + {{detail.couponDetail.worth}} +   积分 + + + + + 有效期 + + + {{detail.couponDetail.startDate}}至{{detail.couponDetail.endDate}} + + + + 使用须知 + + + + + + {{item}} + + + + + + 无使用须知 + + + + + + + + + + + + + + {{productDetail.productName}} + + + + {{productDetail.pointWorth}} +   积分 + + + {{productDetail.pointWorth}} +   积分 {{productDetail.amountWorth}} +   元 + + + {{productDetail.amountWorth}} +   元 + + + + + + 兑换规则 + + + 会员凭{{worth}}可兑换“{{productDetail.productName}}”,兑换后将会从会员积分中扣除对应价值 + + + + 发货说明 + + + 积分商城仅支持中国大陆地区(不含粤港澳地区) 的兑换邮寄服务,兑换成功后将于3-7个工作日内 邮寄积分商品。 + + + + 运费说明 + + + 本礼品兑换需自付运费,货到付款 + + + + 售后服务 + + + 积分商品在兑换后不可退货 + + + + 商品描述 + + + + + + + + +