detail.vue 6.7 KB

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