index.vue 32 KB

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