detail.vue 6.7 KB

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