shopDetail.vue 11 KB

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