index.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  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. shareID:'',
  245. discount:'',
  246. }
  247. },
  248. onLoad(opt) {
  249. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  250. var that=this;
  251. //this.$common.getExtStoreId()
  252. var ext=this.$common.getExtStoreId();
  253. this.ext=ext
  254. console.log(ext)
  255. //console.log( String(Date.now()))
  256. this.shopId=ext.shopId;
  257. this.url=ext.url;
  258. this.unionId=ext.unionId;
  259. var shareID = opt.scene //'F16E7299-6850-4015-ABCE-A9F2794B45B5'
  260. if (shareID) {
  261. this.shareID = shareID
  262. //this.$store.commit('mutationsshareID', shareID)
  263. }
  264. this.shareID='5788B15EAEE94EE78D3AA3FCE079B68D'
  265. //this.unionId="26A1039A-DB10-4D0E-BBA2-541C06274EED";
  266. //this.ext.appId="wxffd2502e67d37908"
  267. // uni.setStorage({
  268. // key: 'extdata',
  269. // data: {
  270. // shopId:'E37BB296-5A08-4534-859D-B351BA611AF9',
  271. // },
  272. // success: function () {
  273. // that.uniLogin()
  274. // }
  275. // });
  276. //this.userInfo = uni.getStorageSync("userInfo");
  277. this.userInfo=this.$store.state.userInfo
  278. if(this.userInfo){
  279. //this.wxOpenData = uni.getStorageSync("wxOpenData");
  280. this.getCarList();
  281. this.queryHomeCardList()
  282. this.queryManagerInfo()
  283. }else{
  284. this.uniLogin()
  285. }
  286. },
  287. onShow() {
  288. var indexaddcar = uni.getStorageSync("indexaddcar")
  289. if(indexaddcar==1){
  290. uni.removeStorageSync('indexaddcar');
  291. this.getCarList();
  292. }else{
  293. this.carInfo=this.$store.state.carInfo;
  294. this.jsTime()
  295. }
  296. },
  297. onPullDownRefresh(){
  298. this.getCarList();
  299. this.queryHomeCardList()
  300. this.queryManagerInfo()
  301. setTimeout(() => {
  302. uni.stopPullDownRefresh(); // 关闭下拉刷新
  303. }, 1000);
  304. },
  305. methods: {
  306. addCar(){
  307. if(!this.userInfo){
  308. this.authorizShow=true;
  309. }else{
  310. uni.navigateTo({
  311. url:'../user/addCar/addCar?type=1'
  312. })
  313. }
  314. },
  315. goShop(){
  316. uni.switchTab({
  317. url:'../shop/shop'
  318. })
  319. },
  320. moreJk(){
  321. uni.switchTab({
  322. url:'../activity/activity'
  323. })
  324. },
  325. information(){
  326. console.log('车辆信息--',this.carInfo);
  327. uni.navigateTo({
  328. url:'handbook?mileage='+this.carInfo.milage+'&liyangId='+this.carInfo.nLevelID
  329. })
  330. },
  331. changeCar(){
  332. // uni.scanCode({
  333. // success: function (res) {
  334. // console.log('条码类型:' + res.scanType);
  335. // console.log( res);
  336. // }
  337. // });
  338. // return false;
  339. uni.navigateTo({
  340. url:'../user/addCar/cailist'
  341. })
  342. },
  343. goMUsers(){
  344. if(!this.userInfo){
  345. this.authorizShow=true;
  346. }else{
  347. var managerInfo={
  348. name:this.managerInfo.name,
  349. shopInfo:{
  350. shopName:this.managerInfo.shopInfo.shopName,
  351. provinceName:this.managerInfo.shopInfo.provinceName,
  352. cityName:this.managerInfo.shopInfo.cityName,
  353. areaName:this.managerInfo.shopInfo.areaName,
  354. Address:this.managerInfo.shopInfo.Address,
  355. },
  356. avatar:this.managerInfo.avatar
  357. }
  358. uni.navigateTo({
  359. url:'../index/personalCard?adInfo='+JSON.stringify(managerInfo)
  360. })
  361. }
  362. },
  363. goGoods(item){
  364. if(!this.userInfo){
  365. this.authorizShow=true;
  366. }else{
  367. uni.navigateTo({
  368. url:'../shop/goodsDetail?id='+item.id
  369. })
  370. }
  371. },
  372. goJk(item){
  373. if(!this.userInfo){
  374. this.authorizShow=true;
  375. }else{
  376. uni.navigateTo({
  377. url:'../activity/jkDetail?id='+item.id
  378. })
  379. }
  380. },
  381. goRoter(item){
  382. console.log(item)
  383. if(!this.userInfo){
  384. this.authorizShow=true;
  385. }else{
  386. if(item.bizType==0){
  387. if(item.name=='新车'){ //
  388. uni.navigateTo({
  389. url:'newCar'
  390. })
  391. }else if(item.name=='二手车'){
  392. uni.navigateTo({
  393. url:'usedCar'
  394. })
  395. }else if(item.name=='爱车估价'){
  396. uni.navigateTo({
  397. url:'evaluation'
  398. })
  399. }
  400. else{
  401. uni.showToast({
  402. title: '敬请期待',
  403. icon:'none',
  404. duration: 3000
  405. });
  406. }
  407. }else if(item.bizType==1){ //紧急救援
  408. // uni.navigateTo({
  409. // url:'rescue'
  410. // })
  411. uni.showToast({
  412. title: '敬请期待',
  413. icon:'none',
  414. duration: 3000
  415. });
  416. }else if(item.bizType==2){ //钣金喷漆
  417. uni.navigateTo({
  418. url:'paint'
  419. })
  420. }else if(item.bizType==3){ //保养
  421. uni.navigateTo({
  422. url:'maintain'
  423. })
  424. }else if(item.bizType==4){ //在线预约
  425. uni.navigateTo({
  426. url:'onlineBooking?naShopId='+item.naShopId
  427. })
  428. }else if(item.bizType==5){ //导航
  429. this.getShopinfo(5,item.reShopId)
  430. }else if(item.bizType==6){ //联系本店
  431. this.getShopinfo(6,item.orShopId)
  432. }else if(item.bizType==7){ //7门店列表
  433. uni.navigateTo({
  434. url:'shopList'
  435. })
  436. }else if(item.bizType==8){ //我的会员卡
  437. uni.navigateTo({
  438. url:'vipCard'
  439. })
  440. }else if(item.bizType==9){ //我的优惠券
  441. uni.navigateTo({
  442. url:'discountCard'
  443. })
  444. }else if(item.bizType==10){ //我的订单
  445. uni.navigateTo({
  446. url:'../user/myOrder/myOrder'
  447. })
  448. }else if(item.bizType==11){ //我的预约
  449. uni.navigateTo({
  450. url:'../user/myBespeak'
  451. })
  452. }else if(item.bizType==12){ //历史消费
  453. uni.navigateTo({
  454. url:'../user/historySpend'
  455. })
  456. }else if(item.bizType==12){ //历史消费
  457. uni.navigateTo({
  458. url:'../user/historySpend'
  459. })
  460. }else if(item.bizType==13){ //车检报告
  461. uni.navigateTo({
  462. url:'../user/checkReport'
  463. })
  464. }else if(item.bizType==14){ //指定商品分类
  465. uni.setStorage({
  466. key: 'shopcategoryID',
  467. data: item.bizId,
  468. success: function () {
  469. getApp().globalData.shopcategoryID=item.bizId;
  470. uni.switchTab({
  471. url:'../shop/shop?shopcategoryID='+ item.bizId
  472. })
  473. }
  474. });
  475. }else if(item.bizType==15){ //商品详情
  476. uni.navigateTo({
  477. url:'../shop/goodsDetail?id='+item.bizId
  478. })
  479. }else if(item.bizType==16){ //积分商城
  480. uni.navigateTo({
  481. url:'../integral/integral'
  482. })
  483. }
  484. // uni.navigateTo({
  485. // url:url
  486. // })
  487. }
  488. },
  489. decryptPhoneNumber: function(e) {
  490. console.log(e);
  491. this.code=e.detail.code
  492. this.wxPhoneLogin()
  493. this.authorizShow=false;
  494. },
  495. wxgologin(){
  496. var that=this;
  497. uni.getUserProfile({
  498. lang:'zh_CN',
  499. desc:'登录',
  500. success:(res)=>{
  501. console.log(res);
  502. that.wxdata=res;
  503. uni.setStorage({
  504. key: 'wxdata',
  505. data: res,
  506. success: function () {
  507. that.uniLogin()
  508. }
  509. });
  510. },
  511. fail:(res)=>{
  512. console.log(res)
  513. }
  514. });
  515. },
  516. uniLogin(){
  517. var that=this;
  518. uni.login({
  519. provider: 'weixin',
  520. success: function (loginRes) {
  521. console.log(loginRes);
  522. that.getWxOpenID(loginRes)
  523. }
  524. });
  525. },
  526. getWxOpenID(e){
  527. var that=this;
  528. uni.showLoading({
  529. title: '加载中'
  530. })
  531. this.$http('miniApp2/sys/getWxOpenID', {
  532. code:e.code,
  533. unionId:this.unionId,
  534. shareId:this.shareID
  535. },'GET').then(res => {
  536. if(res.code!=0){
  537. uni.hideLoading();
  538. uni.showToast({
  539. title: res.msg,
  540. icon: 'none',
  541. duration: 3000
  542. });
  543. }
  544. this.wxOpenData=res.data;
  545. this.themeColor=res.data.themeColor
  546. //this.themeColor='FFFFFF'
  547. this.getwxLoing=true;
  548. uni.setNavigationBarTitle({
  549. title:this.wxOpenData.miniAppName
  550. })
  551. if(this.themeColor=='6F2BE8'){
  552. var backgroundImage='/static/tabimg/index6F2BE8.png'
  553. }
  554. if(this.themeColor=='1677FF'){
  555. var backgroundImage='/static/tabimg/index1677FF.png'
  556. }
  557. if(this.themeColor=='FF4F00'){
  558. var backgroundImage='/static/tabimg/indexFF4F00.png'
  559. }
  560. if(this.themeColor=='D53533'){
  561. var backgroundImage='/static/tabimg/index1.png'
  562. }
  563. uni.setTabBarStyle({
  564. // color: '#FF0000',
  565. selectedColor: '#'+this.themeColor,
  566. })
  567. uni.setTabBarItem({
  568. index: 0,
  569. text: '首页',
  570. selectedIconPath: backgroundImage
  571. })
  572. that.queryHomeCardList()
  573. //that.wxPhoneLogin()
  574. this.$store.commit('mutationswxOpenData', that.wxOpenData)
  575. uni.setStorage({
  576. key: 'wxOpenData',
  577. data: that.wxOpenData,
  578. success: function () {
  579. // that.uniLogin()
  580. }
  581. });
  582. uni.setStorage({
  583. key: 'themeColor',
  584. data: that.themeColor,
  585. success: function () {
  586. // that.uniLogin()
  587. }
  588. });
  589. if(this.wxOpenData.loginInfo){
  590. this.$store.commit('mutationsuserInfo', that.wxOpenData.loginInfo.openUser)
  591. this.userInfo=that.wxOpenData.loginInfo.openUser
  592. that.queryManagerInfo()
  593. uni.setStorage({
  594. key: 'userInfo',
  595. data: that.wxOpenData.loginInfo.openUser,
  596. success: function () {
  597. that.getCarList()
  598. }
  599. });
  600. }else{
  601. this.authorizShow=true;
  602. }
  603. uni.hideLoading();
  604. //console.log("优惠券")
  605. uni.showModal({
  606. title: '提示',
  607. content: '您有优惠券待领取',
  608. cancelText:'回到首页',
  609. confirmText:'查看',
  610. success: function(resTK) {
  611. if (resTK.confirm) {
  612. uni.navigateTo({
  613. url:'discountDlq'
  614. })
  615. }
  616. }
  617. });
  618. })
  619. },
  620. wxPhoneLogin(){
  621. var that=this;
  622. this.$http('miniApp2/sys/wxPhoneLogin', {
  623. appId:this.ext.appId,
  624. unionId:this.unionId,
  625. code:this.code,
  626. openId:this.wxOpenData.openid,
  627. shareId:this.shareID
  628. },'POST').then(res => {
  629. var data = res.data;
  630. if(data.loginInfo){
  631. this.userInfo=data.loginInfo.openUser;
  632. this.$store.commit('mutationsuserInfo', this.userInfo);
  633. this.$store.commit('mutationswxOpenData', data.loginInfo)
  634. uni.setStorage({
  635. key: 'userInfo',
  636. data: data.loginInfo.openUser,
  637. success: function () {
  638. that.getCarList()
  639. that.queryHomeCardList()
  640. that.queryManagerInfo()
  641. }
  642. });
  643. }
  644. })
  645. },
  646. getCarList(){
  647. this.$http('opencarOwnerHome/queryCarInfoList', {
  648. },'GET').then(res => {
  649. if(res.code==401){
  650. this.uniLogin()
  651. }else{
  652. this.carInfo=res.data[0]
  653. this.$store.commit('mutationscarInfo', this.carInfo)
  654. /* this.carInfo.insuranceExpireDate='2022-11-11';
  655. this.carInfo.nextAuditDate='2022-08-13'; */
  656. //this.carInfo.nextCareDate='2022-08-11';
  657. //this.carInfo.nextCareMilage=11
  658. this.jsTime()
  659. }
  660. })
  661. },
  662. jsTime(){
  663. if(this.carInfo.insuranceExpireDate){
  664. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.insuranceExpireDate.replace(/-/g, '/')).getTime()) || 0)) {
  665. console.log("现在时间大于开始时间")
  666. this.InsuranceExpireDate = 0
  667. } else {
  668. this.clock()
  669. }
  670. }else{
  671. this.InsuranceExpireDate=''
  672. }
  673. if(this.carInfo.nextCareDate){
  674. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextCareDate.replace(/-/g, '/')).getTime()) || 0)) {
  675. this.NextCareDate = 0
  676. } else {
  677. this.clock2()
  678. }
  679. }else{
  680. this.NextCareDate = ''
  681. }
  682. if(this.carInfo.nextAuditDate){
  683. if (Number(new Date().getTime()) > (Number(new Date(this.carInfo.nextAuditDate.replace(/-/g, '/')).getTime()) || 0)) {
  684. this.NextAuditDate = 0
  685. } else {
  686. this.clock3()
  687. }
  688. }else{
  689. this.NextAuditDate=''
  690. }
  691. },
  692. clock () {
  693. let _this = this
  694. let today = new Date() // 当前时间
  695. let h = today.getHours()
  696. let m = today.getMinutes()
  697. let s = today.getSeconds()
  698. let stopTime = new Date(_this.carInfo.insuranceExpireDate.replace(/-/g, '/')) // 结束时间
  699. let stopH = stopTime.getHours()
  700. let stopM = stopTime.getMinutes()
  701. let stopS = stopTime.getSeconds()
  702. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  703. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  704. this.InsuranceExpireDate=shengyuD+1;
  705. // setTimeout(_this.clock, 500)
  706. },
  707. clock2 () {
  708. let _this = this
  709. let today = new Date() // 当前时间
  710. let stopTime = new Date(_this.carInfo.nextCareDate.replace(/-/g, '/')) // 结束时间
  711. let stopH = stopTime.getHours()
  712. let stopM = stopTime.getMinutes()
  713. let stopS = stopTime.getSeconds()
  714. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  715. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  716. this.NextCareDate=shengyuD+1;
  717. // setTimeout(_this.clock, 500)
  718. },
  719. clock3 () {
  720. let _this = this
  721. let today = new Date() // 当前时间
  722. let stopTime = new Date(_this.carInfo.nextAuditDate.replace(/-/g, '/')) // 结束时间
  723. let shenyu = stopTime.getTime() - today.getTime() // 倒计时毫秒数
  724. let shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)) // 转换为天
  725. this.NextAuditDate=shengyuD+1;
  726. // setTimeout(_this.clock, 500)
  727. },
  728. queryManagerInfo(){
  729. console.log("11")
  730. this.$http('openHome/queryManagerInfo', {
  731. },'GET').then(res => {
  732. this.managerInfo=res.data
  733. })
  734. },
  735. queryHomeCardList(){
  736. //console.log(this.wxOpenData)
  737. uni.showLoading({
  738. title: '加载中'
  739. })
  740. this.$http('openHome/queryHomeCardList', {
  741. unionId:this.unionId
  742. },'GET').then(res => {
  743. uni.hideLoading();
  744. this.homeCardList=res.data
  745. })
  746. },
  747. getShopinfo(num,shopId){
  748. var that=this;
  749. uni.showLoading({
  750. title: '加载中'
  751. })
  752. if(!shopId){
  753. shopId=''
  754. }
  755. this.$http('openmy/getShopinfo', {
  756. shopId:shopId
  757. },'GET').then(res => {
  758. uni.hideLoading();
  759. var res=res.data
  760. if(num==5){
  761. uni.openLocation({
  762. latitude:Number(res.lat),
  763. longitude:Number(res.lng),
  764. name: res.shopName,
  765. address: res.address,
  766. success: function() {
  767. console.log('success');
  768. },
  769. fail(err) {
  770. console.log(err)
  771. }
  772. });
  773. }else{
  774. uni.makePhoneCall({
  775. phoneNumber: res.contactorPhone
  776. });
  777. }
  778. })
  779. }
  780. }
  781. }
  782. </script>
  783. <style scoped>
  784. .bxBox{
  785. display: flex;
  786. flex-wrap: wrap;
  787. }
  788. .bxline{
  789. display: flex;
  790. padding-top: 22rpx;
  791. }
  792. .bxline1{
  793. width: 40%;
  794. }
  795. .bxline2{
  796. width: 60%;
  797. }
  798. .bxlineTitle{
  799. color: #333333;
  800. font-size: 26rpx;
  801. line-height: 37rpx;
  802. padding-left: 10rpx;
  803. }
  804. .bxlineMs1{
  805. line-height: 37rpx;
  806. color: #D53533;
  807. font-size: 26rpx;
  808. padding-left: 12rpx;
  809. }
  810. .bxlineMs2{
  811. line-height: 37rpx;
  812. color: #999999;
  813. font-size: 24rpx;
  814. padding-left: 12rpx;
  815. }
  816. .bxlineIcon{
  817. width: 34rpx;
  818. height: 34rpx;
  819. margin-left: 24rpx;
  820. }
  821. .indexTop{
  822. background: #D53533;
  823. width: 750rpx;
  824. position: fixed;
  825. top: 0;
  826. left: 0;
  827. z-index: 11;
  828. }
  829. .indexnav{
  830. height: 44px;
  831. line-height: 44px;
  832. text-align: center;
  833. font-size: 36rpx;
  834. color: #FFFFFF;
  835. }
  836. .authorizBox{
  837. width: 100vw;
  838. height: 100vh;
  839. background: rgba(0, 0, 0, 0.5);
  840. position: fixed;
  841. top: 0;
  842. left: 0;
  843. }
  844. .authorizCont{
  845. margin-top: 30vh;
  846. width: 564rpx;
  847. height: 408rpx;
  848. background: #FFFFFF;
  849. border-radius: 24rpx;
  850. margin-left: 93rpx;
  851. position: relative;
  852. }
  853. .authorizCloseImg{
  854. width: 62rpx;
  855. height: 62rpx;
  856. }
  857. .sqLogoBox{
  858. width: 180rpx;
  859. height: 180rpx;
  860. background: #FFFFFF;
  861. border-radius: 90rpx;
  862. text-align: center;
  863. position: absolute;
  864. top: -50rpx;
  865. left: 192rpx;
  866. }
  867. .authorizName{
  868. color: #333333;
  869. line-height: 42rpx;
  870. font-size: 30rpx;
  871. text-align: center;
  872. padding-top: 58rpx;
  873. }
  874. .authorizMs{
  875. color: #999999;
  876. line-height: 36rpx;
  877. font-size: 26rpx;
  878. width: 452rpx;
  879. padding-top: 24rpx;
  880. text-align: center;
  881. margin-left: 56rpx;
  882. }
  883. .authorizContbutton{
  884. width: 422rpx;
  885. height: 88rpx;
  886. background: #D53533;
  887. border-radius: 44rpx;
  888. line-height: 88rpx;
  889. text-align: center;
  890. font-size:30rpx;
  891. color: #FFFFFF;
  892. margin-top: 62rpx;
  893. margin-left:71rpx;
  894. }
  895. .content{
  896. min-height: 100vh;
  897. background: #F4F5F7;
  898. }
  899. .topBox{
  900. width: 750rpx;
  901. height: 150rpx;
  902. background: #D53533;
  903. }
  904. .yuanhu{
  905. width: 750rpx;
  906. height: 50rpx;
  907. background: #D53533;
  908. border-radius: 0 0 100% 100%;
  909. }
  910. .carinfoBox{
  911. width: 702rpx;
  912. /* height: 250rpx; */
  913. background: #FFFFFF;
  914. border-radius: 10rpx;
  915. margin-left: 24rpx;
  916. overflow: hidden;
  917. height: 270rpx;
  918. }
  919. .carinfoBox2{
  920. width: 702rpx;
  921. height: 180rpx;
  922. background: #FFFFFF;
  923. border-radius: 10rpx;
  924. margin-left: 24rpx;
  925. overflow: hidden;
  926. }
  927. .carinfoBox2{
  928. }
  929. .carinfoBox .carLogo{
  930. width: 60rpx;height: 60rpx;
  931. margin-top: 6rpx;
  932. }
  933. .carinfoBoxTop{
  934. display: flex;
  935. justify-content: space-between;
  936. padding-top: 29rpx;
  937. padding-left: 24rpx;
  938. padding-right: 20rpx;
  939. padding-bottom: 24rpx;
  940. border: 1px solid #EEEEEE;
  941. }
  942. .carinfoBoxTopCont{
  943. width: 454rpx;
  944. }
  945. .carinfoBoxTopContTop{
  946. display: flex;
  947. }
  948. .carInfoplateNumber{
  949. font-weight: 500;
  950. color: #3C3C3C;
  951. font-size: 30rpx;
  952. line-height: 42rpx;
  953. padding-right: 16rpx;
  954. }
  955. .carTnfomilage{
  956. color: #F19D01;
  957. font-size: 22rpx;
  958. padding: 0rpx 10rpx;
  959. border-radius: 4rpx;
  960. border: 1px solid #F19D01;
  961. height: 32rpx;
  962. line-height: 34rpx;
  963. margin-top: 2rpx;
  964. margin-left: 2rpx;
  965. }
  966. .carInfocarModel{
  967. width: 454rpx;
  968. color: #666666;
  969. font-size: 26rpx;
  970. white-space: nowrap;
  971. overflow: hidden;
  972. text-overflow: ellipsis;
  973. }
  974. .carinfoBoxTopRight{
  975. display: flex;padding-top: 25rpx;
  976. }
  977. .carinfoBoxTopRightIcon{
  978. width: 29rpx;
  979. height: 31rpx;
  980. }
  981. .huancheBtn{
  982. color: #666666; font-size: 26rpx;line-height: 31rpx;
  983. padding-left: 10rpx;
  984. }
  985. .carInfoBottom{
  986. display: flex;
  987. justify-content: space-around;
  988. }
  989. .carInfoBottomLineTitle{
  990. color: #999999;font-size: 24rpx;
  991. text-align: center;
  992. padding-top: 24rpx;
  993. }
  994. .carInfoBottomLineTxt{
  995. color: #3C3C3C;
  996. font-size: 26rpx;
  997. padding-top: 5rpx;
  998. text-align: center;
  999. }
  1000. .carinfonocarIcon{
  1001. width: 72rpx;
  1002. height: 72rpx;
  1003. }
  1004. .carinfoBoxNocar{
  1005. display: flex;
  1006. padding-top: 50rpx;
  1007. padding-left: 20rpx;
  1008. }
  1009. .carinfoBoxNocarRightTitle{
  1010. font-weight: 500;
  1011. color: #3C3C3C;
  1012. font-size: 30rpx;
  1013. }
  1014. .carinfoBoxNocarRightMS{
  1015. color: #666666;
  1016. font-size: 26rpx;
  1017. }
  1018. .carinfoBoxNocarRight{
  1019. padding-left: 24rpx;
  1020. }
  1021. .shoptopbox{
  1022. margin-top: -170rpx;
  1023. }
  1024. .shoptopbox2{
  1025. margin-top: -170rpx;
  1026. }
  1027. .adviser{
  1028. width: 662rpx;
  1029. margin-left: 24rpx;
  1030. background: #FFFFFF;
  1031. border-radius: 10px;
  1032. display: flex;
  1033. justify-content: space-between;
  1034. padding: 18rpx 20rpx;
  1035. margin-top: 20rpx;
  1036. }
  1037. .adviserLeft{
  1038. display: flex;
  1039. }
  1040. .advisertx{
  1041. width: 62rpx;height: 62rpx;
  1042. }
  1043. .adviserNema{
  1044. color: #333333;font-size: 30rpx;
  1045. line-height: 62rpx;padding-left: 24rpx;
  1046. }
  1047. .adviserms{
  1048. width: 118rpx;
  1049. height: 36rpx;
  1050. border-radius: 4rpx;
  1051. border: 1px solid #D53533;
  1052. line-height: 36rpx;
  1053. text-align: center;
  1054. margin-top: 12rpx;
  1055. margin-left: 20rpx;
  1056. color: #D53533;
  1057. font-size: 24rpx;
  1058. }
  1059. .adviserJt{
  1060. width: 12rpx;
  1061. height: 20rpx;
  1062. margin-top: 20rpx;
  1063. }
  1064. .modular{
  1065. width: 702rpx;
  1066. /* height: 313rpx; */
  1067. background: #FFFFFF;
  1068. border-radius: 10px;
  1069. margin-top: 20rpx;
  1070. margin-left: 24rpx;
  1071. padding-bottom: 40rpx;
  1072. }
  1073. .swiper-item{
  1074. display: flex;
  1075. flex-wrap: wrap;
  1076. }
  1077. .itemImg{
  1078. width: 46rpx;
  1079. height: 46rpx;
  1080. }
  1081. .Menusline{
  1082. font-size: 24rpx;
  1083. color: #333333;
  1084. }
  1085. .itemLine{
  1086. width: 20%;
  1087. text-align: center;
  1088. padding-top: 40rpx;
  1089. }
  1090. .advertisement{
  1091. width: 702rpx;
  1092. height: 280rpx;
  1093. margin-top: 20rpx;
  1094. margin-left: 24rpx;
  1095. border-radius: 20rpx;
  1096. }
  1097. .swiper-item2{
  1098. width: 702rpx;
  1099. height: 280px;
  1100. }
  1101. .swiper-item2Img{
  1102. width: 702rpx;
  1103. height: 280rpx;
  1104. }
  1105. .hotMoreJt{
  1106. width: 12rpx;
  1107. height: 20rpx;
  1108. margin-top: 6rpx;
  1109. }
  1110. .Hot{
  1111. width: 702rpx;
  1112. margin-top: 20rpx;
  1113. margin-left: 24rpx;
  1114. }
  1115. .hotTop{
  1116. display: flex;
  1117. justify-content: space-between;
  1118. padding: 6rpx 0;
  1119. }
  1120. .hotSx{
  1121. width: 8rpx;
  1122. height: 30rpx;
  1123. background: #FF0000;
  1124. border-radius: 5rpx;
  1125. }
  1126. .hotLeft{
  1127. display: flex;
  1128. }
  1129. .hottitle{
  1130. font-weight: 500;
  1131. color: #333333;
  1132. font-size: 30rpx;
  1133. line-height: 30rpx;
  1134. margin-left: 16rpx;
  1135. }
  1136. .hotRight{
  1137. display: flex;
  1138. }
  1139. .hotMore{
  1140. line-height: 30rpx;color: #666666;font-size: 24rpx;
  1141. margin-right: 16rpx;
  1142. }
  1143. .hotLineTopImg{
  1144. width: 702rpx;
  1145. height: 280rpx;
  1146. display: block;
  1147. }
  1148. .hotLineTop{
  1149. position: relative;
  1150. height: 280rpx;
  1151. }
  1152. .hotLine{
  1153. margin-top: 20rpx;
  1154. border-radius: 10rpx;
  1155. background: #FFFFFF;
  1156. overflow: hidden;
  1157. }
  1158. .hotlinestate1{
  1159. width: 102rpx;
  1160. height: 44rpx;
  1161. background:#FBBF00 ;
  1162. line-height: 44rpx;
  1163. font-weight: 500;
  1164. color: #333333;
  1165. font-size: 24rpx;
  1166. text-align: center;
  1167. }
  1168. .hotlinestate2{
  1169. width: 102rpx;
  1170. height: 44rpx;
  1171. background:#FF0000 ;
  1172. line-height: 44rpx;
  1173. font-weight: 500;
  1174. color: #FFFFFF;
  1175. font-size: 24rpx;
  1176. text-align: center;
  1177. }
  1178. .hotlineTimebox{
  1179. position: absolute;
  1180. left: 0;
  1181. bottom: 0;
  1182. display: flex;
  1183. align-items: flex-end;
  1184. }
  1185. .hotTime{
  1186. background: rgba(0, 0, 0, 0.5);
  1187. font-weight: 400;
  1188. color: #FFFFFF;
  1189. font-size: 24rpx;
  1190. /* line-height: 44rpx; */
  1191. padding: 5rpx 20rpx;
  1192. margin-top: 9rpx;
  1193. margin-left: -8rpx;
  1194. border-radius: 0px 10rpx 0px 0px;
  1195. }
  1196. .hotName{
  1197. padding: 24rpx 20rpx;
  1198. color: #333333;
  1199. line-height: 40rpx;
  1200. font-size: 28rpx;
  1201. }
  1202. .hotGoodsLine{
  1203. margin-top: 30rpx;
  1204. padding: 20rpx;
  1205. background: #FFFFFF;
  1206. border-radius: 16rpx;
  1207. display: flex;
  1208. }
  1209. .hotGoodsLineImg{
  1210. width: 208rpx;
  1211. height: 194rpx;
  1212. border-radius: 16rpx;
  1213. border: 1px solid #EEEEEE;
  1214. display: block;
  1215. }
  1216. .goodsName{
  1217. font-size: 28rpx;
  1218. font-family: PingFangSC-Regular, PingFang SC;
  1219. font-weight: 400;
  1220. color: #333333;
  1221. line-height: 40rpx;
  1222. text-overflow: -o-ellipsis-lastline;
  1223. overflow: hidden;
  1224. text-overflow: ellipsis;
  1225. display: -webkit-box;
  1226. -webkit-line-clamp: 2;
  1227. line-clamp: 2;
  1228. -webkit-box-orient: vertical;
  1229. }
  1230. .hotGoodsLineRIght{
  1231. padding-left: 24rpx;
  1232. }
  1233. .goodsPrice{
  1234. display: flex;
  1235. padding-top: 10rpx;
  1236. }
  1237. .goodsPrice1{
  1238. font-size: 24rpx;
  1239. font-weight: 400;
  1240. color: #FF0000;
  1241. padding-top: 8rpx;
  1242. }
  1243. .goodsPrice2{
  1244. font-size: 22rpx;
  1245. font-weight: 400;
  1246. color: #FF0000;
  1247. padding-top: 10rpx;
  1248. }
  1249. .goodsPrice3{
  1250. font-size: 32rpx;
  1251. font-weight: 500;
  1252. color: #FF0000;
  1253. }
  1254. .goodsPrice4{
  1255. font-size: 24rpx;
  1256. font-weight: 400;
  1257. color: #999999;
  1258. padding-top: 8rpx;
  1259. padding-left: 10rpx;
  1260. text-decoration:line-through;
  1261. }
  1262. .Sold{
  1263. font-weight: 400;
  1264. color: #999999;
  1265. font-size: 24rpx;
  1266. padding-top: 8rpx;
  1267. }
  1268. .jkStateImg{
  1269. width: 102rpx;
  1270. height: 53rpx;
  1271. position: relative;
  1272. }
  1273. </style>