index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <page title="宝箱订单" ref="pageRef" nav-color="#fff" custom-class="paddingB30">
  3. <tabbar
  4. :data="tabbarData"
  5. custom-class="paddingX20 marginB7"
  6. :initial="initial"
  7. @change="onChange"
  8. />
  9. <view v-if="tableData && tableData.length > 0">
  10. <view v-for="item in tableData" :key="item.tradeNo" class="cell">
  11. <view class="filter" />
  12. <view class="top">
  13. <view class="flex-align-between">
  14. <view class="font2">下单时间:{{ item.createTime }}</view>
  15. <view class="color-money font2">
  16. <text v-if="item.status === 99" class="color-green">已完成</text>
  17. <text v-else-if="item.status === 0">待支付</text>
  18. <text v-else-if="item.status === 10">用户取消</text>
  19. <text v-else-if="item.status === 11">超时取消</text>
  20. </view>
  21. </view>
  22. <view v-if="item.status === 0" class="paddingT5">
  23. {{ item.paymentTimeoutTime }} 将自动取消该订单,如有优惠券,将自动退回
  24. </view>
  25. </view>
  26. <view class="middle flex-align flex1">
  27. <image :src="item.luckPool.cover" mode="aspectFill" class="img" />
  28. <view class="self-stretch flex-column-between marginL12 flex1">
  29. <view class="bold font4">{{ item.luckPool.name }}</view>
  30. <view class="flex-align-between">
  31. <view class="bold font4">¥{{ item.price }}</view>
  32. <view class="font2">X{{ item.quantity }}</view>
  33. </view>
  34. <view class="color-theme font2">
  35. 使用优惠券-{{ item.couponAmount }} 使用源石-{{ item.magicAmount }}
  36. </view>
  37. <view class="color-theme">
  38. <text class="font2">实付款:</text>
  39. <text class="font8 bold">¥{{ item.paymentAmount }}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="listWrapper" v-if="item.status === 99">
  44. <view class="bottom listBox">
  45. <scroll-view scroll-x class="scroll-wrapper">
  46. <view
  47. class="relative item"
  48. v-for="(item, index) in item.itemList"
  49. :key="index"
  50. >
  51. <view class="imgBox">
  52. <image
  53. class="super-image"
  54. :src="item.spu.cover"
  55. mode="aspectFit"
  56. />
  57. </view>
  58. <image
  59. class="level-image"
  60. :src="LEVEL_MAP[item.level].titleText"
  61. mode="aspectFit"
  62. />
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </view>
  67. <view class="orderNo flex-align-between" v-else>
  68. <view class="line-ellipsis">订单号:{{ item.tradeNo }}</view>
  69. <view class="flex-align-end flex-shrink0">
  70. <button
  71. class="btn-clear copy marginL5"
  72. @click.stop="$common.copy(item.tradeNo)"
  73. >
  74. 复制
  75. </button>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <empty v-if="isEmpty" :top="200" light />
  81. </page>
  82. </template>
  83. <script>
  84. import { LEVEL_MAP } from '@/utils/config'
  85. import tabbar from '@/components/tabbar'
  86. import empty from '@/components/empty'
  87. import pageMixin from './../../mixin/page'
  88. import loginMixin from '@/mixin/login'
  89. export default {
  90. mixins: [pageMixin, loginMixin],
  91. components: { tabbar, empty },
  92. data() {
  93. return {
  94. LEVEL_MAP,
  95. initial: 0,
  96. tabbarData: [
  97. {
  98. label: '已完成',
  99. value: 'complete'
  100. },
  101. {
  102. label: '未完成',
  103. value: 'uncomplete'
  104. }
  105. ],
  106. index: 0
  107. }
  108. },
  109. computed: {
  110. itemWidth() {
  111. let width = this.$store.state.systemInfo.screenWidth
  112. width = (width - 28 - 30 - 16) / 5
  113. let height = (91 / 60) * width
  114. return { width, height }
  115. }
  116. },
  117. onLoad(options) {
  118. this.initial = options.active || 0
  119. this.index = this.initial
  120. },
  121. mounted() {
  122. setTimeout(() => {
  123. this.refresh(true)
  124. }, 100)
  125. },
  126. onPullDownRefresh() {
  127. this.refresh()
  128. },
  129. onReachBottom() {
  130. this.loadMore()
  131. },
  132. methods: {
  133. init() {
  134. this.refresh()
  135. },
  136. async loadData(loading) {
  137. const item = this.tabbarData[this.index]
  138. const res = await this.$service.award.orders(
  139. this.pageNum,
  140. this.pageSize,
  141. item.value,
  142. loading
  143. )
  144. return res
  145. },
  146. onChange(index) {
  147. this.index = index
  148. this.refresh(true)
  149. }
  150. }
  151. }
  152. </script>
  153. <style></style>
  154. <style lang="scss" scoped>
  155. .bg {
  156. position: fixed;
  157. z-index: -1;
  158. left: 0;
  159. right: 0;
  160. top: 0;
  161. width: 100%;
  162. height: 100%;
  163. opacity: 0.3;
  164. }
  165. .cell {
  166. background: #fff;
  167. border-radius: 16rpx;
  168. margin: 20rpx 14px;
  169. position: relative;
  170. padding: 0 15px;
  171. .filter {
  172. position: absolute;
  173. left: 0;
  174. top: 0;
  175. bottom: 0;
  176. right: 0;
  177. z-index: -1;
  178. border-radius: 16rpx;
  179. backdrop-filter: blur(20rpx);
  180. }
  181. .top {
  182. padding: 20rpx 0;
  183. border-bottom: 2rpx solid rgba(0, 0, 0, 0.05);
  184. }
  185. .middle {
  186. padding: 24rpx 0;
  187. .img {
  188. width: 180rpx;
  189. height: 180rpx;
  190. border-radius: 8rpx;
  191. }
  192. }
  193. .bottom {
  194. .scroll-wrapper {
  195. overflow: hidden;
  196. white-space: nowrap;
  197. width: 100%;
  198. .item {
  199. display: inline-block;
  200. }
  201. }
  202. .super {
  203. position: absolute;
  204. z-index: -1;
  205. left: 0;
  206. top: 0;
  207. }
  208. .super-text {
  209. width: 80rpx;
  210. height: 36rpx;
  211. position: absolute;
  212. bottom: 10rpx;
  213. }
  214. }
  215. .orderNo {
  216. height: 58rpx;
  217. line-height: 58rpx;
  218. font-size: 24rpx;
  219. }
  220. .btn {
  221. height: 48rpx;
  222. line-height: 48rpx;
  223. text-align: center;
  224. padding: 0 20rpx;
  225. font-size: 28rpx;
  226. border-radius: 24rpx;
  227. }
  228. .copy {
  229. padding: 0 6rpx;
  230. line-height: 32rpx;
  231. border-radius: 8rpx;
  232. text-align: center;
  233. font-size: 24rpx;
  234. background-color: #fec433;
  235. color: #000;
  236. }
  237. }
  238. .listWrapper {
  239. padding-bottom: 20rpx;
  240. .listBox {
  241. background: #f8f8f8;
  242. padding: 20rpx;
  243. }
  244. }
  245. .item {
  246. margin-right: 20rpx;
  247. text-align: center;
  248. .imgBox {
  249. border-radius: 6rpx 6rpx 6rpx 6rpx;
  250. background-color: #fff;
  251. width: 110rpx;
  252. height: 150rpx;
  253. margin-bottom: 12rpx;
  254. }
  255. .super-image {
  256. width: 110rpx;
  257. height: 150rpx;
  258. }
  259. .level-image{
  260. width: 90rpx;
  261. height: 32rpx;
  262. }
  263. }
  264. </style>