index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view class="content">
  3. <view class="bigBox">
  4. <!-- <image class="bigImg" src="http://dmsphoto.66km.com.cn/thFiles/A9157023-4939-48B7-BB49-D9D8113EF953.jpg" mode=""></image> -->
  5. <image class="bigImg" src="/static/img/index.png" mode="widthFix"></image>
  6. <view class="ssBox" v-if="bIndex==2">
  7. <view class="ssView" @click="goSearch">
  8. <image class="newSImg" src="/static/img/newS.png" mode=""></image>
  9. <input type="text" class="sInput" placeholder-style="color:#C4C4C4" placeholder="请输入车辆品牌、车系"/>
  10. </view>
  11. </view>
  12. <view class="ssBox" v-if="bIndex==3">
  13. <view class="ssView" >
  14. <image @click="goSearch" class="newSImg" src="/static/img/newS.png" mode=""></image>
  15. <input @click="goSearch" type="text" class="sInput" placeholder-style="color:#C4C4C4" placeholder="请输入VIN码"/>
  16. <image @click="stBtn" class="newSbImg" src="/static/img/newSb.png" mode=""></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="bottomBox">
  21. <view class="bottomLine" @click="bFn(1)">
  22. <image class="indexbg" v-if="bIndex==1" src="/static/img/indexbg.png" mode=""></image>
  23. <span class="bottomLineTxt" :class="{bAciveTxt:bIndex==1}">车型</span>
  24. </view>
  25. <view class="bottomLine" @click="bFn(2)">
  26. <image class="indexbg" v-if="bIndex==2" src="/static/img/indexbg.png" mode=""></image>
  27. <span class="bottomLineTxt" :class="{bAciveTxt:bIndex==2}">搜索</span>
  28. </view>
  29. <view class="bottomLine" @click="bFn(3)">
  30. <image class="indexbg" v-if="bIndex==3" src="/static/img/indexbg.png" mode=""></image>
  31. <span class="bottomLineTxt" :class="{bAciveTxt:bIndex==3}">VIN码</span>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import carModel from './carModel.vue'
  38. import user from './user.vue'
  39. export default {
  40. components: {
  41. carModel, //注册子组件
  42. user
  43. },
  44. //props:['iStatusBarHeight',],
  45. data() {
  46. return {
  47. fileURl: '',
  48. ckCarShow:false,
  49. vinNum:'',
  50. moreVinList:[],
  51. historyList:[],
  52. iStatusBarHeight:'',
  53. openId:'',
  54. aaa:'',
  55. duration:500,
  56. interval:3000,
  57. historyvin:'',
  58. tabIndex:1,
  59. byItem:'',
  60. historyvinLoding:false,
  61. vincarActiveNum:1,
  62. bIndex:2,
  63. }
  64. },
  65. onLoad() {
  66. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  67. //console.log(this.iStatusBarHeight)
  68. var that=this;
  69. this.uniLogin()
  70. /* setTimeout(function(){
  71. that.$refs.carModelView.getdata();
  72. },500) */
  73. var bb= this.iStatusBarHeight + 44 + 'px';
  74. var cc= '520rpx'
  75. this.aaa= `calc(100vh - ${bb} - ${cc})`
  76. },
  77. onShow() {
  78. if(this.openId){
  79. this.queryHistory()
  80. }
  81. },
  82. methods: {
  83. bFn(num){
  84. this.bIndex=num
  85. if(num==1){
  86. uni.navigateTo({
  87. url:'carModel2'
  88. })
  89. }
  90. },
  91. vincarActiveFn(num){
  92. this.vincarActiveNum=num
  93. },
  94. goSgoods(){
  95. uni.navigateTo({
  96. url:'sgoodsList'
  97. })
  98. },
  99. tabFn(num){
  100. this.tabIndex=num
  101. },
  102. goCarModel(){
  103. uni.navigateTo({
  104. url:'carModel2'
  105. })
  106. },
  107. goCarModelType(type){
  108. uni.navigateTo({
  109. url:'carModel2?type='+type
  110. })
  111. },
  112. wy(){
  113. uni.chooseImage({
  114. count: 6, //默认9
  115. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  116. sourceType: ['album'], //从相册选择
  117. success: function (res) {
  118. console.log(JSON.stringify(res.tempFilePaths));
  119. }
  120. });
  121. },
  122. uniLogin(){
  123. var that=this;
  124. uni.login({
  125. provider: 'weixin',
  126. success: function (loginRes) {
  127. console.log(loginRes);
  128. that.getWxOpenID(loginRes)
  129. }
  130. });
  131. },
  132. getWxOpenID(e){
  133. var that=this;
  134. this.$http2('sys/getWxOpenID', {
  135. code:e.code,
  136. },'GET').then(res => {
  137. this.openId=res.data.openId;
  138. uni.setStorage({
  139. key: 'wxdata',
  140. data: res.data,
  141. success: function () {
  142. that.queryHistory()
  143. }
  144. });
  145. })
  146. },
  147. queryHistory(){
  148. this.historyvinLoding=false
  149. this.$http2('queryHistory', {
  150. },'POST').then(res => {
  151. this.historyList=res.data
  152. this.historyList.forEach(item=>{
  153. if(item.vin){
  154. if(!this.historyvin){
  155. this.historyvin=item.vin
  156. this.byItem=item
  157. }
  158. }
  159. })
  160. this.historyvinLoding=true
  161. var bb= this.iStatusBarHeight + 44 + 'px';
  162. var cc='520rpx'
  163. if(this.historyList.length==0){
  164. cc= '240rpx'
  165. }else
  166. if(this.historyList.length==1){
  167. cc= '352rpx'
  168. }else
  169. if(this.historyList.length==2){
  170. cc= '418rpx'
  171. }
  172. this.aaa= `calc(100vh - ${bb} - ${cc})`
  173. })
  174. },
  175. gocarDetail(){
  176. var e=this.byItem
  177. uni.navigateTo({
  178. url:'/pages/index/byItem?nLevelID='+e.nLevelID+'&logo='+e.logo+'&value='+e.title+'&id='+e.groupID+'&isVin='+e.ifVin+'&vin='+e.vin
  179. })
  180. },
  181. gobyItem(e){
  182. var nLevelID=e.nLevelIDs.split(',')[0]
  183. uni.navigateTo({
  184. url:'/pages/index/byItem?nLevelID='+nLevelID+'&logo='+e.carModelInfo.logo+'&value='+e.title+'&id='+e.ids+'&isVin=1&vin='+this.vinNum
  185. })
  186. },
  187. gohistory(){
  188. uni.navigateTo({
  189. url:'/pages/index/history'
  190. })
  191. },
  192. goSearch(){
  193. uni.navigateTo({
  194. url:'/pages/index/search'
  195. })
  196. },
  197. stBtn(){
  198. var that = this;
  199. console.log("识图识图识图识图")
  200. uni.authorize({
  201. scope: 'scope.camera',
  202. success() {
  203. console.log("chengg");
  204. uni.chooseImage({
  205. sourceType: ['album','camera'],
  206. count:1,
  207. success: (chooseImageRes) => {
  208. //console.log(chooseImageRes)
  209. const tempFilePaths = chooseImageRes.tempFilePaths;
  210. this.fileURl=tempFilePaths[0]
  211. uni.showLoading({ title: '加载中'});
  212. uni.uploadFile({
  213. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  214. filePath: tempFilePaths[0],
  215. name: 'photo',
  216. /* formData: {
  217. 'user': 'test'
  218. }, */
  219. success: (uploadFileRes) => {
  220. var data=JSON.parse(uploadFileRes.data);
  221. uni.hideLoading();
  222. if(data.code == 0){
  223. console.log(data.data)
  224. that.vinNum=data.data;
  225. that.queryCarModelGroupByVinAggregation()
  226. }else{
  227. uni.showToast({
  228. title: data.msg,
  229. duration: 3000,
  230. icon:'none',
  231. });
  232. }
  233. //console.log(JSON.parse(uploadFileRes.data).data );
  234. },fail(err) {
  235. uni.hideLoading();
  236. console.log(err)
  237. uni.showToast({
  238. title: '拉取失败',
  239. icon:'none',
  240. duration: 3000,
  241. });
  242. },
  243. complete(obj){
  244. uni.hideLoading();
  245. if(obj.statusCode!=200){
  246. uni.showToast({
  247. title: 'vin扫描失败,请重试',
  248. icon:'none',
  249. duration: 3000,
  250. });
  251. console.log("vin扫描失败,请重试")
  252. }
  253. }
  254. });
  255. },fail(err){
  256. console.log("上传失败")
  257. console.log(err)
  258. }
  259. });
  260. },fail(err) {
  261. uni.showToast({
  262. title: '授权失败',
  263. icon:'none',
  264. duration: 3000,
  265. });
  266. console.log("授权失败")
  267. uni.showModal({
  268. title: '是否重新授权识图功能',
  269. success(res) {
  270. if (res.confirm) {
  271. uni.openSetting({
  272. success() {
  273. console.log('开启权限成功');
  274. },
  275. fail() {
  276. console.log('开启权限失败');
  277. }
  278. });
  279. } else if (res.cancel) {
  280. console.log('拒绝开启开启权限');
  281. }
  282. }
  283. });
  284. }
  285. })
  286. },
  287. queryCarModelGroupByVinAggregation(){
  288. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  289. vin: this.vinNum,type:2
  290. }, 'POST').then(res => {
  291. if(res.code!=1){
  292. this.moreVinList=res.data;
  293. if(this.moreVinList.length>1){
  294. this.ckCarShow=true;
  295. }else{
  296. this.gobyItem(this.moreVinList[0])
  297. }
  298. }
  299. else {
  300. uni.showToast({
  301. title: res.msg,
  302. duration: 3000,
  303. icon:'none',
  304. });
  305. }
  306. })
  307. },
  308. ckcarClose(){
  309. this.ckCarShow=false;
  310. }
  311. },
  312. onShareAppMessage(){
  313. }
  314. }
  315. </script>
  316. <style scoped>
  317. .bottomBox{
  318. width: 100%;
  319. height: 87rpx;
  320. background: #39434F;
  321. position: fixed;
  322. left: 0;
  323. bottom: 0;
  324. padding-bottom: constant(safe-area-inset-bottom);
  325. padding-bottom: env(safe-area-inset-bottom);
  326. display: flex;
  327. z-index: 11;
  328. }
  329. .bottomLine{
  330. width: 250rpx;
  331. line-height: 87rpx;
  332. text-align: center;
  333. font-weight: 400;
  334. font-size: 29rpx;
  335. color: #7A8490;
  336. position: relative;
  337. }
  338. .bAciveTxt{
  339. font-weight: 500;
  340. font-size: 34rpx;
  341. color: #FFFFFF;
  342. position: relative;
  343. z-index: 111;
  344. }
  345. .indexbg{
  346. width: 250rpx;
  347. height: 87rpx;
  348. position: absolute;
  349. top: 0;
  350. left: 0;
  351. }
  352. .bigBox{
  353. width: 100%;
  354. height: 100vh;
  355. position: relative;
  356. /* background: url('http://dmsphoto.66km.com.cn/thFiles/A9157023-4939-48B7-BB49-D9D8113EF953.jpg') no-repeat;
  357. background-size: 100%; */
  358. }
  359. .bigImg{
  360. position: absolute;
  361. width: 100%;
  362. height: 100vh;
  363. top: 0;
  364. left: 0;
  365. }
  366. .ssBox{
  367. width: 676rpx;
  368. background: rgba(0, 0, 0, 0.7);
  369. position: absolute;
  370. left: 37rpx;
  371. top: 200rpx;
  372. padding: 40rpx 0;
  373. }
  374. .ssView{
  375. width: 595rpx;
  376. height: 78rpx;
  377. background: #646464;
  378. display: flex;
  379. margin-left: 40rpx;
  380. }
  381. .newSImg{
  382. width: 40rpx;height: 40rpx;
  383. margin-top: 20rpx;margin-left: 10rpx;
  384. }
  385. .sInput{
  386. height: 78rpx;line-height: 78rpx;padding-left: 20rpx;font-size: 28rpx;
  387. width: 450rpx;
  388. }
  389. .newSbImg{
  390. width: 45rpx;height: 42rpx;
  391. margin-top: 20rpx;
  392. }
  393. /* */
  394. .contBox{
  395. padding: 0 24rpx;
  396. }
  397. .productBox{
  398. height: 520rpx;
  399. background: #FFFFFF;
  400. border-radius: 16rpx;
  401. padding: 30rpx;
  402. margin-top: 20rpx;
  403. }
  404. .productTitle{
  405. font-weight: 500;
  406. font-size: 28rpx;
  407. color: #1A1A1A;
  408. line-height: 40rpx;
  409. }
  410. .productLinBox{
  411. display: flex;justify-content: space-between;
  412. }
  413. .productImg{
  414. width: 125rpx;height: 44rpx;
  415. }
  416. .productLine{
  417. text-align: center;
  418. padding-top: 24rpx;
  419. }
  420. .productTxt{
  421. text-align: center;
  422. font-size: 26rpx;
  423. color: #1A1A1A;
  424. padding-top: 22rpx;
  425. }
  426. .vincar{
  427. background: #FFFFFF;
  428. border-radius: 16rpx;
  429. padding: 24rpx 30rpx;
  430. }
  431. .vincarTab{
  432. display: flex;
  433. }
  434. .vincarTabLine{
  435. font-size: 26rpx;
  436. color: #333333;
  437. line-height: 37rpx;
  438. }
  439. .anVin{
  440. font-weight: 500;
  441. font-size: 28rpx;
  442. margin-right: 50rpx;
  443. }
  444. .vincarActive{
  445. color: #FF4F00;border-bottom: 4rpx solid #FF4F00;
  446. }
  447. .inputsBox{
  448. border-radius: 10rpx;
  449. border: 2rpx solid #FF4F00;
  450. padding: 8rpx;
  451. display: flex;justify-content: space-between;
  452. margin-top: 27rpx;
  453. }
  454. .inputsBtn{
  455. width: 108rpx;
  456. height: 58rpx;
  457. background: #FF4F00;
  458. border-radius: 6rpx;
  459. text-align: center;
  460. line-height: 58rpx;
  461. font-size: 26rpx;
  462. color: #FFFFFF;
  463. }
  464. .lanjt{
  465. width: 8rpx;height: 15rpx;
  466. margin-top: 20rpx;margin-left: 6rpx;
  467. }
  468. .historyLeft{
  469. display: flex;
  470. font-size: 24rpx;
  471. color: #999999;
  472. }
  473. .historyLeftNum{
  474. height: 50rpx;
  475. background: #FAFAFA;
  476. padding: 0 10rpx;line-height: 50rpx;
  477. }
  478. .historyLeftTxt{
  479. line-height: 50rpx;
  480. }
  481. .historyMore{
  482. line-height: 50rpx;color: #3E86F0;font-size: 24rpx;display: flex;
  483. }
  484. .historyBox{
  485. display: flex;justify-content: space-between;padding-top: 24rpx;
  486. }
  487. .swpBox{
  488. height: 400rpx;
  489. }
  490. .swiperTk{
  491. height: 400rpx;
  492. }
  493. .swiper-itemTk{
  494. padding-top: 20rpx;text-align: center;
  495. overflow: hidden;height: 360rpx;
  496. }
  497. .tkHdImg{
  498. width: 702rpx;height: 360rpx;
  499. }
  500. .aaaaa{
  501. width: 500rpx;
  502. background-color: #1A1A1A;
  503. }
  504. .ckcarJtimg{
  505. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  506. }
  507. .ckcarlineBox{
  508. padding:24rpx ;
  509. border-bottom: 1px solid #EEEEEE;
  510. }
  511. .ckcarLeft{
  512. font-weight: 400;line-height: 36rpx;
  513. color: #1A1A1A;font-size: 26rpx;
  514. }
  515. .ckcarBox{
  516. width: 100vw;height: 100vh;
  517. background:rgba(0, 0, 0, 0.4) ;
  518. position: fixed;top: 0;left: 0;
  519. }
  520. .ckcar{
  521. width: 750rpx;
  522. height: 772rpx;
  523. background: #FFFFFF;
  524. border-radius: 24rpx 24rpx 0rpx 0rpx;
  525. position: absolute;
  526. left: 0;
  527. bottom: 0;
  528. }
  529. .ckcarClose{
  530. width: 30rpx;height: 30rpx;
  531. }
  532. .ckcarTitle{
  533. font-weight: 500;font-size: 28rpx;
  534. color: #1A1A1A;
  535. line-height: 40rpx;
  536. }
  537. .ckcarTop{
  538. padding: 40rpx 26rpx 20rpx 24rpx;
  539. }
  540. .content{
  541. min-height: 100vh;background: #F4F5F7;
  542. }
  543. .top{
  544. width: 100%;height: 385rpx;
  545. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  546. background-size: 100% 100%;
  547. }
  548. .topNavBox{
  549. background: #FFFFFF;
  550. width: 750rpx;
  551. position: fixed;
  552. top: 0;
  553. left: 0;
  554. z-index: 111;
  555. color: #333333;
  556. }
  557. .searchInputBox{
  558. width: 550rpx;display: flex;
  559. height: 58rpx;
  560. background: #FFFFFF;
  561. border-radius: 16rpx;
  562. }
  563. .simg{
  564. width: 34rpx;height: 34rpx;margin-top: 13rpx;margin-left:30rpx;
  565. }
  566. .stimg{
  567. width: 44rpx;height: 44rpx;
  568. }
  569. .searchBox{
  570. display: flex;padding: 20rpx 24rpx;
  571. justify-content: space-between;
  572. padding-right: 0rpx;
  573. }
  574. .st{
  575. text-align: center;padding-left: 20rpx;padding-right: 24rpx;
  576. }
  577. .ssinput{
  578. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 58rpx;height: 58rpx;
  579. width: 450rpx;
  580. }
  581. .ip{
  582. color: #999999;
  583. }
  584. .shitu{
  585. font-weight: 400;
  586. color: #FFFFFF;font-size: 22rpx;
  587. }
  588. .historybox{
  589. padding: 0 18rpx; margin-top: -88rpx;
  590. }
  591. .history{
  592. background: #FFFFFF;
  593. border-radius: 16rpx;
  594. padding: 20rpx;padding-bottom: 0;
  595. }
  596. .jiantouimg{
  597. width: 26rpx;height: 26rpx;margin-top: 7rpx;
  598. }
  599. .historyTop{
  600. display: flex;justify-content: space-between;
  601. padding-bottom: 30rpx;
  602. }
  603. .historyTitle{
  604. font-weight: 500;font-size: 28rpx;
  605. color: #1A1A1A;line-height: 40rpx;
  606. }
  607. .historylinecarImg{
  608. width: 54rpx;
  609. height: 54rpx;
  610. }
  611. .historylinecar{
  612. font-weight: 400;font-size: 26rpx;
  613. color: #1A1A1A;
  614. line-height: 46rpx;width: 576rpx;
  615. }
  616. .historyLine{
  617. display: flex;justify-content: space-between;
  618. padding: 15rpx 0;border-top: 1rpx solid #EEEEEE;
  619. }
  620. .indexnav{
  621. height: 44px;
  622. line-height: 44px;
  623. text-align: center;
  624. font-size: 36rpx;
  625. /* color: #FFFFFF; */
  626. }
  627. .historyLogoBox{
  628. display: flex;align-items: center;
  629. }
  630. .bTabBox{
  631. width: 100vw;
  632. position: fixed;
  633. left: 0;
  634. bottom: 0;
  635. background: #FFFFFF;
  636. box-shadow: 0rpx -2rpx 16rpx 0rpx rgba(153,153,153,0.2);
  637. padding-bottom: constant(safe-area-inset-bottom);
  638. padding-bottom: env(safe-area-inset-bottom);
  639. display: flex;
  640. justify-content: space-around;
  641. }
  642. .btabLineImg{
  643. width: 42rpx;height: 42rpx;
  644. }
  645. .btabLineTxt{
  646. font-weight: 400;
  647. font-size: 22rpx;
  648. color: #1A1A1A;
  649. }
  650. .btabLine{
  651. padding-top: 21rpx;
  652. }
  653. .btabLineImg2{
  654. width: 140rpx;height: 140rpx;
  655. margin-top: -70rpx;
  656. }
  657. </style>