浏览代码

购物车

mym 1 年之前
父节点
当前提交
2ac6ceea31
共有 6 个文件被更改,包括 321 次插入129 次删除
  1. 2 1
      pages.json
  2. 46 10
      pages/goodsDetails/goodsDetails.vue
  3. 1 0
      pages/login/login.vue
  4. 123 5
      pages/oneMarket/cart/cart.vue
  5. 32 69
      pages/oneMarket/oneMarket.vue
  6. 117 44
      pages/oneMarket/order/order.vue

+ 2 - 1
pages.json

@@ -81,7 +81,8 @@
 			"path": "pages/goodsDetails/goodsDetails",
 			"style": {
 				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": false,
+				"navigationStyle": "custom"
 			}
 
 		}, {

+ 46 - 10
pages/goodsDetails/goodsDetails.vue

@@ -1,7 +1,17 @@
 <template>
 	<view>
-		<navigation-bar background-color="#fff" front-color="#000000" />
-		<u-image width="100%" height="400rpx" :src="goods.goodsImg"></u-image>
+		<!-- <navigation-bar background-color="#fff" front-color="#000000" /> -->
+		<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-item>
+		</swiper>
+		<!-- <u-image width="100%" height="800rpx" :src="goods.goodsImg"></u-image> -->
+		<!-- <u-image width="100%" height="400rpx" src="../../static/news.jpg"></u-image> -->
 		<view class="title pad">
 			{{goods.goodsName}}
 		</view>
@@ -58,7 +68,9 @@
 			getGoodsDetails() {
 				this.http.request({
 					url: '/level-one-server/TbGoodsTransit/getById',
-					data: {id: this.id},
+					data: {
+						id: this.id
+					},
 					success: res => {
 						this.goods = res.data.data;
 						if (this.goods) {
@@ -96,9 +108,11 @@
 					contentType: 'application/json; charset=utf-8',
 					method: 'POST',
 					success: res => {
-						setTimeout(function (){
-							uni.showToast({title: res.data.data.msg});
-						},1000)
+						setTimeout(function() {
+							uni.showToast({
+								title: res.data.msg
+							});
+						}, 1000)
 					}
 				});
 			},
@@ -106,15 +120,22 @@
 			buy() {
 				this.http.request({
 					url: '/level-one-server/app/TbGoodsTransit/purchaseLevelOntGoodsTransit',
-					data: { goodsTransitId: this.goods.id },
+					data: {
+						goodsTransitId: this.goods.id
+					},
 					method: 'POST',
 					contentType: 'application/json; charset=utf-8',
 					success: res => {
-						setTimeout(function (){
-							uni.showToast({title: res.data.data.msg});
-						},1000)
+						setTimeout(function() {
+							uni.showToast({
+								title: res.data.msg
+							});
+						}, 1000)
 					}
 				});
+			},
+			back() {
+				uni.navigateBack({delta: 1})
 			}
 		}
 	}
@@ -125,6 +146,21 @@
 		padding: 0;
 	}
 
