detail.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="content">
  3. <block v-if="loading">
  4. <view class="skeleton-line max animate" style="height: 400rpx;"></view>
  5. <view class="skeleton">
  6. <view class="skeleton-line animate mt15"></view>
  7. <view class="skeleton-line min animate mt15"></view>
  8. <view class="skeleton-line min animate mt15"></view>
  9. </view>
  10. <view class="skeleton-line max animate mt15" style="height: 200upx;"></view>
  11. <view class="skeleton-line max animate mt15" style="height: 200upx;"></view>
  12. </block>
  13. <view class="goods-content" v-else>
  14. <scroll-view class="goods-body" scroll-y scroll-with-animation>
  15. </scroll-view>
  16. <view class="footer">
  17. <view class="footer-op">
  18. <view class="footer-left">
  19. <view class="item" @click="toNav('home')"><image src="/static/image/goods/home.png"></image>首页</view>
  20. <view class="item" @click="kfPop"><image src="/static/image/goods/service.png"></image>客服</view>
  21. <view class="item" @click="toNav('order')"><image src="/static/image/goods/order.png"></image>订单</view>
  22. </view>
  23. <view class="footer-right" @click="buyOrder(1)" v-if="isLogin">立即购买 {{ goodsData?$dialog.formatMoney(goodsData.price):'0.00'}}</view>
  24. <button class="footer-right" @click="toLogin" v-else>登录下单 {{ goodsData?$dialog.formatMoney(goodsData.price):''}}</button>
  25. </view>
  26. <view class="footer-safe"></view>
  27. </view>
  28. </view>
  29. <halfLogin ref="loginCom"></halfLogin>
  30. <kfService ref="kfService"></kfService>
  31. </view>
  32. </template>
  33. <script>
  34. var app;
  35. export default {
  36. data() {
  37. return {
  38. options:null,
  39. isLogin:null,
  40. loading:false,
  41. goodsData:null
  42. }
  43. },
  44. onLoad(options) {
  45. app = this;
  46. const data = uni.getLaunchOptionsSync();
  47. options.scene = data.scene
  48. app.options = options
  49. app.isLogin = uni.getStorageSync("user_token");
  50. },
  51. methods: {
  52. toLogin(){
  53. this.$refs.loginCom.open();
  54. },
  55. kfPop(){
  56. this.$refs.kfService.open();
  57. },
  58. toNav(type) {
  59. var url = "";
  60. switch (type) {
  61. case "order":
  62. url = "/pages/order/order"
  63. break;
  64. case "home":
  65. default:
  66. url = "/pages/index/index"
  67. break;
  68. }
  69. uni.switchTab({
  70. url:url
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .content {
  78. background-color: #fff;
  79. height: 100vh;
  80. .skeleton{
  81. width: 95%;
  82. margin: 0 auto;
  83. }
  84. .goods-content{
  85. position: fixed;
  86. z-index: 1;
  87. top: 0;
  88. left: 0;
  89. bottom: 0;
  90. right: 0;
  91. background-color: #ededed;
  92. display: flex;
  93. flex-direction: column;
  94. }
  95. .goods-body{
  96. height: 0;
  97. flex: 1;
  98. }
  99. .footer{
  100. background-color: #fff;padding: 20upx 20upx 0 20upx;border-top: 2upx solid #f8f8f8;
  101. .footer-op{
  102. display: flex;align-items: center;
  103. .footer-left{
  104. display: flex;align-items: center;gap: 40upx;justify-content: center;
  105. .item{flex-direction: column;display: flex;font-size: 24rpx;color: #333;align-items: center;}
  106. image{width: 40upx;height: 40upx;}
  107. }
  108. .footer-right{
  109. background-color: $main-color;
  110. color: #fff;
  111. font-size: 28rpx;
  112. flex: 1;
  113. margin-left: 40upx;
  114. height: 80upx;
  115. border-radius: 10upx;
  116. line-height: 80upx;
  117. text-align: center;
  118. }
  119. }
  120. .footer-safe {
  121. height: env(safe-area-inset-bottom);width: 100%;
  122. }
  123. }
  124. }
  125. </style>