index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. <template>
  2. <view class="content">
  3. <view class="indexTop" :style="{background:'#'+themeColor}" v-if="getwxLoing">
  4. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  5. <view class="indexnav">{{wxOpenData.unionName}}</view>
  6. </view>
  7. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  8. <view style="height: 43px;"></view>
  9. <view class="topBox" :style="{background:'#'+themeColor}" v-if="getwxLoing"></view>
  10. <view class="yuanhu" :style="{background:'#'+themeColor}" v-if="getwxLoing"></view>
  11. <view class="shoptopbox2" v-if="!carInfo">
  12. <view class="carinfoBox2">
  13. <view class="carinfoBoxNocar" @click="addCar">
  14. <img src="../../static/timg/addcar.png" alt="" class="carinfonocarIcon">
  15. <view class="carinfoBoxNocarRight">
  16. <view class="carinfoBoxNocarRightTitle">添加我的爱车</view>
  17. <view class="carinfoBoxNocarRightMS">按照车型推荐合适的商品</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="shoptopbox" v-if="carInfo">
  23. <view class="carinfoBox" >
  24. <view class="carinfoBoxTop">
  25. <img :src="carInfo.brandLogo" alt="" class="carLogo" v-if="carInfo.brandLogo">
  26. <img src="../../static/timg/nocar.png" alt="" class="carLogo" v-else>
  27. <view class="carinfoBoxTopCont">
  28. <view class="carinfoBoxTopContTop">
  29. <view class="carInfoplateNumber">{{carInfo.plateNumber}}</view>
  30. <view class="carTnfomilage" v-if="carInfo.milage">{{carInfo.milage}}km</view>
  31. </view>
  32. <view class="carInfocarModel" v-if="carInfo.carModel">{{carInfo.carModel}}</view>
  33. <view class="carInfocarModel" v-else>暂无</view>
  34. </view>
  35. <view class="carinfoBoxTopRight" @click="changeCar">
  36. <img src="../../static/timg/icon_change@2x.png" alt="" class="carinfoBoxTopRightIcon">
  37. <view class="huancheBtn">换车</view>
  38. </view>
  39. </view>
  40. <!-- <view class="carInfoBottom">
  41. <view class="carInfoBottomLine">
  42. <view class="carInfoBottomLineTitle">下次保养里程</view>
  43. <view class="carInfoBottomLineTxt" v-if="carInfo.nextCareMilage">{{carInfo.nextCareMilage}}</view>
  44. <view class="carInfoBottomLineTxt" v-else>暂无</view>
  45. </view>
  46. <view class="carInfoBottomLine">
  47. <view class="carInfoBottomLineTitle">下次保养日期</view>
  48. <view class="carInfoBottomLineTxt" v-if="carInfo.nextCareDate">{{carInfo.nextCareDate.slice(0,10)}}</view>
  49. <view class="carInfoBottomLineTxt" v-else>暂无</view>
  50. </view>
  51. <view class="carInfoBottomLine">
  52. <view class="carInfoBottomLineTitle">保养手册</view>
  53. <view class="carInfoBottomLineTxt" @click="information">点击查看</view>
  54. </view>
  55. </view> -->
  56. <view class="bxBox">
  57. <view class="bxline bxline1">
  58. <img src="../../static/timg/car1.png" alt="" class="bxlineIcon">
  59. <view class="bxlineTitle">保险</view>
  60. <view class="bxlineMs1" v-if="carInfo.insuranceExpireDate">{{InsuranceExpireDate}}天到期</view>
  61. <view class="bxlineMs2" v-else>--</view>
  62. </view>
  63. <view class="bxline bxline2">
  64. <img src="../../static/timg/car2.png" alt="" class="bxlineIcon" >
  65. <view class="bxlineTitle">下次保养</view>
  66. <view class="bxlineMs1" v-if="carInfo.nextCareDate||carInfo.nextCareMilage">
  67. <span v-if="NextCareDate||NextCareDate===0">{{NextCareDate}}天后</span>
  68. <span v-if="NextCareDate===0&&carInfo.nextCareMilage">或</span>
  69. <span v-if="carInfo.nextCareMilage&&NextCareDate">或</span>
  70. <span v-if="carInfo.nextCareMilage">{{carInfo.nextCareMilage}}km</span>
  71. </view>
  72. <view class="bxlineMs2" v-else>--</view>
  73. </view>
  74. <view class="bxline bxline1">
  75. <img src="../../static/timg/car3.png" alt="" class="bxlineIcon" >
  76. <view class="bxlineTitle">年审</view>
  77. <view class="bxlineMs1" v-if="carInfo.nextAuditDate">{{NextAuditDate}}天到期</view>
  78. <view class="bxlineMs2" v-else>--</view>
  79. </view>
  80. <view class="bxline bxline2">
  81. <img src="../../static/timg/car4.png" alt="" class="bxlineIcon" >
  82. <view class="bxlineTitle">保养手册</view>
  83. <view class="bxlineMs2" @click="information">点击查看</view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 服务顾问 -->
  89. <view v-if="homeCardList.openMUsers">
  90. <view class="adviser" v-if="homeCardList.openMUsers.showType!=2&&managerInfo" @click="goMUsers()">
  91. <view class="adviserLeft">
  92. <img v-if="managerInfo.avatar" :src="managerInfo.avatar" alt="" class="advisertx">
  93. <img v-else src="../../static/timg/pic_def_ava@2x.png" alt="" class="advisertx">
  94. <view class="adviserNema">{{managerInfo.name}}</view>
  95. <view class="adviserms" :style="{border:'1px solid #'+themeColor,color:'#'+themeColor}">服务顾问</view>
  96. </view>
  97. <img src="../../static/timg/icon_arrow_right.png" alt="" class="adviserJt">
  98. </view>
  99. </view>
  100. <!-- 中间功能应用模块 -->
  101. <view class="modular" v-if="homeCardList.application.length>0">
  102. <view class="swiper-item">
  103. <view class="itemLine" @click="goRoter(item)" v-for="(item,index) in homeCardList.application">
  104. <view><img :src="item.icon" alt="" class="itemImg"></view>
  105. <view class="Menusline">{{item.name}}</view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="advertisement" v-if="homeCardList.ad1.length>0">
  110. <swiper class="swiper2" circular :autoplay="true" :interval="interval"
  111. :duration="duration" :indicator-dots="true" indicator-color="#CCCCCC" :indicator-active-color="'#'+themeColor">
  112. <swiper-item v-for="(item,index) in homeCardList.ad1">
  113. <view class="swiper-item2" @click="goRoter(item)">
  114. <image class="swiper-item2Img" :src="item.icon" mode=""></image>
  115. </view>
  116. </swiper-item>
  117. </swiper>
  118. </view>
  119. <view class="advertisement" v-if="homeCardList.ad2.length>0">
  120. <swiper class="swiper2" circular :autoplay="true" :interval="interval"
  121. :duration="duration" :indicator-dots="true" indicator-color="#CCCCCC" :indicator-active-color="'#'+themeColor">
  122. <swiper-item v-for="(item,index) in homeCardList.ad2">
  123. <view class="swiper-item2" @click="goRoter(item)">
  124. <image class="swiper-item2Img" :src="item.icon" mode=""></image>
  125. </view>
  126. </swiper-item>
  127. </swiper>
  128. </view>
  129. <view class="advertisement" v-if="homeCardList.ad3.length>0">
  130. <swiper class="swiper2" circular :autoplay="true" :interval="interval"
  131. :duration="duration" :indicator-dots="true" indicator-color="#CCCCCC" :indicator-active-color="'#'+themeColor">
  132. <swiper-item v-for="(item,index) in homeCardList.ad3">
  133. <view class="swiper-item2" @click="goRoter(item)">
  134. <image class="swiper-item2Img" :src="item.icon" mode=""></image>
  135. </view>
  136. </swiper-item>
  137. </swiper>
  138. </view>
  139. <!-- 热门活动 -->
  140. <view v-if="homeCardList.openMActivity">
  141. <view class="Hot" v-if="homeCardList.openMActivity.openCollectingList.length>0">
  142. <view class="hotTop">
  143. <view class="hotLeft">
  144. <view class="hotSx" :style="{background:'#'+themeColor}"></view>
  145. <view class="hottitle">热门活动</view>
  146. </view>
  147. <view class="hotRight" @click="moreJk">
  148. <view class="hotMore">更多</view>
  149. <img src="../../static/timg/icon_arrow_right.png" alt="" class="hotMoreJt">
  150. </view>
  151. </view>
  152. <view class="hotLine" @click="goJk(item)" v-for="(item,index) in homeCardList.openMActivity.openCollectingList" v-if="index<homeCardList.openMActivity.showCount">
  153. <view class="hotLineTop">
  154. <image class="hotLineTopImg" :src="item.img" mode=""></image>
  155. <view class="hotlineTimebox">
  156. <!-- <view class="hotlinestate1" v-if="item.state==2">进行中</view>
  157. <view class="hotlinestate2" v-if="item.state==1">未开始</view> -->
  158. <image class="jkStateImg" v-if="item.state==2" src="../../static/img/bg_huangse.png" mode="" ></image>
  159. <image class="jkStateImg" v-if="item.state==1" src="../../static/img/bg_hongse.png" mode="" ></image>
  160. <view class="hotTime">{{item.startTime.slice(0,10)}}-{{item.endTime.slice(0,10)}}</view>
  161. </view>
  162. </view>
  163. <view class="hotName">{{item.activityName}}</view>
  164. </view>
  165. </view>
  166. </view>
  167. <!-- 热门车型 -->
  168. <view v-if="homeCardList.openMGoods">
  169. <view class="" v-if="homeCardList.openMGoods.length>0">
  170. <view class="Hot" v-if="homeCardList.openMGoods.showType==1">
  171. <view class="hotTop">
  172. <view class="hotLeft">
  173. <view class="hotSx" :style="{background:'#'+themeColor}"></view>
  174. <view class="hottitle">热门商品</view>
  175. </view>
  176. <view class="hotRight" @click="goShop">
  177. <view class="hotMore">更多</view>
  178. <img src="../../static/timg/icon_arrow_right.png" alt="" class="hotMoreJt">
  179. </view>
  180. </view>
  181. <view class="hotGoodsLine" v-for="(item,index) in homeCardList.openMGoods.goodsList" @click="goGoods(item)" v-if="index<homeCardList.openMGoods.showCount">
  182. <view>
  183. <image :src="item.url" mode="" class="hotGoodsLineImg"></image>
  184. </view>
  185. <view class="hotGoodsLineRIght">
  186. <view class="goodsName">{{item.name}}</view>
  187. <view class="Sold">
  188. <view v-if="item.showLabel&&item.showLabel.indexOf('3')!=-1">
  189. 已售 {{item.saleQty>0?item.saleQty:0}}
  190. </view>
  191. </view>
  192. <view class="goodsPrice">
  193. <view class="goodsPrice1" >{{item.saleLabel}}</view><!-- :style="{color:'#'+themeColor}" -->
  194. <view class="goodsPrice2" >¥</view>
  195. <view class="goodsPrice3" >{{item.salePrice}}
  196. <span v-if="item.categoryIds=='7B97D114-C419-42B2-9C1E-0B4CA284CDA0'">万</span>
  197. </view>
  198. <view class="goodsPrice4" v-if="item.showLabel&&item.scribingPrice&&item.showLabel.indexOf('1')!=-1">¥{{item.scribingPrice}}</view>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. <view style="height: 60rpx;"></view>
  206. <!-- 手机号授权 -->
  207. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  208. <view class="authorizCont" @click.stop="">
  209. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  210. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  211. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  212. </view>
  213. <view style="text-align: center;padding-top: 56rpx;">
  214. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  215. </view>
  216. </view>
  217. <!-- <view @getphonenumber="decryptPhoneNumber" >shopId:{{shopId}}</view>
  218. -->
  219. </view>
  220. </template>
  221. <script>
  222. export default {
  223. data() {
  224. return {
  225. shopId: '',
  226. url:'',
  227. wxOpenData:'',
  228. code:'',
  229. carInfo:'',
  230. homeCardList:'',
  231. authorizShow:false,
  232. miniAppName:'',
  233. iStatusBarHeight:'',
  234. managerInfo:'',
  235. unionId:'',
  236. ext:'',
  237. duration:500,
  238. interval:3000,
  239. InsuranceExpireDate:'',
  240. NextCareDate:'',
  241. NextAuditDate:'',
  242. themeColor:'',
  243. getwxLoing:false,
  244. }
  245. },
  246. onLoad() {
  247. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  248. var that=this;
  249. //this.$common.getExtStoreId()
  250. var ext=this.$common.getExtStoreId();
  251. this.ext=ext
  252. console.log(ext)
  253. //console.log( String(Date.now()))
  254. this.shopId=ext.shopId;
  255. this.url=ext.url;
  256. this.unionId=ext.unionId
  257. //this.unionId="EF7981B9-2D1D-4006-9C0A-66CE7177134D"
  258. // uni.setStorage({
  259. // key: 'extdata',
  260. // data: {
  261. // shopId:'E37BB296-5A08-4534-859D-B351BA611AF9',
  262. // },
  263. // success: function () {
  264. // that.uniLogin()
  265. // }
  266. // });
  267. //this.userInfo = uni.getStorageSync("userInfo");
  268. this.userInfo=this.$store.state.userInfo
  269. if(this.userInfo){
  270. //this.wxOpenData = uni.getStorageSync("wxOpenData");
  271. this.getCarList();
  272. this.queryHomeCardList()
  273. this.queryManagerInfo()
  274. }else{
  275. this.uniLogin()
  276. }
  277. },
  278. onShow() {
  279. var indexaddcar = uni.getStorageSync("indexaddcar")
  280. if(indexaddcar==1){
  281. uni.removeStorageSync('indexaddcar');
  282. this.getCarList();
  283. }else{
  284. this.carInfo=this.$store.state.carInfo;
  285. this.jsTime()
  286. }
  287. },
  288. onPullDownRefresh(){
  289. this.getCarList();
  290. this.queryHomeCardList()
  291. this.queryManagerInfo()
  292. setTimeout(() => {
  293. uni.stopPullDownRefresh(); // 关闭下拉刷新
  294. }, 1000);
  295. },
  296. methods: {
  297. addCar(){
  298. if(!this.userInfo){
  299. this.authorizShow=true;
  300. }else{
  301. uni.navigateTo({
  302. url:'../user/addCar/addCar?type=1'
  303. })
  304. }
  305. },
  306. goShop(){
  307. uni.switchTab({
  308. url:'../shop/shop'
  309. })
  310. },
  311. moreJk(){
  312. uni.switchTab({
  313. url:'../activity/activity'
  314. })
  315. },
  316. information(){
  317. console.log('车辆信息--',this.carInfo);
  318. uni.navigateTo({
  319. url:'handbook?mileage='+this.carInfo.milage+'&liyangId='+this.carInfo.nLevelID
  320. })
  321. },
  322. changeCar(){
  323. uni.navigateTo({
  324. url:'../user/addCar/cailist'
  325. })
  326. },
  327. goMUsers(){
  328. if(!this.userInfo){
  329. this.authorizShow=true;
  330. }else{
  331. var managerInfo={
  332. name:this.managerInfo.name,
  333. shopInfo:{
  334. shopName:this.managerInfo.shopInfo.shopName,
  335. provinceName:this.managerInfo.shopInfo.provinceName,
  336. cityName:this.managerInfo.shopInfo.cityName,
  337. areaName:this.managerInfo.shopInfo.areaName,
  338. Address:this.managerInfo.shopInfo.Address,
  339. },
  340. avatar:this.managerInfo.avatar
  341. }
  342. uni.navigateTo({
  343. url:'../index/personalCard?adInfo='+JSON.stringify(managerInfo)
  344. })
  345. }
  346. },
  347. goGoods(item){
  348. if(!this.userInfo){
  349. this.authorizShow=true;
  350. }else{
  351. uni.navigateTo({
  352. url:'../shop/goodsDetail?id='+item.id
  353. })
  354. }
  355. },
  356. goJk(item){
  357. if(!this.userInfo){
  358. this.authorizShow=true;
  359. }else{
  360. uni.navigateTo({
  361. url:'../activity/jkDetail?id='+item.id
  362. })
  363. }
  364. },
  365. goRoter(item){
  366. console.log(item)
  367. if(!this.userInfo){
  368. this.authorizShow=true;
  369. }else{
  370. if(item.bizType==0){
  371. if(item.name=='新车'){ //
  372. uni.navigateTo({
  373. url:'newCar'
  374. })
  375. }else if(item.name=='二手车'){
  376. uni.navigateTo({
  377. url:'usedCar'
  378. })
  379. }else if(item.name=='爱车估价'){
  380. uni.navigateTo({
  381. url:'evaluation'
  382. })
  383. }
  384. else{
  385. uni.showToast({
  386. title: '敬请期待',
  387. icon:'none',
  388. duration: 3000
  389. });
  390. }
  391. }else if(item.bizType==1){ //紧急救援
  392. uni.navigateTo({
  393. url:'rescue'
  394. })
  395. }else if(item.bizType==2){ //钣金喷漆
  396. uni.navigateTo({
  397. url:'paint'
  398. })
  399. }else if(item.bizType==3){ //保养
  400. uni.navigateTo({
  401. url:'maintain'
  402. })
  403. }else if(item.bizType==4){ //在线预约
  404. uni.navigateTo({
  405. url:'onlineBooking?naShopId='+item.naShopId
  406. })
  407. }else if(item.bizType==5){ //导航
  408. this.getShopinfo(5,item.reShopId)
  409. }else if(item.bizType==6){ //联系本店
  410. this.getShopinfo(6,item.orShopId)
  411. }else if(item.bizType==7){ //7门店列表
  412. uni.navigateTo({
  413. url:'shopList'
  414. })
  415. }else if(item.bizType==8){ //我的会员卡
  416. uni.navigateTo({
  417. url:'vipCard'
  418. })
  419. }else if(item.bizType==9){ //我的优惠券
  420. uni.navigateTo({
  421. url:'discountCard'
  422. })
  423. }else if(item.bizType==10){ //我的订单
  424. uni.navigateTo({
  425. url:'../user/myOrder/myOrder'
  426. })
  427. }else if(item.bizType==11){ //我的预约
  428. uni.navigateTo({
  429. url:'../user/myBespeak'
  430. })
  431. }else if(item.bizType==12){ //历史消费
  432. uni.navigateTo({
  433. url:'../user/historySpend'
  434. })
  435. }else if(item.bizType==12){ //历史消费
  436. uni.navigateTo({
  437. url:'../user/historySpend'
  438. })
  439. }else if(item.bizType==13){ //车检报告
  440. uni.navigateTo({
  441. url:'../user/checkReport'
  442. })
  443. }else if(item.bizType==14){ //指定商品分类
  444. uni.setStorage({
  445. key: 'shopcategoryID',
  446. data: item.bizId,
  447. success: function () {
  448. getApp().globalData.shopcategoryID=item.bizId;
  449. uni.switchTab({
  450. url:'../shop/shop?shopcategoryID='+ item.bizId
  451. })
  452. }
  453. });
  454. }else if(item.bizType==15){ //商品详情
  455. uni.navigateTo({
  456. url:'../shop/goodsDetail?id='+item.bizId
  457. })
  458. }
  459. // uni.navigateTo({
  460. // url:url
  461. // })
  462. }
  463. },
  464. decryptPhoneNumber: function(e) {
  465. console.log(e);
  466. this.code=e.detail.code
  467. this.wxPhoneLogin()
  468. this.authorizShow=false;
  469. },
  470. wxgologin(){
  471. var that=this;
  472. uni.getUserProfile({
  473. lang:'zh_CN',
  474. desc:'登录',
  475. success:(res)=>{
  476. console.log(res);
  477. that.wxdata=res;
  478. uni.setStorage({
  479. key: 'wxdata',
  480. data: res,
  481. success: function () {
  482. that.uniLogin()
  483. }
  484. });
  485. },
  486. fail:(res)=>{
  487. console.log(res)
  488. }
  489. });
  490. },
  491. uniLogin(){
  492. var that=this;
  493. uni.login({
  494. provider: 'weixin',
  495. success: function (loginRes) {
  496. console.log(loginRes);
  497. that.getWxOpenID(loginRes)
  498. }
  499. });
  500. },
  501. getWxOpenID(e){
  502. var that=this;
  503. uni.showLoading({
  504. title: '加载中'
  505. })
  506. this.$http('miniApp2/sys/getWxOpenID', {
  507. code:e.code,
  508. unionId:this.unionId
  509. },'GET').then(res => {
  510. if(res.code!=0){
  511. uni.hideLoading();
  512. uni.showToast({
  513. title: res.msg,
  514. icon: 'none',
  515. duration: 3000
  516. });
  517. }
  518. this.wxOpenData=res.data;
  519. this.themeColor=res.data.themeColor
  520. //this.themeColor='FFFFFF'
  521. this.getwxLoing=true;
  522. uni.setNavigationBarTitle({
  523. title:this.wxOpenData.miniAppName
  524. })
  525. if(this.themeColor=='6F2BE8'){
  526. var backgroundImage='/static/tabimg/index6F2BE8.png'
  527. }
  528. if(this.themeColor=='1677FF'){
  529. var backgroundImage='/static/tabimg/index1677FF.png'
  530. }
  531. if(this.themeColor=='FF4F00'){
  532. var backgroundImage='/static/tabimg/indexFF4F00.png'
  533. }
  534. if(this.themeColor=='D53533'){
  535. var backgroundImage='/static/tabimg/index1.png'
  536. }
  537. uni.setTabBarStyle({
  538. // color: '#FF0000',
  539. selectedColor: '#'+this.themeColor,
  540. })
  541. uni.setTabBarItem({
  542. index: 0,
  543. text: '首页',
  544. selectedIconPath: backgroundImage
  545. })
  546. that.queryHomeCardList()
  547. //that.wxPhoneLogin()
  548. this.$store.commit('mutationswxOpenData', that.wxOpenData)
  549. uni.setStorage({
  550. key: 'wxOpenData',
  551. data: that.wxOpenData,
  552. success: function () {
  553. // that.uniLogin()
  554. }
  555. });
  556. uni.setStorage({
  557. key: 'themeColor',
  558. data: that.themeColor,
  559. success: function () {
  560. // that.uniLogin()
  561. }
  562. });
  563. if(this.wxOpenData.loginInfo){
  564. this.$store.commit('mutationsuserInfo', that.wxOpenData.loginInfo.openUser)
  565. this.userInfo=that.wxOpenData.loginInfo.openUser
  566. that.queryManagerInfo()
  567. uni.setStorage({
  568. key: 'userInfo',
  569. data: that.wxOpenData.loginInfo.openUser,
  570. success: function () {
  571. that.getCarList()
  572. }
  573. });
  574. }else{
  575. this.authorizShow=true;
  576. }
  577. })
  578. },
  579. wxPhoneLogin(){
  580. var that=this;
  581. this.$http('miniApp2/sys/wxPhoneLogin', {
  582. appId:this.ext.appId,
  583. unionId:this.unionId,
  584. code:this.code,
  585. openId:this.wxOpenData.openid
  586. },'POST').then(res => {
  587. var data = res.data;
  588. if(data.loginInfo){
  589. this.userInfo=data.loginInfo.openUser;
  590. this.$store.commit('mutationsuserInfo', this.userInfo);
  591. this.$store.commit('mutationswxOpenData', data.loginInfo)
  592. uni.setStorage({
  593. key: 'userInfo',
  594. data: data.loginInfo.openUser,
  595. success: function () {
  596. that.getCarList()
  597. that.queryHomeCardList()
  598. that.queryManagerInfo()
  599. }
  600. });
  601. }
  602. })
  603. },
  604. getCarList(){
  605. this.$http('opencarOwnerHome/queryCarInfoList', {
  606. },'GET').then(res => {
  607. if(res.code==401){
  608. this.uniLogin()
  609. }else{
  610. this.carInfo=res.data[0]
  611. this.$store.commit('mutationscarInfo', this.carInfo)
  612. /* this.carInfo.insuranceExpireDate='2022-11-11';
  613. this.carInfo.nextAuditDate='2022-08-13'; */
  614. //this.carInfo.nextCareDate='2022-08-11';
  615. //this.carInfo.nextCareMilage=11
  616. this.jsTime()
  617. }
  618. })
  619. },
  620. jsTime(){
  621. if(this.carInfo.insuranceExpireDate){
  622. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.insuranceExpireDate.replace(/-/g, '/')).getTime()) || 0)) {
  623. console.log("现在时间大于开始时间")
  624. this.InsuranceExpireDate = 0
  625. } else {
  626. this.clock()
  627. }
  628. }else{
  629. this.InsuranceExpireDate=''
  630. }
  631. if(this.carInfo.nextCareDate){
  632. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextCareDate.replace(/-/g, '/')).getTime()) || 0)) {
  633. this.NextCareDate = 0
  634. } else {
  635. this.clock2()
  636. }
  637. }else{
  638. this.NextCareDate = ''
  639. }
  640. if(this.carInfo.nextAuditDate){
  641. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextAuditDate.replace(/-/g, '/')).getTime()) || 0)) {
  642. this.NextAuditDate = 0
  643. } else {
  644. this.clock3()
  645. }
  646. }else{
  647. this.NextAuditDate=''
  648. }
  649. },
  650. clock () {
  651. let _this = this
  652. let today = new Date() // 当前时间
  653. let h = today.getHours()
  654. let m = today.getMinutes()
  655. let s = today.getSeconds()
  656. let stopTime = new Date(_this.carInfo.insuranceExpireDate.replace(/-/g, '/')) // 结束时间
  657. let stopH = stopTime.getHours()
  658. let stopM = stopTime.getMinutes()
  659. let stopS = stopTime.getSeconds()
  660. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  661. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  662. this.InsuranceExpireDate=shengyuD+1;
  663. // setTimeout(_this.clock, 500)
  664. },
  665. clock2 () {
  666. let _this = this
  667. let today = new Date() // 当前时间
  668. let stopTime = new Date(_this.carInfo.nextCareDate.replace(/-/g, '/')) // 结束时间
  669. let stopH = stopTime.getHours()
  670. let stopM = stopTime.getMinutes()
  671. let stopS = stopTime.getSeconds()
  672. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  673. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  674. this.NextCareDate=shengyuD+1;
  675. // setTimeout(_this.clock, 500)
  676. },
  677. clock3 () {
  678. let _this = this
  679. let today = new Date() // 当前时间
  680. let stopTime = new Date(_this.carInfo.nextAuditDate.replace(/-/g, '/')) // 结束时间
  681. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  682. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  683. this.NextAuditDate=shengyuD+1;
  684. // setTimeout(_this.clock, 500)
  685. },
  686. queryManagerInfo(){
  687. console.log("11")
  688. this.$http('openHome/queryManagerInfo', {
  689. },'GET').then(res => {
  690. this.managerInfo=res.data
  691. })
  692. },
  693. queryHomeCardList(){
  694. //console.log(this.wxOpenData)
  695. uni.showLoading({
  696. title: '加载中'
  697. })
  698. this.$http('openHome/queryHomeCardList', {
  699. unionId:this.unionId
  700. },'GET').then(res => {
  701. uni.hideLoading();
  702. this.homeCardList=res.data
  703. })
  704. },
  705. getShopinfo(num,shopId){
  706. var that=this;
  707. uni.showLoading({
  708. title: '加载中'
  709. })
  710. if(!shopId){
  711. shopId=''
  712. }
  713. this.$http('openmy/getShopinfo', {
  714. shopId:shopId
  715. },'GET').then(res => {
  716. uni.hideLoading();
  717. var res=res.data
  718. if(num==5){
  719. uni.openLocation({
  720. latitude:Number(res.lat),
  721. longitude:Number(res.lng),
  722. name: res.shopName,
  723. address: res.address,
  724. success: function() {
  725. console.log('success');
  726. },
  727. fail(err) {
  728. console.log(err)
  729. }
  730. });
  731. }else{
  732. uni.makePhoneCall({
  733. phoneNumber: res.contactorPhone
  734. });
  735. }
  736. })
  737. }
  738. }
  739. }
  740. </script>
  741. <style scoped>
  742. .bxBox{
  743. display: flex;
  744. flex-wrap: wrap;
  745. }
  746. .bxline{
  747. display: flex;
  748. padding-top: 22rpx;
  749. }
  750. .bxline1{
  751. width: 40%;
  752. }
  753. .bxline2{
  754. width: 60%;
  755. }
  756. .bxlineTitle{
  757. color: #333333;
  758. font-size: 26rpx;
  759. line-height: 37rpx;
  760. padding-left: 10rpx;
  761. }
  762. .bxlineMs1{
  763. line-height: 37rpx;
  764. color: #D53533;
  765. font-size: 26rpx;
  766. padding-left: 12rpx;
  767. }
  768. .bxlineMs2{
  769. line-height: 37rpx;
  770. color: #999999;
  771. font-size: 24rpx;
  772. padding-left: 12rpx;
  773. }
  774. .bxlineIcon{
  775. width: 34rpx;
  776. height: 34rpx;
  777. margin-left: 24rpx;
  778. }
  779. .indexTop{
  780. background: #D53533;
  781. width: 750rpx;
  782. position: fixed;
  783. top: 0;
  784. left: 0;
  785. z-index: 11;
  786. }
  787. .indexnav{
  788. height: 44px;
  789. line-height: 44px;
  790. text-align: center;
  791. font-size: 36rpx;
  792. color: #FFFFFF;
  793. }
  794. .authorizBox{
  795. width: 100vw;
  796. height: 100vh;
  797. background: rgba(0, 0, 0, 0.5);
  798. position: fixed;
  799. top: 0;
  800. left: 0;
  801. }
  802. .authorizCont{
  803. margin-top: 30vh;
  804. width: 564rpx;
  805. height: 408rpx;
  806. background: #FFFFFF;
  807. border-radius: 24rpx;
  808. margin-left: 93rpx;
  809. position: relative;
  810. }
  811. .authorizCloseImg{
  812. width: 62rpx;
  813. height: 62rpx;
  814. }
  815. .sqLogoBox{
  816. width: 180rpx;
  817. height: 180rpx;
  818. background: #FFFFFF;
  819. border-radius: 90rpx;
  820. text-align: center;
  821. position: absolute;
  822. top: -50rpx;
  823. left: 192rpx;
  824. }
  825. .authorizName{
  826. color: #333333;
  827. line-height: 42rpx;
  828. font-size: 30rpx;
  829. text-align: center;
  830. padding-top: 58rpx;
  831. }
  832. .authorizMs{
  833. color: #999999;
  834. line-height: 36rpx;
  835. font-size: 26rpx;
  836. width: 452rpx;
  837. padding-top: 24rpx;
  838. text-align: center;
  839. margin-left: 56rpx;
  840. }
  841. .authorizContbutton{
  842. width: 422rpx;
  843. height: 88rpx;
  844. background: #D53533;
  845. border-radius: 44rpx;
  846. line-height: 88rpx;
  847. text-align: center;
  848. font-size:30rpx;
  849. color: #FFFFFF;
  850. margin-top: 62rpx;
  851. margin-left:71rpx;
  852. }
  853. .content{
  854. min-height: 100vh;
  855. background: #F4F5F7;
  856. }
  857. .topBox{
  858. width: 750rpx;
  859. height: 150rpx;
  860. background: #D53533;
  861. }
  862. .yuanhu{
  863. width: 750rpx;
  864. height: 50rpx;
  865. background: #D53533;
  866. border-radius: 0 0 100% 100%;
  867. }
  868. .carinfoBox{
  869. width: 702rpx;
  870. /* height: 250rpx; */
  871. background: #FFFFFF;
  872. border-radius: 10rpx;
  873. margin-left: 24rpx;
  874. overflow: hidden;
  875. height: 270rpx;
  876. }
  877. .carinfoBox2{
  878. width: 702rpx;
  879. height: 180rpx;
  880. background: #FFFFFF;
  881. border-radius: 10rpx;
  882. margin-left: 24rpx;
  883. overflow: hidden;
  884. }
  885. .carinfoBox2{
  886. }
  887. .carinfoBox .carLogo{
  888. width: 60rpx;height: 60rpx;
  889. margin-top: 6rpx;
  890. }
  891. .carinfoBoxTop{
  892. display: flex;
  893. justify-content: space-between;
  894. padding-top: 29rpx;
  895. padding-left: 24rpx;
  896. padding-right: 20rpx;
  897. padding-bottom: 24rpx;
  898. border: 1px solid #EEEEEE;
  899. }
  900. .carinfoBoxTopCont{
  901. width: 454rpx;
  902. }
  903. .carinfoBoxTopContTop{
  904. display: flex;
  905. }
  906. .carInfoplateNumber{
  907. font-weight: 500;
  908. color: #3C3C3C;
  909. font-size: 30rpx;
  910. line-height: 42rpx;
  911. padding-right: 16rpx;
  912. }
  913. .carTnfomilage{
  914. color: #F19D01;
  915. font-size: 22rpx;
  916. padding: 0rpx 10rpx;
  917. border-radius: 4rpx;
  918. border: 1px solid #F19D01;
  919. height: 32rpx;
  920. line-height: 34rpx;
  921. margin-top: 2rpx;
  922. margin-left: 2rpx;
  923. }
  924. .carInfocarModel{
  925. width: 454rpx;
  926. color: #666666;
  927. font-size: 26rpx;
  928. white-space: nowrap;
  929. overflow: hidden;
  930. text-overflow: ellipsis;
  931. }
  932. .carinfoBoxTopRight{
  933. display: flex;padding-top: 25rpx;
  934. }
  935. .carinfoBoxTopRightIcon{
  936. width: 29rpx;
  937. height: 31rpx;
  938. }
  939. .huancheBtn{
  940. color: #666666; font-size: 26rpx;line-height: 31rpx;
  941. padding-left: 10rpx;
  942. }
  943. .carInfoBottom{
  944. display: flex;
  945. justify-content: space-around;
  946. }
  947. .carInfoBottomLineTitle{
  948. color: #999999;font-size: 24rpx;
  949. text-align: center;
  950. padding-top: 24rpx;
  951. }
  952. .carInfoBottomLineTxt{
  953. color: #3C3C3C;
  954. font-size: 26rpx;
  955. padding-top: 5rpx;
  956. text-align: center;
  957. }
  958. .carinfonocarIcon{
  959. width: 72rpx;
  960. height: 72rpx;
  961. }
  962. .carinfoBoxNocar{
  963. display: flex;
  964. padding-top: 50rpx;
  965. padding-left: 20rpx;
  966. }
  967. .carinfoBoxNocarRightTitle{
  968. font-weight: 500;
  969. color: #3C3C3C;
  970. font-size: 30rpx;
  971. }
  972. .carinfoBoxNocarRightMS{
  973. color: #666666;
  974. font-size: 26rpx;
  975. }
  976. .carinfoBoxNocarRight{
  977. padding-left: 24rpx;
  978. }
  979. .shoptopbox{
  980. margin-top: -170rpx;
  981. }
  982. .shoptopbox2{
  983. margin-top: -170rpx;
  984. }
  985. .adviser{
  986. width: 662rpx;
  987. margin-left: 24rpx;
  988. background: #FFFFFF;
  989. border-radius: 10px;
  990. display: flex;
  991. justify-content: space-between;
  992. padding: 18rpx 20rpx;
  993. margin-top: 20rpx;
  994. }
  995. .adviserLeft{
  996. display: flex;
  997. }
  998. .advisertx{
  999. width: 62rpx;height: 62rpx;
  1000. }
  1001. .adviserNema{
  1002. color: #333333;font-size: 30rpx;
  1003. line-height: 62rpx;padding-left: 24rpx;
  1004. }
  1005. .adviserms{
  1006. width: 118rpx;
  1007. height: 36rpx;
  1008. border-radius: 4rpx;
  1009. border: 1px solid #D53533;
  1010. line-height: 36rpx;
  1011. text-align: center;
  1012. margin-top: 12rpx;
  1013. margin-left: 20rpx;
  1014. color: #D53533;
  1015. font-size: 24rpx;
  1016. }
  1017. .adviserJt{
  1018. width: 12rpx;
  1019. height: 20rpx;
  1020. margin-top: 20rpx;
  1021. }
  1022. .modular{
  1023. width: 702rpx;
  1024. /* height: 313rpx; */
  1025. background: #FFFFFF;
  1026. border-radius: 10px;
  1027. margin-top: 20rpx;
  1028. margin-left: 24rpx;
  1029. padding-bottom: 40rpx;
  1030. }
  1031. .swiper-item{
  1032. display: flex;
  1033. flex-wrap: wrap;
  1034. }
  1035. .itemImg{
  1036. width: 46rpx;
  1037. height: 46rpx;
  1038. }
  1039. .Menusline{
  1040. font-size: 24rpx;
  1041. color: #333333;
  1042. }
  1043. .itemLine{
  1044. width: 20%;
  1045. text-align: center;
  1046. padding-top: 40rpx;
  1047. }
  1048. .advertisement{
  1049. width: 702rpx;
  1050. height: 280rpx;
  1051. margin-top: 20rpx;
  1052. margin-left: 24rpx;
  1053. border-radius: 20rpx;
  1054. }
  1055. .swiper-item2{
  1056. width: 702rpx;
  1057. height: 280px;
  1058. }
  1059. .swiper-item2Img{
  1060. width: 702rpx;
  1061. height: 280rpx;
  1062. }
  1063. .hotMoreJt{
  1064. width: 12rpx;
  1065. height: 20rpx;
  1066. margin-top: 6rpx;
  1067. }
  1068. .Hot{
  1069. width: 702rpx;
  1070. margin-top: 20rpx;
  1071. margin-left: 24rpx;
  1072. }
  1073. .hotTop{
  1074. display: flex;
  1075. justify-content: space-between;
  1076. padding: 6rpx 0;
  1077. }
  1078. .hotSx{
  1079. width: 8rpx;
  1080. height: 30rpx;
  1081. background: #FF0000;
  1082. border-radius: 5rpx;
  1083. }
  1084. .hotLeft{
  1085. display: flex;
  1086. }
  1087. .hottitle{
  1088. font-weight: 500;
  1089. color: #333333;
  1090. font-size: 30rpx;
  1091. line-height: 30rpx;
  1092. margin-left: 16rpx;
  1093. }
  1094. .hotRight{
  1095. display: flex;
  1096. }
  1097. .hotMore{
  1098. line-height: 30rpx;color: #666666;font-size: 24rpx;
  1099. margin-right: 16rpx;
  1100. }
  1101. .hotLineTopImg{
  1102. width: 702rpx;
  1103. height: 280rpx;
  1104. display: block;
  1105. }
  1106. .hotLineTop{
  1107. position: relative;
  1108. height: 280rpx;
  1109. }
  1110. .hotLine{
  1111. margin-top: 20rpx;
  1112. border-radius: 10rpx;
  1113. background: #FFFFFF;
  1114. overflow: hidden;
  1115. }
  1116. .hotlinestate1{
  1117. width: 102rpx;
  1118. height: 44rpx;
  1119. background:#FBBF00 ;
  1120. line-height: 44rpx;
  1121. font-weight: 500;
  1122. color: #333333;
  1123. font-size: 24rpx;
  1124. text-align: center;
  1125. }
  1126. .hotlinestate2{
  1127. width: 102rpx;
  1128. height: 44rpx;
  1129. background:#FF0000 ;
  1130. line-height: 44rpx;
  1131. font-weight: 500;
  1132. color: #FFFFFF;
  1133. font-size: 24rpx;
  1134. text-align: center;
  1135. }
  1136. .hotlineTimebox{
  1137. position: absolute;
  1138. left: 0;
  1139. bottom: 0;
  1140. display: flex;
  1141. align-items: flex-end;
  1142. }
  1143. .hotTime{
  1144. background: rgba(0, 0, 0, 0.5);
  1145. font-weight: 400;
  1146. color: #FFFFFF;
  1147. font-size: 24rpx;
  1148. /* line-height: 44rpx; */
  1149. padding: 5rpx 20rpx;
  1150. margin-top: 9rpx;
  1151. margin-left: -8rpx;
  1152. border-radius: 0px 10rpx 0px 0px;
  1153. }
  1154. .hotName{
  1155. padding: 24rpx 20rpx;
  1156. color: #333333;
  1157. line-height: 40rpx;
  1158. font-size: 28rpx;
  1159. }
  1160. .hotGoodsLine{
  1161. margin-top: 30rpx;
  1162. padding: 20rpx;
  1163. background: #FFFFFF;
  1164. border-radius: 16rpx;
  1165. display: flex;
  1166. }
  1167. .hotGoodsLineImg{
  1168. width: 208rpx;
  1169. height: 194rpx;
  1170. border-radius: 16rpx;
  1171. border: 1px solid #EEEEEE;
  1172. display: block;
  1173. }
  1174. .goodsName{
  1175. font-size: 28rpx;
  1176. font-family: PingFangSC-Regular, PingFang SC;
  1177. font-weight: 400;
  1178. color: #333333;
  1179. line-height: 40rpx;
  1180. text-overflow: -o-ellipsis-lastline;
  1181. overflow: hidden;
  1182. text-overflow: ellipsis;
  1183. display: -webkit-box;
  1184. -webkit-line-clamp: 2;
  1185. line-clamp: 2;
  1186. -webkit-box-orient: vertical;
  1187. }
  1188. .hotGoodsLineRIght{
  1189. padding-left: 24rpx;
  1190. }
  1191. .goodsPrice{
  1192. display: flex;
  1193. padding-top: 10rpx;
  1194. }
  1195. .goodsPrice1{
  1196. font-size: 24rpx;
  1197. font-weight: 400;
  1198. color: #FF0000;
  1199. padding-top: 8rpx;
  1200. }
  1201. .goodsPrice2{
  1202. font-size: 22rpx;
  1203. font-weight: 400;
  1204. color: #FF0000;
  1205. padding-top: 10rpx;
  1206. }
  1207. .goodsPrice3{
  1208. font-size: 32rpx;
  1209. font-weight: 500;
  1210. color: #FF0000;
  1211. }
  1212. .goodsPrice4{
  1213. font-size: 24rpx;
  1214. font-weight: 400;
  1215. color: #999999;
  1216. padding-top: 8rpx;
  1217. padding-left: 10rpx;
  1218. text-decoration:line-through;
  1219. }
  1220. .Sold{
  1221. font-weight: 400;
  1222. color: #999999;
  1223. font-size: 24rpx;
  1224. padding-top: 8rpx;
  1225. }
  1226. .jkStateImg{
  1227. width: 102rpx;
  1228. height: 53rpx;
  1229. position: relative;
  1230. }
  1231. </style>