+	.back {
+		position: absolute;
+		top: 10rpx;
+		left: 10rpx;
+		width: 80rpx;
+		height: 80rpx;
+		border-radius: 40rpx;
+		background-color: #828282;
+		display: flex;
+		opacity: 0.4;
+		z-index: 1;
+		align-items: center;
+		justify-content: center;
+	}
+
 	.pad {
 		width: 100%;
 		padding: 10rpx;

+ 1 - 0
pages/login/login.vue

@@ -56,6 +56,7 @@ export default {
 				method: 'POST',
 				success: resp => {
 					let data = resp.data.data;
+					console.log(data)
 					uni.setStorageSync('token', data.tokenInfo.tokenValue);
 					uni.setStorageSync('info', data.appUser);
 					uni.setStorageSync('menu', data.per_list);

+ 123 - 5
pages/oneMarket/cart/cart.vue

@@ -1,6 +1,51 @@
 <template>
 	<view>
-		hhhhhhhhhhhhhhhhhhh
+		<navigation-bar title="购物车" background-color="#0081ff" front-color="#ffffff" :left-button="null" />
+		<u-tabs lineWidth="50" :list="list" itemStyle="height:90rpx;width: 100rpx;" :is-scroll="false"
+			:current="current" @change="change"></u-tabs>
+		<u-list style="margin-top: 10rpx;padding: 15rpx;" @scrolltolower="scrolltolower">
+			<u-list-item v-for="(item, index) in cartList" :key="index">
+				<view class="item-box">
+					<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;">[老板力荐]鲜活小龙虾(帮剪头去虾线)约250g/份</view> -->
+								<view class="subtit">
+									<view class="price">¥{{item.totalPrice}}</view>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view class="goods-item">
+						<view class="footer-item">
+							<view style="margin: 15rpx 0rpx;"><button size="mini"
+									:plain="true">立即购买</button></view>
+						</view>
+					</view>
+				</view>
+			</u-list-item>
+		</u-list>
 	</view>
 </template>
 
@@ -8,15 +53,88 @@
 	export default {
 		data() {
 			return {
-				
+				cartList: [],
 			}
 		},
+		onLoad() {
+			this.getCartList()
+		},
 		methods: {
-			
+			getCartList() {
+				this.http.request({
+					url: '/level-one-server/TbGoodsCart/getList',
+					success: res => {
+						this.cartList = res.data.data;
+					}
+				});
+			}
 		}
 	}
 </script>
 
-<style>
+<style lang="scss">
+	.goods-item {
+		margin-bottom: 15rpx;
+	}
+
+	.good-row {
+		display: flex;
+		align-items: center;
+	}
 
-</style>
+	.shop {
+		display: flex;
+		align-items: center;
+		width: 480rpx;
+	}
+
+	.shop-icon {
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		background-color: #eaf1fe;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+
+	.status {
+		width: 200rpx;
+		display: flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
+
+	.des {
+		margin-left: 20rpx;
+		position: relative;
+		top: 1rpx;
+		height: 200rpx;
+	}
+
+	.subtit {
+		font-size: 28rpx;
+		color: #9C9C9C;
+		margin: 20rpx 10rpx;
+	}
+
+	.footer-item {
+		display: flex;
+		justify-content: flex-end;
+		margin-top: -15rpx;
+		margin-bottom: 5rpx;
+	}
+
+	.price {
+		font-size: 30rpx;
+	}
+
+	.item-box {
+		height: 370rpx;
+		width: 85%;
+		padding: 30rpx;
+		border: 1rpx #888 solid;
+		margin: 10rpx 15rpx;
+		border-radius: 10rpx;
+	}
+</style>

+ 32 - 69
pages/oneMarket/oneMarket.vue

@@ -1,17 +1,16 @@
 <template>
 	<view>
-		<!-- 		<image src="../../static/images/top-bg.png"></image> -->
-		<!-- <navigation-bar :title="title" background-color="#fff" front-color="#000000" :left-button="null" /> -->
-		<uni-nav-bar color="#fff" height="60" left-icon="back" @clickLeft="back()" @clickRight="rightClick()"
+	<!-- 			<image src="../../static/images/role/bm.png"></image> -->
+		<uni-nav-bar color="#fff" height="60" :fixed="true" left-icon="back" @clickLeft="back()" @clickRight="rightClick()"
 			right-icon="list" :border="false" backgroundColor="#0081ff" title="一级市场" />
 		</u-navbar>
-		<u-list v-if="active==1" class="list" width="100%" @scrolltolower="scrolltolower">
+		<u-list class="list" width="100%" @scrolltolower="scrolltolower">
 			<u-list-item v-for="(item, index) in goods" :key="index">
 				<view class="item-box">
 					<view class="goods-item">
 						<u-row>
 							<u-col span="5" @click="toDetails(item.id)">
-								<u--image :showLoading="true" src="" width="270rpx" height="220rpx"></u--image>
+								<u--image radius="10" :showLoading="true" src="" width="250rpx" height="220rpx"></u--image>
 							</u-col>
 							<u-col span="7">
 								<view class="t1 txt" @click="toDetails(item.id)">
@@ -27,7 +26,7 @@
 								<view class="t4">
 									<view class="price">¥{{item.price}}</view>
 									<view class="car" @click="addCar(item)">
-										<u-icon color="#fff" name="shopping-cart-fill" size="30"></u-icon>
+										<uni-icons type="cart" color="#fff" size="30"></uni-icons>
 									</view>
 								</view>
 							</u-col>
@@ -43,28 +42,12 @@
 					<view class="rows">
 						<view class="row omit" v-for="(item, index) in typeList" :key="index">
 							<view class="out">
-								<view class="int" :style="{color:index==5?'#0081FF':'#213227'}">{{item.name}}</view>
+								<view class="int" @click="typeClick(item)" :style="{color: item.check?'#0081FF':'#213227'}">{{item.name}}</view>
 							</view>
 						</view>
 						<view class="clear"></view>
 					</view>
 				</view>
-				<view class="item">
-					<view class="title">生鲜海鲜</view>
-					<view class="rows">
-						<view class="row omit" v-for="(item, index) in typeList" :key="index">
-							<view class="out">
-								<view class="int" :active="{active:true}">{{item.name}}</view>
-							</view>
-						</view>
-						<view class="clear"></view>
-					</view>
-				</view>
-				<!-- 	 			<view class="u-page__tag-item" style="display: flex; align-items: center;"
-					v-for="(item, index) in typeList" :key="index">
-					<u-tag class="tag" :text="item.name" :plain="!item.checked" :name="item.no" @click="checkboxClick">
-					</u-tag>
-				</view> -->
 				<u-button class="custom-style" shape="circle" type="primary" size="small" text="确定"
 					@click="close()"></u-button>
 			</view>
@@ -86,10 +69,11 @@
 			return {
 				loadmoreStatus: 'loadmore',
 				goods: [],
-				active: '',
+				active: 0,
 				title: '一级市场',
 				show: false,
 				typeList: [],
+				typeCheck: [],
 			}
 		},
 		onLoad() {
@@ -105,13 +89,13 @@
 					url: '/level-one-server/TbGoodsTransit/getTransitList',
 					success: res => {
 						this.goods = res.data.data;
-						this.goods.forEach((item, index) => {
-							if (index === this.goods.length - 1) {
-								this.loadmoreStatus = 'nomore'
-							} else {
-								this.loadmoreStatus = 'loadmore'
-							}
-						})
+						// this.goods.forEach((item, index) => {
+						// 	if (index === this.goods.length - 1) {
+						// 		this.loadmoreStatus = 'nomore'
+						// 	} else {
+						// 		this.loadmoreStatus = 'loadmore'
+						// 	}
+						// })
 					}
 				});
 			},
@@ -128,7 +112,6 @@
 					goodsName: goods.goodsName,
 					// buyNum: parseInt(this.num)
 				}
-				console.log(goods)
 				this.http.request({
 					url: '/level-one-server/app/TbGoodsCart/addGoodsInShopCart',
 					data: params,
@@ -137,7 +120,7 @@
 					success: res => {
 						setTimeout(function() {
 							uni.showToast({
-								title: res.data.data.msg
+								title: res.data.msg
 							});
 						}, 1000)
 					}
@@ -149,7 +132,9 @@
 					url: '/level-one-server/TbGoodsType/getList',
 					success: res => {
 						this.typeList = res.data.data
-						console.log(this.typeList)
+						this.typeList.map(item => {
+							item.check=false
+						})
 					}
 				});
 			},
