main
lihao 9 months ago
commit 01abffc8d4

@ -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 () {
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "核销成功"
}

@ -0,0 +1,21 @@
<view class='top'>
<view class="img width100">
<image src='/images/couponSuccess.png'></image>
</view>
<view class="success width100"> 核销成功</view>
<view class="ok" bindtap="gotoIndex">完成核销</view>
</view>
<view class="fg"></view>
<view class="bottom">
<view class='width100 item'>
<view class="itemLeft">核销门店:</view>
<view class="itemRight">{{shopName}}</view>
</view>
<view class='width100 item'>
<view class="itemLeft">核销时间:</view>
<view class="itemRight">{{createDate}}</view>
</view>
</view>

@ -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);
}

@ -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',
})
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "支付成功"
}

@ -0,0 +1,27 @@
<view class='top'>
<view class="img width100">
<image src='/images/couponSuccess.png'></image>
</view>
<view class="success width100"> 支付成功</view>
<view class="money">¥{{realAmount}}</view>
<view class="ok" bindtap='gotoIndex'>支付完成</view>
</view>
<view class="fg"></view>
<view class="bottom">
<view class='width100 item'>
<view class="itemLeft">门店名称:</view>
<view class="itemRight">{{shopName}}</view>
</view>
<view class='width100 item'>
<view class="itemLeft">支付时间:</view>
<view class="itemRight">{{createDate}}</view>
</view>
<view class='width100 item'>
<view class="itemLeft">门店号:</view>
<view class="itemRight">{{shopNo}}
</view>
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "会员中心"
}

@ -0,0 +1,62 @@
<!-- 卡信息 -->
<view class='card_info'>
<!-- -->
<view class='content'>
<image class='user_head' src='{{avatarUrl}}'></image>
<view class='user_name'>{{nickName}}</view>
<view class='user_name cy-right-float' bindtap='cy_cardCode'>
<text class='iconfont icon-qrcode' style='font-size:40px; color: white;'></text>
</view>
<view class='user_no'>{{cardNo}}</view>
</view>
</view>
<!-- -->
<view class='user_card_info'>
<view class='card_content_info'>
<view class='card_content_top'>余额</view>
<view class='card_content_bottom'>{{amount}}</view>
</view>
<view class='card_content_info'>
<view class='card_content_top'>积分</view>
<view class='card_content_bottom'>{{totalPoint}}</view>
</view>
</view>
<view bindtap='cy_clickMyAddress' class='user_top_common'>
<text class='user_text'>我的地址</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<view bindtap='cy_clickMyOrder' class='user_bottom_common'>
<text class='user_text'>我的订单</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<view bindtap='clickRechargeRecord' class='user_bottom_common'>
<text class='user_text'>充值记录</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<view bindtap='clickConsumeRecord' class='user_bottom_common'>
<text class='user_text'>消费记录</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<view bindtap='clickCardRecharge' class='user_bottom_common'>
<text class='user_text'>去充值</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<view bindtap='cy_couponCenter' class='user_bottom_common'>
<text class='user_text'>去领券</text>
<text class="iconfont icon-xiangyoujiantou slidIcon"></text>
</view>
<!-- <view class='user_card_info'>
完善资料
</view> -->
<!-- <view class='user_card_info'>
设置密码
</view> -->

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "会员卡"
}

@ -0,0 +1,26 @@
<!-- <view>
<loading hidden="{{hidden}}">加载中...</loading>
</view> -->
<view class="page">
<view class="gift_card">
<view class="gift_dv1 ico_yuan">
<view class="gift_cp1 mch-name">{{name}},您好</view>
<view class="gift_cp2 card-name">余额:¥{{totalAmount}}</view>
</view>
<view class="gift_cdov border b_top2">
<view class="bar_img barcode" style="padding-top:60rpx;">
<canvas canvas-id="barcode" class="bar-code" style="background:red" />
</view>
<view class="qr-code qrcode">
<canvas canvas-id="qrcode" />
</view>
<view class="barnum">{{payCode}}</view>
</view>
</view>
<view class="tip_txt on">
<view class="ico_refresh btn-refresh">
<image style="width: .9rem;height: .9rem;" src="/images/ico_refresh.png"></image>
<text style="padding-left: .5rem;" data-cardno="{{cardNo}}" bindtap="refreshLoad">每分钟自动更新</text>
</view>
</view>
</view>

@ -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;
}

@ -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 () {
},
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "会员权益"
}

