index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <view>
  3. <view class="margin-lr" v-if="modelSwt == '否'">
  4. <view class="">
  5. <swiper class="swiper" autoplay="1500" :indicator-dots="true" :circular='true'
  6. indicator-active-color="#ffffff" indicator-color="#cccccc">
  7. <swiper-item class="swiper-wrap" v-for="(item,index) in bannerList" :key='index'
  8. style="height: 300upx;">
  9. <image :src="item.imageUrl" style="width: 100%;border-radius: 8upx;height: 300upx;"
  10. @click="goWeb(item.url)" mode="scaleToFill"></image>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. <view class="flex justify-between align-center bg-white margin-tb padding-lr-sm radius"
  15. style="width: 100%;height: 100rpx;">
  16. <image src="../static/xinxi.png" style="width: 126rpx;height: 30rpx;" mode=""></image>
  17. <view class="flex-sub margin-left-sm">
  18. <swiper class="swiper" autoplay="1500" :vertical='true' style="height: 40rpx;overflow: hidden;">
  19. <swiper-item class="" v-for="(item,index) in noticeList" :key='index' @click="goWeb1(item.url)">
  20. <text>{{item.title}}</text>
  21. </swiper-item>
  22. </swiper>
  23. </view>
  24. </view>
  25. <view>
  26. <view class="text-black text-xl text-bold margin-bottom">帮帮跑腿</view>
  27. <view class="flex justify-between flex-wrap">
  28. <view class="bg-video margin-tb-xs" v-for="(item,index) in classifyLsit" :key='index'
  29. @click="goNav(item.url)">
  30. <image :src="item.imageUrl" mode="" style="width: 340rpx;height: 200rpx;"></image>
  31. <view class="flex flex-direction justify-end"
  32. style="position: absolute;top: 0;padding: 30rpx;width: 100%;height: 100%;">
  33. <view class="text-white text-lg text-bold">{{item.name}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 红包 -->
  39. <view class="hongbao" v-if="HBShow&&paotuiHB == '是'">
  40. <view style="width: 52%;margin: 0 auto;position: relative;">
  41. <view @click="HBShow=false"
  42. style="position: absolute;right: -10rpx;top: -10rpx;font-size: 32rpx;font-weight: bold;">X
  43. </view>
  44. <image src="https://mxys.chuanghai-tech.com/wmfile/20250814/f5146f4e2f1e46d28d4613260ab58c92.png" class="hb_img"></image>
  45. <image src="../static/hb_btn.png" class="hb_btn" @click="takemoney()"></image>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="content" v-if="modelSwt == '是'">
  50. <!-- #ifndef MP-WEIXIN -->
  51. <view class="page-body">
  52. <view class="page-section page-section-gap">
  53. <map id="map" style="width: 100%; height: 700px;" :latitude="latitude" :longitude="longitude"
  54. :markers="covers" :show-location="true">
  55. <cover-view style="position: fixed;top: 345px;right: 30px;" @click="onToGetLocation()">
  56. <cover-image class="img-map1" src="../static/dw.png">
  57. </cover-image>
  58. </cover-view>
  59. </map>
  60. </view>
  61. </view>
  62. <!-- #endif -->
  63. <!-- #ifdef MP-WEIXIN -->
  64. <view class="page-body">
  65. <view class="page-section page-section-gap">
  66. <map id="map" style="width: 100%; height: 700px;" :latitude="latitude" :longitude="longitude"
  67. :markers="covers" :show-location="true" :customCallout="customCallout">
  68. <cover-view style="position: fixed;bottom: 430rpx;right: 60rpx;" @click="onToGetLocation()">
  69. <cover-image class="img-map1" src="../static/dw.png">
  70. </cover-image>
  71. </cover-view>
  72. </map>
  73. </view>
  74. </view>
  75. <!-- #endif -->
  76. <cover-view class="controls-title">
  77. <cover-view class="controls-tabs">
  78. <cover-view v-for="(item,index) in classifyLsit" :key="index" v-if="index<4"
  79. @tap="change(index,item)" class="atabs_ds">
  80. <cover-view>{{item.name}}</cover-view>
  81. <cover-view :class="{btna:count == index}"></cover-view>
  82. </cover-view>
  83. </cover-view>
  84. <!-- 同城服务 -->
  85. <cover-view class="tabs_box">
  86. <cover-view class="pay_tit">
  87. <cover-view class="pay_name">请写明{{modelDet.name }}的内容</cover-view>
  88. <cover-view class="pay_set">请填写您的具体要求等</cover-view>
  89. <cover-view class="pay_radius" @click="bindcity(4)">下单</cover-view>
  90. </cover-view>
  91. </cover-view>
  92. </cover-view>
  93. <cover-view class="hongbao" v-if="newUserFlag == 1&&paotuiHB == '是'">
  94. <cover-view style="width: 52%;margin: 0 auto;position: relative;">
  95. <cover-view @click="HBShow=false"
  96. style="position: absolute;right: -10rpx;top: -10rpx;font-size: 32rpx;font-weight: bold;">X
  97. </cover-view>
  98. <cover-image src="https://mxys.chuanghai-tech.com/wmfile/20250814/f5146f4e2f1e46d28d4613260ab58c92.png" class="hb_img"></cover-image>
  99. <cover-image src="../static/hb_btn.png" class="hb_btn" @click="takemoney()"></cover-image>
  100. </cover-view>
  101. </cover-view>
  102. <cover-view v-else></cover-view>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. export default {
  108. data() {
  109. return {
  110. HBShow: false,
  111. modelSwt: "否",
  112. modelDet: {},
  113. id: 0, // 使用 marker点击事件 需要填写id
  114. title: 'map',
  115. latitude: '',
  116. longitude: '',
  117. iconPath: '../static/location.png',
  118. covers: [{
  119. latitude: '',
  120. longitude: '',
  121. iconPath: '../static/location.png',
  122. width: 40,
  123. height: 40,
  124. callout: { //自定义标记点上方的气泡窗口 点击有效
  125. content: '当前附近骑手', //文本
  126. color: '#ffffff', //文字颜色
  127. fontSize: 10, //文本大小
  128. padding: 10, //附近留白
  129. borderRadius: 2, //边框圆角
  130. bgColor: '#00c16f', //背景颜色
  131. display: 'ALWAYS', //常显
  132. },
  133. }],
  134. count: "",
  135. list: [{
  136. id: 0,
  137. name: '帮我送'
  138. }, {
  139. id: 1,
  140. name: '帮我取'
  141. }, {
  142. id: 2,
  143. name: '同城帮买'
  144. }, {
  145. id: 3,
  146. name: '同城服务'
  147. }],
  148. current: 0,
  149. value0: '',
  150. value1: '',
  151. value2: '',
  152. value3: '',
  153. type: 'text',
  154. clearable: false,
  155. riderNumber: '',
  156. arr: [],
  157. // 用户红包
  158. newUserFlag: 2,
  159. token: '',
  160. bannerList: [],
  161. noticeList: [],
  162. classifyLsit: [],
  163. tuiguang: '',
  164. tuiguangImg: '',
  165. paotuiHB: '否'
  166. }
  167. },
  168. onLoad() {
  169. this.getBannerList()
  170. this.getNoticeList()
  171. // this.getZiZhi()
  172. let takeAddress = {
  173. data1: '',
  174. data2: '',
  175. }
  176. let closeAddress = {
  177. data1: '',
  178. data2: '',
  179. data3: '',
  180. data4: '',
  181. citydata: ''
  182. }
  183. uni.setStorageSync('takeAddress', takeAddress)
  184. uni.setStorageSync('closeAddress', closeAddress)
  185. if (uni.getStorageSync('disinfo')) {
  186. uni.removeStorageSync('disinfo')
  187. }
  188. },
  189. onShow() {
  190. // 首页是否展示地图
  191. this.$Request.getT('/app/common/type/294').then(res => {
  192. if (res.code == 0) {
  193. if (res.data && res.data.value) {
  194. this.modelSwt = res.data.value
  195. this.$queue.setData('modelSwt', res.data.value)
  196. }
  197. }
  198. });
  199. this.token = uni.getStorageSync('token')
  200. if (this.token) {
  201. this.getUser()
  202. }
  203. },
  204. onReady() {
  205. this.map = uni.createMapContext("map", this)
  206. },
  207. onShareAppMessage(res) { //发送给朋友
  208. return {
  209. title: this.tuiguang,
  210. path: '/pages/index/index',
  211. imageUrl: this.tuiguangImg,
  212. }
  213. },
  214. onShareTimeline(res) { //分享到朋友圈
  215. return {
  216. title: this.tuiguang,
  217. path: '/pages/index/index',
  218. imageUrl: this.tuiguangImg,
  219. }
  220. },
  221. methods: {
  222. // 分享文案和图片
  223. getZiZhi() {
  224. this.$Request.getT('/app/common/type/295').then(res => {
  225. if (res.code === 0) {
  226. this.tuiguang = res.data.value;
  227. }
  228. });
  229. this.$Request.getT('/app/common/type/296').then(res => {
  230. if (res.code === 0) {
  231. this.tuiguangImg = res.data.value;
  232. }
  233. });
  234. },
  235. goWeb(url) {
  236. console.log(url.indexOf('/pages/') !== -1)
  237. return
  238. if (url.indexOf('/pages/') !== -1) {
  239. uni.navigateTo({
  240. url
  241. });
  242. } else {
  243. //#ifndef H5
  244. uni.navigateTo({
  245. url: '/pages/index/webView?url=' + url
  246. });
  247. //#endif
  248. //#ifdef H5
  249. window.location.href = url;
  250. //#endif
  251. }
  252. },
  253. goWeb1(url) {
  254. if (url.indexOf('http') !== -1) {
  255. //#ifndef H5
  256. uni.navigateTo({
  257. url: '/pages/index/webView?url=' + url
  258. });
  259. //#endif
  260. //#ifdef H5
  261. window.location.href = url;
  262. //#endif
  263. }
  264. },
  265. // 跳转发布页面
  266. goNav(e) {
  267. if (this.token) {
  268. uni.navigateTo({
  269. url: e
  270. })
  271. } else {
  272. uni.navigateTo({
  273. url: '/pages/my/register'
  274. })
  275. }
  276. },
  277. // 获取轮播图
  278. getBannerList() {
  279. let data = {
  280. classify: 7,
  281. state:1
  282. };
  283. this.$Request.get("/app/banner/selectBannerList",data).then(res => {
  284. if (res.code == 0) {
  285. this.bannerList = res.data
  286. }
  287. });
  288. let data2 = {
  289. classify: 6,
  290. state:1
  291. };
  292. this.$Request.get("/app/banner/selectBannerList",data2).then(res => {
  293. if (res.code == 0) {
  294. this.classifyLsit = res.data
  295. this.modelDet = this.classifyLsit[0]
  296. }
  297. });
  298. },
  299. // 获取公告
  300. getNoticeList() {
  301. let data = {
  302. page: 1,
  303. limit: 100
  304. }
  305. this.$Request.get("/app/notice/selectNoticeList", data).then(res => {
  306. if (res.code == 0) {
  307. this.noticeList = res.data.list
  308. }
  309. });
  310. },
  311. // 获取用户当前定位
  312. getUser() {
  313. console.log('执行')
  314. var that = this
  315. uni.getLocation({
  316. type: 'gcj02',
  317. success: function(res) {
  318. // console.log('成功')
  319. // console.log(res)
  320. console.log('当前位置的经度:' + res.longitude);
  321. console.log('当前位置的纬度:' + res.latitude);
  322. that.longitude = res.longitude
  323. that.latitude = res.latitude
  324. that.covers[0].longitude = res.longitude
  325. that.covers[0].latitude = res.latitude
  326. that.getAdd(that.longitude, that.latitude)
  327. that.getuserinfo()
  328. },
  329. fail: function(err) {
  330. console.log('授权失败', err)
  331. uni.showToast({
  332. title: "获取位置授权失败",
  333. icon: "none"
  334. })
  335. }
  336. });
  337. },
  338. //右下角定位按钮的点击事件
  339. onToGetLocation() {
  340. console.log('11')
  341. // this. getUser()
  342. // this.map.moveToLocation();
  343. let mapContext = uni.createMapContext('map');
  344. mapContext.moveToLocation(); //moveToLocation将地图中心移动到当前定位点,需要配合map组件的show-location使用
  345. },
  346. // 跑腿人位置
  347. getAdd(lng, lat) {
  348. let data = {
  349. lng: lng,
  350. lat:lat
  351. };
  352. this.$Request.getT('/app/tbindent/find5KmRider',data).then(res => {
  353. // console.log('```````````````', res)
  354. if (res.code == 0) {
  355. this.riderNumber = res.data.length
  356. if (res.data.length > 0) {
  357. var arr = []
  358. for (var i in res.data) {
  359. var obj = {}
  360. obj.latitude = res.data[i].stationLat
  361. obj.longitude = res.data[i].stationLng
  362. obj.iconPath = '../static/rider.png'
  363. obj.width = 30
  364. obj.height = 30
  365. arr.push(obj)
  366. }
  367. this.covers[0].callout.content = '当前附近骑手' + res.data.length + '人'
  368. // this.covers = arr
  369. this.covers = [...this.covers, ...arr];
  370. // console.log('this.covers ', this.covers)
  371. }
  372. }
  373. });
  374. },
  375. change(index, item) {
  376. // console.log(index)
  377. this.modelDet = item
  378. this.current = index;
  379. this.count = index;
  380. console.log(this.count)
  381. // uni.removeStorageSync('takeAddress')
  382. },
  383. bindHelppay(index) {
  384. // console.log(index)
  385. let token = this.$queue.getData("token");
  386. if (token) {
  387. uni.navigateTo({
  388. url: '/pages/Helppay/Helppay'
  389. })
  390. } else {
  391. uni.navigateTo({
  392. url: '/pages/my/register'
  393. })
  394. }
  395. },
  396. bindcity(index) {
  397. // console.log(index)
  398. let token = this.$queue.getData("token");
  399. if (token) {
  400. uni.navigateTo({
  401. url: this.modelDet.url
  402. })
  403. } else {
  404. uni.navigateTo({
  405. url: '/pages/my/register'
  406. })
  407. }
  408. },
  409. // 获取用户信息
  410. getuserinfo() {
  411. this.$Request.getT('/app/tbindent/findUserInfoById').then(res => {
  412. console.log(res)
  413. if (res.code == 0) {
  414. this.newUserFlag = res.data.newUserFlag
  415. console.log(this.newUserFlag)
  416. if (this.newUserFlag == 1) {
  417. this.paotuiHB = this.$queue.getData('paotuiHB')
  418. if (this.paotuiHB == '是') {
  419. this.HBShow = true
  420. }
  421. } else {
  422. this.HBShow = false
  423. }
  424. }
  425. });
  426. },
  427. // 红包
  428. takemoney() {
  429. this.$Request.getT('/app/tbindent/getNewUserRedPacket').then(res => {
  430. console.log(res)
  431. if (res.code === 0) {
  432. this.HBShow = false
  433. this.getuserinfo()
  434. setTimeout(function() {
  435. uni.navigateTo({
  436. url: '/my/hongbao/hongbao'
  437. })
  438. }, 100)
  439. } else {
  440. uni.showToast({
  441. title: res.msg,
  442. icon: "none"
  443. })
  444. this.newUserFlag = ''
  445. }
  446. });
  447. }
  448. }
  449. }
  450. </script>
  451. <style>
  452. .content {
  453. width: 100%;
  454. position: fixed;
  455. top: 0upx;
  456. left: 0upx;
  457. right: 0upx;
  458. bottom: 0upx;
  459. }
  460. .controls-title {
  461. width: 90%;
  462. height: 370upx;
  463. background: #FFFFFF;
  464. position: fixed;
  465. bottom: 0rpx;
  466. margin: 40upx;
  467. border-radius: 26upx;
  468. box-shadow: 0upx 30upx 40upx 0upx rgba(187, 170, 163, 0.20);
  469. /* #ifndef MP-WEIXIN */
  470. width: 90%;
  471. margin: 0 40rpx;
  472. margin-bottom: 150rpx;
  473. /* #endif */
  474. }
  475. /* tab选项卡 */
  476. .controls-tabs {
  477. display: flex;
  478. font-size: 33rpx;
  479. overflow-x: auto;
  480. }
  481. .atabs_ds {
  482. flex-grow: 1;
  483. text-align: center;
  484. height: 55rpx;
  485. }
  486. /* .tabs_box {
  487. display: none;
  488. background: #C8C7CC;
  489. } */
  490. .btna {
  491. background: #FF6A04;
  492. width: 68%;
  493. height: 8rpx;
  494. margin: 9rpx 10rpx 10rpx 29rpx;
  495. border-radius: 35rpx;
  496. }
  497. .tabs_box {
  498. /* display: none; */
  499. }
  500. .dis {
  501. display: block;
  502. }
  503. .controls-tabs {
  504. width: 100%;
  505. height: 90rpx;
  506. display: flex;
  507. justify-content: center;
  508. align-items: center;
  509. margin-top: 10rpx;
  510. }
  511. .box_bg {
  512. width: 90%;
  513. height: 100upx;
  514. background: #FFFFFF;
  515. margin: 0 auto;
  516. border-radius: 12upx;
  517. display: flex;
  518. margin-top: 20upx;
  519. }
  520. .box {
  521. width: 90%;
  522. height: 100upx;
  523. background: #F5F5F5;
  524. margin: 0 auto;
  525. border-radius: 12upx;
  526. display: flex;
  527. margin-top: 20upx;
  528. }
  529. .box_dian {
  530. flex: 1;
  531. display: flex;
  532. justify-content: center;
  533. align-items: center;
  534. }
  535. .box_dian cover-image {
  536. width: 20upx;
  537. height: 20upx;
  538. }
  539. .box_name {
  540. flex: 5;
  541. display: flex;
  542. justify-content: left;
  543. align-items: center;
  544. color: #333333;
  545. font-weight: 700;
  546. font-size: 34rpx;
  547. }
  548. .box_addres {
  549. flex: 5;
  550. }
  551. .add {
  552. color: #333333;
  553. font-size: 26upx;
  554. letter-spacing: 2upx;
  555. font-weight: bold;
  556. line-height: 50upx;
  557. }
  558. .name {
  559. display: inline;
  560. font-size: 24upx;
  561. color: #999999;
  562. }
  563. .number {
  564. display: initial;
  565. color: #999999;
  566. font-size: 24upx;
  567. margin-left: 30upx;
  568. }
  569. .box_image {
  570. flex: 1;
  571. display: flex;
  572. justify-content: center;
  573. align-items: center;
  574. }
  575. .icon_you {
  576. color: #CCCCCC !important;
  577. }
  578. /* 同城购买 */
  579. .pay_tit {
  580. width: 90%;
  581. margin: 0 auto;
  582. height: 200upx;
  583. position: relative;
  584. }
  585. .pay_name {
  586. font-size: 31rpx;
  587. font-weight: bold;
  588. width: 95%;
  589. margin: 0 auto;
  590. letter-spacing: 2upx;
  591. }
  592. .pay_set {
  593. color: #333333;
  594. font-size: 28rpx;
  595. width: 95%;
  596. margin: 0 auto;
  597. margin-top: 20upx;
  598. }
  599. .pay_radius {
  600. width: 100upx;
  601. height: 100upx;
  602. background: #FF7F00;
  603. color: white;
  604. text-align: center;
  605. line-height: 100upx;
  606. border-radius: 68upx;
  607. position: absolute;
  608. right: 20upx;
  609. }
  610. .hongbao {
  611. width: 100%;
  612. /* height: 100px; */
  613. /* background: #007AFF; */
  614. position: fixed;
  615. top: 24%;
  616. /* bottom: 50%; */
  617. left: 0rpx;
  618. right: 0rpx;
  619. /* display: none; */
  620. }
  621. .hb_img {
  622. width: 100%;
  623. height: 435rpx;
  624. }
  625. .hb_btn {
  626. width: 60%;
  627. height: 72rpx;
  628. position: absolute;
  629. top: 315rpx;
  630. left: 80rpx;
  631. }
  632. .img-map1 {
  633. width: 80rpx;
  634. height: 80rpx;
  635. }
  636. </style>