Kaynağa Gözat

修改首页数据

wenjie 9 ay önce
ebeveyn
işleme
70a04fe1e1
7 değiştirilmiş dosya ile 270 ekleme ve 58 silme
  1. 18 0
      api/common.js
  2. 75 0
      hotel/cityList.vue
  3. 9 4
      hotel/index.vue
  4. 1 1
      my/order/detail.vue
  5. 6 0
      pages.json
  6. 160 53
      pages/index/index.vue
  7. 1 0
      refuel/refuelDetail.vue

+ 18 - 0
api/common.js

@@ -228,3 +228,21 @@ export function getGoodsTypeObj(data) {
 		data
 	})
 }
+
+
+//首页搜索
+export function homeSearch(data) {
+	return request({
+		url: '/productcenterserver/search/v1/list',
+		data
+	})
+}
+
+// 城市列表
+export function getCityList(data) {
+  return request({
+    url: '/productcenterserver/region/list',
+    method: 'post',
+    data
+  })
+}

+ 75 - 0
hotel/cityList.vue

@@ -0,0 +1,75 @@
+<template>
+	<view class="cityList">
+		<view class="search-box">
+			 <input class="search" v-model="value" type="text" placeholder="搜索城市名称" />
+		</view>
+		<zs-list class="list" mt="120rpx" :status="status">
+			<view class="item" v-for="item in list" :key="item.code" @click="handleCity(item.name)">
+				{{item.name}}
+			</view>
+		</zs-list>
+		
+	</view>
+</template>
+
+<script>
+	import {getCityList} from '@/api/common'
+	export default {
+		data() {
+			return {
+				value:'',
+				list:[],
+				status:'more'
+			}
+		},
+		methods: {
+			handleCity(name){
+				let city = name.replace('市','')
+				uni.navigateTo({
+					url:'/hotel/index?cityName='+city
+				})
+			},
+			getCityList() {
+				this.status = 'loading'
+				getCityList().then(res=>{
+					if(res.state == 'Success'){
+						this.list = res.content.content
+						this.status = 'noMore'
+					}
+				})
+			}
+		},
+		onLoad() {
+			this.getCityList()
+		}
+	}
+</script>
+
+<style lang="scss" >
+.cityList{
+	background: #fff;
+	.search-box{
+		position: fixed;
+		top: 0%;
+		left: 0%;
+		padding: 0 24rpx ;
+		background: #fff;
+		.search{
+			width: 702rpx;
+			height: 72rpx;
+			text-indent: 20rpx;
+			background: #F6F6F6;
+			border-radius: 36rpx;
+		}
+	}
+	.zs-list{
+		.item{
+			padding: 28rpx 0;
+			font-size: 24rpx;
+			color: #222222;
+			border-bottom: 1rpx solid #F0F0F0;
+			margin: 0 24rpx;
+		}
+	}
+}
+</style>

+ 9 - 4
hotel/index.vue

@@ -5,12 +5,12 @@
 	
 	<view class="search-box">
 		<view class="address-box">
-			<view class="address">
+			<view class="address" @click="jump('./cityList')">
 				{{address}}
 			</view>
 			<image class="more" src="@/static/right.png" mode=""></image>
 			<view class="nearby" @click="handleSearch(1)">
-				附近酒店
+				当前位置
 			</view>
 			<image class="position" src="@/static/rePosition.png" mode=""></image>
 		</view>
@@ -75,7 +75,7 @@
 									</view>
 									
 									<view class="right">
-										<image class="star" v-for="i in getTag(item.star).num" src="../static/star.png" mode=""></image>
+										<image class="star" v-for="(i,d) in getTag(item.star).num" :key="d" src="../static/star.png" mode=""></image>
 	
 									</view>
 								</view>
@@ -115,7 +115,7 @@
 										</view>
 										
 										<view class="right">
-												<image class="star" v-for="i in getTag(item.star).num" src="../static/star.png" mode=""></image>
+												<image class="star" v-for="(i,d) in getTag(item.star).num" :key="d" src="../static/star.png" mode=""></image>
 										</view>
 									</view>
 									<view class="title">