@ -0,0 +1,17 @@
<view class="cy-use-back">
<view class='cy-use-title down-text-center'>
会员权益
</view>
<view class='cy-view content-center'>
<view class='cy-line'></view>
</view>
<view class='cy-use-condition content-center'>
<block wx:for="{{des}}" wx:key="{{item}}">
<view class='content-center cy_des'>{{item}}</view>
</block>
<!-- <view class='content-center'>1.仅限茶饮会员合作门店使用</view> -->
<!-- <view class='content-center'>2.本券不与其他活动叠加使用</view>
<view class='content-center'>3.本券仅在有效期内使用优惠</view> -->
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,44 @@
<view class="page">
<loading hidden="{{hidden}}">
加载中
</loading>
<view style="padding:0px;">
<view class="zan-panel" style="padding:0px;margin:0px; line-height: 15px;">
<view class="zan-cell">
<view class="zan-cell__bd" style="font-size:17px;">共{{totalCount}}个适用门店</view>
</view>
</view>
<view class="weui-search-bar">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input type="text" class="weui-search-bar__input" placeholder="请输入门店名称" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="14"></icon>
</view>
</view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="14"></icon>
<view class="weui-search-bar__text">请输入门店名称</view>
</label>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view>
</view>
<view class="zan-panel" style="border-bottom:0px;">
<block wx:if="{{dataList.length > 0}}" wx:for="{{dataList}}" wx:for-index="idx" wx:for-item="item" wx:key="*this">
<view class="zan-row {{idx != 0 ? 'border' : ''}}">
<view class="zan-col zan-col-19" style="padding:10px;padding-right:0px;">
<view class="weui-media-box__title weui-media-box__title_in-text">{{item.name}}</view>
<view class="weui-media-box__desc">{{item.address == '' ? '暂无地址信息' : item.address}}</view>
</view>
<view class="zan-col zan-col-5 location" data-latitude='{{item.latitude}}' data-longitude='{{item.longitude}}' bindtap='onLocation'>
<view style="margin-top:15rpx;">
<span class="distance">{{item.distance}}km</span>
<image class="icon_location" src="/images/icon_location.png" style="margin-top:20rpx;" />
</view>
</view>
</view>
</block>
</view>
</view>
</view>

@ -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;
}

@ -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();
}
}
})

@ -0,0 +1,7 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "消费记录",
"enablePullDownRefresh": true,
"onReachBottomDistance": 5
}

@ -0,0 +1,35 @@
<!-- <loading hidden="{{hidden}}">
努力加载中
</loading> -->
<view class="page">
<view class="container" style="padding:0px;">
<view class="cy-content-top content-center">
<view class='cy-user'>
<view style='font-size:22px'>{{totalAmount}}</view>
<view style='font-size:16px'>账户余额</view>
</view>
</view>
<view class="no_record" wx:if="{{dataList.length == 0}}">
<view class="no_title" style='font-size:14px;'>
暂无消费记录
</view>
</view>
<view wx:if="{{dataList.length > 0}}" class="table" style="border:0px;">
<block wx:if="{{dataList.length > 0}}" wx:for="{{dataList}}" wx:for-index="idx" wx:for-item="item" wx:key="*this">
<view class='table_row'>
<view class='row_left'>
<view class='row_top down-center'>
{{item.shopName}}
</view>
<view class='row_bottom down-center'>
{{item.payDate}}
</view>
</view>
<view class='row_right'>
{{item.actualAmount}}元
</view>
</view>
</block>
</view>
</view>
</view>

@ -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;
}

@ -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) {
});
},
})

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "会员储值"
}

@ -0,0 +1,36 @@
<loading hidden="{{hidden}}">{{msg}}</loading>
<view class="cy-content-top">
<view class='cy-user'>
<view style='font-size:22px'>{{totalAmount}}</view>
<view style='font-size:16px'>账户余额</view>
</view>
<view class='cy-user-info go-center'>
<view class='cy-user-point' bindtap='cy_rechargeRecord'>充值记录</view>
<view class='cy-line-view'></view>
<view class='cy-user-point' bindtap='cy_memberEquity'>会员权益</view>
<view class='cy-line-view'></view>
<view class='cy-user-point' bindtap='cy_consumeRecord'>消费记录</view>
</view>
</view>
<view class='cy-recharge-icon content-center'>
<text class='cy-icon'>¥</text>
<text>充值金额</text>
</view>
<view class='cy-content-list'>
<view wx:if="{{desList.length > 0}}" wx:for="{{desList}}" wx:key="{{item}}" data-index="{{index}}" class='cy-list-item' bindtap='cy_rechargeScheme'>
<image src="{{item.imgurl}}"></image>
<view class='cy-item-row'>
<text>满</text>
<text>{{item.amount}}</text>
<text>送</text>
<text>{{item.desc}}</text>
</view>
</view>
<view class='cy-list-footer'>
<view class='cy-recharge-view content-center'>
<view class='content-center' bindtap='cy_recharge'>确认充值</view>
</view>
</view>
</view>

@ -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;
}

@ -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();
}
}
})

@ -0,0 +1,6 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "充值记录",
"enablePullDownRefresh": true
}

@ -0,0 +1,35 @@
<!-- <loading hidden="{{hidden}}">
努力加载中
</loading> -->
<view class="page">
<view class="container" style="padding:0px;">
<view class="cy-content-top content-center">
<view class='cy-user'>
<view style='font-size:22px'>{{totalAmount}}</view>
<view style='font-size:16px'>账户余额</view>
</view>
</view>
<view class="no_record" wx:if="{{dataList.length == 0}}">
<view class="no_title" style='font-size:14px;'>
暂无充值记录
</view>
</view>
<view wx:if="{{dataList.length > 0}}" class="table" style="border:0px;">
<block wx:if="{{dataList.length > 0}}" wx:for="{{dataList}}" wx:for-index="idx" wx:for-item="item" wx:key="*this">
<view class='table_row content-center'>
<view class='row_left'>
<view class='row_top'>
充值记录
</view>
<view class='row_bottom'>
{{item.chargeTime}}
</view>
</view>
<view class='row_right'>
{{item.chargeAmount}}元
</view>
</view>
</block>
</view>
</view>
</view>

