|
|
@ -24,12 +24,29 @@ |
|
|
<u-checkbox shape="circle" active-color="#15716E" @change="goodsCheckChange($event, s_index, g_index)" v-model="g_item.checked"></u-checkbox> |
|
|
<u-checkbox shape="circle" active-color="#15716E" @change="goodsCheckChange($event, s_index, g_index)" v-model="g_item.checked"></u-checkbox> |
|
|
</u-checkbox-group> |
|
|
</u-checkbox-group> |
|
|
<view class="lf-m-t-30" style="display: flex;"> |
|
|
<view class="lf-m-t-30" style="display: flex;"> |
|
|
<image class="content-img" :src="g_item.img" mode="widthFix" @click="$url('/pages/shop/goodsdetail?id='+ g_item.com_id)"></image> |
|
|
|
|
|
|
|
|
<image class="content-img" :src="g_item.img" @click="$url('/pages/shop/goodsdetail?id='+ g_item.com_id)"></image> |
|
|
<view class="lf-m-l-15 content-info"> |
|
|
<view class="lf-m-l-15 content-info"> |
|
|
<view class="lf-color-333 lf-font-26 lf-line-2" style="max-width: 480rpx;">{{g_item.name}}</view> |
|
|
|
|
|
<view class="lf-font-24 lf-color-777 lf-m-t-14 lf-row-between"> |
|
|
|
|
|
|
|
|
<view class="lf-color-333 lf-font-26 lf-line-2" style="max-width: 480rpx;"> |
|
|
|
|
|
<text>{{g_item.name}}</text> |
|
|
|
|
|
<text class="lf-m-l-10">{{g_item.color ? g_item.color+' ' : ''}}</text> |
|
|
|
|
|
<text>{{g_item.size ? g_item.size : ''}}</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
<!-- <view class="lf-font-24 lf-color-777 lf-m-t-14"> |
|
|
<view>{{g_item.qty ? g_item.qty+'件;' : ''}}{{g_item.color ? g_item.color+';' : ''}}{{g_item.size ? g_item.size : ''}}</view> |
|
|
<view>{{g_item.qty ? g_item.qty+'件;' : ''}}{{g_item.color ? g_item.color+';' : ''}}{{g_item.size ? g_item.size : ''}}</view> |
|
|
<view class="lf-font-32 lf-color-price">¥{{ g_item.price }}</view> |
|
|
|
|
|
|
|
|
</view> --> |
|
|
|
|
|
<view class="lf-row-between"> |
|
|
|
|
|
<view class="lf-font-32 lf-color-price" style="line-height: 1;">¥{{ g_item.price }}</view> |
|
|
|
|
|
<view class="lf-flex"> |
|
|
|
|
|
<view class="num-btn" @click="changeNum('less', s_index, g_index)"> |
|
|
|
|
|
<text class="lf-iconfont icon-jian1 lf-font-30"></text> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view> |
|
|
|
|
|
<input class="input" :value="g_item.qty" :disabled="true" /> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="num-btn lf-text-right" @click="changeNum('add', s_index, g_index)"> |
|
|
|
|
|
<text class="lf-iconfont icon-jia lf-font-30"></text> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -114,6 +131,40 @@ |
|
|
this.getCartList(); |
|
|
this.getCartList(); |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
// 购物车商品加减 |
|
|
|
|
|
changeNum(type, parentIndex, childIndex){ |
|
|
|
|
|
let goodsItem = this.list[parentIndex].goods[childIndex]; |
|
|
|
|
|
if(type == 'add'){ |
|
|
|
|
|
if(goodsItem.qty < 10){ |
|
|
|
|
|
goodsItem.qty++; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
}else if(type == 'less'){ |
|
|
|
|
|
if(goodsItem.qty > 1){ |
|
|
|
|
|
goodsItem.qty--; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
let __raw_id = goodsItem.__raw_id; |
|
|
|
|
|
this.$http.ajax({ |
|
|
|
|
|
api: 'api/shopping/cart/'+ __raw_id, |
|
|
|
|
|
method: 'PUT', |
|
|
|
|
|
header: { |
|
|
|
|
|
Authorization: this.token |
|
|
|
|
|
}, |
|
|
|
|
|
data: { |
|
|
|
|
|
attributes: { |
|
|
|
|
|
qty: goodsItem.qty |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if(!res.data.status){ |
|
|
|
|
|
this.$msg('购物车更新失败', {icon: 'error'}); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
getCartList(){ |
|
|
getCartList(){ |
|
|
this.$http.get({ |
|
|
this.$http.get({ |
|
|
api: 'api/cart', |
|
|
api: 'api/cart', |
|
|
@ -274,6 +325,9 @@ |
|
|
} |
|
|
} |
|
|
.content-info{ |
|
|
.content-info{ |
|
|
width: 410rpx; |
|
|
width: 410rpx; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
justify-content: space-between; |
|
|
} |
|
|
} |
|
|
.online-card { |
|
|
.online-card { |
|
|
width: 686rpx; |
|
|
width: 686rpx; |
|
|
@ -288,4 +342,14 @@ |
|
|
margin-bottom: 150rpx; |
|
|
margin-bottom: 150rpx; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
.num-btn{ |
|
|
|
|
|
width: 36rpx; |
|
|
|
|
|
} |
|
|
|
|
|
.input{ |
|
|
|
|
|
width: 40rpx; |
|
|
|
|
|
height: 45rpx; |
|
|
|
|
|
border-radius: 2rpx; |
|
|
|
|
|
background-color: #F3F8F7; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |