Commit daff02e27c91c0e62091937b0868b28124f45ac5

Authored by yvan.ni
1 parent 7252664e

秒杀,拼团,进行中,预热中的跳转优化

components/auto_go/auto_go.js 0 → 100644
  1 +Component({
  2 + /*** 页面的初始数据***/
  3 + data: {
  4 + msgStatus:false,
  5 + countDownNum:3, //默认3秒后跳转
  6 + },
  7 + methods: {
  8 + show:function (){
  9 + this.setData({msgStatus:true,countDownNum:3})
  10 + this.cut_down();
  11 + },
  12 + hide:function (){
  13 + this.setData({msgStatus:false})
  14 + },
  15 + //定时器跳转
  16 + cut_down(){
  17 + if(this.data.countDownNum>0){
  18 + var a=this.data.countDownNum-1;
  19 + this.setData({countDownNum:a})
  20 + setTimeout(()=>{
  21 + this.cut_down();
  22 + },1000);
  23 + }else{
  24 + this.hide();
  25 + this.triggerEvent('childFun');
  26 + }
  27 + }
  28 + }
  29 +
  30 +
  31 +})
0 32 \ No newline at end of file
... ...
components/auto_go/auto_go.json 0 → 100644
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
0 5 \ No newline at end of file
... ...
components/auto_go/auto_go.wxml 0 → 100644
  1 +<view class="no-data" wx:if="{{msgStatus == true}}">
  2 + <view class="no-data-title" style="text-align:center;margin-top:100px">
  3 + <view style="color:#444;line-height:30px;">暂无进行中活动</view>
  4 + <view style="color:#444;line-height:30px;"> {{countDownNum}} 秒后自动跳到即将开始</view>
  5 + </view>
  6 +</view>
... ...
components/auto_go/auto_go.wxss 0 → 100644
  1 +@import "../../app.wxss";
  2 +
  3 +.no-data .cart-image {
  4 + width: 208rpx;
  5 + height: 202rpx;
  6 +}
  7 +
  8 +.no-data .no-data-title {
  9 + font-size: 28rpx;
  10 + color: #b8b8b8;
  11 + margin-bottom: 50rpx;
  12 +}
  13 +
  14 +.no-data .lookat {
  15 + display: inline-block;
  16 + font-size: 28rpx;
  17 + border-radius: 10rpx;
  18 + background-color: #e83028;
  19 + color: white;
  20 + padding: 20rpx 50rpx;
  21 +}