@ -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;
}

@ -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")
}
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "适用门店"
}

@ -0,0 +1,53 @@
<!--pages/coupon/applyShop.wxml-->
<view class="page">
<loading hidden="{{hidden}}">
加载中
</loading>
<view class='title_fixed'>
<view class="zan-panel" style="padding:0px;margin:0px; line-height: 15px;">
<view class="zan-cell">
<view class="zan-cell__bd">共个{{totalCount}}适用门店</view>
</view>
</view>
<view class="weui-search-bar">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input type="text" class="weui-search-bar__input" placeholder="请输入门店名称" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="14"></icon>
</view>
</view>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view>
</view>
</view>
<view class="container margin" style="padding:0px;">
<view class="zan-panel2" style="border-bottom:0px;">
<block wx:if="{{dataList.length > 0}}" wx:for="{{dataList}}" wx:for-index="idx" wx:for-item="item" wx:key="*this">
<view class="zan-row border">
<view class="zan-col zan-col-18" style="padding:10px;padding-right:0px;">
<view class="weui-media-box__title" style='margin-bottom0rpx;'>{{item.name}}</view>
<view class="weui-media-box__desc fontStyle" >
<image src='/images/icon-location.png' class='icon'></image> {{item.address == '' ? '暂无地址信息' : item.address}}</view>
<view class="weui-media-box__desc" style='padding-top:15rpx;'>
<image src='/images/time.png' class='icon'></image> 营业时间00:00-24:00</view>
<view class='bottom' >
<view class='num'>
<image src='/images/phone2.png' class='icon'></image>
{{item.phoneNum}}
</view>
<view class='phone' bindtap='phone' data-phone="{{item.phoneNum}}">电话</view>
<view class='dh' bindtap='onLocation' data-latitude='{{item.latitude}}' data-longitude='{{item.longitude}}' style='background:{{color}};'> 导航</view>
</view>
</view>
<view class='distance zan-col-5'>{{item.distance}}km</view>
</view>
</block>
</view>
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "领券中心"
}

@ -0,0 +1,33 @@
<view style='--color--:{{color}}'>
<import src="../../template/useCouponCenter/couponTemplate.wxml" />
<view hidden='true' class="container">
<view class='cy-top-view flex-display'>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==1? "cy-select-title" : ""}}'>未使用</view>
</view>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==2? "cy-select-title" : ""}}'>已使用</view>
</view>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==3? "cy-select-title" : ""}}'>已过期</view>
</view>
</view>
<view class='cy-content-item-view flex-display'>
<image src="http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"></image>
<view class='cy-item-money-view'>
<text class='cy-item-money-unit'></text>
<text class='cy-item-money'></text>
</view>
<view class='cy-coupon-des-view'>
<view class='cy-coupon-title'></view>
<view class='cy-coupon-condition'></view>
<view class='cy-coupon-time'></view>
</view>
<view class='cy-coupon-use content-center'>
<text style='line-height:34rpx;'>=</text>
</view>
</view>
</view>
<template is="templateCoupon" data="{{couponStatus, list}}"></template>
</view>

@ -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);
}

@ -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);
},
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "领券中心"
}

@ -0,0 +1,43 @@
<view style='--color--:{{color}}'>
<import src="../../template/useCouponCenter/couponTemplate.wxml" />
<import src="../../template/paymentCode/code.wxml" />
<view hidden='true' class="container">
<view class='cy-top-view flex-display'>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==1? "cy-select-title" : ""}}'>未使用</view>
</view>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==2? "cy-select-title" : ""}}'>已使用</view>
</view>
<view class='cy-top-view-item'>
<view class='cy-top-item-title {{status==3? "cy-select-title" : ""}}'>已过期</view>
</view>
</view>
<view class='cy-content-item-view flex-display'>
<image src="http://pos.juweiyun.cn/373001/file/wechatAppnewCoupon.png"></image>
<view class='cy-item-money-view'>
<text class='cy-item-money-unit'></text>
<text class='cy-item-money'></text>
</view>
<view class='cy-coupon-des-view'>
<view class='cy-coupon-title'></view>
<view class='cy-coupon-condition'></view>
<view class='cy-coupon-time'></view>
</view>
<view class='cy-coupon-use content-center'>
<text style='line-height:34rpx;'>=</text>
</view>
</view>
</view>
<view class="toWrite" bindtap="cy_goto_myCoupon">
<image src="http://pos.juweiyun.cn/wechatAppcoupon-float.png"></image>
<view style="padding-top:7rpx;">我的券</view>
</view>
<view class="cy-no-coupon" wx:if="{{list =='' || list.length<=0}}">
<image src="http://pos.juweiyun.cn/373001/file/wechatAppcy_no_coupon.png"></image>
暂无优惠券
</view>
<template is="templateCode" data="{{code,hiden}}"></template>
<template is="templateCoupon" data="{{title, list}}"></template>
</view>

@ -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--);
} */

@ -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() {
}
})

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "使用须知"
}

@ -0,0 +1,17 @@
<view class="cy-use-back">
<view class='cy-use-title down-text-center'>
使用须知
</view>
<view class='cy-view content-center'>
<view class='cy-line'></view>
</view>
<view class='cy-use-condition'>
<block wx:for="{{des}}" wx:key="{{item}}">
<view class='content-center'>{{item}}</view>
</block>
<!-- <view class='content-center'>1.仅限茶饮会员合作门店使用</view> -->
<!-- <view class='content-center'>2.本券不与其他活动叠加使用</view>
<view class='content-center'>3.本券仅在有效期内使用优惠</view> -->
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "卡券详情"
}

