search.vue 12 KB

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