search.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view class="content">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'搜索'"></homenav>
  4. <view class="sTopBox">
  5. <view class="searchInputBox" >
  6. <image src="../../static/img/icon_search.png" mode="" class="simg"></image>
  7. <input v-model="value" type="text" placeholder="请输入车辆品牌、车系或VIN码"
  8. placeholder-class="ip" ref="myInput"
  9. class="ssinput" @confirm="searchFn" :focus="focuszt">
  10. <image src="../../static/img/icon_search_del.png" mode="" class="search_del" @click="searchDel"></image>
  11. </view>
  12. <view class="searchBtn" @click="searchFn">
  13. 搜索
  14. </view>
  15. </view>
  16. <view class="box">
  17. <view class="historyLine" v-for="(item,index) in carMlist">
  18. <!-- <image src="http://img.db.66km.cn/carbrandlogo/B - 宝马.png" mode="" class="historylinecarImg"></image> -->
  19. <view class="historylinecar" @click="carMbtn(item)">{{item.title}}</view>
  20. </view>
  21. <nodata v-if="loading&&carMlist.length==0"></nodata>
  22. </view>
  23. <!-- 选择车型 -->
  24. <view class="ckcarBox" v-if="ckCarShow">
  25. <view class="ckcar">
  26. <view class="ckcarTop flex">
  27. <view class="ckcarTitle">请选择车型</view>
  28. <image src="../../static/img/icon_quxiao.png" mode="" class="ckcarClose" @click="ckcarClose"></image>
  29. </view>
  30. <view class="ckcarlineBox" v-for="(item,index) in vinList" @click="goDetal(item)">
  31. <view class="ckcarline flex" >
  32. <view class="ckcarLeft">{{item.title}}</view>
  33. <image src="../../static/img/icon_arrow.png" mode="" class="ckcarJtimg"></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="popupone" @click="popupc" v-if="popuponeShow">
  39. <view class="popup-content" @click.stop="">
  40. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  41. <view style="height: 44px;"></view>
  42. <view style="padding: 24rpx 0;">
  43. <view class="manufactorP">{{manufactor}}</view>
  44. </view>
  45. <scroll-view class="brandList" scroll-y="true">
  46. <view class="pLine" v-for="(item,index) in popuponeList" @click="popuponeBtn(item)">{{item.title}}</view>
  47. </scroll-view>
  48. </view>
  49. </view>
  50. <view class="popupone popupTwo" @click="popupcTwo" v-if="popupTwoShow">
  51. <view class="popup-content" @click.stop="">
  52. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  53. <view style="height: 44px;"></view>
  54. <view style="">
  55. <!-- <view class="manufactorP">{{displacement}}</view> -->
  56. <view class="manufactorPTow"> <span>{{displacement}}</span>
  57. <span @click="poneHide">上一步</span>
  58. </view>
  59. </view>
  60. <scroll-view class="brandList" scroll-y="true">
  61. <view class="pLine" v-for="(item,index) in displacementList" @click="goDetalcx(item)">{{item.displacement}}</view>
  62. </scroll-view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import homenav from "../../components/homenav/nav.vue"
  69. import nodata from '../../components/nodata/nodata.vue'
  70. export default {
  71. components: {
  72. homenav,nodata
  73. },
  74. data() {
  75. return {
  76. value:'',
  77. ckCarShow:false,
  78. vinList:[],
  79. carMlist:[],
  80. carMshow:false,
  81. popuponeShow:false,
  82. popuponeList:[],
  83. manufactor:'',
  84. displacementList:'',
  85. type:'',
  86. popupTwoShow:false,
  87. displacement:'',
  88. brand:'',
  89. carSeries:'',
  90. isVin:'',
  91. vin:'',
  92. iStatusBarHeight:'',
  93. focusKuwei:false,
  94. loading:false,
  95. bizType:'',
  96. carModel:'',
  97. focuszt:false,
  98. }
  99. },
  100. onLoad(opt) {
  101. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  102. var that=this;
  103. setTimeout(() => {
  104. this.focusKuwei=true;
  105. }, 500)
  106. /* this.$nextTick(() => {
  107. this.$refs.myInput.focus();
  108. }); */
  109. },
  110. onReady() {
  111. // 确保在渲染完成后触发
  112. this.$nextTick(() => {
  113. this.focuszt = true;
  114. });
  115. },
  116. methods: {
  117. searchDel(){
  118. console.log("清除")
  119. this.value=''
  120. },
  121. goDetal(e){
  122. /* uni.navigateTo({
  123. url:'/pages/index/byItem?nLevelID='+e.carModelInfo.nLevelID+'&logo='+e.carModelInfo.logo+'&isVin='+this.isVin+'&value='+e.value+'&id='+e.ids+'&vin='+this.vin
  124. }) */
  125. uni.navigateTo({
  126. url:'/pages/index/goodsList?nLevelID='+e.carModelInfo.nLevelID+'&logo='+e.carModelInfo.logo+'&isVin='+this.isVin+'&value='+e.value+'&id='+e.ids+'&vin='+this.vin
  127. })
  128. },
  129. goDetalcx(e){
  130. console.log(e)
  131. /* uni.navigateTo({
  132. url:'/pages/index/byItem?scarid='+e.id
  133. }) */
  134. uni.navigateTo({
  135. url:'/pages/index/goodsList?scarid='+e.id
  136. })
  137. },
  138. carMbtn(e){
  139. this.type=e.type;
  140. if(e.type==1){
  141. this.manufactor=e.manufactor;
  142. this.getpopuponeList()
  143. }else{
  144. this.brand=e.brand
  145. this.carSeries=e.carSeries
  146. this.manufactor=e.manufactor
  147. this.carModel=e.carModel
  148. this.bizType=e.bizType
  149. this.getpopuponeList(e)
  150. }
  151. },
  152. popuponeBtn(item){
  153. this.displacementList=item.displacementList;
  154. this.displacement=item.title;
  155. this.popupTwoShow=true;
  156. console.log( this.displacementList)
  157. },
  158. poneHide(){
  159. this.popupTwoShow=false;
  160. },
  161. popupcTwo(){
  162. this.popupTwoShow=false;
  163. },
  164. getpopuponeList(e){
  165. uni.showLoading({ title: '加载中'});
  166. if(this.type==1){
  167. var params={
  168. manufactor: this.manufactor,type:this.type
  169. }
  170. this.$http('matchingByOpen/queryCarModelGroupIiPackageSecond', params,'POST').then(res => {
  171. uni.hideLoading();
  172. this.popuponeList=res.data;
  173. this.popuponeShow=true;
  174. })
  175. }else if(this.type==2){
  176. var params={
  177. manufactor: this.manufactor,type:this.type,carSeries:this.carSeries,brand:this.brand,
  178. bizType:this.bizType,carModel:this.carModel
  179. }
  180. this.$http('matchingByOpen/queryCarModelGroupIiPackageSecond', params,'POST').then(res => {
  181. uni.hideLoading();
  182. this.popuponeList=res.data;
  183. this.popuponeShow=true;
  184. })
  185. }else{
  186. uni.hideLoading();
  187. console.log(e)
  188. this.displacementList=e.displacementList;
  189. this.popupTwoShow=true;
  190. }
  191. },
  192. popupc(){
  193. this.popuponeShow=false;
  194. },
  195. searchFn(){
  196. console.log(this.value.length)
  197. if(!this.value){
  198. uni.showToast({
  199. title: '请输入车辆品牌、车系或VIN码',
  200. icon:'none',
  201. duration: 3000,
  202. });
  203. return false
  204. }
  205. if(this.value.length==17){
  206. uni.showLoading({ title: '加载中'});
  207. this.isVin=1;
  208. this.vin=this.value;
  209. this.vinList=[];
  210. this.loading=false;
  211. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  212. vin: this.value,type:2
  213. },'POST').then(res => {
  214. this.loading=true;
  215. if(res.code==0){
  216. uni.hideLoading();
  217. this.vinList=res.data;
  218. if(this.vinList.length==1){
  219. this.goDetal(this.vinList[0])
  220. }else{
  221. this.ckCarShow=true;
  222. this.carMshow=false;
  223. }
  224. }
  225. })
  226. }else{
  227. uni.showLoading({ title: '加载中'});
  228. this.isVin=0;
  229. this.vin='';
  230. this.loading=false;
  231. this.$http('matchingByOpen/queryCarModelGroupIiPackage', {
  232. name: this.value,
  233. },'POST').then(res => {
  234. uni.hideLoading();
  235. this.loading=true;
  236. this.carMlist=res.data;
  237. this.carMshow=true;
  238. this.ckCarShow=false;
  239. })
  240. }
  241. },
  242. ckcarClose(){
  243. this.ckCarShow=false;
  244. }
  245. }
  246. }
  247. </script>
  248. <style scoped>
  249. .manufactorP{
  250. line-height: 69rpx;padding-left: 24rpx;
  251. width: 504rpx;margin-left: 30rpx;
  252. height: 69rpx;
  253. /* background: #FF4F00 linear-gradient(132deg, #FF8635 0%, #FF4828 100%); */
  254. border-radius: 16rpx;
  255. font-weight: 500;
  256. color: #FFFFFF;font-size: 28rpx;
  257. background: #254A90;
  258. }
  259. .manufactorPTow{
  260. line-height: 69rpx;padding-left: 24rpx;
  261. padding-right: 24rpx;display: flex;
  262. justify-content: space-between;
  263. /* background: #FF4F00 linear-gradient(132deg, #FF8635 0%, #FF4828 100%); */
  264. font-weight: 500;
  265. color: #FFFFFF;font-size: 28rpx;
  266. background: #254A90;
  267. }
  268. .brandList{
  269. height: calc(100vh - 200rpx);
  270. /* padding-bottom:var(--status-bar-height); */
  271. }
  272. .pLine{
  273. border-bottom: 1rpx solid #EEEEEE;
  274. font-weight: 400;
  275. color: #333333;font-size: 26rpx;
  276. padding: 30rpx 24rpx;
  277. }
  278. .popupone{
  279. width: 100vw;height: 100vh;
  280. background:rgba(0, 0, 0, 0.4) ;
  281. position: fixed;top: 0;left: 0;
  282. z-index: 11;
  283. }
  284. .popupTwo{
  285. z-index: 111;
  286. }
  287. .popup-content{
  288. width: 80vw;
  289. background: #FFFFFF;
  290. height: 100vh;
  291. margin-left: 20vw;
  292. }
  293. .ckcarJtimg{
  294. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  295. }
  296. .ckcarlineBox{
  297. padding:24rpx ;
  298. border-bottom: 1px solid #EEEEEE;
  299. }
  300. .ckcarLeft{
  301. font-weight: 400;line-height: 36rpx;
  302. color: #1A1A1A;font-size: 26rpx;
  303. }
  304. .ckcarBox{
  305. width: 100vw;height: 100vh;
  306. background:rgba(0, 0, 0, 0.4) ;
  307. position: fixed;top: 0;left: 0;
  308. }
  309. .ckcar{
  310. width: 750rpx;
  311. height: 772rpx;
  312. background: #FFFFFF;
  313. border-radius: 24rpx 24rpx 0rpx 0rpx;
  314. position: absolute;
  315. left: 0;
  316. bottom: 0;
  317. }
  318. .ckcarClose{
  319. width: 30rpx;height: 30rpx;
  320. }
  321. .ckcarTitle{
  322. font-weight: 500;font-size: 28rpx;
  323. color: #1A1A1A;
  324. line-height: 40rpx;
  325. }
  326. .ckcarTop{
  327. padding: 40rpx 26rpx 20rpx 24rpx;
  328. }
  329. .box{
  330. padding: 0 24rpx;
  331. }
  332. .sTopBox{
  333. display: flex;padding: 30rpx 24rpx;
  334. }
  335. .searchBtn{
  336. font-weight: 400;font-size: 28rpx;padding-left: 24rpx;
  337. color: #1A1A1A;line-height: 80rpx;
  338. }
  339. .searchInputBox{
  340. width: 622rpx;display: flex;
  341. height: 80rpx;position: relative;
  342. background: #F9F9F9;
  343. border-radius: 16rpx;
  344. }
  345. .ssinput{
  346. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  347. width: 480rpx;
  348. }
  349. .search_del{
  350. width: 36rpx;height: 36rpx;padding-top: 23rpx;padding-bottom: 10px;padding-right: 10rpx;
  351. position: absolute;
  352. right: 0;
  353. }
  354. .simg{
  355. width: 36rpx;height: 34rpx;margin-top: 23rpx;margin-left:30rpx;
  356. }
  357. .historylinecarImg{
  358. width: 46rpx;
  359. height: 46rpx;
  360. }
  361. .historylinecar{
  362. font-weight: 400;font-size: 26rpx;
  363. color: #1A1A1A;
  364. line-height: 37rpx;width: 636rpx;
  365. }
  366. .historyLine{
  367. display: flex;justify-content: space-between;
  368. padding: 30rpx 0;border-bottom: 1rpx solid #EEEEEE;
  369. }
  370. </style>