Commit d17cd5e8 by 梁建民

hot red

parent 16011375
......@@ -102,7 +102,7 @@ Page({
http.getData(apis.invitesInfo, 'GET', null, (res) => {
if (res.errcode === 0) {
this.setData({
invitesInfo: res.data
});
......
// pages/person/packet/index.js
const http = require('../../../utils/util.js');
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
isShow: true
isShow: false,
flag: false,
code: '',
codesAdd:{}
},
/**
......@@ -26,7 +33,13 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
let code = wx.getStorageSync('code');
if (code) {
this.setData({
flag: true,
code: code
});
}
},
/**
......@@ -63,5 +76,40 @@ Page({
this.setData({
isShow: false
});
},
formSubmit: function (e) {
let code = e.detail.value.code;
if (!code) {
wx.showToast({
title: '请输入红包码',
icon: 'none',
duration: 2000
});
return false;
}
http.getData(apis.codesAdd, 'GET', {
code: code
}, (res) => {
if (res.errcode === 0) {
this.setData({
flag: true,
isShow: true,
codesAdd:res.data
})
wx.setStorage({
key: "code",
data: res.data.code
});
} else {
wx.showToast({
title: res.errmsg,
icon: 'none',
duration: 2000
});
}
}, true, false, true);
}
})
\ No newline at end of file
......@@ -169,11 +169,16 @@
width: 64rpx;
height: 64rpx;
border: 2rpx solid #ffffff;
border-radius: 50%;
.icon{
font-size:40rpx;
color:#fff;
border-radius: 50%;
.icon {
font-size: 40rpx;
color: #fff;
}
}
}
}
.opac {
opacity: 0.5;
}
\ No newline at end of file
<view class="packet" hover-class="none" hover-stop-propagation="false">
<view class="head">
<view class="wrap column rowCenter verCenter">
<text class="t1">输入好友的红包码</text>
<text class="t2">领取随机红包</text>
<form bindsubmit='formSubmit'>
<view class="head">
<view class="wrap column rowCenter verCenter">
<text class="t1">输入好友的红包码</text>
<text class="t2">领取随机红包</text>
</view>
<view class="inp">
<input type="text" value="{{code}}" placeholder="请输入红包码" class="inpt" placeholder-class="plac" name='code' disabled="{{flag}}"></input>
</view>
</view>
<view class="inp">
<input type="text" placeholder="请输入红包码" class="inpt" placeholder-class="plac"></input>
</view>
</view>
<button class="btn">兑换好友红包</button>
<button class="btn {{flag? 'opac':''}}" form-type="submit">兑换好友红包</button>
</form>
<view class="txt column">
<text class="tit">温馨提示:</text>
<text class="t1">1.红包码可向已注册好友索要,填写后可获得随机红包。</text>
......@@ -16,7 +18,6 @@
<text class="t1">3.本活动最终解释权归深圳市电界网络科技有限公司所有。</text>
</view>
</view>
<!-- 弹出层 -->
<view wx:if="{{isShow}}" class="layer-mask column verCenter rowCenter" hover-class="none" hover-stop-propagation="false">
<view class="layer column verCenter rowCenter">
......@@ -24,7 +25,7 @@
<text class="t1">恭喜您</text>
<text class="t2">获得</text>
<view class="mt">
<text class="t3">0.06</text>
<text class="t3">{{codesAdd.amount}}</text>
<text class="t4">元</text>
</view>
<view class="btn">收下红包</view>
......
......@@ -155,3 +155,6 @@
font-size: 40rpx;
color: #fff;
}
.opac {
opacity: 0.5;
}
......@@ -95,6 +95,13 @@
"pathName": "pages/person/invitationrecord/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/packet/index",
"pathName": "pages/person/packet/index",
"query": "",
"scene": null
}
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment