placeorder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view>
  3. <view class="film-des">
  4. <image class="left-img" :src="filmDes.pic" mode="widthFix"></image>
  5. <view class="right-box">
  6. <view class="film-name">
  7. {{showItem.filmName}}
  8. </view>
  9. <view class="film-time">
  10. {{showItem.showTime}}<br />
  11. {{showItem.cinemaName}}<br />
  12. {{showItem.hallName}}
  13. </view>
  14. <view class="film-caveat">
  15. <view class="item">
  16. <van-icon name="clear" color='#E31818' />
  17. 不支持退票
  18. </view>
  19. <view class="item">
  20. <van-icon name="clear" color='#E31818' />
  21. 不支持改签
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="select-des">
  27. <view class="tit-text">
  28. 选择购票方式
  29. </view>
  30. <van-radio-group :value="radioType" @change="radioOnChange">
  31. <view class="options-box">
  32. <view class="left-box">
  33. <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E7%89%B9%E6%83%A0%E8%B4%AD%E7%A5%A8.png"
  34. mode="widthFix"></image>
  35. <view class="text-box">
  36. <text class="top">特惠购票</text>
  37. <text class="bottom">固定折扣,快速出票</text>
  38. </view>
  39. </view>
  40. <view class="right-box">
  41. <view class="text-box">
  42. <text class="top">¥{{(showItem.netPrice/100*(showItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount).toFixed(2)}}/张</text>
  43. <text class="bottom">优惠 ¥{{(showItem.netPrice/100-(showItem.netPrice/100*(showItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount)).toFixed(2)}}元</text>
  44. </view>
  45. <van-radio :name="1" checked-color="#07c160"></van-radio>
  46. </view>
  47. </view>
  48. <view class="options-box">
  49. <view class="left-box">
  50. <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E5%BF%AB%E9%80%9F%E8%B4%AD%E7%A5%A8.png"
  51. mode="widthFix"></image>
  52. <view class="text-box">
  53. <text class="top">快速购票</text>
  54. <text class="bottom">无需等待,即买即兑</text>
  55. </view>
  56. </view>
  57. <view class="right-box">
  58. <view class="text-box">
  59. <text class="top">¥{{(showItem.netPrice/100).toFixed(2)}}/张</text>
  60. </view>
  61. <van-radio :name="2" checked-color="#07c160" disabled></van-radio>
  62. </view>
  63. </view>
  64. <view class="options-box">
  65. <view class="left-box">
  66. <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E7%AB%9E%E4%BB%B7.png"
  67. mode="widthFix"></image>
  68. <view class="text-box">
  69. <text class="top">竞价购买</text>
  70. <text class="bottom">为您网罗最低的折扣,约耗时几分钟</text>
  71. </view>
  72. </view>
  73. <view class="right-box">
  74. <view class="text-box">
  75. <text class="top">等待竞价</text>
  76. </view>
  77. <van-radio :name="3" checked-color="#07c160" disabled></van-radio>
  78. </view>
  79. </view>
  80. </van-radio-group>
  81. </view>
  82. <view class="seat-select">
  83. <text class="tit-text">无座时接受系统调座</text>
  84. <van-switch :checked="acceptChangeSeat==1" @change="onChange" size="24px" />
  85. </view>
  86. <view class="seat-des">
  87. <view class="tit-text">
  88. 购票须知
  89. </view>
  90. <view class="seat-box">
  91. <view class="left">
  92. 座位:
  93. </view>
  94. <view class="right">
  95. <view class="item" v-for="(item,index) in seatResult" :key='index'>
  96. <text class="top">{{item.seatNo}}</text>
  97. <text class="bottom">¥{{(showItem.netPrice/100*(showItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount).toFixed(2)}}</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="buy-des">
  103. <view class="left">
  104. <text class="one">总价:</text>
  105. <text class="two">¥{{(showItem.netPrice*seatResult.length/100*(showItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount).toFixed(2)}}</text>
  106. <text class="three">优惠¥{{(showItem.netPrice*seatResult.length/100-(showItem.netPrice*seatResult.length/100*(showItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount)).toFixed(2)}}元</text>
  107. </view>
  108. <view class="right">
  109. <text class="text">{{seatResult.length}}张</text>
  110. <button class="btn" type="default" @click="buy">去支付</button>
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. prepareOrder
  118. } from '@/api/cinema.js'
  119. export default {
  120. data: () => ({
  121. showItem: {},
  122. seatResult: [],
  123. radioType: 1,
  124. acceptChangeSeat: 0,
  125. orderRes: {}
  126. }),
  127. onLoad: function(option) {
  128. this.seatResult = JSON.parse(option.seatResult).map((val) => {
  129. return JSON.parse(val)
  130. })
  131. this.showItem = JSON.parse(option.showItem);
  132. },
  133. computed: {
  134. filmDes() {
  135. let des = {}
  136. this.$store.state.cinema.filmList.forEach((val) => {
  137. if (val.filmId == this.showItem.filmId) {
  138. des = val
  139. }
  140. })
  141. return des;
  142. },
  143. filmDiscount() {
  144. return this.$store.state.cinema.filmDiscount;
  145. },
  146. discountRule() {
  147. return this.$store.state.cinema.discountRule;
  148. }
  149. },
  150. methods: {
  151. radioOnChange(e) {
  152. this.radioType = e.detail
  153. },
  154. onChange({
  155. detail
  156. }) {
  157. // 需要手动对 checked 状态进行更新
  158. if (detail) {
  159. this.acceptChangeSeat = 1
  160. } else {
  161. this.acceptChangeSeat = 0
  162. }
  163. },
  164. async buy() {
  165. //已有订单则直接请求历史数据
  166. if (this.orderRes.code == 200) {
  167. let payRes = await wx.requestPayment(this.orderRes.data)
  168. console.log(payRes)
  169. return false
  170. }
  171. let seat = [],
  172. seatId = [],
  173. seatNo = []
  174. this.seatResult.forEach(val => {
  175. seat.push(val.seatNo)
  176. seatNo.push(val.seatNo)
  177. seatId.push(val.seatId)
  178. })
  179. prepareOrder({
  180. acceptChangeSeat: this.acceptChangeSeat,
  181. seat: seat.join(','),
  182. seatId: seatId.join('|'),
  183. seatNo: seatNo.join('|'),
  184. showId: this.showItem.showId,
  185. cinemaId: this.showItem.cinemaId,
  186. goodsPictureUrl: this.filmDes.pic,
  187. goodsType: '1'
  188. }).then(async res => {
  189. this.orderRes = res
  190. let payRes = await wx.requestPayment(this.orderRes.data)
  191. if(payRes.errMsg=='requestPayment:ok'){
  192. this.goPage(`/pages/cinema/orderdes?outTradeNo=${this.orderRes.data.outTradeNo}`,'reLaunch')
  193. }
  194. console.log(payRes)
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .film-des {
  202. padding: 40rpx 30rpx;
  203. margin-top: 20rpx;
  204. background-color: #FFFFFF;
  205. display: flex;
  206. .left-img {
  207. width: 170rpx;
  208. height: 236rpx;
  209. margin-right: 20rpx;
  210. }
  211. .right-box {
  212. display: flex;
  213. flex-direction: column;
  214. justify-content: space-between;
  215. .film-name {
  216. font-size: 30rpx;
  217. font-weight: 400;
  218. color: #0F0404;
  219. }
  220. .film-time {
  221. font-size: 26rpx;
  222. font-weight: 400;
  223. color: #666666;
  224. line-height: 39rpx;
  225. }
  226. .film-caveat {
  227. display: flex;
  228. .item {
  229. display: flex;
  230. align-items: center;
  231. margin-right: 33rpx;
  232. font-size: 26rpx;
  233. font-weight: 400;
  234. color: #0F0404;
  235. }
  236. }
  237. }
  238. }
  239. .select-des {
  240. background-color: #FFFFFF;
  241. margin-top: 20rpx;
  242. padding-bottom: 1rpx;
  243. .tit-text {
  244. padding: 30rpx;
  245. font-size: 26rpx;
  246. font-weight: 400;
  247. color: #0F0404;
  248. border-bottom: 1rpx solid #E8E8E8;
  249. }
  250. .options-box {
  251. display: flex;
  252. justify-content: space-between;
  253. align-items: center;
  254. margin: 30rpx;
  255. .left-box {
  256. display: flex;
  257. .img {
  258. width: 66rpx;
  259. height: 66rpx;
  260. margin-right: 20rpx;
  261. }
  262. .text-box {
  263. display: flex;
  264. flex-direction: column;
  265. .top {
  266. font-size: 26rpx;
  267. font-weight: 400;
  268. color: #0F0404;
  269. }
  270. .bottom {
  271. font-size: 22rpx;
  272. font-weight: 400;
  273. color: #666666;
  274. }
  275. }
  276. }
  277. .right-box {
  278. display: flex;
  279. align-items: center;
  280. .text-box {
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: space-around;
  284. align-items: flex-end;
  285. margin-right: 23rpx;
  286. .top {
  287. font-size: 26rpx;
  288. font-weight: 400;
  289. color: #E31818;
  290. }
  291. .bottom {
  292. font-size: 20rpx;
  293. font-weight: 400;
  294. color: #605A5A;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. .seat-select {
  301. background-color: #FFFFFF;
  302. margin-top: 20rpx;
  303. display: flex;
  304. justify-content: space-between;
  305. align-items: center;
  306. padding: 20rpx 30rpx;
  307. .tit-text {
  308. font-size: 26rpx;
  309. font-weight: 400;
  310. color: #E31818;
  311. }
  312. }
  313. .seat-des {
  314. background-color: #FFFFFF;
  315. margin-top: 20rpx;
  316. .tit-text {
  317. font-size: 26rpx;
  318. font-weight: 400;
  319. color: #0F0404;
  320. padding: 30rpx;
  321. border-bottom: 1rpx solid #E8E8E8;
  322. }
  323. .seat-box {
  324. display: flex;
  325. justify-content: flex-start;
  326. padding: 10rpx 30rpx;
  327. .left {
  328. white-space: nowrap;
  329. height: 96rpx;
  330. margin-top: 10rpx;
  331. }
  332. .right {
  333. display: flex;
  334. flex-wrap: wrap;
  335. justify-content: flex-start;
  336. align-items: center;
  337. .item {
  338. width: 134rpx;
  339. height: 96rpx;
  340. margin: 10rpx;
  341. background: #EBEBEB;
  342. border-radius: 10rpx;
  343. display: flex;
  344. flex-direction: column;
  345. justify-content: center;
  346. align-items: center;
  347. .top {
  348. font-size: 26rpx;
  349. font-weight: 400;
  350. color: #666666;
  351. }
  352. .bottom {
  353. font-size: 22rpx;
  354. font-weight: 400;
  355. color: #E31923;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. .buy-des {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. background-color: #FFFFFF;
  366. width: 100vw;
  367. box-sizing: border-box;
  368. position: fixed;
  369. bottom: 0;
  370. padding: 15rpx 30rpx;
  371. padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
  372. .left {
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. width: 50%;
  377. .one {
  378. font-size: 26rpx;
  379. color: #0F0404;
  380. }
  381. .two {
  382. font-size: 36rpx;
  383. color: #E31919;
  384. }
  385. .three {
  386. font-size: 22rpx;
  387. color: #E86125;
  388. }
  389. }
  390. .right {
  391. width: 40%;
  392. display: flex;
  393. justify-content: space-between;
  394. align-items: center;
  395. .text {
  396. font-size: 26rpx;
  397. color: #0F0404;
  398. }
  399. .btn {
  400. margin: 0;
  401. width: 200rpx;
  402. height: 80rpx;
  403. background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
  404. border-radius: 40rpx;
  405. font-size: 30rpx;
  406. color: #FFFFFF;
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. white-space: nowrap;
  411. }
  412. }
  413. }
  414. </style>