placeorder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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. console.log(payRes)
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .film-des {
  199. padding: 40rpx 30rpx;
  200. margin-top: 20rpx;
  201. background-color: #FFFFFF;
  202. display: flex;
  203. .left-img {
  204. width: 170rpx;
  205. height: 236rpx;
  206. margin-right: 20rpx;
  207. }
  208. .right-box {
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: space-between;
  212. .film-name {
  213. font-size: 30rpx;
  214. font-weight: 400;
  215. color: #0F0404;
  216. }
  217. .film-time {
  218. font-size: 26rpx;
  219. font-weight: 400;
  220. color: #666666;
  221. line-height: 39rpx;
  222. }
  223. .film-caveat {
  224. display: flex;
  225. .item {
  226. display: flex;
  227. align-items: center;
  228. margin-right: 33rpx;
  229. font-size: 26rpx;
  230. font-weight: 400;
  231. color: #0F0404;
  232. }
  233. }
  234. }
  235. }
  236. .select-des {
  237. background-color: #FFFFFF;
  238. margin-top: 20rpx;
  239. padding-bottom: 1rpx;
  240. .tit-text {
  241. padding: 30rpx;
  242. font-size: 26rpx;
  243. font-weight: 400;
  244. color: #0F0404;
  245. border-bottom: 1rpx solid #E8E8E8;
  246. }
  247. .options-box {
  248. display: flex;
  249. justify-content: space-between;
  250. align-items: center;
  251. margin: 30rpx;
  252. .left-box {
  253. display: flex;
  254. .img {
  255. width: 66rpx;
  256. height: 66rpx;
  257. margin-right: 20rpx;
  258. }
  259. .text-box {
  260. display: flex;
  261. flex-direction: column;
  262. .top {
  263. font-size: 26rpx;
  264. font-weight: 400;
  265. color: #0F0404;
  266. }
  267. .bottom {
  268. font-size: 22rpx;
  269. font-weight: 400;
  270. color: #666666;
  271. }
  272. }
  273. }
  274. .right-box {
  275. display: flex;
  276. align-items: center;
  277. .text-box {
  278. display: flex;
  279. flex-direction: column;
  280. justify-content: space-around;
  281. align-items: flex-end;
  282. margin-right: 23rpx;
  283. .top {
  284. font-size: 26rpx;
  285. font-weight: 400;
  286. color: #E31818;
  287. }
  288. .bottom {
  289. font-size: 20rpx;
  290. font-weight: 400;
  291. color: #605A5A;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. .seat-select {
  298. background-color: #FFFFFF;
  299. margin-top: 20rpx;
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. padding: 20rpx 30rpx;
  304. .tit-text {
  305. font-size: 26rpx;
  306. font-weight: 400;
  307. color: #E31818;
  308. }
  309. }
  310. .seat-des {
  311. background-color: #FFFFFF;
  312. margin-top: 20rpx;
  313. .tit-text {
  314. font-size: 26rpx;
  315. font-weight: 400;
  316. color: #0F0404;
  317. padding: 30rpx;
  318. border-bottom: 1rpx solid #E8E8E8;
  319. }
  320. .seat-box {
  321. display: flex;
  322. justify-content: flex-start;
  323. padding: 10rpx 30rpx;
  324. .left {
  325. white-space: nowrap;
  326. height: 96rpx;
  327. margin-top: 10rpx;
  328. }
  329. .right {
  330. display: flex;
  331. flex-wrap: wrap;
  332. justify-content: flex-start;
  333. align-items: center;
  334. .item {
  335. width: 134rpx;
  336. height: 96rpx;
  337. margin: 10rpx;
  338. background: #EBEBEB;
  339. border-radius: 10rpx;
  340. display: flex;
  341. flex-direction: column;
  342. justify-content: center;
  343. align-items: center;
  344. .top {
  345. font-size: 26rpx;
  346. font-weight: 400;
  347. color: #666666;
  348. }
  349. .bottom {
  350. font-size: 22rpx;
  351. font-weight: 400;
  352. color: #E31923;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. .buy-des {
  359. display: flex;
  360. justify-content: space-between;
  361. align-items: center;
  362. background-color: #FFFFFF;
  363. width: 100vw;
  364. box-sizing: border-box;
  365. position: fixed;
  366. bottom: 0;
  367. padding: 15rpx 30rpx;
  368. padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
  369. .left {
  370. display: flex;
  371. justify-content: space-between;
  372. align-items: center;
  373. width: 50%;
  374. .one {
  375. font-size: 26rpx;
  376. color: #0F0404;
  377. }
  378. .two {
  379. font-size: 36rpx;
  380. color: #E31919;
  381. }
  382. .three {
  383. font-size: 22rpx;
  384. color: #E86125;
  385. }
  386. }
  387. .right {
  388. width: 40%;
  389. display: flex;
  390. justify-content: space-between;
  391. align-items: center;
  392. .text {
  393. font-size: 26rpx;
  394. color: #0F0404;
  395. }
  396. .btn {
  397. margin: 0;
  398. width: 200rpx;
  399. height: 80rpx;
  400. background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
  401. border-radius: 40rpx;
  402. font-size: 30rpx;
  403. color: #FFFFFF;
  404. display: flex;
  405. justify-content: center;
  406. align-items: center;
  407. white-space: nowrap;
  408. }
  409. }
  410. }
  411. </style>