@ -0,0 +1,21 @@
<view class="page">
<view class="gift_card">
<view class="gift_dv1 ico_yuan">
<view class="gift_cp1 mch-name">{{title}}</view>
<view class="gift_cp2 card-name" hidden="{{true}}">{{subTitle}}</view>
</view>
<view class="gift_cdov border b_top2" style="padding:0px;margin:0px;">
<view class="bar_img barcode" style="padding-top:25px;">
<canvas canvas-id="barcode" class="bar-code content-center" />
</view>
<view class="qr-code qrcode content-center">
<canvas canvas-id="qrcode" />
</view>
<view class="barnum">{{code}}</view>
<view class="barnum">
<view>使用条件:{{useTime}}</view>
<view>{{useCondition}}</view>
</view>
</view>
</view>
</view>

@ -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;
}

@ -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);
},
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,38 @@
<import src="../../template/paymentCode/code.wxml" />
<view class="couponDeatilContent">
<view class="couponDetailBg">
<view class="detail0"> </view>
<view class="detail1">
<!-- <block wx:if="{{fontSize!=45}}"> -->
<view class="text-btm one"> {{couponDetail.prefix}}</view>
<!-- </block> -->
<block wx:if="{{fontSize!=45}}">
<view class="text-btm tow" style="font-size:{{fontSize}}rpx;">{{couponDetail.context}}</view>
</block>
<view class="text-btm three">{{couponDetail.subTitle}}</view>
</view>
<view class="detail2">{{couponDetail.time}}</view>
<view class="detail2">{{couponDetail.timeDesc}}</view>
</view>
<view class="couponDeatilDescribe">
<view class="couponDeatilDescribeItem">
<view class="useMessage">使用说明</view>
<view class="useMessageContext">
<block wx:if="{{list}}">
<block wx:for="{{list}}" wx:key="index">
<view>{{item}}</view>
</block>
</block>
</view>
</view>
<view class="couponDeatilDescribeItem item" bindtap="lookShop" data-couponId="{{couponDetail.couponId}}">
<text class="useMessage2 block">适用门店</text>
<text class="block num">{{num}}</text>
<image src="/images/jt.png" class="jt"></image>
</view>
<view class="couponDeatilDescribeItem item" bindtap="userCoupon">
<view class="couponDetailUse" style="background:{{color}};">立即使用</view>
</view>
</view>
</view>
<template is="templateCode" data="{{code,hiden}}"></template>

@ -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;
}

@ -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,
})
},
})

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "卡券详情"
}

@ -0,0 +1,41 @@
<view class="cy-coupon-back">
<view class='cy-coupon-top'>
<view class='cy-left-float'>
<image class='cy-image' src='../../images/icon-home.png'></image>
</view>
<view class='cy-coupon-content cy-left-float'>
<view class='cy-coupon-worth down-text-center'>{{title}}</view>
<view class='cy-coupon-worth content-center' style='font-size:12px; color:gray;'>请提前出示给服务员</view>
</view>
</view>
<view class='cy-coupon-bottom'>
<view class='cy-coupon-use content-center'>
<view class='content-center' bindtap='cy_once_use'>立即使用</view>
</view>
<view class='cy-coupon-use-time'>
<view class='content-center'>有效期</view>
<view class='content-center'>{{startDate}} 至 {{endDate}}</view>
<view class='content-center'>周一至周日</view>
</view>
<view class='cy-use-list'>
<!-- <view>
<view class='cy-use-item content-center'>分享转增</view>
<view>1</view>
</view> -->
<view bindtap='cy_use_store'>
<view style='width:220rpx;' class='cy-use-item cy-left-float'>适用门店</view>
<view style='width:180rpx; color:gray;' class='cy-use-item cy-right-float'>
<text>查看详情</text>
<text class='iconfont icon-xiangyoujiantou'></text>
</view>
</view>
<view bindtap='cy_use_info'>
<view style='width:220rpx;' class='cy-use-item cy-left-float'>使用须知</view>
<view style='width:180rpx; color:gray;' class='cy-use-item cy-right-float'>
<text>查看详情</text>
<text class='iconfont icon-xiangyoujiantou'></text>
</view>
</view>
</view>
</view>
</view>

@ -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;
}

@ -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 () {
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "分享转赠"
}

@ -0,0 +1,2 @@
<!--pages/coupon/couponShare.wxml-->
<!-- <text>pages/coupon/couponShare.wxml</text> -->

@ -0,0 +1 @@
/* pages/coupon/couponShare.wxss */

@ -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;
},
})

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "优惠券"
}

