wholesaleDetail.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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="loading? '':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. getWholeInfo
  35. } from '@/api/whole.js'
  36. export default {
  37. components: {
  38. topSwiper,
  39. contentText
  40. },
  41. data() {
  42. return {
  43. imgList: [],
  44. goodItem: {},
  45. good_id: '',
  46. time_id: '',
  47. status: 1,
  48. is_new: '',
  49. description: '',
  50. loading: false,
  51. }
  52. },
  53. onLoad(opt) {
  54. if (opt.id) {
  55. this.good_id = opt.id
  56. }
  57. if (opt.time) {
  58. this.time_id = opt.time
  59. }
  60. if (opt.status) {
  61. this.status = opt.status
  62. }
  63. if (opt.is_new) {
  64. this.is_new = opt.is_new
  65. }
  66. this.getWholeDetai()
  67. },
  68. methods: {
  69. getWholeDetai() {
  70. let obj = this
  71. if (obj.is_new) {
  72. getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 1).then(({
  73. data
  74. }) => {
  75. obj.goodItem = data.storeInfo
  76. obj.imgList = data.storeInfo.images
  77. obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
  78. })
  79. } else {
  80. getWholeInfo({},obj.good_id).then(({data}) => {
  81. obj.goodItem = data.storeInfo
  82. obj.imgList = data.storeInfo.images
  83. obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
  84. })
  85. // getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 0).then(({
  86. // data
  87. // }) => {
  88. // obj.goodItem = data.storeInfo
  89. // obj.imgList = data.storeInfo.images
  90. // obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
  91. // })
  92. }
  93. },
  94. // 预约包
  95. reservePackage() {
  96. let obj = this
  97. let updata = {
  98. whole_id: obj.good_id,
  99. time_id: obj.time_id,
  100. price: obj.goodItem.price,
  101. to_uid: obj.is_new == 'isn' ? 0 : '',
  102. first_price: obj.is_new == 'isn' ? 0 : '',
  103. last_id: obj.is_new == 'isn' ? 0 : ''
  104. }
  105. obj.loading = true
  106. reservePackage(updata).then(res => {
  107. uni.showToast({
  108. title: '预约成功',
  109. duration: 2000
  110. });
  111. setTimeout(function() {
  112. uni.navigateTo({
  113. url: '/pages/user/myWholesale'
  114. });
  115. }, 800);
  116. }).catch(err => {
  117. obj.loading = false
  118. console.log(err)
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .good-price {
  126. padding-left: 20rpx;
  127. padding-top: 20rpx;
  128. justify-content: flex-start;
  129. background-color: #fff;
  130. // align-items: f;
  131. .new-price {
  132. font-size: 50rpx;
  133. font-family: PingFang SC;
  134. font-weight: bold;
  135. color: #FF4C4C;
  136. }
  137. .old-price {
  138. padding-left: 8rpx;
  139. font-size: 33rpx;
  140. font-family: PingFang SC;
  141. font-weight: bold;
  142. text-decoration: line-through;
  143. color: #999999;
  144. }
  145. }
  146. .good-tit {
  147. padding: 20rpx;
  148. background-color: #fff;
  149. }
  150. .btm-btn {
  151. position: fixed;
  152. bottom: 35rpx;
  153. left: 0;
  154. right: 0;
  155. margin: auto;
  156. width: 699rpx;
  157. height: 90rpx;
  158. line-height: 90rpx;
  159. text-align: center;
  160. background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
  161. border-radius: 45rpx;
  162. font-size: 36rpx;
  163. font-family: PingFang SC;
  164. font-weight: 500;
  165. color: #FFFFFF;
  166. // background-color: #fff;
  167. }
  168. /* 商品详情中限制图片大小 */
  169. /deep/ .rich-img {
  170. width: 100% !important;
  171. height: auto;
  172. }
  173. </style>