Commit bc61693e10d14b6bb9acf1260d6ea113cb0b13ab
1 parent
d68beddc
秒杀优化,和组合购优化
Showing
5 changed files
with
28 additions
and
12 deletions
components/diy_seckill/diy_seckill.js
| @@ -76,9 +76,12 @@ Component({ | @@ -76,9 +76,12 @@ Component({ | ||
| 76 | }) | 76 | }) | 
| 77 | goodsidlist = ut.sub_last(goodsidlist); | 77 | goodsidlist = ut.sub_last(goodsidlist); | 
| 78 | 78 | ||
| 79 | + var user_id=getApp().globalData.user_id; | ||
| 80 | + if(!user_id){ user_id=0;} | ||
| 81 | + | ||
| 79 | //--调用接口,读取秒杀-- | 82 | //--调用接口,读取秒杀-- | 
| 80 | app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id=" | 83 | app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id=" | 
| 81 | - + os.stoid + "&goodsidlist=" + goodsidlist, {}).then(res => { | 84 | + + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id"+user_id, {}).then(res => { | 
| 82 | console.log(res); | 85 | console.log(res); | 
| 83 | //如果秒杀的数组为空的时候 | 86 | //如果秒杀的数组为空的时候 | 
| 84 | var goodslist = res.data.data; | 87 | var goodslist = res.data.data; | 
| @@ -118,6 +121,7 @@ Component({ | @@ -118,6 +121,7 @@ Component({ | ||
| 118 | g_id.forEach(function (val, ind) { | 121 | g_id.forEach(function (val, ind) { | 
| 119 | goodslist.forEach(function (vy, indy) { | 122 | goodslist.forEach(function (vy, indy) { | 
| 120 | if (val.goodsid == vy.goods_id) { | 123 | if (val.goodsid == vy.goods_id) { | 
| 124 | + if(!vy.id) vy.id=vy.prom_id; | ||
| 121 | all_array.push(vy); | 125 | all_array.push(vy); | 
| 122 | } | 126 | } | 
| 123 | }) | 127 | }) | 
pages/cart/cart2/cart2.wxml
| @@ -78,8 +78,11 @@ | @@ -78,8 +78,11 @@ | ||
| 78 | </view> | 78 | </view> | 
| 79 | <view class="order-detail" wx:for="{{item.goods}}" wx:for-index="idx" wx:for-item="items"> | 79 | <view class="order-detail" wx:for="{{item.goods}}" wx:for-index="idx" wx:for-item="items"> | 
| 80 | <!----商品图片-----> | 80 | <!----商品图片-----> | 
| 81 | - <view class="goods-img" style="position: relative"> | 81 | + <view class="goods-img" style="position: relative; overflow: hidden"> | 
| 82 | <image wx:if="{{items.is_gift}}" src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image> | 82 | <image wx:if="{{items.is_gift}}" src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image> | 
| 83 | + <text class="zuhe" wx:if="{{items.prom_type==7}}">组合购</text> | ||
| 84 | + | ||
| 85 | + | ||
| 83 | <image class="wh100 bdr14" src="{{items.original_img}}" binderror='cart_set_err' data-err='cartlist[{{pidx}}].goods[{{idx}}].original_img'></image> | 86 | <image class="wh100 bdr14" src="{{items.original_img}}" binderror='cart_set_err' data-err='cartlist[{{pidx}}].goods[{{idx}}].original_img'></image> | 
| 84 | </view> | 87 | </view> | 
| 85 | <!----商品名称规格----> | 88 | <!----商品名称规格----> | 
| @@ -89,15 +92,9 @@ | @@ -89,15 +92,9 @@ | ||
| 89 | <view class="flex-vertical fs28 color-gray n_guige"> | 92 | <view class="flex-vertical fs28 color-gray n_guige"> | 
| 90 | <view class="goods-color"> | 93 | <view class="goods-color"> | 
| 91 | <block><text>{{filters.show_gui_ge(items.goods_spec,items.goods_color)}}</text></block> | 94 | <block><text>{{filters.show_gui_ge(items.goods_spec,items.goods_color)}}</text></block> | 
| 92 | - <!--<block wx:if="{{!items.goods_spec && !items.goods_color}}"><text>规格1</text></block>--> | ||
| 93 | - <!--<block wx:else>--> | ||
| 94 | - <!--<text wx:if="{{items.goods_spec!=''}}">{{items.goods_spec}}<text wx:if="{{items.goods_color}}">/</text></text>--> | ||
| 95 | - <!--<text wx:if="{{items.goods_color}}">{{items.goods_color}}</text>--> | ||
| 96 | - <!--</block>--> | ||
| 97 | </view> | 95 | </view> | 
| 98 | </view> | 96 | </view> | 
| 99 | 97 | ||
| 100 | - | ||
| 101 | <!-----商品名称规格------> | 98 | <!-----商品名称规格------> | 
| 102 | <view class="order-num flex-space-between"> | 99 | <view class="order-num flex-space-between"> | 
| 103 | <view class="co-red">¥<text class="fs36">{{filters.toFix(items.goods_price,2)}}</text></view> | 100 | <view class="co-red">¥<text class="fs36">{{filters.toFix(items.goods_price,2)}}</text></view> | 
pages/cart/cart2/cart2.wxss
| @@ -19,9 +19,6 @@ | @@ -19,9 +19,6 @@ | ||
| 19 | box-shadow: 16rpx 0px 12px #e7e9eb; | 19 | box-shadow: 16rpx 0px 12px #e7e9eb; | 
| 20 | } | 20 | } | 
| 21 | 21 | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | page { | 22 | page { | 
| 26 | /* background-color: #FAFAFA; */ | 23 | /* background-color: #FAFAFA; */ | 
| 27 | background-color: #F0F0F0; | 24 | background-color: #F0F0F0; | 
| @@ -995,3 +992,16 @@ margin-left: 20rpx; | @@ -995,3 +992,16 @@ margin-left: 20rpx; | ||
| 995 | top:36rpx | 992 | top:36rpx | 
| 996 | } | 993 | } | 
| 997 | 994 | ||
| 995 | +.zuhe { | ||
| 996 | + width: 140rpx; | ||
| 997 | + text-align: center; | ||
| 998 | + height:40rpx; | ||
| 999 | + position: absolute; | ||
| 1000 | + top: 15rpx; | ||
| 1001 | + left: -37rpx; | ||
| 1002 | + transform: rotate(-45deg); | ||
| 1003 | + background-color: rgb(255,0,0); | ||
| 1004 | + font-size:22rpx; | ||
| 1005 | + color: #fff; | ||
| 1006 | + line-height: 37rpx; | ||
| 1007 | +} | 
pages/cart/cart2/zh_calculate.js
| @@ -193,6 +193,11 @@ module.exports = { | @@ -193,6 +193,11 @@ module.exports = { | ||
| 193 | new_g.prom_type = 0; | 193 | new_g.prom_type = 0; | 
| 194 | new_g.prom_id = 0; | 194 | new_g.prom_id = 0; | 
| 195 | goods.push(new_g); | 195 | goods.push(new_g); | 
| 196 | + | ||
| 197 | + //如果商品的数量已经为空了 | ||
| 198 | + if(goods[idx].goods_num<=0){ | ||
| 199 | + goods.splice(idx,1); | ||
| 200 | + } | ||
| 196 | } | 201 | } | 
| 197 | } | 202 | } | 
| 198 | 203 | 
pages/user/order_list/order_list.js
| @@ -1205,7 +1205,7 @@ Page({ | @@ -1205,7 +1205,7 @@ Page({ | ||
| 1205 | b_item.prom_type = 7; | 1205 | b_item.prom_type = 7; | 
| 1206 | b_item.prom_id = res.data.data.id; | 1206 | b_item.prom_id = res.data.data.id; | 
| 1207 | good.prom_type = 7; | 1207 | good.prom_type = 7; | 
| 1208 | - good.prom_id = prom.b_item.prom_id; | 1208 | + good.prom_id = b_item.prom_id; | 
| 1209 | 1209 | ||
| 1210 | } | 1210 | } | 
| 1211 | } | 1211 | } |