detail.vue 6.0 KB

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