detail.vue 6.5 KB

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