@ -0,0 +1,35 @@
<loading hidden="{{hidden}}">
加载中
</loading>
<view class='cy-content'>
<view class='cy-content-title flex-display'>
<view wx:for="{{tabs}}" wx:key="{{item}}" data-index='{{index}}' bindtap='cy_selectTypeCoupon' class='cy-content-item content-center'>
<view>
<view class='cy-use-item'>{{item.name}}</view>
<view wx:if="{{item.checked}}" class='cy-use-line'></view>
</view>
</view>
</view>
<view class='cy-content-list'>
<block wx:if="{{couponList1.length > 0}}">
<view wx:for="{{couponList1}}" wx:key="{{item}}" data-index='{{index}}' class='cy-list-item flex-display' bindtap='cy_couponDetail'>
<view class='cy-item-value content-center'>
<image style='width:220rpx;height:130rpx;' src='../../images/icon-card.png'></image>
<text>¥{{item.worth}}</text>
</view>
<view class='cy-item-des'>
<view class='cy-item-des-title content-center'>{{item.title}}</view>
<view class='content-center' style='font-weight:bold; width:100%; height:25rpx; font-size:8px;'>
<text decode="{{true}}">/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</text>
</view>
<view class='cy-item-date content-center'>有效期:{{item.startDate}}{{item.endDate}}</view>
</view>
</view>
</block>
<block wx:if="{{couponList1.length == 0}}">
<view class='cy-warn-view content-center'>
暂无优惠券,敬请关注
</view>
</block>
</view>
</view>

@ -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;
}

@ -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"
})
})
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,57 @@
<view class="page">
<view class="active_rule_time wid100">
<view class="active_rule_title">活动时间</view>
<view class="active_rule_time_value">{{startDate}} 至 {{endDate}}</view>
</view>
<view class="active_rule_old_user wid100">
<view class="active_rule_title">使用人群</view>
<view class="active_rule_value">参与用户:全部用户</view>
<view class="active_rule_value A1">
<view style="display: inline-block;width:20%;padding-buttom:50rpx;"> 奖励内容:</view>
<view style="display: inline-block;width:80%;">每邀请1人成功后{{content}}</view>
</view>
<view class="active_rule_value">发放时间:立即发放</view>
</view>
<!-- <view class="active_rule_new_user wid100">
<view class="active_rule_title">新用户</view>
<view class="active_rule_value A1">
<view style="display: inline-block;width:20%;padding-buttom:50rpx;"> 奖励内容:</view>
<view style="display: inline-block;width:80%;">新用户注册送九折优惠券1张新用户首次消费送3元优惠券1张</view>
</view>
<view class="active_rule_value">发放时间:立即发放</view>
</view> -->
<view class="active_rule_describe wid100">
<view class="active_rule_title">活动规则介绍</view>
<view class="active_rule_value">{{description}}</view>
</view>
</view>
<!-- <view class="page">
<view class="active_rule_time wid100">
<view class="active_rule_title">活动时间</view>
<view class="active_rule_time_value">2019-08-01 至 2019-12-12</view>
</view>
<view class="active_rule_old_user wid100">
<view class="active_rule_title">老用户</view>
<view class="active_rule_value">参与用户:全部用户</view>
<view class="active_rule_value A1">
<view style="display: inline-block;width:20%;padding-buttom:50rpx;"> 奖励内容:</view>
<view style="display: inline-block;width:80%;">每邀请1人成功后送优惠券3元代金券1张 新用户首次消费送优惠券2元代金券1张</view>
</view>
<view class="active_rule_value">发放时间:立即发放</view>
</view>
<view class="active_rule_new_user wid100">
<view class="active_rule_title">新用户</view>
<view class="active_rule_value A1">
<view style="display: inline-block;width:20%;padding-buttom:50rpx;"> 奖励内容:</view>
<view style="display: inline-block;width:80%;">新用户注册送九折优惠券1张新用户首次消费送3元优惠券1张</view>
</view>
<view class="active_rule_value">发放时间:立即发放</view>
</view>
<view class="active_rule_describe wid100">
<view class="active_rule_title">活动规则介绍</view>
<view class="active_rule_value">被邀请人注册时邀请人会得到一张优惠券</view>
<view class="active_rule_value">被邀请人首次消费时邀请人会再送一张优惠券</view>
</view>
</view> -->

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "兑换成功"
}

@ -0,0 +1,26 @@
<view style='--color--:{{color}}'>
<view class="page">
<view class="exchange_success_image">
<image src="http://pos.juweiyun.cn/373001/file/wechatAppcomplete.png"></image>
</view>
<view class="exchange_success_title">
兑换成功
</view>
<view class="exchange_success_detail">
<block wx:if="{{shopType==0}}">
您已使用{{msg}}兑换卡券大礼包 您可在“个人中心-我的优惠券”中查看详情
</block>
<block wx:if="{{shopType==1}}">
您已使用{{msg}}兑换了“{{productName}}”,我们会尽快给您发货
</block>
</view>
<view class="exchange_success_operation">
<view class="exchange_success_return_index" bindtap="returnIndex">返回首页</view>
<view class="exchange_success_goto" bindtap="goon">继续兑换</view>
</view>
</view>
</view>

@ -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;
}

