index.vue 15 KB

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