wenjie пре 9 месеци
родитељ
комит
59bca91414
6 измењених фајлова са 101 додато и 50 уклоњено
  1. 1 2
      api/common.js
  2. 30 7
      hotel/cityList.vue
  3. 6 4
      movie/index.vue
  4. 1 1
      movie/movieDetail.vue
  5. 46 25
      pages/index/index.vue
  6. 17 11
      utils/request.js

+ 1 - 2
api/common.js

@@ -241,8 +241,7 @@ export function homeSearch(data) {
 // 城市列表
 export function getCityList(data) {
   return request({
-    url: '/productcenterserver/region/list',
+    url: `/productcenterserver/region/list?name=${data.name}&type=City&page=${data.page}&size=${data.size}`,
     method: 'post',
-    data
   })
 }

+ 30 - 7
hotel/cityList.vue

@@ -1,9 +1,9 @@
 <template>
 	<view class="cityList">
 		<view class="search-box">
-			 <input class="search" v-model="value" type="text" placeholder="搜索城市名称" />
+			 <input class="search" v-model="query.name" type="text" placeholder="搜索城市名称" />
 		</view>
-		<zs-list class="list" mt="120rpx" :status="status">
+		<zs-list class="list" mt="120rpx" @load="loadMore" :status="status">
 			<view class="item" v-for="item in list" :key="item.code" @click="handleCity(item.name)">
 				{{item.name}}
 			</view>
@@ -13,19 +13,32 @@
 </template>
 
 <script>
+	import {debounce} from '@/utils/tool.js'
 	import {getCityList} from '@/api/common'
 	export default {
 		data() {
 			return {
-				value:'',
+				query:{
+					name:'',
+					page:0,
+					size:30,
+				},
 				list:[],
 				status:'more',
 				backUrl:'',
 				checkInDate:'',
 				checkOutDate:'',
-				key:''
+				key:'',
 			}
 		},
+		watch: {
+			'query.name':debounce(function(val) {
+				this.status = 'more'
+				this.query.page = 0
+				this.list = []
+				this.getCityList()
+			})
+		},
 		methods: {
 			handleCity(name){
 				let city = name.replace('市','')
@@ -40,12 +53,20 @@
 				}
 				
 			},
+			loadMore(){
+				this.getCityList()
+			},
 			getCityList() {
 				this.status = 'loading'
-				getCityList().then(res=>{
+				getCityList(this.query).then(res=>{
 					if(res.state == 'Success'){
-						this.list = res.content.content
-						this.status = 'noMore'
+						this.list = this.list.concat(res.content.content) 
+						if(this.list.length == res.content.totalElements){
+							this.status = 'noMore'
+						}else{
+							this.status = 'more'
+							this.query.page++
+						}
 					}
 				})
 			}
@@ -75,6 +96,8 @@
 			text-indent: 20rpx;
 			background: #F6F6F6;
 			border-radius: 36rpx;
+			box-sizing: border-box;
+			padding: 0 40rpx;
 		}
 	}
 	.zs-list{

+ 6 - 4
movie/index.vue

@@ -235,10 +235,12 @@
 			
 		},
 		onLoad() {
-			this.cityList().then(()=>{
-				// this.cinema_filter()
-				this.hotList()
-			})
+			// this.cityList().then(()=>{
+			// 	// this.cinema_filter()
+			// 	this.hotList()
+			// })
+			this.cityId = uni.getStorageSync('movieCityId')
+			this.hotList()
 		},
 		created() {
 			//去除

+ 1 - 1
movie/movieDetail.vue

@@ -271,7 +271,7 @@
 			movie_cinemas(){
 				movie_cinemas(this.query).then(res=>{
 					if(res.state == 'Success'){
-						if(!(res.content.data.showDates.includes(this.query.day))){
+						if(!(res.content.data.showDates.includes(this.query.day))&&res.content.data.showDates.length){
 							this.query.day = res.content.data.showDates[0]
 							this.movie_cinemas()
 						}

+ 46 - 25
pages/index/index.vue

@@ -56,7 +56,7 @@
 								<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.cover[0]" width="344rpx" height="344rpx" mode=""></zs-img>
+								<zs-img :src="item.cover[0]" width="344rpx" height="344rpx" mode="widthFix"></zs-img>
 								<!-- <zs-img :src="item.goodsVos[0].goodsImg" width="344rpx" height="344rpx" mode=""></zs-img> -->
 								<view class="info">
 									<view class="title">
@@ -75,27 +75,27 @@
 									</view> -->
 									<view class="price-box">
 										<view class="left">
-											<view class="price" v-if="item.salePrice">
+											<text class="price" v-if="item.salePrice">
 											¥{{(item.salePrice/100).toFixed(2)}}
-											</view>
-								<!-- 			<view class="label" v-if="item.productType!='Shop'&&item.productType!='ShopGoods'&&item.productType!='ShopService'&&item.productType!='PetrolStation'">
+											</text>
+											<text class="label" v-if="(item.labelType=='Place'||item.productType=='MovieTicket')&&item.salePrice">
-											</view> -->
-											<view class="old-price" v-if="item.originalPrice">
+											</text>
+											<text class="old-price" v-if="item.originalPrice">
 											¥{{(item.originalPrice/100).toFixed(2)}}
-											</view>
+											</text>
 										</view>
 										
-										<view class="right" v-if="item.salesCount">
+										<!-- <view class="right" v-if="item.salesCount">
 											销量{{item.salesCount}}
-										</view>
+										</view> -->
 									</view>
 									
 									<view class="address-box">
 										<view class="address">
 											{{item.address || ''}}
 										</view>
-										<view class="distance">
+										<view class="distance" v-if="item.distance">
 											{{item.distance | filterDis}}
 										</view>
 									</view>
@@ -112,7 +112,7 @@
 								<!-- <image class="ad" :src="item.advertsImg" mode="widthFix"></image> -->
 							</template>
 							<view v-else  @click="goGoodsDetail(item)">
-								<zs-img :src="item.cover[0]" width="344rpx" height="344rpx" mode=""></zs-img>
+								<zs-img :src="item.cover[0]" width="344rpx" height="344rpx" mode="widthFix"></zs-img>
 								<view class="info">
 									<view class="title">
 									<!-- 	<view class="tag">
@@ -130,27 +130,27 @@
 									</view> -->
 									<view class="price-box">
 										<view class="left">
-										<view class="price" v-if="item.salePrice">
-											¥{{(item.salePrice/100).toFixed(2)}}
-											</view>
-									<!-- 		<view class="label" v-if="item.productType!='Shop'&&item.productType!='ShopGoods'&&item.productType!='ShopService'&&item.productType!='PetrolStation'">
+											<text class="price" v-if="item.salePrice">
+											¥{{(item.salePrice/100).toFixed(2)}} {{item.productType=='PetrolStation'?'/L':''}}
+											</text>
+											<text class="label" v-if="(item.labelType=='Place'||item.productType=='MovieTicket')&&item.salePrice">
-											</view> -->
-											<view class="old-price" v-if="item.originalPrice">
+											</text>
+											<text class="old-price" v-if="item.originalPrice">
 											¥{{(item.originalPrice/100).toFixed(2)}}
-											</view>
+											</text>
 										</view>
 										
-										<view class="right" v-if="item.salesCount">
+										<!-- <view class="right" v-if="item.salesCount">
 											销量{{item.salesCount}}
-										</view>
+										</view> -->
 									</view>
 									
 									<view class="address-box">
 										<view class="address">
 											{{item.address || ''}}
 										</view>
-										<view class="distance">
+										<view class="distance" v-if="item.distance">
 											{{item.distance |filterDis}}
 										</view>
 									</view>
@@ -176,6 +176,7 @@
 		getAdv,
 		homeSearch
 	} from '@/api/common.js'
+	import {cityList} from '@/api/movie.js'
 	import { search } from '@/api/shop.js';
 	// 腾讯地图
 	var QQMapWX = require('../../libs/qqmap-wx-jssdk.min.js');
@@ -200,7 +201,7 @@
 				list1: [],
 				copyList1: [],
 				query:{
-					distance:100000000,
+					distance:5000,
 					latitude:0,
 					longitude:0,
 					regionCode:'520101',
@@ -220,7 +221,7 @@
 		filters: {
 			filterDis: function(value) {
 				if(value<1000){
-					return value +'m';
+					return value.toFixed(0) +'m';
 				}else{
 					return (value/1000).toFixed(0)+'km'
 				}
@@ -449,7 +450,7 @@
 						
 						this.list = JSON.parse(JSON.stringify(this.copyList))
 						this.list1 = JSON.parse(JSON.stringify(this.copyList1))
-						if(this.query.page == res.content.totalPages){
+						if(this.query.page+1 == res.content.totalPages){
 							this.status = 'noMore'
 						}else{
 							this.status = 'more'
@@ -567,6 +568,19 @@
 					})
 				})
 			},
+			// 获取电影票城市id
+			cityList(){
+				return new Promise((resolve,reject)=>{
+					cityList().then(res=>{
+						if(res.state == 'Success'){
+							let city = uni.getStorageSync('city').replace('市','')
+							let cityId = res.content.data.filter(item=>item.name == city)[0].cityId
+							uni.setStorageSync('movieCityId',cityId)
+							resolve()
+						}
+					})
+				})
+			},
 		},
 		onPageScroll(e) {
 				if(e.scrollTop >= 50){
@@ -616,6 +630,7 @@
 			this.getDialogAdv()
 			Promise.all([this.getMenu(),this.getAdv(),this.getCity()]).then(res=>{
 				this.search()
+				this.cityList()
 			})
 			
 		}
@@ -845,6 +860,7 @@
 							.left{
 								display: flex;
 								align-items: flex-end;
+								vertical-align: bottom;
 								.unit{
 									font-size: 20rpx;
 									color: $uni-color-primary;
@@ -852,10 +868,15 @@
 								}
 								.price{
 									font-size: 32rpx;
+									line-height: 32rpx;
 									color: $uni-color-primary;
 									font-weight: bold;
 								}
-								
+								.label{
+									font-size: 20rpx;
+									color: #AAAAAA;
+									margin-left: 6rpx;
+								}
 								.old-price{
 									font-size: 20rpx;
 									color: #AAAAAA;

+ 17 - 11
utils/request.js

@@ -27,10 +27,12 @@ export let request = (options) => {
 							})
 							// uni.hideLoading()
 						} else if (res.data.msg != '成功') { //接口返回报错
-							uni.showToast({
-								title: res.data.content || res.data.msg || '请求失败',
-								icon: 'none',
-								duration:3000
+							setTimeout(()=>{
+								uni.showToast({
+									title: res.data.content || res.data.msg || '请求失败',
+									icon: 'none',
+									duration:3000
+								})
 							})
 							console.error('报错接口:',BASE_URL + options.url,'报错信息:', res.data);
 
@@ -55,10 +57,12 @@ export let request = (options) => {
 											success(r) {
 												uni.hideLoading()
 												if (r.data.content == '刷新令牌错误') {
-													uni.showToast({
-														title: '登录失效',
-														icon: 'fail'
-													})
+													setTimeout(()=>{
+														uni.showToast({
+															title: '登录失效',
+															icon: 'fail'
+														})
+													},0)
 													uni.clearStorageSync()
 													uni.reLaunch({
 														url: '/pages/index/index'
@@ -113,9 +117,11 @@ export let request = (options) => {
 				},
 				//请求失败
 				fail: (err) => {
-					uni.showToast({
-						title: '请求接口失败'
-					})
+					setTimeout(()=>{
+						uni.showToast({
+							title: '请求接口失败'
+						})
+					},0)
 					reject(err)
 				}
 			})