index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="page-wrap">
  3. <swiper class="swiper-panel" circular indicator-dots indicator-color="#fff" indicator-active-color="#00bcd2">
  4. <swiper-item>
  5. <image class="img" src="@/static/img_banner_1.jpg" mode="aspectFill"></image>
  6. </swiper-item>
  7. <swiper-item>
  8. <image class="img" src="@/static/img_banner_2.jpg" mode="aspectFill"></image>
  9. </swiper-item>
  10. </swiper>
  11. <view class="product-panel">
  12. <view class="name">{{ productInfo.name }}</view>
  13. <view class="desc">{{ productInfo.title }}</view>
  14. <view class="tags">
  15. <view class="tag" v-for="(tag, tagIndex) in tags" :key="tagIndex">{{ filterDict(tag, tagList) }}</view>
  16. </view>
  17. <view class="price">{{ productInfo.salePrice }}</view>
  18. </view>
  19. <view class="nav-panel">
  20. <view class="item" @click="handleOpenLocation">
  21. <view class="label">{{ productInfo.address }}</view>
  22. <view class="text">导航</view>
  23. <image class="icon" src="@/static/icon_pointer.png"></image>
  24. </view>
  25. <view class="item" @click="handleCallPhone">
  26. <view class="label">24小时服务电话</view>
  27. <view class="text">电话</view>
  28. <image class="icon" src="@/static/icon_tel.png"></image>
  29. </view>
  30. </view>
  31. <view :class="{ 'info-panel': true, collapse: isCollapseExplain }">
  32. <view class="title">服务说明</view>
  33. <view class="content">
  34. <image class="explain-img" src="@/static/img_product_detail.jpg"></image>
  35. </view>
  36. <view class="collapse-btn" @click="isCollapseExplain = !isCollapseExplain"></view>
  37. </view>
  38. <view :class="{ 'info-panel': true, collapse: isCollapseTips }">
  39. <view class="title">温馨提示</view>
  40. <view class="content">
  41. <view class="p">
  42. 我们的每款产品都是一次性收费,保证无二次收费。标注的产品价格,可能会因更新不及时,与实际价格有差异,具体请参见
  43. <text class="b">《鑫恩华价格发布规范》</text>
  44. </view>
  45. <view class="p">如果您有不同需求,请在下单之前联系客服,再次衷心感谢新老客户们一直以来对我集团的支持,我们将竭诚为您服务,您的满意是我们最大的追求!</view>
  46. </view>
  47. <view class="collapse-btn" @click="isCollapseTips = !isCollapseTips"></view>
  48. </view>
  49. <view class="info-panel">
  50. <view class="title">相关推荐</view>
  51. <view class="content">
  52. <scroll-view class="recommend-scorll" scroll-x>
  53. <view class="recommend-list">
  54. <view class="item" v-for="(item, index) in [1, 2, 3, 4, 5, 6]" :key="index">
  55. <image class="img" src="@/static/img_banner_1.jpg" mode="aspectFill"></image>
  56. <view class="name">公章刻印</view>
  57. </view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. </view>
  62. <view class="foot-panel">
  63. <view class="foot-wrap">
  64. <button class="share-btn" open-type="share">
  65. <image class="icon" src="@/static/svg/user_nav_4.svg"></image>
  66. 分享海报
  67. </button>
  68. <button class="btn btn-1" @click="handleCallPhone">电话咨询</button>
  69. <button class="btn">下单购买</button>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import productService from '@/api/product.js';
  76. import systemService from '@/api/system.js';
  77. import { filterDict } from '@/utils/util.js';
  78. export default {
  79. data() {
  80. return {
  81. productId: '',
  82. productInfo: '',
  83. tags: [],
  84. tagList: '',
  85. isCollapseExplain: true,
  86. isCollapseTips: true
  87. };
  88. },
  89. onLoad(option) {
  90. this.productId = option.id;
  91. this.getProductDetail();
  92. this.getTagConfig();
  93. },
  94. onShareAppMessage() {
  95. return {
  96. title: this.productInfo.name,
  97. path: '/pages/index/product/index?id=' + this.productId
  98. };
  99. },
  100. methods: {
  101. // 获取商品详情
  102. async getProductDetail() {
  103. const { data } = await productService.getProductDetail(this.productId);
  104. this.productInfo = data;
  105. this.tags = data.label ? data.label.split(',') : [];
  106. },
  107. // 获取标签配置
  108. async getTagConfig() {
  109. const { rows } = await systemService.getDict('fin_product_tag');
  110. this.tagList = rows;
  111. },
  112. handleCallPhone() {
  113. if (!this.productInfo.telephone) return;
  114. uni.makePhoneCall({
  115. phoneNumber: this.productInfo.telephone
  116. });
  117. },
  118. handleOpenLocation() {
  119. let { coordinate, address } = this.productInfo;
  120. if (!coordinate) return;
  121. coordinate = coordinate.split(',');
  122. console.log(coordinate);
  123. uni.openLocation({
  124. latitude: +coordinate[0],
  125. longitude: +coordinate[1],
  126. address
  127. });
  128. },
  129. filterDict
  130. }
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. @import 'index.scss';
  135. </style>