瀏覽代碼

bug 修复

lilei 4 年之前
父節點
當前提交
dd31e9cd75
共有 4 個文件被更改,包括 56 次插入26 次删除
  1. 2 2
      components/uni-coods/uni-coods.vue
  2. 7 5
      components/uni-numbers-box/uni-numbers-box.vue
  3. 0 1
      pages.json
  4. 47 18
      pages/cart/cart.vue

+ 2 - 2
components/uni-coods/uni-coods.vue

@@ -2,8 +2,8 @@
 	<view class="goods-list">
 		<view class="goods-item" v-for="item in list" :key="item.id">
 			<view class="goods-imgs"  @click="toDetail(item)">
-				<view v-if="item.inventoryQty == 0" class="goods-staus">已售罄</view>
-				<view v-if="item.delFlage == 0 || item.state == 0" class="goods-staus">已失效</view>
+				<view v-if="item.inventoryQty == 0&&item.state == 1" class="goods-staus">已售罄</view>
+				<view v-if="item.state == 0" class="goods-staus">已下架</view>
 				<u-lazy-load 
 				img-mode="scaleToFill" 
 				:height="imgHeight" 

+ 7 - 5
components/uni-numbers-box/uni-numbers-box.vue

@@ -114,19 +114,19 @@
 	};
 </script>
 <style lang="scss" scoped>
-	$box-height: 34px;
+	$box-height: 30px;
 	/* #ifdef APP-NVUE */
-	$box-line-height: 34px;
+	$box-line-height: 30px;
 	/* #endif */
 	$box-line-height: 26px;
-	$box-width: 35px;
+	$box-width: 30px;
 
 	.uni-numbox {
 		/* #ifndef APP-NVUE */
 		display: flex;
 		/* #endif */
 		flex-direction: row;
-		width: 120px;
+		width: 100px;
 	}
 
 	.uni-numbox__value {
@@ -151,6 +151,7 @@
 		font-size: 20px;
 		color: $uni-text-color;
 		background-color: $uni-bg-color-grey;
+		border-radius: $box-width;
 	}
 
 	.uni-numbox__plus {
@@ -164,10 +165,11 @@
 		height: $box-height;
 		line-height: $box-height;
 		background-color: $uni-bg-color-grey;
+		border-radius: $box-width;
 	}
 
 	.uni-numbox--text {
-		font-size: 40rpx;
+		font-size: 36rpx;
 		color: $uni-text-color;
 	}
 

+ 0 - 1
pages.json

@@ -127,7 +127,6 @@
                 "navigationBarTitleText": "购物车",
                 "enablePullDownRefresh": false
             }
-            
         }
 		,{
 		    "path" : "pages/toOrder/index",

+ 47 - 18
pages/cart/cart.vue

@@ -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;
+					}
 				}
 			}
 		}