film-orderList.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <script setup lang="ts">
  2. // import { StaticUrl } from '@/config'
  3. import router from '@/router'
  4. const props = defineProps<{
  5. orderList: Api.xsbOrderList[]
  6. subPackOrder?: typeof import('@/subPack-film/utils/order-data')
  7. subPackConfirm?: typeof import('@/subPack-film/utils/confirm-order')
  8. }>()
  9. const _emit = defineEmits<{
  10. 'after-sale': [item: Api.xsbOrderList]
  11. 'refresh': []
  12. }>()
  13. function resolveModule<T = any>(maybeRef: any): T | undefined {
  14. if (!maybeRef)
  15. return undefined
  16. if (maybeRef.value !== undefined)
  17. return maybeRef.value as T
  18. return maybeRef as T
  19. }
  20. async function handlePay(orderNumber: string) {
  21. const spc = resolveModule(props.subPackConfirm)
  22. if (!spc)
  23. return
  24. const res = await spc.handleCommonPayMent(orderNumber)
  25. if (res.payType !== 1) {
  26. await getWxCommonPayment(res)
  27. }
  28. else {
  29. _emit('refresh')
  30. }
  31. }
  32. async function handleCancel(order: Api.xsbOrderList) {
  33. const sp = resolveModule(props.subPackOrder)
  34. if (!sp)
  35. return
  36. await handleCommonCancelOrder(order)
  37. _emit('refresh')
  38. }
  39. function handleCopy(data: string) {
  40. uni.setClipboardData({
  41. data,
  42. showToast: true,
  43. })
  44. }
  45. function handleOrder(orderNo: string) {
  46. router.push({
  47. name: 'film-order-detail',
  48. params: {
  49. orderNo,
  50. },
  51. })
  52. }
  53. </script>
  54. <template>
  55. <view
  56. v-for="(item, index) in orderList" :key="index" class="order-item block"
  57. @click.self="handleOrder(item.orderNumber as string)"
  58. >
  59. <view class="top-box">
  60. <view class="title">
  61. {{ item.movieName }}
  62. </view>
  63. <view class="status">
  64. <template v-if="item.hbOrderStatus === props.subPackOrder?.OrderStatus.PaddingPay">
  65. <view class="flex items-center">
  66. 待支付( 还剩 <wd-count-down
  67. :time="props.subPackOrder?.handleCommonOrderStatusText(item)"
  68. @finish="() => _emit('refresh')"
  69. /> )
  70. </view>
  71. </template>
  72. <text v-else>
  73. {{ props.subPackOrder?.handleCommonOrderStatusText(item) }}
  74. </text>
  75. </view>
  76. </view>
  77. <!-- <view class="status-box">
  78. <view class="reason-box">
  79. <image class="icon" :src="`${StaticUrl}/film-error.png`" mode="scaleToFill" />
  80. <view class="reason">
  81. 订单取消原因
  82. </view>
  83. </view>
  84. <view class="info">
  85. 退款金额 ¥240 预计1-3个工作日到账
  86. </view>
  87. </view> -->
  88. <view class="info-box">
  89. <image class="img" :src="item.orderImage" mode="scaleToFill" />
  90. <view class="info">
  91. <view class="info-item">
  92. 影院:{{ item.cinemaName }}
  93. </view>
  94. <view class="info-item">
  95. 场次:{{ item.session.replace('T', ' ') }}
  96. </view>
  97. <view class="info-item">
  98. 数量:{{ item.orderMovieItems?.length }}张
  99. </view>
  100. <view class="info-item">
  101. 总价:¥{{ item.orderMoney }}
  102. </view>
  103. </view>
  104. </view>
  105. <view class="btn-box">
  106. <template v-if="item.hbOrderStatus === props.subPackOrder?.OrderStatus.PaddingPay">
  107. <!-- 待支付 -->
  108. <view
  109. class="btn cancel"
  110. custom-style="width: 128rpx;height: 38rpx;font-size: 24rpx;color: #AAAAAA;box-sizing: border-box;"
  111. @click.stop="handleCancel(item)"
  112. >
  113. 取消订单
  114. </view>
  115. <view
  116. class="btn"
  117. custom-style="width: 128rpx;height: 38rpx;font-size: 24rpx;color: #222222;box-sizing: border-box"
  118. @click.stop="handlePay(item.orderNumber as string)"
  119. >
  120. 付款
  121. </view>
  122. </template>
  123. <wd-button
  124. v-if="item.orderMovieItems[0].ticketCode"
  125. custom-style="width: 188rpx;height: 44rpx;font-size: 28rpx;box-sizing: border-box"
  126. @click.stop="handleCopy(item.orderMovieItems[0].ticketCode as string)"
  127. >
  128. 复制取票码
  129. </wd-button>
  130. </view>
  131. </view>
  132. </template>
  133. <style lang="scss" scoped>
  134. .block {
  135. background: #FFFFFF;
  136. border-radius: 16rpx 16rpx 16rpx 16rpx;
  137. padding: 24rpx;
  138. margin-bottom: 20rpx;
  139. }
  140. .order-item {
  141. .top-box {
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. .title {
  146. font-size: 32rpx;
  147. color: #222222;
  148. font-weight: bold;
  149. }
  150. .status {
  151. font-size: 28rpx;
  152. color: #222222;
  153. }
  154. }
  155. .status-box {
  156. margin-top: 24rpx;
  157. background: #F9F9F9;
  158. border-radius: 16rpx 16rpx 16rpx 16rpx;
  159. padding: 24rpx;
  160. .reason-box {
  161. display: flex;
  162. align-items: center;
  163. .icon {
  164. width: 30rpx;
  165. height: 30rpx;
  166. }
  167. .reason {
  168. font-size: 28rpx;
  169. color: #999999;
  170. margin-left: 10rpx;
  171. }
  172. }
  173. .info {
  174. font-size: 24rpx;
  175. color: #AAAAAA;
  176. margin-top: 20rpx;
  177. line-height: 44rpx;
  178. }
  179. }
  180. .info-box {
  181. margin-top: 20rpx;
  182. display: flex;
  183. .img {
  184. width: 160rpx;
  185. height: 160rpx;
  186. border-radius: 16rpx 16rpx 16rpx 16rpx;
  187. background: #999999;
  188. margin-right: 20rpx;
  189. }
  190. .info {
  191. display: flex;
  192. flex-direction: column;
  193. justify-content: space-between;
  194. .info-item {
  195. font-size: 24rpx;
  196. color: #222222;
  197. }
  198. }
  199. }
  200. .btn-box {
  201. display: flex;
  202. align-items: center;
  203. justify-content: flex-end;
  204. margin-top: 20rpx;
  205. .btn {
  206. width: 128rpx;
  207. height: 48rpx;
  208. line-height: 48rpx;
  209. text-align: center;
  210. background: #FFFFFF;
  211. border-radius: 24rpx 24rpx 24rpx 24rpx;
  212. border: 1rpx solid #222222;
  213. font-size: 24rpx;
  214. color: #222222;
  215. }
  216. .btn.cancel {
  217. color: #AAAAAA;
  218. border: 1rpx solid #AAAAAA;
  219. margin-right: 20rpx;
  220. }
  221. }
  222. }
  223. </style>