detail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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="flex detail-info">
  9. <view class="detail-info__left">
  10. <text class="title">{{ info.title }}</text>
  11. <view class="flex num">
  12. <u-icon name="gift" size="25" color="#EB7009"></u-icon>
  13. <text>100%抽中,商品价值10元-10万元</text>
  14. </view>
  15. <view class="tip">图片仅供参考,请以实物为准</view>
  16. </view>
  17. <view class="detail-info__right">
  18. <text class="money">¥{{ $numberFormat(info.salePrice) }}</text>
  19. <text>销量 {{ info.saleQty }}</text>
  20. </view>
  21. </view>
  22. <view class="detail-goods">
  23. <view class="detail-goods-title">可获得奖品</view>
  24. <view class="detail-goods-list">
  25. <navigator :url="`/pages/prizeGoods/detail?id=${ item.prizeId }`" class="detail-goods-list-item"
  26. hover-class="navigator-hover" v-for="(item, index) in prizeList" :key="index">
  27. <view class="detail-goods-list-item__value">
  28. <view class="flex image-wrap">
  29. <image :src="item.picUrl" mode="scaleToFill"></image>
  30. </view>
  31. <view class="info">
  32. <text>{{ item.title }}</text>
  33. <text>价值:¥{{ $numberFormat(item.value) }}</text>
  34. <text>概率:{{ item.hitRate }}%</text>
  35. </view>
  36. <view class="name">{{ item.name }}</view>
  37. </view>
  38. </navigator>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="footer-fixed">
  43. <view class="flex btn">
  44. <button type="default" @click="exchange">10元 立即开刮</button>
  45. </view>
  46. </view>
  47. <pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="toProcess" />
  48. </view>
  49. </template>
  50. <script>
  51. import env from '../../config/env.js'
  52. import $http from '@/utils/request.js'
  53. import PayPopup from '../../components/pay-popup/pay-popup.vue'
  54. export default {
  55. components: {
  56. PayPopup
  57. },
  58. data() {
  59. return {
  60. boxId: '',
  61. picUrlArr: [],
  62. info: {},
  63. prizeList: [],
  64. payShow: false,
  65. payInfo: {}
  66. };
  67. },
  68. onLoad(opthios) {
  69. this.getDetail(opthios.id)
  70. },
  71. methods: {
  72. getDetail(id) {
  73. uni.showLoading({
  74. title: '加载中'
  75. });
  76. $http.post('/api/v1/mp/channel/mall/ticket/detail', {
  77. boxId: id
  78. }).then(res => {
  79. uni.hideLoading();
  80. if (res.code == 0) {
  81. this.info = res.data
  82. let picUrlArr = res.data.picUrl.split(',')
  83. picUrlArr.forEach(item => {
  84. this.picUrlArr.push(env.filePublic + item)
  85. })
  86. let prizeList = res.data.prizeList
  87. prizeList.forEach(item => {
  88. item.picUrl = env.filePublic + item.picUrl
  89. })
  90. this.prizeList = prizeList
  91. }
  92. }).catch(() => {
  93. uni.hideLoading();
  94. })
  95. },
  96. close() {
  97. this.payShow = false
  98. },
  99. toProcess(id) {
  100. this.payShow = false
  101. uni.navigateTo({
  102. url: `/pages/process/index?id=${ id }`
  103. })
  104. },
  105. exchange() {
  106. let data = {
  107. couponIds: [],
  108. autoCoupon: 1,
  109. boxId: this.info.boxId,
  110. ticketId: this.info.ticketId,
  111. orderNum: 1
  112. }
  113. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  114. if (res.code == 0) {
  115. let info = {
  116. ...res.data,
  117. ...this.info,
  118. picUrl: env.filePublic + res.data.picUrl,
  119. }
  120. this.payInfo = info
  121. this.payShow = true
  122. }
  123. })
  124. },
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .detail {
  130. padding-bottom: 100rpx;
  131. &-top {
  132. margin-bottom: 20rpx;
  133. }
  134. &-info {
  135. justify-content: space-between;
  136. box-sizing: border-box;
  137. padding: 24rpx 16rpx;
  138. background-color: #fff;
  139. margin: 10rpx 10rpx 20rpx;
  140. border-radius: 10rpx;
  141. &__left {
  142. display: flex;
  143. flex-direction: column;
  144. justify-content: space-between;
  145. text {
  146. line-height: 24rpx;
  147. display: inline-block;
  148. }
  149. .title {
  150. color: rgba(16, 16, 16, 100);
  151. font-size: 32rpx;
  152. line-height: 32rpx;
  153. font-weight: bold;
  154. }
  155. .num {
  156. color: $uni-text-color;
  157. font-size: 28rpx;
  158. justify-content: flex-start;
  159. margin: 20rpx 0;
  160. }
  161. .tip {
  162. font-size: 24rpx;
  163. }
  164. }
  165. &__right {
  166. display: flex;
  167. flex-direction: column;
  168. align-items: flex-end;
  169. justify-content: space-between;
  170. height: 162rpx;
  171. text {
  172. color: rgba(157, 157, 157, 100);
  173. font-size: 14px;
  174. }
  175. .money {
  176. font-size: 40rpx;
  177. font-weight: bold;
  178. line-height: 40rpx;
  179. font-weight: bold;
  180. color: $uni-text-color;
  181. margin-bottom: 40rpx;
  182. }
  183. }
  184. }
  185. &-sku {
  186. background-color: #fff;
  187. border-radius: 10rpx;
  188. margin: 10rpx 10rpx 20rpx;
  189. &-title {
  190. padding: 24rpx 16rpx 12rpx;
  191. }
  192. &-item {
  193. padding-bottom: 10rpx;
  194. view {
  195. padding-left: 50rpx;
  196. line-height: 50rpx;
  197. }
  198. }
  199. }
  200. &-goods {
  201. margin: 10rpx 10rpx 20rpx;
  202. &-title {
  203. margin-bottom: 20rpx;
  204. }
  205. &-list {
  206. &-item {
  207. position: relative;
  208. background-color: #FFFFFF;
  209. margin-bottom: 40rpx;
  210. border-radius: 10rpx;
  211. &__value {
  212. display: flex;
  213. }
  214. .image-wrap {
  215. width: 250rpx;
  216. height: 250rpx;
  217. margin-right: 30rpx;
  218. image {
  219. width: 180rpx;
  220. height: 120rpx;
  221. }
  222. }
  223. .name {
  224. position: absolute;
  225. line-height: 28rpx;
  226. padding: 6rpx 20rpx;
  227. color: #FFFFFF;
  228. background-color: $uni-bg-color;
  229. }
  230. .info {
  231. display: flex;
  232. flex-direction: column;
  233. font-size: 24rpx;
  234. text {
  235. margin-bottom: 10rpx;
  236. }
  237. text:first-child {
  238. font-size: 28rpx;
  239. margin-top: 24rpx;
  240. margin-bottom: 55rpx;
  241. font-weight: bold;
  242. }
  243. }
  244. }
  245. &-item:last-child {
  246. border: none;
  247. }
  248. }
  249. }
  250. }
  251. .footer-fixed {
  252. position: fixed;
  253. bottom: var(--window-bottom);
  254. left: 0;
  255. right: 0;
  256. z-index: 11;
  257. box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  258. background: #fff;
  259. // 设置ios刘海屏底部横线安全区域
  260. padding-bottom: constant(safe-area-inset-bottom);
  261. padding-bottom: env(safe-area-inset-bottom);
  262. .btn {
  263. padding: 20rpx 40rpx;
  264. /deep/ button {
  265. width: 100%;
  266. line-height: 60rpx;
  267. font-size: 28rpx;
  268. height: 60rpx;
  269. color: #fff;
  270. background-color: $uni-bg-color;
  271. border: none;
  272. border-radius: 100rpx;
  273. }
  274. }
  275. }
  276. </style>