index.vue 15 KB

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