detail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <app-layout>
  3. <app-swiper :height="360" :list="list.pic_url" :autoplay="true" name="pic_url"></app-swiper>
  4. <view class="head">
  5. <view class="name">{{list.name}}</view>
  6. <view class="dir-left-nowrap cross-center score">
  7. <view class="box-grow-0">评分:</view>
  8. <icon v-for="i in list.score" :key="i" class="box-grow-0 image" type></icon>
  9. </view>
  10. <view class="time">营业时间:{{list.business_hours}}</view>
  11. </view>
  12. <view class="cross-center tel">
  13. <view class="box-grow-0">电话:</view>
  14. <view class="box-grow-1 info">{{list.mobile}}</view>
  15. <image @click="mobile" class="box-grow-0" src="/static/image/icon/store-tel.png"></image>
  16. </view>
  17. <view class="cross-top address">
  18. <view class="box-grow-0">地址:</view>
  19. <view class="box-grow-1 info">{{list.address}}</view>
  20. <image @click="goto" class="box-grow-0" src="/static/image/icon/store-navigate.png"></image>
  21. </view>
  22. <view class="bg-line"></view>
  23. <view class="content cross-center">店铺介绍</view>
  24. <view class="end">
  25. <app-rich-text :content="list.description"></app-rich-text>
  26. </view>
  27. </app-layout>
  28. </template>
  29. <script>
  30. import appSwiper from "../../components/page-component/app-swiper/app-swiper.vue";
  31. import appRichText from "../../components/basic-component/app-rich/parse.vue";
  32. export default {
  33. name: "detail",
  34. components: {appSwiper, appRichText},
  35. data() {
  36. return {
  37. list: {
  38. business_hours: '',
  39. name: '',
  40. mobile: '',
  41. score: '',
  42. address: '',
  43. description: '',
  44. },
  45. }
  46. },
  47. // #ifdef MP
  48. onShareAppMessage() {
  49. return this.$shareAppMessage({
  50. title: this.list.name,
  51. path: '/pages/store/detail',
  52. params: {
  53. id: this.list.id,
  54. }
  55. });
  56. },
  57. // #endif
  58. onLoad(options) { this.$commonLoad.onload(options);
  59. if (!options.id) {
  60. return;
  61. }
  62. const self = this;
  63. self.$showLoading({title: '加载中'});
  64. self.$request({
  65. url: self.$api.store.detail,
  66. data: {
  67. id: options.id
  68. }
  69. }).then(info => {
  70. self.$hideLoading();
  71. if (info.code === 0) {
  72. //#ifdef MP-BAIDU
  73. const score = info.data.list.score;
  74. let array = [];
  75. for (let i = 0; i < score; i++) {
  76. array.push(i);
  77. }
  78. info.data.list.score = array;
  79. //#endif
  80. self.list = info.data.list;
  81. }
  82. }).catch(info => {
  83. self.$hideLoading();
  84. })
  85. },
  86. methods: {
  87. goto: function (e) {
  88. const list = this.list;
  89. uni.openLocation({
  90. latitude: parseFloat(list.latitude),
  91. longitude: parseFloat(list.longitude),
  92. name: list.name,
  93. address: list.address,
  94. })
  95. },
  96. mobile: function () {
  97. uni.makePhoneCall({
  98. phoneNumber: this.list.mobile,
  99. })
  100. },
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .head {
  106. background: #FFFFFF;
  107. padding: 0 #{24rpx};
  108. font-size: #{26rpx};
  109. color: #999999;
  110. border-bottom: #{1px} solid #e2e2e2;
  111. .name {
  112. font-size: #{32rpx};
  113. font-weight: bold;
  114. color: #353535;
  115. padding-top: #{24rpx};
  116. }
  117. .score {
  118. margin-top: #{24rpx};
  119. .image {
  120. background-repeat: no-repeat;
  121. background-size: 100% 100%;
  122. background-image: url('../../static/image/icon/store-score.png');
  123. margin-left: #{6rpx};
  124. height: #{24rpx};
  125. width: #{28rpx};
  126. }
  127. }
  128. .time {
  129. margin-top: #{16rpx};
  130. margin-bottom: #{28rpx};
  131. }
  132. }
  133. .tel, .address {
  134. background: #FFFFFF;
  135. font-size: #{28rpx};
  136. color: #353535;
  137. padding: #{34rpx} 0 #{34rpx} #{24rpx};
  138. border-bottom: #{1px} solid #e2e2e2;
  139. .info {
  140. border-right: #{1px} solid #e2e2e2;
  141. padding-right: #{60rpx};
  142. }
  143. image {
  144. height: #{40rpx};
  145. width: #{40rpx};
  146. margin: 0 #{40rpx};
  147. align-self: center;
  148. }
  149. }
  150. .address {
  151. border-bottom: none;
  152. }
  153. .bg-line {
  154. background: #f7f7f7;
  155. height: #{20rpx};
  156. width: #{100%};
  157. }
  158. .content {
  159. background: #FFFFFF;
  160. padding-left: #{24rpx};
  161. height: #{72rpx};
  162. font-size: #{26rpx};
  163. color: #353535;
  164. border-bottom: #{1px} solid #e2e2e2;
  165. }
  166. .end {
  167. background: #FFFFFF;
  168. padding: #{32rpx} #{24rpx} #{32rpx};
  169. }
  170. </style>