Commit 630542853db1933492db2f5bf4d526c47f7885b9

Authored by vking
1 parent 843494c6

pay

... ... @@ -38,6 +38,13 @@
],
"subpackages": [
{
"root": "pack-activity-pay",
"name": "支付",
"pages": [
"pages/index"
]
},
{
"root": "pack-activity",
"name": "红包活动包",
"pages": [
... ...
// pack-activity/pages/index.js
import util from '../../utils/util';
import App from '../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
activity:null,
count:0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options
let sys=wx.getSystemInfoSync();
if("wxwork"==sys.environment){
console.log('wxwork run pack-activity',options)
App.Task.GetTaskByOpenid({
...options
}).then(res=>{
this.options.id=options.aid
if(res.ret==200){
util.toast('恭喜获得红包','none')
setTimeout(()=>{
this.GetTaskInfos()
},300)
}
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.GetTaskInfos()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title:this.data.activity.title,
path:'/pages/reserve/index',
imageUrl:this.data.activity.bgurl+'.share.jpg',
}
},
GetTaskInfos(){
App.Task.GetTaskInfos({
aid:this.options.id,
}).then(res=>{
let activity=res.data.activity
activity.list=res.data.task
let count=0
activity.list.forEach(t=>{
if(t.status==2){
count+=(t.price*1)
}
})
this.setData({
count:count.toFixed(2),
activity:activity
})
})
},
taskNextDo(e){
let index=util.attr(e,'index')
let task=this.data.activity.list[index]
let tid=task.id
,path=util.http_build_query({aid:this.data.activity.id,tid:tid},task.task_url||'/pack-activity/pages/yuding')
console.log(path)
if(task.status==0){
App.Task.SetTaskInfo({//领取任务
aid:this.data.activity.id,
tid:tid,
}).then(()=>{
this.GetTaskInfos()
wx.navigateTo({
url: path
})
})
}else if(task.status==1){
wx.navigateTo({
url: path
})
}else{
wx.navigateTo({
url: '/pack-activity/pages/money'
})
}
},
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"black",
"usingComponents": {
"nav":"/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pack-activity/pages/index.wxml-->
<nav hasHome>周到安排</nav>
<view class="pages" style="background-color: {{activity.element}}">
<view class="banner">
<image mode="widthFix" src="{{activity.bgurl}}" style="width: 100%"></image>
<navigator url="/pack-activity/pages/rule?id={{activity.id}}" hover-class="navigator-hover">
<view class="guize">活动 规则</view>
</navigator>
<view class="nomoney" wx:if="{{activity.balance<=1000}}"></view>
</view>
<view class="content">
<navigator url="/pack-activity/pages/money" hover-class="navigator-hover">
<view class="tips flex-lr">
<view>活动累计收入:{{count}}元</view>
<view class="flex-rr">
查看余额
<view class="more"></view>
</view>
</view>
</navigator>
<view class="list">
<view class="header flex-cc">
<view class="header-img lt"></view>
<view class="header-txt">完成任务得红包</view>
<view class="header-img gt"></view>
</view>
<view class="item flex-lr" wx:for="{{activity.list}}" wx:key="list">
<image class="icon" src="{{item.icon_url}}" mode="aspectFit"></image>
<view class="item-content">
<view class="item-title">{{item.title}}</view>
<view class="item-desc">{{item.desc}}</view>
</view>
<view class="opt" bindtap="taskNextDo" data-index="{{index}}" wx:if="{{activity.balance>1000}}">
<view class="opt-button status{{item.status}}">{{['领取','去完成','已完成'][item.status]}}</view>
<view class="opt-money">{{item.price}}元红包</view>
</view>
</view>
</view>
<view class="share-but">
<button class="button-none" open-type="share">分享活动</button>
</view>
</view>
</view>
... ...
/* pack-activity/pages/index.wxss */
.pages{
}
.banner{
width:100%;
background:linear-gradient(202deg,rgba(213,45,182,1) 0%,rgba(240,72,102,1) 100%);
position: relative;
}
.content{
height: 1020rpx;
width: calc(100% - 40rpx);
margin: 0 20rpx 0;
}
.tips{
width:100%;
height:50rpx;
background:rgba(53,53,53,0.3);
border-radius:30rpx;
box-sizing: border-box;
padding: 0 28rpx 0 40rpx;
font-size:24rpx;
font-weight:500;
color:rgba(255,255,255,1);
line-height:50rpx;
}
.more{
background-image: url("http://qn.colorcun.com/activity/images/more.png");
margin-left: 22rpx;
}
.guize{
width:40rpx;
height:120rpx;
background:rgba(53,53,53,0.29);
border-radius:10rpx 0rpx 0rpx 10rpx;
padding: 2rpx 10rpx 0;
box-sizing: border-box;
font-size:20rpx;
font-weight:500;
color:rgba(255,255,255,1);
line-height:28rpx;
position: absolute;
top:20rpx;
right:0;
}
.nomoney{
background-image: url("http://qn.colorcun.com/activity/images/nomoney.png");
width:176rpx;
height:144rpx;
right:24rpx;
bottom: 42rpx;
position: absolute;
background-size: 100% 100%;
}
.list{
background:rgba(255,255,255,1);
box-shadow:4rpx 4rpx 6rpx 4rpx rgba(218,61,69,1);
border-radius:20rpx;
margin-top: 20rpx;
box-sizing: border-box;
padding-top: 60rpx;
padding-bottom: 60rpx;
}
.header{
margin-bottom: 60rpx;
}
.header .header-txt{
width:236rpx;
height:44rpx;
font-size:32rpx;
font-weight:600;
color:rgba(204,17,39,1);
line-height:44rpx;
margin: 0 20rpx;
}
.header-img{
background-size: 100% 100%;
width: 70rpx;
height: 16rpx;
}
.header-img.gt{
background-image: url("http://qn.colorcun.com/activity/images/lt.png");
}
.header-img.lt{
background-image: url("http://qn.colorcun.com/activity/images/gt.png");
}
.list .item{
margin-bottom: 60rpx;
height: 94rpx;
padding: 0 20rpx;
box-sizing: border-box;
}
.list .item:last-child{
margin-bottom: 0;
}
.item .icon{
width: 94rpx;
height: 94rpx;
min-width: 94rpx;
}
.item-content{
margin-left: 10rpx;
width: 100%;
}
.opt{
width: 130rpx;
min-width: 130rpx;
}
.item-title{
height:44rpx;
font-size:32rpx;
font-weight:600;
color:rgba(53,53,53,1);
line-height:44rpx;
}
.item-desc{
height:34rpx;
font-size:24rpx;
font-weight:500;
color:rgba(153,153,153,1);
line-height:34rpx;
margin-top: 10rpx;
}
.opt-money{
height:28rpx;
font-size:20rpx;
font-weight:600;
color:rgba(230,34,57,1);
line-height:28rpx;
margin-top: 10rpx;
}
.opt-button{
box-sizing: border-box;
width:130rpx;
height:50rpx;
border-radius:25rpx;
border:2rpx solid rgba(235,41,65,1);
font-size:24rpx;
font-weight:600;
color:rgba(230,34,57,1);
line-height:50rpx;
text-align: center;
}
.opt-button.status0,.opt-button.status1{
background:linear-gradient(180deg,rgba(225,27,49,1) 0%,rgba(243,53,78,1) 100%);
box-shadow:0rpx 2rpx 4rpx 0rpx rgba(232,37,60,1),2rpx 0rpx 6rpx 0rpx rgba(255,172,171,1);
color:rgba(255,227,192,1);
}
.share-but{
width:400rpx;
height:80rpx;
background:linear-gradient(180deg,rgba(252,190,38,1) 0%,rgba(255,233,128,1) 100%);
box-shadow:0rpx 4rpx 8rpx 0rpx rgba(182,43,68,1);
border-radius:40rpx;
margin-top: 40rpx;
font-size:32rpx;
font-weight:600;
color:rgba(230,34,57,1);
line-height:80rpx;
text-align: center;
margin-left: calc(50% - 200rpx);
}
.share-but .button-none{
height: 80rpx;
line-height:80rpx;
}
\ No newline at end of file
... ...