|
|
@@ -8,7 +8,7 @@
|
|
|
<view class="weui-navbar navbarIndex">
|
|
|
<!-- City -->
|
|
|
<view class="citySelection" @tap="clickNav">
|
|
|
- <b>{{nav[0]}}<icon type="triangle"/></b>
|
|
|
+ <b>{{nav[0]}}<icon type="triangle" /></b>
|
|
|
</view>
|
|
|
|
|
|
<view wx:for="{{tabs}}" wx:key="{{key}}" id="{{index}}"
|
|
|
@@ -17,93 +17,96 @@
|
|
|
<view class="weui-navbar__title">{{item}}</view>
|
|
|
</view>
|
|
|
<!-- RegionsBar -->
|
|
|
- <view wx:if="{{activeIndex==1 && !!regions[1]}}" class="thisShell {{onMore?'onMore':''}}">
|
|
|
- <view wx:if="{{regions.length>4}}" class="more-cities"><b @tap.stop="bindMore">更多</b><i class="ico_arr"/></view>
|
|
|
- <scroll-view
|
|
|
- scroll-x
|
|
|
- scroll-y
|
|
|
- scroll-left="{{scrollLeft}}"
|
|
|
- scroll-with-animation="{{scrollAnim}}"
|
|
|
- class="weui-navbar_">
|
|
|
- <view class="scrollHack"/>
|
|
|
- <view
|
|
|
- wx:for="{{regions}}"
|
|
|
- wx:key="{{key}}"
|
|
|
- id="{{index}}"
|
|
|
+ <view wx:if="{{activeIndex==1 && !!regions[1]}}"
|
|
|
+ class="thisShell {{onMore?'onMore':''}}">
|
|
|
+ <view wx:if="{{regions.length>4}}" class="more-cities"><b
|
|
|
+ @tap.stop="bindMore">更多</b><i class="ico_arr" /></view>
|
|
|
+ <scroll-view scroll-x scroll-y scroll-left="{{scrollLeft}}"
|
|
|
+ scroll-with-animation="{{scrollAnim}}" class="weui-navbar_">
|
|
|
+ <view class="scrollHack" />
|
|
|
+ <view wx:for="{{regions}}" wx:key="{{key}}" id="{{index}}"
|
|
|
data-curCity="{{!!(item.id == curCity.id)}}"
|
|
|
class="weui-navbar__item_ {{activeIndex_ == index ? 'weui-bar__item_on_' : ''}}"
|
|
|
@tap="tabClick_">
|
|
|
<view class="weui-navbar__title_">{{item}}</view>
|
|
|
</view>
|
|
|
- <view class="scrollHack"/>
|
|
|
+ <view class="scrollHack" />
|
|
|
</scroll-view>
|
|
|
- <view class="mask"/>
|
|
|
+ <view class="mask" />
|
|
|
+ </view>
|
|
|
+ <view class="weui-navbar__slider"
|
|
|
+ style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);">
|
|
|
</view>
|
|
|
- <view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
|
|
|
</view>
|
|
|
<view class="weui-tab__content">
|
|
|
<view wx:if="{{!!locateFail}}" class="blackMargin">
|
|
|
- <icon type="ico-Empty2" class=""/>
|
|
|
- <button
|
|
|
- @tap="goToSelectCity"
|
|
|
- type="default" plain size="mini"
|
|
|
+ <icon type="ico-Empty2" class="" />
|
|
|
+ <button @tap="goToSelectCity" type="default" plain size="mini"
|
|
|
class="select_city">定位失败,请手动选择城市</button>
|
|
|
</view>
|
|
|
<!-- 电影列表 -->
|
|
|
- <scroll-view
|
|
|
- hidden="{{activeIndex != 0}}"
|
|
|
- scroll-y
|
|
|
- scroll-with-animation
|
|
|
- enable-back-to-top="true"
|
|
|
- scroll-top="{{scrollTop}}"
|
|
|
- bindscrolltolower="lower"
|
|
|
- style="height:92vh"
|
|
|
- class="cinemas__list__wrapper">
|
|
|
- <view wx:if="{{!!DataMovies && (DataMovies.subjects.length == 0)}}" class="blackMargin">
|
|
|
- <icon type="ico-Empty2" class=""/>
|
|
|
+ <scroll-view hidden="{{activeIndex != 0}}" scroll-y
|
|
|
+ scroll-with-animation enable-back-to-top="true"
|
|
|
+ scroll-top="{{scrollTop}}" bindscrolltolower="lower"
|
|
|
+ style="height:92vh" class="cinemas__list__wrapper">
|
|
|
+ <view
|
|
|
+ wx:if="{{!!DataMovies && (DataMovies.subjects.length == 0)}}"
|
|
|
+ class="blackMargin">
|
|
|
+ <icon type="ico-Empty2" class="" />
|
|
|
<view>没有符合条件的影片</view>
|
|
|
</view>
|
|
|
|
|
|
- <ul wx:if="{{!!DataMovies.subjects.length}}" class="movies__list" @tap="goToitem">
|
|
|
+ <ul wx:if="{{!!DataMovies.subjects.length}}"
|
|
|
+ class="movies__list" @tap="goToitem">
|
|
|
<li wx:for="{{DataMovies.subjects}}" wx:key="index"
|
|
|
class="movies__list__item"
|
|
|
- data-subject_id="{{item.subject_id}}"
|
|
|
- >
|
|
|
+ data-subject_id="{{item.subject_id}}">
|
|
|
<view class="movieInfo">
|
|
|
- <image class="movieInfo__poster" src="{{item.pic}}" mode="widthFix" lazy-load="true"/>
|
|
|
+ <image class="movieInfo__poster"
|
|
|
+ src="{{item.poster}}" mode="widthFix"
|
|
|
+ lazy-load="true" />
|
|
|
<view class="movieInfo__detail">
|
|
|
- <h2 class="movieInfo__name">{{item.title}}</h2>
|
|
|
- <view wx:if="{{!!item.title_en}}" class="movieInfo__title_en">{{item.title_en}}</view>
|
|
|
- <view wx:if="{{!!item.director}}" class="movieInfo__p">导演:{{item.director}}</view>
|
|
|
- <view wx:if="{{!!item.actors.length}}" class="movieInfo__p">主演:<text wx:for="{{item.actors}}" wx:key="index">{{item}}</text></view>
|
|
|
+ <h2 class="movieInfo__name">{{item.showName}}
|
|
|
+ </h2>
|
|
|
+ <view wx:if="{{!!item.showNameEn}}"
|
|
|
+ class="movieInfo__title_en">{{
|
|
|
+ item.showNameEn}}</view>
|
|
|
+ <view wx:if="{{!!item.director}}"
|
|
|
+ class="movieInfo__p">导演:{{item.director}}
|
|
|
+ </view>
|
|
|
+ <view wx:if="{{!!item.leadingRole}}"
|
|
|
+ class="movieInfo__p">主演:{{item.leadingRole}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="rightSidebar">
|
|
|
- <button size="mini">{{conpon_kind=='4' ? '购票' : '兑换'}}</button>
|
|
|
+ <button
|
|
|
+ size="mini">{{coupon_type=='COUPON' ? '购票' : '兑换'}}</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <view wx:if="{{!!DataMovies.subjects.length}}" class="weui-loadmore weui-loadmore_line">
|
|
|
- <view class="weui-loadmore__tips weui-loadmore__tips_in-line">已经到底了</view>
|
|
|
+ <view wx:if="{{!!DataMovies.subjects.length}}"
|
|
|
+ class="weui-loadmore weui-loadmore_line">
|
|
|
+ <view
|
|
|
+ class="weui-loadmore__tips weui-loadmore__tips_in-line">
|
|
|
+ 已经到底了</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
<!-- 影院列表 -->
|
|
|
<!-- style="{{!!onlyCinem ? 'height:82vh;'{{!!regions[1] ? 'top:130rpx' : ''}};" -->
|
|
|
- <scroll-view
|
|
|
- hidden="{{activeIndex != 1}}"
|
|
|
- scroll-y
|
|
|
- scroll-with-animation
|
|
|
- enable-back-to-top="true"
|
|
|
- scroll-top="{{scrollTop}}"
|
|
|
- bindscrolltolower="lower"
|
|
|
+ <scroll-view hidden="{{activeIndex != 1}}" scroll-y
|
|
|
+ scroll-with-animation enable-back-to-top="true"
|
|
|
+ scroll-top="{{scrollTop}}" bindscrolltolower="lower"
|
|
|
style="{{!!onlyCinem ? 'height:92vh;' : 'height:82vh;top:130rpx'}};"
|
|
|
class="cinemas__list__wrapper">
|
|
|
- <view wx:if="{{!!Data && (Data.cinemas.length == 0)}}" class="blackMargin">
|
|
|
- <icon type="ico-Empty2" class=""/>
|
|
|
+ <view wx:if="{{!!Data && (Data.cinemas.length == 0)}}"
|
|
|
+ class="blackMargin">
|
|
|
+ <icon type="ico-Empty2" class="" />
|
|
|
<view>没有符合条件的影院</view>
|
|
|
</view>
|
|
|
|
|
|
- <ul wx:if="{{Data.cinemas.length > 0}}" @tap="goToitem" class="cinemas__list">
|
|
|
+ <ul wx:if="{{Data.cinemas.length > 0}}" @tap="goToitem"
|
|
|
+ class="cinemas__list">
|
|
|
<li wx:for="{{Data.cinemas}}" wx:key="index"
|
|
|
class="cinemas__list__item"
|
|
|
data-cinema_id="{{item.cinema_id}}">
|
|
|
@@ -114,30 +117,30 @@
|
|
|
<div class="item__text">{{item.distance}}</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <view wx:if="{{!!isMax && !!Data}}" class="weui-loadmore weui-loadmore_line">
|
|
|
- <view class="weui-loadmore__tips weui-loadmore__tips_in-line">已经到底了</view>
|
|
|
+ <view wx:if="{{!!isMax && !!Data}}"
|
|
|
+ class="weui-loadmore weui-loadmore_line">
|
|
|
+ <view
|
|
|
+ class="weui-loadmore__tips weui-loadmore__tips_in-line">
|
|
|
+ 已经到底了</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<!-- 筛选点击其他区域消失浮层 -->
|
|
|
- <div
|
|
|
- wx:if="{{onMore}}"
|
|
|
- class="y-page__Wrapper"
|
|
|
- @tap.stop="handleClickScroller"/>
|
|
|
+ <div wx:if="{{onMore}}" class="y-page__Wrapper"
|
|
|
+ @tap.stop="handleClickScroller" />
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import wepy from 'wepy'
|
|
|
-import { fetchMovies, fetchCinemas } from '../../utils/api.js'
|
|
|
+import wepy from 'wepy';
|
|
|
+import { fetchMovies, fetchCinemas } from '../../utils/api.js';
|
|
|
|
|
|
export default class Cinemas extends wepy.page {
|
|
|
config = {
|
|
|
navigationBarTitleText: '选择影院'
|
|
|
};
|
|
|
- components = {
|
|
|
- };
|
|
|
+ components = {};
|
|
|
data = {
|
|
|
- conpon_kind: 0,
|
|
|
+ coupon_type: 0,
|
|
|
onlyCinem: false,
|
|
|
tabs: ['影片', '影院'],
|
|
|
activeIndex: 0,
|
|
|
@@ -175,160 +178,163 @@ export default class Cinemas extends wepy.page {
|
|
|
|
|
|
methods = {
|
|
|
async tabClick(e) {
|
|
|
- this.sliderOffset = e.currentTarget.offsetLeft
|
|
|
- this.activeIndex = e.currentTarget.id
|
|
|
- if(e.currentTarget.id==0){
|
|
|
- await this.fetchDataMovies('show')
|
|
|
- }else{
|
|
|
- let start = this.start,
|
|
|
+ this.sliderOffset = e.currentTarget.offsetLeft;
|
|
|
+ this.activeIndex = e.currentTarget.id;
|
|
|
+ if (e.currentTarget.id == 0) {
|
|
|
+ await this.fetchDataMovies('show');
|
|
|
+ } else {
|
|
|
+ let start = this.start,
|
|
|
limit = this.limit,
|
|
|
- total = this.total
|
|
|
- await this.fetchData(start, limit, 'show')
|
|
|
+ total = this.total;
|
|
|
+ await this.fetchData(start, limit, 'show');
|
|
|
}
|
|
|
},
|
|
|
- clickNav (e){
|
|
|
- if(e.target.id == 0){
|
|
|
- this.curStatus = 0
|
|
|
- this.cinemas__nav__item = 'cinemas__nav__item'
|
|
|
+ clickNav(e) {
|
|
|
+ if (e.target.id == 0) {
|
|
|
+ this.curStatus = 0;
|
|
|
+ this.cinemas__nav__item = 'cinemas__nav__item';
|
|
|
|
|
|
- this.methods.goToSelectCity.call(this)
|
|
|
- this.$apply()
|
|
|
+ this.methods.goToSelectCity.call(this);
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
},
|
|
|
- bindMore(){
|
|
|
- this.onMore = !this.onMore
|
|
|
+ bindMore() {
|
|
|
+ this.onMore = !this.onMore;
|
|
|
// this.forbiddenScroll = !this.forbiddenScroll
|
|
|
- if(!!this.onMore){
|
|
|
- this.scrollAnim = false
|
|
|
- this.scrollLeft = this.scrollLeft - 0.1
|
|
|
- } else{
|
|
|
- this.scrollAnim = true
|
|
|
- this.scrollLeft = this.scrollLeft + 0.1
|
|
|
+ if (!!this.onMore) {
|
|
|
+ this.scrollAnim = false;
|
|
|
+ this.scrollLeft = this.scrollLeft - 0.1;
|
|
|
+ } else {
|
|
|
+ this.scrollAnim = true;
|
|
|
+ this.scrollLeft = this.scrollLeft + 0.1;
|
|
|
}
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
},
|
|
|
async tabClick_(e) {
|
|
|
// 点击更多入口
|
|
|
- if(this.onMore){
|
|
|
- this.onMore=!this.onMore
|
|
|
+ if (this.onMore) {
|
|
|
+ this.onMore = !this.onMore;
|
|
|
setTimeout(() => {
|
|
|
wx.createSelectorQuery()
|
|
|
.select('.weui-bar__item_on_')
|
|
|
- .boundingClientRect((rect)=>{
|
|
|
+ .boundingClientRect(rect => {
|
|
|
let left = rect.left,
|
|
|
- left_ = left<-2 ? -2 : left
|
|
|
- let scrollLeft = left_ - (this.windowWidth/2-75 || 116.5)
|
|
|
- this.scrollLeft = scrollLeft<-2 ? 0 : scrollLeft
|
|
|
- this.$apply()
|
|
|
- }).exec()
|
|
|
- }, 200)
|
|
|
-
|
|
|
- } else{
|
|
|
+ left_ = left < -2 ? -2 : left;
|
|
|
+ let scrollLeft = left_ - (this.windowWidth / 2 - 75 || 116.5);
|
|
|
+ this.scrollLeft = scrollLeft < -2 ? 0 : scrollLeft;
|
|
|
+ this.$apply();
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ }, 200);
|
|
|
+ } else {
|
|
|
let left = e.currentTarget.offsetLeft,
|
|
|
- left_ = left<-2 ? -2 : left
|
|
|
- let scrollLeft = left_ - (this.windowWidth/2-75 || 116.5)
|
|
|
- this.scrollLeft = scrollLeft<-2 ? 0 : scrollLeft
|
|
|
+ left_ = left < -2 ? -2 : left;
|
|
|
+ let scrollLeft = left_ - (this.windowWidth / 2 - 75 || 116.5);
|
|
|
+ this.scrollLeft = scrollLeft < -2 ? 0 : scrollLeft;
|
|
|
}
|
|
|
- this.activeIndex_ = e.currentTarget.id
|
|
|
-
|
|
|
- let id = e.currentTarget.id
|
|
|
- this.region = id==0 ? '' : this.regions[id]
|
|
|
- this.start = 0
|
|
|
- console.log('region::',this.region)
|
|
|
+ this.activeIndex_ = e.currentTarget.id;
|
|
|
+
|
|
|
+ let id = e.currentTarget.id;
|
|
|
+ this.region = id == 0 ? '' : this.regions[id];
|
|
|
+ this.start = 0;
|
|
|
+ console.log('region::', this.region);
|
|
|
let queryData = {
|
|
|
batch_id: this.batch_id,
|
|
|
subject_id: this.subject_id,
|
|
|
- region: id==0 ? '' : this.regions[id],
|
|
|
+ region: id == 0 ? '' : this.regions[id],
|
|
|
start: 0,
|
|
|
limit: 20,
|
|
|
...this.loc
|
|
|
+ };
|
|
|
+ let fetchData = await fetchCinemas(queryData);
|
|
|
+ this.total = fetchData.data.total;
|
|
|
+
|
|
|
+ console.log(queryData.limit, queryData.start, this.total, queryData.limit + queryData.start <= this.total);
|
|
|
+ if (queryData.limit + queryData.start <= this.total) {
|
|
|
+ this.isMax = false;
|
|
|
+ } else {
|
|
|
+ this.isMax = true;
|
|
|
}
|
|
|
- let fetchData = await fetchCinemas(queryData)
|
|
|
- this.total = fetchData.data.total
|
|
|
|
|
|
- console.log(
|
|
|
- queryData.limit,queryData.start,this.total,
|
|
|
- queryData.limit + queryData.start <= this.total
|
|
|
- )
|
|
|
- if(queryData.limit + queryData.start <= this.total){
|
|
|
- this.isMax = false
|
|
|
- } else{
|
|
|
- this.isMax = true
|
|
|
- }
|
|
|
-
|
|
|
- this.Data.cinemas = fetchData.data.cinemas
|
|
|
+ this.Data.cinemas = fetchData.data.cinemas;
|
|
|
// this.fetchData(0, 20)
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
},
|
|
|
// 点击其它区域隐藏
|
|
|
handleClickScroller() {
|
|
|
- this.onMore = false
|
|
|
+ this.onMore = false;
|
|
|
// if (this.curStatus == 0) return;
|
|
|
// this.curStatus = 0
|
|
|
// this.cinemas__nav__item = 'cinemas__nav__item'
|
|
|
},
|
|
|
- goToSelectCity(){
|
|
|
- let batch_id = this.batch_id
|
|
|
- let url = `/pages/locoation/locoation?batch_id=${batch_id}&loc=choose`
|
|
|
+ goToSelectCity() {
|
|
|
+ let batch_id = this.batch_id;
|
|
|
+ let url = `/pages/locoation/locoation?batch_id=${batch_id}&loc=choose`;
|
|
|
wx.navigateTo({
|
|
|
url
|
|
|
});
|
|
|
},
|
|
|
goToitem(e) {
|
|
|
- let batch_id = this.batch_id
|
|
|
- let cinema_id = !!e.target.dataset.cinema_id ? e.target.dataset.cinema_id : ''
|
|
|
- let subject_id = !!e.target.dataset.subject_id ? `&subject_id=${e.target.dataset.subject_id}` : ''
|
|
|
+ let batch_id = this.batch_id;
|
|
|
+ let cinema_id = !!e.target.dataset.cinema_id ? e.target.dataset.cinema_id : '';
|
|
|
+ let subject_id = !!e.target.dataset.subject_id ? `&subject_id=${e.target.dataset.subject_id}` : '';
|
|
|
|
|
|
- let subject_id_ = !!this.subject_id ? `&subject_id=${this.subject_id}` : ''
|
|
|
- let conpon_kind = !!this.conpon_kind ? `&conpon_kind=${this.conpon_kind}` : ''
|
|
|
+ let subject_id_ = !!this.subject_id ? `&subject_id=${this.subject_id}` : '';
|
|
|
+ let coupon_type = !!this.coupon_type ? `&coupon_type=${this.coupon_type}` : '';
|
|
|
|
|
|
- let usable_num = this.usable_num
|
|
|
- let subjectOnly = !!this.subject_id ? `&subjectOnly=0` : 's'
|
|
|
- let urlMovie = `/pages/moviedetails/moviedetails?batch_id=${batch_id}${conpon_kind}${subject_id}&subject_info=1&usable_num=${usable_num}`
|
|
|
- let urlCinema = `/pages/session/session?batch_id=${batch_id}${conpon_kind}&cinema_id=${cinema_id}${subject_id_}&usable_num=${usable_num}${subjectOnly}`
|
|
|
-
|
|
|
- wx.navigateTo({
|
|
|
- url: this.activeIndex==1 ? urlCinema : urlMovie
|
|
|
- })
|
|
|
- },
|
|
|
- }
|
|
|
- // 获取影片列表
|
|
|
- async fetchDataMovies(show){
|
|
|
+ let usable_num = this.usable_num;
|
|
|
+ let subjectOnly = !!this.subject_id ? `&subjectOnly=0` : 's';
|
|
|
+ let urlMovie = `/pages/moviedetails/moviedetails?batch_id=${batch_id}${coupon_type}${subject_id}&subject_info=1&usable_num=${usable_num}`;
|
|
|
+ let urlCinema = `/pages/session/session?batch_id=${batch_id}${coupon_type}&cinema_id=${cinema_id}${subject_id_}&usable_num=${usable_num}${subjectOnly}`;
|
|
|
|
|
|
+ wx.navigateTo({
|
|
|
+ url: this.activeIndex == 1 ? urlCinema : urlMovie
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // 获取影片列表
|
|
|
+ async fetchDataMovies(show) {
|
|
|
+ console.log(this.$parent.globalData);
|
|
|
let current_city = this.$parent.globalData.location.current_city,
|
|
|
choose_city = this.$parent.globalData.location.choose_city,
|
|
|
- choose_city1 = !!current_city ? {lat:current_city.lat, lng:current_city.lng, ...choose_city} : choose_city
|
|
|
- let locateFail = this.locateFail
|
|
|
- this.loc = choose_city ? choose_city1 : current_city
|
|
|
- this.nav[0] = !!this.loc ? this.loc.city : '城市选择'
|
|
|
- this.$apply()
|
|
|
-
|
|
|
- if(locateFail !=null && !!locateFail){
|
|
|
- return
|
|
|
+ choose_city1 = !!current_city
|
|
|
+ ? {
|
|
|
+ lat: current_city.lat,
|
|
|
+ lng: current_city.lng,
|
|
|
+ ...choose_city
|
|
|
+ }
|
|
|
+ : choose_city;
|
|
|
+ let locateFail = this.locateFail;
|
|
|
+ this.loc = choose_city ? choose_city1 : current_city;
|
|
|
+ this.nav[0] = !!this.loc ? this.loc.city : '城市选择';
|
|
|
+ this.$apply();
|
|
|
+
|
|
|
+ if (locateFail != null && !!locateFail) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- let data = {
|
|
|
- batch_id: this.batch_id,
|
|
|
- ...this.loc
|
|
|
- }
|
|
|
-
|
|
|
- let fetchData = await fetchMovies(data)
|
|
|
+ let fetchData = await fetchMovies(this.loc.id, this.couponId);
|
|
|
|
|
|
- this.DataMovies = fetchData.data
|
|
|
+ this.DataMovies = { subjects: fetchData };
|
|
|
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
// 获取影院列表
|
|
|
- async fetchData(start, limit, show){
|
|
|
-
|
|
|
+ async fetchData(start, limit, show) {
|
|
|
let current_city = this.$parent.globalData.location.current_city,
|
|
|
choose_city = this.$parent.globalData.location.choose_city,
|
|
|
- choose_city1 = !!current_city ? {lat:current_city.lat, lng:current_city.lng, ...choose_city} : choose_city
|
|
|
- let locateFail = this.locateFail
|
|
|
- this.loc = choose_city ? choose_city1 : current_city
|
|
|
- this.nav[0] = !!this.loc ? this.loc.city : '城市选择'
|
|
|
- if(locateFail !=null && !!locateFail){
|
|
|
- return
|
|
|
+ choose_city1 = !!current_city
|
|
|
+ ? {
|
|
|
+ lat: current_city.lat,
|
|
|
+ lng: current_city.lng,
|
|
|
+ ...choose_city
|
|
|
+ }
|
|
|
+ : choose_city;
|
|
|
+ let locateFail = this.locateFail;
|
|
|
+ this.loc = choose_city ? choose_city1 : current_city;
|
|
|
+ this.nav[0] = !!this.loc ? this.loc.city : '城市选择';
|
|
|
+ if (locateFail != null && !!locateFail) {
|
|
|
+ return;
|
|
|
}
|
|
|
let data = {
|
|
|
batch_id: this.batch_id,
|
|
|
@@ -337,133 +343,123 @@ export default class Cinemas extends wepy.page {
|
|
|
start: start,
|
|
|
limit: limit,
|
|
|
...this.loc
|
|
|
+ };
|
|
|
+ this.$apply();
|
|
|
+ let fetchData = await fetchCinemas(data);
|
|
|
+
|
|
|
+ if (!!this.Data && !show) {
|
|
|
+ this.Data.cinemas = [...this.Data.cinemas, ...fetchData.data.cinemas];
|
|
|
+ } else {
|
|
|
+ this.Data = fetchData.data;
|
|
|
}
|
|
|
- this.$apply()
|
|
|
- let fetchData = await fetchCinemas(data)
|
|
|
-
|
|
|
- if(!!this.Data && !show){
|
|
|
- this.Data.cinemas = [
|
|
|
- ...this.Data.cinemas,
|
|
|
- ...fetchData.data.cinemas,
|
|
|
- ]
|
|
|
- } else{
|
|
|
- this.Data = fetchData.data
|
|
|
- }
|
|
|
- if(!!fetchData.data){
|
|
|
- this.start = fetchData.data.start
|
|
|
- this.limit = fetchData.data.limit
|
|
|
- this.total = fetchData.data.total
|
|
|
+ if (!!fetchData.data) {
|
|
|
+ this.start = fetchData.data.start;
|
|
|
+ this.limit = fetchData.data.limit;
|
|
|
+ this.total = fetchData.data.total;
|
|
|
}
|
|
|
|
|
|
- this.regions = fetchData.data.regions ? ['不限区域', ...fetchData.data.regions] : ['不限区域']
|
|
|
- let timestamp = Date.parse(new Date())
|
|
|
- let expiration = timestamp + 7200000
|
|
|
- wx.setStorageSync('data_location', this.curCity)
|
|
|
- wx.setStorageSync('data_location_expiration', expiration)
|
|
|
+ this.regions = fetchData.data.regions ? ['不限区域', ...fetchData.data.regions] : ['不限区域'];
|
|
|
+ let timestamp = Date.parse(new Date());
|
|
|
+ let expiration = timestamp + 7200000;
|
|
|
+ wx.setStorageSync('data_location', this.curCity);
|
|
|
+ wx.setStorageSync('data_location_expiration', expiration);
|
|
|
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
async onLoad(options) {
|
|
|
- this.conpon_kind = options.conpon_kind
|
|
|
- this.batch_id = options.batch_id
|
|
|
- this.subject_id = options.subject_id
|
|
|
- this.cinema_id = options.cinema_id
|
|
|
- this.usable_num = options.usable_num
|
|
|
-
|
|
|
- let timestamp = Date.parse(new Date())
|
|
|
- let expiration = wx.getStorageSync('data_location_expiration')
|
|
|
- let app_data = wx.getStorageSync('data_location')
|
|
|
-
|
|
|
- if( !!this.subject_id && (this.cinema_id == null || this.cinema_id > 1)){
|
|
|
- this.onlyCinem = true
|
|
|
- this.activeIndex = 1
|
|
|
- } else{
|
|
|
- this.onlyCinem = false
|
|
|
- this.activeIndex = 0
|
|
|
+ this.coupon_type = options.coupon_type;
|
|
|
+ this.batch_id = options.batch_id;
|
|
|
+ this.subject_id = options.subject_id;
|
|
|
+ this.cinema_id = options.cinema_id;
|
|
|
+ this.usable_num = options.usable_num;
|
|
|
+
|
|
|
+ let timestamp = Date.parse(new Date());
|
|
|
+ let expiration = wx.getStorageSync('data_location_expiration');
|
|
|
+ let app_data = wx.getStorageSync('data_location');
|
|
|
+
|
|
|
+ if (!!this.subject_id && (this.cinema_id == null || this.cinema_id > 1)) {
|
|
|
+ this.onlyCinem = true;
|
|
|
+ this.activeIndex = 1;
|
|
|
+ } else {
|
|
|
+ this.onlyCinem = false;
|
|
|
+ this.activeIndex = 0;
|
|
|
}
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
- async onShow(){
|
|
|
- let system = await wepy.getSystemInfo()
|
|
|
- this.sliderLeft = system.windowWidth / 12
|
|
|
+ async onShow() {
|
|
|
+ let system = await wepy.getSystemInfo();
|
|
|
+ this.sliderLeft = system.windowWidth / 12;
|
|
|
|
|
|
- if(this.$parent.globalData.loc == 'choose' && this.$parent.globalData.From == 'lockoation'){
|
|
|
- this.region = ''
|
|
|
- this.start = 0
|
|
|
+ if (this.$parent.globalData.loc == 'choose' && this.$parent.globalData.From == 'lockoation') {
|
|
|
+ this.region = '';
|
|
|
+ this.start = 0;
|
|
|
// this.nav[1] = '区域选择'
|
|
|
// this.activeIndex = 1
|
|
|
- this.$apply()
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
- let choose_city = this.$parent.globalData.location.choose_city
|
|
|
+ let choose_city = this.$parent.globalData.location.choose_city;
|
|
|
let start = this.start,
|
|
|
limit = this.limit,
|
|
|
- total = this.total
|
|
|
+ total = this.total;
|
|
|
|
|
|
- let locateFail = this.locateFail = this.$parent.globalData.locateFail
|
|
|
+ let locateFail = (this.locateFail = this.$parent.globalData.locateFail);
|
|
|
|
|
|
// console.log(':::',this.$parent.globalData.locateFail)
|
|
|
// 由排期页返回时不加载数据
|
|
|
- if(this.$parent.globalData.From == 'session'){
|
|
|
+ if (this.$parent.globalData.From == 'session') {
|
|
|
setTimeout(() => {
|
|
|
- this.$parent.globalData.From = ''
|
|
|
- console.log(this.$parent.globalData.From )
|
|
|
- this.$apply()
|
|
|
+ this.$parent.globalData.From = '';
|
|
|
+ console.log(this.$parent.globalData.From);
|
|
|
+ this.$apply();
|
|
|
}, 500);
|
|
|
}
|
|
|
- if(this.$parent.globalData.From != 'session'){
|
|
|
-
|
|
|
+ if (this.$parent.globalData.From != 'session') {
|
|
|
// 首页入口时-定位失败时
|
|
|
- if(locateFail !=null){
|
|
|
-
|
|
|
- if(this.activeIndex == 0){
|
|
|
- this.fetchDataMovies('show')
|
|
|
- }else{
|
|
|
- this.fetchData(start, limit, 'show')
|
|
|
+ if (locateFail != null) {
|
|
|
+ if (this.activeIndex == 0) {
|
|
|
+ this.fetchDataMovies('show');
|
|
|
+ } else {
|
|
|
+ this.fetchData(start, limit, 'show');
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
// 首页入口时-定位成功时
|
|
|
// !!this.$parent.globalData.location.current_city && this.fetchData(start, limit, 'show')
|
|
|
-
|
|
|
+
|
|
|
// 非首页入口时
|
|
|
- this.$parent.observable.on("location",
|
|
|
- async ()=>{
|
|
|
- let locateFail = this.locateFail = await this.$parent.globalData.locateFail
|
|
|
- this.$apply()
|
|
|
- if(this.activeIndex == 0){
|
|
|
- this.fetchDataMovies('show')
|
|
|
- } else{
|
|
|
-
|
|
|
- this.fetchData(start, limit, 'show')
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$parent.observable.on('location', async () => {
|
|
|
+ let locateFail = (this.locateFail = await this.$parent.globalData.locateFail);
|
|
|
+ this.$apply();
|
|
|
+ if (this.activeIndex == 0) {
|
|
|
+ this.fetchDataMovies('show');
|
|
|
+ } else {
|
|
|
+ this.fetchData(start, limit, 'show');
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 上拉加载
|
|
|
async lower(e) {
|
|
|
-
|
|
|
- if( !!this.lowerLoader || !!this.isMax ){
|
|
|
- return
|
|
|
+ if (!!this.lowerLoader || !!this.isMax) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (this.limit + this.start <= this.total) {
|
|
|
- await this.fetchData(this.limit + this.start, this.limit)
|
|
|
- this.lowerLoader = true
|
|
|
- }else{
|
|
|
- this.isMax = true
|
|
|
- this.lowerLoader = false
|
|
|
- return
|
|
|
+ await this.fetchData(this.limit + this.start, this.limit);
|
|
|
+ this.lowerLoader = true;
|
|
|
+ } else {
|
|
|
+ this.isMax = true;
|
|
|
+ this.lowerLoader = false;
|
|
|
+ return;
|
|
|
}
|
|
|
- setTimeout( () => {
|
|
|
- this.lowerLoader = false
|
|
|
- }, 100 )
|
|
|
- this.$apply()
|
|
|
-
|
|
|
+ setTimeout(() => {
|
|
|
+ this.lowerLoader = false;
|
|
|
+ }, 100);
|
|
|
+ this.$apply();
|
|
|
}
|
|
|
async onReachBottom(e) {
|
|
|
- await this.lower(e)
|
|
|
+ await this.lower(e);
|
|
|
}
|
|
|
}
|
|
|
</script>
|