index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <view class="container">
  3. <keep-alive>
  4. <MyTabBar @tab-switch="onTabSwitch" :actived="actived"></MyTabBar>
  5. </keep-alive>
  6. <view class="toutu-container">
  7. <!-- <image src="https://mall.zhaijieshi.cc/file/wx-huawang/tb.png" mode="aspectFill" /> -->
  8. </view>
  9. <view class="bolang" @tap="loginHandle">
  10. <view class="zx">
  11. <image src="../../static/shouye/guanjiaicon.png" class="zx-img"></image>
  12. <text>尊享花王认证保洁师服务</text>
  13. <view class="zx-one">一天只服务一家,承诺不满意重做</view>
  14. </view>
  15. <button class="loginBtn" v-if="!isLogin">注册/登陆</button>
  16. </view>
  17. <view class="sort">
  18. <view class="single">
  19. <view class="single-title">
  20. <text class="sort-title ">单次体验</text>
  21. </view>
  22. <text class="sort-tip sort-tip1">除菌率99.9%,品质家庭就选它</text>
  23. <view v-for="(item, index) in dcGoods" :key="index"
  24. :class="{ 'last-items-style': index === dcGoods.length - 1 }">
  25. <navigator :url="'/pages/goods/goods?id=' + item.id" hover-class="none">
  26. <view class="sproducts">
  27. <view class="single-img">
  28. <image :src="item.picUrl" class="ssingle-img" />
  29. </view>
  30. <view class="ssproducts">
  31. <text class="ssproducts-title">{{item.name}}</text>
  32. <view class="ssproducts-contents">
  33. <text class="ssproducts-content">{{item.brief}}</text>
  34. <view class="productPrice"
  35. style="display: flex;justify-content: space-between; margin-top: 20rpx;width: 420rpx;">
  36. <view class="">
  37. <text class="salePrice">¥</text>
  38. <text class="salePrice-num">{{item.retailPrice}}</text>
  39. <text class="salePrice-spe">/次</text>
  40. <text class="originalPrice">¥{{item.counterPrice}}</text>
  41. </view>
  42. <view class="appointmentNow">
  43. 立即预约
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </navigator>
  50. </view>
  51. </view>
  52. <view class="period">
  53. <view class="period-title">
  54. <text class=" sort-title">周期更省心</text>
  55. </view>
  56. <text class="sort-tip1 sort-tip">用过1次,一定会用第2次的服务</text>
  57. <view class="pproducts">
  58. <view class="pproducts-one" :class="{ 'last-item-style': (index+1)%3==0 }"
  59. v-for="(item, index) in zqGoods" :key="index">
  60. <navigator :url="'/pages/goods/goods?id=' + item.id" hover-class="none">
  61. <image :src="item.picUrl" class="pproducts-img"></image>
  62. <text
  63. :class="item.name.startsWith('【')?'pproducts-title1':'pproducts-title'">{{item.name}}</text>
  64. <view style="display: flex;justify-content: space-around;">
  65. <view class="" style="margin :7rpx 0rpx 0rpx 10rpx;;">
  66. <text class="pproducts-price">¥</text>
  67. <text style="color: #EC351D; font-weight:bold; font-size: 30rpx;"
  68. class="pproducts-price-num">{{item.retailPrice}}</text>
  69. <text class="pproducts-originalPrice">¥{{item.counterPrice}}</text>
  70. </view>
  71. <view class="appointment">
  72. 预约
  73. </view>
  74. </view>
  75. </navigator>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="combination">
  80. <text class="ctitle">全屋焕新 除菌必备</text>
  81. <view class="ctips">
  82. <image src="../../static/shouye/wuxin.png" class="ctips-icon"></image>
  83. <text class="ctipstitle">新房入住</text>
  84. <text class="ctipscontent">清除基础开荒后残留的有害化学物质</text>
  85. </view>
  86. <view class="ctips">
  87. <image src="../../static/shouye/wuxin.png" class="ctips-icon"></image>
  88. <text class="ctipstitle">二手房入住</text>
  89. <text class="ctipscontent">清除前任居住遗留的细菌和异味</text>
  90. </view>
  91. <view class="cproducts" v-for="(item, index) in zhGoods" :key="index">
  92. <navigator :url="'/pages/goods/goods?id=' + item.id" hover-class="none">
  93. <view class="title" style="display: flex;justify-content: space-between;">
  94. <view class="sort-title">焕新入住</view>
  95. <view class="sort-tip2 title-val" >
  96. <view class="title-val__text">
  97. {{item.brief}}
  98. </view>
  99. </view>
  100. </view>
  101. <view class="cproducts-img">
  102. <image :src="item.gallery.split(',')[0]" class="cproducts-img"></image>
  103. </view>
  104. <view class="cproducts-bottom">
  105. <view class="cproducts-price">
  106. <text class="salePrice">¥</text>
  107. <text class="salePrice-num">{{item.retailPrice}}</text>
  108. <text class="salePrice-spe">/次</text>
  109. <text class="originalPrice">¥{{item.counterPrice}}</text>
  110. </view>
  111. <view class="appointmentNow ">立即预约</view>
  112. </view>
  113. </navigator>
  114. </view>
  115. <view class="bottom">
  116. <view class="bottom-image">
  117. </view>
  118. <view class="kouhao">
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </template>
  125. <script>
  126. const util = require('../../utils/util.js');
  127. const api = require('../../config/api.js');
  128. const user = require('../../utils/user.js');
  129. const map = require('../../utils/map.js');
  130. const area = require('../../utils/area.js');
  131. export default {
  132. data() {
  133. return {
  134. actived: 0,
  135. dcGoods: [],
  136. zqGoods: [],
  137. zhGoods: [],
  138. isLogin: ''
  139. }
  140. },
  141. onShow() {
  142. this.setData({
  143. isLogin: uni.getStorageSync("token")
  144. })
  145. console.log(this.isLogin);
  146. this.getIndexData()
  147. },
  148. onPullDownRefresh() {
  149. let that = this;
  150. util.request(api.IndexUrl).then(function(res) {
  151. console.log('111111', res.data.goods);
  152. if (res.errno === 0) {
  153. that.setData({
  154. dcGoods: res.data.goods.dcGoods,
  155. zqGoods: res.data.goods.zqGoods,
  156. zhGoods: res.data.goods.zhGoods
  157. });
  158. console.log(that.dcGoods);
  159. setTimeout(() => {
  160. uni.stopPullDownRefresh()
  161. }, 2000)
  162. }
  163. });
  164. },
  165. methods: {
  166. onTabSwitch(index) {
  167. console.log('Switched to tab index:', index);
  168. // 根据索引进行页面跳转或逻辑处理
  169. if (index == 2) {
  170. uni.reLaunch({
  171. url: "/pages/tabBar/ucenter/index/index"
  172. })
  173. } else if (index == 1) {
  174. uni.navigateTo({
  175. url: "/pages/oneToone/1to1"
  176. })
  177. } else {
  178. return
  179. }
  180. },
  181. getIndexData() {
  182. uni.showLoading({
  183. title: '加载中'
  184. });
  185. let that = this;
  186. util.request(api.IndexUrl).then(function(res) {
  187. console.log('11', res.data.goods);
  188. if (res.errno === 0) {
  189. that.setData({
  190. dcGoods: res.data.goods.dcGoods,
  191. zqGoods: res.data.goods.zqGoods,
  192. zhGoods: res.data.goods.zhGoods
  193. });
  194. console.log(that.dcGoods);
  195. uni.hideLoading();
  196. }
  197. });
  198. },
  199. loginHandle() {
  200. if (this.isLogin) {
  201. return
  202. } else {
  203. uni.navigateTo({
  204. url: "/pages/auth/login/login"
  205. })
  206. }
  207. },
  208. }
  209. }
  210. </script>
  211. <style>
  212. .container {
  213. width: 100%;
  214. overflow: hidden;
  215. height: auto;
  216. /* position: relative; */
  217. background-color: #f2f2f2;
  218. }
  219. .tabbar.data-v-56e9c485 {
  220. border: none !important;
  221. }
  222. .toutu-container {
  223. background-image: url('https://mall.zhaijieshi.cc/file/wx-huawang/tb2.png');
  224. background-size: cover;
  225. /* or contain based on your need */
  226. /* background-position: center; */
  227. /* Center the background image */
  228. width: 100%;
  229. /* 容器宽度填充屏幕宽度 */
  230. height: 730rpx;
  231. /* 根据需要调整高度 */
  232. }
  233. .bolang {
  234. position: absolute;
  235. top: 400rpx;
  236. width: 750rpx;
  237. height: 640rpx;
  238. background: url('https://mall.zhaijieshi.cc/file/wx-huawang/shouye.png') no-repeat center center;
  239. background-size: 101% 100%;
  240. }
  241. .zx {
  242. width: 450rpx;
  243. height: 52rpx;
  244. font-size: 40rpx;
  245. color: #B43C14;
  246. line-height: 52rpx;
  247. margin-top: 156rpx;
  248. margin-left: 48rpx;
  249. font-weight: bold;
  250. }
  251. .zx-one {
  252. font-size: 25rpx;
  253. font-weight: normal;
  254. }
  255. .zx-img {
  256. display: block;
  257. width: 114rpx;
  258. height: 128rpx;
  259. position: absolute;
  260. top: 72rpx;
  261. left: 0;
  262. }
  263. .loginBtn {
  264. width: 144rpx;
  265. height: 44rpx;
  266. background: #D42525;
  267. border-radius: 22rpx;
  268. color: #FEF5ED;
  269. font-size: 25rpx;
  270. padding: 0rpx;
  271. line-height: 44rpx;
  272. margin-right: 39rpx;
  273. }
  274. .sort {
  275. position: absolute;
  276. top: 700rpx;
  277. }
  278. .single {
  279. width: 701rpx;
  280. background-color: #fff;
  281. border-radius: 18rpx;
  282. margin: auto;
  283. background-size: 100% 100%;
  284. position: relative;
  285. padding-bottom: 10rpx;
  286. }
  287. .period {
  288. width: 701rpx;
  289. border-radius: 22rpx;
  290. margin: 22rpx auto;
  291. background-color: #fff;
  292. background-size: 100% 100%;
  293. position: relative;
  294. padding-bottom: 12rpx;
  295. }
  296. .period-title {
  297. position: absolute;
  298. top: -13rpx;
  299. left: -1rpx;
  300. width: 228rpx;
  301. height: 76rpx;
  302. background: url(https://mall.zhaijieshi.cc/file/wx-huawang/daohanglan.png) no-repeat center center;
  303. background-size: 100% 100%;
  304. display: inline-block;
  305. }
  306. .combination {
  307. width: 750rpx;
  308. /* height: 778rpx; */
  309. background-color: #fff;
  310. padding-bottom: 20rpx;
  311. }
  312. .cproducts {
  313. width: 701rpx;
  314. padding-bottom: 20rpx;
  315. /* height: 506rpx; */
  316. background: url('https://mall.zhaijieshi.cc/file/wx-huawang/shouye_1.png') no-repeat;
  317. background-size: 100% 100%;
  318. margin: 22rpx auto;
  319. border-radius: 18rpx;
  320. filter: drop-shadow(1rpx -3rpx 2rpx rgba(0, 0, 0, .1)) drop-shadow(-1rpx 3rpx 2rpx rgba(0, 0, 0, .1));
  321. }
  322. .sort-title {
  323. display: inline-block;
  324. font-size: 32rpx;
  325. font-weight: bold;
  326. margin-left: 24rpx;
  327. height: 50rpx;
  328. width: 200rpx;
  329. margin-top: 12rpx;
  330. color: #29292A;
  331. }
  332. .sort-tip {
  333. display: inline-block;
  334. font-size: 27rpx;
  335. font-weight: bold;
  336. margin-right: 25rpx;
  337. color: #AD7857;
  338. margin-top: 28rpx;
  339. width: 400rpx;
  340. float: right;
  341. text-align: right;
  342. height: 40rpx;
  343. overflow: hidden;
  344. }
  345. .sort-tip1 {
  346. margin: 15rpx 25rpx 15rpx 0rpx
  347. }
  348. .sort-tip2{
  349. display: inline-block;
  350. font-size: 27rpx;
  351. font-weight: bold;
  352. margin-right: 25rpx;
  353. color: #AD7857;
  354. margin-top: 28rpx;
  355. width: 400rpx;
  356. }
  357. .title-val {
  358. text-align: right;
  359. }
  360. .title-val__text {
  361. display: inline-block;
  362. text-align: justify;
  363. }
  364. .cproducts-img {
  365. width: 649rpx;
  366. height: 325rpx;
  367. box-shadow: 0rpx 2rpx 26rpx 0rpx rgba(186, 184, 184, 0.32);
  368. border-radius: 18rpx;
  369. margin: 20rpx auto;
  370. border-radius: 10rpx;
  371. display: block;
  372. }
  373. .ctipstitle {
  374. height: 31rpx;
  375. font-family: Alibaba PuHuiTi 2.0;
  376. font-weight: normal;
  377. font-size: 33rpx;
  378. color: #8F572F;
  379. line-height: 40rpx;
  380. display: inline-block;
  381. margin-right: 20rpx;
  382. }
  383. .ctipscontent {
  384. width: 381rpx;
  385. height: 23rpx;
  386. font-family: Alibaba PuHuiTi 2.0;
  387. font-weight: normal;
  388. font-size: 24rpx;
  389. color: #8F572F;
  390. line-height: 40rpx;
  391. }
  392. .ctitle {
  393. height: 53rpx;
  394. font-family: Alibaba PuHuiTi 2.0;
  395. font-weight: normal;
  396. font-size: 56rpx;
  397. color: #942914;
  398. line-height: 50rpx;
  399. display: inline-block;
  400. margin: 43rpx 0 20rpx 51rpx;
  401. }
  402. .cproducts-bottom {
  403. display: flex;
  404. margin: auto;
  405. width: 649rpx;
  406. justify-content: space-around;
  407. }
  408. .single-title {
  409. position: absolute;
  410. top: -12rpx;
  411. left: -2rpx;
  412. width: 228rpx;
  413. height: 76rpx;
  414. background: url('https://mall.zhaijieshi.cc/file/wx-huawang/daohanglan.png') no-repeat center center;
  415. background-size: 100% 100%;
  416. display: inline-block;
  417. }
  418. .sproducts {
  419. width: 650rpx;
  420. height: 224rpx;
  421. background-color: #fff;
  422. margin: 0rpx auto 20rpx;
  423. border-radius: 18rpx;
  424. display: flex;
  425. box-shadow: 2rpx 2rpx 16rpx 0rpx rgba(0, 0, 0, 0.1);
  426. }
  427. .last-items-style {
  428. margin: 0rpx auto;
  429. }
  430. .single-img {
  431. width: 187rpx;
  432. height: 187rpx;
  433. display: block;
  434. margin: 20rpx 20rpx 10rpx 10rpx;
  435. border-radius: 10rpx;
  436. }
  437. .ssingle-img{
  438. width: 187rpx;
  439. height: 187rpx;
  440. border-radius: 10rpx;
  441. }
  442. .ssproducts {
  443. display: inline-block;
  444. padding-top: 10rpx;
  445. width: 500rpx;
  446. }
  447. .ssproducts-title {
  448. height: 28rpx;
  449. font-weight: bold;
  450. font-size: 28rpx;
  451. color: #333333;
  452. line-height: 28rpx;
  453. display: block;
  454. margin: 20rpx 0rpx;
  455. overflow: hidden;
  456. font-family: Alibaba PuHuiTi 2.0;
  457. }
  458. .ssproducts-contents {
  459. display: flex;
  460. flex-direction: column;
  461. justify-content: space-between;
  462. height: 130rpx;
  463. }
  464. .ssproducts-content {
  465. display: inline-block;
  466. width: 382rpx;
  467. height: 30rpx;
  468. font-weight: normal;
  469. font-size: 25rpx;
  470. text-wrap: wrap;
  471. color: #999999;
  472. }
  473. .appointmentNow {
  474. width: 154rpx;
  475. height: 51rpx;
  476. background: #D42525;
  477. border-radius: 25rpx;
  478. font-size: 33rpx;
  479. color: #FEFEFE;
  480. line-height: 51rpx;
  481. text-align: center;
  482. }
  483. .salePrice {
  484. color: #EC351D;
  485. font-size: 21rpx;
  486. font-weight: bold;
  487. }
  488. .salePrice-num {
  489. color: #EC351D;
  490. font-weight: bold;
  491. font-size: 33rpx;
  492. }
  493. .originalPrice {
  494. color: #c7c7c7;
  495. text-decoration: line-through;
  496. font-size: 25rpx;
  497. display: inline-block;
  498. margin-left: 10rpx;
  499. margin-right: 30rpx;
  500. }
  501. .salePrice-spe {
  502. color: #c7c7c7;
  503. font-size: 24rpx;
  504. }
  505. .pproducts {
  506. width: 664rpx;
  507. /* height: 402rpx; */
  508. background: #fff;
  509. box-shadow: 0rpx 2rpx 26rpx 0rpx rgba(186, 184, 184, 0.32);
  510. border-radius: 19rpx;
  511. margin: 23rpx auto;
  512. display: flex;
  513. flex-wrap: wrap;
  514. }
  515. .pproducts-img {
  516. display: block;
  517. width: 181rpx;
  518. height: 181rpx;
  519. margin: 0rpx auto 21rpx;
  520. border-radius: 10rpx;
  521. }
  522. .pproducts-title {
  523. font-size: 25rpx;
  524. color: #333333;
  525. font-weight: bold;
  526. display: block;
  527. width: 181rpx;
  528. height: 65rpx;
  529. margin: 2rpx auto 10rpx;
  530. }
  531. .pproducts-title1 {
  532. font-size: 25rpx;
  533. color: #333333;
  534. font-weight: bold;
  535. display: block;
  536. width: 181rpx;
  537. margin: 2rpx auto 10rpx;
  538. text-indent: -0.5em;
  539. overflow: hidden;
  540. text-overflow: ellipsis;
  541. display: -webkit-box;
  542. -webkit-line-clamp: 2;
  543. -webkit-box-orient: vertical;
  544. height: 65rpx;
  545. }
  546. .pproducts-price {
  547. color: #EC351D;
  548. font-size: 21rpx;
  549. font-weight: bold;
  550. }
  551. .pproducts-originalPrice {
  552. color: #c7c7c7;
  553. text-decoration: line-through;
  554. font-size: 19rpx;
  555. display: block;
  556. }
  557. .appointment {
  558. width: 76rpx;
  559. height: 44rpx;
  560. background: #D42525;
  561. border-radius: 19rpx;
  562. font-size: 27rpx;
  563. color: #fff;
  564. text-align: center;
  565. margin: 10rpx 0 0 20rpx;
  566. line-height: 44rpx;
  567. }
  568. .ctips-icon {
  569. width: 24rpx;
  570. height: 24rpx;
  571. margin: 20rpx 20rpx 0 55rpx;
  572. }
  573. .pproducts-one {
  574. width: 221rpx;
  575. margin-top: 21rpx;
  576. border-right: 1rpx dashed #999;
  577. margin-bottom: 30rpx;
  578. }
  579. .last-item-style {
  580. border: none;
  581. }
  582. .bottom {
  583. position: absolute;
  584. margin-top: 60rpx;
  585. }
  586. .bottom-image {
  587. width: 750rpx;
  588. height: 2389rpx;
  589. background-image: url('https://mall.zhaijieshi.cc/file/wx-huawang/xq.png');
  590. background-size: cover;
  591. background-position: center;
  592. }
  593. .kouhao {
  594. margin: 30rpx auto 185rpx;
  595. width: 451rpx;
  596. height: 135rpx;
  597. background-image: url('https://mall.zhaijieshi.cc/file/wx-huawang/db.png');
  598. background-size: cover;
  599. background-position: center;
  600. }
  601. </style>