cailist.vue 12 KB

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