浏览代码

登录页面

mym 2 年之前
父节点
当前提交
fbdf2aeea3

+ 4 - 0
apis/api.js

@@ -50,4 +50,8 @@ export default {
 	getGoodsDetails(data) {
 		return ajax.get('/level-one-server/TbGoodsTransit/getById', data)
 	},
+	// 添加购物车
+	addCar(data) {
+		return ajax.postJson('/level-one-server/app/TbGoodsCart/addGoodsInShopCart',data)
+	} 
 }

+ 7 - 0
pages.json

@@ -23,6 +23,13 @@
 				"enablePullDownRefresh": false
 			}
 
+		},{
+			"path": "pages/login/userAgreement",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
 		}, {
 			"path": "pages/index/index",
 			"style": {

+ 78 - 6
pages/goodsDetails/goodsDetails.vue

@@ -1,23 +1,48 @@
 <template>
 	<view>
 		<navigation-bar background-color="#fff" front-color="#000000" />
-		<u-image width="100%" height="300rpx" :src="goods.goodsImg"></u-image>
-		<view class="title">
+		<u-image width="100%" height="400rpx" :src="goods.goodsImg"></u-image>
+		<view class="title pad">
 			{{goods.goodsName}}
 		</view>
+		<view class="price pad">
+			¥{{goods.price}} {{goods.goodsUnits}}
+		</view>
+		<view class="pad">
+			<u-tag class="tag" v-for="(item,index) in type" :key="index" :text="item" type="warning" plain></u-tag>
+		</view>
+		<view class="pad">
+			<u--text prefixIcon="home" iconStyle="font-size: 50rpx" :text="goods.merchantName" size="26"></u--text>
+		</view>
+		<view class="pad">
+			<u--text prefixIcon="map" iconStyle="font-size: 50rpx" :text="goods.tradeAreaName" size="26"></u--text>
+		</view>
+		<view class="pad des">
+			<u--text text="商品描述:" size="24"></u--text>
+			<u--text :text="goods.description? goods.description : '卖家很懒,什么都没有留下'" size="24"></u--text>
+		</view>
 		<view class="footer">
-			<u-button class="custom-style" type="warning">加入购物车</u-button>
+			<u-button class="custom-style" type="warning" @click="addCar()">加入购物车</u-button>
 			<u-button class="custom-style" type="error">立即购买</u-button>
 		</view>
+		<u-popup :show="show" @close="close" @open="open">
+			<view>
+				<text>出淤泥而不染,濯清涟而不妖</text>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
+	import common from '../../common/js/common'
 	export default {
 		data() {
 			return {
 				id: '',
-				goods: {}
+				goods: {},
+				type: [],
+				show: false,
+				num: 1
 			}
 		},
 		onLoad(option) {
@@ -31,6 +56,28 @@
 				}
 				this.$api.getGoodsDetails(params).then(res => {
 					this.goods = res.data
+					if (this.goods) {
+						this.type = this.goods.goodsType.toString().split("、")
+					}
+				})
+			},
+			addCar() {
+				this.show = true
+				let user = uni.getStorageInfoSync("info")
+				let params = {
+					buyUserId: user.id,
+					enterpriseId: this.goods.merchantId,
+					shopId: shopId,
+					tradeAreaId: this.goods.tradeAreaId,
+					saleGoodsInfoId: this.goods.id,
+					buyUserType: user.userType,
+					buyType: 2,
+					goodsImg: this.goods.goodsImg,
+					goodsName: this.goods.goodsName,
+					buyNum: num
+				}
+				this.$api.addCar(this.goods).then(res => {
+					console.log(res)
 				})
 			}
 		}
@@ -42,18 +89,43 @@
 		padding: 0;
 	}
 
+	.pad {
+		width: 100%;
+		padding: 10rpx;
+		display: flex;
+	}
+
 	.title {
-		margin: 10rpx;
+		font-size: 42rpx;
+	}
+
+	.price {
+		color: red;
 		font-size: 40rpx;
 	}
 
+	// .flex-box {
+
+	// }
+
+	.tag {
+		width: auto;
+		margin-right: 10rpx;
+	}
+
 	.custom-style {
-		width: 400rpx;
+		width: 50%;
 		height: 100rpx;
 		font-size: 30rpx;
 	}
 
