Commit 7e492e65808b530b3044238ef3c7fe310667d366
1 parent
4ed0a31d
每月礼包,礼包详情优化
Showing
1 changed file
with
77 additions
and
12 deletions
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
| @@ -7,6 +7,7 @@ var ut = require("../../../../../utils/util.js"); | @@ -7,6 +7,7 @@ var ut = require("../../../../../utils/util.js"); | ||
| 7 | var com = require("../public/buy_com.js"); | 7 | var com = require("../public/buy_com.js"); |
| 8 | const i = require("../../../../../utils/util.js"); | 8 | const i = require("../../../../../utils/util.js"); |
| 9 | 9 | ||
| 10 | + | ||
| 10 | Page({ | 11 | Page({ |
| 11 | data: { | 12 | data: { |
| 12 | url: a.url, //接口网址 | 13 | url: a.url, //接口网址 |
| @@ -110,23 +111,26 @@ Page({ | @@ -110,23 +111,26 @@ Page({ | ||
| 110 | 111 | ||
| 111 | let monthgiftbag=wx.getStorageSync('monthgiftbag') | 112 | let monthgiftbag=wx.getStorageSync('monthgiftbag') |
| 112 | let monthgiftba_defpick=wx.getStorageSync('monthgiftba_defpick') | 113 | let monthgiftba_defpick=wx.getStorageSync('monthgiftba_defpick') |
| 113 | - | ||
| 114 | var now = ut.gettimestamp(); | 114 | var now = ut.gettimestamp(); |
| 115 | var isStart=0; | 115 | var isStart=0; |
| 116 | // var str = res.data.data.starTime; | 116 | // var str = res.data.data.starTime; |
| 117 | - var start = monthgiftbag.begindate; | 117 | + // if (start < now) isStart = 1; |
| 118 | // start = start / 1000; | 118 | // start = start / 1000; |
| 119 | - if (start < now) isStart = 1; | ||
| 120 | - | ||
| 121 | - let remark=monthgiftbag.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | ||
| 122 | - monthgiftbag.remark=remark | 119 | + // if (options && options.id) { |
| 120 | + // this.getList() | ||
| 121 | + // } | ||
| 122 | + // if (monthgiftbag) { | ||
| 123 | + // var start = monthgiftbag.begindate; | ||
| 124 | + // let remark=monthgiftbag.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | ||
| 125 | + // monthgiftbag.remark=remark | ||
| 126 | + // } | ||
| 123 | 127 | ||
| 124 | - this.setData({ | ||
| 125 | - isStart, | ||
| 126 | - monthgiftbag, | ||
| 127 | - sele_g:monthgiftbag, | 128 | + // this.setData({ |
| 129 | + // isStart, | ||
| 130 | + // monthgiftbag, | ||
| 131 | + // sele_g:monthgiftbag, | ||
| 128 | // def_pick_store:monthgiftba_defpick | 132 | // def_pick_store:monthgiftba_defpick |
| 129 | - }) | 133 | + // }) |
| 130 | 134 | ||
| 131 | }, | 135 | }, |
| 132 | init() { | 136 | init() { |
| @@ -198,6 +202,67 @@ Page({ | @@ -198,6 +202,67 @@ Page({ | ||
| 198 | 202 | ||
| 199 | }, | 203 | }, |
| 200 | 204 | ||
| 205 | + getList: function (e) { | ||
| 206 | + var th = this; | ||
| 207 | + getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { | ||
| 208 | + isShowLoading: true, | ||
| 209 | + data: { | ||
| 210 | + store_id: a.stoid, //商家ID | ||
| 211 | + user_id: d.user_id, //用户ID | ||
| 212 | + page: 1, | ||
| 213 | + pageSize: 10, | ||
| 214 | + is_end:0, | ||
| 215 | + timetype:1, | ||
| 216 | + id:th.data.params.id | ||
| 217 | + }, | ||
| 218 | + success: function (res) { | ||
| 219 | + if (res.data.code == 0) { | ||
| 220 | + th.data.curpage++; | ||
| 221 | + // var arr1 = th.data.wareCard; | ||
| 222 | + var arr2 = res.data.data.pageData; | ||
| 223 | + for (let j = 0; j < arr2.length; j++) { | ||
| 224 | + // arr2[j].starTime1=Date.parse(new Date(arr2[j].begindate.replace(/-/g, "/")))/1000 | ||
| 225 | + arr2[j].starTime1=arr2[j].begindate | ||
| 226 | + arr2[j].starTime=i.formatTime(arr2[j].begindate, "yyyy-MM-dd hh:mm:ss"); | ||
| 227 | + arr2[j].endTime=i.formatTime(arr2[j].enddate, "yyyy-MM-dd hh:mm:ss"); | ||
| 228 | + arr2[j].giftPosPrice=arr2[j].oldPrice | ||
| 229 | + arr2[j].payMoney=arr2[j].lbPrice | ||
| 230 | + arr2[j].payIntegral=arr2[j].exchangeIntegral | ||
| 231 | + arr2[j].giftQty=arr2[j].buynum | ||
| 232 | + arr2[j].cover_img=arr2[j].imageurl | ||
| 233 | + arr2[j].giftTitle=arr2[j].act_name | ||
| 234 | + arr2[j].virtualsales=arr2[j].virtualSales | ||
| 235 | + arr2[j].lbnum=arr2[j].lbNum | ||
| 236 | + } | ||
| 237 | + if(arr2.length>0){ | ||
| 238 | + var monthgiftbag =arr2[0]; | ||
| 239 | + var ismore = 0; | ||
| 240 | + // if (arr3.length == res.data.data.total) ismore = 1 | ||
| 241 | + var isStart=0; | ||
| 242 | + if (monthgiftbag) { | ||
| 243 | + var start = monthgiftbag.begindate; | ||
| 244 | + let remark=monthgiftbag.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | ||
| 245 | + monthgiftbag.remark=remark | ||
| 246 | + var now = ut.gettimestamp(); | ||
| 247 | + if (start < now) isStart = 1; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + | ||
| 251 | + th.setData({ | ||
| 252 | + isStart, | ||
| 253 | + monthgiftbag: monthgiftbag, | ||
| 254 | + sele_g: monthgiftbag, | ||
| 255 | + }) | ||
| 256 | + th.init() | ||
| 257 | + } | ||
| 258 | + } else { | ||
| 259 | + getApp().my_warnning("获取活动失败", 0, th); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + }) | ||
| 263 | + | ||
| 264 | + }, | ||
| 265 | + | ||
| 201 | onShow: function () { | 266 | onShow: function () { |
| 202 | var th=this; | 267 | var th=this; |
| 203 | this.setData({submit:0}) | 268 | this.setData({submit:0}) |
| @@ -210,7 +275,7 @@ Page({ | @@ -210,7 +275,7 @@ Page({ | ||
| 210 | getApp().goto('/packageE/pages/togoin/togoin'); | 275 | getApp().goto('/packageE/pages/togoin/togoin'); |
| 211 | return false; | 276 | return false; |
| 212 | } | 277 | } |
| 213 | - this.init(); | 278 | + this.getList(); |
| 214 | }) | 279 | }) |
| 215 | 280 | ||
| 216 | setTimeout(()=>{ | 281 | setTimeout(()=>{ |