yuwenjun 4 лет назад
Родитель
Сommit
9dbb96732f

+ 76 - 73
components/cm-module/listTemplate/productList.vue

@@ -14,20 +14,21 @@
 			@search="searchValHandle"
 			@input="searchValChange"
 			@clear="searchValClear"
+			@blur="searchValBlur"
 		></fuzzy-search>
 		<!-- 内容区域 -->
 		<scroll-view
 			class="product-container"
 			@scrolltolower="scrolltolower"
 			scroll-y
-			v-if="!isShowEmpty || productList.length > 0"
+			v-if="!isShowEmpty && productList.length > 0"
 		>
 			<view
 				v-for="(item, index) in productList"
 				:key="index"
 				:id="item.id"
 				class="all-type-list-content commodity-list goods-item"
-				@click.stop="navToDetailPage(item.productID)"
+				@click.stop="navToDetailPage(item.productId)"
 			>
 				<image
 					mode="widthFix"
@@ -36,18 +37,36 @@
 					alt="list-img"
 				></image>
 				<view class="list-details-info">
-					<text class="list-details-title">{{ item.name }}</text>
+					<text class="list-details-title">{{ item.productName }}</text>
 					<!-- 商品标签 -->
 					<!-- <view class="list-details-tags">
 							<tui-tag type="red" class="tag" padding="6rpx" size="20rpx" plain>商品标签</tui-tag>
 							<tui-tag type="red" class="tag" padding="6rpx" size="20rpx" plain>商品标签</tui-tag>
 						</view> -->
+					<!-- 活动标签 -->
+					<view class="list-details-price">
+						<view class="floor-item-act" v-if="item.actStatus == 1">
+							<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+								{{ item.promotions.name
+								}}<text v-if="item.price1TextFlag != 1"
+									>:¥{{ item.retailPrice | NumFormat }}</text
+								>
+							</view>
+							<view class="floor-tags" v-else>{{ item.promotions.name }}</view>
+						</view>
+						<view
+							class="floor-item-act"
+							v-if="item.actStatus == 0 && item.ladderPriceFlag == 1"
+						>
+							<view class="floor-tags">阶梯价格</view>
+						</view>
+					</view>
 					<text class="list-details-specs"
 						>规格:{{ item.unit != null ? item.unit : '' }}</text
 					>
-					<text class="list-details-specs"
+					<!-- <text class="list-details-specs"
 						>商品编码:{{ item.productCode != null ? item.productCode : '' }}</text
-					>
+					> -->
 					<!-- <text class="list-details-miniQuantity">起订量:{{ item.ladderPriceFlag == '1' ? item.maxBuyNumber : item.minBuyNumber}}</text> -->
 					<!-- 价格 -->
 					<view class="list-details-price">
@@ -76,24 +95,6 @@
 							购买
 						</button>
 					</view>
-					<!-- 活动标签 -->
-					<view class="list-details-price" v-if="item.actStatus == 1">
-						<view class="floor-item-act">
-							<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-								{{ item.promotions.name
-								}}<text v-if="item.price1TextFlag != 1"
-									>:¥{{ item.retailPrice | NumFormat }}</text
-								>
-							</view>
-							<view class="floor-tags" v-else>{{ item.promotions.name }}</view>
-						</view>
-						<view
-							class="floor-item-act"
-							v-if="item.actStatus == 0 && item.ladderPriceFlag == 1"
-						>
-							<view class="floor-tags">阶梯价格</view>
-						</view>
-					</view>
 				</view>
 			</view>
 			<!--加载loadding-->
@@ -153,7 +154,6 @@ export default {
 			// 是否显示骨架
 			showSkeleton: false,
 			isShowEmpty: false,
-			userID: '',
 			scrollHeight: '',
 			productList: [],
 			loadingNow: false,
@@ -164,15 +164,16 @@ export default {
 			cartQuantity: 0,
 			showRegularBtn: true,
 			isPrecedence: false,
-			searchVal: '' //搜索框
+			searchVal: '', //搜索框
+			organizeId: '',
+			userId: ''
 		}
 	},
