Commit d5ca6391273e64d2d07ae4929e89b9718cfb6050

Authored by vking
1 parent c60de007

master-activity

1 // pack-activity/pages/index.js 1 // pack-activity/pages/index.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
2 Page({ 4 Page({
3 5
4 /** 6 /**
5 * 页面的初始数据 7 * 页面的初始数据
6 */ 8 */
7 data: { 9 data: {
8 - activity:{  
9 - id:1,  
10 - background:'#F04866',  
11 - banner:'http://qn.colorcun.com/activity/images/banner.png',  
12 - list:[  
13 - {  
14 - id:1,  
15 - name:'开工专享红包',  
16 - desc:'开工福利,胡吃海喝',  
17 - money:'18.8',  
18 - icon:'http://qn.colorcun.com/activity/images/icon.png',  
19 - status:0,  
20 - },  
21 - {  
22 - id:2,  
23 - name:'开工专享红包',  
24 - desc:'开工福利,胡吃海喝',  
25 - money:'18.8',  
26 - icon:'http://qn.colorcun.com/activity/images/icon.png',  
27 - status:1,  
28 - },  
29 - {  
30 - id:3,  
31 - name:'开工专享红包',  
32 - desc:'开工福利,胡吃海喝',  
33 - money:'18.8',  
34 - icon:'http://qn.colorcun.com/activity/images/icon.png',  
35 - status:2,  
36 - },  
37 - {  
38 - id:4,  
39 - name:'开工专享红包',  
40 - desc:'开工福利,胡吃海喝',  
41 - money:'18.8',  
42 - icon:'http://qn.colorcun.com/activity/images/icon.png',  
43 - status:0,  
44 - },  
45 - ],  
46 - },  
47 - count:999.99.toFixed(2), 10 + activity:null,
  11 + count:0,
48 }, 12 },
49 13
50 /** 14 /**
@@ -65,7 +29,20 @@ Page({ @@ -65,7 +29,20 @@ Page({
65 * 生命周期函数--监听页面显示 29 * 生命周期函数--监听页面显示
66 */ 30 */
67 onShow: function () { 31 onShow: function () {
68 - 32 + App.Task.GetTaskInfos().then(res=>{
  33 + let activity=res.data.activity
  34 + activity.list=res.data.task
  35 + let count=0
  36 + activity.list.forEach(t=>{
  37 + if(t.status==2){
  38 + count+=(t.price*1)
  39 + }
  40 + })
  41 + this.setData({
  42 + count:count.toFixed(2),
  43 + activity:activity
  44 + })
  45 + })
69 }, 46 },
70 47
71 /** 48 /**
@@ -100,6 +77,10 @@ Page({ @@ -100,6 +77,10 @@ Page({
100 * 用户点击右上角分享 77 * 用户点击右上角分享
101 */ 78 */
102 onShareAppMessage: function () { 79 onShareAppMessage: function () {
103 - 80 + return {
  81 + title:this.data.activity.title,
  82 + path:'/pages/reserve/index',
  83 + imageUrl:this.data.activity.bgurl,
  84 + }
104 } 85 }
105 }) 86 })
1 <!--pack-activity/pages/index.wxml--> 1 <!--pack-activity/pages/index.wxml-->
2 <nav hasHome>周到安排</nav> 2 <nav hasHome>周到安排</nav>
3 -<view class="pages" style="background-color: {{activity.background}}"> 3 +<view class="pages" style="background-color: {{activity.element}}">
4 <view class="banner"> 4 <view class="banner">
5 - <image mode="widthFix" src="{{activity.banner}}" style="width: 100%"></image> 5 + <image mode="widthFix" src="{{activity.bgurl}}" style="width: 100%"></image>
6 <view class="guize">活动 规则</view> 6 <view class="guize">活动 规则</view>
7 </view> 7 </view>
8 <view class="content"> 8 <view class="content">
@@ -22,17 +22,19 @@ @@ -22,17 +22,19 @@
22 <view class="header-img gt"></view> 22 <view class="header-img gt"></view>
23 </view> 23 </view>
24 <view class="item flex-lr" wx:for="{{activity.list}}" wx:key="list"> 24 <view class="item flex-lr" wx:for="{{activity.list}}" wx:key="list">
25 - <image class="icon" src="{{item.icon}}" mode="aspectFit"></image> 25 + <image class="icon" src="{{item.icon_url}}" mode="aspectFit"></image>
26 <view class="item-content"> 26 <view class="item-content">
27 - <view class="item-title">{{item.name}}</view> 27 + <view class="item-title">{{item.title}}</view>
28 <view class="item-desc">{{item.desc}}</view> 28 <view class="item-desc">{{item.desc}}</view>
29 </view> 29 </view>
30 <view class="opt"> 30 <view class="opt">
31 <view class="opt-button status{{item.status}}">{{['领取奖励','去完成','去查看'][item.status]}}</view> 31 <view class="opt-button status{{item.status}}">{{['领取奖励','去完成','去查看'][item.status]}}</view>
32 - <view class="opt-money">{{item.money}}元红包</view> 32 + <view class="opt-money">{{item.price}}元红包</view>
33 </view> 33 </view>
34 </view> 34 </view>
35 </view> 35 </view>
36 - <view class="share-but">分享活动</view> 36 + <view class="share-but">
  37 + <button class="button-none" open-type="share">分享活动</button>
  38 + </view>
