shopDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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">
  9. <image class="mrt-image" src="../../static/index/index10.png" mode=""></image>
  10. <view class="mrt-font">距离您{{ info.jl }}KM</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/index/index10.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"
  30. scroll-left="10px">
  31. <view class="scroll-item" v-for="(item, index) in info.slider_image" :key="index">
  32. <image class="scroll-image" :src="item" mode="heightFix" @click="openImg(info.slider_image,item)">
  33. </image>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. <view class="" style="padding: 20rpx 20rpx 1rpx 20rpx;background-color: #fff;margin-top: 20rpx;">
  38. <view class="shop-dhq flex" v-for="qitem in info.coupon">
  39. <view class="dhq-left flex f-d-c f-j-c fg1 f-ai-s">
  40. <view class="dhq-name">
  41. {{qitem.store_name}}
  42. </view>
  43. <view class="dhq-price flex">
  44. <view class="j-price">
  45. {{qitem.price}}
  46. </view>
  47. <view class="j-zk">
  48. {{(((qitem.price*10)/(qitem.ot_price*1)).toFixed(1))}}折
  49. </view>
  50. </view>
  51. </view>
  52. <view class="dhq-right fs0">
  53. <view class="right-btn" @click="goBuy(qitem)">
  54. 抢购
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="store-main" v-if="info.images != null">
  60. <view class="smain-title">店内图片</view>
  61. <scroll-view class="scroll-box flex" @scroll="scroll" scroll-x="true" :scroll-with-animation="true"
  62. scroll-left="10px">
  63. <view class="scroll-item" v-for="(item, index) in info.images" :key="index">
  64. <image class="scroll-image" :src="item" mode="heightFix" @click="openImg(info.images,item)"></image>
  65. </view>
  66. </scroll-view>
  67. </view>
  68. <view class="" style="height: 100rpx;">
  69. </view>
  70. <view class="btn-box flex">
  71. <view class="btn-left" @click="tocall()">联系商家</view>
  72. <view class="btn-right" @click="toGaodeMap()">导航到店</view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. // #ifdef H5
  78. import {
  79. weixindata,
  80. shareLoad
  81. } from '@/utils/wxAuthorized';
  82. // #endif
  83. import {
  84. mapState,
  85. mapMutations
  86. } from 'vuex';
  87. import {
  88. getStoreDetail
  89. } from '@/api/shop.js'
  90. import {
  91. store_details
  92. } from '@/api/index.js';
  93. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  94. export default {
  95. data() {
  96. return {
  97. id: '',
  98. info: '',
  99. address: ''
  100. };
  101. },
  102. computed: {
  103. ...mapState(['loginInterceptor', 'baseURL', 'latitude', 'longitude']),
  104. },
  105. onLoad(option) {
  106. this.id = option.id;
  107. // this.loadData();
  108. if (this.latitude) {
  109. this.getStoreDetail()
  110. } else {
  111. this.getaddress()
  112. }
  113. // this.getStoreDetail()
  114. },
  115. methods: {
  116. // 获取门店详情
  117. getStoreDetail() {
  118. let obj = this
  119. getStoreDetail({}, obj.id).then(res => {
  120. console.log(res)
  121. obj.info = res.data
  122. obj.info.jl = obj.getFlatternDistance(obj.latitude, obj.longitude, obj.info.latitude, obj
  123. .info.longitude);
  124. })
  125. },
  126. markertap(e) {
  127. let obj = this
  128. // #ifdef H5
  129. weixindata().then(wxOjb => {
  130. console.log(wxOjb, '获取微信');
  131. wxOjb.openLocation({
  132. latitude: obj.info.latitude, // 纬度,浮点数,范围为90 ~ -90
  133. longitude: obj.info.longitude, // 经度,浮点数,范围为180 ~ -180。
  134. name: obj.info.name, // 位置名
  135. address: obj.info.detailed_address, // 地址详情说明
  136. scale: 28, // 地图缩放级别,整型值,范围从1~28。默认为最大
  137. infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
  138. });
  139. });
  140. // #endif
  141. },
  142. //根据经纬度计算距离
  143. getFlatternDistance(lat1, lng1, lat2, lng2) {
  144. console.log(lat1, lng1, lat2, lng2)
  145. let radLat1 = (lat1 * Math.PI) / 180.0;
  146. let radLat2 = (lat2 * Math.PI) / 180.0;
  147. let a = radLat1 - radLat2;
  148. let b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
  149. let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
  150. .pow(Math.sin(b / 2), 2)));
  151. s = s * 6378.137;
  152. s = Math.round(s * 10000) / 10000;
  153. return s;
  154. },
  155. scroll(e) {
  156. console.log(e, '123456');
  157. },
  158. tocall() {
  159. let num = this.info.phone;
  160. console.log(num);
  161. uni.makePhoneCall({
  162. phoneNumber: num //仅为示例
  163. });
  164. },
  165. goBuy(item) {
  166. uni.navigateTo({
  167. url: '/pages/product/product?id=' + item.id
  168. })
  169. },
  170. getaddress() {
  171. console.log('dizhi+++++++++++');
  172. let obj = this;
  173. // #ifdef H5
  174. weixindata().then(wxOjb => {
  175. console.log(wxOjb, '获取微信');
  176. wxOjb.getLocation({
  177. type: 'gcj02',
  178. success: res => {
  179. console.log(res, 123456);
  180. obj.setLat(res.latitude);
  181. obj.setLon(res.longitude);
  182. obj.getStoreDetail()
  183. },
  184. fail: err => {
  185. console.log(err, 'shi+++++++++++++++');
  186. openMap().then(e => {
  187. obj.getaddress();
  188. });
  189. }
  190. });
  191. });
  192. // #endif
  193. },
  194. //
  195. openImg(list, item) {
  196. uni.previewImage({
  197. current: item,
  198. urls: list
  199. })
  200. },
  201. // 调用高德
  202. toGaodeMap() {
  203. let obj = this
  204. window.location.href =
  205. `https://uri.amap.com/marker?position=${obj.info.longitude},${obj.info.latitude}&name=${obj.info.name}`;
  206. },
  207. }
  208. };
  209. </script>
  210. <style lang="less">
  211. .center,
  212. page {
  213. background: #f8f8f8;
  214. height: 100%;
  215. }
  216. .store-info {
  217. background: #ffffff;
  218. .store-top {
  219. padding: 40rpx 20rpx;
  220. justify-content: flex-start;
  221. .simage {
  222. width: 130rpx;
  223. height: 130rpx;
  224. background: #f44939;
  225. }
  226. .stop-main {
  227. height: 130rpx;
  228. padding: 6rpx 0;
  229. margin-left: 20rpx;
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: space-between;
  233. align-items: flex-start;
  234. .stop-title {
  235. font-size: 36rpx;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. color: #000000;
  239. }
  240. .stop-address {
  241. display: flex;
  242. justify-content: flex-end;
  243. align-items: center;
  244. .mrt-image {
  245. width: 20rpx;
  246. height: 28rpx;
  247. }
  248. .mrt-font {
  249. margin-left: 8rpx;
  250. font-size: 22rpx;
  251. font-family: PingFang SC;
  252. font-weight: 500;
  253. color: #666666;
  254. }
  255. }
  256. }
  257. }
  258. }
  259. .store-item {
  260. background: #ffffff;
  261. display: flex;
  262. justify-content: flex-start;
  263. align-items: center;
  264. padding: 30rpx 30rpx 30rpx 44rpx;
  265. .store-image1 {
  266. width: 36rpx;
  267. height: 36rpx;
  268. }
  269. .store-image2 {
  270. margin: 0 1rpx;
  271. width: 34rpx;
  272. height: 34rpx;
  273. }
  274. .store-image3 {
  275. margin: 0 7rpx;
  276. width: 22rpx;
  277. height: 28rpx;
  278. }
  279. .store-font {
  280. margin-left: 22rpx;
  281. font-size: 26rpx;
  282. font-family: PingFang SC;
  283. font-weight: 500;
  284. color: #2d2d2d;
  285. }
  286. }
  287. .store-main {
  288. margin-top: 16rpx;
  289. background: #ffffff;
  290. padding: 30rpx 42rpx 40rpx;
  291. .smain-title {
  292. font-size: 30rpx;
  293. font-family: PingFang SC;
  294. font-weight: 500;
  295. color: #464646;
  296. }
  297. }
  298. .scroll-box {
  299. white-space: nowrap;
  300. margin-top: 30rpx;
  301. height: 240rpx;
  302. .scroll-item:first-child {
  303. margin-left: 0;
  304. }
  305. .scroll-item {
  306. margin-left: 20rpx;
  307. display: inline-block;
  308. height: 240rpx;
  309. // width: 240rpx;
  310. }
  311. .scroll-image {
  312. height: 240rpx;
  313. // width: 240rpx;
  314. }
  315. }
  316. .btn-box {
  317. position: fixed;
  318. bottom: 0rpx;
  319. left: 0;
  320. right: 0;
  321. width: 750rpx;
  322. background: rgba(255, 255, 255, 0.6);
  323. box-shadow: 0rpx 0rpx 20rpx 0px rgba(50, 50, 52, 0.06);
  324. padding: 22rpx 68rpx;
  325. .btn-left {
  326. width: 280rpx;
  327. height: 80rpx;
  328. background: linear-gradient(180deg, #ffa30b, #ffd158);
  329. box-shadow: 0px 3rpx 13rpx 3rpx rgba(255, 164, 13, 0.48);
  330. border-radius: 40rpx;
  331. text-align: center;
  332. line-height: 80rpx;
  333. font-size: 32rpx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #ffffff;
  337. }
  338. .btn-right {
  339. width: 280rpx;
  340. height: 80rpx;
  341. background: linear-gradient(180deg, #ff6223, #ffab60);
  342. box-shadow: 0px 3rpx 13rpx 3rpx rgba(255, 164, 13, 0.48);
  343. border-radius: 40rpx;
  344. text-align: center;
  345. line-height: 80rpx;
  346. font-size: 32rpx;
  347. font-family: PingFang SC;
  348. font-weight: 500;
  349. color: #ffffff;
  350. }
  351. }
  352. .popup_row {
  353. width: 100%;
  354. height: 500rpx;
  355. background-color: #ffffff;
  356. border-radius: 20rpx;
  357. display: flex;
  358. justify-content: center;
  359. align-items: center;
  360. .rows {
  361. width: 100%;
  362. padding: 0 24rpx;
  363. .rows-item {
  364. height: 80rpx;
  365. line-height: 80rpx;
  366. text-align: center;
  367. width: 100%;
  368. font-size: 32rpx;
  369. color: #303133;
  370. // border-bottom: 1rpx solid #f0f0f0;
  371. }
  372. // .row-1 {
  373. // margin: auto;
  374. // .first_aid {
  375. // width: 300rpx;
  376. // height: 300rpx;
  377. // }
  378. // }
  379. // .row-2 {
  380. // font-size: 38rpx;
  381. // margin-top: 20rpx;
  382. // }
  383. }
  384. }
  385. .shop-dhq {
  386. width: 702rpx;
  387. height: 171rpx;
  388. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.15);
  389. margin: auto;
  390. border-radius: 20rpx;
  391. background-color: #fff;
  392. padding: 0 48rpx 0 26rpx;
  393. margin-bottom: 20rpx;
  394. .dhq-left {
  395. .dhq-name {
  396. font-size: 33rpx;
  397. font-weight: bold;
  398. color: #333333;
  399. }
  400. .dhq-price {
  401. padding-top: 20rpx;
  402. .j-price {
  403. font-size: 38rpx;
  404. font-weight: bold;
  405. color: #FF4C4C;
  406. &::before {
  407. content: '¥';
  408. font-size: 24rpx;
  409. color: #FF4C4C;
  410. }
  411. }
  412. .j-zk {
  413. display: inline-block;
  414. margin-left: 10rpx;
  415. line-height: 32rpx;
  416. height: 32rpx;
  417. border: 1px solid #FF4C4C;
  418. border-radius: 5rpx;
  419. font-size: 22rpx;
  420. font-weight: 500;
  421. color: #FF4C4C;
  422. padding: 0 8rpx;
  423. }
  424. }
  425. }
  426. .dhq-right {
  427. .right-btn {
  428. width: 105rpx;
  429. line-height: 56rpx;
  430. background: linear-gradient(143.2747deg, #FF6A00, #EE0979);
  431. border: 1rpx solid #FF4C4C;
  432. border-radius: 27rpx;
  433. text-align: center;
  434. color: #fff;
  435. font-size: 28rpx;
  436. font-weight: bold;
  437. }
  438. }
  439. }
  440. </style>