detail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view>
  3. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="奖品详情"></u-navbar>
  4. <view class="detail">
  5. <view class="detail-top">
  6. <u-swiper :list="picUrlArr" height="320" radius="0" :indicator="true" :circular="true"></u-swiper>
  7. </view>
  8. <view class="detail-info">
  9. <view class="content">零跑C11电动汽车新能源车整车国产中型SUV C11性能版</view>
  10. </view>
  11. <view class="detail-title">商品详情</view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import env from '../../config/env.js'
  17. import $http from '@/utils/request.js'
  18. export default {
  19. data() {
  20. return {
  21. boxId: '',
  22. picUrlArr: [
  23. 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
  24. 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  25. 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  26. ],
  27. info: {},
  28. prizeList: [],
  29. payShow: false,
  30. payInfo: {}
  31. };
  32. },
  33. onLoad(opthios) {
  34. // this.getDetail(opthios.id)
  35. },
  36. methods: {
  37. getDetail(id) {
  38. uni.showLoading({
  39. title: '加载中'
  40. });
  41. $http.post('/api/v1/mp/channel/mall/ticket/detail', {
  42. boxId: id
  43. }).then(res => {
  44. uni.hideLoading();
  45. if (res.code == 0) {
  46. this.info = res.data
  47. let picUrlArr = res.data.picUrl.split(',')
  48. picUrlArr.forEach(item => {
  49. this.picUrlArr.push(env.filePublic + item)
  50. })
  51. let prizeList = res.data.prizeList
  52. prizeList.forEach(item => {
  53. item.picUrl = env.filePublic + item.picUrl
  54. })
  55. this.prizeList = prizeList
  56. }
  57. }).catch(() => {
  58. uni.hideLoading();
  59. })
  60. },
  61. close() {
  62. this.payShow = false
  63. },
  64. exchange() {
  65. let data = {
  66. couponIds: [],
  67. autoCoupon: 1,
  68. boxId: this.info.boxId,
  69. ticketId: this.info.ticketId,
  70. orderNum: 1
  71. }
  72. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  73. if (res.code == 0) {
  74. let info = {
  75. ...res.data,
  76. ...this.info,
  77. picUrl: env.filePublic + res.data.picUrl,
  78. }
  79. this.payInfo = info
  80. this.payShow = true
  81. }
  82. })
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .detail {
  89. padding-bottom: 100rpx;
  90. &-info{
  91. padding: 50rpx 20rpx 50rpx;
  92. margin-bottom: 10rpx;
  93. background-color: #fff;
  94. .content{
  95. font-size: 32rpx;
  96. font-weight: bold;
  97. }
  98. }
  99. &-title{
  100. height: 88rpx;
  101. text-align: center;
  102. line-height: 88rpx;
  103. font-weight: bold;
  104. background-color: #FFFFFF;
  105. }
  106. }
  107. </style>