浏览代码

卡券复制 & 影院场次排序

DaMowang 2 年之前
父节点
当前提交
0a866ff00e

+ 0 - 1
src/components/uqrcode/uqrcode.vue

@@ -40,7 +40,6 @@ export default {
     },
   },
   mounted() {
-    // this.createCode();
     if(this.code) this.createCode(this.code);
   },
   watch: {},

+ 61 - 53
src/pagesB/cinema/choiceMovie.vue

@@ -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;
         }

+ 8 - 10
src/pagesB/cinema/cinemaTicket.vue

@@ -23,12 +23,12 @@
                     <swiper class="swiper" circular>
                         <swiper-item v-for="(i,s) in ticket.ticketCode" :key="s">
                             <block v-for="(a,b) in i.code" :key="b" v-show="a.text=='取票码'">
-                                <Uqrcode ref="uqcode" :code="a.value" :size="150" :class="{'code-img':true,opacity:HaveBeenShown}" />
+                                <Uqrcode ref="uqcode" :code="a.value" :size="150" :class="['code-img',HaveBeenShown?'opacity':'']" />
                                 <div class="ticketCode">取票码:<span class="dinB">{{ a.value }}</span></div>
-                                <span class="ico" v-if="HaveBeenShown">已放映</span>
                             </block>
                         </swiper-item>
                     </swiper>
+                    <span class="ico" v-show="HaveBeenShown">已放映</span>
                 </div>
                 <div class="await" v-else-if="ticket.orderStatus=='DEALING'">
                     <img class="await_img" src="http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/416c89124df9a69bb1cbfb55b1007b086031a57fpng" alt="">
@@ -120,10 +120,11 @@ export default {
             post("local/orderMovie", da).then(res => {
                 if (res.code == 0) {
                     if (res.data.detail.code == 200) {
-                        this.ticket = res.data.detail.data
-                        this.HaveBeenShown = this.$day().unix() > this.$day(this.ticket.showTime).unix()
+                        this.ticket = res.data.detail.data;
+                        let bo = this.$day().unix() > this.$day(this.ticket.showTime).add(2, 'h').unix();
+                        this.$set(this,"HaveBeenShown",bo);
                     }
-                    let da = res.data.order
+                    let da = res.data.order;
                     if (da) {
                         let arr = JSON.parse(da.product_detail)
                         let obj = {
@@ -173,9 +174,7 @@ export default {
         this.pda = da;
         this.getTicket(da)
     },
-    onShow() {
-        // this.$refs.uqcode.createCode("kjsdgkhg");
-    },
+    onShow() {},
     mounted() {},
 };
 </script>
@@ -192,7 +191,6 @@ export default {
     .head_tit {
         font-size: 28rpx;
         padding: 25rpx 28rpx;
-        // background-color: rgba($color: #000, $alpha: 0.05);
     }
 
     .head_con {
@@ -255,7 +253,7 @@ export default {
         font-weight: bold;
         position: absolute;
         left: calc(50% - 65rpx);
-        top: 130rpx;
+        top: 210rpx;
     }
     .await{
         text-align: center;

+ 3 - 1
src/pagesB/cinema/confirmOrder.vue

@@ -94,7 +94,9 @@ export default {
                 cinemaId: this.cinemaInfo.restaurant_id,
                 showId: this.OrderDa.s.showId,
                 phone: this.userinfo.mobile,
-                showInfor: JSON.stringify(ar)
+                showInfor: JSON.stringify(ar),
+                movieName: this.OrderDa.m.movieName,
+                posterUrl: this.OrderDa.m.posterUrl
             }
             post("local/cinemaOrder", da).then(res => {
                 if (res.code == 0 && res.data.prepayid) {

+ 15 - 3
src/pagesB/directCharge/orderDetail.vue

@@ -7,9 +7,18 @@
         <div class="card qupiao" v-if="detail.order_no">
             <uqrcode ref="uqcode" v-if="[0,2].includes(detail.card_type)" :code="detail.unique_code" class="code-img" :size="150" />
             <tki-barcode v-if="[1,2].includes(detail.card_type)" :val="detail.unique_code" />
-            <p @click="copyText(detail.card_no)" v-if="detail.card_no">卡号:{{ detail.card_no }}</p>
-            <p @click="copyText(detail.card_pwd)" v-if="detail.card_pwd">卡密:{{ detail.card_pwd }}</p>
-            <p @click="copyText(detail.link_url)" v-if="detail.link_url">卡券链接:{{detail.link_url}}</p>
+            <p @click="copyText(detail.card_no)" v-if="detail.card_no">
+                <span>卡号:{{ detail.card_no }}</span>
+                <span class="iconfont ico">&#xe602;</span>
+            </p>
+            <p @click="copyText(detail.card_pwd)" v-if="detail.card_pwd">
+                <span>卡密:{{ detail.card_pwd }}</span>
+                <span class="iconfont ico">&#xe602;</span>
+            </p>
+            <p @click="copyText(detail.link_url)" v-if="detail.link_url">
+                <span>卡券链接:{{detail.link_url}}</span>
+                <span class="iconfont ico">&#xe602;</span>
+            </p>
         </div>
         <div class="money card" v-if="order.type==2">
             <div class="li flex_r flex_jb">
@@ -152,6 +161,9 @@ export default {
         justify-content: center;
         margin: 0 auto;
     }
+    .ico{
+        float: right;
+    }
 }
 .card {
     background-color: #fff;

+ 2 - 2
src/utils/myfun.js

@@ -116,8 +116,8 @@ let compareAsc = (propertyName) => {
 }
 // json排序
 export function Desc(arr = [], key = "id") {
-    arr.sort(compareDesc(key));
+    return arr.sort(compareDesc(key));
 }
 export function Asc(arr = [], key = "id") {
-    arr.sort(compareAsc(key));
+    return arr.sort(compareAsc(key));
 }