@@ -199,6 +199,11 @@
 			}
 		},
 		methods: {
+			jump(url){
+				uni.navigateTo({
+					url
+				})
+			},
 			getTag(star){
 				if(star == 0 ||star == 1){
 					return {tag:'tag1',num:1}

+ 1 - 1
my/order/detail.vue

@@ -12,7 +12,7 @@
 				</view>
 			</view>
 			
-			<view class="content progress"  v-if="info.goodsList[0].goodsState == 'APPLY_REFUND' || info.goodsList[0].goodsState == 'REFUNDED'"  @click="refundDetail">
+			<view class="content progress"  v-if="info.goodsList[0].goodsState == 'APPLY_REFUND' || info.goodsList[0].goodsState == 'REFUNDED'||info.goodsList[0].goodsState == 'APPLY_REFUNDING'"  @click="refundDetail">
 				<view class="progress-title">
 					退款进度
 				</view>

+ 6 - 0
pages.json

@@ -435,6 +435,12 @@
 						"navigationStyle": "custom"
 					}
 				},
+				{
+					"path": "cityList",
+					"style": {
+						"navigationBarTitleText": "城市列表"
+					}
+				},
 				{
 					"path": "hotelDetail",
 					"style": {

+ 160 - 53
pages/index/index.vue

@@ -56,29 +56,35 @@
 								<zs-img :src="item.advertsImg" radius="full" width="344rpx" mode="widthFix" @click.native="jump(item.jumpUrl)"></zs-img>
 							</template>
 							<view v-else @click="goGoodsDetail(item)">
-								<zs-img :src="item.goodsVos[0].goodsImg" width="344rpx" height="344rpx" mode=""></zs-img>
+								<zs-img :src="item.cover[0]" width="344rpx" height="344rpx" mode=""></zs-img>
+								<!-- <zs-img :src="item.goodsVos[0].goodsImg" width="344rpx" height="344rpx" mode=""></zs-img> -->
 								<view class="info">
 									<view class="title">
-										{{item.goodsVos[0].goodsName}}
+										<view class="tag">
+											今日特惠
+										</view>
+										<view class="text">
+											{{item.title}}
+										</view>
 									</view>
 									<!-- <view class="desc">
 										{{item.goodsVos[0].goodsDescribe}}
 									</view> -->
+									<view class="discount-tag" v-if="item.salePrice&&item.originalPrice">
+										{{(item.salePrice/item.originalPrice)*10}}
+									</view>
 									<view class="price-box">
 										<view class="left">
-											<!-- <view class="unit">
-												¥
-											</view> -->
-											<view class="price">
-											¥{{item.goodsVos[0].realPrice}}
+											<view class="price" v-if="item.salePrice">
+											¥{{item.salePrice}}
 											</view>
-											<view class="old-price">
-											¥{{item.goodsVos[0].marketPrice}}
+											<view class="old-price" v-if="item.originalPrice">
+											¥{{item.originalPrice}}
 											</view>
 										</view>
 										
-										<view class="right">
-											销量{{item.goodsVos[0].saleNum}}
+										<view class="right" v-if="item.salesCount">
+											销量{{item.salesCount}}
 										</view>
 									</view>
 								</view>
@@ -94,30 +100,35 @@
 								<!-- <image class="ad" :src="item.advertsImg" mode="widthFix"></image> -->
 							</template>
 							<view v-else  @click="goGoodsDetail(item)">
-								<zs-img :src="item.goodsVos[0].goodsImg" width="344rpx" height="344rpx" mode=""></zs-img>
+								<zs-img :src="item.cover[0]" width="344rpx" height="344rpx" mode=""></zs-img>
 								<view class="info">
 									<view class="title">
-										{{item.goodsVos[0].goodsName}}
+										<view class="tag">
+											今日特惠
+										</view>
+										<view class="text">
+											{{item.title}}
+										</view>
+									</view>
+									<view class="discount-tag">
+										<!-- {{(item.salePrice/item.originalPrice)*10}} -->
+										4.5折
 									</view>
 									<!-- <view class="desc">
 										{{item.goodsVos[0].goodsDescribe}}
 									</view> -->
 									<view class="price-box">
 										<view class="left">
-											<!-- <view class="unit">
-												¥
-											</view> -->
-											<view class="price">
-											¥{{item.goodsVos[0].realPrice}}
+										<view class="price" v-if="item.salePrice">
+											¥{{item.salePrice}}
 											</view>
-											<view class="old-price">
-											¥{{item.goodsVos[0].marketPrice}}
+											<view class="old-price" v-if="item.originalPrice">
+											¥{{item.originalPrice}}
 											</view>
-											
 										</view>
 										
-										<view class="right">
-											销量{{item.goodsVos[0].saleNum}}
+										<view class="right" v-if="item.salesCount">
+											销量{{item.salesCount}}
 										</view>
 									</view>
 								</view>
@@ -139,7 +150,8 @@
 	import {
 		getUserDetail,
 		getMenu,
-		getAdv
+		getAdv,
+		homeSearch
 	} from '@/api/common.js'
 	import { search } from '@/api/shop.js';
 	// 腾讯地图
@@ -165,12 +177,20 @@
 				list1: [],
 				copyList1: [],
 				query:{
-					queryName:'',
-					'location.lat':0,
-					'location.lon':0,
-					pageCurrent:1,
-					pageSize:100
-				},
+					distance:100000000,
+					latitude:0,
+					longitude:0,
+					regionCode:'520101',
+					page:0,
+					size:10
+				}
+				// query:{
+				// 	queryName:'',
+				// 	'location.lat':0,
+				// 	'location.lon':0,
+				// 	pageCurrent:1,
+				// 	pageSize:100
+				// },
 				
 			}
 		},
