detail.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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" v-if="type != 'not'">
  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. type: ''
  55. };
  56. },
  57. onLoad(opthios) {
  58. this.getDetail(opthios.id)
  59. this.goodsId = opthios.id
  60. this.type = opthios.type
  61. },
  62. methods: {
  63. getDetail(id) {
  64. uni.showLoading({
  65. title: '加载中'
  66. });
  67. $http.post('/api/v1/mp/user/exchange/goods/detail', {
  68. noToken: true,
  69. goodsId: id
  70. }).then(res => {
  71. uni.hideLoading();
  72. if (res.code == 0) {
  73. this.info = res.data
  74. let picUrlArr = res.data.picUrl.split(',')
  75. picUrlArr.forEach(item => {
  76. this.picUrlArr.push(env.filePublic + item + '?imageView2/2/w/750')
  77. })
  78. // 处理富文本
  79. const description = res.data.description.replaceAll(".jpg\"", ".jpg?imageView2/2/w/750\"")
  80. .replaceAll(".jpeg\"", ".jpeg?imageView2/2/w/750\"").replaceAll(".png\"",
  81. ".png?imageView2/2/w/750\"");
  82. this.description = formatRichText(description);
  83. }
  84. }).catch(() => {
  85. uni.hideLoading();
  86. })
  87. },
  88. close() {
  89. this.payShow = false
  90. },
  91. exchange() {
  92. let data = {
  93. couponIds: [],
  94. autoCoupon: 1,
  95. boxId: this.info.boxId,
  96. ticketId: this.info.ticketId,
  97. orderNum: 1
  98. }
  99. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  100. if (res.code == 0) {
  101. let info = {
  102. ...res.data,
  103. ...this.info,
  104. picUrl: env.filePublic + res.data.picUrl,
  105. }
  106. this.payInfo = info
  107. this.payShow = true
  108. }
  109. })
  110. },
  111. toCompanyData(){
  112. uni.navigateTo({
  113. url:`/packageGoods/goods/company?goodsId=${ this.goodsId }`
  114. })
  115. },
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .detail {
  121. // 商品轮播
  122. &-swiper {
  123. background-color: #FFFFFF;
  124. }
  125. // 详情
  126. &-info {
  127. background-color: #fff;
  128. justify-content: space-between;
  129. padding: 34rpx;
  130. margin-bottom: 22rpx;
  131. &-left {
  132. flex: 1;
  133. &__title {
  134. font-size: 34rpx;
  135. line-height: 34rpx;
  136. height: 34rpx;
  137. overflow: hidden;
  138. margin-bottom: 26rpx;
  139. font-weight: bold;
  140. }
  141. &__coin {
  142. display: flex;
  143. line-height: 30rpx;
  144. margin-bottom: 26rpx;
  145. font-size: 26rpx;
  146. .content {
  147. color: #FF2929;
  148. margin-right: 34rpx;
  149. font-weight: bold;
  150. image {
  151. width: 34rpx;
  152. height: 30rpx;
  153. }
  154. text {
  155. font-weight: normal;
  156. }
  157. }
  158. .txt {
  159. color: #666666;
  160. text-decoration: line-through;
  161. }
  162. }
  163. &__price {
  164. line-height: 24rpx;
  165. color: #666666;
  166. }
  167. }
  168. &-right {
  169. color: #666666;
  170. }
  171. }
  172. &-goods {
  173. height: 90rpx;
  174. text-align: center;
  175. line-height: 90rpx;
  176. font-weight: bold;
  177. font-size: 30rpx;
  178. background-color: #FFFFFF;
  179. }
  180. &-description {
  181. image {
  182. width: 100%;
  183. }
  184. }
  185. &-merchant {
  186. height: 88rpx;
  187. // text-align: center;
  188. line-height: 88rpx;
  189. font-weight: bold;
  190. background-color: #FFFFFF;
  191. &-warp {
  192. height: 88rpx;
  193. width: 100%;
  194. background-color: #ffffff;
  195. &-one {
  196. float: left;
  197. margin: 20rpx;
  198. font-weight: 600;
  199. }
  200. &-two {
  201. float: right;
  202. margin: 20rpx;
  203. font-weight: 600;
  204. }
  205. }
  206. }
  207. // 设置ios刘海屏底部横线安全区域
  208. padding-bottom: constant(safe-area-inset-bottom);
  209. padding-bottom: env(safe-area-inset-bottom);
  210. }
  211. </style>