index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <page-meta :page-style="lock ? 'overflow: hidden' : 'overflow: auto'" />
  3. <page nav-color="transparent" ref="pageRef">
  4. <top v-if="data" :data="data.spu" :cover="data.spu.cover" :price="data.price" :down="data.status != 1" :finish="data.status == 99"/>
  5. <argument v-if="data" :data="data.spu" />
  6. <bid-record v-if="data" :data="data.latestTradeBid" />
  7. <moli v-if="data && data.recommendedLuckPool && data.recommendedLuckPool.length > 0" :data="data.recommendedLuckPool" />
  8. <detail v-if="data" :data="data.spu" />
  9. <view v-if="data && data.status === 1" class="fill-height"></view>
  10. <view v-if="data && data.status === 1" class="bottom paddingX14 flex-align bgcolor-white">
  11. <view class="btn-k" @click="showBid">出价</view>
  12. <view class="btn marginL25" @click="showCheckout">立即购买</view>
  13. </view>
  14. <checkout ref="checkoutRef" v-if="data" :data="data" />
  15. <image v-if="topVisible" :src="resource.top" webp class="fixed" style="right:30rpx; bottom: 400rpx;width: 72rpx;height: 72rpx"
  16. @click="$common.scrollTop()" />
  17. <bid ref="bidRef" :tradeGoodsId="goodsId" @success="onBidSuccess" />
  18. </page>
  19. </template>
  20. <script>
  21. import top from './../product/top'
  22. import argument from './argument'
  23. import moli from './../product/moli'
  24. import detail from './../product/detail'
  25. import checkout from './checkout'
  26. import resource from '@/utils/resource'
  27. import loginMixin from '@/mixin/login'
  28. import bid from './bid'
  29. import bidRecord from './bid_record'
  30. export default {
  31. mixins: [loginMixin],
  32. components: { top, argument, moli, detail, checkout, bid, bidRecord },
  33. data() {
  34. return {
  35. resource,
  36. goodsId: '',
  37. data: null,
  38. topVisible: false,
  39. lock: false
  40. }
  41. },
  42. onLoad(options) {
  43. this.goodsId = options.id
  44. },
  45. mounted() {
  46. this.getData(true)
  47. },
  48. onPageScroll(e) {
  49. this.topVisible = e.scrollTop > 800
  50. },
  51. onShareAppMessage(res) {
  52. return {
  53. title: this.data.spu.name,
  54. path: '/pages/sell_detail/index?id=' + this.goodsId
  55. }
  56. },
  57. onShareTimeline() {
  58. return {
  59. title: this.data.spu.name,
  60. query: 'id=' + this.goodsId,
  61. imageUrl: this.data.spu.cover
  62. }
  63. },
  64. methods: {
  65. init() {
  66. this.getData()
  67. },
  68. async getData(loading = false) {
  69. const res = await this.$service.sell.detail(this.goodsId, loading)
  70. this.data = res
  71. },
  72. showBid() {
  73. if (!this.$common.checkLogin()) return
  74. this.$refs.bidRef.show()
  75. },
  76. onBidSuccess() {
  77. this.getData()
  78. this.$message.success('出价成功')
  79. },
  80. async showCheckout() {
  81. if (!this.$common.checkLogin()) return
  82. const res = await this.$service.sell.previewSubmit(this.goodsId)
  83. res && this.$refs.checkoutRef.show(res)
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .fill-height {
  90. height: 164rpx;
  91. }
  92. .bottom {
  93. position: fixed;
  94. left: 0;
  95. right: 0;
  96. bottom: 0;
  97. height: 148rpx;
  98. padding-bottom: 60rpx;
  99. .btn-k {
  100. margin-top: 30rpx;
  101. flex: 1;
  102. height: 88rpx;
  103. border: 2rpx solid #a76ef4;
  104. border-radius: 44rpx;
  105. line-height: 88rpx;
  106. text-align: center;
  107. font-size: 32rpx;
  108. color: #a76ef4;
  109. }
  110. .btn {
  111. margin-top: 30rpx;
  112. flex: 1;
  113. margin-left: 30rpx;
  114. color: #fff;
  115. font-size: 32rpx;
  116. height: 88rpx;
  117. line-height: 88rpx;
  118. text-align: center;
  119. border-radius: 44rpx;
  120. background: linear-gradient(270deg, #d070ff 0%, #8b3dff 100%);
  121. }
  122. }
  123. </style>