@ -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'
}
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,61 @@
<view style='--color--:{{color}}'>
<import src="../../template/couponPackage/package.wxml" />
<import src="../../template/couponItem/item.wxml" />
<import src="../../template/pointProduct/product.wxml" />
<import src="/components/Lucky/index.wxml"></import>
<view>
<view class="hy_coupon_center_title" bindtap="goto" data-url="invitationFriend">
<image src=http://pos.juweiyun.cn/373001/file/wechatApp%E9%82%80%E8%AF%B7%E6%9C%89%E5%A5%96%402x.png"> </image> </view> <view class="hy_coupon_center_lucky_draw {{list.length==0 && listPackage==0 ?'background_while':'' }}" bindtap="goto" data-url="/pages2/member/luckyDraw/luckyDraw">
<image src="http://pos.juweiyun.cn/373001/file/wechatApp%E6%8A%BD%E5%A5%96%20%E6%8B%B7%E8%B4%9D%402x.png"></image>
</view>
<block wx:if="{{listPackage.length>0}}">
<view class="hy_coupon_center_shop">
<view class="hy_coupon_center_shop_content">
<view class="shop_content_title">
卡券商城
<view class="shop_content_title_move" bindtap="goto" data-url="shop?type=1">查看更多
<image src="/images/left.png" />
</view>
</view>
<template is="templateCouponPackage" data="{{listPackage}}"></template>
</view>
</view>
</block>
<block wx:if="{{vipProduct.length>0}}">
<view class="hy_coupon_center_shop">
<view class="hy_coupon_center_shop_content">
<view class="shop_content_title">
会员周边
<view class="shop_content_title_move" bindtap="goto" data-url="shop?type=2">查看更多
<image src="/images/left.png" />
</view>
</view>
<template is="templatePointProduct" data="{{vipProduct}}"></template>
</view>
</view>
</block>
<block wx:if="{{list.length>0}}">
<view class="hy_coupon_center_get_coupon">
<view class="hy_coupon_center_shop_content">
<view class="shop_content_title">
领券中心
<view class="shop_content_title_move" bindtap="goto" data-url="../coupon/couponCenter">查看更多
<image src="/images/left.png" />
</view>
</view>
<template is="couponItem" data="{{list}}"></template>
</view>
</view>
</block>
</view>
<block wx:if="{{list.length==0 && listPackage==0 }}">
<view class="no_card_package">
<image src="/images/no_product.png"></image>
<view class="no_card_package_prompt">暂无商品</view>
</view>
</block>
<template is="lucky" data="{{upWindowList,color,defaultBack}}" wx:if="{{showUpWindow}}"></template>
</view>

@ -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;
}

@ -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")
}
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,31 @@
<view class="invitation_friend_bg_image">
<image src="http://pos.juweiyun.cn/373001/file/wechatApp%E5%9B%BE%E5%B1%82%203%402x.png"></image>
</view>
<view class="invatation_bottom">
<button class="invitation_buttom_goto" open-type="share">立即邀请</button>
<view class="invatation_buttom_reward">
<image src="http://pos.juweiyun.cn/373001/file/wechatApp%E7%BB%84%201%402x.png"></image>
<view class="reward_text">我的奖励</view>
</view>
</view>
<view class="my_reward">
<view>
<text class="my_reward_num">{{count}}</text>
<text class="my_reward_text">已邀请(人)</text>
</view>
<view>
<text class="my_reward_num">{{totalCouponCount}}</text>
<text class="my_reward_text">获得卡包</text>
</view>
<view>
<text class="my_reward_num">{{totalPoint}}</text>
<text class="my_reward_text">获得积分</text>
</view>
</view>
<view class="active_rule" bindtap="activeRule">
活动规则
<image src="/images/right.png"></image>
</view>

@ -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;
}

@ -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);
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "确认订单"
}

@ -0,0 +1,68 @@
<view class="contarner">
<view class="title" bindtap='gotoAddressList'>
<block wx:if="{{addressFlag}}">
<view>
<text class="titleText">{{address.receiveName}}</text>
<text class="titleText">{{address.receiveMobile}}</text>
</view>
<view class="addressDetail">
{{address.receiveAddress}} {{address.receiveDoor}}
</view>
<view class="titleBottom">
<image src='/images/lll.png'></image>
</view>
<image src='/images/jt.png' class="jt"></image>
</block>
<block wx:else>
<view class="addressMsg">请添加收货地址</view>
</block>
</view>
<view class="content">
<view class="contentLeft">
<image src='{{productDetail.imageUrl}}'></image>
</view>
<view class="contentRight">
<view class="contentRightTitle">{{productDetail.productName}}
<text class="num">x{{num}}</text>
</view>
<view class="contentRightContent">{{productDetail.specName}}</view>
<view class="contentRightBottom">{{productDetail.money}}</view>
</view>
</view>
<view class="content2">
<view>
<text class="content2Left">商品运费</text>
<text class="content2Right">¥0.00</text>
</view>
<view class="fg"></view>
<view>
<text class="content2Left">商品总值</text>
<text class="content2Right">{{productDetail.totalMoney}}</text>
</view>
</view>
<view class="buttom" bindtap='showRemark'>
<text decode="true" class="content2Left" style='margin-top:25rpx;'>备&nbsp;&nbsp;注&nbsp;&nbsp;</text>
<text class="content2Right comment">{{remark}}</text>
</view>
</view>
<view class="dh">
<view style='width:65%;height: 130rpx;' class="money">
<text class="text1">合计:</text>
<text class="text2">{{productDetail.totalMoney}}</text>
</view>
<view style='width:35%;' bindtap='onSubmit' class="weui-btn">付款</view>
</view>
<view class="mode_view" wx:if="{{showRemark}}" style='height:{{height}}px;'>
<view bindtap="hideModeClick" class="phone_bg_view" style='height:{{height}}px;'></view>
<view class="phone_center_view">
<text class="mode_text1">填写备注</text>
<textarea class="remark" bindinput='remarkInput' value='{{remark}}'></textarea>
<form report-submit='true' bindsubmit='confirmRemark'>
<button class="mode_btn" form-type="submit" style='background:{{color}};'>确定</button>
</form>
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "卡券详情",
"usingComponents": {
"dialog": "/components/dialog/dialog"
}
}

