storeInfo.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="center">
  3. <view class="store-info flex">
  4. <view class="store-top flex">
  5. <image class="simage" :src="info.image" mode=""></image>
  6. <view class="stop-main">
  7. <view class="stop-title">{{info.name}}</view>
  8. <view class="stop-address" v-if="info.jl">
  9. <image class="mrt-image" src="../../static/index/index10.png" mode=""></image>
  10. <view class="mrt-font" >距离{{info.jl}}M</view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="store-item">
  16. <image class="store-image1" src="../../static/img/store2.png" mode=""></image>
  17. <view class="store-font">营业时间:{{info.day_time}}</view>
  18. </view>
  19. <view class="store-item">
  20. <image class="store-image2" src="../../static/img/store3.png" mode=""></image>
  21. <view class="store-font">商家电话:{{ info.phone }}</view>
  22. </view>
  23. <view class="store-item">
  24. <image class="store-image3" src="../../static/img/store1.png" mode=""></image>
  25. <view class="store-font">门店地址:{{ info.detailed_address }}</view>
  26. </view>
  27. <view class="store-main" v-if="info.slider_image != null">
  28. <view class="smain-title">门头照片</view>
  29. <scroll-view class="scroll-box flex" @scroll="scroll" scroll-x="true" :scroll-with-animation="true" scroll-left="10px">
  30. <view class="scroll-item" v-for="(item,index) in info.slider_image" :key="index">
  31. <image class="scroll-image" :src="item" mode="heightFix"></image>
  32. </view>
  33. </scroll-view>
  34. </view>
  35. <view class="store-main" v-if="info.images != null">
  36. <view class="smain-title">店内图片</view>
  37. <scroll-view class="scroll-box flex" @scroll="scroll" scroll-x="true" :scroll-with-animation="true" scroll-left="10px">
  38. <view class="scroll-item" v-for="(item,index) in images" :key="index">
  39. <image class="scroll-image" src="" mode="heightFix"></image>
  40. </view>
  41. </scroll-view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { store_details } from '@/api/index.js'
  47. export default {
  48. data() {
  49. return {
  50. id:'',
  51. info:'',
  52. longitude:'',
  53. latitude:'',
  54. };
  55. },
  56. onLoad(option) {
  57. this.id = option.id;
  58. this.loadData();
  59. },
  60. methods: {
  61. loadData() {
  62. store_details({},this.id).then(({data}) =>{
  63. console.log(data);
  64. this.info = data
  65. })
  66. // uni.getLocation({
  67. // type: 'gcj02',
  68. // success: res => {
  69. // console.log('dizhi+++++++++++');
  70. // this.longitude = res.longitude //经度
  71. // this.latitude = res.latitude //纬度
  72. // store_details({},this.id).then(({data}) =>{
  73. // console.log(data);
  74. // data.jl = this.getFlatternDistance(this.latitude,this.longitude,data.latitude,data.longitude)
  75. // this.info = data
  76. // })
  77. // },
  78. // fail: err => {
  79. // console.log(err);
  80. // openMap().then(e => {
  81. // this.getaddress();
  82. // });
  83. // }
  84. // });
  85. },
  86. //根据经纬度计算距离
  87. getFlatternDistance(lat1, lng1, lat2, lng2){
  88. let f = getRad((lat1 + lat2)/2);
  89. let g = getRad((lat1 - lat2)/2);
  90. let l = getRad((lat1 - lng2)/2);
  91. let sg = Math.sin(g);
  92. let sl = Math.sin(1);
  93. let sf = Math.sin(f);
  94. let s,C,W,r ,d,h1,h2;
  95. let a = EARTH_RADIUS ;
  96. let fl = 1/298.257;
  97. sg = sg*sg;
  98. s1 = s1*sl;
  99. sf = sf*sf;
  100. g*(1-s1) + (1-sf)*s1;
  101. C = (1-sg)*(1-s1) + sf*sl;
  102. N = Math.atan(Math.sqrt(s/c));
  103. r = Math.sqrt(s*c)/w;
  104. d = 2*w*a;
  105. h1 = (3*r -1)/2/c;
  106. h2 = (3*r +1)/2/s;
  107. return d*(1 + fl*(h1*sf*(1-sg) - h2*(1-sf)*sg));
  108. },
  109. scroll(e) {
  110. console.log(e,"123456");
  111. }
  112. }
  113. };
  114. </script>
  115. <style lang="less">
  116. .center,
  117. page {
  118. background: #f8f8f8;
  119. height: 100%;
  120. }
  121. .store-info {
  122. background: #ffffff;
  123. .store-top {
  124. padding: 40rpx 20rpx;
  125. justify-content: flex-start;
  126. .simage {
  127. width: 130rpx;
  128. height: 130rpx;
  129. background: #f44939;
  130. }
  131. .stop-main {
  132. height: 130rpx;
  133. padding: 6rpx 0;
  134. margin-left: 20rpx;
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: space-between;
  138. align-items: flex-start;
  139. .stop-title {
  140. font-size: 36rpx;
  141. font-family: PingFang SC;
  142. font-weight: 500;
  143. color: #000000;
  144. }
  145. .stop-address {
  146. display: flex;
  147. justify-content: flex-end;
  148. align-items: center;
  149. .mrt-image {
  150. width: 20rpx;
  151. height: 28rpx;
  152. }
  153. .mrt-font {
  154. margin-left: 8rpx;
  155. font-size: 22rpx;
  156. font-family: PingFang SC;
  157. font-weight: 500;
  158. color: #666666;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. .store-item {
  165. background: #ffffff;
  166. display: flex;
  167. justify-content: flex-start;
  168. align-items: center;
  169. padding: 30rpx 30rpx 30rpx 44rpx;
  170. .store-image1 {
  171. width: 36rpx;
  172. height: 36rpx;
  173. }
  174. .store-image2 {
  175. margin: 0 1rpx;
  176. width: 34rpx;
  177. height: 34rpx;
  178. }
  179. .store-image3 {
  180. margin: 0 7rpx;
  181. width: 22rpx;
  182. height: 28rpx;
  183. }
  184. .store-font {
  185. margin-left: 22rpx;
  186. font-size: 26rpx;
  187. font-family: PingFang SC;
  188. font-weight: 500;
  189. color: #2d2d2d;
  190. }
  191. }
  192. .store-main {
  193. margin-top: 16rpx;
  194. background: #FFFFFF;
  195. padding: 30rpx 42rpx 40rpx;
  196. .smain-title {
  197. font-size: 30rpx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #464646;
  201. }
  202. }
  203. .scroll-box {
  204. white-space: nowrap;
  205. margin-top: 30rpx;
  206. height: 240rpx;
  207. .scroll-item:first-child {
  208. margin-left: 0;
  209. }
  210. .scroll-item {
  211. margin-left: 20rpx;
  212. display: inline-block;
  213. height: 240rpx;
  214. width: 240rpx;
  215. }
  216. .scroll-image {
  217. height: 240rpx;
  218. width: 240rpx;
  219. background: #5AC725;
  220. }
  221. }
  222. </style>