ouzhui 2 years ago
parent
commit
ce9c8fc24c
1 changed files with 355 additions and 345 deletions
  1. 355 345
      src/pages/info/index.vue

+ 355 - 345
src/pages/info/index.vue

@@ -1,346 +1,356 @@
-<template>
-  <view class="body">
-    <view class="content">
-      <view class="item">
-        <view class="item-left">
-          <img :src="infoData.cover" class="item-img" />
-        </view>
-        <view class="item-right">
-          <view class="item-right-title">
-            <span class="title">{{ infoData.name }}</span>
-            <span class="red">{{ infoData.price }}</span>
-          </view>
-          <view class="item-right-text">{{ orderData.desc }}</view>
-          <view class="item-right-text-small">
-            <span>售票类型:成人/儿童</span>
-            <span>售票人数:{{ infoData.sell_num }}</span>
-          </view>
-          <view class="item-right-text-small">
-            <span>剩余票量: {{ newNum }}</span>
-            <span></span>
-          </view>
-          <view class="item-right-text" style="font-size:12px;color:#666368;">
-            <span>{{ infoData.desc }}</span>
-          </view>
-        </view>
-      </view>
-      <view class="title">预约时间</view>
-      <timeCheck
-        :dateList="dateList"
-        :timeList="timeList"
-        @getFilmScreen="getFilmScreen"
-        @setCheck="setCheck"
-      />
-      <view class="title">购票人信息</view>
-      <buyMan
-        @setManNum="setManNum"
-        @setChildNum="setChildNum"
-        @setTel="setTel"
-        @setRemake="setRemake"
-        @setCode="setCode"
-      />
-      <view class="title">购票须知</view>
-      <buyInfo :Direction="Direction" />
-    </view>
-
-    <view class="bottom-btn">
-      <!-- <span class="money">实付款:¥{{ checkData.price_total }}</span> -->
-      <span class="bottom-btn-dom" @click="goToBuy">立即下单</span>
-    </view>
-  </view>
-</template>
-
-<script>
-import timeCheck from "../../components/order-info-timeCheck.vue";
-import buyInfo from "../../components/order-info-buy.vue";
-import buyMan from "../../components/order-info-man.vue";
-import Request from "../../share/http";
-import MakeDate from "../../share/date";
-import Calc from "../../share/calculation";
-export default {
-  components: {
-    timeCheck,
-    buyInfo,
-    buyMan,
-  },
-  data() {
-    return {
-      infoData: {},
-      // 可选择日期
-      dateList: [],
-      // 可选时间
-      timeList: [],
-      // 电影id
-      id: "",
-      // 影评页数
-      page: 1,
-      // 影评每页数量
-      page_num: 10,
-
-      // 生成订单使用的数据
-      checkData: {
-        s_id: "", // 电影场次id
-        f_id: "", // 电影id
-        price_total: "", // 订单金额
-        total_num: 0, // 票总数
-        children_num: 0, // 儿童票数
-        children_price: 0, // 儿童票价
-        tel: "", // 预留电话
-        remark: "", // 备注
-        discount_code: "", // 优惠码
-      },
-
-      // 是否可以提交
-      isOk: false,
-      // 提示信息
-      Direction: {},
-      // 当前总票数
-      newNum: "",
-      // 提交
-      isPush: true,
-    };
-  },
-  onLoad(e) {
-    this.id = e.id;
-    this.checkData.f_id = e.id;
-    this.dateList = MakeDate();
-    // 后期改成 async await
-    this.getFilmInfo();
-    this.getFilmScreen(this.dateList[0].date);
-    this.getInfo();
-  },
-  methods: {
-    // 获取购票须知和使用说明
-    getInfo: function() {
-      let _this = this;
-      Request({
-        url: "/api/Filmmanage/getSysDirection",
-      }).then((res) => {
-        _this.Direction = res.data;
-      });
-    },
-    // 设置优惠码
-    setCode: function(value) {
-      console.log(value);
-      this.checkData.discount_code = value;
-    },
-    // 设置备注
-    setRemake: function(value) {
-      this.checkData.remark = value;
-    },
-    // 设置联系电话
-    setTel: function(value) {
-      console.log(value);
-      this.checkData.tel = value;
-    },
-    // 设置成人票数
-    setManNum: function(num) {
-      this.checkData.total_num += num;
-    },
-    // 设置成人票数
-    setChildNum: function(num) {
-      this.checkData.children_num += num;
-      this.checkData.total_num += num;
-    },
-    // 选择场次id
-    setCheck(data) {
-      console.log(data);
-      this.checkData.s_id = data.id;
-      this.infoData.price = data.price;
-      this.newNum = data.num;
-    },
-    // 获取详情
-    getFilmInfo: function() {
-      let _this = this;
-      Request({
-        url: "/api/Filmmanage/getFilmInfo",
-        data: {
-          id: _this.id,
-        },
-        method: "GET",
-      }).then((res) => {
-        if (res.code === 1) {
-          this.infoData = res.data;
-        }
-      });
-    },
-    // 获取场次
-    getFilmScreen: function(date) {
-      let arr = date.split(".");
-      let m = arr[0] > 9 ? arr[0] : "0" + arr[0];
-      let d = arr[1] > 9 ? arr[1] : "0" + arr[1];
-      let time = new Date().getFullYear() + "-" + m + "-" + d;
-      let _this = this;
-      Request({
-        url: "/api/Filmmanage/getFilmScreen",
-        data: {
-          f_id: _this.id,
-          time: time,
-        },
-        method: "GET",
-      }).then((res) => {
-        _this.timeList = res.data.list;
-        _this.newNum = res.data.total_surplus;
-      });
-    },
-    //  点击购买
-    goToBuy: function() {
-      console.log(this.checkData);
-      if (!this.isPush) {
-        return false;
-      }
-      let _this = this;
-      Calc.getPrice(
-        this.checkData.total_num,
-        this.checkData.children_num,
-        this.infoData.price
-      )
-        .then((res) => {
-          _this.checkData.children_price = res.children_price;
-          _this.checkData.price_total = res.price_total;
-          Request({
-            url: "/api/Order/createOrder",
-            data: _this.checkData,
-            method: "POST",
-          }).then((res) => {
-            this.isPush = true;
-            if (res.code === 1) {
-              uni.navigateTo({
-                url: "/pages/buy/index?id=" + res.data.id,
-              });
-            }
-          });
-        })
-        .catch((err) => {
-          this.isPush = true;
-        });
-    },
-  },
-};
-</script>
-
-<style scoped>
-.content {
-  padding: 0 20px;
-  background-color: #f8f8f8;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: flex-start;
-  height: 92vh;
-  overflow: hidden;
-  overflow-y: scroll;
-}
-.item {
-  background-color: #ffffff;
-  margin: 20px 0 10px 0;
-  border-radius: 5px;
-  padding: 10px 10px;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
-  width: 95%;
-}
-.item-left {
-  width: 30%;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-}
-.item-img {
-  height: 105px;
-  width: 80px;
-  border-radius: 5px;
-}
-
-.item-right {
-  width: 70%;
-  display: flex;
-  flex-direction: column;
-  align-items: flex-start;
-  justify-content: flex-start;
-}
-
-/* 电影信息 */
-.item-right view {
-  width: 100%;
-  padding: 0 5px;
-}
-.item-right-title {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
-}
-.title {
-  font-size: 17px;
-  font-family: PingFang SC;
-  font-weight: 500;
-  line-height: 24px;
-}
-.red {
-  font-size: 12px;
-  font-family: DIN Alternate;
-  font-weight: bold;
-  line-height: 14px;
-  color: #ff102c;
-}
-.item-right-text {
-  font-size: 14px;
-  font-family: PingFang SC;
-  font-weight: 400;
-  line-height: 20px;
-  color: #090909;
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-}
-.item-right-text-small {
-  font-size: 12px;
-  font-family: PingFang SC;
-  font-weight: 400;
-  line-height: 17px;
-  color: #666368;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
-}
-.title {
-  width: 95%;
-  font-size: 17px;
-  font-family: PingFang SC;
-  font-weight: 500;
-  line-height: 24px;
-  color: #000000;
-}
-
-/* 立即购买按钮 */
-.money {
-  width: 60%;
-  text-align: left;
-}
-.bottom-btn {
-  height: 8vh;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: flex-end;
-}
-.bottom-btn-dom {
-  width: 30%;
-  background-color: #f78531;
-  color: #fff;
-  margin: 0 20px;
-  text-align: center;
-  height: 6vh;
-  border-radius: 30px;
-  line-height: 30px;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-}
+<template>
+	<view class="body">
+		<view class="content">
+			<view class="item">
+				<view class="item-left">
+					<img :src="infoData.cover" class="item-img" />
+				</view>
+				<view class="item-right">
+					<view class="item-right-title">
+						<span class="title">{{ infoData.name }}</span>
+						<span class="red">{{ infoData.price }}</span>
+					</view>
+					<view class="item-right-text">{{ orderData.desc }}</view>
+					<view class="item-right-text-small">
+						<span>售票类型:成人/儿童</span>
+						<span>售票人数:{{ infoData.sell_num }}</span>
+					</view>
+					<view class="item-right-text-small">
+						<span>剩余票量: {{ newNum }}</span>
+						<span></span>
+					</view>
+					<view class="item-right-text" style="font-size:12px;color:#666368;">
+						<span>{{ infoData.desc }}</span>
+					</view>
+				</view>
+			</view>
+			<view class="title">预约时间</view>
+			<timeCheck :dateList="dateList" :timeList="timeList" @getFilmScreen="getFilmScreen" @setCheck="setCheck" />
+			<view class="title">购票人信息</view>
+			<buyMan @setManNum="setManNum" @setChildNum="setChildNum" @setTel="setTel" @setRemake="setRemake" @setCode="setCode" />
+			<view class="title">购票须知</view>
+			<buyInfo :Direction="Direction" />
+		</view>
+
+		<view class="bottom-btn">
+			<!-- <span class="money">实付款:¥{{ checkData.price_total }}</span> -->
+			<span class="bottom-btn-dom" @click="goToBuy">立即下单</span>
+		</view>
+	</view>
+</template>
+
+<script>
+	import timeCheck from "../../components/order-info-timeCheck.vue";
+	import buyInfo from "../../components/order-info-buy.vue";
+	import buyMan from "../../components/order-info-man.vue";
+	import Request from "../../share/http";
+	import MakeDate from "../../share/date";
+	import Calc from "../../share/calculation";
+	export default {
+		components: {
+			timeCheck,
+			buyInfo,
+			buyMan,
+		},
+		data() {
+			return {
+				infoData: {},
+				// 可选择日期
+				dateList: [],
+				// 可选时间
+				timeList: [],
+				// 电影id
+				id: "",
+				// 影评页数
+				page: 1,
+				// 影评每页数量
+				page_num: 10,
+
+				// 生成订单使用的数据
+				checkData: {
+					s_id: "", // 电影场次id
+					f_id: "", // 电影id
+					price_total: "", // 订单金额
+					total_num: 0, // 票总数
+					children_num: 0, // 儿童票数
+					children_price: 0, // 儿童票价
+					tel: "", // 预留电话
+					remark: "", // 备注
+					discount_code: "", // 优惠码
+				},
+
+				// 是否可以提交
+				isOk: false,
+				// 提示信息
+				Direction: {},
+				// 当前总票数
+				newNum: "",
+				// 提交
+				isPush: true,
+			};
+		},
+		onLoad(e) {
+			this.id = e.id;
+			this.checkData.f_id = e.id;
+			this.dateList = MakeDate();
+			// 后期改成 async await
+			this.getFilmInfo();
+			this.getFilmScreen(this.dateList[0].date);
+			this.getInfo();
+		},
+		methods: {
+			// 获取购票须知和使用说明
+			getInfo: function() {
+				let _this = this;
+				Request({
+					url: "/api/Filmmanage/getSysDirection",
+				}).then((res) => {
+					_this.Direction = res.data;
+				});
+			},
+			// 设置优惠码
+			setCode: function(value) {
+				console.log(value);
+				this.checkData.discount_code = value;
+			},
+			// 设置备注
+			setRemake: function(value) {
+				this.checkData.remark = value;
+			},
+			// 设置联系电话
+			setTel: function(value) {
+				console.log(value);
+				this.checkData.tel = value;
+			},
+			// 设置成人票数
+			setManNum: function(num) {
+				this.checkData.total_num += num;
+			},
+			// 设置成人票数
+			setChildNum: function(num) {
+				this.checkData.children_num += num;
+				this.checkData.total_num += num;
+			},
+			// 选择场次id
+			setCheck(data) {
+				console.log(data);
+				this.checkData.s_id = data.id;
+				this.infoData.price = data.price;
+				this.newNum = data.num;
+			},
+			// 获取详情
+			getFilmInfo: function() {
+				let _this = this;
+				Request({
+					url: "/api/Filmmanage/getFilmInfo",
+					data: {
+						id: _this.id,
+					},
+					method: "GET",
+				}).then((res) => {
+					if (res.code === 1) {
+						this.infoData = res.data;
+					}
+				});
+			},
+			// 获取场次
+			getFilmScreen: function(date) {
+				let arr = date.split(".");
+				let m = arr[0] > 9 ? arr[0] : "0" + arr[0];
+				let d = arr[1] > 9 ? arr[1] : "0" + arr[1];
+				// 新加时间判断
+				var year = new Date().getFullYear() // 年
+				var month = new Date().getMonth() + 1; // 月
+				var day = new Date().getDate(); // 日
+				var time1 = year + "-" + m + "-" + d;
+				var time2 = year + "-" + month + "-" + day;
+				if(new Date(time1.replace(/-/g, "/")).getTime() < new Date(time2.replace(/-/g, "/")).getTime()){
+					year = year + 1
+					var time1 = year + "-" + m + "-" + d;
+				}
+				let time = time1
+				let _this = this;
+				Request({
+					url: "/api/Filmmanage/getFilmScreen",
+					data: {
+						f_id: _this.id,
+						time: time,
+					},
+					method: "GET",
+				}).then((res) => {
+					_this.timeList = res.data.list;
+					_this.newNum = res.data.total_surplus;
+				});
+			},
+			//  点击购买
+			goToBuy: function() {
+				console.log(this.checkData);
+				if (!this.isPush) {
+					return false;
+				}
+				let _this = this;
+				Calc.getPrice(
+						this.checkData.total_num,
+						this.checkData.children_num,
+						this.infoData.price
+					)
+					.then((res) => {
+						_this.checkData.children_price = res.children_price;
+						_this.checkData.price_total = res.price_total;
+						Request({
+							url: "/api/Order/createOrder",
+							data: _this.checkData,
+							method: "POST",
+						}).then((res) => {
+							this.isPush = true;
+							if (res.code === 1) {
+								uni.navigateTo({
+									url: "/pages/buy/index?id=" + res.data.id,
+								});
+							}
+						});
+					})
+					.catch((err) => {
+						this.isPush = true;
+					});
+			},
+		},
+	};
+</script>
+
+<style scoped>
+	.content {
+		padding: 0 20px;
+		background-color: #f8f8f8;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: flex-start;
+		height: 92vh;
+		overflow: hidden;
+		overflow-y: scroll;
+	}
+
+	.item {
+		background-color: #ffffff;
+		margin: 20px 0 10px 0;
+		border-radius: 5px;
+		padding: 10px 10px;
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: space-between;
+		width: 95%;
+	}
+
+	.item-left {
+		width: 30%;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+	}
+
+	.item-img {
+		height: 105px;
+		width: 80px;
+		border-radius: 5px;
+	}
+
+	.item-right {
+		width: 70%;
+		display: flex;
+		flex-direction: column;
+		align-items: flex-start;
+		justify-content: flex-start;
+	}
+
+	/* 电影信息 */
+	.item-right view {
+		width: 100%;
+		padding: 0 5px;
+	}
+
+	.item-right-title {
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: space-between;
+	}
+
+	.title {
+		font-size: 17px;
+		font-family: PingFang SC;
+		font-weight: 500;
+		line-height: 24px;
+	}
+
+	.red {
+		font-size: 12px;
+		font-family: DIN Alternate;
+		font-weight: bold;
+		line-height: 14px;
+		color: #ff102c;
+	}
+
+	.item-right-text {
+		font-size: 14px;
+		font-family: PingFang SC;
+		font-weight: 400;
+		line-height: 20px;
+		color: #090909;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+	}
+
+	.item-right-text-small {
+		font-size: 12px;
+		font-family: PingFang SC;
+		font-weight: 400;
+		line-height: 17px;
+		color: #666368;
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: space-between;
+	}
+
+	.title {
+		width: 95%;
+		font-size: 17px;
+		font-family: PingFang SC;
+		font-weight: 500;
+		line-height: 24px;
+		color: #000000;
+	}
+
+	/* 立即购买按钮 */
+	.money {
+		width: 60%;
+		text-align: left;
+	}
+
+	.bottom-btn {
+		height: 8vh;
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: flex-end;
+	}
+
+	.bottom-btn-dom {
+		width: 30%;
+		background-color: #f78531;
+		color: #fff;
+		margin: 0 20px;
+		text-align: center;
+		height: 6vh;
+		border-radius: 30px;
+		line-height: 30px;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+	}
 </style>