Commit 247e19c395ae22ed8eaabf852f1acc320a033e14

Authored by vking
1 parent 9f7e7f5e

taocan-share

@@ -11,6 +11,7 @@ Page({ @@ -11,6 +11,7 @@ Page({
11 activityId:'', 11 activityId:'',
12 packs:{}, 12 packs:{},
13 hasNoSets:false,//没有任何套餐 13 hasNoSets:false,//没有任何套餐
  14 + hasLoading:true,
14 }, 15 },
15 activityId:'', 16 activityId:'',
16 /** 17 /**
@@ -133,14 +134,20 @@ Page({ @@ -133,14 +134,20 @@ Page({
133 this.setData({ 134 this.setData({
134 packs:packs, 135 packs:packs,
135 activityId:this.activityId, 136 activityId:this.activityId,
136 - current:this.getCurrent(this.activityId,packs) 137 + current:this.getCurrent(this.activityId,packs),
  138 + hasLoading:false,
137 }) 139 })
138 this.getActivityDetail() 140 this.getActivityDetail()
139 }catch (e){ 141 }catch (e){
140 this.setData({ 142 this.setData({
141 hasNoSets:true,//没有任何套餐 143 hasNoSets:true,//没有任何套餐
  144 + hasLoading:false,
142 }); 145 });
143 } 146 }
  147 + }).catch(()=>{
  148 + this.setData({
  149 + hasLoadTimeout:true,//网络异常
  150 + });
144 }) 151 })
145 }, 152 },
146 getCurrent(id,packs){ 153 getCurrent(id,packs){
1 <!--pages/taocan/index.wxml--> 1 <!--pages/taocan/index.wxml-->
2 <wxs src="../../utils/util.wxs" module="util" /> 2 <wxs src="../../utils/util.wxs" module="util" />
3 -<nav hasHome>  
4 - <view style="top:{{shareTop}}px;height:{{shareHeight}}px;left:{{shareLeft}}px;"  
5 - catchtap="share"  
6 - class="share view flex align-center justify-center bg-white round">  
7 - <view class="icon view"></view>  
8 - <view class="text margin-left-xs">分享</view> 3 +<view class="view flex flex-direction justify-center align-center" style="width: 100vw;height: 100vh;" wx:if="{{hasLoading}}">
  4 + <view class="flex flex-direction justify-center align-center" wx:if="{{hasLoadTimeout}}">
  5 + <image src="http://nosqn.colorcun.com/timeout.png" style="width: 520rpx;height: 348rpx;"></image>
  6 + <view class="margin-tb-lg txt-28-h">请求超时啦~重试一下看看</view>
  7 + <view class="reflush flex justify-center align-center" bindtap="taocanInit">点击重试</view>
9 </view> 8 </view>
10 -</nav>  
11 -<!--  
12 -<swiper  
13 - display-multiple-items="3"  
14 - class="view margin-left-lg header text-black"  
15 - bindchange="swiperChange"  
16 - current="{{current}}"  
17 - style="height: 80rpx;">  
18 - <block wx:for="{{packs}}" wx:key="*this">  
19 - <swiper-item  
20 - bindtap="touchTab" data-id="{{item.id}}" data-index="{{index}}"  
21 - class="swiper-item {{activityId==item.id?'active':''}} flex align-center">  
22 - <view class="txt-32-h text-cut" style="width: 220rpx;height: 56rpx;">  
23 - <text class="swiper-item-txt">{{item.name}}</text>  
24 - </view>  
25 - </swiper-item>  
26 - </block>  
27 -</swiper>  
28 --->  
29 -<block wx:if="{{!hasNoSets}}">  
30 - <scroll-view class="view margin-left-lg header text-black"  
31 - scroll-x="true" bindscroll="scroll" scroll-into-view="PID{{activityId}}"  
32 - style="width: 100%;white-space: nowrap;height:80rpx;"> 9 + <view wx:else="" class="flex flex-direction justify-center align-center">
  10 + <image src="http://nosqn.colorcun.com/loading.gif" style="width: 40rpx;height: 40rpx;"></image>
  11 + <view class="margin-top bg-white txt-24-h">加载中,请稍后…</view>
  12 + </view>
  13 +</view>
  14 +<block wx:else="">
  15 + <nav hasHome>
  16 + <view style="top:{{shareTop}}px;height:{{shareHeight}}px;left:{{shareLeft}}px;"
  17 + catchtap="share"
  18 + class="share view flex align-center justify-center bg-white round">
  19 + <view class="icon view"></view>
  20 + <view class="text margin-left-xs">分享</view>
  21 + </view>
  22 + </nav>
  23 + <!--
  24 + <swiper
  25 + display-multiple-items="3"
  26 + class="view margin-left-lg header text-black"
  27 + bindchange="swiperChange"
  28 + current="{{current}}"
  29 + style="height: 80rpx;">
33 <block wx:for="{{packs}}" wx:key="*this"> 30 <block wx:for="{{packs}}" wx:key="*this">
34 - <view id="PID{{item.id}}"  
35 - bindtap="touchTab" data-id="{{item.id}}" data-index="{{index}}"  
36 - class="view swiper-item {{activityId==item.id?'active':''}} flex align-center">  
37 - <view class="txt-32-h swiper-item-txt">  
38 - {{item.nameSub}} 31 + <swiper-item
  32 + bindtap="touchTab" data-id="{{item.id}}" data-index="{{index}}"
  33 + class="swiper-item {{activityId==item.id?'active':''}} flex align-center">
  34 + <view class="txt-32-h text-cut" style="width: 220rpx;height: 56rpx;">
  35 + <text class="swiper-item-txt">{{item.name}}</text>
39 </view> 36 </view>
40 - </view> 37 + </swiper-item>
41 </block> 38 </block>
42 - </scroll-view>  
43 - <view class="view" style="padding-bottom: 150rpx;padding-top: 80rpx;">  
44 - <view class="view box margin-lr margin-top-lg margin-bottom-sm padding">  
45 - <view class="view text-xxl text-bold">{{packs[activityId].name}}</view>  
46 - <view class="view flex align-end">  
47 - <view class="text-orange txt-28-h" style="margin-bottom: 4rpx;">¥</view>  
48 - <view class="text-orange txt-44-h margin-right-sm text-bold">{{packs[activityId].sale_price}}</view>  
49 - <view class="huaxian flex align-end">  
50 - <view class="txt-20-h" style="margin-bottom: 8rpx;">¥</view>  
51 - <view class="txt-28-h" style="margin-bottom: 4rpx;">{{packs[activityId].market_price}}</view> 39 + </swiper>
  40 + -->
  41 + <block wx:if="{{!hasNoSets}}">
  42 + <scroll-view class="view margin-left-lg header text-black"
  43 + scroll-x="true" bindscroll="scroll" scroll-into-view="PID{{activityId}}"
  44 + style="width: 100%;white-space: nowrap;height:80rpx;">
  45 + <block wx:for="{{packs}}" wx:key="*this">
  46 + <view id="PID{{item.id}}"
  47 + bindtap="touchTab" data-id="{{item.id}}" data-index="{{index}}"
  48 + class="view swiper-item {{activityId==item.id?'active':''}} flex align-center">
  49 + <view class="txt-32-h swiper-item-txt">
  50 + {{item.nameSub}}
  51 + </view>
52 </view> 52 </view>
53 - <view class="view flex text-orange align-end margin-left-sm" wx:if="{{packs[activityId].discount>0}}" >  
54 - <view class="view tag" style="margin-bottom: 16rpx;"></view>  
55 - <view class="view margin-left-xs txt-24-h" style="margin-bottom: 10rpx;">{{packs[activityId].discount*10}}折</view> 53 + </block>
  54 + </scroll-view>
  55 + <view class="view" style="padding-bottom: 150rpx;padding-top: 80rpx;">
  56 + <view class="view box margin-lr margin-top-lg margin-bottom-sm padding">
  57 + <view class="view text-xxl text-bold">{{packs[activityId].name}}</view>
  58 + <view class="view flex align-end">
  59 + <view class="text-orange txt-28-h" style="margin-bottom: 4rpx;">¥</view>
  60 + <view class="text-orange txt-44-h margin-right-sm text-bold">{{packs[activityId].sale_price}}</view>
  61 + <view class="huaxian flex align-end">
  62 + <view class="txt-20-h" style="margin-bottom: 8rpx;">¥</view>
  63 + <view class="txt-28-h" style="margin-bottom: 4rpx;">{{packs[activityId].market_price}}</view>
  64 + </view>
  65 + <view class="view flex text-orange align-end margin-left-sm" wx:if="{{packs[activityId].discount>0}}" >
  66 + <view class="view tag" style="margin-bottom: 16rpx;"></view>
  67 + <view class="view margin-left-xs txt-24-h" style="margin-bottom: 10rpx;">{{packs[activityId].discount*10}}折</view>
  68 + </view>
56 </view> 69 </view>
57 - </view>  
58 - <view class="view flex align-center txt-28-h margin-bottom labels" style="margin-top: 10rpx;">  
59 - <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['包间可用']}}">  
60 - <view class="view icon icon1"></view>  
61 - <view class="view txt-28-h bg-white">包间可用</view>  
62 - </view>  
63 - <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['免预约']}}">  
64 - <view class="view icon icon2"></view>  
65 - <view class="view txt-28-h bg-white">免预约</view>  
66 - </view>  
67 - <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['随时退']}}">  
68 - <view class="view icon icon3"></view>  
69 - <view class="view txt-28-h bg-white">随时退</view> 70 + <view class="view flex align-center txt-28-h margin-bottom labels" style="margin-top: 10rpx;">
  71 + <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['包间可用']}}">
  72 + <view class="view icon icon1"></view>
  73 + <view class="view txt-28-h bg-white">包间可用</view>
  74 + </view>
  75 + <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['免预约']}}">
  76 + <view class="view icon icon2"></view>
  77 + <view class="view txt-28-h bg-white">免预约</view>
  78 + </view>
  79 + <view class="view margin-right flex align-center" wx:if="{{packs[activityId]['随时退']}}">
  80 + <view class="view icon icon3"></view>
  81 + <view class="view txt-28-h bg-white">随时退</view>
  82 + </view>
70 </view> 83 </view>
  84 + <image src="{{packs[activityId].detail_url}}" style="width:100%;border-radius: 10rpx;" mode="widthFix"></image>
71 </view> 85 </view>
72 - <image src="{{packs[activityId].detail_url}}" style="width:100%;border-radius: 10rpx;" mode="widthFix"></image>  
73 - </view>  
74 - <view class="view box margin-lr margin-top-sm margin-bottom-sm">  
75 - <view class="txt-30-h padding solid-bottom text-bold">购买须知</view>  
76 - <view class="view padding block">  
77 - <view class="flex align-center margin-bottom-sm">  
78 - <view class="dot"></view>  
79 - <view class="txt-30-h text-bold">有效期</view> 86 + <view class="view box margin-lr margin-top-sm margin-bottom-sm">
  87 + <view class="txt-30-h padding solid-bottom text-bold">购买须知</view>
  88 + <view class="view padding block">
  89 + <view class="flex align-center margin-bottom-sm">
  90 + <view class="dot"></view>
  91 + <view class="txt-30-h text-bold">有效期</view>
  92 + </view>
  93 + <view class="text-df">{{util.unixtoTime(packs[activityId].eff_time_start,'YYYY.MM.DD')}}-{{util.unixtoTime(packs[activityId].eff_time_end,'YYYY.MM.DD HH:II')}}</view>
80 </view> 94 </view>
81 - <view class="text-df">{{util.unixtoTime(packs[activityId].eff_time_start,'YYYY.MM.DD')}}-{{util.unixtoTime(packs[activityId].eff_time_end,'YYYY.MM.DD HH:II')}}</view>  
82 - </view>  
83 - <view class="view padding block">  
84 - <view class="flex align-center margin-bottom-sm">  
85 - <view class="dot"></view>  
86 - <view class="txt-30-h text-bold">使用时间</view> 95 + <view class="view padding block">
  96 + <view class="flex align-center margin-bottom-sm">
  97 + <view class="dot"></view>
  98 + <view class="txt-30-h text-bold">使用时间</view>
  99 + </view>
  100 + <view class="text-df">{{packs[activityId].use_time}}</view>
87 </view> 101 </view>
88 - <view class="text-df">{{packs[activityId].use_time}}</view>  
89 - </view>  
90 - <view class="view padding block padding-bottom-sm">  
91 - <view class="flex align-center margin-bottom-sm">  
92 - <view class="dot"></view>  
93 - <view class="txt-30-h text-bold">使用规则</view>  
94 - </view>  
95 - <view class="text-df" wx:if="{{hasShowRule}}">  
96 - <text style="line-height: 40rpx;">{{packs[activityId].use_notice}}</text>  
97 - </view>  
98 - <view class="flex justify-center align-center rule margin-top-sm margin-bottom-sm" bindtap="toggleRule">  
99 - <view class="txt-28-h">{{hasShowRule?'收起':'展开更多'}}</view>  
100 - <view class="view icon {{hasShowRule?'show':''}}"></view> 102 + <view class="view padding block padding-bottom-sm">
  103 + <view class="flex align-center margin-bottom-sm">
  104 + <view class="dot"></view>
  105 + <view class="txt-30-h text-bold">使用规则</view>
  106 + </view>
  107 + <view class="text-df" wx:if="{{hasShowRule}}">
  108 + <text style="line-height: 40rpx;">{{packs[activityId].use_notice}}</text>
  109 + </view>
  110 + <view class="flex justify-center align-center rule margin-top-sm margin-bottom-sm" bindtap="toggleRule">
  111 + <view class="txt-28-h">{{hasShowRule?'收起':'展开更多'}}</view>
  112 + <view class="view icon {{hasShowRule?'show':''}}"></view>
  113 + </view>
101 </view> 114 </view>
102 </view> 115 </view>
103 </view> 116 </view>
104 - </view>  
105 - <view class="view bottom flex align-center justify-between padding-right">  
106 - <view class="view flex justify-center align-center flex-treble ">  
107 - <view class="view flex align-end">  
108 - <view class="text-orange txt-40-h" style="margin-bottom: 4rpx;">¥</view>  
109 - <view class="text-orange txt-52-h margin-right-sm text-bold">{{packs[activityId].sale_price}}</view>  
110 - </view>  
111 - <view class="view flex flex-direction justify-center align-start">  
112 - <view class="view flex text-orange align-center" wx:if="{{packs[activityId].discount>0}}">  
113 - <view class="view tag"></view>  
114 - <view class="view margin-left-xs txt-24-h">{{packs[activityId].discount*10}}折</view> 117 + <view class="view bottom flex align-center justify-between padding-right">
  118 + <view class="view flex justify-center align-center flex-treble ">
  119 + <view class="view flex align-end">
  120 + <view class="text-orange txt-40-h" style="margin-bottom: 4rpx;">¥</view>
  121 + <view class="text-orange txt-52-h margin-right-sm text-bold">{{packs[activityId].sale_price}}</view>
115 </view> 122 </view>
116 - <view class="huaxian flex align-end">  
117 - <view class="txt-24-h" style="margin-bottom: 2rpx;">¥</view>  
118 - <view class="txt-32-h">{{packs[activityId].market_price}}</view> 123 + <view class="view flex flex-direction justify-center align-start">
  124 + <view class="view flex text-orange align-center" wx:if="{{packs[activityId].discount>0}}">
  125 + <view class="view tag"></view>
  126 + <view class="view margin-left-xs txt-24-h">{{packs[activityId].discount*10}}折</view>
  127 + </view>
  128 + <view class="huaxian flex align-end">
  129 + <view class="txt-24-h" style="margin-bottom: 2rpx;">¥</view>
  130 + <view class="txt-32-h">{{packs[activityId].market_price}}</view>
  131 + </view>
119 </view> 132 </view>
120 </view> 133 </view>
  134 + <view class="flex justify-end" bindtap="createSale">
  135 + <view class="buyButton txt-36-h text-bold flex align-center justify-center bg-blue-blue">立即抢购</view>
  136 + </view>
121 </view> 137 </view>
122 - <view class="flex justify-end" bindtap="createSale">  
123 - <view class="buyButton txt-36-h text-bold flex align-center justify-center bg-blue-blue">立即抢购</view>  
124 - </view> 138 + </block>
  139 + <view wx:else=""
  140 + style="padding-top: 172rpx;"
  141 + class="flex flex-direction justify-start align-center">
  142 + <image src="http://nosqn.colorcun.com/taocan/1%20%2827%29.png"
  143 + style="width: 520rpx;height: 348rpx;"></image>
  144 + <view class="txt-28-h margin-top-lg">该套餐过期啦</view>
125 </view> 145 </view>
  146 + <share id="share" pack="{{packs[activityId]}}" wx:if="{{packs[activityId].id}}"></share>
126 </block> 147 </block>
127 -<view wx:else=""  
128 - style="padding-top: 172rpx;"  
129 - class="flex flex-direction justify-start align-center">  
130 - <image src="http://nosqn.colorcun.com/taocan/1%20%2827%29.png"  
131 - style="width: 520rpx;height: 348rpx;"></image>  
132 - <view class="txt-28-h margin-top-lg">该套餐过期啦</view>  
133 -</view>  
134 -<share id="share" pack="{{packs[activityId]}}" wx:if="{{packs[activityId].id}}"></share> 148 +
135 149
@@ -120,4 +120,16 @@ @@ -120,4 +120,16 @@
120 font-weight: 400; 120 font-weight: 400;
121 color: #333333; 121 color: #333333;
122 line-height: 36rpx; 122 line-height: 36rpx;
  123 +}
  124 +.reflush{
  125 + width: 152rpx;
  126 + height: 56rpx;
  127 + background: #42A5FF;
  128 + border-radius: 28rpx;
  129 +
  130 + font-size: 28rpx;
  131 + font-family: PingFangSC-Regular, PingFang SC;
  132 + font-weight: 400;
  133 + color: #FFFFFF;
  134 + line-height: 40rpx;
123 } 135 }