-	created() {
-		// 从缓存中获取机构id
-		this.$api.getComStorage('clubInfo').then(e => {
-			this.userID = e.userId
-			this.getGoodsList()
-		})
+	async created() {
+		const userInfo = uni.getStorageSync('userInfo')
+		this.organizeId = userInfo.organizeId
+		this.productList = await this.getGoodsList()
+		this.getCartQuantity()
 	},
 	filters: {
 		NumFormat: function(text) {
@@ -185,54 +186,67 @@ export default {
 	},
 	methods: {
 		// 获取购物车商品数量
-		getCartQuantity(){
-			this.cartQuantity = 100
+		getCartQuantity() {
+			const clubInfo = uni.getStorageSync('clubInfo')
+			this.userId = clubInfo.userId
+			this.SellerService.CartQuantity({ userId: this.userId }).then(res => {
+				console.log(res)
+				this.cartQuantity = res.data
+			})
 		},
 		// 模糊框单击事件
 		fuzzyClickHandle(e) {
 			console.log(e)
 		},
 		// 绑定数据
-		searchValChange(val){
+		searchValChange(val) {
 			this.searchVal = val
 		},
+		searchValBlur() {
+			this.searchKeyWords()
+		},
+		// 关键字搜索
+		async searchKeyWords() {
+			this.pageNum = 1
+			this.productList = await this.getGoodsList()
+		},
 		// 搜索按钮点击事件
-		searchValHandle(val){
+		async searchValHandle(val) {
 			// 如果输入框内容为空
-			if(val.trim().length<=0){
+			if (val.trim().length <= 0) {
 				this.searchVal = ''
 				return
 			}
-			console.log(this.searchVal)
-			this.searchVal = val
-			// 查询数据 => 刷新列表
-			this.getGoodsList(true)
+			this.searchKeyWords()
 		},
-		searchValClear(){
+		async searchValClear() {
 			this.searchVal = ''
+			this.searchKeyWords()
 		},
 		// 上拉加载更多
-		scrolltolower() {
-			if (this.hasNextPage && this.pullFlag) {
+		async scrolltolower() {
+			if (!this.hasNextPage) {
+				// 没有更多了
+				this.loadingNow = false
+				return
+			}
+			if (this.pullFlag) {
+				this.loadingNow = true
+				// 页码加1
 				this.pageNum += 1
+				const addGoods = await this.getGoodsList()
+				this.productList = [...this.productList, ...addGoods]
 				this.pullFlag = false
-				this.loadingNow = true
-				this.getGoodsList(true)
-				// 下拉刷新间隔为2s
 				setTimeout(() => {
 					this.pullFlag = true
-				}, 2000)
+				}, 1500)
 			}
 		},
 		// 获取商品列表
-		async getGoodsList(flag = false) {
-			// 如果是刷新列表或按名称查找,页码定位到第一页
-			if (!flag) {
-				this.pageNum = 1
-			}
+		async getGoodsList() {
 			// 参数
 			const params = {
-				organizeId: this.userID,
+				organizeId: this.organizeId,
 				pageNum: this.pageNum,
 				pageSize: this.pageSize,
 				productName: this.searchVal
@@ -250,21 +264,10 @@ export default {
 				})
 				return
 			}
-			// 如果商品列表为空
-			if (result.total <= 0) {
-				this.isShowEmpty = true
-			}
-			// 是否加载更多 true 加载更多 false 刷新列表
-			if (flag) {
-				this.productList = [...this.productList, ...result.list]
-			} else {
-				this.productList = result.list
-			}
-			this.pageNum = result.pageNum
-			this.pageSize = result.pageSize
+			// 是否还有下一页
 			this.hasNextPage = result.hasNextPage
-			// 改变加载状态
-			this.loadingNow = false
+			// 返回数据
+			return result.list
 		},
 		operationHanld(prop) {
 			this.$emit('operationConfim', prop)
@@ -301,7 +304,7 @@ export default {
 			return false
 		},
 		btnClick() {
-			this.$api.navigateTo('/pages/goods/cart')
+			this.$api.navigateTo('/pages/user/cart/cart')
 		},
 		btnTouchstart() {
 			// console.log('btnTouchstart');
@@ -315,10 +318,6 @@ export default {
 
 <style lang="scss">
 .commodity-list-wrapper {
-	scroll-view {
-		height: 100%;
-		border-top: 2rpx solid rgba(0, 0, 0, 0.07);
-	}
 	.empty-container-image {
 		margin-top: -300rpx;
 	}
@@ -360,6 +359,7 @@ export default {
 	font-size: 26rpx;
 	position: relative;
 	.list-details-title {
+		height: 76rpx;
 		line-height: 38rpx;
 		text-overflow: ellipsis;
 		overflow: hidden;
@@ -383,6 +383,8 @@ export default {
 .list-details-price {
 	width: 100%;
 	line-height: 54rpx;
+	margin-top: 10rpx;
+	height: 54rpx;
 	float: left;
 	.floor-item-act {
 		height: 54rpx;
@@ -399,7 +401,7 @@ export default {
 			display: inline-block;
 			padding: 0 16rpx;
 			font-size: $font-size-20;
-			margin-left: 15rpx;
+			margin-right: 15rpx;
 			border: 1px solid #e15616;
 		}
 	}
@@ -496,6 +498,7 @@ export default {
 .product-container {
 	width: 100%;
 	height: 100vh;
+	overflow: hidden;
 	padding-top: 100rpx;
 	box-sizing: border-box;
 }

+ 2 - 1
components/cm-module/search/fuzzySearch.vue

@@ -53,6 +53,7 @@ export default {
 		// 文本框失去焦点
 		inputBlurHandle() {
 			this.showMask = false
+			this.$emit('blur')
 		},
 		// 文本框输入事件
 		onInputHandle() {
@@ -133,7 +134,7 @@ export default {
 			color: #eee;
 		}
 		input {
-			width: 90%;
+			width: 480rpx;
 			font-size: 26rpx;
 		}
 	}

+ 8 - 15
pages/authorization/authorization.vue

@@ -59,6 +59,8 @@ export default {
 			//微信授权
 			if (e.detail.userInfo) {
 				this.checkedUser()
+				// 授权成功后保存微信用户信息
+				this.$store.commit('wxLogin',e.detail.userInfo)
 			} else {
 				this.$util.msg('授权失败', 2000)
 			}
@@ -70,25 +72,16 @@ export default {
 		async checkedUser() {
 			const wechatCode = await authorize.getCode('weixin')
 			// 用户是否填写了邀请码
-			const res = await this.UserService.userInfoLogin({ code: wechatCode }).catch((error)=>{
-				console.log('登录失败')
+			this.UserService.userInfoLogin({ code: wechatCode }).then(res=>{
+				console.log('授权登录成功')
 				uni.reLaunch({
 					url: '/pages/index/index'
 				})
-			})
-			if (res.code !== 0) {
-				return uni.showToast({
-					title: '账号未注册',
-					success() {
-						uni.reLaunch({
-							url: '/pages/login/login'
-						})
-					}
+			}).catch((error)=>{
+				console.log('游客登录')
+				uni.reLaunch({
+					url: '/pages/login/login'
 				})
-			}
-			console.log('授权登录成功')
-			uni.reLaunch({
-				url: '/pages/index/index'
 			})
 		}
 	}

+ 6 - 5
pages/goods/list.vue

@@ -45,7 +45,7 @@
 		},
 		data(){
 			return{
-				userID: '',
+				userId: '',
 				serverUrl: '',
 				emptyText: '',
 				lastPageType: '',
@@ -62,7 +62,8 @@
 			}
 		},
 		onLoad() {
-			
+			const clubInfo = uni.getStorageSync('clubInfo')
+			this.userId = clubInfo.userId
 		},
 		methods:{
 			//显示选择数量确认弹窗
@@ -97,7 +98,7 @@
 				if(this.number<=this.minBuyNumber){
 					this.number= this.minBuyNumber
 					this.isQuantity =true
-					this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
+					this.$util.msg(`该商品起订量为${this.minBuyNumber}`,2000);
 					return
 				}else{
 					if(this.buyRetailPriceStep == 2){
@@ -114,7 +115,7 @@
 				if(!this.$api.isNumber(_value)){
 					this.number = this.minBuyNumber
 				}else if(_value < this.minBuyNumber){	
-					this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
+					this.$util.msg(`该商品起订量为${this.minBuyNumber}`,2000);
 					this.number = this.minBuyNumber
 				}else if( _value % this.minBuyNumber !=0 ){
 					this.$util.msg(`购买量必须为起订量的整数倍`,2000);
@@ -150,7 +151,7 @@
 			},
 			//增加购物车成功和toast弹窗提示成功
 			getAddProductCart(){
-				this.ProductService.shoppingAddCart({productID:this.handleData.productID,userID:this.userID,productCount:this.number}).then(response => {
+				this.ProductService.shoppingAddCart({productId:this.handleData.productId,userId:this.userId,productCount:this.number}).then(response => {
 					this.specClass = 'hide';
 					this.$util.msg(response.msg,1500,true,'success')
 					setTimeout(() => {this.specClass = 'none'}, 200)

+ 162 - 42
pages/goods/product.vue

@@ -3,10 +3,18 @@
 		<view class="product-topnav" v-if="isNavbarFiexd" :class="navbarFiexd">
 			<!-- 导航栏 -->
 			<view class="navbar">
-				<view class="nav-item tui-skeleton-fillet" :class="{ current: tabCurrentIndex === 0 }" @click="tabClick(0)">
+				<view
+					class="nav-item tui-skeleton-fillet"
+					:class="{ current: tabCurrentIndex === 0 }"
+					@click="tabClick(0)"
+				>
 					<text>商品</text> <text class="line"></text>
 				</view>
-				<view class="nav-item tui-skeleton-fillet" :class="{ current: tabCurrentIndex === 1 }" @click="tabClick(1)">
+				<view
+					class="nav-item tui-skeleton-fillet"
+					:class="{ current: tabCurrentIndex === 1 }"
+					@click="tabClick(1)"
+				>
 					<text>详情</text> <text class="line"></text>
 				</view>
 				<view
@@ -19,13 +27,24 @@
 				</view>
 			</view>
 		</view>
-		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading="true" :loadingType="5"></tui-skeleton>
+		<tui-skeleton
+			v-if="skeletonShow"
+			backgroundColor="#fafafa"
+			borderRadius="10rpx"
+			:isLoading="true"
+			:loadingType="5"
+		></tui-skeleton>
 		<template v-else>
 			<!-- 如果商品下架 -->
 			<view class="cart-content empty" v-if="isInvalid">
 				<view class="empty-container">
-					<image class="empty-container-image" :src="productNoneImage" mode="aspectFit"></image>
-					<text class="error-text">商品已失效,去商城逛逛别的吧~</text> <view class="login-btn" @click="goIndex">去商城</view>
+					<image
+						class="empty-container-image"
+						:src="productNoneImage"
+						mode="aspectFit"
+					></image>
+					<text class="error-text">商品已失效,去商城逛逛别的吧~</text>
+					<view class="login-btn" @click="goIndex">去商城</view>
 				</view>
 			</view>
 			<view class="container-product tui-skeleton" v-else>
@@ -34,14 +53,39 @@
 					<view class="product-top">
 						<!-- 轮播图 -->
 						<view class="banner-section">
-							<uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode">
-								<swiper class="banner tui-banner tui-skeleton-rect" @change="swiperChange" :duration="800" :autoplay="false" :circular="true">
-									<swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
-										<image :src="item" @click="previewImg(index)" class="product-img" />
+							<uni-swiper-dot
+								:info="productImage"
+								:current="current"
+								field="content"
+								:mode="mode"
+							>
+								<swiper
+									class="banner tui-banner tui-skeleton-rect"
+									@change="swiperChange"
+									:duration="800"
+									:autoplay="false"
+									:circular="true"
+								>
+									<swiper-item
+										v-for="(item, index) in productImage"
+										:key="index"
+										class="banner-item"
+									>
+										<image
+											:src="item"
+											@click="previewImg(index)"
+											class="product-img"
+										/>
 									</swiper-item>
 								</swiper>
 								<view class="swiper__dots-box">
-									<tui-tag padding="12rpx 24rpx" type="translucent" shape="circleLeft" size="32rpx" :scaleMultiple="0.82" originRight
+									<tui-tag
+										padding="12rpx 24rpx"
+										type="translucent"
+										shape="circleLeft"
+										size="32rpx"
+										:scaleMultiple="0.82"
+										originRight
 										>{{ current + 1 }}/{{ productImage.length }}</tui-tag
 									>
 								</view>
@@ -62,29 +106,57 @@
 								</view>
 								<view class="p-title tui-skeleton-fillet">
 									<!-- 美博会 -->
-									<view class="mclap-tag" v-if="product.beautyActFlag == '1'">美博会</view>
-									<view class="p-title-name" :class="product.beautyActFlag == '1' ? 'indent' : ''">
+									<view class="mclap-tag" v-if="product.beautyActFlag == '1'"
+										>美博会</view
+									>
+									<view
+										class="p-title-name"
+										:class="product.beautyActFlag == '1' ? 'indent' : ''"
+									>
 										{{ product.name == undefined ? '' : product.name }}
 									</view>
 									<!-- 分享 -->
-									<button open-type="share" class="p-title-share tui-share-position" @tap="onShare">
-										<view class=""><text class="iconfont icon-fenxiang"></text></view> <view class="">分享</view>
+									<button
+										open-type="share"
+										class="p-title-share tui-share-position"
+										@tap="onShare"
+									>
+										<view class=""
+											><text class="iconfont icon-fenxiang"></text
+										></view>
+										<view class="">分享</view>
 									</button>
 								</view>
 							</view>
 							<!-- 产品标签 -->
 							<view class="wrap-label" v-if="product.tagsList.length > 0">
-								<view class="label-a tui-skeleton-fillet" v-for="(label, index) in product.tagsList" :key="index">{{ label }}</view>
+								<view
+									class="label-a tui-skeleton-fillet"
+									v-for="(label, index) in product.tagsList"
+									:key="index"
+									>{{ label }}</view
+								>
 							</view>
 							<!-- 承诺 -->
 							<view class="product-seve">
 								<text class="label">采美承诺:</text>
-								<text class="iconfont icon-dui tui-skeleton-rect"><text class="text">无忧退货</text></text>
-								<text class="iconfont icon-dui tui-skeleton-rect"><text class="text">快速退款</text></text>
-								<text class="iconfont icon-dui tui-skeleton-rect"><text class="text">正品保证</text></text>
+								<text class="iconfont icon-dui tui-skeleton-rect"
+									><text class="text">无忧退货</text></text
+								>
+								<text class="iconfont icon-dui tui-skeleton-rect"
+									><text class="text">快速退款</text></text
+								>
+								<text class="iconfont icon-dui tui-skeleton-rect"
+									><text class="text">正品保证</text></text
+								>
 							</view>
 							<!-- 备注信息 -->
-							<view class="productRemarks" v-if="product.productRemarks != '' && product.productRemarks != null">
+							<view
+								class="productRemarks"
+								v-if="
+									product.productRemarks != '' && product.productRemarks != null
+								"
+							>
 								备注:{{ product.productRemarks }}
 							</view>
 						</view>
@@ -92,11 +164,19 @@
 					<view class="product-details product-details0">
 						<view class="product-item-none" v-if="goodsData.isNoneDisabled">
 							<image class="none-image" :src="productNoneImage" mode=""></image>
-							<view class="none-text">此商品已{{ goodsData.disabledText }},请浏览以下推荐商品~</view>
+							<view class="none-text"
+								>此商品已{{ goodsData.disabledText }},请浏览以下推荐商品~</view
+							>
 						</view>
 						<!-- 选择商品参数按钮 -->
-						<view class="product-parameter" @click="showPopup" v-if="!goodsData.isNoneDisabled">
-							<text class="title">参数:</text> <text class="name">品牌 起订量 分类...</text> <text class="iconfont icon-chakangengduo"></text>
+						<view
+							class="product-parameter"
+							@click="showPopup"
+							v-if="!goodsData.isNoneDisabled"
+						>
+							<text class="title">参数:</text>
+							<text class="name">品牌 起订量 分类...</text>
+							<text class="iconfont icon-chakangengduo"></text>
 						</view>
 					</view>
 				</view>
@@ -105,7 +185,11 @@
 					<!-- 商品详情 -->
 					<view class="title"> <view class="title-tab">商品详情</view> </view>
 					<view class="content tui-banner product-rich-text tui-skeleton-rect">
-						<parser :html="html" :img-mode="widthFix" v-if="!goodsData.isNoneDisabled"></parser>
+						<parser
+							:html="html"
+							:img-mode="widthFix"
+							v-if="!goodsData.isNoneDisabled"
+						></parser>
 						<view class="product-rich-text-none" v-else>暂无商品信息</view>
 					</view>
 				</view>
@@ -113,7 +197,10 @@
 				<view class="product-details service product-details2">
 					<!-- 服务项目 -->
 					<view class="title"> <view class="title-tab">服务项目</view> </view>
-					<view class="content service" v-if="product.productDetail.orderInfo || product.productDetail.serviceInfo">
+					<view
+						class="content service"
+						v-if="product.productDetail.orderInfo || product.productDetail.serviceInfo"
+					>
 						<cm-service :product="product.productDetail" v-if="isRequest"></cm-service>
 					</view>
 					<view class="content-none" v-else> <text>暂无服务项目</text> </view>
@@ -125,32 +212,51 @@
 						<div class="tui-popup-main">
 							<scroll-view class="tui-popup-scroll" scroll-y="true">
 								<view class="content-tr">
-									<view class="content-td">起订量</view> <view class="content-th">{{ product.minBuyNumber }}</view>
+									<view class="content-td">起订量</view>
+									<view class="content-th">{{ product.minBuyNumber }}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">品牌</view>
-									<view class="content-th">{{ product.brandName == null ? '其他' : product.brandName }}</view>
+									<view class="content-th">{{
+										product.brandName == null ? '其他' : product.brandName
+									}}</view>
 								</view>
 								<view class="content-tr">
 									<view class="content-td">分类</view>
-									<view class="content-th">{{ product.typeName == null ? '暂无' : product.typeName }}</view>
+									<view class="content-th">{{
+										product.typeName == null ? '暂无' : product.typeName
+									}}</view>
 								</view>
 								<view class="content-tr">
-									<view class="content-td">包装规格</view> <view class="content-th">{{ product.unit }}</view>
+									<view class="content-td">包装规格</view>
+									<view class="content-th">{{ product.unit }}</view>
 								</view>
 								<view class="content-tr">
-									<view class="content-td">商品编码</view> <view class="content-th">{{ product.productCode }}</view>
+									<view class="content-td">商品编码</view>
+									<view class="content-th">{{ product.productCode }}</view>
 								</view>
 								<view class="content-tr">
-									<view class="content-td">库存</view> <view class="content-th">{{ product.stock }}</view>
+									<view class="content-td">库存</view>
+									<view class="content-th">{{ product.stock }}</view>
 								</view>
-								<view class="content-tr" v-if="product.parametersList.length > 0" v-for="(item, index) in product.parametersList" :key="index">
-									<view class="content-td">{{ item.paramsName }}</view> <view class="content-th">{{ item.paramsContent }}</view>
+								<view
+									class="content-tr"
+									v-if="product.parametersList.length > 0"
+									v-for="(item, index) in product.parametersList"
+									:key="index"
+								>
+									<view class="content-td">{{ item.paramsName }}</view>
+									<view class="content-th">{{ item.paramsContent }}</view>
 								</view>
 							</scroll-view>
 						</div>
-						<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
-							<view class="tui-flex-1"> <view class="tui-button" @click="hidePopup()">收起</view> </view>
+						<view
+							class="tui-right-flex tui-popup-btn"
+							:style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }"
+						>
+							<view class="tui-flex-1">
+								<view class="tui-button" @click="hidePopup()">收起</view>
+							</view>
 						</view>
 					</view>
 				</tui-bottom-popup>
@@ -282,9 +388,7 @@ export default {
 		initData() {
 			// 初始化商品详情查询
 			this.ProductService.queryProductDetils({
-				userId: this.userID,
-				productID: this.productID,
-				identity: this.identity
+				productId: this.productID
 			})
 				.then(response => {
 					this.skeletonShow = false
@@ -297,7 +401,10 @@ export default {
 						this.isInvalid = true
 					}
 					this.ladderPriceFlag = this.product.ladderPriceFlag
-					this.html = this.product.productDetail == null ? this.html : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
+					this.html =
+						this.product.productDetail == null
+							? this.html
+							: this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
 					this.stock = this.product.stock
 					this.buyRetailPriceStep = this.product.step
 					this.number = this.product.minBuyNumber
@@ -318,7 +425,11 @@ export default {
 						this.buyRetailPrice = this.product.retailPrice
 					}
 					//处理下架商品和售罄商品
-					if (this.product.validFlag == '3' || this.product.validFlag == '10' || this.stock == 0) {
+					if (
+						this.product.validFlag == '3' ||
+						this.product.validFlag == '10' ||
+						this.stock == 0
+					) {
 						this.disabled = true
 						this.isNoneDisabled = true
 					} else {
@@ -401,7 +512,10 @@ export default {
 		},
 		processActivityPrice() {
 			//单独处理活动价格和阶梯价格
-			if ((this.ladderPriceFlag == '0' && this.product.actStatus == 0) || this.product.actStatus == 1) {
+			if (
+				(this.ladderPriceFlag == '0' && this.product.actStatus == 0) ||
+				this.product.actStatus == 1
+			) {
 				this.buyRetailPrice = this.product.retailPrice
 			} else {
 				this.ladderPriceList.forEach((item, index) => {
@@ -564,7 +678,9 @@ export default {
 					if (i == 0) {
 						sectionScrollTopList.push(`0-${thisScrollTop}`)
 					} else if (i == arr.length - 1) {
-						sectionScrollTopList.push(`${thisScrollTop}-${nextScrollTop - this.winHeight}`)
+						sectionScrollTopList.push(
+							`${thisScrollTop}-${nextScrollTop - this.winHeight}`
+						)
 					} else {
 						sectionScrollTopList.push(`${thisScrollTop}-${nextScrollTop}`)
 					}
@@ -1333,7 +1449,11 @@ page {
 			border-radius: 0 42rpx 42rpx 0;
 		}
 		.btn-bay.disabled {
-			background: linear-gradient(135deg, rgba(242, 143, 49, 0.5) 0%, rgba(225, 86, 22, 0.5) 100%);
+			background: linear-gradient(
+				135deg,
+				rgba(242, 143, 49, 0.5) 0%,
+				rgba(225, 86, 22, 0.5) 100%
+			);
 		}
 	}
 }

+ 19 - 32
pages/index/index.vue

@@ -116,9 +116,11 @@ export default {
 		}
 	},
 	onLoad() {
+		// 获取用户是否授权
 		authorize.getSetting().then(res => {
 			//0:为取消授权 1:为已授权 2:为未操作
 			if (res == 1) {
+				console.log('用户已授权')
 				this.GetWxAuthorize()
 			}
 		})
@@ -128,42 +130,26 @@ export default {
 	},
 	methods: {
 		...mapMutations(['login', 'logout']),
+		// 授权登录验证
 		async GetWxAuthorize() {
+			// 获取微信code
 			const wechatCode = await authorize.getCode('weixin')
-			this.UserService.userInfoLogin({ code: wechatCode })
-				.then(response => {
-					// 保存登录信息
-					this.login(response.data)
-					console.log(response)
-					this.$store.commit('updateStatus', response.data)
-					this.organizeId = response.data.organizeId
-					this.getUserInfoPersonal(response.data.organizeId)
-				})
-				.catch(error => {
-					uni.setStorage({
-						//缓存游客用户openid
-						key: 'openid',
-						data: error.data.openid
-					})
-					this.logout()
-				})
-			this.UserService.userInfoLogin({ code: wechatCode })
-				.then(response => {
-					this.login(response.data)
-					this.$store.commit('updateStatus', response.data)
-					this.getUserInfoPersonal(response.data.organizeId)
-				})
-				.catch(error => {
-					uni.setStorage({
-						//缓存游客用户openid
-						key: 'openid',
-						data: error.data.openid
-					})
-					
-				})
+			this.UserService.userInfoLogin({code:wechatCode}).then(res=>{
+				// 登录成功
+				this.login(res.data)
+				const organizeId = res.data.organizeId
+				this.organizeId = res.data.organizeId
+				this.getUserInfoPersonal(organizeId)
+				console.log(res)
+			}).catch(err=>{
+				// 缓存游客openid
+				console.log(err)
+				uni.setStorageSync('openid',err.data.openid)
+				this.logout()
+			})
 		},
+		//初始化个人中心数据
 		getUserInfoPersonal(organizeId) {
-			//初始化个人中心数据
 			this.UserService.userInfoPersonal({ organizeId: organizeId })
 				.then(response => {
 					this.organizeName = response.data.organizeName
@@ -172,6 +158,7 @@ export default {
 					this.shipmentsCount = this.showBadge(response.data.shipmentsCount) //已发货
 					this.salesReturnCount = this.showBadge(response.data.salesReturnCount) //退货/款
 					this.isRequest = true //个人中心初始化成功后才显示页面
+					console.log(response)
 				})
 				.catch(error => {
 					this.$util.msg(error.msg, 2000)

+ 22 - 22
pages/login/login.vue

@@ -41,8 +41,7 @@ export default {
 			loginMessage: '' //登录信息反馈
 		}
 	},
-	onLoad(option) {
-	},
+	onLoad(option) {},
 	computed: {
 		...mapState(['isWxAuthorize', 'isLoginType', 'isLoginProductId', 'isLoginOrderId']),
 		// 邀请码长度是否符合要求
@@ -60,24 +59,28 @@ export default {
 					this.isUserInfo = false
 					this.userInfo = res.userInfo
 					let params = {
-							invitationCode: this.invitationCode,
-							nickName: res.userInfo.nickName,
-							openid: uni.getStorageSync('openid')
+						invitationCode: this.invitationCode,
+						nickName: res.userInfo.nickName,
+						openid: uni.getStorageSync('openid')
 					}
 					// 验证邀请码
-					this.UserService.userInvitation(params).then(response => {
-						console.log(response)
-						// 保存用户信息
-						this.login(response.data)
-						this.$store.commit('updateStatus',response.data)
-						setTimeout(()=>{
-							this.$api.navigateTo(`/pages/index/index`)
-						},1500)
-					}).catch(error => {
-						this.loginMessage = error.msg
-						this.isUserInfo = false
-						// this.$util.msg(error.msg, 2000)
-					})
+					this.UserService.userInvitation(params)
+						.then(response => {
+							console.log(response)
+							// 保存用户信息
+							this.login(response.data)
+							this.$store.commit('updateStatus', response.data)
+							// 登录成功提示
+							this.$util.msg('登录成功', 1500, false, 'success')
+							setTimeout(() => {
+								this.$api.navigateTo(`/pages/index/index`)
+							}, 1500)
+						})
+						.catch(error => {
+							this.loginMessage = error.msg
+							this.isUserInfo = false
+							// this.$util.msg(error.msg, 2000)
+						})
 				}
 			})
 		},
@@ -104,10 +107,7 @@ export default {
 			this.$refs.VcodeInput.clearValue()
 		}
 	},
-	onShow() {
-		
-		
-	}
+	onShow() {}
 }
 </script>
 

+ 42 - 76
pages/user/club/club-list.vue

@@ -35,7 +35,11 @@
 				<view class="txt">暂无机构数据</view>
 			</view>
 			<view v-else class="club-list">
-				<scroll-view scroll-y="true" :style="{ height: scrollHeight }">
+				<scroll-view
+					scroll-y="true"
+					:style="{ height: scrollHeight }"
+					@scrolltolower="getOnReachBottomData"
+				>
 					<!-- 机构数据 -->
 					<view class="list" v-for="item in clubList" :key="item.userId">
 						<view class="list-left">
@@ -125,104 +129,66 @@ export default {
 	methods: {
 		// 初始胡机构列表
 		init() {
-			this.$api.getStorage().then(response => {
+			this.$api.getStorage().then(async response => {
 				this.serviceProviderId = response.serviceProviderID
 				this.pageNum = 1
-				this.getClubList()
+				this.clubList = await this.getClubList()
 			})
 		},
 		// 设置scroll高度
 		setScrollHeight() {
 			this.scrollHeight = this.$store.state.windowHeight - 61 + 'px'
 		},
-		searchClubList() {
+		async searchClubList() {
 			// 如果搜索框为空
 			if (this.searchInputVal.trim().length <= 0) {
 				this.searchInputVal = ''
 				return
 			}
+			this.searchKeyWords()
+		},
+		async searchKeyWords(){
 			this.pageNum = 1
-			this.getClubList()
+			this.clubList = await this.getClubList()
 		},
 		// 初始化机构列表
-		getClubList() {
+		async getClubList() {
 			let params = {
 				organizeId: this.organizeId,
 				name: this.searchInputVal,
-				pageNum: 1,
+				pageNum: this.pageNum,
 				pageSize: this.pageSize
 				// status: this.status
 			}
-			this.SellerService.GetSellerClubList(params)
-				.then(response => {
-					let responseData = response.data
-					console.log(responseData)
-					// 如果返回机构条数大于0
-					if (responseData.total > 0) {
-						this.isEmpty = false
-						this.hasNextPage = response.data.hasNextPage
-						this.clubList = responseData.list
-						this.pullFlag = false
-						setTimeout(() => {
-							this.pullFlag = true
-						}, 500)
-						if (this.hasNextPage) {
-							this.pullUpOn = false
-							this.nomoreText = '上拉显示更多'
-						} else {
-							this.pullUpOn = true
-							this.loadding = false
-							this.nomoreText = '已至底部'
-						}
-					} else {
-						this.isEmpty = true
-					}
-				})
-				.catch(error => {
+			const { data: res } = await this.SellerService.GetSellerClubList(params).catch(
+				error => {
 					this.$util.msg(error.msg, 2000)
-				})
-		},
-		// scroll触底事件
-		onReachBottom() {
-			if (this.hasNextPage) {
-				this.loadding = true
-				this.pullUpOn = true
-				this.getOnReachBottomData()
+				}
+			)
+			this.pageNum = res.pageNum
+			this.hasNextPage = res.hasNextPage
+			if (res.list.length < 0) {
+				this.isEmpty = true
 			}
+			return res.list
 		},
 		// 加载下一页数据
-		getOnReachBottomData() {
-			this.pageNum += 1
-			let params = {
-				organizeId: this.organizeId,
-				name: this.searchInputVal,
-				pageNum: this.pageNum,
-				pageSize: this.pageSize
+		async getOnReachBottomData() {
+			if (!this.hasNextPage && this.pullFlag) {
+				this.loadding = false
+				this.pullUpOn = false
+				this.nomoreText = '已至底部'
+				return
 			}
-			this.SellerService.GetSellerClubList(params)
-				.then(response => {
-					let responseData = response.data
-					if (responseData.total > 0) {
-						this.hasNextPage = response.data.hasNextPage
-						// 将数据追加到clubList列表
-						this.clubList = this.clubList.concat(responseData.list)
-						this.pullFlag = false // 防上拉暴滑
-						setTimeout(() => {
-							this.pullFlag = true
-						}, 500)
-						if (this.hasNextPage) {
-							this.pullUpOn = false
-							this.nomoreText = '上拉显示更多'
-						} else {
-							this.pullUpOn = false
-							this.loadding = false
-							this.nomoreText = '已至底部'
-						}
-					}
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
+			this.nomoreText = '上拉显示更多'
+			this.loadding = true
+			this.pullUpOn = true
+			this.pageNum += 1
+			const list = await this.getClubList()
+			this.clubList = [...this.clubList, ...list]
+			setTimeout(() => {
+				this.pullFlag = true
+			}, 2000)
 		},
 		//输入框失去焦点时触发
 		onShowClose() {
@@ -232,11 +198,11 @@ export default {
 				this.isShowClose = false
 			}
 		},
-		delInputText() {
+		async delInputText() {
 			//清除输入框内容
 			this.searchInputVal = ''
 			this.isShowClose = false
-			this.getClubList()
+			this.searchKeyWords()
 		},
 		// 跳转下单产品列表
 		_goGoodsList(item) {
@@ -248,9 +214,9 @@ export default {
 			this.$api.setStorage('clubInfo', item)
 			this.$api.navigateTo(`pages/user/order/order-list`)
 		},
-		hideSearchModalHandle() {
+		async hideSearchModalHandle() {
 			this.showSearchModal = false
-			this.searchClubList()
+			this.searchKeyWords()
 		},
 		searchInputFoucs() {
 			this.showSearchModal = true

+ 2 - 2
services/product.service.js

@@ -68,7 +68,7 @@ export default class ProductService {
 	 * @param:productIds 商品ID
 	 */
 	queryProductDetilsRelevant (data = {}) {
-		return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
+		return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
 	}
 	
 	/**
@@ -78,7 +78,7 @@ export default class ProductService {
 	 * @param:productCount 商品数量(必填)
 	 */
 	shoppingAddCart (data = {}) {
-		return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
+		return this.AjaxService.post({ url:'/shopping/add/cart', data, isLoading: true })
 	}
 	
 	/**

+ 13 - 0
services/sellse.service.js

@@ -24,6 +24,19 @@ export default class SellerService {
 			isLoading: true
 		})
 	}
+	
+	/**
+	 *@下单商品列表
+	 *@param userId 用户id
+	 */
+	CartQuantity(data = {}) {
+		return this.AjaxService.get({
+			url: '/shopping/quantity',
+			data,
+			isLoading: true
+		})
+	}
+	
 	/**
 	 *@协销登录
 	 *@param mobile 手机号

+ 1 - 0
services/user.service.js

@@ -26,6 +26,7 @@ export default class UserService {
 			isStatus: false
 		})
 	}
+	
 	/*维沙邀请码绑定*/
 	userInvitation(data = {}) {
 		return this.AjaxService.post({

+ 20 - 18
utils/util.js

@@ -1,44 +1,46 @@
 /* 常用工具函数 */
-export const msg = (title, duration=1500, mask=true, icon='none')=>{
+export const msg = (title, duration = 1500, mask = true, icon = 'none') => {
 	//统一提示方便全局修改
-	if(Boolean(title) === false){return;}
+	if (Boolean(title) === false) {
+		return
+	}
 	uni.showToast({
 		title,
 		duration,
 		mask,
 		icon
-	});
+	})
 }
-export const modal = (title,content,confirmText,cancelText,showCancel=false,callBack) =>{
+export const modal = (title, content, confirmText, cancelText, showCancel = false, callBack) => {
 	uni.showModal({
 		title,
 		content,
 		confirmText,
 		cancelText,
-		confirmColor:'#E15616',
+		confirmColor: '#E15616',
 		showCancel,
-		success: function (res) {
+		success: function(res) {
 			if (res.confirm) {
 				callBack()
 			}
 		}
-	});
-}	
-export const json = type=>{
+	})
+}
+export const json = type => {
 	//模拟异步请求数据
-	return new Promise(resolve=>{
-		setTimeout(()=>{
+	return new Promise(resolve => {
+		setTimeout(() => {
 			// console.log(resolve+'======='+type);
-			resolve(Json[type]);
+			resolve(Json[type])
 		}, 500)
 	})
 }
 
-export const prePage = ()=>{
-	let pages = getCurrentPages();
-	let prePage = pages[pages.length - 2];
+export const prePage = () => {
+	let pages = getCurrentPages()
+	let prePage = pages[pages.length - 2]
 	// #ifdef H5
-	return prePage;
+	return prePage
 	// #endif
-	return prePage.$vm;
-}
+	return prePage.$vm
+}