zhaoxw 4 年 前
コミット
e063be5a5c
4 ファイル変更613 行追加115 行削除
  1. 11 0
      pages.json
  2. 244 115
      pages/cart/cart.vue
  3. 358 0
      pages/user/index.vue
  4. BIN
      static/images/userbackground.png

+ 11 - 0
pages.json

@@ -17,6 +17,12 @@
 			"style": {
 				"navigationStyle": "custom"
 			}
+		},
+		{
+			"path": "pages/user/index",
+			"style": {
+				"navigationStyle": "custom"
+			}
 		}
 	],
 	"subPackages": [],
@@ -46,6 +52,11 @@
 				"iconPath": "static/images/caizhai.png",
 				"selectedIconPath": "static/images/caizhai.png",
 				"text": "购物车"
+			},{
+				"pagePath": "pages/user/index",
+				"iconPath": "static/images/caizhai.png",
+				"selectedIconPath": "static/images/caizhai.png",
+				"text": "个人"
 			}
 		]
 	}

+ 244 - 115
pages/cart/cart.vue

@@ -7,42 +7,40 @@
 			<scroll-view :show-scrollbar="0" show-scrollbar="true" scroll-y="true" class="goods-box">
 				<view class="goods-row" v-for="item in goodsList" @click="">
 					<view class="goods-top">
-						<view class="iconfont iconqueding select" @click=""></view>
+						<view class="iconfont iconqueding select magl5" @click=""></view>
 						<view class="iconfont icondianpu magr5"></view>
 						<view class="seller-label magr5">{{item.sellerName}}</view>
 						<view class="iconfont iconfangxiang magr5"></view>
 					</view>
 					<view class="split-line"></view>
 					<view class="goods-middle">
-					    <view class="iconfont iconqueding select-goods" @click=""></view>
+						<view class="iconfont iconqueding select-goods magl5" @click=""></view>
 						<cover-image class="goods-img" @click="" :src="item.url"></cover-image>
-						<view>
+						<view class="goods-info">
 							<view class="goods-details">{{item.details}}</view>
-							<uni-tag text="类型:普通商品" size="small" type="default"></uni-tag>
-							<view class="goods-spec">
-								<text>{{item.spec}}</text>
+							<view class="goods-type">类型:{{item.goodType}}</view>
+							<!-- <uni-tag text="类型: 普通商品" size="small" type="default"></uni-tag> -->
+							<view class="goods-info-btm">
+								<view class="goods-spec">
+									<text>{{item.spec}}</text>
+								</view>
+								<!-- <uni-number-box :min="1" :value="cartNum"></uni-number-box> -->
+								<view class="pro-num-box">
+									<text class="num-btn r" @click="numSub(index,cIndex)">-</text>
+									<text class="num">{{item.num}}</text>
+									<text class="num-btn l" @click="numAdd(index,cIndex)">+</text>
+								</view>
 							</view>
 						</view>
 					</view>
 					<view class="split-line"></view>
 					<view class="goods-bottom">
-						<text class="magr5">合计</text>
-						<view class="goods-spec magr5">
+						<text class="magr20">合计</text>
+						<view class="goods-spec magr10">
 							<text>{{item.spec}}</text>
 						</view>
 						<view class="settle-btn"><text>结算(3)</text></view>
 					</view>
-					
-					<!-- <cover-image class="goods-img" @click="" :src="item.url"></cover-image>
-					<view class="goods-info">
-						<view class="goods-name">{{item.name}}</view>
-						<view class="goods-details">{{item.details}}</view>
-						<view class="goods-number">
-							<text class="goods-spec">{{item.spec}}</text>
-							<text class="goods-sales">{{item.sales}}人付款</text>
-						</view>
-					</view>
-					<view class="goods-cart"></view> -->
 				</view>
 			</scroll-view>
 		</view>
@@ -51,121 +49,285 @@
 
 <script>
 	import uniTag from "@/components/uni-tag/uni-tag.vue"
