detail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view>
  3. <u-navbar title="兑换详情" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  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="detail-sku">
  9. <view class="detail-sku-title">参数</view>
  10. </view>
  11. </view>
  12. <view class="footer-fixed">
  13. <view class="flex btn">
  14. <view class="btn-left" @click="toCart">
  15. <u-icon name="shopping-cart" color="#808080" size="20"></u-icon>
  16. <view>购物车</view>
  17. </view>
  18. <view class="btn-right">
  19. <text @click="addCart">加入购物车</text>
  20. <text @click="toSettlement">立即购票</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import env from '../../config/env.js'
  28. import $http from '@/utils/request.js'
  29. export default {
  30. data() {
  31. return {
  32. boxId: '',
  33. picUrlArr: [
  34. 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
  35. 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  36. 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  37. ],
  38. info: {},
  39. prizeList: [],
  40. };
  41. },
  42. onLoad(opthios) {
  43. // this.getDetail(opthios.boxId)
  44. },
  45. methods: {
  46. getDetail(id) {
  47. $http.post('/api/v1/mp/channel/mall/ticket/detail', {
  48. boxId: id
  49. }).then(res => {
  50. if (res.code == 0) {
  51. this.info = res.data
  52. let picUrlArr = res.data.picUrl.split(',')
  53. picUrlArr.forEach(item => {
  54. this.picUrlArr.push(env.filePublic + item)
  55. })
  56. let prizeList = res.data.prizeList
  57. prizeList.forEach(item => {
  58. item.picUrl = env.filePublic + item.picUrl
  59. })
  60. this.prizeList = prizeList
  61. }
  62. })
  63. },
  64. addCart(id) {
  65. let data = {
  66. boxId: this.info.boxId,
  67. orderNum: 1
  68. }
  69. $http.post(`/api/v1/mp/channel/mall/cart/add`, data).then(res => {
  70. if (res.code == 0) {
  71. uni.$u.toast('加入购物车成功');
  72. }
  73. })
  74. },
  75. toCart() {
  76. uni.switchTab({
  77. url: "/pages/index/cart"
  78. })
  79. },
  80. toSettlement() {
  81. uni.navigateTo({
  82. url: `/pages/order/settlement?boxId=${ this.info.boxId }`
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. </style>
  90. <style lang="scss" scoped>
  91. .detail {
  92. padding-bottom: 100rpx;
  93. &-top {
  94. margin-bottom: 20rpx;
  95. }
  96. &-info {
  97. justify-content: space-between;
  98. box-sizing: border-box;
  99. padding: 24rpx 16rpx;
  100. background-color: #fff;
  101. margin: 10rpx 10rpx 20rpx;
  102. border-radius: 10rpx;
  103. &__left {
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: space-between;
  107. text {
  108. font-size: 24rpx;
  109. line-height: 24rpx;
  110. display: inline-block;
  111. }
  112. .title {
  113. color: rgba(16, 16, 16, 100);
  114. font-size: 32rpx;
  115. line-height: 32rpx;
  116. font-weight: bold;
  117. margin-bottom: 40rpx;
  118. }
  119. .num {
  120. width: 220rpx;
  121. height: 34rpx;
  122. color: $uni-text-color;
  123. text-align: center;
  124. line-height: 34rpx;
  125. border: 1px solid $uni-bg-color;
  126. border-radius: 6rpx;
  127. }
  128. }
  129. &__right {
  130. display: flex;
  131. flex-direction: column;
  132. align-items: flex-end;
  133. justify-content: space-between;
  134. text {
  135. color: rgba(157, 157, 157, 100);
  136. font-size: 14px;
  137. }
  138. .money {
  139. font-size: 40rpx;
  140. font-weight: bold;
  141. line-height: 40rpx;
  142. font-weight: bold;
  143. color: $uni-text-color;
  144. margin-bottom: 40rpx;
  145. }
  146. }
  147. }
  148. &-sku {
  149. background-color: #fff;
  150. border-radius: 10rpx;
  151. margin: 10rpx 10rpx 20rpx;
  152. &-title {
  153. padding: 24rpx 16rpx 12rpx;
  154. }
  155. &-item {
  156. padding-bottom: 10rpx;
  157. view {
  158. padding-left: 50rpx;
  159. line-height: 50rpx;
  160. }
  161. }
  162. }
  163. &-goods {
  164. margin: 10rpx 10rpx 20rpx;
  165. &-title {
  166. margin-bottom: 20rpx;
  167. }
  168. &-list {
  169. background-color: #FFFFFF;
  170. &-item {
  171. position: relative;
  172. margin: 16rpx 0;
  173. border-bottom: 1px solid rgba(236, 236, 236, 100);
  174. &__value {
  175. display: flex;
  176. }
  177. .image-wrap {
  178. width: 250rpx;
  179. height: 250rpx;
  180. margin-right: 30rpx;
  181. image {
  182. width: 180rpx;
  183. height: 120rpx;
  184. }
  185. }
  186. .name {
  187. position: absolute;
  188. line-height: 28rpx;
  189. padding: 6rpx 20rpx;
  190. background-color: $uni-bg-color;
  191. }
  192. .info {
  193. display: flex;
  194. flex-direction: column;
  195. font-size: 24rpx;
  196. text {
  197. margin-bottom: 10rpx;
  198. }
  199. text:first-child {
  200. font-size: 28rpx;
  201. margin-top: 24rpx;
  202. margin-bottom: 30rpx;
  203. font-weight: bold;
  204. }
  205. }
  206. }
  207. &-item:last-child {
  208. border: none;
  209. }
  210. }
  211. }
  212. }
  213. .footer-fixed {
  214. position: fixed;
  215. bottom: var(--window-bottom);
  216. left: 0;
  217. right: 0;
  218. // min-height: 120rpx;
  219. z-index: 11;
  220. box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  221. background: #fff;
  222. // margin-bottom: 40rpx;
  223. // 设置ios刘海屏底部横线安全区域
  224. padding-bottom: constant(safe-area-inset-bottom);
  225. padding-bottom: env(safe-area-inset-bottom);
  226. .btn {
  227. justify-content: space-between;
  228. padding: 10rpx 40rpx;
  229. &-left {
  230. display: flex;
  231. line-height: 28rpx;
  232. flex-direction: column;
  233. align-items: center;
  234. justify-content: center;
  235. color: #808080;
  236. }
  237. &-right {
  238. display: flex;
  239. align-items: center;
  240. justify-content: flex-end;
  241. text {
  242. width: 190rpx;
  243. height: 60rpx;
  244. line-height: 60rpx;
  245. border-radius: 8rpx;
  246. text-align: center;
  247. margin-left: 40rpx;
  248. }
  249. text:first-child {
  250. background-color: rgba(236, 153, 84, 100);
  251. color: rgba(255, 255, 255, 100);
  252. }
  253. text:last-child {
  254. background-color: rgba(235, 112, 9, 100);
  255. color: rgba(255, 255, 255, 100);
  256. }
  257. }
  258. }
  259. }
  260. </style>