index.vue 16 KB

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