index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. <template>
  2. <view class="content">
  3. <view class="topBox"></view>
  4. <view class="yuanhu"></view>
  5. <view class="shoptopbox2" v-if="!carInfo">
  6. <view class="carinfoBox2">
  7. <view class="carinfoBoxNocar" @click="addCar">
  8. <img src="../../static/timg/addcar.png" alt="" class="carinfonocarIcon">
  9. <view class="carinfoBoxNocarRight">
  10. <view class="carinfoBoxNocarRightTitle">添加我的爱车</view>
  11. <view class="carinfoBoxNocarRightMS">按照车型推荐合适的商品</view>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="shoptopbox" v-if="carInfo">
  17. <view class="carinfoBox" >
  18. <view class="carinfoBoxTop">
  19. <img :src="carInfo.brandLogo" alt="" class="carLogo" v-if="carInfo.brandLogo">
  20. <img src="../../static/timg/nocar.png" alt="" class="carLogo" v-else>
  21. <view class="carinfoBoxTopCont">
  22. <view class="carinfoBoxTopContTop">
  23. <view class="carInfoplateNumber">{{carInfo.plateNumber}}</view>
  24. <view class="carTnfomilage">{{carInfo.milage?carInfo.milage:0}}km</view>
  25. </view>
  26. <view class="carInfocarModel" v-if="carInfo.carModel">{{carInfo.carModel}}</view>
  27. <view class="carInfocarModel" v-else>暂无</view>
  28. </view>
  29. <view class="carinfoBoxTopRight" @click="changeCar">
  30. <img src="../../static/timg/icon_change@2x.png" alt="" class="carinfoBoxTopRightIcon">
  31. <view class="huancheBtn">换车</view>
  32. </view>
  33. </view>
  34. <view class="carInfoBottom">
  35. <view class="carInfoBottomLine">
  36. <view class="carInfoBottomLineTitle">下次保养里程</view>
  37. <view class="carInfoBottomLineTxt" v-if="carInfo.nextCareMilage">{{carInfo.nextCareMilage}}</view>
  38. <view class="carInfoBottomLineTxt" v-else>暂无</view>
  39. </view>
  40. <view class="carInfoBottomLine">
  41. <view class="carInfoBottomLineTitle">下次保养日期</view>
  42. <view class="carInfoBottomLineTxt" v-if="carInfo.nextCareDate">{{carInfo.nextCareDate.slice(0,10)}}</view>
  43. <view class="carInfoBottomLineTxt" v-else>暂无</view>
  44. </view>
  45. <view class="carInfoBottomLine">
  46. <view class="carInfoBottomLineTitle">保养手册</view>
  47. <view class="carInfoBottomLineTxt" @click="information">点击查看</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 服务顾问 -->
  53. <view class="adviser" v-if="homeCardList.openMUsers">
  54. <view class="adviserLeft">
  55. <img src="../../static/timg/pic_def_ava@2x.png" alt="" class="advisertx">
  56. <view class="adviserNema">{{homeCardList.openMUsers.operatorName}}</view>
  57. <view class="adviserms">服务顾问</view>
  58. </view>
  59. <img src="../../static/timg/icon_arrow_right.png" alt="" class="adviserJt">
  60. </view>
  61. <!-- 中间轮播模块 -->
  62. <view class="modular" v-if="homeCardList.application.length>0">
  63. <swiper class="swiper" circular :autoplay="false" :interval="interval"
  64. :duration="duration" :indicator-dots="true" indicator-color="#CCCCCC" indicator-active-color="#D53533">
  65. <swiper-item>
  66. <view class="swiper-item">
  67. <view class="itemLine" @click="goRoter('onlineBooking')" v-for="(item,index) in homeCardList.application">
  68. <view><img :src="item.icon" alt="" class="itemImg"></view>
  69. <view class="Menusline">{{item.name}}</view>
  70. </view>
  71. </view>
  72. </swiper-item>
  73. <!-- <swiper-item>
  74. <view class="swiper-item">
  75. </view>
  76. </swiper-item> -->
  77. </swiper>
  78. </view>
  79. <view class="advertisement" v-if="homeCardList.ad1.length>0">
  80. <swiper class="swiper2" circular :autoplay="false" :interval="interval"
  81. :duration="duration" :indicator-dots="true" indicator-color="#CCCCCC" indicator-active-color="#D53533">
  82. <swiper-item v-for="(item,index) in homeCardList.ad1">
  83. <view class="swiper-item2">
  84. <image class="swiper-item2Img" :src="item.icon" mode=""></image>
  85. </view>
  86. </swiper-item>
  87. </swiper>
  88. </view>
  89. <!-- 热门活动 -->
  90. <view class="Hot">
  91. <view class="hotTop">
  92. <view class="hotLeft">
  93. <view class="hotSx"></view>
  94. <view class="hottitle">热门活动</view>
  95. </view>
  96. <view class="hotRight">
  97. <view class="hotMore">更多</view>
  98. <img src="../../static/timg/icon_arrow_right.png" alt="" class="hotMoreJt">
  99. </view>
  100. </view>
  101. <view class="hotLine">
  102. <view class="hotLineTop">
  103. <image class="hotLineTopImg" src="http://phone.66km.cn:8088/thFiles/C678448A-C874-4B42-9EAE-4F8F21D71D27.jpg" mode=""></image>
  104. <view class="hotlineTimebox">
  105. <view class="hotlinestate1">进行中</view>
  106. <view class="hotTime">2022.01.21-2022.02.14</view>
  107. </view>
  108. </view>
  109. <view class="hotName">博世 7月促【CX-200715003】</view>
  110. </view>
  111. <view class="hotLine">
  112. <view class="hotLineTop">
  113. <image class="hotLineTopImg" src="http://phone.66km.cn:8088/thFiles/C678448A-C874-4B42-9EAE-4F8F21D71D27.jpg" mode=""></image>
  114. <view class="hotlineTimebox">
  115. <view class="hotlinestate2">未开始</view>
  116. <view class="hotTime">2022.01.21-2022.02.14</view>
  117. </view>
  118. </view>
  119. <view class="hotName">博世 7月促【CX-200715003】</view>
  120. </view>
  121. </view>
  122. <!-- 热门商品 -->
  123. <view class="Hot">
  124. <view class="hotTop">
  125. <view class="hotLeft">
  126. <view class="hotSx"></view>
  127. <view class="hottitle">热门商品</view>
  128. </view>
  129. <view class="hotRight">
  130. <view class="hotMore">更多</view>
  131. <img src="../../static/timg/icon_arrow_right.png" alt="" class="hotMoreJt">
  132. </view>
  133. </view>
  134. <view class="hotGoodsLine" v-for="(item,index) in 5">
  135. <view>
  136. <image src="../../static/timg/nocar.png" mode="" class="hotGoodsLineImg"></image>
  137. </view>
  138. <view class="hotGoodsLineRIght">
  139. <view class="goodsName">德国马牌 Continental 全新升级6代 TechContct德国马牌 Continental 全新升级6代 TechContct</view>
  140. <view class="Sold">已售 999</view>
  141. <view class="goodsPrice">
  142. <view class="goodsPrice1">店庆价</view>
  143. <view class="goodsPrice2">¥</view>
  144. <view class="goodsPrice3">999</view>
  145. <view class="goodsPrice3">¥893</view>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. <view style="height: 60rpx;"></view>
  151. <!-- <view @getphonenumber="decryptPhoneNumber" >shopId:{{shopId}}</view>
  152. <button type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">获取手机号</button> -->
  153. </view>
  154. </template>
  155. <script>
  156. export default {
  157. data() {
  158. return {
  159. shopId: '',
  160. url:'',
  161. wxOpenData:'',
  162. code:'',
  163. carInfo:{},
  164. homeCardList:'',
  165. }
  166. },
  167. onLoad() {
  168. var that=this;
  169. this.$common.getExtStoreId()
  170. var ext=this.$common.getExtStoreId();
  171. console.log(ext)
  172. this.shopId=ext.shopId;
  173. this.url=ext.url;
  174. // uni.setStorage({
  175. // key: 'extdata',
  176. // data: {
  177. // shopId:'E37BB296-5A08-4534-859D-B351BA611AF9',
  178. // },
  179. // success: function () {
  180. // that.uniLogin()
  181. // }
  182. // });
  183. this.userInfo = uni.getStorageSync("userInfo");
  184. if(this.userInfo){
  185. this.getCarList();
  186. this.queryHomeCardList()
  187. }else{
  188. this.uniLogin()
  189. }
  190. },
  191. methods: {
  192. information(){
  193. },
  194. changeCar(){
  195. },
  196. goRoter(url){
  197. uni.navigateTo({
  198. url:url
  199. })
  200. },
  201. decryptPhoneNumber: function(e) {
  202. console.log(e);
  203. this.code=e.detail.code
  204. this.wxPhoneLogin()
  205. },
  206. wxgologin(){
  207. var that=this;
  208. uni.getUserProfile({
  209. lang:'zh_CN',
  210. desc:'登录',
  211. success:(res)=>{
  212. console.log(res);
  213. that.wxdata=res;
  214. uni.setStorage({
  215. key: 'wxdata',
  216. data: res,
  217. success: function () {
  218. that.uniLogin()
  219. }
  220. });
  221. },
  222. fail:(res)=>{
  223. console.log(res)
  224. }
  225. });
  226. },
  227. uniLogin(){
  228. var that=this;
  229. uni.login({
  230. provider: 'weixin',
  231. success: function (loginRes) {
  232. console.log(loginRes);
  233. that.getWxOpenID(loginRes)
  234. }
  235. });
  236. },
  237. getWxOpenID(e){
  238. var that=this;
  239. // this.code=e.code;
  240. this.$http('miniApp2/sys/getWxOpenID', {
  241. code:e.code,
  242. shopId:'E37BB296-5A08-4534-859D-B351BA611AF9'
  243. },'GET').then(res => {
  244. this.wxOpenData=res.data;
  245. //that.wxPhoneLogin()
  246. uni.setStorage({
  247. key: 'wxOpenData',
  248. data: that.wxOpenData,
  249. success: function () {
  250. // that.uniLogin()
  251. }
  252. });
  253. if(this.wxOpenData.loginInfo){
  254. uni.setStorage({
  255. key: 'userInfo',
  256. data: that.wxOpenData.loginInfo.openUser,
  257. success: function () {
  258. // that.uniLogin()
  259. }
  260. });
  261. }
  262. })
  263. },
  264. wxPhoneLogin(){
  265. var that=this;
  266. this.$http('miniApp2/sys/wxPhoneLogin', {
  267. appId:'wx33053a645546ec31',
  268. shopId:'E37BB296-5A08-4534-859D-B351BA611AF9',
  269. code:this.code,
  270. openId:this.wxOpenData.openid
  271. },'POST').then(res => {
  272. var data = res.data;
  273. if(data.loginInfo){
  274. uni.setStorage({
  275. key: 'userInfo',
  276. data: data.loginInfo.openUser,
  277. success: function () {
  278. that.getCarList()
  279. that.queryHomeCardList()
  280. }
  281. });
  282. }
  283. })
  284. },
  285. getCarList(){
  286. this.$http('opencarOwnerHome/queryCarInfoList', {
  287. },'GET').then(res => {
  288. this.carInfo=res.data[0]
  289. this.$store.commit('mutationscarInfo', this.carInfo)
  290. })
  291. },
  292. queryHomeCardList(){
  293. this.$http('openHome/queryHomeCardList', {
  294. },'GET').then(res => {
  295. this.homeCardList=res.data
  296. })
  297. }
  298. }
  299. }
  300. </script>
  301. <style scoped>
  302. .content{
  303. min-height: 100vh;
  304. background: #F4F5F7;
  305. }
  306. .topBox{
  307. width: 750rpx;
  308. height: 200rpx;
  309. background: #D53533;
  310. }
  311. .yuanhu{
  312. width: 750rpx;
  313. height: 50rpx;
  314. background: #D53533;
  315. border-radius: 0 0 100% 100%;
  316. }
  317. .carinfoBox{
  318. width: 702rpx;
  319. height: 250rpx;
  320. background: #FFFFFF;
  321. border-radius: 10rpx;
  322. margin-left: 24rpx;
  323. overflow: hidden;
  324. }
  325. .carinfoBox2{
  326. width: 702rpx;
  327. height: 180rpx;
  328. background: #FFFFFF;
  329. border-radius: 10rpx;
  330. margin-left: 24rpx;
  331. overflow: hidden;
  332. }
  333. .carinfoBox .carLogo{
  334. width: 72rpx;height: 72rpx;
  335. }
  336. .carinfoBoxTop{
  337. display: flex;
  338. justify-content: space-between;
  339. padding-top: 29rpx;
  340. padding-left: 24rpx;
  341. padding-right: 20rpx;
  342. padding-bottom: 24rpx;
  343. border: 1px solid #EEEEEE;
  344. }
  345. .carinfoBoxTopCont{
  346. width: 454rpx;
  347. }
  348. .carinfoBoxTopContTop{
  349. display: flex;
  350. }
  351. .carInfoplateNumber{
  352. font-weight: 500;
  353. color: #3C3C3C;
  354. font-size: 30rpx;
  355. line-height: 42rpx;
  356. padding-right: 16rpx;
  357. }
  358. .carTnfomilage{
  359. color: #F19D01;
  360. font-size: 22rpx;
  361. padding: 0rpx 10rpx;
  362. border-radius: 4rpx;
  363. border: 1px solid #F19D01;
  364. height: 32rpx;
  365. line-height: 34rpx;
  366. margin-top: 2rpx;
  367. margin-left: 2rpx;
  368. }
  369. .carInfocarModel{
  370. width: 454rpx;
  371. color: #666666;
  372. font-size: 26rpx;
  373. white-space: nowrap;
  374. overflow: hidden;
  375. text-overflow: ellipsis;
  376. }
  377. .carinfoBoxTopRight{
  378. display: flex;padding-top: 25rpx;
  379. }
  380. .carinfoBoxTopRightIcon{
  381. width: 29rpx;
  382. height: 31rpx;
  383. }
  384. .huancheBtn{
  385. color: #666666; font-size: 26rpx;line-height: 31rpx;
  386. padding-left: 10rpx;
  387. }
  388. .carInfoBottom{
  389. display: flex;
  390. justify-content: space-around;
  391. }
  392. .carInfoBottomLineTitle{
  393. color: #999999;font-size: 24rpx;
  394. text-align: center;
  395. padding-top: 24rpx;
  396. }
  397. .carInfoBottomLineTxt{
  398. color: #3C3C3C;
  399. font-size: 26rpx;
  400. padding-top: 5rpx;
  401. text-align: center;
  402. }
  403. .carinfonocarIcon{
  404. width: 72rpx;
  405. height: 72rpx;
  406. }
  407. .carinfoBoxNocar{
  408. display: flex;
  409. padding-top: 50rpx;
  410. padding-left: 20rpx;
  411. }
  412. .carinfoBoxNocarRightTitle{
  413. font-weight: 500;
  414. color: #3C3C3C;
  415. font-size: 30rpx;
  416. }
  417. .carinfoBoxNocarRightMS{
  418. color: #666666;
  419. font-size: 26rpx;
  420. }
  421. .carinfoBoxNocarRight{
  422. padding-left: 24rpx;
  423. }
  424. .shoptopbox{
  425. margin-top: -200rpx;
  426. }
  427. .adviser{
  428. width: 662rpx;
  429. margin-left: 24rpx;
  430. background: #FFFFFF;
  431. border-radius: 10px;
  432. display: flex;
  433. justify-content: space-between;
  434. padding: 18rpx 20rpx;
  435. margin-top: 20rpx;
  436. }
  437. .adviserLeft{
  438. display: flex;
  439. }
  440. .advisertx{
  441. width: 62rpx;height: 62rpx;
  442. }
  443. .adviserNema{
  444. color: #333333;font-size: 30rpx;
  445. line-height: 62rpx;padding-left: 24rpx;
  446. }
  447. .adviserms{
  448. width: 118rpx;
  449. height: 36rpx;
  450. border-radius: 4rpx;
  451. border: 1px solid #D53533;
  452. line-height: 36rpx;
  453. text-align: center;
  454. margin-top: 12rpx;
  455. margin-left: 20rpx;
  456. color: #D53533;
  457. font-size: 24rpx;
  458. }
  459. .adviserJt{
  460. width: 12rpx;
  461. height: 20rpx;
  462. margin-top: 16rpx;
  463. }
  464. .modular{
  465. width: 702rpx;
  466. height: 313rpx;
  467. background: #FFFFFF;
  468. border-radius: 10px;
  469. margin-top: 20rpx;
  470. margin-left: 24rpx;
  471. }
  472. .swiper-item{
  473. display: flex;
  474. flex-wrap: wrap;
  475. }
  476. .itemImg{
  477. width: 46rpx;
  478. height: 46rpx;
  479. }
  480. .Menusline{
  481. font-size: 24rpx;
  482. color: #333333;
  483. }
  484. .itemLine{
  485. width: 25%;
  486. text-align: center;
  487. padding-top: 40rpx;
  488. }
  489. .advertisement{
  490. width: 702rpx;
  491. height: 280rpx;
  492. margin-top: 20rpx;
  493. margin-left: 24rpx;
  494. border-radius: 20rpx;
  495. }
  496. .swiper-item2{
  497. width: 702rpx;
  498. height: 280px;
  499. }
  500. .swiper-item2Img{
  501. width: 702rpx;
  502. height: 280rpx;
  503. }
  504. .hotMoreJt{
  505. width: 12rpx;
  506. height: 20rpx;
  507. margin-top: 6rpx;
  508. }
  509. .Hot{
  510. width: 702rpx;
  511. margin-top: 20rpx;
  512. margin-left: 24rpx;
  513. }
  514. .hotTop{
  515. display: flex;
  516. justify-content: space-between;
  517. }
  518. .hotSx{
  519. width: 8rpx;
  520. height: 30rpx;
  521. background: #F03B3B;
  522. border-radius: 5rpx;
  523. }
  524. .hotLeft{
  525. display: flex;
  526. }
  527. .hottitle{
  528. font-weight: 500;
  529. color: #333333;
  530. font-size: 30rpx;
  531. line-height: 30rpx;
  532. margin-left: 16rpx;
  533. }
  534. .hotRight{
  535. display: flex;
  536. }
  537. .hotMore{
  538. line-height: 30rpx;color: #666666;font-size: 24rpx;
  539. margin-right: 16rpx;
  540. }
  541. .hotLineTopImg{
  542. width: 702rpx;
  543. height: 280rpx;
  544. }
  545. .hotLineTop{
  546. position: relative;
  547. height: 280rpx;
  548. }
  549. .hotLine{
  550. margin-top: 20rpx;
  551. border-radius: 10rpx;
  552. background: #FFFFFF;
  553. overflow: hidden;
  554. }
  555. .hotlinestate1{
  556. width: 102rpx;
  557. height: 44rpx;
  558. background:#FBBF00 ;
  559. line-height: 44rpx;
  560. font-weight: 500;
  561. color: #333333;
  562. font-size: 24rpx;
  563. text-align: center;
  564. }
  565. .hotlinestate2{
  566. width: 102rpx;
  567. height: 44rpx;
  568. background:#F03B3B ;
  569. line-height: 44rpx;
  570. font-weight: 500;
  571. color: #FFFFFF;
  572. font-size: 24rpx;
  573. text-align: center;
  574. }
  575. .hotlineTimebox{
  576. position: absolute;
  577. left: 0;
  578. bottom: 0;
  579. background: rgba(0, 0, 0, 0.5);
  580. display: flex;
  581. }
  582. .hotTime{
  583. font-weight: 400;
  584. color: #FFFFFF;
  585. font-size: 24rpx;
  586. line-height: 44rpx;
  587. padding: 0 20rpx;
  588. }
  589. .hotName{
  590. padding: 24rpx 20rpx;
  591. color: #333333;
  592. line-height: 40rpx;
  593. font-size: 28rpx;
  594. }
  595. .hotGoodsLine{
  596. margin-top: 20rpx;
  597. padding: 20rpx;
  598. background: #FFFFFF;
  599. border-radius: 16rpx;
  600. display: flex;
  601. }
  602. .hotGoodsLineImg{
  603. width: 208rpx;
  604. height: 194rpx;
  605. border-radius: 16rpx;
  606. border: 1px solid #EEEEEE;
  607. }
  608. .goodsName{
  609. font-size: 28rpx;
  610. font-family: PingFangSC-Regular, PingFang SC;
  611. font-weight: 400;
  612. color: #333333;
  613. line-height: 40rpx;
  614. text-overflow: -o-ellipsis-lastline;
  615. overflow: hidden;
  616. text-overflow: ellipsis;
  617. display: -webkit-box;
  618. -webkit-line-clamp: 2;
  619. line-clamp: 2;
  620. -webkit-box-orient: vertical;
  621. }
  622. .hotGoodsLineRIght{
  623. padding-left: 24rpx;
  624. }
  625. .goodsPrice{
  626. display: flex;
  627. padding-top: 10rpx;
  628. }
  629. .goodsPrice1{
  630. font-size: 24rpx;
  631. font-weight: 400;
  632. color: #F03B3B;
  633. }
  634. .goodsPrice2{
  635. font-size: 22rpx;
  636. font-weight: 400;
  637. color: #F03B3B;
  638. }
  639. .goodsPrice3{
  640. font-size: 32rpx;
  641. font-weight: 400;
  642. color: #F03B3B;
  643. }
  644. .goodsPrice3{
  645. font-size: 24rpx;
  646. font-weight: 400;
  647. color: #999999;
  648. }
  649. .Sold{
  650. font-weight: 400;
  651. color: #999999;
  652. font-size: 24rpx;
  653. padding-top: 8rpx;
  654. }
  655. </style>