37 </view> 39 </view>
38 </view> 40 </view>
@@ -154,4 +154,8 @@ @@ -154,4 +154,8 @@
154 line-height:80rpx; 154 line-height:80rpx;
155 text-align: center; 155 text-align: center;
156 margin-left: calc(50% - 200rpx); 156 margin-left: calc(50% - 200rpx);
  157 +}
  158 +.share-but .button-none{
  159 + height: 80rpx;
  160 + line-height:80rpx;
157 } 161 }
1 // pack-activity/pages/money.js 1 // pack-activity/pages/money.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
2 Page({ 4 Page({
3 5
4 /** 6 /**
@@ -12,7 +14,16 @@ Page({ @@ -12,7 +14,16 @@ Page({
12 * 生命周期函数--监听页面加载 14 * 生命周期函数--监听页面加载
13 */ 15 */
14 onLoad: function (options) { 16 onLoad: function (options) {
15 - 17 + App.User.GetBalance().then(res=>{
  18 + this.setData({
  19 + user:res.data
  20 + })
  21 + })
  22 + App.User.GetConsume().then(res=>{
  23 + this.setData({
  24 + list:res.data
  25 + })
  26 + })
16 }, 27 },
17 28
18 /** 29 /**
1 <!--pack-activity/pages/money.wxml--> 1 <!--pack-activity/pages/money.wxml-->
  2 +<wxs src="../../utils/util.wxs" module="util" />
2 <nav hasHome>我的余额</nav> 3 <nav hasHome>我的余额</nav>
3 <view class="pages"> 4 <view class="pages">
4 <view class="pages-view"> 5 <view class="pages-view">
5 <view class="money-block"> 6 <view class="money-block">
6 <view class="money-views-top">我的余额</view> 7 <view class="money-views-top">我的余额</view>
7 <view class="money-views flex-bc"> 8 <view class="money-views flex-bc">
8 - <view class="money-number">18.8</view> 9 + <view class="money-number">{{user.price}}</view>
9 <view class="money-dw">元</view> 10 <view class="money-dw">元</view>
10 </view> 11 </view>
11 </view> 12 </view>
12 </view> 13 </view>
13 - <view class="list-view">  
14 - <view class="item"> 14 + <view class="list-view" wx:if="{{list.length>0}}">
  15 + <view class="item" wx:for="{{list}}" wx:key="list">
15 <view class="flex-lr name"> 16 <view class="flex-lr name">
16 - <view>活动红包</view>  
17 - <view>+100</view> 17 + <view>{{item.remark}}</view>
  18 + <view>{{item.type==1?'+':'-'}}{{item.consumeprice}}</view>
18 </view> 19 </view>
19 <view class="flex-lr date"> 20 <view class="flex-lr date">
20 - <view>11-10 17:19</view>  
21 - <view>余额 788.00</view>  
22 - </view>  
23 - </view>  
24 - <view class="item">  
25 - <view class="flex-lr name">  
26 - <view>活动红包</view>  
27 - <view>+100</view>  
28 - </view>  
29 - <view class="flex-lr date">  
30 - <view>11-10 17:19</view>  
31 - <view>余额 788.00</view>  
32 - </view>  
33 - </view>  
34 - <view class="item">  
35 - <view class="flex-lr name">  
36 - <view>活动红包</view>  
37 - <view>+100</view>  
38 - </view>  
39 - <view class="flex-lr date">  
40 - <view>11-10 17:19</view>  
41 - <view>余额 788.00</view> 21 + <view>{{util.unixtoTime(item.createtime,"MM-DD HH:II")}}</view>
  22 + <view>余额 {{item.currprice}}</view>
42 </view> 23 </view>
43 </view> 24 </view>
44 </view> 25 </view>
@@ -428,4 +428,25 @@ export default { @@ -428,4 +428,25 @@ export default {
428 'App.Customer.SetReserveStatusByUser':{ 428 'App.Customer.SetReserveStatusByUser':{
429 openid:'openid', 429 openid:'openid',
430 }, 430 },
  431 +
  432 + //获取用户余额
  433 + 'App.User.GetBalance':{
  434 + openid:'openid',
  435 + },
  436 + //获取用户余额
  437 + 'App.User.GetConsume':{
  438 + openid:'openid',
  439 + },
  440 + //获取单个任务
  441 + 'App.Task.GetTaskInfo':{
  442 + openid:'openid',
  443 + },
  444 + //获取用户任务列表
  445 + 'App.Task.GetTaskInfos':{
  446 + openid:'openid',
  447 + },
  448 + //领取任务 aid tid
  449 + 'App.Task.SetTaskInfo':{
  450 + openid:'openid',
  451 + },
431 } 452 }