index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. <template>
  2. <view class="container">
  3. <!-- 顶部logo and 搜索 start-->
  4. <view class="status_bar"></view>
  5. <!-- <view class="top-bg"></view> -->
  6. <view class="top-search flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/icon/search-w.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. <!-- 顶部logo and 搜索 end-->
  13. <!-- 轮播图 start -->
  14. <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  15. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  16. @click="bannerNavToUrl(item)">
  17. <image :src="item.pic" />
  18. </swiper-item>
  19. </swiper>
  20. <!-- <image src="../../static/index/in-banner.png" mode="widthFix" class="in-banner"></image> -->
  21. <!-- 轮播图 end -->
  22. <!-- 分类 start -->
  23. <view class="cate-section flex">
  24. <view class="cate-item flex" v-for="(citem,cindex) in cateList" @click="gogogo(citem)">
  25. <view class="img-wrapper flex">
  26. <image :src="citem.img + (cindex + 1) + '.png'" mode=""></image>
  27. </view>
  28. <view class="item-title">{{citem.tit}}</view>
  29. </view>
  30. </view>
  31. <!-- 分类 ed -->
  32. <image src="../../static/index/in-tit.png" mode="" class="in-tit"></image>
  33. <image src="../../static/index/in-banner-t.png" mode="" class="in-banner-t"></image>
  34. <view class="in-vip" v-for="item in levelList">
  35. <image :src="item.image" mode=""></image>
  36. <view class="vip-info flex">
  37. <view class="">
  38. <view class="price">
  39. ¥{{item.money}} <text>/{{item.valid_date}}天</text>
  40. </view>
  41. <view class="info">
  42. {{item.name}}
  43. </view>
  44. </view>
  45. <view class="btn" @click="gobuy(item)">
  46. 立即开通
  47. </view>
  48. </view>
  49. </view>
  50. <image src="../../static/index/in-tit-t.png" mode="" class="in-tit"></image>
  51. <view class="art">
  52. <view class="art-tit flex">
  53. <view class="">
  54. M A S S A G E
  55. </view>
  56. <view class="">
  57. +++
  58. </view>
  59. </view>
  60. <view class="art-content" v-html="art">
  61. </view>
  62. <view class="art-line"></view>
  63. </view>
  64. <uni-popup ref="popupkf" type="center">
  65. <view class="popup-box">
  66. <view class="img">
  67. <image src="../../static/img/img009.png" mode=""></image>
  68. </view>
  69. <view class="mian">
  70. <view class="delivery">
  71. <view class="title">已经为您定制专属客服</view>
  72. <image src="../../static/img/img010.png" mode=""></image>
  73. </view>
  74. <view class="nocancel">客服VX:{{ text }}</view>
  75. <view class="comfirm-box">
  76. <view class="cancel" @click="cancel">取消</view>
  77. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  78. </view>
  79. </view>
  80. </view>
  81. </uni-popup>
  82. <uni-popup ref="popup" type="bottom">
  83. <view class="cz-model">
  84. <image :src="choose.image" mode=""></image>
  85. <view class="">
  86. {{choose.name}}
  87. </view>
  88. <view class="price">
  89. ¥{{choose.money}}
  90. </view>
  91. <view class="btn" @click="goNew">
  92. 立即开通
  93. </view>
  94. </view>
  95. </uni-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. loadIndexs,
  101. groom1,
  102. getLevelList
  103. } from '@/api/index.js';
  104. import {
  105. getUserInfo,
  106. spread,
  107. levelBuy,
  108. details
  109. } from '@/api/user.js';
  110. import {
  111. getBargainList,
  112. getProducts,
  113. goodsDetail,
  114. poster,
  115. getBd,
  116. getGp
  117. } from '@/api/product.js';
  118. import {
  119. saveUrl,
  120. interceptor
  121. } from '@/utils/loginUtils';
  122. import {
  123. mapState,
  124. mapMutations
  125. } from 'vuex';
  126. // #ifdef H5
  127. import {
  128. weixindata,
  129. shareLoad
  130. } from '@/utils/wxAuthorized';
  131. // #endif
  132. export default {
  133. data() {
  134. return {
  135. buying: false,
  136. choose: {},
  137. levelList: [],
  138. art: ' 希尔伯特作为科学疗人的方法,是指运用高端先进的仪器作用于病患的体表、受伤的部位、不适的所在.特定的脸穴、疼痛的地方,具体运用推、拿、按、摩、揉、捏、点、拍等形式多样的手法,以期达到疏通经络、推行气血、扶伤止痛、祛邪扶正、调和阴阳的 疗 效。', //文章介绍
  139. bastList: [], //爆款推荐
  140. muted: false,
  141. cateList: [{
  142. path: '/pages/index/artDetail?id=4',
  143. img: '../../static/index/in',
  144. tit: '仪器介绍'
  145. },
  146. {
  147. path: 'gift',
  148. img: '../../static/index/in',
  149. tit: '会员商品'
  150. },
  151. // {
  152. // path: 'kf',
  153. // img: '../../static/index/in',
  154. // tit: '联系客服'
  155. // },
  156. {
  157. path: '/pages/user/shareQrCode',
  158. img: '../../static/index/in',
  159. tit: '邀请好友'
  160. }
  161. ],
  162. text: '', //客服微信
  163. // page: 1,
  164. limitt: 20,
  165. loadingType: 'more',
  166. current: 0,
  167. shareShow: false, //分享海报
  168. pageProportion: 0, //保存页面基于750宽度的比例
  169. swiperHeight: 0,
  170. checkid: 0,
  171. titleNViewBackground: '',
  172. swiperCurrent: 0,
  173. swiperLength: 0,
  174. carouselList: [], //轮播列表
  175. page: 1,
  176. limit: 5,
  177. firstList: [],
  178. goodList: [], //商品列表
  179. shopList: [],
  180. period: 1,
  181. shareImage: '',
  182. jfList: [],
  183. };
  184. },
  185. computed: {
  186. ...mapState('user', ['hasLogin', 'userInfo'])
  187. },
  188. onReachBottom() {
  189. console.log('到底')
  190. },
  191. onLoad: function(option) {
  192. // #ifdef MP
  193. if (option.scene) {
  194. // 存储小程序邀请人
  195. uni.setStorage({
  196. key: 'spread_code',
  197. data: option.scene
  198. });
  199. }
  200. // #endif
  201. // #ifdef H5
  202. if (option.spread) {
  203. // 存储小程序邀请人
  204. uni.setStorage({
  205. key: 'spread',
  206. data: option.spread
  207. });
  208. }
  209. // #endif
  210. },
  211. onShow: function() {
  212. this.loadData();
  213. if(this.hasLogin) {
  214. this.getList()
  215. }
  216. this.details()
  217. },
  218. onHide() {},
  219. methods: {
  220. details() {
  221. details({},1).then(res => {
  222. console.log(res)
  223. this.art = res.data.content
  224. })
  225. },
  226. gobuy(e) {
  227. this.choose = e
  228. this.$refs.popup.open()
  229. },
  230. goNew() {
  231. if(this.buying) {
  232. return
  233. }
  234. if(this.userInfo.now_money*1 < this.choose.money*1) {
  235. return this.$api.msg('您当前余额不足')
  236. }
  237. this.buying = true
  238. levelBuy({
  239. level_id: this.choose.id
  240. }).then(res => {
  241. this.$refs.popup.close()
  242. this.buying = false
  243. uni.showToast({
  244. title: '开通成功',
  245. icon: 'success'
  246. });
  247. }).catch(err => {
  248. this.buying = false
  249. })
  250. },
  251. getList() {
  252. getLevelList().then(res => {
  253. console.log(res)
  254. this.levelList = res.data.list
  255. })
  256. },
  257. getBd() {
  258. getBd().then(res => {
  259. console.log(res)
  260. this.navList[0].list = res.data.list
  261. this.navList[0].loaded = true
  262. })
  263. },
  264. getGp(id) {
  265. let nav = this.navList[id]
  266. getGp(nav.qdata).then(res => {
  267. console.log(res)
  268. nav.list = res.data.list
  269. nav.loaded = true
  270. })
  271. },
  272. gogogo(item) {
  273. if (!item.path) {
  274. uni.navigateTo({
  275. url: '/pages/index/dkf'
  276. })
  277. }
  278. if (item.path == 'kf') {
  279. this.$refs.popupkf.open()
  280. } else {
  281. if(item.path == 'gift') {
  282. if(this.hasLogin ) {
  283. if(this.userInfo.vip) {
  284. uni.navigateTo({
  285. url:'/pages/index/gift'
  286. })
  287. }else {
  288. uni.showModal({
  289. title:'提示',
  290. content: '您当前不是会员,请先升级会员'
  291. })
  292. }
  293. }else {
  294. // 保存地址
  295. saveUrl();
  296. // 登录拦截
  297. interceptor();
  298. }
  299. }else {
  300. uni.navigateTo({
  301. url: item.path + '&tit=' + item.tit,
  302. fail() {
  303. uni.navigateTo({
  304. url: item.path,
  305. fail() {
  306. uni.switchTab({
  307. url: item.path,
  308. })
  309. }
  310. })
  311. }
  312. })
  313. }
  314. }
  315. },
  316. getGoodList() {
  317. let obj = this
  318. getProducts({
  319. is_order: 0,
  320. tree_id: 0
  321. }).then(res => {
  322. this.jfList = res.data
  323. })
  324. },
  325. navto(url, type = 0) {
  326. if (type == 1) {
  327. if (!this.hasLogin) {
  328. // 保存地址
  329. saveUrl();
  330. // 登录拦截
  331. interceptor();
  332. } else {
  333. uni.navigateTo({
  334. url,
  335. fail() {
  336. uni.switchTab({
  337. url
  338. })
  339. }
  340. })
  341. }
  342. } else {
  343. uni.navigateTo({
  344. url,
  345. fail() {
  346. uni.switchTab({
  347. url
  348. })
  349. }
  350. })
  351. }
  352. },
  353. navTo(url) {
  354. if (url == '') {
  355. this.$api.msg('暂未开通,敬请期待');
  356. } else {
  357. this.navto(url)
  358. }
  359. },
  360. // 點擊搜索框
  361. clickSearch() {
  362. uni.navigateTo({
  363. url: '/pages/product/search'
  364. });
  365. },
  366. // 监听图片加载完成
  367. onImageError(key, index) {
  368. this[key][index].image = '/static/error/errorImage.jpg';
  369. },
  370. // 请求载入数据
  371. async loadData() {
  372. loadIndexs({})
  373. .then(({
  374. data
  375. }) => {
  376. let goods = data.info;
  377. console.log(goods, '商品信息');
  378. this.carouselList = data.banner;
  379. this.swiperLength = this.carouselList.length;
  380. this.bastList = data.likeInfo; //会员礼包
  381. data.info.firstList.forEach(e => {
  382. e.isVip = e.store_type ? "3" : "0"
  383. })
  384. this.firstList = data.info.firstList //首页商品
  385. this.jfList = data.benefit
  386. uni.stopPullDownRefresh();
  387. })
  388. .catch(e => {
  389. uni.stopPullDownRefresh();
  390. });
  391. },
  392. //轮播图切换修改背景色
  393. swiperChange(e) {
  394. const index = e.detail.current;
  395. this.swiperCurrent = index;
  396. this.titleNViewBackground = this.carouselList[index].background;
  397. },
  398. // 轮播图跳转
  399. bannerNavToUrl(item) {
  400. // #ifdef H5
  401. console.log(item.wap_url.indexOf('http'), 'banner');
  402. if (item.wap_url.indexOf('http') >= 0) {
  403. window.location.href = item.wap_url;
  404. }
  405. // #endif
  406. uni.navigateTo({
  407. url: item.wap_url
  408. });
  409. },
  410. comfirm(text) {
  411. console.log(text);
  412. const result = this.uniCopy(text);
  413. if (result === false) {
  414. uni.showToast({
  415. title: '不支持'
  416. });
  417. } else {
  418. uni.showToast({
  419. title: '复制成功',
  420. icon: 'none'
  421. });
  422. }
  423. this.$refs.popupkf.close();
  424. },
  425. uniCopy(content) {
  426. /**
  427. * 小程序端 和 app端的复制逻辑
  428. */
  429. //#ifndef H5
  430. uni.setClipboardData({
  431. data: content,
  432. success: function() {
  433. console.log('success');
  434. return true;
  435. }
  436. });
  437. //#endif
  438. /**
  439. * H5端的复制逻辑
  440. */
  441. // #ifdef H5
  442. if (!document.queryCommandSupported('copy')) {
  443. //为了兼容有些浏览器 queryCommandSupported 的判断
  444. // 不支持
  445. return false;
  446. }
  447. let textarea = document.createElement('textarea');
  448. textarea.value = content;
  449. textarea.readOnly = 'readOnly';
  450. document.body.appendChild(textarea);
  451. textarea.select(); // 选择对象
  452. textarea.setSelectionRange(0, content.length); //核心
  453. let result = document.execCommand('copy'); // 执行浏览器复制命令
  454. textarea.remove();
  455. return result;
  456. // #endif
  457. },
  458. // 打开客服
  459. openKf() {
  460. this.$refs.popupkf.open();
  461. },
  462. // 关闭客服
  463. cancel() {
  464. this.$refs.popupkf.close();
  465. },
  466. }
  467. };
  468. </script>
  469. <style lang="scss">
  470. .container {
  471. // background-image: url('../../static/index/in-bg.png');
  472. // background-size: 100% 100%;
  473. padding-bottom: 68rpx;
  474. }
  475. image {
  476. vertical-align: middle;
  477. }
  478. page {
  479. min-height: 100%;
  480. height: auto;
  481. }
  482. // 顶部搜索
  483. .top-search {
  484. height: 80rpx;
  485. padding: 0 20rpx;
  486. position: relative;
  487. margin-bottom: 20rpx;
  488. .top-logo {
  489. width: 50rpx;
  490. margin-right: 10rpx;
  491. image {
  492. width: 48rpx;
  493. }
  494. }
  495. .search-box {
  496. justify-content: center;
  497. width: 698rpx;
  498. height: 60rpx;
  499. background: rgba(255, 255, 255, 0.5);
  500. color: #CBCBCB;
  501. border-radius: 30rpx;
  502. .search {
  503. width: 34rpx;
  504. height: 34rpx;
  505. }
  506. .search-font {
  507. margin-left: 14rpx;
  508. font-size: 28rpx;
  509. font-weight: 500;
  510. }
  511. }
  512. }
  513. // 顶部轮播图
  514. .top-swiper {
  515. width: 750rpx;
  516. height: 360rpx;
  517. .carousel-item {
  518. image {
  519. width: 100%;
  520. height: 100%;
  521. }
  522. }
  523. }
  524. .in-banner {
  525. width: 750rpx;
  526. height: 57rpx;
  527. }
  528. .in-banner-t {
  529. width: 750rpx;
  530. height: 220rpx;
  531. }
  532. .in-vip {
  533. width: 680rpx;
  534. height: 504rpx;
  535. background-image: url('../../static/index/in-vip.png');
  536. background-size: 100% 100%;
  537. margin: 30rpx auto 70rpx;
  538. position: relative;
  539. image {
  540. width: 100%;
  541. height: 356rpx;
  542. position: absolute;
  543. top: 0;
  544. left: 0;
  545. }
  546. .vip-info {
  547. height: 147rpx;
  548. width: 100%;
  549. position: absolute;
  550. bottom: 0;
  551. left: 0;
  552. padding: 0 27rpx;
  553. .price {
  554. font-weight: bold;
  555. font-size: 35rpx;
  556. color: #FF4C4C;
  557. text {
  558. font-size: 25rpx;
  559. color: #333333;
  560. }
  561. }
  562. .info {
  563. font-weight: 500;
  564. font-size: 22rpx;
  565. color: #443516;
  566. padding-top: 10rpx;
  567. }
  568. .btn {
  569. width: 127rpx;
  570. line-height: 44rpx;
  571. background: linear-gradient(89deg, #BB9159, #E6C79D);
  572. border-radius: 22rpx;
  573. font-weight: 500;
  574. font-size: 22rpx;
  575. color: #443516;
  576. text-align: center;
  577. }
  578. }
  579. }
  580. .swiper-btm {
  581. height: 60rpx;
  582. width: 750rpx;
  583. margin-bottom: 20rpx;
  584. font-size: 26rpx;
  585. font-weight: 500;
  586. color: #333333;
  587. .btm-item {
  588. flex-grow: 1;
  589. justify-content: center;
  590. image {
  591. width: 25rpx;
  592. height: 25rpx;
  593. margin-right: 14rpx;
  594. }
  595. }
  596. }
  597. // 分类
  598. .cate-section {
  599. justify-content: flex-start;
  600. padding: 0 0 30rpx;
  601. flex-wrap: wrap;
  602. .cate-item {
  603. padding-top: 30rpx;
  604. flex-grow: 0;
  605. flex-grow: 1;
  606. min-width: 20%;
  607. flex-direction: column;
  608. text-align: center;
  609. align-items: center;
  610. justify-content: center;
  611. .img-wrapper {
  612. width: 90rpx;
  613. height: 90rpx;
  614. border-radius: 20rpx;
  615. position: relative;
  616. image {
  617. width: 100%;
  618. height: 100%;
  619. position: absolute;
  620. left: 50%;
  621. top: 50%;
  622. transform: translate(-50%, -50%);
  623. }
  624. }
  625. .item-title {
  626. margin-top: 15rpx;
  627. font-size: 26rpx;
  628. font-weight: 500;
  629. color: #443516;
  630. }
  631. }
  632. }
  633. .in-tit {
  634. width: 449rpx;
  635. height: 79rpx;
  636. display: block;
  637. margin: 40rpx auto;
  638. }
  639. .art {
  640. width: 680rpx;
  641. margin: auto;
  642. background: #FFFFFF;
  643. box-shadow: 0rpx 3rpx 3rpx 0rpx rgba(0, 0, 0, 0.1);
  644. border-radius: 30rpx;
  645. padding: 39rpx;
  646. .art-tit {
  647. font-weight: 400;
  648. font-size: 16rpx;
  649. color: #848484;
  650. }
  651. .art-content {
  652. // font-weight: 500;
  653. // font-size: 24rpx;
  654. // color: #000000;
  655. padding: 43rpx 10rpx 31rpx;
  656. // text-indent: 2em;
  657. // text-align: justify;
  658. }
  659. .art-line {
  660. width: 446rpx;
  661. height: 1rpx;
  662. background: #434343;
  663. float: right;
  664. }
  665. }
  666. .popup-box {
  667. width: 522rpx;
  668. height: 605rpx;
  669. background-color: #ffffff;
  670. border-radius: 20rpx;
  671. position: relative;
  672. .img {
  673. position: relative;
  674. top: -56rpx;
  675. left: 0;
  676. width: 522rpx;
  677. height: 132rpx;
  678. display: flex;
  679. justify-content: center;
  680. image {
  681. border-radius: 20rpx 20rpx 0 0;
  682. width: 450rpx;
  683. height: 132rpx;
  684. }
  685. }
  686. .mian {
  687. margin-top: -44rpx;
  688. display: flex;
  689. flex-direction: column;
  690. align-items: center;
  691. // padding: 32rpx 32rpx;
  692. background-color: #ffffff;
  693. border-radius: 0 0 20rpx 20rpx;
  694. text-align: center;
  695. .delivery {
  696. font-size: 40rpx;
  697. color: #333333;
  698. display: flex;
  699. align-items: center;
  700. flex-direction: column;
  701. image {
  702. margin-top: 48rpx;
  703. width: 172rpx;
  704. height: 160rpx;
  705. }
  706. }
  707. .nocancel {
  708. font-size: 32rpx;
  709. color: #333333;
  710. margin-top: 14rpx;
  711. }
  712. .comfirm-box {
  713. margin-top: 52rpx;
  714. display: flex;
  715. .cancel {
  716. display: flex;
  717. align-items: center;
  718. justify-content: center;
  719. width: 197rpx;
  720. height: 74rpx;
  721. border: 1px solid #dcc786;
  722. border-radius: 38rpx;
  723. font-size: 32rpx;
  724. color: #605128;
  725. }
  726. .comfirm {
  727. margin-left: 32rpx;
  728. display: flex;
  729. align-items: center;
  730. justify-content: center;
  731. width: 197rpx;
  732. height: 74rpx;
  733. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  734. border-radius: 38px;
  735. font-size: 32rpx;
  736. color: #605128;
  737. }
  738. }
  739. }
  740. }
  741. .status_bar {
  742. height: var(--status-bar-height);
  743. width: 100%;
  744. }
  745. /deep/ img {
  746. width: 100% !important;
  747. height: auto;
  748. }
  749. .cz-model {
  750. width: 750rpx;
  751. background-color: #fff;
  752. padding: 60rpx 0 30rpx;
  753. text-align: center;
  754. border-radius: 25rpx 25rpx 0 0;
  755. padding-bottom:70px;
  756. /* #ifdef APP-PLUS */
  757. padding-bottom:40px;
  758. /* #endif */
  759. view {
  760. padding: 10rpx 0;
  761. }
  762. image {
  763. width: 680rpx;
  764. // height: ;
  765. height: 356rpx;
  766. }
  767. .price {
  768. color: $base-color;
  769. font-size: 48rpx;
  770. font-weight: bold;
  771. }
  772. .tip {
  773. color: #409eff;
  774. }
  775. .tips {
  776. padding-bottom: 20rpx;
  777. }
  778. .btn {
  779. width: 690rpx;
  780. text-align: center;
  781. line-height: 60rpx;
  782. color: #443516;
  783. background: linear-gradient(89deg, #BB9159, #E6C79D);
  784. border-radius: 40rpx;
  785. margin: auto;
  786. }
  787. }
  788. </style>