Commit cffa5a26918a42000fceecc87a840fa0ac4d0d5d
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
14 changed files
with
560 additions
and
218 deletions
packageA/pages/distribution/myteam/myteam.js
| @@ -83,6 +83,7 @@ Page({ | @@ -83,6 +83,7 @@ Page({ | ||
| 83 | store_id: app.globalData.setting.stoid, | 83 | store_id: app.globalData.setting.stoid, |
| 84 | user_id: app.globalData.user_id, | 84 | user_id: app.globalData.user_id, |
| 85 | level: 1, | 85 | level: 1, |
| 86 | + isall: 1, | ||
| 86 | }); | 87 | }); |
| 87 | 88 | ||
| 88 | }; | 89 | }; |
| @@ -149,6 +150,7 @@ Page({ | @@ -149,6 +150,7 @@ Page({ | ||
| 149 | store_id: app.globalData.setting.stoid, | 150 | store_id: app.globalData.setting.stoid, |
| 150 | user_id: app.globalData.user_id, | 151 | user_id: app.globalData.user_id, |
| 151 | level: th.data.currentTabIndex + 1, | 152 | level: th.data.currentTabIndex + 1, |
| 153 | + isall: 1 | ||
| 152 | }); | 154 | }); |
| 153 | }, | 155 | }, |
| 154 | 156 | ||
| @@ -176,6 +178,7 @@ Page({ | @@ -176,6 +178,7 @@ Page({ | ||
| 176 | store_id: app.globalData.setting.stoid, | 178 | store_id: app.globalData.setting.stoid, |
| 177 | user_id: app.globalData.user_id, | 179 | user_id: app.globalData.user_id, |
| 178 | level: currentIndex + 1, | 180 | level: currentIndex + 1, |
| 181 | + isall: 1 | ||
| 179 | }); | 182 | }); |
| 180 | }, | 183 | }, |
| 181 | 184 |
packageA/pages/distribution/myteam/myteam.wxml
| @@ -9,7 +9,11 @@ | @@ -9,7 +9,11 @@ | ||
| 9 | <view class="flex ai-center"> | 9 | <view class="flex ai-center"> |
| 10 | <view class="pdr20"><image class="avatar" src="{{item.head_pic}}"/></view> | 10 | <view class="pdr20"><image class="avatar" src="{{item.head_pic}}"/></view> |
| 11 | <view> | 11 | <view> |
| 12 | - <view>{{item.nickname}}</view> | 12 | + <view> |
| 13 | + {{item.nickname}} | ||
| 14 | + <view style="color: #FF6768;display:inline;" wx:if="{{item.is_distribut == 1}}">分销会员</view> | ||
| 15 | + <view style="color: #FF6768;display:inline;" wx:else>普通会员</view> | ||
| 16 | + </view> | ||
| 13 | <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> | 17 | <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> |
| 14 | </view> | 18 | </view> |
| 15 | </view> | 19 | </view> |
packageA/pages/prom_list/prom_list.js
| @@ -40,7 +40,8 @@ Page({ | @@ -40,7 +40,8 @@ Page({ | ||
| 40 | g_buy_num: null, | 40 | g_buy_num: null, |
| 41 | sele_collocation:null, | 41 | sele_collocation:null, |
| 42 | 42 | ||
| 43 | - room_id:0, //房间号 | 43 | + room_id:0, //房间号 |
| 44 | + is_coupon: 1, //搭配促销禁用 | ||
| 44 | }, | 45 | }, |
| 45 | 46 | ||
| 46 | //------初始化加载---------- | 47 | //------初始化加载---------- |
| @@ -164,163 +165,189 @@ Page({ | @@ -164,163 +165,189 @@ Page({ | ||
| 164 | var ee=this,th=ee,that=ee; | 165 | var ee=this,th=ee,that=ee; |
| 165 | var gid = this.data.gid,i = getApp().request; | 166 | var gid = this.data.gid,i = getApp().request; |
| 166 | ee.data.g_buy_num = new Map(); | 167 | ee.data.g_buy_num = new Map(); |
| 167 | - this.wait_for_store_config(); | ||
| 168 | - setTimeout(function(){ | ||
| 169 | - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | ||
| 170 | - failRollback: !0, | ||
| 171 | - success: function(t) { | ||
| 172 | - if (t.data.code == 0) { | ||
| 173 | - if (t.data.data.is_on_sale != 1) { | ||
| 174 | - wx.showModal({ | ||
| 175 | - title: '商品已经下架', | ||
| 176 | - showCancel: !1, | ||
| 177 | - complete: function() { | ||
| 178 | - wx.navigateBack(); | ||
| 179 | - } | ||
| 180 | - }); | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - var timestamp = Date.parse(new Date()); | ||
| 184 | - timestamp = timestamp / 1000; | ||
| 185 | - if (t.data.data.on_time > timestamp) { | ||
| 186 | - wx.showModal({ | ||
| 187 | - title: '商品还未上架', | ||
| 188 | - showCancel: !1, | ||
| 189 | - complete: function() { | ||
| 190 | - wx.navigateBack(); | ||
| 191 | - } | ||
| 192 | - }); | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - if (t.data.data.down_time > 0) { | ||
| 196 | - if (t.data.data.down_time < timestamp) { | ||
| 197 | - wx.showModal({ | ||
| 198 | - title: '商品已经到期下架', | ||
| 199 | - showCancel: !1, | ||
| 200 | - complete: function() { | ||
| 201 | - wx.navigateBack(); | ||
| 202 | - } | ||
| 203 | - }); | ||
| 204 | - } | ||
| 205 | - } | ||
| 206 | - | ||
| 207 | - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | ||
| 208 | - var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); | ||
| 209 | - t.data.data['disc'] = txt; | ||
| 210 | - | ||
| 211 | - if (t.data.data.original_img.indexOf(o.imghost) == -1) | ||
| 212 | - t.data.data.original_img = o.imghost + t.data.data.original_img; | ||
| 213 | - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; | ||
| 214 | - | ||
| 215 | - //计算商品的规格 | ||
| 216 | - var gg = ""; | ||
| 217 | - if(t.data.data.goods_spec=="null" || t.data.data.goods_spec==null) t.data.data.goods_spec=""; | ||
| 218 | - if(t.data.data.goods_color=="null" || t.data.data.goods_color==null) t.data.data.goods_color=""; | ||
| 219 | - | ||
| 220 | - if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { | ||
| 221 | - gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; | ||
| 222 | - } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { | ||
| 223 | - gg = t.data.data.goods_spec + t.data.data.goods_color; | ||
| 224 | - } else { | ||
| 225 | - gg = "规格1"; | ||
| 226 | - } | ||
| 227 | - t.data.data.gg = gg; | ||
| 228 | - | ||
| 229 | - | ||
| 230 | - //--看一下有没有开启等级卡--- | ||
| 231 | - if(ee.data.rank_switch){ | ||
| 232 | - //---回调卡的列表--- | ||
| 233 | - th.getPlusCardType(function(ob){ | ||
| 234 | - var user = getApp().globalData.userInfo; | ||
| 235 | - if(user){ | ||
| 236 | - if(user.card_field && user['card_expiredate']){ | ||
| 237 | - var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 238 | - var end = new Date(str); | ||
| 239 | - end = Date.parse(end) / 1000; | ||
| 240 | - var now = ut.gettimestamp(); | ||
| 241 | - //--- 判断是等级会员,且在有效期范围内 --- | ||
| 242 | - if(user.card_field && now<end){ | ||
| 243 | - var card_name=ob.name_map.get(user.card_field); | ||
| 244 | - if(card_name && card_name.length>5) card_name=card_name.substring(0,5); | ||
| 245 | - th.setData({card_field:user.card_field,card_name:card_name}); | ||
| 246 | - if(t.data.data[user.card_field]>0) t.data.data.shop_price=t.data.data[user.card_field]; | ||
| 247 | - } | ||
| 248 | - } | ||
| 249 | - } | ||
| 250 | - ee.setData({ data: t.data.data, }); | ||
| 251 | - }) | ||
| 252 | - }else{ | ||
| 253 | - ee.setData({ data: t.data.data, }); | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | - if(!ee.data.collocationList){ | ||
| 257 | - /*---获取活动的重表---*/ | ||
| 258 | - //调用接口判断订单优惠, | ||
| 259 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+ee.data.gid+"/2", {}).then(res => { | ||
| 260 | - if(res.data.code==0){ | ||
| 261 | - var r_data=res.data.data; | ||
| 262 | - th.loop_promise(0,r_data.collocationList,function(){ | ||
| 263 | - ee.setData({ | ||
| 264 | - collocationGoods:r_data.collocationPromList, | ||
| 265 | - collocationList:r_data.collocationList, | ||
| 266 | - }) | ||
| 267 | - }) | ||
| 268 | - } | ||
| 269 | - }) | ||
| 270 | - } | ||
| 271 | - | ||
| 272 | - //获取统一条形码,普通商品和优惠促销的商品 | ||
| 273 | - if ( t.data.data.prom_type == 5){ | ||
| 274 | - //默认门店要拿下门店库存 | ||
| 275 | - if(that.data.sales_rules==2 && that.data.is_newsales_rules){ | ||
| 276 | - //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | ||
| 277 | - getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ | ||
| 278 | - if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){ | ||
| 279 | - var lock=0,plist=null; | ||
| 280 | - //先读取门店的lock,采用链式写法,少用await | ||
| 281 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
| 282 | - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000} | ||
| 283 | - }).then(res=>{ | ||
| 284 | - if(res.data.code==0 && res.data.data.total>0){ | ||
| 285 | - for(var i in res.data.data.pageData) | ||
| 286 | - lock+=res.data.data.pageData[i].outQty | ||
| 287 | - } | ||
| 288 | - //---通过接口获取门店的线下库存信息-- | ||
| 289 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
| 290 | - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid,pageSize:2000} | ||
| 291 | - }) | ||
| 292 | - }).then(res=>{ | ||
| 293 | - if(res.data.code==0 && res.data.data.total>0){ | ||
| 294 | - plist=res.data.data.pageData[0]; | ||
| 295 | - } | ||
| 296 | - if(plist && plist.CanOutQty-lock>0){ | ||
| 297 | - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; | ||
| 298 | - }else{ | ||
| 299 | - that.data.fir_def_store.CanOutQty=0; | ||
| 300 | - } | ||
| 301 | - //--给门店赋值线下库存-- | ||
| 302 | - th.setData({def_pick_store:that.data.fir_def_store}); | ||
| 303 | - //获取门店 | ||
| 304 | - ee.get_sto(); | ||
| 305 | - }) | ||
| 306 | - }else{ | ||
| 307 | - //--获取门店-- | ||
| 308 | - ee.get_sto(); | ||
| 309 | - } | ||
| 310 | - }) | ||
| 311 | - }else{ | ||
| 312 | - //获取门店 | ||
| 313 | - ee.get_sto(); | ||
| 314 | - } | ||
| 315 | - | ||
| 316 | - } | ||
| 317 | - else { | ||
| 318 | - return getApp().my_warnning("商品没有搭配购的活动",0,th) | ||
| 319 | - } | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - }); | ||
| 323 | - },1000) | 168 | + this.wait_for_store_config(); |
| 169 | + clearTimeout(ot); | ||
| 170 | + var ot = setTimeout(function () { | ||
| 171 | + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | ||
| 172 | + failRollback: !0, | ||
| 173 | + success: function (t) { | ||
| 174 | + if (t.data.code == 0) { | ||
| 175 | + if (t.data.data.is_on_sale != 1) { | ||
| 176 | + wx.showModal({ | ||
| 177 | + title: '商品已经下架', | ||
| 178 | + showCancel: !1, | ||
| 179 | + complete: function () { | ||
| 180 | + wx.navigateBack(); | ||
| 181 | + } | ||
| 182 | + }); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + var timestamp = Date.parse(new Date()); | ||
| 186 | + timestamp = timestamp / 1000; | ||
| 187 | + if (t.data.data.on_time > timestamp) { | ||
| 188 | + wx.showModal({ | ||
| 189 | + title: '商品还未上架', | ||
| 190 | + showCancel: !1, | ||
| 191 | + complete: function () { | ||
| 192 | + wx.navigateBack(); | ||
| 193 | + } | ||
| 194 | + }); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + if (t.data.data.down_time > 0) { | ||
| 198 | + if (t.data.data.down_time < timestamp) { | ||
| 199 | + wx.showModal({ | ||
| 200 | + title: '商品已经到期下架', | ||
| 201 | + showCancel: !1, | ||
| 202 | + complete: function () { | ||
| 203 | + wx.navigateBack(); | ||
| 204 | + } | ||
| 205 | + }); | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | ||
| 210 | + var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); | ||
| 211 | + t.data.data['disc'] = txt; | ||
| 212 | + | ||
| 213 | + if (t.data.data.original_img.indexOf(o.imghost) == -1) | ||
| 214 | + t.data.data.original_img = o.imghost + t.data.data.original_img; | ||
| 215 | + if (t.data.data.goods_content == null) t.data.data.goods_content = ""; | ||
| 216 | + | ||
| 217 | + //计算商品的规格 | ||
| 218 | + var gg = ""; | ||
| 219 | + if (t.data.data.goods_spec == "null" || t.data.data.goods_spec == null) t.data.data.goods_spec = ""; | ||
| 220 | + if (t.data.data.goods_color == "null" || t.data.data.goods_color == null) t.data.data.goods_color = ""; | ||
| 221 | + | ||
| 222 | + if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { | ||
| 223 | + gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; | ||
| 224 | + } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { | ||
| 225 | + gg = t.data.data.goods_spec + t.data.data.goods_color; | ||
| 226 | + } else { | ||
| 227 | + gg = "规格1"; | ||
| 228 | + } | ||
| 229 | + t.data.data.gg = gg; | ||
| 230 | + | ||
| 231 | + | ||
| 232 | + //--看一下有没有开启等级卡--- | ||
| 233 | + if (ee.data.rank_switch) { | ||
| 234 | + //---回调卡的列表--- | ||
| 235 | + th.getPlusCardType(function (ob) { | ||
| 236 | + var user = getApp().globalData.userInfo; | ||
| 237 | + if (user) { | ||
| 238 | + if (user.card_field && user['card_expiredate']) { | ||
| 239 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 240 | + var end = new Date(str); | ||
| 241 | + end = Date.parse(end) / 1000; | ||
| 242 | + var now = ut.gettimestamp(); | ||
| 243 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
| 244 | + if (user.card_field && now < end) { | ||
| 245 | + var card_name = ob.name_map.get(user.card_field); | ||
| 246 | + if (card_name && card_name.length > 5) card_name = card_name.substring(0, 5); | ||
| 247 | + th.setData({ | ||
| 248 | + card_field: user.card_field, | ||
| 249 | + card_name: card_name | ||
| 250 | + }); | ||
| 251 | + if (t.data.data[user.card_field] > 0) t.data.data.shop_price = t.data.data[user.card_field]; | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | + ee.setData({ | ||
| 256 | + data: t.data.data, | ||
| 257 | + }); | ||
| 258 | + }) | ||
| 259 | + } else { | ||
| 260 | + ee.setData({ | ||
| 261 | + data: t.data.data, | ||
| 262 | + }); | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + if (!ee.data.collocationList) { | ||
| 266 | + /*---获取活动的重表---*/ | ||
| 267 | + //调用接口判断订单优惠, | ||
| 268 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2", {}).then(res => { | ||
| 269 | + if (res.data.code == 0) { | ||
| 270 | + var r_data = res.data.data; | ||
| 271 | + | ||
| 272 | + th.data.is_coupon = r_data.collocationPromList.is_coupon; | ||
| 273 | + | ||
| 274 | + | ||
| 275 | + th.loop_promise(0, r_data.collocationList, function () { | ||
| 276 | + // 设置搭配购是否使用优惠卷 | ||
| 277 | + ee.setData({ | ||
| 278 | + collocationGoods: r_data.collocationPromList, | ||
| 279 | + collocationList: r_data.collocationList, | ||
| 280 | + }) | ||
| 281 | + }) | ||
| 282 | + } | ||
| 283 | + }) | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + //获取统一条形码,普通商品和优惠促销的商品 | ||
| 287 | + if (t.data.data.prom_type == 5) { | ||
| 288 | + //默认门店要拿下门店库存 | ||
| 289 | + if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | ||
| 290 | + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | ||
| 291 | + getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () { | ||
| 292 | + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id) { | ||
| 293 | + var lock = 0, | ||
| 294 | + plist = null; | ||
| 295 | + //先读取门店的lock,采用链式写法,少用await | ||
| 296 | + getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
| 297 | + data: { | ||
| 298 | + store_id: os.stoid, | ||
| 299 | + wareId: ee.data.data.goods_id, | ||
| 300 | + storageId: that.data.fir_def_store.pickup_id, | ||
| 301 | + pageSize: 1000 | ||
| 302 | + } | ||
| 303 | + }).then(res => { | ||
| 304 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 305 | + for (var i in res.data.data.pageData) | ||
| 306 | + lock += res.data.data.pageData[i].outQty | ||
| 307 | + } | ||
| 308 | + //---通过接口获取门店的线下库存信息-- | ||
| 309 | + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 310 | + data: { | ||
| 311 | + storageNos: that.data.fir_def_store.pickup_no, | ||
| 312 | + wareIds: encodeURIComponent(th.data.data.erpwareid), | ||
| 313 | + storeId: os.stoid, | ||
| 314 | + pageSize: 2000 | ||
| 315 | + } | ||
| 316 | + }) | ||
| 317 | + }).then(res => { | ||
| 318 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 319 | + plist = res.data.data.pageData[0]; | ||
| 320 | + } | ||
| 321 | + if (plist && plist.CanOutQty - lock > 0) { | ||
| 322 | + that.data.fir_def_store.CanOutQty = plist.CanOutQty - lock; | ||
| 323 | + } else { | ||
| 324 | + that.data.fir_def_store.CanOutQty = 0; | ||
| 325 | + } | ||
| 326 | + //--给门店赋值线下库存-- | ||
| 327 | + th.setData({ | ||
| 328 | + def_pick_store: that.data.fir_def_store | ||
| 329 | + }); | ||
| 330 | + //获取门店 | ||
| 331 | + ee.get_sto(); | ||
| 332 | + }) | ||
| 333 | + } else { | ||
| 334 | + //--获取门店-- | ||
| 335 | + ee.get_sto(); | ||
| 336 | + } | ||
| 337 | + }) | ||
| 338 | + } else { | ||
| 339 | + //获取门店 | ||
| 340 | + ee.get_sto(); | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + } else { | ||
| 344 | + return getApp().my_warnning("商品没有搭配购的活动", 0, th) | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + }); | ||
| 349 | + clearTimeout(ot); | ||
| 350 | + }, 1000) | ||
| 324 | }, | 351 | }, |
| 325 | 352 | ||
| 326 | onUnload: function() {}, | 353 | onUnload: function() {}, |
| @@ -507,6 +534,8 @@ Page({ | @@ -507,6 +534,8 @@ Page({ | ||
| 507 | newd['pick_dis'] = th.data.sto_sele_distr; | 534 | newd['pick_dis'] = th.data.sto_sele_distr; |
| 508 | newd["collocation_goods"]=th.data.sele_collocation; | 535 | newd["collocation_goods"]=th.data.sele_collocation; |
| 509 | 536 | ||
| 537 | + newd["is_coupon"] = th.data.is_coupon; | ||
| 538 | + | ||
| 510 | th.buyNow(newd); | 539 | th.buyNow(newd); |
| 511 | 540 | ||
| 512 | }, | 541 | }, |
packageB/pages/zuhegou/list/g_filter.wxs
| @@ -20,10 +20,19 @@ var g_filters = { | @@ -20,10 +20,19 @@ var g_filters = { | ||
| 20 | var tnow=getDate(); | 20 | var tnow=getDate(); |
| 21 | if(t1>=tnow) return 1; | 21 | if(t1>=tnow) return 1; |
| 22 | return 0; | 22 | return 0; |
| 23 | - } | 23 | + }, |
| 24 | + goToUrl: function(type, id, name) { | ||
| 25 | + if (type == 1) { | ||
| 26 | + return "/packageB/pages/zuhegou/index/index?id="+id+"&title="+name | ||
| 27 | + } else { | ||
| 28 | + return "/packageB/pages/zuhegou/preIndex/index?id="+id+"&title="+name | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + | ||
| 24 | } | 32 | } |
| 25 | module.exports = { | 33 | module.exports = { |
| 26 | has_char: g_filters.has_char, | 34 | has_char: g_filters.has_char, |
| 27 | beg_time: g_filters.beg_time, | 35 | beg_time: g_filters.beg_time, |
| 28 | end_time: g_filters.end_time, | 36 | end_time: g_filters.end_time, |
| 37 | + goToUrl: g_filters.goToUrl, | ||
| 29 | } | 38 | } |
| 30 | \ No newline at end of file | 39 | \ No newline at end of file |
packageB/pages/zuhegou/list/list.js
| @@ -90,16 +90,17 @@ Page({ | @@ -90,16 +90,17 @@ Page({ | ||
| 90 | 90 | ||
| 91 | //----倒计时函数----- | 91 | //----倒计时函数----- |
| 92 | countDown() { | 92 | countDown() { |
| 93 | + | ||
| 93 | if(!this.data.is_timer) return false; | 94 | if(!this.data.is_timer) return false; |
| 94 | var th=this; | 95 | var th=this; |
| 95 | // 获取当前时间,同时得到活动结束时间数组 | 96 | // 获取当前时间,同时得到活动结束时间数组 |
| 96 | - let newTime =ut.gettimestamp(); | ||
| 97 | - var endTimeList = this.data.goodlist; | ||
| 98 | - if(endTimeList==null) return null | 97 | + let newTime = ut.gettimestamp(); |
| 98 | + var endTimeList = th.data.goodlist; | ||
| 99 | + if(endTimeList == null) return null; | ||
| 99 | // 对结束时间进行处理渲染到页面 | 100 | // 对结束时间进行处理渲染到页面 |
| 100 | for (var i = 0; i < endTimeList.length;i++){ | 101 | for (var i = 0; i < endTimeList.length;i++){ |
| 101 | var o = endTimeList[i]; | 102 | var o = endTimeList[i]; |
| 102 | - var endTime = o.end_time; | 103 | + var endTime = o.start_time; |
| 103 | if(th.data.type==0) endTime = o.start_time; | 104 | if(th.data.type==0) endTime = o.start_time; |
| 104 | let obj = null; | 105 | let obj = null; |
| 105 | // 如果活动未结束,对时间进行处理 | 106 | // 如果活动未结束,对时间进行处理 |
| @@ -122,23 +123,36 @@ Page({ | @@ -122,23 +123,36 @@ Page({ | ||
| 122 | } | 123 | } |
| 123 | }, | 124 | }, |
| 124 | 125 | ||
| 126 | + // 请求活动列表 | ||
| 125 | async requestSalelist() { | 127 | async requestSalelist() { |
| 126 | //--没有更多就不调用-- | 128 | //--没有更多就不调用-- |
| 127 | if(!this.data.ismore) return false; | 129 | if(!this.data.ismore) return false; |
| 128 | - | ||
| 129 | - var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; | 130 | + var e = this, |
| 131 | + th = e, | ||
| 132 | + i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=" + this.data.type + "&page=" + e.data.currentPage; | ||
| 130 | // var plist=null,alllist=th.data.goodlist; | 133 | // var plist=null,alllist=th.data.goodlist; |
| 131 | // if(!alllist) alllist=[]; | 134 | // if(!alllist) alllist=[]; |
| 132 | - let {goodlist}=this.data; | 135 | + let {goodlist} = this.data; |
| 133 | const {data:res}=await getApp().request.promiseGet(i,{ | 136 | const {data:res}=await getApp().request.promiseGet(i,{ |
| 134 | isShowLoading:1, | 137 | isShowLoading:1, |
| 135 | - data:{store_id:os.stoid,user_id:getApp().globalData.user_id} | 138 | + data:{ |
| 139 | + store_id: os.stoid, | ||
| 140 | + user_id: getApp().globalData.user_id | ||
| 141 | + } | ||
| 136 | }) | 142 | }) |
| 137 | if(res.code==0 && res.data.pageData.length>0){ | 143 | if(res.code==0 && res.data.pageData.length>0){ |
| 138 | if(res.data.page>1){ | 144 | if(res.data.page>1){ |
| 139 | - goodlist=goodlist.concat(res.data.pageData) | 145 | + th.data.goodlist = goodlist.concat(res.data.pageData) |
| 140 | }else{ | 146 | }else{ |
| 141 | - goodlist=res.data.pageData; | 147 | + th.data.goodlist = res.data.pageData; |
| 148 | + } | ||
| 149 | + | ||
| 150 | + if (th.data.type == 0) { | ||
| 151 | + clearInterval(ot); | ||
| 152 | + var ot = setInterval(function () { | ||
| 153 | + th.countDown(); | ||
| 154 | + }, 1000); | ||
| 155 | + | ||
| 142 | } | 156 | } |
| 143 | 157 | ||
| 144 | }else{ | 158 | }else{ |
| @@ -146,14 +160,21 @@ Page({ | @@ -146,14 +160,21 @@ Page({ | ||
| 146 | th.data.ismore=0; | 160 | th.data.ismore=0; |
| 147 | } | 161 | } |
| 148 | e.data.currentPage++; | 162 | e.data.currentPage++; |
| 149 | - th.setData({goodlist,isshow:1}); | 163 | + th.setData({ |
| 164 | + goodlist: th.data.goodlist, | ||
| 165 | + isshow: 1 | ||
| 166 | + }); | ||
| 150 | 167 | ||
| 151 | }, | 168 | }, |
| 169 | + | ||
| 152 | onPullDownRefresh: function() { | 170 | onPullDownRefresh: function() { |
| 153 | this.reloadGoodList(); | 171 | this.reloadGoodList(); |
| 154 | }, | 172 | }, |
| 173 | + | ||
| 155 | reloadGoodList: function() { | 174 | reloadGoodList: function() { |
| 156 | - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); | 175 | + this.data.goodlist = null; |
| 176 | + this.data.currentPage = 1; | ||
| 177 | + this.requestSalelist(); | ||
| 157 | }, | 178 | }, |
| 158 | 179 | ||
| 159 | onReachBottom: function() { | 180 | onReachBottom: function() { |
| @@ -162,9 +183,16 @@ Page({ | @@ -162,9 +183,16 @@ Page({ | ||
| 162 | 183 | ||
| 163 | //点击tab事件 | 184 | //点击tab事件 |
| 164 | tip:function(e) { | 185 | tip:function(e) { |
| 165 | - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1; | ||
| 166 | - this.setData({type:a,goodlist:null}); | 186 | + var a = e.currentTarget.dataset.ty, |
| 187 | + th = this; | ||
| 188 | + th.data.type = a; | ||
| 189 | + th.data.ismore = 1; | ||
| 190 | + this.setData({ | ||
| 191 | + type:a, | ||
| 192 | + goodlist: null | ||
| 193 | + }); | ||
| 167 | this.reloadGoodList(); | 194 | this.reloadGoodList(); |
| 195 | + | ||
| 168 | }, | 196 | }, |
| 169 | 197 | ||
| 170 | 198 |
packageB/pages/zuhegou/list/list.wxml
| @@ -31,18 +31,26 @@ | @@ -31,18 +31,26 @@ | ||
| 31 | 31 | ||
| 32 | <view class="kill-list"> | 32 | <view class="kill-list"> |
| 33 | <view class="kill-item" wx:for="{{goodlist}}"> | 33 | <view class="kill-item" wx:for="{{goodlist}}"> |
| 34 | - <navigator class="kill-pic rel" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none"> | 34 | + <navigator class="kill-pic rel" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none"> |
| 35 | + <!-- <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> --> | ||
| 35 | <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}" | 36 | <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}" |
| 36 | data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image> | 37 | data-errorimg="goodlist[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image> |
| 37 | </navigator> | 38 | </navigator> |
| 38 | <view class="kill-cont"> | 39 | <view class="kill-cont"> |
| 39 | - <navigator class="goods-name ellipsis-2" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none"> | 40 | + <navigator class="goods-name ellipsis-2" url="{{g_filter.goToUrl(type, item.id, item.name)}}" hover-class="none"> |
| 40 | {{item.name}} | 41 | {{item.name}} |
| 41 | 42 | ||
| 42 | <view class="goods-num"> | 43 | <view class="goods-num"> |
| 43 | <view> | 44 | <view> |
| 44 | <view>组合数量: {{item.zhbuyqty}}</view> | 45 | <view>组合数量: {{item.zhbuyqty}}</view> |
| 45 | <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view> | 46 | <view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view> |
| 47 | + <view class="blue_c" wx:if="{{type == 0}}"> | ||
| 48 | + <text>剩余:</text> | ||
| 49 | + <text class='tui-conutdown-box'> {{item.djs.day}}</text>天 | ||
| 50 | + <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时 | ||
| 51 | + <text class='tui-conutdown-box'>{{item.djs.min}}</text>分 | ||
| 52 | + <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒 | ||
| 53 | + </view> | ||
| 46 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > | 54 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > |
| 47 | <view class="fs28" style="line-height: 16px;">¥</view> | 55 | <view class="fs28" style="line-height: 16px;">¥</view> |
| 48 | <text>{{item.zhprice}}</text> | 56 | <text>{{item.zhprice}}</text> |
| @@ -53,7 +61,24 @@ | @@ -53,7 +61,24 @@ | ||
| 53 | </view> | 61 | </view> |
| 54 | </view> | 62 | </view> |
| 55 | </view> | 63 | </view> |
| 56 | - <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> | 64 | + |
| 65 | +<view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> | ||
| 66 | + | ||
| 67 | +<view class="kill-time xc-seckill-bottom"> | ||
| 68 | + <view class="theader" > | ||
| 69 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | ||
| 70 | + <image class="xc-bottom" | ||
| 71 | + src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | ||
| 72 | + 火热进行中</view> | ||
| 73 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | ||
| 74 | + <image class="xc-bottom" | ||
| 75 | + src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | ||
| 76 | + 即将开始</view> | ||
| 77 | + </view> | ||
| 78 | +</view> | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + | ||
| 57 | </view> | 82 | </view> |
| 58 | 83 | ||
| 59 | <share_box id="share"></share_box> | 84 | <share_box id="share"></share_box> |
packageC/pages/group_list/group_list.js
| @@ -9,7 +9,8 @@ Page({ | @@ -9,7 +9,8 @@ Page({ | ||
| 9 | * 页面的初始数据 | 9 | * 页面的初始数据 |
| 10 | */ | 10 | */ |
| 11 | data: { | 11 | data: { |
| 12 | - // type:1, | 12 | + url: a.imghost, |
| 13 | + type:1, | ||
| 13 | // goodlist: null, | 14 | // goodlist: null, |
| 14 | 15 | ||
| 15 | isLogin: false, | 16 | isLogin: false, |
| @@ -51,13 +52,13 @@ Page({ | @@ -51,13 +52,13 @@ Page({ | ||
| 51 | isLogin: true, | 52 | isLogin: true, |
| 52 | }); | 53 | }); |
| 53 | 54 | ||
| 54 | - | 55 | + let typeVal = this.data.type; |
| 55 | let url = '/api/weshop/goods/groupBuy/page'; | 56 | let url = '/api/weshop/goods/groupBuy/page'; |
| 56 | let data = { | 57 | let data = { |
| 57 | store_id: app.globalData.setting.stoid, | 58 | store_id: app.globalData.setting.stoid, |
| 58 | is_show: 1, | 59 | is_show: 1, |
| 59 | is_end: 0, | 60 | is_end: 0, |
| 60 | - timetype:1 | 61 | + timetype: typeVal |
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 63 | this.setData({ | 64 | this.setData({ |
| @@ -72,21 +73,48 @@ Page({ | @@ -72,21 +73,48 @@ Page({ | ||
| 72 | }); | 73 | }); |
| 73 | }); | 74 | }); |
| 74 | 75 | ||
| 75 | - this.data.is_timer=1; | 76 | + this.data.is_timer = 1; |
| 76 | 77 | ||
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| 79 | - | ||
| 80 | //设置全局定时器 | 80 | //设置全局定时器 |
| 81 | + clearInterval(this.data.timer); | ||
| 81 | this.data.timer = setInterval(function () { | 82 | this.data.timer = setInterval(function () { |
| 82 | - self.countDown(); | ||
| 83 | - },1000); | ||
| 84 | - | 83 | + self.countDown(); |
| 84 | + }, 1000); | ||
| 85 | 85 | ||
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | }, | 88 | }, |
| 89 | 89 | ||
| 90 | + // 底部按钮切换 | ||
| 91 | + tip: function(e) { | ||
| 92 | + // 1进行中 0预热 | ||
| 93 | + let typeValue = e.currentTarget.dataset.ty; | ||
| 94 | + this.data.type = typeValue; | ||
| 95 | + let url = '/api/weshop/goods/groupBuy/page'; | ||
| 96 | + let data = { | ||
| 97 | + store_id: app.globalData.setting.stoid, | ||
| 98 | + is_show: 1, | ||
| 99 | + is_end: 0, | ||
| 100 | + timetype: typeValue | ||
| 101 | + }; | ||
| 102 | + | ||
| 103 | + this.getData(true, url, data).then(function() { | ||
| 104 | + self.setData({ | ||
| 105 | + currentData: data, | ||
| 106 | + }); | ||
| 107 | + | ||
| 108 | + }); | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + this.setData({ | ||
| 112 | + list: null, | ||
| 113 | + type: typeValue, | ||
| 114 | + }); | ||
| 115 | + | ||
| 116 | + }, | ||
| 117 | + | ||
| 90 | /** | 118 | /** |
| 91 | * 生命周期函数--监听页面隐藏 | 119 | * 生命周期函数--监听页面隐藏 |
| 92 | */ | 120 | */ |
| @@ -210,7 +238,7 @@ Page({ | @@ -210,7 +238,7 @@ Page({ | ||
| 210 | // 对结束时间进行处理渲染到页面 | 238 | // 对结束时间进行处理渲染到页面 |
| 211 | for(var i = 0; i < endTimeList.length; i++) { | 239 | for(var i = 0; i < endTimeList.length; i++) { |
| 212 | var o = endTimeList[i]; | 240 | var o = endTimeList[i]; |
| 213 | - var endTime = o.end_time; | 241 | + var endTime = this.data.type == 1?o.end_time:o.start_time; |
| 214 | // if(th.data.type==0) endTime = o.start_time; | 242 | // if(th.data.type==0) endTime = o.start_time; |
| 215 | let obj = null; | 243 | let obj = null; |
| 216 | // 如果活动未结束,对时间进行处理 | 244 | // 如果活动未结束,对时间进行处理 |
packageC/pages/group_list/group_list.wxml
| @@ -9,8 +9,13 @@ | @@ -9,8 +9,13 @@ | ||
| 9 | <view> | 9 | <view> |
| 10 | <view class="fs30">{{item.title}}</view> | 10 | <view class="fs30">{{item.title}}</view> |
| 11 | <view class="flex ai_c"> | 11 | <view class="flex ai_c"> |
| 12 | - <view class="fs26 tag">{{item.rebate}}折</view> | ||
| 13 | - <view class="rmb c-red fs30">{{item.price}}</view> | 12 | + |
| 13 | + <view class="fs26 tag" wx:if="{{type == 1}}">{{item.rebate}}折</view> | ||
| 14 | + <view class="fs26 tag" style="color:#fff;background:#059de5;" wx:else>{{item.rebate}}折</view> | ||
| 15 | + | ||
| 16 | + <view class="rmb c-red fs30" wx:if="{{type == 1}}">{{item.price}}</view> | ||
| 17 | + <view class="rmb c-red fs30" style="color:#059de5;" wx:else>{{item.price}}</view> | ||
| 18 | + | ||
| 14 | <view class="rmb del fs24 c-7b pdl10">{{item.market_price}}</view> | 19 | <view class="rmb del fs24 c-7b pdl10">{{item.market_price}}</view> |
| 15 | </view> | 20 | </view> |
| 16 | </view> | 21 | </view> |
| @@ -19,15 +24,32 @@ | @@ -19,15 +24,32 @@ | ||
| 19 | <view>已售{{item.buy_num+item.virtual_num}}件</view> | 24 | <view>已售{{item.buy_num+item.virtual_num}}件</view> |
| 20 | <view class=""><text class="iconfont icon-shizhong fs24"></text>{{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒</view> | 25 | <view class=""><text class="iconfont icon-shizhong fs24"></text>{{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒</view> |
| 21 | </view> | 26 | </view> |
| 22 | - <view class="btn" >去团购</view> | 27 | + |
| 28 | + | ||
| 29 | + <view class="btn" wx:if="{{type == 1}}">去团购</view> | ||
| 30 | + <view class="btn" style="background: #059de5;color:#fff;" wx:else>即将开始</view> | ||
| 31 | + | ||
| 32 | + | ||
| 23 | </view> | 33 | </view> |
| 24 | </view> | 34 | </view> |
| 25 | </view> | 35 | </view> |
| 26 | 36 | ||
| 27 | </block> | 37 | </block> |
| 28 | - | ||
| 29 | - | 38 | + <view style="height:60rpx"></view> |
| 30 | </view> | 39 | </view> |
| 31 | 40 | ||
| 32 | <view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view> | 41 | <view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view> |
| 33 | <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> | 42 | <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> |
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | +<view class="kill-time xc-seckill-bottom"> | ||
| 47 | + <view class="theader" > | ||
| 48 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | ||
| 49 | + <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | ||
| 50 | + 火热进行中</view> | ||
| 51 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | ||
| 52 | + <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | ||
| 53 | + 即将开始</view> | ||
| 54 | + </view> | ||
| 55 | +</view> | ||
| 34 | \ No newline at end of file | 56 | \ No newline at end of file |
packageC/pages/group_list/group_list.wxss
| @@ -55,4 +55,83 @@ page { | @@ -55,4 +55,83 @@ page { | ||
| 55 | text-align: center; | 55 | text-align: center; |
| 56 | /* margin-top: 10rpx; */ | 56 | /* margin-top: 10rpx; */ |
| 57 | color: #ccc; | 57 | color: #ccc; |
| 58 | +} | ||
| 59 | + | ||
| 60 | +.xc-seckill-bottom{ | ||
| 61 | + position: fixed; | ||
| 62 | +bottom: 0rpx; | ||
| 63 | +width: 100%; | ||
| 64 | + | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +.xc-bottom{ | ||
| 68 | + width: 45rpx; | ||
| 69 | + height: 45rpx; | ||
| 70 | + margin-right: 13rpx; | ||
| 71 | +} | ||
| 72 | +.xc-border-right{ | ||
| 73 | + border-right: 4rpx solid #eee; | ||
| 74 | + | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +.kill-time .theader .timeac { | ||
| 78 | + font-size: 32rpx; height:100%; width: 50%; | ||
| 79 | + color: #333; background-color: #fff; | ||
| 80 | + | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +.kill-time .theader{ | ||
| 84 | + display: flex; margin: 0 auto; align-items: center; | ||
| 85 | + height: 100rpx; | ||
| 86 | + | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +.kill-time { | ||
| 90 | + text-align: center; | ||
| 91 | + justify-content: space-around; | ||
| 92 | + align-items: center; | ||
| 93 | + height: 101rpx; | ||
| 94 | + border-bottom: 1px solid #ddd; | ||
| 95 | + border-top: 1px solid #ddd; | ||
| 96 | + background-color: #f6f6f6; | ||
| 97 | +} | ||
| 98 | +.kill-time .theader{ | ||
| 99 | + display: flex; margin: 0 auto; align-items: center; | ||
| 100 | + height: 100rpx; | ||
| 101 | + | ||
| 102 | +} | ||
| 103 | +.kill-time .theader .timeac { | ||
| 104 | + font-size: 32rpx; height:100%; width: 50%; | ||
| 105 | + color: #333; background-color: #fff; | ||
| 106 | + | ||
| 107 | +} | ||
| 108 | +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} | ||
| 109 | +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ | ||
| 110 | +.kill-time .theader .timeac.active{color: #c4182e} | ||
| 111 | + | ||
| 112 | +.kill-item { | ||
| 113 | + display: flex; | ||
| 114 | + justify-content: space-between; | ||
| 115 | + background-color: #fff; | ||
| 116 | + padding: 20rpx; | ||
| 117 | + margin-bottom: 20rpx; | ||
| 118 | + border-radius: 10rpx; | ||
| 119 | + /* height: 249rpx; */ | ||
| 120 | + align-items: center; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +.kill-pic { | ||
| 124 | + width: 215rpx; | ||
| 125 | + height: 215rpx; | ||
| 126 | +} | ||
| 127 | + | ||
| 128 | +.kill-cont { | ||
| 129 | + width: 465rpx; | ||
| 130 | + margin-left:20rpx; | ||
| 131 | + margin-right: 5rpx; | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +.blue_c { | ||
| 135 | + color: #059de5; | ||
| 136 | + | ||
| 58 | } | 137 | } |
| 59 | \ No newline at end of file | 138 | \ No newline at end of file |
packageC/pages/presell/list/list.js
| @@ -11,6 +11,7 @@ Page({ | @@ -11,6 +11,7 @@ Page({ | ||
| 11 | isshow: 0, | 11 | isshow: 0, |
| 12 | ad_data: null, | 12 | ad_data: null, |
| 13 | max_sw_height: 200, | 13 | max_sw_height: 200, |
| 14 | + type: 1, | ||
| 14 | }, | 15 | }, |
| 15 | 16 | ||
| 16 | //------初始化加载---------- | 17 | //------初始化加载---------- |
| @@ -117,7 +118,7 @@ Page({ | @@ -117,7 +118,7 @@ Page({ | ||
| 117 | store_id: os.stoid, | 118 | store_id: os.stoid, |
| 118 | page: this.data.page, | 119 | page: this.data.page, |
| 119 | pageSize: 10, | 120 | pageSize: 10, |
| 120 | - timetype: 1, | 121 | + timetype: self.data.type, |
| 121 | isuse:1 | 122 | isuse:1 |
| 122 | } | 123 | } |
| 123 | if(getApp().globalData.userInfo){ | 124 | if(getApp().globalData.userInfo){ |
| @@ -131,7 +132,6 @@ Page({ | @@ -131,7 +132,6 @@ Page({ | ||
| 131 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | 132 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { |
| 132 | data: req, | 133 | data: req, |
| 133 | success: function (res) { | 134 | success: function (res) { |
| 134 | - console.log(res); | ||
| 135 | self.data.loading = 0; | 135 | self.data.loading = 0; |
| 136 | if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { | 136 | if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { |
| 137 | var list = self.data.goodlist ? self.data.goodlist : []; | 137 | var list = self.data.goodlist ? self.data.goodlist : []; |
| @@ -145,17 +145,92 @@ Page({ | @@ -145,17 +145,92 @@ Page({ | ||
| 145 | if (arr.length < 10) { | 145 | if (arr.length < 10) { |
| 146 | self.setData({no_more: 1}) | 146 | self.setData({no_more: 1}) |
| 147 | } | 147 | } |
| 148 | + | ||
| 149 | + // 预热活动设置倒计时 | ||
| 150 | + if (self.data.type == 0) { | ||
| 151 | + clearInterval(self.data.timer); | ||
| 152 | + self.data.timer = setInterval(function () { | ||
| 153 | + self.countDown(); | ||
| 154 | + }, 1000); | ||
| 155 | + | ||
| 156 | + } | ||
| 148 | } else { | 157 | } else { |
| 149 | self.setData({no_more: 1}) | 158 | self.setData({no_more: 1}) |
| 150 | } | 159 | } |
| 151 | self.setData({is_get: 1}) | 160 | self.setData({is_get: 1}) |
| 152 | - | 161 | + |
| 153 | } | 162 | } |
| 154 | }) | 163 | }) |
| 155 | }, | 164 | }, |
| 165 | + | ||
| 166 | + | ||
| 156 | go_index:function () { | 167 | go_index:function () { |
| 157 | getApp().goto("/pages/index/index/index"); | 168 | getApp().goto("/pages/index/index/index"); |
| 158 | - } | 169 | + }, |
| 170 | + | ||
| 171 | + | ||
| 172 | + tip: function(e){ | ||
| 173 | + // 获取模板Data数据 1进行中 0预热中 | ||
| 174 | + var typeValue = e.currentTarget.dataset.ty; | ||
| 175 | + // 初始化数据 | ||
| 176 | + this.data.type = typeValue; | ||
| 177 | + this.data.loading = 0; | ||
| 178 | + this.data.no_more = 0; | ||
| 179 | + this.data.page = 1; | ||
| 180 | + this.data.goodlist = []; | ||
| 181 | + var goodslist = this.data.goodlist; | ||
| 182 | + // 设置模板Data数据 | ||
| 183 | + this.setData({ | ||
| 184 | + type: typeValue, | ||
| 185 | + goodlist: goodslist, | ||
| 186 | + }); | ||
| 187 | + // 请求接口数据 | ||
| 188 | + this.get_list(); | ||
| 189 | + }, | ||
| 190 | + | ||
| 191 | + //----倒计时函数----- | ||
| 192 | + countDown() { | ||
| 193 | + var th=this; | ||
| 194 | + // 获取当前时间,同时得到活动结束时间数组 | ||
| 195 | + let newTime = ut.gettimestamp(); | ||
| 196 | + var endTimeList = this.data.goodlist; | ||
| 197 | + if(endTimeList==null) return null | ||
| 198 | + // 对结束时间进行处理渲染到页面 | ||
| 199 | + for (var i = 0; i < endTimeList.length; i++){ | ||
| 200 | + var o = endTimeList[i]; | ||
| 201 | + var endTime = o.start_time; | ||
| 202 | + let obj = null; | ||
| 203 | + // 如果活动未结束,对时间进行处理 | ||
| 204 | + if (endTime - newTime > 0){ | ||
| 205 | + let time = (endTime - newTime); | ||
| 206 | + // 获取天、时、分、秒 | ||
| 207 | + let day = parseInt(time / (60 * 60 * 24)); | ||
| 208 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | ||
| 209 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | ||
| 210 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | ||
| 211 | + obj = { | ||
| 212 | + day: this.timeFormat(day), | ||
| 213 | + hou: this.timeFormat(hou), | ||
| 214 | + min: this.timeFormat(min), | ||
| 215 | + sec: this.timeFormat(sec), | ||
| 216 | + hide: 1 | ||
| 217 | + } | ||
| 218 | + }else{ | ||
| 219 | + //活动已结束,全部设置为'00' | ||
| 220 | + obj = { | ||
| 221 | + day: '00', | ||
| 222 | + hou: '00', | ||
| 223 | + min: '00', | ||
| 224 | + sec: '00' | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + var txt ="goodlist["+i+"].djs"; | ||
| 228 | + th.setData({ [txt]: obj}); | ||
| 229 | + } | ||
| 230 | + }, | ||
| 231 | + | ||
| 232 | + | ||
| 159 | 233 | ||
| 234 | + | ||
| 160 | 235 | ||
| 161 | }); | 236 | }); |
packageC/pages/presell/list/list.wxml
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | <view class="flex-vertical xc-strip-frame"> | 37 | <view class="flex-vertical xc-strip-frame"> |
| 38 | <view class="xc-strip-blank rel"> | 38 | <view class="xc-strip-blank rel"> |
| 39 | 39 | ||
| 40 | - <view class="flex-vertical rel total"> | 40 | + <view class="flex-vertical rel total" style="background-color: {{type == 0 ? '#059de5' : ''}};"> |
| 41 | <view class="t-c abs xc-fill" style="width:{{215*(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)}}rpx;background:#e4374d;"></view> | 41 | <view class="t-c abs xc-fill" style="width:{{215*(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)}}rpx;background:#e4374d;"></view> |
| 42 | <text class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}%</text> | 42 | <text class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}%</text> |
| 43 | </view> | 43 | </view> |
| @@ -45,32 +45,56 @@ | @@ -45,32 +45,56 @@ | ||
| 45 | </view> | 45 | </view> |
| 46 | <view class=" ml10 fs20">库存还剩{{item.presell_sumqty-item.buy_goodnum}}件</view> | 46 | <view class=" ml10 fs20">库存还剩{{item.presell_sumqty-item.buy_goodnum}}件</view> |
| 47 | </view> | 47 | </view> |
| 48 | - | ||
| 49 | - | 48 | + |
| 50 | <view class="goods-num"> | 49 | <view class="goods-num"> |
| 51 | <view> | 50 | <view> |
| 52 | - <view class="{{type==1?'xc-wc':'blue_c'}}"></view> | 51 | + <view class="blue_c" wx:if="{{type == 0}}"> |
| 52 | + <text>剩余:</text> | ||
| 53 | + <text class='tui-conutdown-box'> {{item.djs.day}}</text>天 | ||
| 54 | + <text class='tui-conutdown-box'>{{item.djs.hou}}</text>时 | ||
| 55 | + <text class='tui-conutdown-box'>{{item.djs.min}}</text>分 | ||
| 56 | + <text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒 | ||
| 57 | + </view> | ||
| 58 | + | ||
| 53 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > | 59 | <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" > |
| 54 | <view class="fs28" style="line-height: 16px;">¥{{item.presell_price}}</view> | 60 | <view class="fs28" style="line-height: 16px;">¥{{item.presell_price}}</view> |
| 55 | <text>{{item.price}}</text> | 61 | <text>{{item.price}}</text> |
| 56 | <span class="underline fs20">零售价¥{{item.market_price}}</span></view> | 62 | <span class="underline fs20">零售价¥{{item.market_price}}</span></view> |
| 57 | - | ||
| 58 | </view> | 63 | </view> |
| 59 | <view class="kill-btn "> | 64 | <view class="kill-btn "> |
| 60 | - <navigator url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> | 65 | + <navigator wx:if="{{type==1}}" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">去抢购</navigator> |
| 66 | + <navigator wx:else url="/packageC/pages/presell/pregoodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}" style="background:#059de5;"><view style="color:#fff;">即将开始</view></navigator> | ||
| 61 | </view> | 67 | </view> |
| 68 | + | ||
| 62 | </view> | 69 | </view> |
| 63 | </view> | 70 | </view> |
| 64 | </view> | 71 | </view> |
| 65 | </view> | 72 | </view> |
| 66 | 73 | ||
| 67 | - <block wx:if="{{goodlist.length==0 && is_get}}"> | ||
| 68 | - <nodata nodataContainer="t-c"></nodata> | ||
| 69 | - <view class="bc_btn" bindtap="go_index">去首页逛逛</view> | ||
| 70 | - </block> | ||
| 71 | - <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | 74 | +<block wx:if="{{goodlist.length==0 && is_get}}"> |
| 75 | +<nodata nodataContainer="t-c"></nodata> | ||
| 76 | +</block> | ||
| 72 | 77 | ||
| 78 | + <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | ||
| 73 | <view style="height:10rpx"></view> | 79 | <view style="height:10rpx"></view> |
| 80 | + | ||
| 81 | + <!-- 底部按钮 --> | ||
| 82 | + <view class="kill-time xc-seckill-bottom"> | ||
| 83 | + <view class="theader" > | ||
| 84 | + <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | ||
| 85 | + <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | ||
| 86 | + 火热进行中 | ||
| 87 | + </view> | ||
| 88 | + | ||
| 89 | + <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | ||
| 90 | + <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | ||
| 91 | + 即将开始 | ||
| 92 | + </view> | ||
| 93 | + | ||
| 94 | + </view> | ||
| 95 | +</view> | ||
| 96 | + | ||
| 97 | + | ||
| 74 | </view> | 98 | </view> |
| 75 | 99 | ||
| 76 | 100 |
pages/cart/cart2/cart2.js
| @@ -175,7 +175,10 @@ Page({ | @@ -175,7 +175,10 @@ Page({ | ||
| 175 | //----------子页返回父页触发---------- | 175 | //----------子页返回父页触发---------- |
| 176 | onShow: function () { | 176 | onShow: function () { |
| 177 | var th = this; | 177 | var th = this; |
| 178 | - th.setData({show_submit: 0}); //让提交先掩藏 | 178 | + th.setData({ |
| 179 | + show_submit: 0, | ||
| 180 | + | ||
| 181 | + }); //让提交先掩藏 | ||
| 179 | th.data.g_cart_q_time = null; | 182 | th.data.g_cart_q_time = null; |
| 180 | 183 | ||
| 181 | if (th.data.isclose == 0) { | 184 | if (th.data.isclose == 0) { |
| @@ -328,6 +331,7 @@ Page({ | @@ -328,6 +331,7 @@ Page({ | ||
| 328 | typeof func == "function" && func(); | 331 | typeof func == "function" && func(); |
| 329 | }) | 332 | }) |
| 330 | }, | 333 | }, |
| 334 | + | ||
| 331 | //------获取会员信息-----先获取用户信息,在进行下一步--- | 335 | //------获取会员信息-----先获取用户信息,在进行下一步--- |
| 332 | get_info: function (func) { | 336 | get_info: function (func) { |
| 333 | var user_id = t.globalData.user_id; | 337 | var user_id = t.globalData.user_id; |
| @@ -831,6 +835,8 @@ Page({ | @@ -831,6 +835,8 @@ Page({ | ||
| 831 | get_buy_goods: function (e) { | 835 | get_buy_goods: function (e) { |
| 832 | var th = this; | 836 | var th = this; |
| 833 | var gg = to.get_b_now(); | 837 | var gg = to.get_b_now(); |
| 838 | + | ||
| 839 | + | ||
| 834 | //--------如果goods_id一样,就是要立即购买----- | 840 | //--------如果goods_id一样,就是要立即购买----- |
| 835 | if (e == gg.goods_id) { | 841 | if (e == gg.goods_id) { |
| 836 | a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { | 842 | a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { |
| @@ -978,6 +984,11 @@ Page({ | @@ -978,6 +984,11 @@ Page({ | ||
| 978 | } else { | 984 | } else { |
| 979 | //--看是不是搭配促销-- | 985 | //--看是不是搭配促销-- |
| 980 | if (gg.prom_type == 5) { | 986 | if (gg.prom_type == 5) { |
| 987 | + | ||
| 988 | + th.setData({ | ||
| 989 | + 'is_coupon': gg.is_coupon | ||
| 990 | + }); | ||
| 991 | + | ||
| 981 | t.data.data.prom_id = gg.prom_id; | 992 | t.data.data.prom_id = gg.prom_id; |
| 982 | t.data.data.prom_type = 5; | 993 | t.data.data.prom_type = 5; |
| 983 | if (gg.room_id) { | 994 | if (gg.room_id) { |
| @@ -3591,6 +3602,7 @@ Page({ | @@ -3591,6 +3602,7 @@ Page({ | ||
| 3591 | if (th.data.is_b_now == 1) { | 3602 | if (th.data.is_b_now == 1) { |
| 3592 | th.setData({index: m_wind, is_express: m_wind}); | 3603 | th.setData({index: m_wind, is_express: m_wind}); |
| 3593 | } else { | 3604 | } else { |
| 3605 | + clearInterval(ui); | ||
| 3594 | var ui = setInterval(function () { | 3606 | var ui = setInterval(function () { |
| 3595 | if (th.data.cartlist) { | 3607 | if (th.data.cartlist) { |
| 3596 | var c_arr = th.data.cartlist; | 3608 | var c_arr = th.data.cartlist; |
pages/cart/cart2/cart2.wxml
| @@ -343,11 +343,12 @@ | @@ -343,11 +343,12 @@ | ||
| 343 | 343 | ||
| 344 | 344 | ||
| 345 | <view class="set-mes bdr_b-14"> | 345 | <view class="set-mes bdr_b-14"> |
| 346 | + | ||
| 346 | <view wx:if="{{order.store_prom}}"> | 347 | <view wx:if="{{order.store_prom}}"> |
| 347 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} | 348 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} |
| 348 | </view> | 349 | </view> |
| 349 | 350 | ||
| 350 | - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | 351 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{is_coupon > 0 && ((selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null)}}"> |
| 351 | <view class="work-frame flex-space-between"> | 352 | <view class="work-frame flex-space-between"> |
| 352 | <view class="work"> | 353 | <view class="work"> |
| 353 | 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | 354 | 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> |
pages/goods/goodsInfo/goodsInfo.js
| @@ -3105,8 +3105,8 @@ Page({ | @@ -3105,8 +3105,8 @@ Page({ | ||
| 3105 | 3105 | ||
| 3106 | //--------检查是否活动,活动是否开始,或者是否结束------- | 3106 | //--------检查是否活动,活动是否开始,或者是否结束------- |
| 3107 | async check_prom(gid, prom_type, prom_id) { | 3107 | async check_prom(gid, prom_type, prom_id) { |
| 3108 | - console.log('check_prom'); | ||
| 3109 | - var ee = this,th = ee; | 3108 | + var ee = this, |
| 3109 | + th = ee; | ||
| 3110 | var user_id=getApp().globalData.user_id; | 3110 | var user_id=getApp().globalData.user_id; |
| 3111 | if(!user_id) user_id=0; | 3111 | if(!user_id) user_id=0; |
| 3112 | 3112 | ||
| @@ -3118,6 +3118,7 @@ Page({ | @@ -3118,6 +3118,7 @@ Page({ | ||
| 3118 | } | 3118 | } |
| 3119 | 3119 | ||
| 3120 | if(prom_type==2){ | 3120 | if(prom_type==2){ |
| 3121 | + | ||
| 3121 | //-------判断团购活动是否抢光--------- | 3122 | //-------判断团购活动是否抢光--------- |
| 3122 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { | 3123 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { |
| 3123 | 1: 1 | 3124 | 1: 1 |
| @@ -3129,11 +3130,12 @@ Page({ | @@ -3129,11 +3130,12 @@ Page({ | ||
| 3129 | }); | 3130 | }); |
| 3130 | //拿取价格并且判断时间-- | 3131 | //拿取价格并且判断时间-- |
| 3131 | getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { | 3132 | getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { |
| 3132 | - success: function (t) { | ||
| 3133 | - if (t.data.code != 0) { | ||
| 3134 | - ee.get_normal(gid); | ||
| 3135 | - return false; | ||
| 3136 | - } | 3133 | + success: function (t) { |
| 3134 | + if (t.data.code != 0) { | ||
| 3135 | + ee.get_normal(gid); | ||
| 3136 | + return false; | ||
| 3137 | + } | ||
| 3138 | + | ||
| 3137 | //----已经结束----- | 3139 | //----已经结束----- |
| 3138 | if (t.data.data.is_end == 1) { | 3140 | if (t.data.data.is_end == 1) { |
| 3139 | ee.get_normal(gid); | 3141 | ee.get_normal(gid); |
| @@ -3141,17 +3143,18 @@ Page({ | @@ -3141,17 +3143,18 @@ Page({ | ||
| 3141 | } | 3143 | } |
| 3142 | //----已经过期----- | 3144 | //----已经过期----- |
| 3143 | var now = ut.gettimestamp(); | 3145 | var now = ut.gettimestamp(); |
| 3144 | - if (t.data.data.end_time < now || t.data.data.start_time>now) { | 3146 | + // if (t.data.data.end_time < now || t.data.data.start_time > now) { |
| 3147 | + if (t.data.data.end_time < now) { | ||
| 3145 | ee.get_normal(gid); | 3148 | ee.get_normal(gid); |
| 3146 | return false; | 3149 | return false; |
| 3147 | } | 3150 | } |
| 3148 | - | 3151 | + |
| 3149 | /*-- 还没有开始预热的也不显示 --*/ | 3152 | /*-- 还没有开始预热的也不显示 --*/ |
| 3150 | if (t.data.data.show_time > now) { | 3153 | if (t.data.data.show_time > now) { |
| 3151 | ee.get_normal(gid); | 3154 | ee.get_normal(gid); |
| 3152 | return false; | 3155 | return false; |
| 3153 | } | 3156 | } |
| 3154 | - | 3157 | + |
| 3155 | var t_gd = ee.data.data; | 3158 | var t_gd = ee.data.data; |
| 3156 | var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); | 3159 | var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); |
| 3157 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); | 3160 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); |