@@ -220,8 +240,10 @@
 							type: 'gcj02',
 							success: (res) => {
 								// 解析地址
-								that.query['location.lat'] = res.latitude
-								that.query['location.lon'] = res.longitude
+								that.query.latitude = res.latitude
+								that.query.longitude = res.longitude
+								// that.query['location.lat'] = res.latitude
+								// that.query['location.lon'] = res.longitude
 								// 存储经纬度
 								uni.setStorageSync('location',JSON.stringify({latitude:res.latitude,longitude:res.longitude}))
 								qqmapsdk.reverseGeocoder({
@@ -279,13 +301,76 @@
 				})
 			},
 			goGoodsDetail(item) {
-				uni.setStorageSync('shopInfo', JSON.stringify(item))
+				// uni.setStorageSync('shopInfo', JSON.stringify(item))
+				console.log(item.productType);
+				let url = ''
+				if (item.productType === 'Web') {
+				    console.log('链接');
+				} else if (item.productType === 'Recharge') {
+					url = '/detail/virtualGoods/index'
+				    console.log('充值类');
+				} else if (item.productType === 'Scenic') {
+					url = '/scenic/detail'
+				    console.log('景区');
+				} else if (item.productType === 'ScenicTicket') {
+				    console.log('景区门票');
+				} else if (item.productType === 'StudyTour') {
+					url = '/detail/virtualGoods/index'
+				    console.log('StudyTour');
+				} else if (item.productType === 'Hotel') {
+					url = '/hotel/hotelDetail'
+				    console.log('酒店');
+				} else if (item.productType === 'HotelRoom') {
+					url = '/hotel/hotelDetail'
+				    console.log('酒店房型');
+				} else if (item.productType === 'Cinema') {
+					url = '/movie/movieList'
+				    console.log('电影院');
+				} else if (item.productType === 'MovieTicket') {
+					url = '/movie/movieDetail'
+				    console.log('电影票');
+				} else if (item.productType === 'Restaurant') {
+					url = '/detail/virtualGoods/index'
+				    console.log('餐厅');
+				} else if (item.productType === 'RestaurantFood') {
+					url = '/detail/discountsDetail/index'
+				    console.log('餐厅美食');
+				} else if (item.productType === 'CarMaintain') {
+					url = '/detail/discountsDetail/index'
+				    console.log('汽车保养门店');
+				} else if (item.productType === 'CarMaintainGoods') {
+					url = '/detail/detail/discountsDetail/index/index'
+				    console.log('汽车保养商品');
+				} else if (item.productType === 'CarMaintainService') {
+					url = '/detail/detail/discountsDetail/index/index'
+				    console.log('汽车保养服务');
+				} else if (item.productType === 'Shop') {
+					url = '/detail/shopDetail/shopDetail'
+				    console.log('店铺');
+				} else if (item.productType === 'ShopGoods') {
+					url = '/detail/goodsDetail/index'
+				    console.log('店铺商品');
+				} else if (item.productType === 'ShopService') {
+					url = '/detail/goodsDetail/index'
+				    console.log('店铺服务');
+				} else if (item.productType === 'Coupon') {
+					url = '/detail/goodsDetail/index'
+				    console.log('优惠券');
+				} 
+				else if (item.productType === 'PetrolStation') {
+					url = '/refuel/refuelDetail'
+				    console.log('加油站');
+				} 
+				
+				else {
+				    // 处理未知或未定义的产品类型
+				    console.log('未知产品类型');
+				}
 				uni.navigateTo({
-					url: `../../detail/goodsDetail/index?id=${item.goodsVos[0].goodsId}`
+					// url: `../../detail/goodsDetail/index?id=${item.goodsVos[0].goodsId}`
+					url: `${url}?id=${item.pid}&epId=${item.id}`
 				})
-				// uni.reLaunch({
-				// 	url: `/signUp/index?id=${item.goodsVos[0].goodsId}`
-				// })
+	
 			},
 
 			// 更多套餐
