//index.js
//获取应用实例
var app = getApp()
Page({
data: {
src: '../img/bg.jpg',
/*登陆弹框*/
bombHidden: true,
countVal: '发送验证码',
mobile: '',
countNum: '',
tipHidden: true,
tip: '',
countDisabled: false,
loginDisabled: false,
/*领取按钮状态*/
receiveHide: false,
immediateUse: true,
hadHide: true,
feeHidden: true, // 支付控制
/*退款状态*/
isBack: true,
/*免费券*/
shopInfo: {}, // 商家信息
couponInfo: {}, // 商品信息
cardLevel: [], // 卡级别
countLimit:'',
/*购买券*/
buyDetail: {},
/*积分券*/
giftDetail: {},
/*判断进来的是那种券*/
isId: '',
coinNum: 1, // 积分兑换默认值
coinHidden: true, // 显示积分兑换框
myPoint: '', // 我的积分
btnTit: '', // 按钮文字
orderNo: '', // 支付订单
wxRequest: {}, // 微信支付串
},
onLoad: function (option) {
var pages = getCurrentPages();
var currPage = pages[pages.length - 1]; //当前页面
var prevPage = pages[pages.length - 2]; //上一个页面
console.log(pages);
var that = this;
var detailsList = {
'mallNo': app.globalData.mallNo
}
var pathList = '';
if (option.id) { // 免费券详情
pathList = 'mixc/api/v2/coupon/detail/' + option.id;
detailsList.category = option.category; // 券类型
app.getData(pathList, detailsList, function (res) {
var data = JSON.parse(res).data;
var may = ['V1_POINT_CARD', 'POINT_CARD', 'V2_POINT_CARD', 'V3_POINT_CARD', 'V3_GOLD_CARD', 'V3_PLATINUM_CARD'];
var chMay = ['畅享卡', '买单测试卡级', '优享卡', '尊享卡', '尊享金卡', '尊享白金卡'];
var cardLevels = [];
var thisCard = data.couponInfo.cardLevels;
for (var i = 0; i < thisCard.length; i++) {
for (var j = 0; j < may.length; j++) {
if (thisCard[i] === may[j]) {
cardLevels.push(chMay[j]);
}
}
}
that.setData({
shopInfo: data.shopInfo,
couponInfo: data.couponInfo,
cardLevel: cardLevels,
isId: 'free'
});
if(data.couponInfo.receiveStatus=== ''){
that.setData({
countLimit:'未开始',
hadHide:false,
receiveHide:true,
immediateUse:true
});
}
if(data.couponInfo.receiveStatus === '2'){
that.setData({
hadHide:true,
receiveHide:false,
immediateUse:true
});
}
if(data.couponInfo.receiveStatus === '3'){
that.setData({
countLimit:'已抢光',
hadHide:false,
receiveHide:true,
immediateUse:true
});
}
if(data.couponInfo.receiveStatus === '4'){
that.setData({
countLimit:'已领取',
hadHide:false,
receiveHide:true,
immediateUse:true
});
}
if(data.couponInfo.receiveStatus === '5'){
that.setData({
countLimit:'已过期',
hadHide:false,
receiveHide:true,
immediateUse:true
});
}
})
}
if (option.gbId) { // 购买券详情
pathList = 'mixc/api/v2/groupbuy/info';
detailsList = {
'gbId': option.gbId,
}
app.getData(pathList, detailsList, function (res) {
var data = JSON.parse(res).data;
if (data.status == 1) {
that.setData({
receiveHide: true,
immediateUse: true,
hadHide: false,
btnTit: '未开始'
});
}
if (data.status == 2) {
that.setData({
receiveHide: false,
immediateUse: true,
hadHide: true,
});
}
if (data.status == 3) {
that.setData({
receiveHide: true,
immediateUse: true,
hadHide: false,
btnTit: '已结束'
});
}
if (data.status == 4) {
that.setData({
receiveHide: true,
immediateUse: true,
hadHide: false,
btnTit: '已抢光'
});
}
that.setData({
buyDetail: data,
isId: 'fee'
});
})
}
if (option.giftId) { // 积分券详情
pathList = 'mixc/api/v2/gift/info';
detailsList = {
'giftId': option.giftId,
}
app.getData(pathList, detailsList, function (res) {
var data = JSON.parse(res).data;
that.setData({
giftDetail: data,
isId: 'coin'
});
})
}
},
/*跳转至卖家中心*/
toSeller: function (e) {
var that = this;
var scope = e.currentTarget.dataset.scope;
var id = '',bizType = '';
if(e.currentTarget.dataset.id){id=e.currentTarget.dataset.id;bizType = 20} // 免费
if(e.currentTarget.dataset.gbid){id=e.currentTarget.dataset.gbid;bizType = 10} // 购买
if(e.currentTarget.dataset.giftId){id=e.currentTarget.dataset.giftId;bizType = 20} // 积分
if (scope > 1) {
wx.navigateTo({
url: '../seller/seller?id=' + id + '&bizType='+ bizType
});
}
},
/*领取免费券*/
toDraw: function (e) {
var that = this;
var token = wx.getStorageSync('token') || '';
var cardLevel = wx.getStorageSync('cardLevel') || ''; // 获取用户级别
var ids = this.data.couponInfo.id;
if (token) {
var memberPriceCardLevels = this.data.couponInfo.cardLevels || []; // 判断卡级别
var flg = false;
if(memberPriceCardLevels.length > 0){
if(cardLevel){
memberPriceCardLevels.forEach(function (item) {
if (item === cardLevel){
flg = true;
}
});
if(!flg){
wx.showModal({
title: '提示',
content: "您当前卡级别不够",
showCancel:false
});
return false;
}
}else {
wx.showModal({
title: '提示',
content: "您当前卡级别不够",
showCancel:false
});
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序开发-优惠券卡卷案例源码.zip (88个子文件)
优惠券卡卷小程序
截图
1.gif 850KB
源码
clhc-wxx
wxx
app.js 2KB
project.config.json 419B
utils
util.js 460B
pages
invalidCard
invalidCard.wxml 6KB
invalidCard.wxss 2KB
invalidCard.js 744B
my
my.wxss 5KB
my.wxml 13KB
my.js 16KB
my.json 106B
refundDetail
refundDetail.wxml 3KB
refundDetail.wxss 2KB
refundDetail.js 1KB
refundDetail.json 52B
myDetails
myDetails.js 12KB
myDetails.wxss 7KB
myDetails.wxml 18KB
myDetails.json 52B
list
list.wxss 4KB
list.json 67B
list.js 11KB
list.wxml 6KB
service
service.js 352B
service.wxml 25KB
service.wxss 239B
details
details.js 21KB
details.wxss 8KB
details.json 52B
details.wxml 20KB
load
load.js 195B
load.wxss 3KB
load.json 166B
load.wxml 3KB
seller
seller.json 104B
seller.wxml 792B
seller.js 2KB
seller.wxss 2KB
img
bg02.png 419KB
pay.png 2KB
user.png 2KB
duiH.png 3KB
lq.png 3KB
list01.png 1KB
ld01.png 4KB
my01.png 2KB
shiX.png 3KB
apple.png 2KB
detail.png 580B
close.png 1KB
d02.png 181KB
an.png 2KB
l02.png 8KB
ld05.png 4KB
noCard.png 5KB
d01.png 212KB
l03.png 8KB
jfdh.png 14KB
my02.png 2KB
us02.png 2KB
ld10.png 3KB
us01.png 2KB
ld09.png 5KB
ld02.png 5KB
ld04.png 4KB
logo.png 17KB
myBj.png 3KB
case_xs.png 1KB
sj.png 1KB
to.png 722B
jf.png 3KB
time.png 2KB
lingQ.png 4KB
bg.jpg 15KB
user_xs.png 1KB
l04.png 11KB
ld06.png 3KB
customer.png 1KB
banner.jpg 95KB
close2.png 2KB
list02.png 1KB
l01.png 7KB
ld08.png 5KB
ld03.png 4KB
phone.png 2KB
back.png 26KB
app.json 973B
app.wxss 2KB
共 88 条
- 1
芝麻粒儿
- 粉丝: 5w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页