detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. console.log(res);
  81. if (res.code == 0) {
  82. this.info = res.data
  83. let picUrlArr = res.data.picUrl.split(',')
  84. picUrlArr.forEach(item => {
  85. this.picUrlArr.push(env.filePublic + item)
  86. })
  87. let prizeList = res.data.prizeList
  88. console.log(prizeList);
  89. prizeList.forEach(item => {
  90. item.picUrl = env.filePublic + item.picUrl
  91. })
  92. this.prizeList = prizeList
  93. }
  94. }).catch(() => {
  95. uni.hideLoading();
  96. })
  97. },
  98. close() {
  99. this.payShow = false
  100. },
  101. toProcess(id) {
  102. this.payShow = false
  103. uni.navigateTo({
  104. url: `/pages/process/index?id=${ id }`
  105. })
  106. },
  107. exchange() {
  108. let data = {
  109. couponIds: [],
  110. autoCoupon: 1,
  111. boxId: this.info.boxId,
  112. ticketId: this.info.ticketId,
  113. orderNum: 1
  114. }
  115. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  116. console.log(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. console.log(info);
  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. &-item {
  211. position: relative;
  212. background-color: #FFFFFF;
  213. margin-bottom: 40rpx;
  214. border-radius: 10rpx;
  215. &__value {
  216. display: flex;
  217. }
  218. .image-wrap {
  219. width: 250rpx;
  220. height: 250rpx;
  221. margin-right: 30rpx;
  222. image {
  223. width: 180rpx;
  224. height: 120rpx;
  225. }
  226. }
  227. .name {
  228. position: absolute;
  229. line-height: 28rpx;
  230. padding: 6rpx 20rpx;
  231. color: #FFFFFF;
  232. background-color: $uni-bg-color;
  233. }
  234. .info {
  235. display: flex;
  236. flex-direction: column;
  237. font-size: 24rpx;
  238. text {
  239. margin-bottom: 10rpx;
  240. }
  241. text:first-child {
  242. font-size: 28rpx;
  243. margin-top: 24rpx;
  244. margin-bottom: 55rpx;
  245. font-weight: bold;
  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 40rpx;
  268. /deep/ button {
  269. width: 100%;
  270. line-height: 60rpx;
  271. font-size: 28rpx;
  272. height: 60rpx;
  273. color: #fff;
  274. background-color: $uni-bg-color;
  275. border: none;
  276. border-radius: 100rpx;
  277. }
  278. }
  279. }
  280. </style>