@@ -303,21 +388,24 @@
 				})
 			},
 			loadMore() {
-				if(this.query['location.lat']&&this.query['location.lon']){
+				// if(this.query['location.lat']&&this.query['location.lon']){
+				if(this.query.latitude&&this.query.longitude){
 					this.search()
 				}
 			},
 			search() {
 				if(this.status == 'noMore' || this.status == 'loading') return
-				console.log('加载数据',this.status,this.list,this.list1,this.query.pageCurrent);
 				this.status = 'loading'
-				search(this.query).then(res=>{
+				homeSearch(this.query).then(res=>{
 					if(res.state == 'Success'){
 						this.loading = false
 						let list = []
 						let list1 = []
-						let data = res.content.records
+						let data = res.content.content
 						data.map((item,index)=>{
+							if(item.productType == 'Cinema'){
+								delete item.meta
+							}
 							if(index%2 == 0){
 								list.push(item)
 							}else{
@@ -331,11 +419,11 @@
 						
 						this.list = JSON.parse(JSON.stringify(this.copyList))
 						this.list1 = JSON.parse(JSON.stringify(this.copyList1))
-						if(this.query.pageCurrent == res.content.pages){
+						if(this.query.page == res.content.totalPages){
 							this.status = 'noMore'
 						}else{
 							this.status = 'more'
-							this.query.pageCurrent++
+							this.query.page++
 						}
 						if(!this.advList1.length){
 							this.getGoodsAdv().then(()=>{
@@ -668,18 +756,28 @@
 					.info{
 						flex: 1;
 						padding: 16rpx;
-						display: flex;
-						flex-direction: column;
-						justify-content: space-between;
 						position: relative;
 						.title{
-							font-size: 28rpx;
-							font-weight: bold;
-							width: 100%;
-							white-space: nowrap;
-							overflow: hidden;
-							text-overflow: ellipsis;
 							margin-top: 10rpx;
+							display: flex;
+							align-items: center;
+							.tag{
+								display: inline-block;
+								text-align: center;
+								font-size: 20rpx;
+								color: #FFFFFF;
+								background: $uni-color-primary;
+								padding: 2rpx 10rpx;
+								border-radius: 8rpx;
+							}
+							.text{
+								font-size: 28rpx;
+								font-weight: bold;
+								flex: 1;
+								white-space: nowrap;
+								overflow: hidden;
+								text-overflow: ellipsis;
+							}
 						}
 						
 						.desc{
@@ -695,7 +793,16 @@
 							-webkit-box-orient: vertical;
 							margin-top: 12rpx;
 						}
-						
+						.discount-tag{
+							display: inline-block;
+							padding: 0 10rpx;
+							font-size: 20rpx;
+							color: #EE4320;
+							line-height: 28rpx;
+							background: #FFF6F5;
+							border-radius: 8rpx 8rpx 8rpx 8rpx;
+							margin-top: 10rpx;
+						}
 						.price-box{
 							display: flex;
 							justify-content: space-between;

+ 1 - 0
refuel/refuelDetail.vue

@@ -557,6 +557,7 @@
 		},
 		onLoad(options) {
 			this.epId = options.epId
+			console.log(111,options);
 			// '5154031457384536897'
 			this.storeId =  options.id
 			this.queryStoreDetail(options.id)