+	.des {
+		border-top: 1rpx #888 solid;
+		margin-bottom: 10rpx;
+	}
+
 	.footer {
+		width: 100%;
 		display: flex;
 		position: absolute;
 		bottom: 1rpx;

+ 4 - 1
pages/index/index.vue

@@ -89,7 +89,7 @@
 			this.getBannerList();
 			this.getNewsList();
 			this.getRoleMenu();
-			this.getMenu();
+			//this.getMenu();
 		},
 		methods: {
 			getBannerList() {
@@ -107,7 +107,9 @@
 							}
 						})
 					})
+							this.getMenu();
 				})
+		
 			},
 			getMenu() {
 				this.$api.getMenu().then(res => {
@@ -117,6 +119,7 @@
 								this.menuList.push(item1)
 							}
 						})
+						this.$forceUpdate()
 					})
 				})
 			},

+ 7 - 7
pages/login/chooseRole.vue

@@ -9,7 +9,7 @@
 				</u-button>
 			</u-list-item>
 		</u-list>
-		<!-- <u-button type="error" shape="circle" text="下一步" @click="next()"></u-button> -->
+		<u-button type="error" shape="circle" text="下一步" @click="next()"></u-button>
 	</view>
 </template>
 
@@ -26,9 +26,9 @@
 		},
 		methods: {
 			choose(data) {
-				for (let i = 1; i <= this.roles.length; i++) {
+				for (let i = 0; i <= this.roles.length; i++) {
 					if (this.roles[i].roleName == data.roleName) {
-						this.current = i;
+						this.current = i+1;
 					}
 				}
 				this.isNext = true
@@ -38,12 +38,12 @@
 					console.log(res)
 					this.roles = res.data
 				})
-				this.$common.to('/pages/login/register?type='+data.id);
 			},
 			next(){
-				uni.navigateTo({
-					url:"/pages/login/register?type="+this.current
-				})
+				// uni.navigateTo({
+				// 	url:"/pages/login/register?type="+this.current
+				// })
+				this.$common.to('/pages/login/register?type='+this.current);
 			}
 		}
 	}

+ 11 - 3
pages/login/login.vue

@@ -21,8 +21,8 @@
 			<view class="btn">
 				<view style="margin-bottom: 20rpx;font-size: 28rpx;">
 					<u-checkbox-group v-model="value" :wrap="true">
-						<u-checkbox name="1"></u-checkbox>登录同意<text class="blue-class">《用户协议》</text>和<text
-							class="blue-class">《隐私政策》</text>
+						<u-checkbox name="1"></u-checkbox>登录同意<text class="blue-class" @click="getAgreement(1)">《用户协议》</text>和<text
+							class="blue-class" @click="getAgreement(2)">《隐私政策》</text>
 					</u-checkbox-group>
 				</view>
 				<view>
@@ -40,7 +40,6 @@
 	export default {
 		data() {
 			return {
-				sliderVerifyFLag: false, //滑块验证
 				form: {
 					phone: '',
 					password: ''
@@ -99,6 +98,15 @@
 			},
 			toRegister() {
 				this.$common.to('/pages/login/chooseRole')
+			},
+			getAgreement(id) {
+				// let params = {
+				// 	id: this.id
+				// }
+				// this.$api.getAgreement(params).then(res => {
+				// 	console.log(res)
+				// })
+				this.$common.to('/pages/login/userAgreement?id='+id)
 			}
 		}
 	}

+ 0 - 1
pages/oneMarket/oneMarket.vue

@@ -58,7 +58,6 @@
 			// 	}
 			// }
 			toDetails(id) {
-				console.log(11)
 				this.$common.to('/pages/goodsDetails/goodsDetails?id='+id)
 			}
 		}

+ 7 - 2
pages/personal/personal.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		
+		<u-button type="primary" text="退出登录" @click="exitLogin()"></u-button>
 	</view>
 </template>
 
@@ -12,7 +12,12 @@
 			}
 		},
 		methods: {
-			
+			exitLogin() {
+				uni.removeStorageSync("token")
+				uni.removeStorageSync("info")
+				uni.removeStorageSync("menu")
+				this.$common.to('/pages/login/login')
+			}
 		}
 	}
 </script>