shopDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  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="https://hy.liuniu946.com/app/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" v-if="info.display==1">
  16. <image class="store-image1" src="https://hy.liuniu946.com/app/img/store2.png" mode=""></image>
  17. <view class="store-font">营业时间:{{ info.day_time }}</view>
  18. </view>
  19. <view class="store-item" v-if="info.display==1&&info.phone">
  20. <image class="store-image2" src="https://hy.liuniu946.com/app/img/store3.png" mode=""></image>
  21. <view class="store-font">预约电话:{{ info.phone }}</view>
  22. </view>
  23. <view class="store-item" v-if="info.display==1">
  24. <image class="store-image3" src="https://hy.liuniu946.com/app/index/index10.png" mode=""></image>
  25. <view class="store-font">门店地址:{{ info.detailed_address }}</view>
  26. </view>
  27. <view class="store-item" v-if="info.display==1">
  28. <image class="store-image1" src="https://hy.liuniu946.com/app/img/store2.png" mode=""></image>
  29. <view class="store-font">商家介绍:{{ info.introduction }}</view>
  30. </view>
  31. <view class="store-main" v-if="info.images != null">
  32. <view class="smain-title">门头照片</view>
  33. <scroll-view class="scroll-box flex" @scroll="scroll" scroll-x="true" :scroll-with-animation="true"
  34. scroll-left="10px">
  35. <view class="scroll-item" v-for="(item, index) in info.images" :key="index">
  36. <image class="scroll-image" :src="item" mode="heightFix" @click="openImg(info.images,item)"></image>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. <view v-if="info.display==1">
  41. <view class="jx-box-content" v-for="item in vipList" @click="navToDetailPage(item)">
  42. <view class="content-left">
  43. <image :src=item.image mode=""></image>
  44. </view>
  45. <view class="content-right">
  46. <view class="shop-name">
  47. {{item.store_name}}
  48. </view>
  49. <view class="shop-content">
  50. <view class="shop-content-left">
  51. <view class="price-box">
  52. <view class="yuan-price">
  53. ¥{{item.ot_price}}
  54. </view>
  55. <view class="j-price">
  56. 满{{item.yhq.use_min_price}}元可用
  57. </view>
  58. </view>
  59. <view class="price-x">
  60. ¥{{item.price}}
  61. </view>
  62. </view>
  63. <view class="shop-content-right" >
  64. 立即购买
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <uni-load-more :status="loadingType"></uni-load-more>
  70. </view>
  71. <view class="store-main" v-if="info.slider_image != null">
  72. <view class="smain-title">店内照片</view>
  73. <scroll-view class="scroll-box flex" @scroll="scroll" scroll-x="true" :scroll-with-animation="true"
  74. scroll-left="10px">
  75. <view class="scroll-item" v-for="(item, index) in info.slider_image" :key="index">
  76. <image class="scroll-image" :src="item" mode="heightFix" @click="openImg(info.slider_image,item)">
  77. </image>
  78. </view>
  79. </scroll-view>
  80. </view>
  81. <view class="" style="height: 100rpx;">
  82. </view>
  83. <view class="btn-box flex" v-if="info.phone">
  84. <view class="btn-left" @click="tocall()">联系商家</view>
  85. <!-- #ifdef H5 -->
  86. <view class="btn-right" @click="toGaodeMap()">导航到店</view>
  87. <!-- #endif -->
  88. <!-- #ifdef MP -->
  89. <view class="btn-right" @click="dh()">导航到店</view>
  90. <!-- #endif -->
  91. </view>
  92. <view class="btn-box dhdd flex" v-if="!info.phone">
  93. <!-- #ifdef H5 -->
  94. <view class="btn-right" @click="toGaodeMap()">导航到店</view>
  95. <!-- #endif -->
  96. <!-- #ifdef MP -->
  97. <view class="btn-right" @click="dh()">导航到店</view>
  98. <!-- #endif -->
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  104. import {getVip} from '@/api/index.js';
  105. // #ifdef H5
  106. import {
  107. weixindata,
  108. shareLoad
  109. } from '@/utils/wxAuthorized';
  110. // #endif
  111. import {
  112. saveUrl,
  113. interceptor
  114. } from '@/utils/loginUtils.js';
  115. import {
  116. mapState,
  117. mapMutations
  118. } from 'vuex';
  119. import {
  120. spread,
  121. orderData,
  122. userinfo
  123. } from '@/api/user.js';
  124. import {
  125. getStoreDetail
  126. } from '@/api/shop.js'
  127. import {
  128. setCoupons
  129. } from '@/api/functionalUnit.js';
  130. import {
  131. store_details
  132. } from '@/api/index.js';
  133. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  134. export default {
  135. components:{
  136. uniLoadMore
  137. },
  138. data() {
  139. return {
  140. vipList:[],//商品列表
  141. page:1,
  142. limit:10,
  143. loadingType:'more',
  144. id: '',
  145. info: '',
  146. address: '',
  147. userInfo:''
  148. };
  149. },
  150. computed: {
  151. ...mapState(['loginInterceptor', 'baseURL', 'latitude', 'longitude']),
  152. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  153. },
  154. onLoad(option) {
  155. let obj = this;
  156. userinfo({})
  157. .then(({
  158. data
  159. }) => {
  160. obj.userInfo = data;
  161. console.log(data, "123456")
  162. })
  163. if (option.spread) {
  164. // 存储邀请人
  165. uni.setStorageSync('puid', option.spread);
  166. }
  167. console.log(option.spread,'邀请人')
  168. this.id = option.id;
  169. if (this.latitude) {
  170. this.getStoreDetail()
  171. } else {
  172. this.getaddress()
  173. }
  174. },
  175. onShow() {
  176. // #ifdef MP-WEIXIN
  177. wx.showShareMenu({
  178. withShareTicket: true,
  179. menus: ["shareAppMessage", "shareTimeline"]
  180. })
  181. //#endif
  182. },
  183. // #ifdef MP-WEIXIN
  184. onShareAppMessage(res) {
  185. let obj = this;
  186. // 保存分享人id链接
  187. let url = 'pages/store/shopDetail' + '?spread=' + this.userInfo.uid+'&id='+obj.info.id;
  188. if (res.from === 'button') { // 来自页面内分享按钮
  189. console.log(res.target)
  190. }
  191. return {
  192. path: url, // 分享链接
  193. imageUrl: obj.info.images, // 分享图标
  194. desc: '我在这家店领取了超多消费券哦!',
  195. title: this.userInfo.nickname + "给您推荐了" + obj.info.name,
  196. }
  197. },
  198. //分享到朋友圈
  199. onShareTimeline(res) {
  200. console.log(this.userInfo)
  201. let obj = this;
  202. let url = 'pages/store/shopDetail' + '?spread=' + this.userInfo.uid+'&id='+obj.info.id;
  203. return {
  204. path: url, // 分享链接
  205. imageUrl: obj.info.images, // 分享图标
  206. desc: '我在这家店领取了超多消费券哦!',
  207. title: this.userInfo.nickname + "给您推荐了" + obj.info.name,
  208. }
  209. },
  210. //#endif
  211. methods: {
  212. navToDetailPage(item) {
  213. let id = item.id;
  214. uni.navigateTo({
  215. url: '/pages/product/product?id=' + id +'&isVip='+8+'&store_id='+item.store_id
  216. });
  217. },
  218. // 获取门店详情
  219. getStoreDetail() {
  220. let obj = this
  221. getStoreDetail({}, obj.id).then(res => {
  222. console.log(res,"000000000")
  223. obj.vipList=res.data.coupon
  224. obj.info = res.data
  225. obj.info.jl = obj.getFlatternDistance(obj.latitude, obj.longitude, obj.info.latitude, obj
  226. .info.longitude);
  227. })
  228. },
  229. markertap(e) {
  230. let obj = this
  231. // #ifdef H5
  232. weixindata().then(wxOjb => {
  233. console.log(wxOjb, '获取微信');
  234. wxOjb.openLocation({
  235. latitude: obj.info.latitude, // 纬度,浮点数,范围为90 ~ -90
  236. longitude: obj.info.longitude, // 经度,浮点数,范围为180 ~ -180。
  237. name: obj.info.name, // 位置名
  238. address: obj.info.detailed_address, // 地址详情说明
  239. scale: 28, // 地图缩放级别,整型值,范围从1~28。默认为最大
  240. infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
  241. });
  242. });
  243. // #endif
  244. },
  245. //根据经纬度计算距离
  246. getFlatternDistance(lat1, lng1, lat2, lng2) {
  247. console.log(lat1, lng1, lat2, lng2)
  248. let radLat1 = (lat1 * Math.PI) / 180.0;
  249. let radLat2 = (lat2 * Math.PI) / 180.0;
  250. let a = radLat1 - radLat2;
  251. let b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
  252. let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
  253. .pow(Math.sin(b / 2), 2)));
  254. s = s * 6378.137;
  255. s = Math.round(s * 10000) / 10000;
  256. return s;
  257. },
  258. scroll(e) {
  259. console.log(e, '123456');
  260. },
  261. tocall() {
  262. let num = this.info.phone;
  263. console.log(num);
  264. uni.makePhoneCall({
  265. phoneNumber: num //仅为示例
  266. });
  267. },
  268. // 点击触发领取优惠券
  269. setCoupons(item) {
  270. // 判断是否已经领取了优惠券
  271. let obj = this;
  272. uni.showModal({
  273. title: '领取提示',
  274. content: '是否领取优惠券',
  275. success(e) {
  276. if (e.confirm) {
  277. setCoupons({
  278. couponId: item.id
  279. }).then(e => {
  280. item.is_use = true;
  281. uni.showToast({
  282. title: '领取成功',
  283. type: 'top',
  284. duration: 2000
  285. });
  286. });
  287. }
  288. }
  289. });
  290. },
  291. getaddress() {
  292. console.log('dizhi+++++++++++');
  293. let obj = this;
  294. // #ifdef H5
  295. weixindata().then(wxOjb => {
  296. console.log(wxOjb, '获取微信');
  297. wxOjb.getLocation({
  298. type: 'gcj02',
  299. success: res => {
  300. console.log(res, 123456);
  301. obj.setLat(res.latitude);
  302. obj.setLon(res.longitude);
  303. obj.getStoreDetail()
  304. },
  305. fail: err => {
  306. console.log(err, 'shi+++++++++++++++');
  307. openMap().then(e => {
  308. obj.getaddress();
  309. });
  310. }
  311. });
  312. });
  313. // #endif
  314. },
  315. //
  316. openImg(list, item) {
  317. uni.previewImage({
  318. current: item,
  319. urls: list
  320. })
  321. },
  322. // 调用高德
  323. toGaodeMap() {
  324. let obj = this
  325. window.location.href =
  326. `https://uri.amap.com/marker?position=${obj.info.longitude},${obj.info.latitude}&name=${obj.info.name}`;
  327. },
  328. // 导航
  329. dh() {
  330. let obj = this
  331. wx.openLocation({
  332. latitude: obj.info.latitude * 1,
  333. longitude: obj.info.longitude * 1,
  334. name: obj.info.name,
  335. address: obj.info.detailed_address
  336. })
  337. },
  338. }
  339. };
  340. </script>
  341. <style lang="less">
  342. .center,
  343. page {
  344. background: #f8f8f8;
  345. height: 100%;
  346. }
  347. .dhdd{
  348. view{
  349. margin: 0 auto;
  350. }
  351. }
  352. .store-info {
  353. background: #ffffff;
  354. .store-top {
  355. padding: 40rpx 20rpx;
  356. justify-content: flex-start;
  357. .simage {
  358. width: 130rpx;
  359. height: 130rpx;
  360. background: #f44939;
  361. }
  362. .stop-main {
  363. height: 130rpx;
  364. padding: 6rpx 0;
  365. margin-left: 20rpx;
  366. display: flex;
  367. flex-direction: column;
  368. justify-content: space-between;
  369. align-items: flex-start;
  370. .stop-title {
  371. font-size: 36rpx;
  372. font-family: PingFang SC;
  373. font-weight: 500;
  374. color: #000000;
  375. }
  376. .stop-address {
  377. display: flex;
  378. justify-content: flex-end;
  379. align-items: center;
  380. .mrt-image {
  381. width: 20rpx;
  382. height: 28rpx;
  383. }
  384. .mrt-font {
  385. margin-left: 8rpx;
  386. font-size: 22rpx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #666666;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .store-item {
  396. background: #ffffff;
  397. display: flex;
  398. justify-content: flex-start;
  399. align-items: center;
  400. padding: 30rpx 30rpx 30rpx 44rpx;
  401. .store-image1 {
  402. width: 36rpx;
  403. height: 36rpx;
  404. }
  405. .store-image2 {
  406. margin: 0 1rpx;
  407. width: 34rpx;
  408. height: 34rpx;
  409. }
  410. .store-image3 {
  411. margin: 0 7rpx;
  412. width: 22rpx;
  413. height: 28rpx;
  414. }
  415. .store-font {
  416. margin-left: 22rpx;
  417. font-size: 26rpx;
  418. font-family: PingFang SC;
  419. font-weight: 500;
  420. color: #2d2d2d;
  421. }
  422. }
  423. .store-main {
  424. margin-top: 16rpx;
  425. background: #ffffff;
  426. padding: 30rpx 42rpx 40rpx;
  427. .smain-title {
  428. font-size: 30rpx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #464646;
  432. }
  433. }
  434. .scroll-box {
  435. white-space: nowrap;
  436. margin-top: 30rpx;
  437. height: 240rpx;
  438. .scroll-item:first-child {
  439. margin-left: 0;
  440. }
  441. .scroll-item {
  442. margin-left: 20rpx;
  443. display: inline-block;
  444. height: 240rpx;
  445. // width: 240rpx;
  446. }
  447. .scroll-image {
  448. height: 240rpx;
  449. // width: 240rpx;
  450. }
  451. }
  452. .btn-box {
  453. position: fixed;
  454. bottom: 0rpx;
  455. left: 0;
  456. right: 0;
  457. width: 750rpx;
  458. background: rgba(255, 255, 255, 0.6);
  459. box-shadow: 0rpx 0rpx 20rpx 0px rgba(50, 50, 52, 0.06);
  460. padding: 22rpx 68rpx;
  461. .btn-left {
  462. width: 280rpx;
  463. height: 80rpx;
  464. background: linear-gradient(180deg, #ffa30b, #ffd158);
  465. box-shadow: 0px 3rpx 13rpx 3rpx rgba(255, 164, 13, 0.48);
  466. border-radius: 40rpx;
  467. text-align: center;
  468. line-height: 80rpx;
  469. font-size: 32rpx;
  470. font-family: PingFang SC;
  471. font-weight: 500;
  472. color: #ffffff;
  473. }
  474. .btn-right {
  475. width: 280rpx;
  476. height: 80rpx;
  477. background: linear-gradient(180deg, #ff6223, #ffab60);
  478. box-shadow: 0px 3rpx 13rpx 3rpx rgba(255, 164, 13, 0.48);
  479. border-radius: 40rpx;
  480. text-align: center;
  481. line-height: 80rpx;
  482. font-size: 32rpx;
  483. font-family: PingFang SC;
  484. font-weight: 500;
  485. color: #ffffff;
  486. }
  487. }
  488. .popup_row {
  489. width: 100%;
  490. height: 500rpx;
  491. background-color: #ffffff;
  492. border-radius: 20rpx;
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. .rows {
  497. width: 100%;
  498. padding: 0 24rpx;
  499. .rows-item {
  500. height: 80rpx;
  501. line-height: 80rpx;
  502. text-align: center;
  503. width: 100%;
  504. font-size: 32rpx;
  505. color: #303133;
  506. // border-bottom: 1rpx solid #f0f0f0;
  507. }
  508. // .row-1 {
  509. // margin: auto;
  510. // .first_aid {
  511. // width: 300rpx;
  512. // height: 300rpx;
  513. // }
  514. // }
  515. // .row-2 {
  516. // font-size: 38rpx;
  517. // margin-top: 20rpx;
  518. // }
  519. }
  520. }
  521. .shop-dhq {
  522. width: 702rpx;
  523. height: 171rpx;
  524. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.15);
  525. margin: auto;
  526. border-radius: 20rpx;
  527. background-color: #fff;
  528. padding: 0 48rpx 0 26rpx;
  529. margin-bottom: 20rpx;
  530. .dhq-left {
  531. .dhq-name {
  532. overflow: hidden;
  533. width: 28%;
  534. font-size: 28rpx;
  535. font-weight: bold;
  536. color: #333333;
  537. }
  538. .dhq-price {
  539. padding-top: 20rpx;
  540. .j-price {
  541. font-size: 38rpx;
  542. font-weight: bold;
  543. color: #FF4C4C;
  544. &::before {
  545. content: '¥';
  546. font-size: 24rpx;
  547. color: #FF4C4C;
  548. }
  549. }
  550. .j-zk {
  551. margin: 10rpx;
  552. display: inline-block;
  553. margin-left: 10rpx;
  554. line-height: 32rpx;
  555. height: 32rpx;
  556. border: 1px solid #FF4C4C;
  557. border-radius: 5rpx;
  558. font-size: 22rpx;
  559. font-weight: 500;
  560. color: #FF4C4C;
  561. padding: 0 8rpx;
  562. }
  563. }
  564. }
  565. .dhq-right {
  566. .right-btn {
  567. width: 105rpx;
  568. line-height: 56rpx;
  569. background: linear-gradient(143.2747deg, #FF6A00, #EE0979);
  570. border: 1rpx solid #FF4C4C;
  571. border-radius: 27rpx;
  572. text-align: center;
  573. color: #fff;
  574. font-size: 28rpx;
  575. font-weight: bold;
  576. }
  577. }
  578. }
  579. .jx-box-content {
  580. display: flex;
  581. .content-left {
  582. margin: 20rpx 15rpx;
  583. width: 236rpx;
  584. height: 236rpx;
  585. background: #E2E2E2;
  586. border-radius: 10rpx;
  587. image {
  588. width: 100%;
  589. height:100%;
  590. }
  591. }
  592. .content-right {
  593. display: flex;
  594. flex-direction: column;
  595. justify-content: space-around;
  596. .shop-name {
  597. width: 382rpx;
  598. font-size: 32rpx;
  599. font-weight: bold;
  600. color: #333333;
  601. overflow: hidden;
  602. text-overflow: ellipsis;
  603. display:-webkit-box;
  604. -webkit-box-orient:vertical;
  605. -webkit-line-clamp:2;
  606. }
  607. .shop-content {
  608. width: 455rpx;
  609. display: flex;
  610. justify-content: space-between;
  611. .shop-content-left {
  612. display: flex;
  613. flex-direction: column;
  614. .price-box {
  615. display: flex;
  616. align-items: center;
  617. .yuan-price {
  618. font-size: 26rpx;
  619. font-weight: 500;
  620. text-decoration: line-through;
  621. color: #999999;
  622. }
  623. image {
  624. margin: 0 10rpx;
  625. width: 16rpx;
  626. height: 18rpx;
  627. }
  628. .j-price {
  629. font-size: 24rpx;
  630. font-weight: bold;
  631. color: #B59467;
  632. }
  633. }
  634. .price-x {
  635. font-size: 36rpx;
  636. font-weight: bold;
  637. color: #FF4C4C;
  638. }
  639. }
  640. .shop-content-right {
  641. margin-top:20rpx ;
  642. align-items: center;
  643. text-align: center;
  644. width: 137rpx;
  645. height: 52rpx;
  646. font-size: 26rpx;
  647. font-weight: 500;
  648. color: #fff;
  649. background: #f75022;
  650. border-radius: 26rpx;
  651. line-height: 52rpx;
  652. }
  653. }
  654. }
  655. }
  656. </style>