1
0

detail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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"></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. //
  48. onShareAppMessage: function () {
  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. onLoad: function (options) {
  58. if (!options.id) {
  59. return;
  60. }
  61. const self = this;
  62. self.$showLoading({title: '加载中'});
  63. self.$request({
  64. url: self.$api.store.detail,
  65. data: {
  66. id: options.id
  67. }
  68. }).then(info => {
  69. self.$hideLoading();
  70. if (info.code === 0) {
  71. //#ifdef MP-BAIDU
  72. const score = info.data.list.score;
  73. let array = [];
  74. for (let i = 0; i < score; i++) {
  75. array.push(i);
  76. }
  77. info.data.list.score = array;
  78. //#endif
  79. self.list = info.data.list;
  80. }
  81. }).catch(info => {
  82. self.$hideLoading();
  83. })
  84. },
  85. methods: {
  86. goto: function (e) {
  87. const list = this.list;
  88. uni.openLocation({
  89. latitude: parseFloat(list.latitude),
  90. longitude: parseFloat(list.longitude),
  91. name: list.name,
  92. address: list.address,
  93. })
  94. },
  95. mobile: function () {
  96. uni.makePhoneCall({
  97. phoneNumber: this.list.mobile,
  98. })
  99. },
  100. }
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .head {
  105. background: #FFFFFF;
  106. padding: 0 #{24rpx};
  107. font-size: #{26rpx};
  108. color: #999999;
  109. border-bottom: #{1px} solid #e2e2e2;
  110. .name {
  111. font-size: #{32rpx};
  112. font-weight: bold;
  113. color: #353535;
  114. padding-top: #{24rpx};
  115. }
  116. .score {
  117. margin-top: #{24rpx};
  118. .image {
  119. background-repeat: no-repeat;
  120. background-size: 100% 100%;
  121. background-image: url('../../static/image/icon/store-score.png');
  122. margin-left: #{6rpx};
  123. height: #{24rpx};
  124. width: #{28rpx};
  125. }
  126. }
  127. .time {
  128. margin-top: #{16rpx};
  129. margin-bottom: #{28rpx};
  130. }
  131. }
  132. .tel, .address {
  133. background: #FFFFFF;
  134. font-size: #{28rpx};
  135. color: #353535;
  136. padding: #{34rpx} 0 #{34rpx} #{24rpx};
  137. border-bottom: #{1px} solid #e2e2e2;
  138. .info {
  139. border-right: #{1px} solid #e2e2e2;
  140. padding-right: #{60rpx};
  141. }
  142. image {
  143. height: #{40rpx};
  144. width: #{40rpx};
  145. margin: 0 #{40rpx};
  146. align-self: center;
  147. }
  148. }
  149. .address {
  150. border-bottom: none;
  151. }
  152. .bg-line {
  153. background: #f7f7f7;
  154. height: #{20rpx};
  155. width: #{100%};
  156. }
  157. .content {
  158. background: #FFFFFF;
  159. padding-left: #{24rpx};
  160. height: #{72rpx};
  161. font-size: #{26rpx};
  162. color: #353535;
  163. border-bottom: #{1px} solid #e2e2e2;
  164. }
  165. .end {
  166. background: #FFFFFF;
  167. padding: #{32rpx} #{24rpx} #{32rpx};
  168. }
  169. </style>