detail.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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-swiper">
  6. <u-swiper :list="picUrlArr" height="375" radius="0" :indicator="true" :circular="true" indicatorMode="dot" indicatorActiveColor="#FA822C"></u-swiper>
  7. </view>
  8. <!-- 详情 -->
  9. <view class="detail-info flex">
  10. <view class="detail-info-left">
  11. <view class="detail-info-left__title ells-one">{{ info.title }}</view>
  12. <view class="detail-info-left__coin">
  13. <view class="content flex">
  14. <image src="../../static/public/goods_coin.png" mode=""></image>
  15. <view><text>×</text>{{ info.exchangePrice }}</view>
  16. </view>
  17. <view class="txt" v-if="info.originPrice">原盲豆:<text>{{ info.originPrice }}</text></view>
  18. </view>
  19. <view class="detail-info-left__price">¥{{ $numberFormat(info.value) }}</view>
  20. </view>
  21. <view class="detail-info-right" v-show="false">销量:30个</view>
  22. </view>
  23. <view class="detail-goods">产品介绍</view>
  24. <view class="detail-description">
  25. <u-parse :content="description" :selectable="true"></u-parse>
  26. </view>
  27. <view style="detail-merchant" @click="toCompanyData" v-if="info.merchantInfo?true:false">
  28. <view class="detail-merchant-warp">
  29. <view class="detail-merchant-warp-one">商家信息</view>
  30. <view class="detail-merchant-warp-two">
  31. <view style="float: left;">前往查看</view>
  32. <u-icon style="float: right;" name="arrow-right" size="18"></u-icon>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import env from '../../config/env.js'
  41. import $http from '@/utils/request.js'
  42. import { formatRichText } from '@/utils/util.js'
  43. export default {
  44. data() {
  45. return {
  46. boxId: '',
  47. picUrlArr: [],
  48. info: {},
  49. prizeList: [],
  50. description: '',
  51. goodsId: '',
  52. payShow: false,
  53. payInfo: {}
  54. };
  55. },
  56. onLoad(opthios) {
  57. this.getDetail(opthios.id)
  58. this.goodsId = opthios.id
  59. },
  60. methods: {
  61. getDetail(id) {
  62. uni.showLoading({
  63. title: '加载中'
  64. });
  65. $http.post('/api/v1/mp/user/exchange/goods/detail', {
  66. noToken: true,
  67. goodsId: id
  68. }).then(res => {
  69. uni.hideLoading();
  70. if (res.code == 0) {
  71. this.info = res.data
  72. let picUrlArr = res.data.picUrl.split(',')
  73. picUrlArr.forEach(item => {
  74. this.picUrlArr.push(env.filePublic + item + '?imageView2/2/w/750')
  75. })
  76. // 处理富文本
  77. const description = res.data.description.replaceAll(".jpg\"", ".jpg?imageView2/2/w/750\"")
  78. .replaceAll(".jpeg\"", ".jpeg?imageView2/2/w/750\"").replaceAll(".png\"",
  79. ".png?imageView2/2/w/750\"");
  80. this.description = formatRichText(description);
  81. }
  82. }).catch(() => {
  83. uni.hideLoading();
  84. })
  85. },
  86. close() {
  87. this.payShow = false
  88. },
  89. exchange() {
  90. let data = {
  91. couponIds: [],
  92. autoCoupon: 1,
  93. boxId: this.info.boxId,
  94. ticketId: this.info.ticketId,
  95. orderNum: 1
  96. }
  97. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  98. if (res.code == 0) {
  99. let info = {
  100. ...res.data,
  101. ...this.info,
  102. picUrl: env.filePublic + res.data.picUrl,
  103. }
  104. this.payInfo = info
  105. this.payShow = true
  106. }
  107. })
  108. },
  109. toCompanyData(){
  110. uni.navigateTo({
  111. url:`/packageGoods/goods/company?goodsId=${ this.goodsId }`
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .detail {
  119. // 商品轮播
  120. &-swiper {
  121. background-color: #FFFFFF;
  122. }
  123. // 详情
  124. &-info {
  125. background-color: #fff;
  126. justify-content: space-between;
  127. padding: 34rpx;
  128. margin-bottom: 22rpx;
  129. &-left {
  130. flex: 1;
  131. &__title {
  132. font-size: 34rpx;
  133. line-height: 34rpx;
  134. height: 34rpx;
  135. overflow: hidden;
  136. margin-bottom: 26rpx;
  137. font-weight: bold;
  138. }
  139. &__coin {
  140. display: flex;
  141. line-height: 30rpx;
  142. margin-bottom: 26rpx;
  143. font-size: 26rpx;
  144. .content {
  145. color: #FF2929;
  146. margin-right: 34rpx;
  147. font-weight: bold;
  148. image {
  149. width: 34rpx;
  150. height: 30rpx;
  151. }
  152. text {
  153. font-weight: normal;
  154. }
  155. }
  156. .txt {
  157. color: #666666;
  158. text-decoration: line-through;
  159. }
  160. }
  161. &__price {
  162. line-height: 24rpx;
  163. color: #666666;
  164. }
  165. }
  166. &-right {
  167. color: #666666;
  168. }
  169. }
  170. &-goods {
  171. height: 90rpx;
  172. text-align: center;
  173. line-height: 90rpx;
  174. font-weight: bold;
  175. font-size: 30rpx;
  176. background-color: #FFFFFF;
  177. }
  178. &-description {
  179. image {
  180. width: 100%;
  181. }
  182. }
  183. &-merchant {
  184. height: 88rpx;
  185. // text-align: center;
  186. line-height: 88rpx;
  187. font-weight: bold;
  188. background-color: #FFFFFF;
  189. &-warp {
  190. height: 88rpx;
  191. width: 100%;
  192. background-color: #ffffff;
  193. &-one {
  194. float: left;
  195. margin: 20rpx;
  196. font-weight: 600;
  197. }
  198. &-two {
  199. float: right;
  200. margin: 20rpx;
  201. font-weight: 600;
  202. }
  203. }
  204. }
  205. // 设置ios刘海屏底部横线安全区域
  206. padding-bottom: constant(safe-area-inset-bottom);
  207. padding-bottom: env(safe-area-inset-bottom);
  208. }
  209. </style>