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