wholesaleDetail.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="content">
  3. <!-- 轮播图 -->
  4. <top-swiper :imgList="imgList"></top-swiper>
  5. <!-- 价格 -->
  6. <view class="good-price flex">
  7. <view class="new-price">
  8. ¥{{goodItem.price}}
  9. </view>
  10. <view class="old-price">
  11. ¥{{goodItem.ot_price}}
  12. </view>
  13. </view>
  14. <!-- 标题 -->
  15. <view class="good-tit">
  16. {{goodItem.title}}
  17. </view>
  18. <content-text :description="description"></content-text>
  19. <view class="btn-ts" style="height: 130rpx; background-color: #fff;">
  20. </view>
  21. <view class="btm-btn" @click="reservePackage">
  22. 立即预约
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. // 头部轮播图
  28. import topSwiper from './common/topSwiper.vue';
  29. // 图文详情
  30. import contentText from './common/contentText.vue';
  31. import {
  32. getWholeDetai,
  33. reservePackage
  34. } from '@/api/whole.js'
  35. export default {
  36. components: {
  37. topSwiper,
  38. contentText
  39. },
  40. data() {
  41. return {
  42. imgList: [],
  43. goodItem: {},
  44. good_id: '',
  45. time_id: '',
  46. status: 1,
  47. is_new: 0,//是否是新人 0->是 1->不是
  48. description: ''
  49. }
  50. },
  51. onLoad(opt) {
  52. this.good_id = opt.id
  53. this.time_id = opt.time
  54. this.status = opt.status
  55. this.is_new = opt.is_new == 0 ? 1 : 0
  56. this.getWholeDetai()
  57. },
  58. methods: {
  59. getWholeDetai() {
  60. let obj = this
  61. getWholeDetai({}, obj.good_id, obj.time_id, obj.status, obj.is_new).then(({
  62. data
  63. }) => {
  64. obj.goodItem = data.storeInfo
  65. obj.imgList = data.storeInfo.images
  66. obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
  67. })
  68. },
  69. reservePackage() {
  70. let obj = this
  71. let updata = {
  72. whole_id: obj.good_id,
  73. time_id: obj.time_id,
  74. price: obj.goodItem.price,
  75. to_uid: obj.is_new == 0 ? '':0,
  76. first_price: obj.is_new == 0?'':0,
  77. last_id: obj.is_new== 0? '': 0
  78. }
  79. reservePackage(updata).then(res => {
  80. console.log(res)
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .good-price {
  88. padding-left: 20rpx;
  89. padding-top: 20rpx;
  90. justify-content: flex-start;
  91. background-color: #fff;
  92. // align-items: f;
  93. .new-price {
  94. font-size: 50rpx;
  95. font-family: PingFang SC;
  96. font-weight: bold;
  97. color: #FF4C4C;
  98. }
  99. .old-price {
  100. padding-left: 8rpx;
  101. font-size: 33rpx;
  102. font-family: PingFang SC;
  103. font-weight: bold;
  104. text-decoration: line-through;
  105. color: #999999;
  106. }
  107. }
  108. .good-tit {
  109. padding: 20rpx;
  110. background-color: #fff;
  111. }
  112. .btm-btn {
  113. position: fixed;
  114. bottom: 35rpx;
  115. left: 0;
  116. right: 0;
  117. margin: auto;
  118. width: 699rpx;
  119. height: 90rpx;
  120. line-height: 90rpx;
  121. text-align: center;
  122. background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
  123. border-radius: 45rpx;
  124. font-size: 36rpx;
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. color: #FFFFFF;
  128. // background-color: #fff;
  129. }
  130. /* 商品详情中限制图片大小 */
  131. /deep/ .rich-img {
  132. width: 100% !important;
  133. height: auto;
  134. }
  135. </style>