|
@@ -42,8 +42,9 @@
|
|
|
</view>
|
|
|
<view class="goods-info">
|
|
|
<view class="goods-imgs">
|
|
|
- <view v-if="good.goods.inventoryQty==0||good.goods.state == 0||good.goods.delFlage == 0" class="goods-staus">
|
|
|
- <text>已失效</text>
|
|
|
+ <view v-if="good.goods.inventoryQty==0||good.goods.state == 0" class="goods-staus">
|
|
|
+ <text v-if="good.goods.state == 0">已下架</text>
|
|
|
+ <text v-if="good.goods.state == 1&&good.goods.inventoryQty==0">已售罄</text>
|
|
|
</view>
|
|
|
<u-image border-radius="12" width="158rpx" height="140rpx" :src="good.goods.homeImage+'?x-oss-process=image/resize,m_pad,h_140,w_158,color_ffffff'"></u-image>
|
|
|
</view>
|
|
@@ -64,6 +65,11 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <!-- 小计 -->
|
|
|
+ <view class="goods-class-heji">
|
|
|
+ <view>合计:<text>{{item.total}}</text></view>
|
|
|
+ <image mode="scaleToFill" style="width: 30rpx;height: 30rpx;"src="/static/ledou.png"></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="noData" v-if="!loading&&cartList.length==0">
|
|
@@ -86,7 +92,8 @@
|
|
|
</view>
|
|
|
<view v-if="!isEdit">
|
|
|
<view class="heji">
|
|
|
- <view>总计:<text>{{totalPrice}}</text></view>
|
|
|
+ <view>总计:</view>
|
|
|
+ <text>{{totalPrice}}</text>
|
|
|
<u-image mode="scaleToFill" width="35rpx" height="35rpx" src="/static/ledou.png"></u-image>
|
|
|
</view>
|
|
|
<u-button size="mini" :custom-style="toOrderButton" type="error" @click="toOrder">立即下单</u-button>
|
|
@@ -97,7 +104,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
export default {
|
|
|
data() {
|
|
@@ -115,6 +121,9 @@
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ userData(){
|
|
|
+ return this.$store.state.vuex_userData
|
|
|
+ },
|
|
|
// 总数
|
|
|
count() {
|
|
|
let arr = this.cartList
|
|
@@ -137,15 +146,21 @@
|
|
|
let arr = this.cartList
|
|
|
let total = 0
|
|
|
arr.map(item=>{
|
|
|
+ let xj = 0
|
|
|
item.shoppingCartGoodsList.map(a =>{
|
|
|
if(a.checked){
|
|
|
total = total + a.buyQty * a.goods.sellGold
|
|
|
+ xj = xj + a.buyQty * a.goods.sellGold
|
|
|
}
|
|
|
})
|
|
|
+ item.total = xj
|
|
|
})
|
|
|
return total
|
|
|
},
|
|
|
},
|
|
|
+ onUnload() {
|
|
|
+ uni.$off('getCarListSuccess')
|
|
|
+ },
|
|
|
onLoad() {
|
|
|
this.loading = true
|
|
|
uni.$emit('getCartList')
|
|
@@ -159,8 +174,6 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onShow() {
|
|
|
- },
|
|
|
methods: {
|
|
|
toBuy(){
|
|
|
uni.switchTab({
|
|
@@ -277,15 +290,21 @@
|
|
|
// 立即下单
|
|
|
toOrder(){
|
|
|
let goods = this.getCheckGoods(1)
|
|
|
- console.log(goods)
|
|
|
- if(goods.length){
|
|
|
- this.$u.vuex("vuex_toOrderList",goods)
|
|
|
- uni.redirectTo({
|
|
|
- url:"/pages/toOrder/index"
|
|
|
- })
|
|
|
+ if(this.userData.currentGold >= this.totalPrice){
|
|
|
+ if(goods.length){
|
|
|
+ this.$u.vuex("vuex_toOrderList",goods)
|
|
|
+ uni.redirectTo({
|
|
|
+ url:"/pages/toOrder/index"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title:"请选择商品",
|
|
|
+ icon:"none"
|
|
|
+ })
|
|
|
+ }
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
- title:"请选择商品",
|
|
|
+ title:"你的乐豆余额不足",
|
|
|
icon:"none"
|
|
|
})
|
|
|
}
|
|
@@ -461,6 +480,16 @@ page{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .goods-class-heji{
|
|
|
+ padding: 20upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ font-size: 24rpx;
|
|
|
+ text{
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
.cart-submit{
|
|
|
padding: 20upx;
|
|
@@ -478,17 +507,17 @@ page{
|
|
|
}
|
|
|
&:last-child{
|
|
|
font-size: 26upx;
|
|
|
- text{
|
|
|
- color: red;
|
|
|
- font-size: 40upx;
|
|
|
- }
|
|
|
> view{
|
|
|
- padding-right: 50upx;
|
|
|
+ padding-right: 30upx;
|
|
|
}
|
|
|
.heji{
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
font-weight: bold;
|
|
|
+ text{
|
|
|
+ color: red;
|
|
|
+ font-size: 40upx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|