cinemaTicket.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="cinemaTicket">
  3. <template v-if="order.status != 0">
  4. <div class="head">
  5. <div class="head_tit">{{ ticket.cinemaName }}</div>
  6. <div class="head_con flex_r flex_jb">
  7. <div class="info flex_c flex_jb">
  8. <div class="cb">
  9. <p class="pt">{{ ticket.movieName }}</p>
  10. <p>{{ticket.showVersionType}} {{ ticket.amount }}张</p>
  11. </div>
  12. <div class="cb">
  13. <p>{{ ticket.showTime }} 时长{{ ticket.duration }}分钟</p>
  14. <p class="p">{{ ticket.hallName }} {{ ticket.seatInfos }}</p>
  15. </div>
  16. </div>
  17. <image class="poster" mode="aspectFill" :src="ticket.posterUrl" />
  18. </div>
  19. </div>
  20. <div class="card qupiao">
  21. <div class="tit">取电影票</div>
  22. <div class="codebar">
  23. <Uqrcode ref="uqcode" :size="150" class="code-img" />
  24. </div>
  25. </div>
  26. <div class="card detail">
  27. <div class="tit">订单详情</div>
  28. <view class="label">
  29. <view class="title">实付金额:</view>
  30. <view class="nums">¥{{ order.pay_amount }}</view>
  31. </view>
  32. <view class="label">
  33. <view class="title">订单编号:</view>
  34. <view class="nums">{{ ticket.tradeNo }}</view>
  35. </view>
  36. <view class="label">
  37. <view class="title">购买时间:</view>
  38. <view class="nums">{{ ticket.orderTime }}</view>
  39. </view>
  40. <view class="label">
  41. <view class="title">手机号码:</view>
  42. <view class="nums">{{ ticket.phoneNumber }}</view>
  43. </view>
  44. </div>
  45. </template>
  46. <template v-else>
  47. <div class="head">
  48. <div class="head_tit">{{ order.cinemaName }}</div>
  49. <div class="head_con flex_r flex_jb">
  50. <div class="info flex_c flex_jb">
  51. <p class="pt">{{ order.movieName }}</p>
  52. <p class="p">{{ order.amount }}张</p>
  53. <p class="p">原价 ¥{{ order.order_amount }}</p>
  54. <p class="p">{{ order.seatInfos }}</p>
  55. </div>
  56. <image class="poster" mode="aspectFill" :src="order.posterUrl" />
  57. </div>
  58. </div>
  59. <div class="phone card flex_r flex_jb">
  60. <span>联系方式</span>
  61. <span>{{ userinfo.mobile }}</span>
  62. </div>
  63. <div class="money card">
  64. <div class="li flex_r flex_jb">
  65. <span>消费金额</span>
  66. <span>¥{{ order.order_amount || 0 }}</span>
  67. </div>
  68. <div class="li flex_r flex_jb">
  69. <span>消费金抵扣<span class="corg">{{Integral}}%</span></span>
  70. <span class="corg">-¥{{ deduction || 0 }}</span>
  71. </div>
  72. <div class="li flex_r flex_jb">
  73. <span>实付金额</span>
  74. <span>¥{{ order.pay_amount || 0 }}</span>
  75. </div>
  76. </div>
  77. <div class="btnbar" v-if="ispay" @click="pay">立即支付
  78. <div class="msg">请在 {{ $day(order.create_time).add(15, 'm').format("YYYY-MM-DD HH:mm") }} 前完成支付</div>
  79. </div>
  80. </template>
  81. </div>
  82. </template>
  83. <script>
  84. import { ToPayOpre } from "@/utils/reqTools.js";
  85. let toPayOpre = new ToPayOpre();
  86. import Uqrcode from '@/components/uqrcode/uqrcode'
  87. import { post } from "@/request/api.js";
  88. export default {
  89. name: "cinemaTicket",
  90. props: {},
  91. components: { Uqrcode },
  92. data() {
  93. return {
  94. pda: {},
  95. ticket: {},
  96. order: {},
  97. Integral: 0,
  98. deduction: 0,
  99. userinfo: uni.getStorageSync("userinfo"),
  100. ispay: false,
  101. };
  102. },
  103. methods: {
  104. getTicket(da){
  105. post("local/orderMovie",da).then(res=>{
  106. if (res.code == 0) {
  107. if(res.data.detail.code == 200){
  108. this.ticket = res.data.detail.data
  109. }
  110. let da = res.data.order
  111. let arr = JSON.parse(da.product_detail)
  112. let obj = {
  113. trade_no: da.trade_no,
  114. cinemaName: da.restaurant_name,
  115. movieName: da.orderGoods[0].product_name,
  116. amount: da.orderGoods[0].number,
  117. posterUrl: da.orderGoods[0].product_img,
  118. seatInfos: arr.map(item => item.seatName).join(","),
  119. pay_amount: da.pay_amount,
  120. order_amount: da.order_amount,
  121. create_time: da.create_time,
  122. status: da.status
  123. }
  124. this.order = obj;
  125. this.getIntegral();
  126. this.ispay = this.$day().unix() < this.$day(this.order.create_time).add(15, 'm').unix()
  127. }
  128. })
  129. },
  130. getIntegral(){
  131. post("local/getIntegral",{type:2}).then(res=>{
  132. if (res.code == 0) {
  133. let i1 = res.data.integral;
  134. this.Integral = this.$h.Mul(i1,100);
  135. this.deduction = this.$h.Mul(this.order.order_amount,i1).toFixed(2);
  136. }
  137. })
  138. },
  139. pay() {
  140. post("local/goOrderPay", {trade_no: this.order.trade_no}).then(res => {
  141. if (res.code == 0 && res.data.data.prepayid) {
  142. toPayOpre.toPay(res.data.data, (rea) => {
  143. if (!rea) {
  144. // 支付成功
  145. this.getTicket(this.pda);
  146. } else {
  147. // 支付失败
  148. }
  149. });
  150. }
  151. })
  152. },
  153. },
  154. onLoad(da) {
  155. this.pda = da;
  156. this.getTicket(da)
  157. },
  158. onShow() {
  159. // this.$refs.uqcode.createCode("kjsdgkhg");
  160. },
  161. mounted() {},
  162. };
  163. </script>
  164. <style scoped lang='scss'>
  165. .cinemaTicket{
  166. padding: 28rpx 30rpx;
  167. }
  168. .head{
  169. border-radius: 20rpx;
  170. background-color: #fff;
  171. box-shadow: 4rpx 4rpx 26rpx 2rpx rgba(17, 18, 29, 0.1);
  172. .head_tit{
  173. font-size: 28rpx;
  174. padding: 25rpx 28rpx;
  175. // background-color: rgba($color: #000, $alpha: 0.05);
  176. }
  177. .head_con{
  178. padding: 25rpx 28rpx;
  179. }
  180. .info,.poster{
  181. vertical-align: text-top;
  182. }
  183. .info{
  184. width: calc(100% - 150rpx);
  185. padding-right: 30rpx;
  186. min-height: 220rpx;
  187. p{
  188. font-size: 26rpx;
  189. color: #666;
  190. margin-bottom: 8rpx;
  191. }
  192. .pt{
  193. font-weight: bold;
  194. color: #000;
  195. font-size: 30rpx;
  196. margin-bottom: 8rpx;
  197. }
  198. .p{
  199. color: #000;
  200. }
  201. }
  202. .poster{
  203. width: 150rpx;
  204. height: 220rpx;
  205. border-radius: 12rpx;
  206. }
  207. }
  208. .qupiao{
  209. .code-img {
  210. display: flex;
  211. flex-direction: row;
  212. justify-content: center;
  213. margin: 0 auto;
  214. }
  215. .opacity{
  216. opacity: 0.3;
  217. }
  218. }
  219. .detail{
  220. .label{
  221. margin-top: 15rpx;
  222. }
  223. .title,.nums{
  224. display: inline-block;
  225. font-size: 26rpx;
  226. }
  227. .title{
  228. color: #888;
  229. width: 160rpx;
  230. }
  231. }
  232. .money{
  233. .li{
  234. margin-bottom: 16rpx;
  235. &:last-child{
  236. margin-bottom: 0;
  237. }
  238. span{
  239. font-size: 30rpx;
  240. }
  241. }
  242. .corg{
  243. color: #E8627B;
  244. margin-left: 5rpx;
  245. }
  246. }
  247. .btnbar{
  248. width: calc(100% - 60rpx);
  249. height: 80rpx;
  250. background: #E8627B;
  251. border-radius: 45rpx;
  252. position: fixed;
  253. bottom: 50rpx;
  254. left: 30rpx;
  255. color: #fff;
  256. font-size: 36rpx;
  257. text-align: center;
  258. line-height: 80rpx;
  259. .msg{
  260. position: absolute;
  261. top: -80rpx;
  262. left: 0;
  263. font-size: 25rpx;
  264. color: #666;
  265. width: 100%;
  266. text-align: center;
  267. }
  268. }
  269. .card {
  270. background-color: #fff;
  271. border-radius: 16rpx;
  272. margin-top: 30rpx;
  273. padding: 28rpx 30rpx;
  274. font-size: 32rpx;
  275. .tit{
  276. height: 30rpx;
  277. line-height: 30rpx;
  278. font-size: 30rpx;
  279. margin-bottom: 30rpx;
  280. padding-left: 12rpx;
  281. border-left: 6rpx solid #E8627B;
  282. }
  283. }
  284. </style>