queryVehicleModel.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="page">
  3. <view class="header dis a-c j-s">
  4. <u-icon name="arrow-left" color="#333" size="18" :bold="true" style="margin-right: 20rpx;"
  5. @click="back"></u-icon>
  6. <u-search placeholder="可使用车架号/品牌型号查询" v-model="keyword" bgColor="#f7f7f7"
  7. :actionStyle="{position: 'absolute',right:'20px',background:'#FDE935',padding:'8rpx 24rpx',boxSiting:'border-box',borderRadius:'100rpx'}"
  8. actionText="查询" @search="search" @custom="custom"></u-search>
  9. </view>
  10. <view class="vehicleModel" v-if="vehicleModelList.length">
  11. <view class="item mb-2" v-for="(item,index) in vehicleModelList" :key="index"
  12. @click="chooseVehicleType(index)">
  13. <text class="title">{{item.modelName}}</text>
  14. <view class="dis a-c f-wrap content">
  15. <text>新车购置价:{{item.replacementValue}}</text>
  16. <text>年款:{{item.marketYear}}</text>
  17. <text>排量:{{item.displacement}}</text>
  18. <text>座位数:{{item.ratedPassengerCapacity}}座</text>
  19. </view>
  20. <view class="colorBlock">
  21. <text class="font-weight">车系</text>
  22. <text class="ml-2 mr-2">{{item.modelCode}}</text>
  23. <text>{{item.series}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. <u-empty v-else mode="car" icon="/static/image/Empty1.png" text="没有查询到数据,可使用品牌型号查询">
  28. </u-empty>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. keyword: '',
  36. vehicleModelList: [],
  37. frameNo: "", //车架号
  38. modelName: "", //车型
  39. }
  40. },
  41. onShow() {
  42. },
  43. async onLoad(options) {
  44. if (options.frameNo) {
  45. this.keyword = options.frameNo;
  46. this.getCarModel(options.frameNo);
  47. } else if (options.modelName) {
  48. this.getBrandModel(options.modelName);
  49. }
  50. },
  51. methods: {
  52. back() {
  53. uni.navigateBack(1)
  54. },
  55. chooseVehicleType(index) {
  56. let pages = getCurrentPages(); //获取所有页面栈实例列表
  57. let nowPage = pages[pages.length - 1]; //当前页页面实例
  58. let prevPage = pages[pages.length - 2]; //上一页页面实例
  59. prevPage.$vm.carInfo.brandName = this.vehicleModelList[index].modelName; //车型
  60. prevPage.$vm.carInfo.modelcname = this.vehicleModelList[index].modelName; //车型
  61. prevPage.$vm.carInfo.carYear = this.vehicleModelList[index].marketYear; //年款
  62. prevPage.$vm.carInfo.seatCount = this.vehicleModelList[index].ratedPassengerCapacity; //座位数
  63. prevPage.$vm.carInfo.purchasePrice = this.vehicleModelList[index].replacementValue; //价格
  64. prevPage.$vm.carInfo.modelCode = this.vehicleModelList[index].modelCode; //车辆型号编码
  65. prevPage.$vm.carInfo.familyName = this.vehicleModelList[index].series; //系列
  66. prevPage.$vm.carInfo.displacement = this.vehicleModelList[index].displacement; //排量
  67. prevPage.$vm.carInfo.energyTypeCode = this.vehicleModelList[index].fuelTypeCode; //燃油种类
  68. prevPage.$vm.carInfo.powerScale = this.vehicleModelList[index].powerScale; //功率
  69. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  70. delta: 1
  71. });
  72. },
  73. search(value) {
  74. if (this.frameNo) {
  75. this.getCarModel(value);
  76. } else if (this.modelName) {
  77. this.getBrandModel(value);
  78. }
  79. },
  80. custom(value) {
  81. if (this.frameNo) {
  82. this.getCarModel(value);
  83. } else if (this.modelName) {
  84. this.getBrandModel(value);
  85. }
  86. },
  87. async getCarModel(cctype) {
  88. let res = await this.$http.get('/order/carModel/vinSearch?frameNo=' + cctype);
  89. this.vehicleModelList = res.data;
  90. },
  91. //品牌型号查询
  92. async getBrandModel(cctype, marketYear) {
  93. let cctypeName = cctype.replace(/[^u4e00-u9fa5|,]+/ig, ''); //去掉中文
  94. let res = await this.$http.post('/order/carModel/modelsQuery', {
  95. modelName: cctypeName,
  96. marketYear: marketYear
  97. });
  98. this.vehicleModelList = res.data;
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .page {
  105. background-color: #F8F8F8;
  106. height: 100vh;
  107. }
  108. .page {
  109. background-color: #f8f8f8;
  110. height: 100vh;
  111. }
  112. .header {
  113. padding: 116rpx 30rpx 16rpx;
  114. box-sizing: border-box;
  115. background-color: #FFFFFF;
  116. position: fixed;
  117. top: 0;
  118. left: 0;
  119. width: 100%;
  120. }
  121. .u-empty {
  122. width: 100%;
  123. position: absolute;
  124. top: 30%;
  125. left: 50%;
  126. transform: translate(-50%);
  127. }
  128. .vehicleModel {
  129. padding: 220rpx 30rpx 20rpx;
  130. .item {
  131. width: 100%;
  132. background: #FFFFFF;
  133. padding: 30rpx;
  134. box-sizing: border-box;
  135. border-radius: 10rpx 10rpx 10rpx 10rpx;
  136. .title {
  137. font-size: 34rpx;
  138. color: #333;
  139. font-weight: bold;
  140. }
  141. .content {
  142. margin: 24rpx 0;
  143. text {
  144. width: 50%;
  145. font-size: 30rpx;
  146. color: #666;
  147. margin-bottom: 16rpx;
  148. }
  149. text:nth-child(3),
  150. text:nth-child(4) {
  151. margin-bottom: 0;
  152. }
  153. }
  154. .colorBlock {
  155. width: 100%;
  156. height: 50rpx;
  157. border-radius: 80rpx 0 0 20rpx;
  158. background: linear-gradient(90deg, #FFF9F1 0%, rgba(255, 249, 241, 0) 100%);
  159. font-size: 30rpx;
  160. color: #333;
  161. padding: 4rpx 30rpx;
  162. box-sizing: border-box;
  163. }
  164. }
  165. }
  166. </style>