index.vue 16 KB

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