index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="content">
  3. <!-- 轮播图 -->
  4. <view class="bBannerList">
  5. <swiper class="swiper" :autoplay="autoplay" :interval="interval" :duration="duration" :circular="true">
  6. <swiper-item v-for="(item,index) in imgData" @click="carBswpClick(item)" v-if="!shopId">
  7. <view class="swiper-item uni-bg-red">
  8. <image :src="item.logo" mode="" class="swpImg"></image>
  9. </view>
  10. </swiper-item>
  11. <swiper-item v-for="(item,index) in imgData" @click="carBswpClickshop(item)" v-if="shopId">
  12. <view class="swiper-item uni-bg-red">
  13. <image :src="item.logo" mode="" class="swpImg"></image>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. <!-- 填写车辆信息 -->
  19. <view class="carMessage">
  20. <view class="mesView">
  21. <view class="leftTitle">城市</view>
  22. <view class="cityBtn noSelectColor" v-if="!cityname" @click="showCity=true">请选择</view>
  23. <view class="cityBtn selectColor" v-else @click="showCity=true">{{cityname}}</view>
  24. <image src="../../static/img/rightArrow.png" class="rightArrow"></image>
  25. </view>
  26. <view class="mesView">
  27. <view class="leftTitle">车牌号</view>
  28. <view class="rightView" v-if="!memberCar">
  29. <view class="plateNumber noSelectColor">请添加您的爱车</view>
  30. <view class="changeCarBg" @click="addCar()">
  31. <image src="../../static/img/icon_change.png"
  32. style="width: 32rpx; height: 34rpx; margin-right: 5rpx;"></image>
  33. <view style="color: #FF2400; font-size: 28rpx;">添加</view>
  34. </view>
  35. </view>
  36. <view class="rightView" v-else>
  37. <view class="plateNumber selectColor">{{memberCar.plateNumber}}</view>
  38. <view class="changeCarBg" @click="goCarList()">
  39. <image src="../../static/img/icon_change.png"
  40. style="width: 32rpx; height: 34rpx; margin-right: 5rpx;"></image>
  41. <view style="color: #FF2400; font-size: 28rpx;">换车</view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="mesView">
  46. <view class="leftTitle">车型</view>
  47. <view class="carModBtn selectColor" v-if="memberCar">{{memberCar.carModel}}</view>
  48. </view>
  49. <view class="mesView">
  50. <view class="leftTitle">行驶里程</view>
  51. <input class="mileageInput selectColor" type="number" v-model="mileage" placeholder="请输入"
  52. placeholder-style="color:#999999" />
  53. <view class="kmStr">km</view>
  54. </view>
  55. </view>
  56. <view class="look4s" @click="gomodule">查看4S店保养价格</view>
  57. <chose-city @selectCity="selectCity" v-if="showCity" @closeModal="closeModal"></chose-city>
  58. </view>
  59. </template>
  60. <script>
  61. import choseCity from "@/components/chose-city/chose-city"
  62. export default {
  63. components: {
  64. choseCity
  65. },
  66. data() {
  67. return {
  68. imgData: [],
  69. uid: '',
  70. cityname: '',
  71. showCity: false,
  72. memberCar: '',
  73. location: {
  74. lng:'',
  75. lat:'',
  76. cityname:'',
  77. cityCode:'',
  78. },
  79. cityCode: '',
  80. time: '',
  81. mileage: '',
  82. autoplay:true,
  83. }
  84. },
  85. onLoad() {
  86. },
  87. onShow() {
  88. var that = this;
  89. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  90. this.uid = uni.getStorageSync("logodata").uid;
  91. this.location = uni.getStorageSync("location");
  92. if (this.location) {
  93. this.lng = this.location.lng;
  94. this.lat = this.location.lat;
  95. this.cityname = this.location.cityname;
  96. this.cityCode = this.location.cityCode;
  97. that.queryHomeDetail();
  98. } else {
  99. uni.showToast({
  100. title: '请选择城市'
  101. })
  102. }
  103. },
  104. methods: {
  105. queryHomeDetail() {
  106. uni.showLoading({
  107. title: '加载中'
  108. })
  109. this.$http('worldKeepCar/worldHome/queryHomeDetail', {
  110. cityCode: this.cityCode
  111. }, 'GET').then(res => {
  112. uni.hideLoading();
  113. this.imgData = res.data.banners
  114. this.memberCar = res.data.memberCar
  115. this.mileage = res.data.memberCar.milage
  116. var cardata = uni.getStorageSync("maintainCarData")
  117. if (cardata) {
  118. this.memberCar = cardata
  119. }
  120. })
  121. },
  122. gomodule() {
  123. uni.navigateTo({
  124. url: '../module/maintain'
  125. })
  126. },
  127. goCarList() {
  128. if (this.uid) {
  129. uni.navigateTo({
  130. url: 'cailist?type=1'
  131. })
  132. }
  133. },
  134. addCar() {
  135. uni.navigateTo({
  136. url: 'addCar'
  137. })
  138. },
  139. selectCity(item) {
  140. console.log('-您选择的城市-', item)
  141. this.location.cityname = item.name;
  142. this.location.cityCode = item.citycode;
  143. this.cityname = item.name;
  144. console.log(this.location)
  145. uni.setStorage({
  146. key: 'location',
  147. data: this.location,
  148. success: function() {}
  149. });
  150. this.showCity = false;
  151. },
  152. closeModal() {
  153. this.showCity = false
  154. },
  155. bindChange(e) {
  156. console.log(e);
  157. this.time = e.target.value
  158. },
  159. }
  160. }
  161. </script>
  162. <style>
  163. .content {
  164. min-height: 100vh;
  165. background-color: #F4F5F7;
  166. }
  167. .bBannerList {
  168. width: 100%;
  169. height: 300rpx;
  170. background-color: #F4F5F7;
  171. }
  172. .swpImg {
  173. width: 100%;
  174. height: 300rpx;
  175. }
  176. .carMessage {
  177. margin: 24rpx 24rpx 40rpx;
  178. padding-top: 10rpx;
  179. height: 500rpx;
  180. background-color: #FFFFFF;
  181. border-radius: 10rpx;
  182. }
  183. .look4s {
  184. margin: 40rpx 24rpx;
  185. height: 88rpx;
  186. line-height: 88rpx;
  187. text-align: center;
  188. background-color: #FD5300;
  189. border-radius: 10rpx;
  190. color: #FFFFFF;
  191. font-weight: bold;
  192. font-size: 30rpx;
  193. }
  194. .mesView {
  195. display: flex;
  196. align-items: center;
  197. width: 100%;
  198. height: 120rpx;
  199. background-color: #FFFFFF;
  200. }
  201. .leftTitle {
  202. margin: 28rpx;
  203. width: 120rpx;
  204. font-size: 28rpx;
  205. color: #666666;
  206. }
  207. .noSelectColor {
  208. color: #999999;
  209. }
  210. .selectColor {
  211. color: #333333;
  212. }
  213. .rightArrow {
  214. margin-right: 28rpx;
  215. width: 14rpx;
  216. height: 23rpx;
  217. }
  218. .cityBtn {
  219. width: 65%;
  220. font-size: 28rpx;
  221. }
  222. .rightView {
  223. display: flex;
  224. justify-content: space-between;
  225. width: 80%;
  226. }
  227. .plateNumber {
  228. font-size: 28rpx;
  229. }
  230. .carModBtn {
  231. width: 65%;
  232. font-size: 28rpx;
  233. }
  234. .timeBtn {
  235. width: 65%;
  236. font-size: 28rpx;
  237. }
  238. .mileageInput {
  239. width: 20%;
  240. font-size: 28rpx;
  241. }
  242. .kmStr {
  243. font-size: 28rpx;
  244. color: #333333;
  245. }
  246. .changeCarBg {
  247. display: flex;
  248. /* justify-content: flex-start; */
  249. align-items: center;
  250. width: 120rpx;
  251. margin-right: 28rpx;
  252. }
  253. </style>