search.vue 12 KB

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