@ -0,0 +1,124 @@
<view style='--color--:{{color}}'>
<view class="product_detail_container">
<block wx:if="{{detail.shopType==0}}">
<view class="product_detail_title_image">
<image src="{{productDetailLogUrl}}"></image>
</view>
<view class="product_detail_content">
<view class="product_detail_describe">
<view class="product_detail_name">
{{detail.couponDetail.title}}
</view>
<view class="product_detail_worth">
{{detail.couponDetail.worth}}
<text class="unit" decode="true">&nbsp;&nbsp;积分</text>
</view>
<view class="product_detail_name"></view>
<view class="product_detail_key">
有效期
</view>
<view class="product_detail_value">
<view class="d"></view> {{detail.couponDetail.startDate}}至{{detail.couponDetail.endDate}}
</view>
<view class="product_detail_key">
使用须知
</view>
<block wx:if="{{list.length>0}}">
<block wx:for="{{list}}" wx:key="">
<view class="product_detail_value">
<view class="d"></view> {{item}}
</view>
</block>
</block>
<block wx:else>
<view class="product_detail_value">
<view class="d"></view> 无使用须知
</view>
</block>
</view>
</view>
</block>
<block wx:if="{{detail.shopType==1}}">
<view class="product_detail_title_image">
<image src="{{productDetail.imageUrl}}"></image>
</view>
<view class="product_detail_content">
<view class="product_detail_describe">
<view class="product_detail_name">
{{productDetail.productName}}
</view>
<view class="product_detail_worth">
<block wx:if="{{productDetail.type==0}}">
{{productDetail.pointWorth}}
<text class="unit" decode="true">&nbsp;&nbsp;积分</text>
</block>
<block wx:if="{{productDetail.type==1}}">
{{productDetail.pointWorth}}
<text class="unit" decode="true">&nbsp;&nbsp;积分</text> {{productDetail.amountWorth}}
<text class="unit" decode="true">&nbsp;&nbsp;元</text>
</block>
<block wx:if="{{productDetail.type==2}}">
{{productDetail.amountWorth}}
<text class="unit" decode="true">&nbsp;&nbsp;元</text>
</block>
</view>
<view class="product_detail_name"></view>
<view class="product_detail_key">
兑换规则
</view>
<view class="product_detail_value">
<view class="d"></view> 会员凭{{worth}}可兑换“{{productDetail.productName}}”,兑换后将会从会员积分中扣除对应价值
</view>
<view class="product_detail_key">
发货说明
</view>
<view class="product_detail_value">
<view class="d"></view>积分商城仅支持中国大陆地区(不含粤港澳地区) 的兑换邮寄服务兑换成功后将于3-7个工作日内 邮寄积分商品。
</view>
<view class="product_detail_key">
运费说明
</view>
<view class="product_detail_value">
<view class="d"></view> 本礼品兑换需自付运费,货到付款
</view>
<view class="product_detail_key">
售后服务
</view>
<view class="product_detail_value">
<view class="d"></view> 积分商品在兑换后不可退货
</view>
<view class="product_detail_key">
商品描述
</view>
</view>
<view class="product_detail_key">
<view class="d"></view>
<view class="wxParse" style='overflow:auto;'>
<import src="../../utils/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:commodityAttr.nodes}}" />
</view>
</view>
</view>
</block>
<view class="product_detail_bottom">
<view class="product_detail_exchange" bindtap="exchange">
立即兑换
</view>
</view>
<dialog id="dialog" title="提示" confirmText="兑换" cancelText="取消" content="本次兑换将会扣除您" content2="{{worth}}" content3=" 是否确定继续兑换" bind:cancel="cancel" bind:confirm="goto">
</dialog>
</view>
</view>

