detail.vue 6.8 KB

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