|
|
@@ -58,13 +58,14 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import swipers from '@/pagesB/components/u-swiper.vue'
|
|
|
+import { Desc, Asc } from "@/utils/myfun.js"
|
|
|
import { post } from "@/request/api.js";
|
|
|
export default {
|
|
|
components: { swipers },
|
|
|
data() {
|
|
|
return {
|
|
|
- movieList: [], //选中的电影
|
|
|
- chooseMovice: {}, //swiper默认选中
|
|
|
+ movieList: [], //选中的电影
|
|
|
+ chooseMovice: {}, //swiper默认选中
|
|
|
swiperCurrent: 0,
|
|
|
|
|
|
tabIndexs: 0,
|
|
|
@@ -77,59 +78,65 @@ export default {
|
|
|
},
|
|
|
onLoad(da) {
|
|
|
this.cinemaInfo = uni.getStorageSync("cinemaItem");
|
|
|
- this.getlists(da)
|
|
|
+ this.getlists(da)
|
|
|
},
|
|
|
methods: {
|
|
|
- // 获取场次
|
|
|
+ // 获取场次
|
|
|
getlists(da) {
|
|
|
post("local/getPreferential", da).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
let da = res.data.data
|
|
|
- let arr = [], obj = {};
|
|
|
- for (let it of da.showInfor) {
|
|
|
- if(!arr.includes(it.movieId)) {
|
|
|
- arr.push(it.movieId)
|
|
|
- obj[it.movieId] = [];
|
|
|
- }
|
|
|
- obj[it.movieId].push(it);
|
|
|
- }
|
|
|
- for (let i in obj) {
|
|
|
- let ar = [], ob = {};
|
|
|
- for (let b of obj[i]) {
|
|
|
- let tim = b.showTime.slice(5,10);
|
|
|
- if(!ar.includes(tim)) {
|
|
|
- ar.push(tim)
|
|
|
- ob[tim] = [];
|
|
|
- }
|
|
|
- ob[tim].push(b);
|
|
|
- }
|
|
|
- let ar2 = []
|
|
|
- for (let c in ob) {
|
|
|
- ar2.push({ time: c, list: ob[c] })
|
|
|
- }
|
|
|
- obj[i] = ar2
|
|
|
- }
|
|
|
+ let arr = [],
|
|
|
+ obj = {};
|
|
|
+ for (let it of da.showInfor) {
|
|
|
+ if (!arr.includes(it.movieId)) {
|
|
|
+ arr.push(it.movieId)
|
|
|
+ obj[it.movieId] = [];
|
|
|
+ }
|
|
|
+ obj[it.movieId].push(it);
|
|
|
+ }
|
|
|
+ for (let i in obj) {
|
|
|
+ let ar = [],
|
|
|
+ ob = {};
|
|
|
+ for (let b of obj[i]) {
|
|
|
+ let tim = b.showTime.slice(5, 10);
|
|
|
+ if (!ar.includes(tim)) {
|
|
|
+ ar.push(tim)
|
|
|
+ ob[tim] = [];
|
|
|
+ }
|
|
|
+ ob[tim].push(b);
|
|
|
+ }
|
|
|
+ let ar2 = []
|
|
|
+ for (let c in ob) {
|
|
|
+ ar2.push({ time: c, list: ob[c] })
|
|
|
+ }
|
|
|
+ obj[i] = ar2
|
|
|
+ }
|
|
|
let movies = uni.getStorageSync("movies")
|
|
|
- let MS = []
|
|
|
- for (let m of movies) {
|
|
|
- if(arr.includes(m.movieId)) MS.unshift(m)
|
|
|
- }
|
|
|
- this.movieList = MS
|
|
|
- this.chooseMovice = this.movieList[0]
|
|
|
- this.tabLists = obj[this.chooseMovice.movieId];
|
|
|
- this.timeList = this.tabLists[0].list
|
|
|
- this.allPreferential = obj
|
|
|
+ let MS = []
|
|
|
+ for (let m of movies) {
|
|
|
+ if (arr.includes(m.movieId)) MS.unshift(m)
|
|
|
+ }
|
|
|
+ this.movieList = MS;
|
|
|
+ this.chooseMovice = this.movieList[0];
|
|
|
+ this.tabLists = Asc(obj[this.chooseMovice.movieId], "time");
|
|
|
+ this.timeList = Asc(this.tabLists[0].list, "showTime");
|
|
|
+ this.allPreferential = obj;
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- openm(){
|
|
|
+ openm() {
|
|
|
let latitude = parseFloat(this.cinemaInfo.latitude);
|
|
|
let longitude = parseFloat(this.cinemaInfo.longitude);
|
|
|
let name = this.cinemaInfo.restaurant_name;
|
|
|
let address = this.cinemaInfo.restaurant_address;
|
|
|
uni.openLocation({
|
|
|
- latitude, longitude, scale: 18, name, address,
|
|
|
- success: function () {
|
|
|
+ latitude,
|
|
|
+ longitude,
|
|
|
+ scale: 18,
|
|
|
+ name,
|
|
|
+ address,
|
|
|
+ success: function() {
|
|
|
console.log('success');
|
|
|
}
|
|
|
});
|
|
|
@@ -139,27 +146,27 @@ export default {
|
|
|
setBackground(index) {
|
|
|
this.swiperCurrent = index;
|
|
|
this.chooseMovice = this.movieList[index];
|
|
|
- this.tabLists = this.allPreferential[this.chooseMovice.movieId];
|
|
|
- this.timeList = this.tabLists[0].list;
|
|
|
+ this.tabLists = Asc(this.allPreferential[this.chooseMovice.movieId], "time");
|
|
|
+ this.timeList = Asc(this.tabLists[0].list, "showTime");
|
|
|
this.tabIndexs = 0;
|
|
|
},
|
|
|
- getTimeTab(data,index){
|
|
|
- if(this.tabIndexs!=index){
|
|
|
- this.tabIndexs=index
|
|
|
- this.timeList = data.list
|
|
|
- }
|
|
|
+ getTimeTab(data, index) {
|
|
|
+ if (this.tabIndexs != index) {
|
|
|
+ this.tabIndexs = index
|
|
|
+ this.timeList = Asc(data.list, "showTime")
|
|
|
+ }
|
|
|
},
|
|
|
getGou(data) {
|
|
|
- uni.setStorageSync("SeatInfo",data);
|
|
|
- uni.setStorageSync("chooseMovice",this.chooseMovice);
|
|
|
- this.goto("/pagesB/cinema/selectSeat",{showId:data.showId})
|
|
|
+ uni.setStorageSync("SeatInfo", data);
|
|
|
+ uni.setStorageSync("chooseMovice", this.chooseMovice);
|
|
|
+ this.goto("/pagesB/cinema/selectSeat", { showId: data.showId })
|
|
|
},
|
|
|
province(original, price) {
|
|
|
let val = original - price
|
|
|
return Math.floor(val * 100) / 100
|
|
|
},
|
|
|
|
|
|
- tim(str){
|
|
|
+ tim(str) {
|
|
|
return this.$day(str).format("HH:mm")
|
|
|
}
|
|
|
}
|
|
|
@@ -225,7 +232,7 @@ page {
|
|
|
.movie-position {
|
|
|
padding: 30rpx 32rpx;
|
|
|
|
|
|
- .position-item{
|
|
|
+ .position-item {
|
|
|
width: calc(100% - 80rpx);
|
|
|
}
|
|
|
|
|
|
@@ -332,7 +339,8 @@ page {
|
|
|
color: #EB5A5F;
|
|
|
font-size: 38rpx;
|
|
|
font-weight: bold;
|
|
|
- &::before{
|
|
|
+
|
|
|
+ &::before {
|
|
|
content: "¥";
|
|
|
font-size: 28rpx;
|
|
|
}
|