@ -0,0 +1,125 @@
/* @import "../../utils/wxParse/wxParse.wxss"; */
.product_detail_container{
height: auto;
}
.product_detail_title_image {
width: 100%;
height: 480rpx;
background: rgba(248, 248, 248, 1);
border-radius: 4rpx;
}
.product_detail_title_image image {
width: 368rpx;
height: 325rpx;
display: block;
margin: auto auto;
padding-top: 75rpx;
}
.product_detail_describe {
display: flex;
flex-direction: column;
width: 93%;
margin: auto auto;
padding-top: 30rpx;
padding-bottom: 10rpx;
}
.product_detail_content {
width: 100%;
background: rgba(255, 255, 255, 1);
height: auto;
/* overflow: scroll; */
margin-bottom: 110rpx;
}
.wxParse{
background: rgba(255, 255, 255, 1);
}
.product_detail_name {
width: 597rpx;
height: 39rpx;
font-size: 30rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(51, 51, 51, 1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.product_detail_worth {
width: 100%;
height: 29rpx;
font-size: 38rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(255, 73, 73, 1);
margin-top: 10rpx;
}
.unit {
width: 51rpx;
height: 24rpx;
font-size: 26rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(102, 102, 102, 1);
}
.product_detail_key {
height: 28rpx;
font-size: 30rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(51, 51, 51, 1);
margin-top: 45rpx;
}
.product_detail_value {
font-size: 30rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(102, 102, 102, 1);
margin-top: 25rpx;
padding-left: 25rpx;
}
.product_detail_bottom {
width: 100%;
height: 120rpx;
position: fixed;
bottom: 0.3rpx;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: center;
align-items: center;
}
.product_detail_exchange {
width: 550rpx;
height: 80rpx;
background: var(--color--);
border-radius: 40rpx;
text-align: center;
line-height: 80rpx;
font-size: 36rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
.d {
display: inline-block;
width: 8rpx;
height: 8rpx;
background: rgba(102, 102, 102, 1);
border-radius: 50%;
margin-bottom: 6rpx;
}
.wxParse image{
width: 100%;
}

@ -0,0 +1,219 @@
const app = getApp();
const util = require("../../utils/util.js")
const card = require('../../utils/card.js');
Page({
data: {
},
onLoad: function(options) {
//获取积分优惠券
//获取vip商品
//获取周边商品
if (!options.type) {
util.showWaring("缺少type参数,即将分返");
setTimeout(function() {
wx.navigateBack({})
}, 3000)
return;
}
if (options.type == 1) {
this.get_pointCoupon();
} else if (options.type == 2) {
this.get_roduct();
}
this.setData({
type: options.type
})
},
get_pointCoupon: function() {
var that = this;
//2 代表免费领取
card.couponCenter("", 1, 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;
}
}
// 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.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领取";
}
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"
}
item.color = "#FFC639";
item.condition = "满" + item.leastCost + "可用";
item.effective = item.startDate + " 至 " + item.endDate;
item.shopType = 0;
list.push(item);
}
that.setData({
listPackage: list
})
} else {
that.setData({
listPackage: 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"
})
})
},
get_roduct: function() {
var that = this;
card.pointAllTypeProduct( function(success) {
var result = success.data;
if (result.status == 1) {
// var list = result.list;
// for(var item of list){
// item.shopType = parseInt(type)+1;
// }
// if (type == 0) {
// that.setData({
// vipProduct: list
// });
// } else if (type == 1) {
// that.setData({
// memberProduct: list
// });
// }
var list = result.list;
var pointProduct = [];
for (var item of list) {
item.shopType = (parseInt(1) + 1);
pointProduct.push(item);
}
that.setData({
vipProduct: pointProduct
});
} else {
var str;
if (type == 0) {
str = "vip专区";
} else {
str = "会员周边";
}
var msg = "暂无" + str + "商品";
wx.showToast({
title: msg,
icon: "none"
})
}
}, function(error) {
console.log(err);
wx.showToast({
title: "网络连接不稳定, 请重试",
icon: "none"
})
})
},
goto_detail: function(e) {
console.log(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;
if (data.shopType == 2) {
data.shopType = 1;
}
}
if(data.couponDetail){
app.globalData.productDetailLogUrl = data.couponDetail.logoUrl;
//怕图片地址太长页面传递参数长度超过限制解析报错
data.couponDetail.logoUrl="";
}
wx.navigateTo({
url: "productDetail?data=" + JSON.stringify(data),
})
},
onShow: function() {
},
onPullDownRefresh: function() {
},
onReachBottom: function() {
},
onShareAppMessage: function() {
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "卡券商城"
}

@ -0,0 +1,37 @@
<import src="../../template/couponPackage/package.wxml" />
<import src="../../template/pointProduct/product.wxml" />
<block wx:if="{{type==1}}">
<view class="page">
<view class="point_coupon">
<view class="point_coupon_contents">
<!-- <view class="point_coupon_content_title">
卡券商城
</view> -->
<template is="templateCouponPackage" data="{{listPackage}}"></template>
</view>
</view>
</view>
</block>
<block wx:if="{{type==2}}">
<view class="page">
<view class="vip_product">
<view class="point_coupon_contents">
<!-- <view class="point_coupon_content_title">
vip专区
</view> -->
<template is="templatePointProduct" data="{{vipProduct}}"></template>
</view>
</view>
</view>
</block>
<!-- <view class="member_product"> -->
<!-- <view class="point_coupon_contents"> -->
<!-- <view class="point_coupon_content_title">
会员周边
</view> -->
<!-- <template is="templatePointProduct" data="{{memberProduct}}"></template>
</view> -->
<!-- </view> -->

@ -0,0 +1,51 @@
@import '../../template/couponPackage/package.wxss';
page {
width: 100%;
height: 100%;
}
.page {
width: 100%;
height: 100%;
}
.point_coupon {
width: 100%;
min-height: 550rpx;
background: rgba(255, 255, 255, 1);
height: auto;
}
.vip_product {
width: 100%;
min-height: 550rpx;
background: rgba(255, 255, 255, 1);
}
.member_product {
width: 100%;
height: 550rpx;
background: rgba(255, 255, 255, 1);
}
.point_coupon_contents {
margin-top: 20rpx;
margin-bottom: 20rpx;
margin-left: 4%;
margin-right: 4%;
width: 92%;
/* height: 100%; */
padding-top: 20rpx;
}
.point_coupon_content {
width: 100%;
height: 34rpx;
line-height: 34rpx;
font-size: 36rpx;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
padding-top: 20rpx;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save