detail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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" :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. if (res.code == 0) {
  47. this.info = res.data
  48. let picUrlArr = res.data.picUrl.split(',')
  49. picUrlArr.forEach(item => {
  50. this.picUrlArr.push(env.filePublic + item)
  51. })
  52. let prizeList = res.data.prizeList
  53. console.log(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. console.log(res);
  76. if (res.code == 0) {
  77. let info = {
  78. ...res.data,
  79. ...this.info,
  80. picUrl: env.filePublic + res.data.picUrl,
  81. }
  82. this.payInfo = info
  83. this.payShow = true
  84. console.log(info);
  85. }
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .detail {
  93. padding-bottom: 100rpx;
  94. &-info{
  95. padding: 50rpx 20rpx 50rpx;
  96. margin-bottom: 10rpx;
  97. background-color: #fff;
  98. .content{
  99. font-size: 32rpx;
  100. font-weight: bold;
  101. }
  102. }
  103. &-title{
  104. height: 88rpx;
  105. text-align: center;
  106. line-height: 88rpx;
  107. font-weight: bold;
  108. background-color: #FFFFFF;
  109. }
  110. }
  111. </style>