+	import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue"
 	export default {
-		components: {'uni-tag': uniTag},
+		components: {
+			'uni-tag': uniTag,
+			'uni-number-box': uniNumberBox
+		},
 		data() {
 			return {
-				goodsList: [
-					{name: '优质白菜', sellerName: '商家1', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10},
-					{name: '优质白菜', sellerName: '商家2', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10},
-					{name: '优质白菜', sellerName: '商家3', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10},
-					{name: '优质白菜', sellerName: '商家4', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10},
-					{name: '优质白菜', sellerName: '商家5', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10},
-					{name: '优质白菜', sellerName: '商家6', details: '优质白菜优质白菜优质白菜', spec: '¥80.00/kg', sales: 10}
+				goodsList: [{
+						name: '优质白菜',
+						sellerName: '商家1',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 2,
+					},
+					{
+						name: '优质白菜',
+						sellerName: '商家2',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 2,
+					},
+					{
+						name: '优质白菜',
+						sellerName: '商家3',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 2,
+					},
+					{
+						name: '优质白菜',
+						sellerName: '商家4',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 2,
+					},
+					{
+						name: '优质白菜',
+						sellerName: '商家5',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 5,
+					},
+					{
+						name: '优质白菜',
+						sellerName: '商家6',
+						goodType: '普通商品',
+						details: '优质白菜优质白菜优质白菜',
+						spec: '¥80.00/kg',
+						sales: 10,
+						num: 3,
+					}
 				],
+				cartNum: 1,
 			}
 		},
-		onLoad(){
-			
+		onLoad() {
+
 		},
 		methods: {
+			// 数量减
+			numSub(index, cIndex) {
+				// if (this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum > 1) {
+				// 	this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum = this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum - 1
+				// 	this.updateCart()
+				// } else {
+				//   uni.showToast({
+				// 	title: '亲!至少一件哦!',
+				// 	icon:"none"
+				//   })
+				// }
+			},
+			// 数量加
+			numAdd(index, cIndex) {
+				// if (this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum <= 100) {
+				//       this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum = this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum + 1
+				//       this.updateCart()
+				//     } else {
+				//       wx.showToast({
+				//         title: '库存不足!',
+				//         icon: 'none'
+				//       })
+				//     }
+			},
 		}
 	}
 </script>
 
 <style lang="less" scoped>
-	page{
+	page {
 		width: 100%;
 		height: 100%;
 	}
-	.magr5{
+
+	.magl5 {
+		margin-left: 5px;
+	}
+
+	.magr5 {
 		margin-right: 5px;
 	}
-	.container{
+
+	.magr10 {
+		margin-right: 10px;
+	}
+
+	.magr20 {
+		margin-right: 20px;
+	}
+
+	.container {
 		width: 100%;
 		height: 100%;
 		background-color: #F3F3F3;
-		.swiper{
-			height: 150px;
+
+		.swiper {
+			height: 120px;
 			background-color: #52A63A;
 			border-radius: 0 0 40px 40px;
-			.swiper-text{
+
+			.swiper-text {
 				color: #FFFFFF;
 				padding-left: 10px;
 				padding-top: 15px;
 			}
 		}
-		.sort-right-box{
-			height: calc(100% - 58px);
-			.goods-box{
+
+		.sort-right-box {
+			position: absolute;
+			top: 50px;
+			height: calc(100% - 50px);
+			width: 100%;
+
+			.goods-box {
 				width: 100%;
-				height: calc(100% - 44px);
-				box-sizing: border-box;
-				.goods-row{
+				height: 100%;
+
+				// box-sizing: border-box;
+				.goods-row {
 					width: calc(100% - 24px);
 					height: 185px;
 					box-sizing: border-box;
 					margin: 4px 0 12px 12px;
 					background: #FFFFFF;
 					border-radius: 15px;
-					.goods-top{
-					    display: flex;
+
+					.goods-top {
+						display: flex;
 						align-items: center;
+
 						.select {
-							color: #52A63A; 
+							color: #52A63A;
 							font-size: 35px;
 						}
 					}
+
 					.select-goods {
 						color: #52A63A;
 						font-size: 35px;
 						float: left;
 						text-align: center;
 					}
-					.split-line{
+
+					.split-line {
 						height: 1px;
 						background: #EEEEEE;
 						margin-top: 5px;
 						margin-bottom: 5px;
 					}
+
 					.goods-middle {
 						display: flex;
+
+						.goods-img {
+							width: 84px;
+							height: 84px;
+						}
+
+						.goods-info {
+							flex: 1;
+							margin-left: 10px;
+
+							.goods-details {
+								height: 28px;
+								font-size: 12px;
+								font-family: PingFang SC;
+								color: #333333;
+								line-height: 14px;
+								overflow: hidden;
+								text-overflow: ellipsis;
+								display: -webkit-box;
+								-webkit-line-clamp: 2;
+								-webkit-box-orient: vertical;
+								word-wrap: break-word;
+								margin-top: 10px;
+							}
+
+							.goods-type {
+								width: 100px;
+								height: 20px;
+								background: #F0F0F0;
+								border-radius: 2px;
+								color: #666666;
+								font-size: 10px;
+								display: flex;
+								align-items: center;
+								justify-content: center;
+							}
+
+							.goods-info-btm {
+								display: flex;
+								justify-content: space-between;
+								align-items: center;
+
+								.pro-num-box {
+									margin-top: 10px;
+									margin-right: 10px;
+									width: 80px;
+									height: 20px;
+									border: 1px solid #ddd;
+									border-radius: 4upx;
+									display: flex;
+									flex-direction: row;
+									justify-content: space-between;
+
+									.num-btn {
+										font-size: 34upx;
+										color: #666;
+										display: inline-block;
+										width: 40upx;
+										text-align: center;
+										line-height: 32upx;
+									}
+
+									.num-btn.r {
+										border-right: 1px solid #ddd;
+									}
+
+									.num-btn.l {
+										border-left: 1px solid #ddd;
+									}
+
+									.num {
+										font-size: 26upx;
+										color: #333;
+									}
+								}
+							}
+
+							.goods-spec {
+								height: 16px;
+								font-family: PingFang SC;
+								line-height: 16px;
+								font-size: 14px;
+								color: #52A63A;
+								margin-top: 10px;
+							}
+						}
 					}
-					.goods-img{
-						width: 84px;
-						height: 84px;
-					}
-					.goods-details{
-						height: 28px;
-						font-size: 12px;
-						font-family: PingFang SC;
-						color: #999999;
-						line-height: 14px;
-						overflow: hidden;
-						text-overflow: ellipsis;
-						display: -webkit-box;
-						-webkit-line-clamp: 2;
-						-webkit-box-orient: vertical;
-						word-wrap: break-word;
-						margin-top: 10px;
-					}
-					.goods-spec{
-						height: 16px;
-						font-family: PingFang SC;
-						line-height: 16px;
-						font-size: 15px;
-						color: #52A63A;
-						margin-top: 10px;
-					}
-					.goods-bottom{
-						position: relative;
-						left: 130px;
-						margin-top: 10px;
-						margin-bottom: 10px;
+
+					.goods-bottom {
+						position: absolute;
+						right: 20px;
 						display: flex;
 						align-items: baseline;
+						font-size: 14px;
 					}
-					.settle-btn{
+
+					.settle-btn {
 						color: #FFFFFF;
 						background: #52A63A;
 						border-radius: 40px;
@@ -175,46 +337,13 @@
 						align-items: center;
 						justify-content: center;
 					}
-					.goods-number{
-						height: 16px;
-						font-family: PingFang SC;
-						line-height: 16px;
-						.goods-icon{
-							font-size: 12px;
-							color: #52A63A;
-						}
-						.goods-spec{
-							font-size: 15px;
-							color: #52A63A;
-							margin-right: 15px;
-						}
-						.goods-sales{
-							font-size: 12px;					
-							color: #999999;
-						}
-					}
-					.goods-info{
-						width: calc(100% - 104px);
-						height: 84px;
-						float: left;
-						.goods-name{
-							height: 18px;
-							font-size: 15px;
-							font-family: PingFang SC;
-							color: #333333;
-							line-height: 18px;
-							white-space: nowrap;
-							text-overflow: ellipsis;
-							overflow: hidden;
-						}
-					}
-					.goods-cart{
-						width: 20px;
-						height: 84px;
-						float: left;
-					}
 				}
 			}
 		}
 	}
+
+	// /deep/ .uni-numbox {
+	// 	width: 80px;
+	// 	height: 20px;
+	// }
 </style>

+ 358 - 0
pages/user/index.vue

@@ -0,0 +1,358 @@
+<template>
+	<view class="content">
+		<cover-image class="top-bg" src="@/static/images/userbackground.png"></cover-image>
+		<view class="page-content">
+			<view class="user-info-box" @click="gologin" v-if="JSON.stringify(item) =='{}' ">
+				<image class="user-image" src="" mode="widthFix"></image>
+				<view class="user-info">
+					<view class="user-logoin-title">点击登录</view>
+					<view class="user-logoin-lable">登录后享受更多权益~</view>
+				</view>
+			</view>
+			<view class="user-info-box" v-else @click="goinfo">
+				<image class="user-image" v-if="infoitem.headimg" :src="infoitem.headimg" mode="widthFix" style="border-radius: 50%;"></image>
+				<image class="user-image" v-else src="" mode="widthFix"></image>
+				<view class="user-info">
+					<view class="user-logoin-title" v-if="infoitem.nickname">{{infoitem.nickname}}</view>
+					<view class="user-logoin-title" v-else>{{infoitem.phone}}</view>
+					
+				</view>
+				<image class="user-info-right" src="" mode=""></image>
+			</view>
+			<view class="user-activity">
+				<view class="mr10">
+					<view class="font18">50</view>
+					<view class="font10">共享种植</view>
+				</view>
+				<view class="mr10">|</view>
+				<view class="mr10">
+					<view class="font18">150</view>
+					<view class="font10">我的积分</view>
+				</view>
+				<view class="mr10">|</view>
+				<view>
+					<view class="font18">45</view>
+					<view class="font10">我的优惠券</view>
+				</view>
+			</view>
+			<view class="order-box">
+				<view class="order-item" @click="orderTap(1)">
+					<view class="iconfont icondaifukuan order-item-icon"></view>
+					<view class="order-item-text">待付款</view>
+				</view>
+				<view class="order-item" @click="orderTap(2)">
+					<view class="iconfont icondaifahuo order-item-icon"></view>
+					<view class="order-item-text">待发货</view>
+				</view>
+				<view class="order-item" @click="orderTap(3)">
+					<view class="iconfont icondaishouhuo order-item-icon"></view>
+					<view class="order-item-text">待收货</view>
+				</view>
+				<image class="order-line" src="" mode="widthFix"></image>
+				<view class="order-item" @click="orderTap(0)">
+					<view class="iconfont icondaipingjia order-item-icon"></view>
+					<view class="order-item-text">待评价</view>
+				</view>
+			</view>
+			<!-- <view class="item-btn mt20" @click="gouserEvaluate">
+				<view class="iconfont icondizhiguanli item-btn-icon"></view>
+				<view class="item-btn-text">我的评价</view>
+				<view class="iconfont iconfangxiang"></view>
+			</view>
+			<view class="item-btn mt20" @click="couponClick">
+				<view class="iconfont icondizhiguanli item-btn-icon"></view>
+				<view class="item-btn-text">我的卡券</view>
+				<view class="iconfont iconfangxiang"></view>
+			</view> -->
+			<view class="item-btn mt20" @click="addressClick">
+				<view class="iconfont icondizhiguanli item-btn-icon"></view>
+				<view class="item-btn-text">收货地址</view>
+				<view class="iconfont iconfangxiang"></view>
+			</view>
+			<view class="line-box">
+				<view class="split-line"></view>
+			</view>
+			<view class="item-btn" @click="addressClick">
+				<view class="iconfont icondizhiguanli item-btn-icon"></view>
+				<view class="item-btn-text">关于我们</view>
+				<view class="iconfont iconfangxiang"></view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import userbackground from '../../static/images/userbackground.png'
+	// const NET = require('../../../utils/request')
+	// const API = require('../../../config/api')
+	export default {
+		data() {
+			return {
+				userbackground,
+				item:{},
+				infoitem:{},
+			}
+		},
+		onShow() {
+			// if(uni.getStorageSync('storage_key')){
+			// 	this.item = uni.getStorageSync('storage_key');
+			// }
+			// this.getInfo()
+		},
+		methods: {
+			// 获取会员信息
+			getInfo() {
+				NET.request(API.Info, {
+					token: this.item.token,
+				}, 'GET').then(res => {
+					this.infoitem = res.data
+					// console.log('个人信息',res)
+				}).catch(res => {
+					
+				})
+			},
+			// 个人信息  登录页面
+			gologin(){
+				uni.navigateTo({
+					url:'/pagesUser/userModule/login'
+				})
+			},
+			goinfo(){
+				uni.navigateTo({
+					url:'/pagesUser/userModule/personalDetails?infoitem=' + JSON.stringify(this.infoitem)
+				})
+			},
+			// 我的评论
+			gouserEvaluate(){
+				if(JSON.stringify(this.item) == '{}'){
+					uni.navigateTo({
+						url:'/pagesUser/userModule/login'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pagesGoods/goodsModule/userEvaluate'
+					})
+				}
+				
+			},
+			// 分销中心
+			godistribution(){
+				if(JSON.stringify(this.item) == '{}'){
+					uni.navigateTo({
+						url:'/pagesUser/userModule/login'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pagesDistribution/distributionModule/index'
+					})
+				}
+				
+			},
+			//我的优惠券
+			couponClick(){
+				uni.navigateTo({
+					url:'/pagesUser/userModule/coupon'
+				})
+			},
+			// 地址管理
+			addressClick(){
+				if(JSON.stringify(this.item) == '{}'){
+					uni.navigateTo({
+						url:'/pagesUser/userModule/login'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pagesUser/userModule/address'
+					})
+				}
+				
+			},
+			// 我的售后
+			goafterSale(){
+				if(JSON.stringify(this.item) == '{}'){
+					uni.navigateTo({
+						url:'/pagesUser/userModule/login'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pagesOrder/orderModule/afterSale'
+					})
+				}
+				
+			},
+			//判断是否是分销员
+			getApplyState(){
+				NET.request(API.HasApply,{
+					tenantCode:this.currentId
+				},'POST').then(res => {
+					uni.hideLoading()
+					this.slist = res.data
+				}).catch(res => {
+					uni.hideLoading()
+				})
+			},
+			orderTap(type){
+				if(JSON.stringify(this.item) == '{}'){
+					uni.navigateTo({
+						url:'/pagesUser/userModule/login'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pagesOrder/orderModule/index?type='+type
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang='scss'>
+	page {
+		width: 100%;
+		height: 100%;
+	}
+	.content {
+		width: 100%;
+		height: 100%;
+		background-color: #F3F3F3;
+		/* background-color: #f8f8f8; */
+		.top-bg{
+			width: 100%;
+			height: 175px;
+		}
+		.page-content{
+			width: 100%;
+			height: 100%;
+			display: flex;
+			flex-direction: column;
+			z-index: 10;
+			margin-top: -185px;
+			.user-info-box{
+				width: 100%;
+				box-sizing: border-box;
+				padding: 30upx;
+				display: flex;
+				flex-direction: row;
+				align-items: center;
+				.user-image{
+					width: 130upx;
+					height: 130upx;
+				}
+				.user-info{
+					flex: 1;
+					display: flex;
+					flex-direction: column;
+					padding-left: 20upx;
+					box-sizing: border-box;
+					z-index: 10;
+					.user-logoin-title{
+						font-size:36upx;
+						font-weight:500;
+						color:rgba(255,255,255,1);
+					}
+					.user-logoin-lable{
+						font-size:24upx;
+						font-weight:400;
+						color:rgba(255,255,255,1);
+						margin-top: 20upx;
+					}
+				}
+				.user-info-right{
+					width: 30upx;
+					height: 30upx;
+				}
+			}
+			.user-activity {
+				display: flex;
+				text-align: center;
+				align-items: center;
+				justify-content: center;
+				padding: 15px;
+				color: #FFFFFF;
+			}
+			.order-box{
+				width:690upx;
+				height:170upx;
+				background:rgba(255,255,255,1);
+				box-shadow:0px 0px 10upx 0px rgba(51,51,51,0.1);
+				border-radius:10upx;
+				display: flex;
+				flex-direction: row;
+				align-items: center;
+				margin-left: 30upx;
+				z-index: 10;
+				.order-line{
+					width: 12upx;
+					height: 106upx;
+				}
+				.order-item{
+					flex: 1;
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+					justify-content: center;
+					.order-item-icon{
+						color:#52A63A;
+						font-size: 30px;
+					}
+					.order-item-text{
+						font-size:28upx;
+						margin-top: 10upx;
+						font-weight:500;
+					}
+				}
+			}
+			.item-btn{
+				width: 100%;
+				height: 100upx;
+				display: flex;
+				flex-direction: row;
+				align-items: center;
+				box-sizing: border-box;
+				background-color: #fff;
+				padding: 0 30upx;
+				.item-btn-icon{
+					color:#52A63A;
+					font-size: 20px;
+					/* width: 48upx;
+					height: 48upx; */
+				}
+				.item-btn-text{
+					font-size:28upx;
+					margin-left: 20upx;
+					font-weight:500;
+					flex: 1;
+					color:rgba(102,102,102,1);
+				}
+				
+			}
+			.line-box{
+				height: 5px;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				background: #FFFFFF;
+				.split-line {
+					width: 100%;
+					height: 1px;
+					background: #EEEEEE;
+				}
+			}
+			.mt20{
+				margin-top: 20upx;
+			}
+			.mt1{
+				margin-top: 1upx;
+			}
+			.mr10{
+				margin-right: 10px;
+			}
+			.font18{
+				font-size: 18px;
+			}
+			.font10{
+				font-size: 10px;
+			}
+		}
+	}
+</style>

BIN
static/images/userbackground.png