cailist.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="box">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'我的车库'" :cj="3"></homenav>
  4. <view class="carlistBox" style="display: none;">
  5. <view class="line" v-for="(item,index) in carList" @click="itemClick(item)">
  6. <view class="lineCont">
  7. <view>
  8. <image :src="item.brandLogo" v-if="item.brandLogo" mode="widthFix" class="brandLogo"></image>
  9. <img src="../../../static/timg/nocar.png" alt="" class="brandLogo" v-else>
  10. </view>
  11. <view style="padding-left: 29rpx;">
  12. <view class="carName">
  13. <span>{{item.plateNumber}}</span>
  14. <view class="plateNumber" v-if="item.milage">{{item.milage}}km</view>
  15. <view class="nextCare" v-if="item.nextReturnDate||item.nextCareMilage">
  16. <image class="carByIcon" src="../../../static/timg/car2.png" mode=""></image>
  17. <span class="nextCareTitle">下次保养</span>
  18. <span class="nextCaretxt" v-if="item.nextReturnDate">{{item.nextReturnDate}}天后</span>
  19. <span class="nextCaretxt" v-if="item.nextReturnDate&&item.nextCareMilage">或</span>
  20. <span class="nextCaretxt" v-if="item.nextCareMilage&&item.nextCareMilage>-1">{{item.nextCareMilage}}km</span>
  21. </view>
  22. </view>
  23. <!-- <view class="carMS">{{item.carModel?item.carModel:''}}</view> -->
  24. <view class="carMS">{{item.brand?item.brand:''}} {{item.series?item.series:''}}</view>
  25. </view>
  26. </view>
  27. <view class="lineBottom">
  28. <!-- <view class="lineDel" @click.stop="editCar(item.id)">编辑</view> -->
  29. <view class="lineDel" v-if="openMCar.showType==1" @click.stop="maintain(item)">保养信息</view>
  30. <!-- <view class="Default" v-show="item.isDefault!=1" @click.stop="defaultCar(item)">设为默认</view>
  31. <view class="DefaultYES" v-show="item.isDefault==1">已设为默认</view> -->
  32. </view>
  33. <view class="DefaultIcon" v-show="item.isDefault==1">默认</view>
  34. </view>
  35. </view>
  36. <view class="carlistBox">
  37. <view class="line" v-for="(item,index) in carList" @click="itemClick(item)">
  38. <view class="lineTop">
  39. <view class="lineplateNumber">{{item.plateNumber}}</view>
  40. <view class="lineSx1"></view>
  41. <view class="linekk">
  42. <view class="linekkrow" v-if="item.nextCareMilage" style="color: #333333;font-size: 24rpx;">{{item.nextCareMilage}}km</view>
  43. <view class="linekkrow" v-else>-</view>
  44. <view class="linekkrow">建议下次</view>
  45. <view class="linekkrow" >保养里程</view>
  46. </view>
  47. <view class="lineSx"></view>
  48. <view class="linekk">
  49. <view class="linekkrow" v-if="item.nextCareDate" style="color: #333333;font-size: 24rpx;">{{item.nextCareDate.slice(0,10)}}</view>
  50. <view class="linekkrow" v-else>-</view>
  51. <view class="linekkrow">建议下次</view>
  52. <view class="linekkrow" >保养日期</view>
  53. </view>
  54. </view>
  55. <view class="lineBottom">
  56. <view class="lineDel" v-show="item.isDefault!=1" @click.stop="defaultCar(item)">设为默认</view>
  57. <view class="lineDel" @click.stop="editCar(item.id)">编辑</view>
  58. <view class="lineDel" @click.stop="maintain(item)">保养信息</view>
  59. </view>
  60. <view class="DefaultIcon2" v-show="item.isDefault==1">默认</view>
  61. </view>
  62. </view>
  63. <view v-if="carList==''&&loding" class="nodataBox">
  64. <image src="http://dmsphoto.66km.com.cn/thFiles/3C95A4C5-73F8-4B34-902B-703B8A0825C9.png" mode="widthFix" class="nodataImg"></image>
  65. <view class="noTxt">暂无数据</view>
  66. </view>
  67. <view class="bottomView">
  68. <view class="saveCar" :style="{background:'#'+themeColor}" @click="addBtn">
  69. <view>添加爱车</view>
  70. </view>
  71. </view>
  72. <!-- 手机号授权 -->
  73. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  74. <view class="authorizCont" @click.stop="">
  75. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  76. <view class="authorizMs">未注册的手机号登录后将自动创建会员账号,如果您不同意授权获取手机号,会影响您使用我们的产品和服务。</view>
  77. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  78. </view>
  79. <view style="text-align: center;padding-top: 56rpx;">
  80. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import homenav from "@/components/homenav/nav.vue"
  87. export default {
  88. components: {
  89. homenav
  90. },
  91. data() {
  92. return {
  93. carList: '',
  94. loding: false,
  95. type: '',
  96. carId: '',
  97. fromMe: false,
  98. themeColor:'',
  99. iStatusBarHeight:'',
  100. openMCar:'',
  101. userInfo:'',
  102. ext:'',
  103. wxOpenData:'',
  104. authorizShow:false,
  105. code:'',
  106. }
  107. },
  108. onLoad(opt) {
  109. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  110. this.$common.isUserId()
  111. this.type = opt.type;
  112. // console.log(this.type)
  113. this.fromMe = opt.fromMe
  114. this.themeColor = uni.getStorageSync("themeColor");
  115. this.openMCar=uni.getStorageSync("openMCar");
  116. this.userInfo=this.$store.state.userInfo;
  117. this.ext=this.$common.getExtStoreId();
  118. if(this.userInfo){
  119. this.getqueryMyBMemberCar()
  120. }else{
  121. this.$common.automaticlogin().then(val => {
  122. this.userInfo=this.$store.state.userInfo;
  123. this.wxOpenData=this.$store.state.wxOpenData;
  124. this.themeColor = uni.getStorageSync("themeColor");
  125. this.getqueryMyBMemberCar();
  126. if(!this.userInfo){
  127. this.authorizShow=true
  128. }
  129. })
  130. }
  131. },
  132. onShow() {
  133. this.getqueryMyBMemberCar();
  134. this.carId = uni.getStorageSync("maintainCarData").id
  135. },
  136. methods: {
  137. decryptPhoneNumber: function(e) {
  138. console.log(e);
  139. this.code=e.detail.code
  140. this.wxPhoneLogin()
  141. this.authorizShow=false;
  142. },
  143. wxPhoneLogin(){
  144. var that=this;
  145. this.$http('miniApp2/sys/wxPhoneLogin', {
  146. appId:this.ext.appId,
  147. unionId:this.ext.unionId,
  148. code:this.code,
  149. openId:this.wxOpenData.openid
  150. },'POST').then(res => {
  151. var data = res.data;
  152. if(data.loginInfo){
  153. this.userInfo=data.loginInfo.openUser;
  154. this.wxOpenData=data.loginInfo;
  155. this.$store.commit('mutationswxOpenData', data)
  156. this.$store.commit('mutationsuserInfo', this.userInfo)
  157. this.getqueryMyBMemberCar()
  158. }
  159. })
  160. },
  161. maintain(item){
  162. uni.navigateTo({
  163. url:'../../index/handbook?mileage='+item.milage+'&liyangId='+item.nLevelID
  164. })
  165. },
  166. getqueryMyBMemberCar() {
  167. uni.showLoading({
  168. title: '加载中'
  169. })
  170. this.loding = false;
  171. this.$http('opencarOwnerHome/queryCarInfoList', {
  172. }, 'GET').then(res => {
  173. uni.hideLoading();
  174. this.carList = res.data;
  175. this.loding = true;
  176. })
  177. },
  178. defaultCar(item){
  179. uni.showLoading({
  180. title: '加载中'
  181. })
  182. this.loding = false;
  183. this.$http('opencarOwnerHome/setDefaultCar', {
  184. carId:item.id
  185. }, 'GET').then(res => {
  186. uni.hideLoading();
  187. this.$store.commit('mutationscarInfo', item)
  188. this.loding = true;
  189. this.getqueryMyBMemberCar();
  190. })
  191. },
  192. addBtn() {
  193. uni.navigateTo({
  194. url: '../../subPack/addCarCK'
  195. })
  196. },
  197. editCar(id) {
  198. uni.navigateTo({
  199. url: 'addCar?id=' + id + '&isEditCar=true'
  200. })
  201. },
  202. itemClick(item){
  203. if(this.type!=3){
  204. this.$store.commit('mutationscarInfo', item)
  205. uni.navigateBack({
  206. delta: 1
  207. })
  208. }
  209. },
  210. },
  211. // 下拉刷新
  212. onPullDownRefresh() {
  213. // this.page = 1
  214. this.getqueryMyBMemberCar()
  215. setTimeout(function() {
  216. uni.stopPullDownRefresh();
  217. }, 1000);
  218. },
  219. }
  220. </script>
  221. <style scoped>
  222. .lineTop{
  223. display: flex;justify-content: space-between;
  224. color: #3C3C3C;
  225. font-size: 30rpx;
  226. }
  227. .linekk{
  228. text-align: center;
  229. color: #999999;
  230. font-size: 22rpx;
  231. line-height: 36rpx;
  232. width: 32%;
  233. }
  234. .lineSx1{
  235. width: 2rpx;height: 60rpx;
  236. background: #DDDDDD;margin-top: 24rpx;
  237. }
  238. .lineSx{
  239. width: 2rpx;height: 80rpx;
  240. background: #DDDDDD;margin-top: 14rpx;
  241. }
  242. .lineplateNumber{
  243. font-weight: 600;
  244. display: flex;
  245. align-items: center;
  246. width: 32%;
  247. justify-content: center;
  248. }
  249. .carByIcon{
  250. width: 34rpx;height: 34rpx;
  251. }
  252. .nextCaretxt{
  253. color: #FF0000;
  254. }
  255. .nextCare{
  256. font-size: 20rpx;
  257. line-height: 36rpx;
  258. display: flex;
  259. padding-left: 6rpx;
  260. }
  261. .box {
  262. min-height: 100vh;
  263. background: #F4F5F7;
  264. padding-bottom: 120rpx;
  265. }
  266. .nodataImg {
  267. width: 400rpx;
  268. padding-top: 100rpx;
  269. }
  270. .noTxt {
  271. font-size: 36rpx;
  272. color: #999999;
  273. padding-top: 50rpx;
  274. }
  275. .nodataBox {
  276. text-align: center;
  277. }
  278. .bottomView {
  279. background-color: #FFFFFF;
  280. width: 100%;
  281. height: 120rpx;
  282. position: fixed;
  283. bottom: 0rpx;
  284. padding-bottom: constant(safe-area-inset-bottom);
  285. padding-bottom: env(safe-area-inset-bottom);
  286. }
  287. .saveCar {
  288. background: #D53533;
  289. margin: 23rpx 30rpx;
  290. height: 74rpx;
  291. border-radius: 37rpx;
  292. color: #FFFFFF;
  293. font-size: 30rpx;
  294. font-weight: bold;
  295. align-items: center;
  296. display: flex;
  297. justify-content: center;
  298. }
  299. .carlistBox {
  300. padding-bottom: 120rpx;
  301. }
  302. .carlistBox {
  303. padding: 24rpx;
  304. padding-bottom: 120rpx;
  305. }
  306. .brandLogo {
  307. width: 63rpx;
  308. height: 63rpx;
  309. }
  310. .line {
  311. background: #FFFFFF;
  312. padding: 20rpx 20rpx;
  313. border-radius: 10rpx;
  314. margin-bottom: 20rpx;
  315. position: relative;
  316. }
  317. .lineCont {
  318. display: flex;
  319. }
  320. .carName {
  321. color: #3C3C3C;
  322. font-size: 30rpx;
  323. display: flex;
  324. }
  325. .plateNumber {
  326. border-radius: 4px;
  327. border: 1px solid #F19D01;
  328. height: 32rpx;
  329. line-height: 32rpx;
  330. padding: 0 10rpx;
  331. color: #F19D01;
  332. font-size: 22rpx;
  333. margin-left: 20rpx;
  334. margin-top: 5rpx;
  335. }
  336. .carMS {
  337. color: #666666;
  338. font-size: 26rpx;
  339. padding-top: 5px;
  340. }
  341. .lineBottom {
  342. display: flex;
  343. justify-content: flex-end;
  344. padding-top: 30rpx;
  345. }
  346. .lineDel {
  347. /* width: 94rpx; */
  348. height: 50rpx;
  349. border-radius: 25rpx;
  350. border: 1px solid #DDDDDD;
  351. text-align: center;
  352. line-height: 50rpx;
  353. font-size: 26rpx;
  354. color: #3C3C3C;
  355. margin-left: 29rpx;
  356. padding: 0 20rpx;
  357. }
  358. .Default {
  359. width: 148rpx;
  360. height: 50rpx;
  361. border-radius: 25rpx;
  362. border: 1px solid #FF4F00;
  363. line-height: 50rpx;
  364. text-align: center;
  365. color: #FF4F00;
  366. font-size: 26rpx;
  367. }
  368. .DefaultYES {
  369. width: 148rpx;
  370. height: 50rpx;
  371. border-radius: 25rpx;
  372. border: 1px solid #DDDDDD;
  373. line-height: 50rpx;
  374. text-align: center;
  375. color: #999999;
  376. font-size: 26rpx;
  377. }
  378. .DefaultIcon {
  379. position: absolute;
  380. top: 0;
  381. right: 0;
  382. width: 109rpx;
  383. height: 40rpx;
  384. background: linear-gradient(131deg, #FFA72C 0%, #FF450F 100%);
  385. border-radius: 0px 10rpx 0px 10rpx;
  386. text-align: center;
  387. line-height: 40rpx;
  388. color: #FFFFFF;
  389. font-size: 22rpx;
  390. }
  391. .DefaultIcon2{
  392. position: absolute;
  393. top: 0;
  394. left: 0;
  395. width: 74rpx;
  396. height: 40rpx;
  397. /* background: linear-gradient(131deg, #FFA72C 0%, #FF450F 100%); */
  398. border-radius: 10px 0rpx 10px 0rpx;
  399. text-align: center;
  400. line-height: 40rpx;
  401. color: #222222;
  402. font-size: 22rpx;
  403. background: #FCD903;
  404. }
  405. .authorizBox{
  406. width: 100vw;
  407. height: 100vh;
  408. background: rgba(0, 0, 0, 0.5);
  409. position: fixed;
  410. top: 0;
  411. left: 0;
  412. }
  413. .authorizCont{
  414. margin-top: 30vh;
  415. width: 564rpx;
  416. height: 408rpx;
  417. background: #FFFFFF;
  418. border-radius: 24rpx;
  419. margin-left: 93rpx;
  420. position: relative;
  421. }
  422. .authorizCloseImg{
  423. width: 62rpx;
  424. height: 62rpx;
  425. }
  426. .sqLogoBox{
  427. width: 180rpx;
  428. height: 180rpx;
  429. background: #FFFFFF;
  430. border-radius: 90rpx;
  431. text-align: center;
  432. position: absolute;
  433. top: -50rpx;
  434. left: 192rpx;
  435. }
  436. .authorizName{
  437. color: #333333;
  438. line-height: 42rpx;
  439. font-size: 30rpx;
  440. text-align: center;
  441. padding-top: 58rpx;
  442. }
  443. .authorizMs{
  444. color: #999999;
  445. line-height: 36rpx;
  446. font-size: 26rpx;
  447. width: 452rpx;
  448. padding-top: 24rpx;
  449. text-align: center;
  450. margin-left: 56rpx;
  451. }
  452. .authorizContbutton{
  453. width: 422rpx;
  454. height: 88rpx;
  455. background: #D53533;
  456. border-radius: 44rpx;
  457. line-height: 88rpx;
  458. text-align: center;
  459. font-size:30rpx;
  460. color: #FFFFFF;
  461. margin-top: 62rpx;
  462. margin-left:71rpx;
  463. }
  464. .shopBoxpt{
  465. margin-top: 20rpx;
  466. }
  467. button::after{
  468. border: none;
  469. }
  470. button{
  471. position: relative;
  472. display: block;
  473. margin-left: 0;
  474. margin-right: 0;
  475. padding-left: 0px;
  476. padding-right: 0px;
  477. box-sizing: border-box;
  478. // font-size: 18px;
  479. text-align: center;
  480. text-decoration: none;
  481. // line-height: 1;
  482. line-height: 1.35;
  483. // border-radius: 5px;
  484. -webkit-tap-highlight-color: transparent;
  485. overflow: hidden;
  486. color: #000000;
  487. background-color: #fff;
  488. height: 100%;
  489. }
  490. </style>