wxml
js
//优惠券
yhj:function(){
var that=this;
wx.request({
url: '' + app.information.host + '/api/json/vouchers/vouchers.ashx?action=coupon&companyid=' + app.information.companyid,
header: {
'content-type': 'application/json'
},
//请求后台数据成功
success: function (res) {
if(res.data.status==1){
that.setData({
MK_youhui: res.data.list
})
}else{
that.setData({
MK_youhui: 0
})
}
}
});
},
//领取优惠券
lingjue: function (e) {
var utilMd5 = require('../../utils/util.js');
var that = this;
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
var password = utilMd5.hexMD5(app.information.code + timestamp);
wx.request({
url: '' + app.information.host + '/api/json/vouchers/vouchers.ashx?action=couponobtain&companyid=' + app.information.companyid + '&code=' + password + '×tamp=' + timestamp + '&aid=' + e.currentTarget.dataset.aid,
header: {
'content-type': 'application/json',
"cookie": app.information.cookie.replace(/path=\/,/g, "").replace(/path=\/;/g, "").replace(/path=\//g, "").replace(/HttpOnly,/g, "")
},
//请求后台数据成功
success: function (res) {
wx.showToast({
// 提示内容
title: res.data.returnMsg,
icon: "none",
duration: 2000,
mask: false,
})
}
});
},
wxss
/*优惠券*/
.MK_youhui{width: 92%;padding: 2.67vw 4% 0; background: #fff;overflow: hidden;}
.MK_youhuibt{font-size: 5.3vw;color: #333333;text-align: center;font-weight: 600;margin-bottom: 5.33vw;}
.MK_youhuixbt{margin: 1.8vw 0 5.6vw;text-align: center;color: #e60033;font-size: 3.2vw;}
.MK_youhui_jue{width: 92vw;height:40vw; margin: 0 0 10vw;display: flex;justify-content: space-between;}
.MK_youhui_jue .a1{display:inline-block;margin-right: 2vw}
.MK_youhui_jue .a1:last-child{margin-right: 0;}
.MK_youhui_jue image{width: 29.33vw;height: 40vw;display: block;float:left; position: relative;z-index: 1;left: 0;top: 0;}
.MK_youhui_juenr{width: 29.33vw;height: 40vw;position: relative;z-index: 2;left: 0;top: 0vw;}
.MK_youhui_juetop{font-weight: 600}
.MK_youhui_juenr>view:nth-child(1){position:absolute;color:#fff;font-size:11.67vw;left:5vw;top:6.1vw;width:15vw;text-align:center;}
.MK_youhui_juenr>view:nth-child(2){position:absolute;color:#fff;font-size:4.27vw;left:19vw;top:13vw;}
.MK_youhui_juenr>view:nth-child(3){position:absolute;color:#fff;font-size:4vw;left:6vw;top:21vw;font-weight:600;}
.MK_youhui_juebottom{position: absolute;color: #FAC253;font-size:3vw;left:7vw;top:15vw;font-weight: 600;width: 30vw;height: 3.5vw;text-align: center;line-height:3.5vw;background: #fff}
.MK_youhui_jue>view:nth-child(2n) .MK_youhui_juebottom{color: #F9754F;}