Commit 630542853db1933492db2f5bf4d526c47f7885b9

Authored by vking
1 parent 843494c6

pay

@@ -38,6 +38,13 @@ @@ -38,6 +38,13 @@
38 ], 38 ],
39 "subpackages": [ 39 "subpackages": [
40 { 40 {
  41 + "root": "pack-activity-pay",
  42 + "name": "支付",
  43 + "pages": [
  44 + "pages/index"
  45 + ]
  46 + },
  47 + {
41 "root": "pack-activity", 48 "root": "pack-activity",
42 "name": "红包活动包", 49 "name": "红包活动包",
43 "pages": [ 50 "pages": [
  1 +// pack-activity/pages/index.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + activity:null,
  11 + count:0,
  12 + },
  13 +
  14 + /**
  15 + * 生命周期函数--监听页面加载
  16 + */
  17 + onLoad: function (options) {
  18 + this.options=options
  19 + let sys=wx.getSystemInfoSync();
  20 + if("wxwork"==sys.environment){
  21 + console.log('wxwork run pack-activity',options)
  22 + App.Task.GetTaskByOpenid({
  23 + ...options
  24 + }).then(res=>{
  25 + this.options.id=options.aid
  26 + if(res.ret==200){
  27 + util.toast('恭喜获得红包','none')
  28 + setTimeout(()=>{
  29 + this.GetTaskInfos()
  30 + },300)
  31 + }
  32 + })
  33 + }
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面初次渲染完成
  38 + */
  39 + onReady: function () {
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面显示
  45 + */
  46 + onShow: function () {
  47 + this.GetTaskInfos()
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面隐藏
  52 + */
  53 + onHide: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 生命周期函数--监听页面卸载
  59 + */
  60 + onUnload: function () {
  61 +
  62 + },
  63 +
  64 + /**
  65 + * 页面相关事件处理函数--监听用户下拉动作
  66 + */
  67 + onPullDownRefresh: function () {
  68 +
  69 + },
  70 +
  71 + /**
  72 + * 页面上拉触底事件的处理函数
  73 + */
  74 + onReachBottom: function () {
  75 +
  76 + },
  77 +
  78 + /**
  79 + * 用户点击右上角分享
  80 + */
  81 + onShareAppMessage: function () {
  82 + return {
  83 + title:this.data.activity.title,
  84 + path:'/pages/reserve/index',
  85 + imageUrl:this.data.activity.bgurl+'.share.jpg',
  86 + }
  87 + },
  88 + GetTaskInfos(){
  89 + App.Task.GetTaskInfos({
  90 + aid:this.options.id,
  91 + }).then(res=>{
  92 + let activity=res.data.activity
  93 + activity.list=res.data.task
  94 + let count=0
  95 + activity.list.forEach(t=>{
  96 + if(t.status==2){
  97 + count+=(t.price*1)
  98 + }
  99 + })
  100 + this.setData({
  101 + count:count.toFixed(2),
  102 + activity:activity
  103 + })
  104 + })
  105 + },
  106 + taskNextDo(e){
  107 + let index=util.attr(e,'index')
  108 + let task=this.data.activity.list[index]
  109 + let tid=task.id
  110 + ,path=util.http_build_query({aid:this.data.activity.id,tid:tid},task.task_url||'/pack-activity/pages/yuding')
  111 + console.log(path)
  112 + if(task.status==0){
  113 + App.Task.SetTaskInfo({//领取任务
  114 + aid:this.data.activity.id,
  115 + tid:tid,
  116 + }).then(()=>{
  117 + this.GetTaskInfos()
  118 + wx.navigateTo({
  119 + url: path
  120 + })
  121 + })
  122 + }else if(task.status==1){
  123 + wx.navigateTo({
  124 + url: path
  125 + })
  126 + }else{
  127 + wx.navigateTo({
  128 + url: '/pack-activity/pages/money'
  129 + })
  130 + }
  131 + },
  132 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav"
  7 + }
  8 +}
  1 +<!--pack-activity/pages/index.wxml-->
  2 +<nav hasHome>周到安排</nav>
  3 +<view class="pages" style="background-color: {{activity.element}}">
  4 + <view class="banner">
  5 + <image mode="widthFix" src="{{activity.bgurl}}" style="width: 100%"></image>
  6 + <navigator url="/pack-activity/pages/rule?id={{activity.id}}" hover-class="navigator-hover">
  7 + <view class="guize">活动 规则</view>
  8 + </navigator>
  9 + <view class="nomoney" wx:if="{{activity.balance<=1000}}"></view>
  10 + </view>
  11 + <view class="content">
  12 + <navigator url="/pack-activity/pages/money" hover-class="navigator-hover">
  13 + <view class="tips flex-lr">
  14 + <view>活动累计收入:{{count}}元</view>
  15 + <view class="flex-rr">
  16 + 查看余额
  17 + <view class="more"></view>
  18 + </view>
  19 + </view>
  20 + </navigator>
  21 + <view class="list">
  22 + <view class="header flex-cc">
  23 + <view class="header-img lt"></view>
  24 + <view class="header-txt">完成任务得红包</view>
  25 + <view class="header-img gt"></view>
  26 + </view>
  27 + <view class="item flex-lr" wx:for="{{activity.list}}" wx:key="list">
  28 + <image class="icon" src="{{item.icon_url}}" mode="aspectFit"></image>
  29 + <view class="item-content">
  30 + <view class="item-title">{{item.title}}</view>
  31 + <view class="item-desc">{{item.desc}}</view>
  32 + </view>
  33 + <view class="opt" bindtap="taskNextDo" data-index="{{index}}" wx:if="{{activity.balance>1000}}">
  34 + <view class="opt-button status{{item.status}}">{{['领取','去完成','已完成'][item.status]}}</view>
  35 + <view class="opt-money">{{item.price}}元红包</view>
  36 + </view>
  37 + </view>
  38 + </view>
  39 + <view class="share-but">
  40 + <button class="button-none" open-type="share">分享活动</button>
  41 + </view>
  42 + </view>
  43 +</view>
  1 +/* pack-activity/pages/index.wxss */
  2 +.pages{
  3 +}
  4 +.banner{
  5 + width:100%;
  6 + background:linear-gradient(202deg,rgba(213,45,182,1) 0%,rgba(240,72,102,1) 100%);
  7 + position: relative;
  8 +}
  9 +.content{
  10 + height: 1020rpx;
  11 + width: calc(100% - 40rpx);
  12 + margin: 0 20rpx 0;
  13 +}
  14 +.tips{
  15 + width:100%;
  16 + height:50rpx;
  17 + background:rgba(53,53,53,0.3);
  18 + border-radius:30rpx;
  19 + box-sizing: border-box;
  20 + padding: 0 28rpx 0 40rpx;
  21 +
  22 + font-size:24rpx;
  23 + font-weight:500;
  24 + color:rgba(255,255,255,1);
  25 + line-height:50rpx;
  26 +}
  27 +.more{
  28 + background-image: url("http://qn.colorcun.com/activity/images/more.png");
  29 + margin-left: 22rpx;
  30 +}
  31 +.guize{
  32 + width:40rpx;
  33 + height:120rpx;
  34 + background:rgba(53,53,53,0.29);
  35 + border-radius:10rpx 0rpx 0rpx 10rpx;
  36 + padding: 2rpx 10rpx 0;
  37 + box-sizing: border-box;
  38 +
  39 + font-size:20rpx;
  40 + font-weight:500;
  41 + color:rgba(255,255,255,1);
  42 + line-height:28rpx;
  43 + position: absolute;
  44 + top:20rpx;
  45 + right:0;
  46 +}
  47 +.nomoney{
  48 + background-image: url("http://qn.colorcun.com/activity/images/nomoney.png");
  49 + width:176rpx;
  50 + height:144rpx;
  51 + right:24rpx;
  52 + bottom: 42rpx;
  53 + position: absolute;
  54 + background-size: 100% 100%;
  55 +}
  56 +.list{
  57 + background:rgba(255,255,255,1);
  58 + box-shadow:4rpx 4rpx 6rpx 4rpx rgba(218,61,69,1);
  59 + border-radius:20rpx;
  60 + margin-top: 20rpx;
  61 + box-sizing: border-box;
  62 + padding-top: 60rpx;
  63 + padding-bottom: 60rpx;
  64 +}
  65 +
  66 +.header{
  67 + margin-bottom: 60rpx;
  68 +}
  69 +.header .header-txt{
  70 + width:236rpx;
  71 + height:44rpx;
  72 + font-size:32rpx;
  73 + font-weight:600;
  74 + color:rgba(204,17,39,1);
  75 + line-height:44rpx;
  76 + margin: 0 20rpx;
  77 +}
  78 +.header-img{
  79 + background-size: 100% 100%;
  80 + width: 70rpx;
  81 + height: 16rpx;
  82 +}
  83 +.header-img.gt{
  84 + background-image: url("http://qn.colorcun.com/activity/images/lt.png");
  85 +}
  86 +.header-img.lt{
  87 + background-image: url("http://qn.colorcun.com/activity/images/gt.png");
  88 +}
  89 +.list .item{
  90 + margin-bottom: 60rpx;
  91 + height: 94rpx;
  92 + padding: 0 20rpx;
  93 + box-sizing: border-box;
  94 +}
  95 +.list .item:last-child{
  96 + margin-bottom: 0;
  97 +}
  98 +.item .icon{
  99 + width: 94rpx;
  100 + height: 94rpx;
  101 + min-width: 94rpx;
  102 +}
  103 +.item-content{
  104 + margin-left: 10rpx;
  105 + width: 100%;
  106 +}
  107 +.opt{
  108 + width: 130rpx;
  109 + min-width: 130rpx;
  110 +}
  111 +.item-title{
  112 + height:44rpx;
  113 + font-size:32rpx;
  114 + font-weight:600;
  115 + color:rgba(53,53,53,1);
  116 + line-height:44rpx;
  117 +}
  118 +.item-desc{
  119 + height:34rpx;
  120 + font-size:24rpx;
  121 + font-weight:500;
  122 + color:rgba(153,153,153,1);
  123 + line-height:34rpx;
  124 + margin-top: 10rpx;
  125 +}
  126 +.opt-money{
  127 + height:28rpx;
  128 + font-size:20rpx;
  129 + font-weight:600;
  130 + color:rgba(230,34,57,1);
  131 + line-height:28rpx;
  132 + margin-top: 10rpx;
  133 +}
  134 +.opt-button{
  135 + box-sizing: border-box;
  136 + width:130rpx;
  137 + height:50rpx;
  138 + border-radius:25rpx;
  139 + border:2rpx solid rgba(235,41,65,1);
  140 +
  141 + font-size:24rpx;
  142 + font-weight:600;
  143 + color:rgba(230,34,57,1);
  144 + line-height:50rpx;
  145 + text-align: center;
  146 +}
  147 +.opt-button.status0,.opt-button.status1{
  148 + background:linear-gradient(180deg,rgba(225,27,49,1) 0%,rgba(243,53,78,1) 100%);
  149 + box-shadow:0rpx 2rpx 4rpx 0rpx rgba(232,37,60,1),2rpx 0rpx 6rpx 0rpx rgba(255,172,171,1);
  150 + color:rgba(255,227,192,1);
  151 +}
  152 +.share-but{
  153 + width:400rpx;
  154 + height:80rpx;
  155 + background:linear-gradient(180deg,rgba(252,190,38,1) 0%,rgba(255,233,128,1) 100%);
  156 + box-shadow:0rpx 4rpx 8rpx 0rpx rgba(182,43,68,1);
  157 + border-radius:40rpx;
  158 + margin-top: 40rpx;
  159 +
  160 + font-size:32rpx;
  161 + font-weight:600;
  162 + color:rgba(230,34,57,1);
  163 + line-height:80rpx;
  164 + text-align: center;
  165 + margin-left: calc(50% - 200rpx);
  166 +}
  167 +.share-but .button-none{
  168 + height: 80rpx;
  169 + line-height:80rpx;
  170 +}