0 22 \ No newline at end of file
... ...
pages/activity/pind_list/pind_list.js
... ... @@ -19,7 +19,8 @@ Page({
19 19 ad_data: null,
20 20 max_sw_height: 200,
21 21 is_retail_price:0,
22   - isget:0
  22 + isget:0,
  23 + msgStatus:false
23 24 },
24 25  
25 26 //------初始化加载----------
... ... @@ -82,7 +83,7 @@ Page({
82 83 },
83 84  
84 85 onShow: function (t) {
85   - getApp().check_can_share();
  86 + getApp().check_can_share();
86 87 this.data.is_timer = 1;
87 88 this.data.currentPage = 1;
88 89 this.data.ismore = 1;
... ... @@ -143,14 +144,11 @@ Page({
143 144 //读取数据
144 145 async requestSalelist() {
145 146 if (!this.data.ismore) return false;
146   - var e = this,
147   - th = e,
148   - i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage;
149   - var plist = [],
150   - alllist = th.data.goodlist;
  147 + var e = this,th = e;
  148 + var i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage;
  149 + var plist = [],alllist = th.data.goodlist;
151 150 if (!alllist) alllist = [];
152 151  
153   -
154 152 wx.showLoading();
155 153 await getApp().request.promiseGet(i, {
156 154 isShowLoading: 0,
... ... @@ -166,10 +164,8 @@ Page({
166 164  
167 165 if (plist.length <= 0) {
168 166  
169   - wx.hideLoading();
170   - getApp().showWarning("没有更多数据");
171   - th.data.ismore = 0;
172 167  
  168 + th.data.ismore = 0;
173 169 //没有数据切换
174 170 if (e.data.currentPage == 1 && this.data.type == 1) {
175 171  
... ... @@ -184,13 +180,21 @@ Page({
184 180 user_id:getApp().globalData.user_id,
185 181 }
186 182 }).then(res => {
187   -
188 183 if(ut.ajax_ok(res)){
189   - plist = res.data.data.pageData;
190   - th.setData({ type: 0 });
  184 + th.data.b_plist = res.data.data.pageData;
191 185 }
192 186 });
193 187  
  188 + wx.hideLoading();
  189 + if(th.data.b_plist){
  190 + //组件的id
  191 + var auto_go = th.selectComponent("#auto_go");
  192 + auto_go.show();
  193 +
  194 + }else{
  195 + getApp().showWarning("没有更多数据");
  196 + }
  197 +
194 198 // if(plist){
195 199 // setTimeout(function () {
196 200 // th.data.ismore = 1;
... ... @@ -202,7 +206,12 @@ Page({
202 206 // }
203 207  
204 208 }
  209 + else{
  210 + wx.hideLoading();
  211 + getApp().showWarning("没有更多数据");
  212 + }
205 213  
  214 + return false;
206 215 }
207 216  
208 217 if(plist) {
... ... @@ -220,7 +229,6 @@ Page({
220 229 }
221 230 e.data.currentPage++;
222 231 }
223   -
224 232 th.setData({
225 233 goodlist: alllist,
226 234 isshow: 1,
... ... @@ -324,7 +332,7 @@ Page({
324 332 }
325 333 },
326 334  
327   - onShareTimeline() {
  335 + onShareTimeline() {
328 336 getApp().globalData.no_clear=1;
329 337 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
330 338 if (!store_name)
... ... @@ -350,4 +358,44 @@ Page({
350 358 }
351 359 },
352 360  
  361 + //-- 自动数数,要进行跳转 ---
  362 + async auto_back(){
  363 +
  364 + var e=this,th=this;
  365 + th.setData({ type: 0 });
  366 + wx.showLoading();
  367 +
  368 + var plist=this.data.b_plist;
  369 + var alllist = th.data.goodlist;
  370 + if (!alllist) alllist = [];
  371 +
  372 + if(plist) {
  373 + //--循环读取接口---
  374 + for (var i = 0; i < plist.length; i++) {
  375 + var prom_id = plist[i].id;
  376 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  377 + os.stoid + "/6/" + prom_id, {}).then(res => {
  378 + if (res.data.code == 0) {
  379 + plist[i].status = 1;
  380 + if (res.data.data <= 0) plist[i].status = 3;
  381 + }
  382 + });
  383 + alllist.push(plist[i]);
  384 + }
  385 + e.data.currentPage++;
  386 + }
  387 + th.setData({
  388 + goodlist: alllist,
  389 + isshow: 1,
  390 + is_get:1,
  391 + });
  392 +
  393 + setTimeout(()=>{
  394 + wx.hideLoading();
  395 + },400)
  396 +
  397 +
  398 + }
  399 +
  400 +
353 401 });
354 402 \ No newline at end of file
... ...
pages/activity/pind_list/pind_list.json
1 1 {
2 2 "navigationBarTitleText": "天天拼单",
3 3 "usingComponents": {
4   - "share_box": "/components/share_box/share_box"
  4 + "share_box": "/components/share_box/share_box",
  5 + "auto_go": "/components/auto_go/auto_go"
5 6 }
6 7 }
7 8 \ No newline at end of file
... ...
pages/activity/pind_list/pind_list.wxml
... ... @@ -105,8 +105,9 @@
105 105 </view>
106 106  
107 107 <view class="no-more" wx:if="{{goodlist.length==0 && isget}}">没有相关内容</view>
108   -</view>
  108 +<auto_go id="auto_go" bind:childFun="auto_back"></auto_go>
109 109  
110 110  
  111 +</view>
111 112  
112 113 <share_box id="share"></share_box>
113 114 \ No newline at end of file
... ...
pages/activity/seckill_list/seckill_list.js
... ... @@ -11,7 +11,7 @@ Page({
11 11 killtime: null,
12 12 currentPage: 1,
13 13 goodlist: null,
14   - type: 1,
  14 + type: 1, //1是进行中 0是即将开始
15 15 timer: null,
16 16 ismore: 1, //是否可以加载更多
17 17 isshow: 0,
... ... @@ -167,6 +167,7 @@ Page({
167 167 if (!alllist) alllist = [];
168 168 var user_id = getApp().globalData.user_id;
169 169 if (!user_id) user_id = user_id;
  170 +
170 171 var req = {
171 172 store_id: os.stoid,
172 173 timetype: th.data.type,
... ... @@ -182,23 +183,44 @@ Page({
182 183 data: req
183 184 }).then(res => {
184 185 if (ut.ajax_ok(res)) plist = res.data.data.pageData;
185   -
186 186 });
187 187  
188 188 if (!plist || plist.length <= 0) {
189 189  
190 190 wx.hideLoading();
191   - getApp().showWarning("没有更多数据");
  191 +
192 192 th.data.ismore = 0;
193 193 if (e.data.currentPage == 1 && this.data.type == 1) {
194   - setTimeout(function () {
195   - th.data.ismore = 1;
196   - th.setData({
197   - type: 0
  194 +
  195 + //-- 弄到即将开始 --
  196 + req.timetype=0;
  197 + await getApp().request.promiseGet(i, {
  198 + isShowLoading: 0,
  199 + data: req
  200 + }).then(res => {
  201 + if (ut.ajax_ok(res)) th.data.b_plist = res.data.data.pageData;
198 202 });
199   - th.requestSalelist();
200   - }, 1000);
  203 +
  204 + wx.hideLoading();
  205 + if(th.data.b_plist){
  206 + //组件的id
  207 + var auto_go = th.selectComponent("#auto_go");
  208 + auto_go.show();
  209 + }else{
  210 + getApp().showWarning("没有更多数据");
  211 + }
  212 + // setTimeout(function () {
  213 + // th.data.ismore = 1;
  214 + // th.setData({
  215 + // type: 0
  216 + // });
  217 + // th.requestSalelist();
  218 + // }, 1000);
  219 + }else{
  220 + wx.hideLoading();
  221 + getApp().showWarning("没有更多数据");
201 222 }
  223 +
202 224 return false;
203 225 }
204 226  
... ... @@ -343,4 +365,42 @@ Page({
343 365 getApp().goto(url);
344 366 }
345 367 },
  368 +
  369 + async auto_back(){
  370 +
  371 + var e=this,th=this;
  372 + th.setData({ type: 0 });
  373 + wx.showLoading();
  374 +
  375 + var plist=this.data.b_plist;
  376 + var alllist = th.data.goodlist;
  377 + if (!alllist) alllist = [];
  378 +
  379 + //--循环读取接口---
  380 + for (var i = 0; i < plist.length; i++) {
  381 +
  382 + if (plist[i].user_price) plist[i].price = plist[i].user_price;
  383 + var prom_id = plist[i].id;
  384 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  385 + os.stoid + "/1/" + prom_id, {}
  386 + ).then(res => {
  387 + if (res.data.code == 0) {
  388 + plist[i].status = 1;
  389 + if (res.data.data <= 0) plist[i].status = 3;
  390 + }
  391 + })
  392 + alllist.push(plist[i]);
  393 + }
  394 + e.data.currentPage++;
  395 + console.log("秒杀商品列表", alllist);
  396 + th.setData({
  397 + goodlist: alllist,
  398 + isshow: 1
  399 + });
  400 +
  401 + setTimeout(()=>{
  402 + wx.hideLoading();
  403 + },400)
  404 + }
  405 +
346 406 });
347 407 \ No newline at end of file
... ...
pages/activity/seckill_list/seckill_list.json
1 1 {
2 2 "navigationBarTitleText": "商品秒杀",
3 3 "usingComponents": {
4   - "share_box": "/components/share_box/share_box"
  4 + "share_box": "/components/share_box/share_box",
  5 + "auto_go": "/components/auto_go/auto_go"
5 6 }
6 7 }
7 8 \ No newline at end of file
... ...
pages/activity/seckill_list/seckill_list.wxml
... ... @@ -99,8 +99,10 @@
99 99 </view>
100 100 </view>
101 101  
102   -
103 102 <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view>
  103 +<auto_go id="auto_go" bind:childFun="auto_back"></auto_go>
  104 +
  105 +
104 106 </view>
105 107  
106 108  
... ...