@@ -159,20 +144,6 @@
 			toDetails(id) {
 				this.$common.to('/pages/goodsDetails/goodsDetails?id=' + id)
 			},
-			// change(index) {
-			// 	console.log(index)
-			// 	this.active = index
-			// },
-			// tabClick(id) {
-			// 	this.active = id
-			// 	if (id == 1) {
-			// 		this.title = '一级市场'
-			// 	} else if (id == 2) {
-			// 		this.title = '购物车'
-			// 	} else {
-			// 		this.title = '订单列表'
-			// 	}
-			// },
 			back() {
 				uni.switchTab({
 					url: '/pages/index/index'
@@ -186,8 +157,10 @@
 				// console.log('open');
 			},
 			close() {
+				this.typeList.map(item => {
+					if(item.check) this.typeCheck.push(item)
+				})
 				this.show = false
-				// console.log('close');
 			},
 			BtnClick(type) {
 				type == 1 ? uni.navigateTo({
@@ -196,10 +169,11 @@
 					url: '/pages/oneMarket/order/order'
 				})
 			},
-			checkboxClick(name) {
-				this.typeList.map((item, index) => {
-					if (item.no == name) item.checked = true
+			typeClick(data) {
+				this.typeList.map(item => {
+					if(item.no == data.no) item.check=!item.check
 				})
+				this.$forceUpdate();
 			}
 		}
 	}
@@ -251,7 +225,7 @@
 	.list {
 		height: auto;
 		border-radius: 10rpx;
-		margin: 15rpx;
+		margin: 10rpx 20rpx 10rpx 20rpx;
 	}
 
 	.goods-item {
@@ -260,8 +234,8 @@
 
 	.item-box {
 		height: 230rpx;
-		width: 90%;
-		padding: 20rpx;
+		width: 86%;
+		padding: 30rpx;
 		background-color: #fff;
 		border: 1rpx #FFF solid;
 		margin: 10rpx 0rpx;
@@ -297,9 +271,9 @@
 
 	.car {
 		background-color: #0081ff;
-		width: 60rpx;
-		height: 60rpx;
-		border-radius: 30rpx;
+		width: 80rpx;
+		height: 70rpx;
+		border-radius: 40rpx;
 		text-align: center;
 		display: flex;
 		align-items: center;
@@ -337,17 +311,6 @@
 		width: 300rpx;
 	}
 
-	.tag {
-		margin-bottom: 30rpx;
-		display: flex;
-		align-items: center;
-		/* 	width: 300rpx;
-		height: 50rpx;
-		background-color: #f3f4f6;
-		border-radius: 10rpx;
-		text-align: center; */
-	}
-
 	/* .active-btn {
 		width: 35%;
 		height: 100%;

+ 117 - 44
pages/oneMarket/order/order.vue

@@ -1,50 +1,70 @@
 <template>
 	<view>
-		<u-tabs lineWidth="50" :list="list" itemStyle="height:60rpx;width: 100rpx;" :is-scroll="false" :current="current"
-			@change="change"></u-tabs>
+		<navigation-bar title="订单列表" background-color="#0081ff" front-color="#ffffff" :left-button="null" />
+		<u-tabs lineWidth="50" :list="list" itemStyle="height:90rpx;width: 100rpx;" :is-scroll="false"
+			:current="current" @change="change"></u-tabs>
 		<u-list style="margin-top: 10rpx;padding: 15rpx;" @scrolltolower="scrolltolower">
 			<u-list-item v-for="(item, index) in orderList" :key="index">
 				<view class="item-box">
 					<view class="goods-item">
-						<u-row>
-							<u-col span="10">
-								{{item.shopName}}
-							</u-col>
-							<u-col span="2" v-if="item.finishStatus">
-								已完成
-							</u-col>
-							<u-col span="2" v-else-if="item.resaleStatus">
-								转售中
-							</u-col>
-							<u-col span="2" v-else>
-								待确认
-							</u-col>
-						</u-row>
+						<view class="good-row">
+							<view>
+								<view class="shop">
+									<!-- background-color: #eaf1fe; -->
+									<view class="shop-icon">
+										<uni-icons type="shop" color="#0081ff" size="26"></uni-icons>
+									</view>
+
+									<text style="font-size: 35rpx; margin-left: 8rpx;">{{item.shopName}}</text>
+								</view>
+							</view>
+							<view class="status" v-if="item.finishStatus">
+								<text style="color: #D3D3D3;">已完成</text>
+							</view>
+							<view class="status" v-else-if="item.resaleStatus">
+								<text style="color: #0e87ff;">组员确认中</text>
+							</view>
+							<view class="status" v-else-if="item.resaleStatus">
+								<text style="color: #0e87ff;">进境确认中</text>
+							</view>
+							<view class="status" v-else-if="item.resaleStatus">
+								<text style="color: #0e87ff;">进境申报中</text>
+							</view>
+							<view class="status" v-else-if="item.resaleStatus">
+								<text style="color: #00FF7F;">已进口</text>
+							</view>
+							<view class="status" v-else>
+								<text style="color: #ff660d;">商家未确认</text>
+							</view>
+						</view>
 					</view>
 					<view class="goods-item">
-						<u-row>
-							<u-col span="4">
-								<u--image :showLoading="true" :src="src" width="230rpx" height="210rpx"></u--image>
-							</u-col>
-							<u-col span="5">
-								<u--text lines="1" size="18" :text="item.goodsNames"></u--text>
-								<u--text prefixIcon="map" style="margin-top: 40rpx;" lineHeight="70" iconStyle="font-size: 20px"  lines="1" :text="item.tradeAreaName"></u--text>
-							</u-col>
-							<u-col span="3">
-								<u--text color="#FF4500" align="center" lineHeight="50" size="20" lines="1" :text="`¥${item.totalPrice}`"></u--text>
-								<u--text lines="1" align="center" :text="`${item.totalWeight}吨`"></u--text>
-							</u-col>
-						</u-row>
+						<view class="good-row">
+							<view>
+								<u--image radius="10" :showLoading="true" src="" width="250rpx"
+									height="210rpx"></u--image>
+							</view>
+							<view class="des">
+								<view style="font-size: 34rpx; height: 100rpx;">{{item.goodsNames}}</view>
+								<!-- <view style="font-size: 34rpx;">[老板力荐]鲜活小龙虾(帮剪头去虾线)约250g/份</view> -->
+								<view class="subtit">
+									<text style="margin-right: 20rpx;">{{item.totalWeight}}吨</text>
+									<text>{{item.tradeAreaName}}</text>
+								</view>
+								<view class="subtit">
+									{{item.tradeTime}}
+									<!-- 2023-08-03 16:41 -->
+								</view>
+							</view>
+						</view>
 					</view>
 					<view class="goods-item">
-						<u-row>
-							<u-col span="9">
-								{{item.tradeTime}}
-							</u-col>
-							<u-col span="3">
-								<u-button type="error" size="mini" text="通知商家"></u-button>
-							</u-col>
-						</u-row>
+						<view class="footer-item">
+							<view class="price">¥{{item.totalPrice}}</view>
+						</view>
+						<view class="footer-item">
+							<view style="margin: 15rpx 0rpx;"><button type="error" size="mini" :plain="true">查看详情</button></view>
+						</view>
 					</view>
 				</view>
 			</u-list-item>
@@ -97,16 +117,69 @@
 	// page{
 	// 	padding: 15rpx;
 	// }
-	
-	.goods-item{
-		margin-bottom: 8rpx;
+
+	.goods-item {
+		margin-bottom: 15rpx;
+	}
+
+	.good-row {
+		display: flex;
+		align-items: center;
+	}
+
+	.shop {
+		display: flex;
+		align-items: center;
+		width: 480rpx;
+	}
+
+	.shop-icon {
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		background-color: #eaf1fe;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+
+	.status {
+		width: 200rpx;
+		display: flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
+
+	.des {
+		margin-left: 20rpx;
+		position: relative;
+		top: 1rpx;
+		height: 200rpx;
+	}
+
+	.subtit {
+		font-size: 28rpx;
+		color: #9C9C9C;
+		margin: 10rpx;
+	}
+
+	.footer-item {
+		display: flex;
+		justify-content: flex-end;
+		margin-top: -15rpx;
+		margin-bottom: 5rpx;
 	}
 	
-	.item-box{
-		height: 300rpx;
-		padding: 10rpx;
+	.price{
+		font-size: 30rpx;
+	}
+
+	.item-box {
+		height: 370rpx;
+		width: 85%;
+		padding: 30rpx;
 		border: 1rpx #888 solid;
-		margin: 10rpx 0rpx;
+		margin: 10rpx 15rpx;
 		border-radius: 10rpx;
 	}
 </style>