index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  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. }else if(item.bizType==16){ //积分商城
  459. uni.navigateTo({
  460. url:'../integral/integral'
  461. })
  462. }
  463. // uni.navigateTo({
  464. // url:url
  465. // })
  466. }
  467. },
  468. decryptPhoneNumber: function(e) {
  469. console.log(e);
  470. this.code=e.detail.code
  471. this.wxPhoneLogin()
  472. this.authorizShow=false;
  473. },
  474. wxgologin(){
  475. var that=this;
  476. uni.getUserProfile({
  477. lang:'zh_CN',
  478. desc:'登录',
  479. success:(res)=>{
  480. console.log(res);
  481. that.wxdata=res;
  482. uni.setStorage({
  483. key: 'wxdata',
  484. data: res,
  485. success: function () {
  486. that.uniLogin()
  487. }
  488. });
  489. },
  490. fail:(res)=>{
  491. console.log(res)
  492. }
  493. });
  494. },
  495. uniLogin(){
  496. var that=this;
  497. uni.login({
  498. provider: 'weixin',
  499. success: function (loginRes) {
  500. console.log(loginRes);
  501. that.getWxOpenID(loginRes)
  502. }
  503. });
  504. },
  505. getWxOpenID(e){
  506. var that=this;
  507. uni.showLoading({
  508. title: '加载中'
  509. })
  510. this.$http('miniApp2/sys/getWxOpenID', {
  511. code:e.code,
  512. unionId:this.unionId
  513. },'GET').then(res => {
  514. if(res.code!=0){
  515. uni.hideLoading();
  516. uni.showToast({
  517. title: res.msg,
  518. icon: 'none',
  519. duration: 3000
  520. });
  521. }
  522. this.wxOpenData=res.data;
  523. this.themeColor=res.data.themeColor
  524. //this.themeColor='FFFFFF'
  525. this.getwxLoing=true;
  526. uni.setNavigationBarTitle({
  527. title:this.wxOpenData.miniAppName
  528. })
  529. if(this.themeColor=='6F2BE8'){
  530. var backgroundImage='/static/tabimg/index6F2BE8.png'
  531. }
  532. if(this.themeColor=='1677FF'){
  533. var backgroundImage='/static/tabimg/index1677FF.png'
  534. }
  535. if(this.themeColor=='FF4F00'){
  536. var backgroundImage='/static/tabimg/indexFF4F00.png'
  537. }
  538. if(this.themeColor=='D53533'){
  539. var backgroundImage='/static/tabimg/index1.png'
  540. }
  541. uni.setTabBarStyle({
  542. // color: '#FF0000',
  543. selectedColor: '#'+this.themeColor,
  544. })
  545. uni.setTabBarItem({
  546. index: 0,
  547. text: '首页',
  548. selectedIconPath: backgroundImage
  549. })
  550. that.queryHomeCardList()
  551. //that.wxPhoneLogin()
  552. this.$store.commit('mutationswxOpenData', that.wxOpenData)
  553. uni.setStorage({
  554. key: 'wxOpenData',
  555. data: that.wxOpenData,
  556. success: function () {
  557. // that.uniLogin()
  558. }
  559. });
  560. uni.setStorage({
  561. key: 'themeColor',
  562. data: that.themeColor,
  563. success: function () {
  564. // that.uniLogin()
  565. }
  566. });
  567. if(this.wxOpenData.loginInfo){
  568. this.$store.commit('mutationsuserInfo', that.wxOpenData.loginInfo.openUser)
  569. this.userInfo=that.wxOpenData.loginInfo.openUser
  570. that.queryManagerInfo()
  571. uni.setStorage({
  572. key: 'userInfo',
  573. data: that.wxOpenData.loginInfo.openUser,
  574. success: function () {
  575. that.getCarList()
  576. }
  577. });
  578. }else{
  579. this.authorizShow=true;
  580. }
  581. })
  582. },
  583. wxPhoneLogin(){
  584. var that=this;
  585. this.$http('miniApp2/sys/wxPhoneLogin', {
  586. appId:this.ext.appId,
  587. unionId:this.unionId,
  588. code:this.code,
  589. openId:this.wxOpenData.openid
  590. },'POST').then(res => {
  591. var data = res.data;
  592. if(data.loginInfo){
  593. this.userInfo=data.loginInfo.openUser;
  594. this.$store.commit('mutationsuserInfo', this.userInfo);
  595. this.$store.commit('mutationswxOpenData', data.loginInfo)
  596. uni.setStorage({
  597. key: 'userInfo',
  598. data: data.loginInfo.openUser,
  599. success: function () {
  600. that.getCarList()
  601. that.queryHomeCardList()
  602. that.queryManagerInfo()
  603. }
  604. });
  605. }
  606. })
  607. },
  608. getCarList(){
  609. this.$http('opencarOwnerHome/queryCarInfoList', {
  610. },'GET').then(res => {
  611. if(res.code==401){
  612. this.uniLogin()
  613. }else{
  614. this.carInfo=res.data[0]
  615. this.$store.commit('mutationscarInfo', this.carInfo)
  616. /* this.carInfo.insuranceExpireDate='2022-11-11';
  617. this.carInfo.nextAuditDate='2022-08-13'; */
  618. //this.carInfo.nextCareDate='2022-08-11';
  619. //this.carInfo.nextCareMilage=11
  620. this.jsTime()
  621. }
  622. })
  623. },
  624. jsTime(){
  625. if(this.carInfo.insuranceExpireDate){
  626. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.insuranceExpireDate.replace(/-/g, '/')).getTime()) || 0)) {
  627. console.log("现在时间大于开始时间")
  628. this.InsuranceExpireDate = 0
  629. } else {
  630. this.clock()
  631. }
  632. }else{
  633. this.InsuranceExpireDate=''
  634. }
  635. if(this.carInfo.nextCareDate){
  636. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextCareDate.replace(/-/g, '/')).getTime()) || 0)) {
  637. this.NextCareDate = 0
  638. } else {
  639. this.clock2()
  640. }
  641. }else{
  642. this.NextCareDate = ''
  643. }
  644. if(this.carInfo.nextAuditDate){
  645. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextAuditDate.replace(/-/g, '/')).getTime()) || 0)) {
  646. this.NextAuditDate = 0
  647. } else {
  648. this.clock3()
  649. }
  650. }else{
  651. this.NextAuditDate=''
  652. }
  653. },
  654. clock () {
  655. let _this = this
  656. let today = new Date() // 当前时间
  657. let h = today.getHours()
  658. let m = today.getMinutes()
  659. let s = today.getSeconds()
  660. let stopTime = new Date(_this.carInfo.insuranceExpireDate.replace(/-/g, '/')) // 结束时间
  661. let stopH = stopTime.getHours()
  662. let stopM = stopTime.getMinutes()
  663. let stopS = stopTime.getSeconds()
  664. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  665. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  666. this.InsuranceExpireDate=shengyuD+1;
  667. // setTimeout(_this.clock, 500)
  668. },
  669. clock2 () {
  670. let _this = this
  671. let today = new Date() // 当前时间
  672. let stopTime = new Date(_this.carInfo.nextCareDate.replace(/-/g, '/')) // 结束时间
  673. let stopH = stopTime.getHours()
  674. let stopM = stopTime.getMinutes()
  675. let stopS = stopTime.getSeconds()
  676. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  677. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  678. this.NextCareDate=shengyuD+1;
  679. // setTimeout(_this.clock, 500)
  680. },
  681. clock3 () {
  682. let _this = this
  683. let today = new Date() // 当前时间
  684. let stopTime = new Date(_this.carInfo.nextAuditDate.replace(/-/g, '/')) // 结束时间
  685. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  686. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  687. this.NextAuditDate=shengyuD+1;
  688. // setTimeout(_this.clock, 500)
  689. },
  690. queryManagerInfo(){
  691. console.log("11")
  692. this.$http('openHome/queryManagerInfo', {
  693. },'GET').then(res => {
  694. this.managerInfo=res.data
  695. })
  696. },
  697. queryHomeCardList(){
  698. //console.log(this.wxOpenData)
  699. uni.showLoading({
  700. title: '加载中'
  701. })
  702. this.$http('openHome/queryHomeCardList', {
  703. unionId:this.unionId
  704. },'GET').then(res => {
  705. uni.hideLoading();
  706. this.homeCardList=res.data
  707. })
  708. },
  709. getShopinfo(num,shopId){
  710. var that=this;
  711. uni.showLoading({
  712. title: '加载中'
  713. })
  714. if(!shopId){
  715. shopId=''
  716. }
  717. this.$http('openmy/getShopinfo', {
  718. shopId:shopId
  719. },'GET').then(res => {
  720. uni.hideLoading();
  721. var res=res.data
  722. if(num==5){
  723. uni.openLocation({
  724. latitude:Number(res.lat),
  725. longitude:Number(res.lng),
  726. name: res.shopName,
  727. address: res.address,
  728. success: function() {
  729. console.log('success');
  730. },
  731. fail(err) {
  732. console.log(err)
  733. }
  734. });
  735. }else{
  736. uni.makePhoneCall({
  737. phoneNumber: res.contactorPhone
  738. });
  739. }
  740. })
  741. }
  742. }
  743. }
  744. </script>
  745. <style scoped>
  746. .bxBox{
  747. display: flex;
  748. flex-wrap: wrap;
  749. }
  750. .bxline{
  751. display: flex;
  752. padding-top: 22rpx;
  753. }
  754. .bxline1{
  755. width: 40%;
  756. }
  757. .bxline2{
  758. width: 60%;
  759. }
  760. .bxlineTitle{
  761. color: #333333;
  762. font-size: 26rpx;
  763. line-height: 37rpx;
  764. padding-left: 10rpx;
  765. }
  766. .bxlineMs1{
  767. line-height: 37rpx;
  768. color: #D53533;
  769. font-size: 26rpx;
  770. padding-left: 12rpx;
  771. }
  772. .bxlineMs2{
  773. line-height: 37rpx;
  774. color: #999999;
  775. font-size: 24rpx;
  776. padding-left: 12rpx;
  777. }
  778. .bxlineIcon{
  779. width: 34rpx;
  780. height: 34rpx;
  781. margin-left: 24rpx;
  782. }
  783. .indexTop{
  784. background: #D53533;
  785. width: 750rpx;
  786. position: fixed;
  787. top: 0;
  788. left: 0;
  789. z-index: 11;
  790. }
  791. .indexnav{
  792. height: 44px;
  793. line-height: 44px;
  794. text-align: center;
  795. font-size: 36rpx;
  796. color: #FFFFFF;
  797. }
  798. .authorizBox{
  799. width: 100vw;
  800. height: 100vh;
  801. background: rgba(0, 0, 0, 0.5);
  802. position: fixed;
  803. top: 0;
  804. left: 0;
  805. }
  806. .authorizCont{
  807. margin-top: 30vh;
  808. width: 564rpx;
  809. height: 408rpx;
  810. background: #FFFFFF;
  811. border-radius: 24rpx;
  812. margin-left: 93rpx;
  813. position: relative;
  814. }
  815. .authorizCloseImg{
  816. width: 62rpx;
  817. height: 62rpx;
  818. }
  819. .sqLogoBox{
  820. width: 180rpx;
  821. height: 180rpx;
  822. background: #FFFFFF;
  823. border-radius: 90rpx;
  824. text-align: center;
  825. position: absolute;
  826. top: -50rpx;
  827. left: 192rpx;
  828. }
  829. .authorizName{
  830. color: #333333;
  831. line-height: 42rpx;
  832. font-size: 30rpx;
  833. text-align: center;
  834. padding-top: 58rpx;
  835. }
  836. .authorizMs{
  837. color: #999999;
  838. line-height: 36rpx;
  839. font-size: 26rpx;
  840. width: 452rpx;
  841. padding-top: 24rpx;
  842. text-align: center;
  843. margin-left: 56rpx;
  844. }
  845. .authorizContbutton{
  846. width: 422rpx;
  847. height: 88rpx;
  848. background: #D53533;
  849. border-radius: 44rpx;
  850. line-height: 88rpx;
  851. text-align: center;
  852. font-size:30rpx;
  853. color: #FFFFFF;
  854. margin-top: 62rpx;
  855. margin-left:71rpx;
  856. }
  857. .content{
  858. min-height: 100vh;
  859. background: #F4F5F7;
  860. }
  861. .topBox{
  862. width: 750rpx;
  863. height: 150rpx;
  864. background: #D53533;
  865. }
  866. .yuanhu{
  867. width: 750rpx;
  868. height: 50rpx;
  869. background: #D53533;
  870. border-radius: 0 0 100% 100%;
  871. }
  872. .carinfoBox{
  873. width: 702rpx;
  874. /* height: 250rpx; */
  875. background: #FFFFFF;
  876. border-radius: 10rpx;
  877. margin-left: 24rpx;
  878. overflow: hidden;
  879. height: 270rpx;
  880. }
  881. .carinfoBox2{
  882. width: 702rpx;
  883. height: 180rpx;
  884. background: #FFFFFF;
  885. border-radius: 10rpx;
  886. margin-left: 24rpx;
  887. overflow: hidden;
  888. }
  889. .carinfoBox2{
  890. }
  891. .carinfoBox .carLogo{
  892. width: 60rpx;height: 60rpx;
  893. margin-top: 6rpx;
  894. }
  895. .carinfoBoxTop{
  896. display: flex;
  897. justify-content: space-between;
  898. padding-top: 29rpx;
  899. padding-left: 24rpx;
  900. padding-right: 20rpx;
  901. padding-bottom: 24rpx;
  902. border: 1px solid #EEEEEE;
  903. }
  904. .carinfoBoxTopCont{
  905. width: 454rpx;
  906. }
  907. .carinfoBoxTopContTop{
  908. display: flex;
  909. }
  910. .carInfoplateNumber{
  911. font-weight: 500;
  912. color: #3C3C3C;
  913. font-size: 30rpx;
  914. line-height: 42rpx;
  915. padding-right: 16rpx;
  916. }
  917. .carTnfomilage{
  918. color: #F19D01;
  919. font-size: 22rpx;
  920. padding: 0rpx 10rpx;
  921. border-radius: 4rpx;
  922. border: 1px solid #F19D01;
  923. height: 32rpx;
  924. line-height: 34rpx;
  925. margin-top: 2rpx;
  926. margin-left: 2rpx;
  927. }
  928. .carInfocarModel{
  929. width: 454rpx;
  930. color: #666666;
  931. font-size: 26rpx;
  932. white-space: nowrap;
  933. overflow: hidden;
  934. text-overflow: ellipsis;
  935. }
  936. .carinfoBoxTopRight{
  937. display: flex;padding-top: 25rpx;
  938. }
  939. .carinfoBoxTopRightIcon{
  940. width: 29rpx;
  941. height: 31rpx;
  942. }
  943. .huancheBtn{
  944. color: #666666; font-size: 26rpx;line-height: 31rpx;
  945. padding-left: 10rpx;
  946. }
  947. .carInfoBottom{
  948. display: flex;
  949. justify-content: space-around;
  950. }
  951. .carInfoBottomLineTitle{
  952. color: #999999;font-size: 24rpx;
  953. text-align: center;
  954. padding-top: 24rpx;
  955. }
  956. .carInfoBottomLineTxt{
  957. color: #3C3C3C;
  958. font-size: 26rpx;
  959. padding-top: 5rpx;
  960. text-align: center;
  961. }
  962. .carinfonocarIcon{
  963. width: 72rpx;
  964. height: 72rpx;
  965. }
  966. .carinfoBoxNocar{
  967. display: flex;
  968. padding-top: 50rpx;
  969. padding-left: 20rpx;
  970. }
  971. .carinfoBoxNocarRightTitle{
  972. font-weight: 500;
  973. color: #3C3C3C;
  974. font-size: 30rpx;
  975. }
  976. .carinfoBoxNocarRightMS{
  977. color: #666666;
  978. font-size: 26rpx;
  979. }
  980. .carinfoBoxNocarRight{
  981. padding-left: 24rpx;
  982. }
  983. .shoptopbox{
  984. margin-top: -170rpx;
  985. }
  986. .shoptopbox2{
  987. margin-top: -170rpx;
  988. }
  989. .adviser{
  990. width: 662rpx;
  991. margin-left: 24rpx;
  992. background: #FFFFFF;
  993. border-radius: 10px;
  994. display: flex;
  995. justify-content: space-between;
  996. padding: 18rpx 20rpx;
  997. margin-top: 20rpx;
  998. }
  999. .adviserLeft{
  1000. display: flex;
  1001. }
  1002. .advisertx{
  1003. width: 62rpx;height: 62rpx;
  1004. }
  1005. .adviserNema{
  1006. color: #333333;font-size: 30rpx;
  1007. line-height: 62rpx;padding-left: 24rpx;
  1008. }
  1009. .adviserms{
  1010. width: 118rpx;
  1011. height: 36rpx;
  1012. border-radius: 4rpx;
  1013. border: 1px solid #D53533;
  1014. line-height: 36rpx;
  1015. text-align: center;
  1016. margin-top: 12rpx;
  1017. margin-left: 20rpx;
  1018. color: #D53533;
  1019. font-size: 24rpx;
  1020. }
  1021. .adviserJt{
  1022. width: 12rpx;
  1023. height: 20rpx;
  1024. margin-top: 20rpx;
  1025. }
  1026. .modular{
  1027. width: 702rpx;
  1028. /* height: 313rpx; */
  1029. background: #FFFFFF;
  1030. border-radius: 10px;
  1031. margin-top: 20rpx;
  1032. margin-left: 24rpx;
  1033. padding-bottom: 40rpx;
  1034. }
  1035. .swiper-item{
  1036. display: flex;
  1037. flex-wrap: wrap;
  1038. }
  1039. .itemImg{
  1040. width: 46rpx;
  1041. height: 46rpx;
  1042. }
  1043. .Menusline{
  1044. font-size: 24rpx;
  1045. color: #333333;
  1046. }
  1047. .itemLine{
  1048. width: 20%;
  1049. text-align: center;
  1050. padding-top: 40rpx;
  1051. }
  1052. .advertisement{
  1053. width: 702rpx;
  1054. height: 280rpx;
  1055. margin-top: 20rpx;
  1056. margin-left: 24rpx;
  1057. border-radius: 20rpx;
  1058. }
  1059. .swiper-item2{
  1060. width: 702rpx;
  1061. height: 280px;
  1062. }
  1063. .swiper-item2Img{
  1064. width: 702rpx;
  1065. height: 280rpx;
  1066. }
  1067. .hotMoreJt{
  1068. width: 12rpx;
  1069. height: 20rpx;
  1070. margin-top: 6rpx;
  1071. }
  1072. .Hot{
  1073. width: 702rpx;
  1074. margin-top: 20rpx;
  1075. margin-left: 24rpx;
  1076. }
  1077. .hotTop{
  1078. display: flex;
  1079. justify-content: space-between;
  1080. padding: 6rpx 0;
  1081. }
  1082. .hotSx{
  1083. width: 8rpx;
  1084. height: 30rpx;
  1085. background: #FF0000;
  1086. border-radius: 5rpx;
  1087. }
  1088. .hotLeft{
  1089. display: flex;
  1090. }
  1091. .hottitle{
  1092. font-weight: 500;
  1093. color: #333333;
  1094. font-size: 30rpx;
  1095. line-height: 30rpx;
  1096. margin-left: 16rpx;
  1097. }
  1098. .hotRight{
  1099. display: flex;
  1100. }
  1101. .hotMore{
  1102. line-height: 30rpx;color: #666666;font-size: 24rpx;
  1103. margin-right: 16rpx;
  1104. }
  1105. .hotLineTopImg{
  1106. width: 702rpx;
  1107. height: 280rpx;
  1108. display: block;
  1109. }
  1110. .hotLineTop{
  1111. position: relative;
  1112. height: 280rpx;
  1113. }
  1114. .hotLine{
  1115. margin-top: 20rpx;
  1116. border-radius: 10rpx;
  1117. background: #FFFFFF;
  1118. overflow: hidden;
  1119. }
  1120. .hotlinestate1{
  1121. width: 102rpx;
  1122. height: 44rpx;
  1123. background:#FBBF00 ;
  1124. line-height: 44rpx;
  1125. font-weight: 500;
  1126. color: #333333;
  1127. font-size: 24rpx;
  1128. text-align: center;
  1129. }
  1130. .hotlinestate2{
  1131. width: 102rpx;
  1132. height: 44rpx;
  1133. background:#FF0000 ;
  1134. line-height: 44rpx;
  1135. font-weight: 500;
  1136. color: #FFFFFF;
  1137. font-size: 24rpx;
  1138. text-align: center;
  1139. }
  1140. .hotlineTimebox{
  1141. position: absolute;
  1142. left: 0;
  1143. bottom: 0;
  1144. display: flex;
  1145. align-items: flex-end;
  1146. }
  1147. .hotTime{
  1148. background: rgba(0, 0, 0, 0.5);
  1149. font-weight: 400;
  1150. color: #FFFFFF;
  1151. font-size: 24rpx;
  1152. /* line-height: 44rpx; */
  1153. padding: 5rpx 20rpx;
  1154. margin-top: 9rpx;
  1155. margin-left: -8rpx;
  1156. border-radius: 0px 10rpx 0px 0px;
  1157. }
  1158. .hotName{
  1159. padding: 24rpx 20rpx;
  1160. color: #333333;
  1161. line-height: 40rpx;
  1162. font-size: 28rpx;
  1163. }
  1164. .hotGoodsLine{
  1165. margin-top: 30rpx;
  1166. padding: 20rpx;
  1167. background: #FFFFFF;
  1168. border-radius: 16rpx;
  1169. display: flex;
  1170. }
  1171. .hotGoodsLineImg{
  1172. width: 208rpx;
  1173. height: 194rpx;
  1174. border-radius: 16rpx;
  1175. border: 1px solid #EEEEEE;
  1176. display: block;
  1177. }
  1178. .goodsName{
  1179. font-size: 28rpx;
  1180. font-family: PingFangSC-Regular, PingFang SC;
  1181. font-weight: 400;
  1182. color: #333333;
  1183. line-height: 40rpx;
  1184. text-overflow: -o-ellipsis-lastline;
  1185. overflow: hidden;
  1186. text-overflow: ellipsis;
  1187. display: -webkit-box;
  1188. -webkit-line-clamp: 2;
  1189. line-clamp: 2;
  1190. -webkit-box-orient: vertical;
  1191. }
  1192. .hotGoodsLineRIght{
  1193. padding-left: 24rpx;
  1194. }
  1195. .goodsPrice{
  1196. display: flex;
  1197. padding-top: 10rpx;
  1198. }
  1199. .goodsPrice1{
  1200. font-size: 24rpx;
  1201. font-weight: 400;
  1202. color: #FF0000;
  1203. padding-top: 8rpx;
  1204. }
  1205. .goodsPrice2{
  1206. font-size: 22rpx;
  1207. font-weight: 400;
  1208. color: #FF0000;
  1209. padding-top: 10rpx;
  1210. }
  1211. .goodsPrice3{
  1212. font-size: 32rpx;
  1213. font-weight: 500;
  1214. color: #FF0000;
  1215. }
  1216. .goodsPrice4{
  1217. font-size: 24rpx;
  1218. font-weight: 400;
  1219. color: #999999;
  1220. padding-top: 8rpx;
  1221. padding-left: 10rpx;
  1222. text-decoration:line-through;
  1223. }
  1224. .Sold{
  1225. font-weight: 400;
  1226. color: #999999;
  1227. font-size: 24rpx;
  1228. padding-top: 8rpx;
  1229. }
  1230. .jkStateImg{
  1231. width: 102rpx;
  1232. height: 53rpx;
  1233. position: relative;
  1234. }
  1235. </style>