cailist.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="box">
  3. <view class="carlistBox">
  4. <view class="line" v-for="(item,index) in carList" @click="itemClick(item)">
  5. <view class="lineCont">
  6. <view>
  7. <image :src="item.brandLogo" mode="widthFix" class="brandLogo"></image>
  8. </view>
  9. <view style="padding-left: 29rpx;">
  10. <view class="carName">
  11. <span>{{item.brand}} {{item.series}}</span>
  12. <view class="plateNumber">{{item.plateNumber}}</view>
  13. </view>
  14. <view class="carMS">{{item.carModel}}</view>
  15. </view>
  16. </view>
  17. <view class="lineBottom">
  18. <view class="lineDel" @click.stop="delCar(item.id)">删除</view>
  19. <view class="lineDel" @click.stop="editCar(item.id)">编辑</view>
  20. <view class="Default" v-show="item.isDefault!=1" @click.stop="defaultCar(item)">设为默认</view>
  21. <view class="DefaultYES" v-show="item.isDefault==1">已设为默认</view>
  22. </view>
  23. <view class="DefaultIcon" v-show="item.isDefault==1">默认</view>
  24. </view>
  25. </view>
  26. <view v-if="carList==''&&loding" class="nodataBox">
  27. <image src="http://dmsphoto.66km.com.cn/thFiles/3C95A4C5-73F8-4B34-902B-703B8A0825C9.png" mode="widthFix" class="nodataImg"></image>
  28. <view class="noTxt">暂无数据</view>
  29. </view>
  30. <view class="bottomView">
  31. <view class="saveCar" @click="addBtn">
  32. <!-- <image src="../../../static/img/icon_tianjiacheliang.png" mode=""
  33. style="width: 44rpx; height: 36rpx; margin-right: 10rpx;"></image> -->
  34. <view>添加爱车</view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. carList: '',
  44. loding: false,
  45. type: '',
  46. carId: '',
  47. fromMe: false,
  48. }
  49. },
  50. onLoad(opt) {
  51. this.$common.isUserId()
  52. this.type = opt.type;
  53. // console.log(this.type)
  54. this.fromMe = opt.fromMe
  55. },
  56. onShow() {
  57. this.getqueryMyBMemberCar();
  58. this.carId = uni.getStorageSync("maintainCarData").id
  59. },
  60. methods: {
  61. getqueryMyBMemberCar() {
  62. uni.showLoading({
  63. title: '加载中'
  64. })
  65. this.loding = false;
  66. this.$http('opencarOwnerHome/queryCarInfoList', {
  67. }, 'GET').then(res => {
  68. uni.hideLoading();
  69. this.carList = res.data;
  70. this.loding = true;
  71. })
  72. },
  73. addBtn() {
  74. uni.navigateTo({
  75. url: 'addCar'
  76. })
  77. // var length = this.carList.length
  78. // if (length > 4) {
  79. // uni.showToast({
  80. // title: '库最多放五辆车,如果想添加,请先删除',
  81. // icon: 'none',
  82. // duration: 3000
  83. // });
  84. // } else {
  85. // uni.navigateTo({
  86. // url: 'addCar'
  87. // })
  88. // }
  89. },
  90. editCar(id) {
  91. uni.navigateTo({
  92. url: 'addCar?id=' + id + '&isEditCar=true'
  93. })
  94. },
  95. delCar(id) {
  96. var that = this;
  97. uni.showModal({
  98. title: '提示',
  99. content: '确定要删除车辆吗',
  100. success: function(res) {
  101. if (res.confirm) {
  102. uni.showLoading({});
  103. that.$http('worldKeepCar/worldHome/deleteTMemberCar', {
  104. id: id
  105. }, 'POST').then(res => {
  106. uni.hideLoading();
  107. if (res.code == 0) {
  108. if (that.carId == id) {
  109. uni.removeStorageSync('maintainCarData');
  110. }
  111. }
  112. that.getqueryMyBMemberCar()
  113. })
  114. } else if (res.cancel) {
  115. }
  116. }
  117. });
  118. },
  119. defaultCar(item) {
  120. var that = this;
  121. uni.showLoading({
  122. title: '保存中'
  123. })
  124. that.$http('worldKeepCar/worldHome/updateTCarIsdefault', {
  125. id: item.id
  126. }, 'POST').then(res => {
  127. uni.hideLoading();
  128. if (res.code == 0) {
  129. uni.showToast({
  130. title: '操作成功',
  131. icon: 'none',
  132. duration: 3000
  133. });
  134. } else {
  135. uni.showToast({
  136. title: res.msg,
  137. icon: 'none',
  138. duration: 3000
  139. });
  140. }
  141. that.getqueryMyBMemberCar()
  142. })
  143. },
  144. itemClick(item) {
  145. if (this.fromMe == 'true') {
  146. return
  147. }
  148. uni.setStorage({
  149. key: 'maintainCarData',
  150. data: item,
  151. success: function() {
  152. uni.navigateBack({
  153. delta: 1
  154. })
  155. }
  156. });
  157. }
  158. }
  159. }
  160. </script>
  161. <style scoped>
  162. .box {
  163. min-height: 100vh;
  164. background: #F4F5F7;
  165. }
  166. .nodataImg {
  167. width: 400rpx;
  168. padding-top: 100rpx;
  169. }
  170. .noTxt {
  171. font-size: 36rpx;
  172. color: #999999;
  173. padding-top: 50rpx;
  174. }
  175. .nodataBox {
  176. text-align: center;
  177. }
  178. .bottomView {
  179. background-color: #FFFFFF;
  180. width: 100%;
  181. height: 120rpx;
  182. position: fixed;
  183. bottom: 0rpx;
  184. padding-bottom: constant(safe-area-inset-bottom);
  185. padding-bottom: env(safe-area-inset-bottom);
  186. }
  187. .saveCar {
  188. background: linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
  189. margin: 23rpx 30rpx;
  190. height: 74rpx;
  191. border-radius: 37rpx;
  192. color: #FFFFFF;
  193. font-size: 30rpx;
  194. font-weight: bold;
  195. align-items: center;
  196. display: flex;
  197. justify-content: center;
  198. }
  199. .carlistBox {
  200. padding-bottom: 120rpx;
  201. }
  202. .carlistBox {
  203. padding: 24rpx;
  204. padding-bottom: 120rpx;
  205. }
  206. .brandLogo {
  207. width: 63rpx;
  208. }
  209. .line {
  210. background: #FFFFFF;
  211. padding: 27rpx 20rpx;
  212. border-radius: 10rpx;
  213. margin-bottom: 20rpx;
  214. position: relative;
  215. }
  216. .lineCont {
  217. display: flex;
  218. }
  219. .carName {
  220. color: #3C3C3C;
  221. font-size: 30rpx;
  222. display: flex;
  223. }
  224. .plateNumber {
  225. border-radius: 4px;
  226. border: 1px solid #F19D01;
  227. height: 32rpx;
  228. line-height: 32rpx;
  229. padding: 0 10rpx;
  230. color: #F19D01;
  231. font-size: 22rpx;
  232. margin-left: 20rpx;
  233. margin-top: 5rpx;
  234. }
  235. .carMS {
  236. color: #666666;
  237. font-size: 26rpx;
  238. padding-top: 5px;
  239. }
  240. .lineBottom {
  241. display: flex;
  242. justify-content: flex-end;
  243. padding-top: 20rpx;
  244. }
  245. .lineDel {
  246. width: 94rpx;
  247. height: 50rpx;
  248. border-radius: 25rpx;
  249. border: 1px solid #DDDDDD;
  250. text-align: center;
  251. line-height: 50rpx;
  252. font-size: 26rpx;
  253. color: #3C3C3C;
  254. margin-right: 29rpx;
  255. }
  256. .Default {
  257. width: 148rpx;
  258. height: 50rpx;
  259. border-radius: 25rpx;
  260. border: 1px solid #FF4F00;
  261. line-height: 50rpx;
  262. text-align: center;
  263. color: #FF4F00;
  264. font-size: 26rpx;
  265. }
  266. .DefaultYES {
  267. width: 148rpx;
  268. height: 50rpx;
  269. border-radius: 25rpx;
  270. border: 1px solid #DDDDDD;
  271. line-height: 50rpx;
  272. text-align: center;
  273. color: #999999;
  274. font-size: 26rpx;
  275. }
  276. .DefaultIcon {
  277. position: absolute;
  278. top: 0;
  279. right: 0;
  280. width: 109rpx;
  281. height: 40rpx;
  282. background: linear-gradient(131deg, #FFA72C 0%, #FF450F 100%);
  283. border-radius: 0px 10rpx 0px 10rpx;
  284. text-align: center;
  285. line-height: 40rpx;
  286. color: #FFFFFF;
  287. font-size: 22rpx;
  288. }
  289. </style>