mym 1 年之前
父节点
当前提交
6728b31802
共有 4 个文件被更改,包括 59 次插入45 次删除
  1. 1 1
      common/http.js
  2. 23 24
      pages/goodsDetails/goodsDetails.vue
  3. 32 20
      pages/oneMarket/cart/cart.vue
  4. 3 0
      pages/oneMarket/order/order.vue

+ 1 - 1
common/http.js

@@ -1,4 +1,4 @@
-const ip = 'http://192.168.88.34:8080'; //线下
+const ip = 'http://192.168.88.12:8080'; //线下
 //const ip = 'http://114.118.9.159:8080/prod-api'; //线上
 /**
  * 封装的http请求

+ 23 - 24
pages/goodsDetails/goodsDetails.vue

@@ -4,10 +4,9 @@
 		<view class="back" @click="back">
 			<uni-icons type="back" color="#000000" size="30"></uni-icons>
 		</view>
-		<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
-			:duration="duration">
-			<swiper-item>
-				<image width="100%" src="../../static/news.jpg"></image>
+		<swiper style="width: 100%; height: 700rpx;" circular :indicator-dots="true" :autoplay="true">
+			<swiper-item style="width: 100%;">
+				<image style="width: 100%; height: 100%;" mode="aspectFill" src="../../static/news.jpg"></image>
 			</swiper-item>
 		</swiper>
 		<!-- <u-image width="100%" height="800rpx" :src="goods.goodsImg"></u-image> -->
@@ -32,6 +31,11 @@
 			<u--text :text="goods.description? goods.description : '卖家很懒,什么都没有留下'" size="24"></u--text>
 		</view>
 		<view class="footer">
+			<view class="cart">
+				<uni-icons color="#ef732a" type="cart" size="30"></uni-icons>
+				<text>购物车</text>
+				<!-- <u-icon label="购物车" size="40" color="#ef732a" labelColor="#ef732a" name="shopping-cart"></u-icon> -->
+			</view>
 			<u-button class="custom-style" type="warning" @click="addCar()">加入购物车</u-button>
 			<u-button class="custom-style" type="error" @click="buy()">提交订单</u-button>
 		</view>
@@ -135,7 +139,9 @@
 				});
 			},
 			back() {
-				uni.navigateBack({delta: 1})
+				uni.navigateBack({
+					delta: 1
+				})
 			}
 		}
 	}
@@ -144,6 +150,7 @@
 <style lang="scss">
 	page {
 		padding: 0;
+		background-color: #f3f4f6;
 	}
 
 	.back {
@@ -155,7 +162,7 @@
 		border-radius: 40rpx;
 		background-color: #828282;
 		display: flex;
-		opacity: 0.4;
+		opacity: 0.7;
 		z-index: 1;
 		align-items: center;
 		justify-content: center;
@@ -176,9 +183,14 @@
 		font-size: 40rpx;
 	}
 
-	// .flex-box {
-
-	// }
+	.cart {
+		width: 30%;
+		color: #ef732a;
+		font-size: 40rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
 
 	.tag {
 		width: auto;
@@ -186,7 +198,7 @@
 	}
 
 	.custom-style {
-		width: 50%;
+		width: 30%;
 		height: 100rpx;
 		font-size: 30rpx;
 	}
@@ -196,21 +208,8 @@
 		margin-bottom: 10rpx;
 	}
 
-	.num {
-		width: 100%;
-		padding: 10rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		font-size: 40rpx;
-	}
-
-	.numBtn {
-		width: 20%;
-		margin: 20rpx;
-	}
-
 	.footer {
+		padding: 20rpx;
 		width: 100%;
 		display: flex;
 		position: absolute;

+ 32 - 20
pages/oneMarket/cart/cart.vue

@@ -9,31 +9,23 @@
 					<view class="goods-item">
 						<view class="good-row">
 							<view>
-								<view class="shop">
-									<view class="shop-icon">
-										<uni-icons type="shop" color="#0081ff" size="26"></uni-icons>
-									</view>
-
-									<text style="font-size: 35rpx; margin-left: 8rpx;">{{item.goodsName}}</text>
-								</view>
-							</view>
-							<view class="status">
-								<uni-icons type="trash" color="red" size="30"></uni-icons>
-							</view>
-						</view>
-					</view>
-					<view class="goods-item">
-						<view class="good-row">
-							<view>
 								<u--image radius="10" :showLoading="true" :src="item.goodsImg" width="250rpx"
 									height="210rpx"></u--image>
 							</view>
 							<view class="des">
-								<view style="font-size: 34rpx; height: 100rpx;">{{item.goodsName}}</view>
+								<view style="font-size: 34rpx; height: 100rpx; display: flex;">
+									<view style="width: 300rpx;">
+										{{item.goodsName}}
+									</view>
+									<view class="status" @click="cleanCart(item.id)">
+										<uni-icons type="trash" color="grey" size="30"></uni-icons>
+									</view>
+								</view>
 								<!-- <view style="font-size: 34rpx;">[老板力荐]鲜活小龙虾(帮剪头去虾线)约250g/份</view> -->
 								<view class="subtit">
 									<view class="price">¥{{item.totalPrice}}</view>
 								</view>
+								
 							</view>
 						</view>
 					</view>
@@ -67,6 +59,26 @@
 						this.cartList = res.data.data;
 					}
 				});
+			},
+			scrolltolower() {
+				this.getCartList()
+			},
+			// 
+			cleanCart(id) {
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsCart/cleanCart',
+					data: {id: 1460500735619366940},
+					contentType: 'application/json; charset=utf-8',
+					method: 'POST',
+					success: res => {
+						setTimeout(function() {
+							uni.showToast({
+								title: res.data.msg
+							});
+						}, 1000)
+					}
+				});
+				console.log( id + "类型"+ typeof id)
 			}
 		}
 	}
@@ -99,10 +111,10 @@
 	}
 
 	.status {
-		width: 200rpx;
+		width: 100rpx;
 		display: flex;
 		align-items: center;
-		justify-content: flex-end;
+		// justify-content: flex-end;
 	}
 
 	.des {
@@ -130,7 +142,7 @@
 	}
 
 	.item-box {
-		height: 370rpx;
+		height: 280rpx;
 		width: 85%;
 		padding: 30rpx;
 		border: 1rpx #888 solid;

+ 3 - 0
pages/oneMarket/order/order.vue

@@ -108,6 +108,9 @@
 						this.orderList = res.data.data;
 					}
 				});
+			},
+			scrolltolower() {
+				this.getCartList()
 			}
 		}
 	}