detail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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="375" 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. console.log(res);
  46. return
  47. if (res.code == 0) {
  48. this.info = res.data
  49. let picUrlArr = res.data.picUrl.split(',')
  50. picUrlArr.forEach(item => {
  51. this.picUrlArr.push(env.filePublic + item)
  52. })
  53. let prizeList = res.data.prizeList
  54. prizeList.forEach(item => {
  55. item.picUrl = env.filePublic + item.picUrl
  56. })
  57. this.prizeList = prizeList
  58. }
  59. }).catch(() => {
  60. uni.hideLoading();
  61. })
  62. },
  63. close() {
  64. this.payShow = false
  65. },
  66. exchange() {
  67. let data = {
  68. couponIds: [],
  69. autoCoupon: 1,
  70. boxId: this.info.boxId,
  71. ticketId: this.info.ticketId,
  72. orderNum: 1
  73. }
  74. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  75. if (res.code == 0) {
  76. let info = {
  77. ...res.data,
  78. ...this.info,
  79. picUrl: env.filePublic + res.data.picUrl,
  80. }
  81. this.payInfo = info
  82. this.payShow = true
  83. }
  84. })
  85. },
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .detail {
  91. padding-bottom: 100rpx;
  92. &-info{
  93. padding: 50rpx 20rpx 50rpx;
  94. margin-bottom: 10rpx;
  95. background-color: #fff;
  96. .content{
  97. font-size: 32rpx;
  98. font-weight: bold;
  99. }
  100. }
  101. &-title{
  102. height: 88rpx;
  103. text-align: center;
  104. line-height: 88rpx;
  105. font-weight: bold;
  106. background-color: #FFFFFF;
  107. }
  108. }
  109. </style>