index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="topNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="indexnav">雨刮查询</view>
  7. </view>
  8. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  9. <view style="height: 43px;"></view>
  10. <view class="searchBox">
  11. <view class="searchInputBox" @click="goSearch">
  12. <image src="../../static/img/icon_search.png" mode="" class="simg"></image>
  13. <input type="text" placeholder="请输入车辆品牌、车系或VIN码" placeholder-class="ip" class="ssinput">
  14. </view>
  15. <view class="st" @click="stBtn">
  16. <image src="../../static/img/icon_shitu.png" mode="" class="stimg"></image>
  17. <!-- <image src="http://139.196.183.144/0.jpg" mode="" class="stimg"></image> -->
  18. <!-- http://139.196.183.144/0.jpg-->
  19. <view class="shitu">识图</view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 历史查询 -->
  24. <view class="historybox ">
  25. <view class="history">
  26. <view class="historyTop" @click="gohistory">
  27. <view class="historyTitle">历史查询</view>
  28. <image src="../../static/img/icon_arrow.png" mode="" class="jiantouimg"></image>
  29. </view>
  30. <view class="historyLine" v-for="(item,index) in historyList" v-if="index<3" @click="gocarDetail(item)">
  31. <view class="historyLogoBox">
  32. <image :src="item.logo" mode="" class="historylinecarImg"></image>
  33. </view>
  34. <view class="historylinecar">{{item.title}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- <view :style="{height: aaa}" class="aaaaa"></view> -->
  39. <carModel ref="carModelView" :iStatusBarHeight="iStatusBarHeight" :svHeight="aaa"></carModel>
  40. <!-- 选择车型 -->
  41. <view class="ckcarBox" v-if="ckCarShow" >
  42. <view class="ckcar" @click.stop="">
  43. <view class="ckcarTop flex">
  44. <view class="ckcarTitle">请选择车型</view>
  45. <image src="../../static/img/icon_quxiao.png" mode="" class="ckcarClose" @click="ckcarClose"></image>
  46. </view>
  47. <view class="ckcarlineBox" v-for="(item,index) in moreVinList" @click="gobyItem(item)">
  48. <view class="ckcarline flex">
  49. <view class="ckcarLeft">{{item.title}}</view>
  50. <image src="../../static/img/icon_arrow.png" mode="" class="ckcarJtimg"></image>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import carModel from './carModel.vue'
  59. export default {
  60. components: {
  61. carModel, //注册子组件
  62. },
  63. data() {
  64. return {
  65. fileURl: '',
  66. ckCarShow:false,
  67. vinNum:'',
  68. moreVinList:[],
  69. historyList:[],
  70. iStatusBarHeight:'',
  71. openId:'',
  72. aaa:'',
  73. }
  74. },
  75. onLoad() {
  76. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  77. var that=this;
  78. this.uniLogin()
  79. setTimeout(function(){
  80. that.$refs.carModelView.getdata();
  81. },500)
  82. var bb= this.iStatusBarHeight + 44 + 'px';
  83. var cc= '520rpx'
  84. this.aaa= `calc(100vh - ${bb} - ${cc})`
  85. },
  86. onShow() {
  87. if(this.openId){
  88. this.queryHistory()
  89. }
  90. },
  91. methods: {
  92. uniLogin(){
  93. var that=this;
  94. uni.login({
  95. provider: 'weixin',
  96. success: function (loginRes) {
  97. console.log(loginRes);
  98. that.getWxOpenID(loginRes)
  99. }
  100. });
  101. },
  102. getWxOpenID(e){
  103. var that=this;
  104. this.$http2('sys/getWxOpenID', {
  105. code:e.code,
  106. },'GET').then(res => {
  107. this.openId=res.data.openId;
  108. uni.setStorage({
  109. key: 'wxdata',
  110. data: res.data,
  111. success: function () {
  112. that.queryHistory()
  113. }
  114. });
  115. })
  116. },
  117. queryHistory(){
  118. this.$http2('queryHistory', {
  119. },'POST').then(res => {
  120. this.historyList=res.data
  121. var bb= this.iStatusBarHeight + 44 + 'px';
  122. var cc='520rpx'
  123. if(this.historyList.length==0){
  124. cc= '240rpx'
  125. }else
  126. if(this.historyList.length==1){
  127. cc= '352rpx'
  128. }else
  129. if(this.historyList.length==2){
  130. cc= '418rpx'
  131. }
  132. this.aaa= `calc(100vh - ${bb} - ${cc})`
  133. })
  134. },
  135. gocarDetail(e){
  136. uni.navigateTo({
  137. url:'/pages/index/byItem?nLevelID='+e.nLevelID+'&logo='+e.logo+'&value='+e.title+'&id='+e.groupID+'&isVin='+e.ifVin+'&vin='+e.vin
  138. })
  139. },
  140. gobyItem(e){
  141. var nLevelID=e.nLevelIDs.split(',')[0]
  142. uni.navigateTo({
  143. url:'/pages/index/byItem?nLevelID='+nLevelID+'&logo='+e.carModelInfo.logo+'&value='+e.title+'&id='+e.ids+'&isVin=1&vin='+this.vinNum
  144. })
  145. },
  146. gohistory(){
  147. uni.navigateTo({
  148. url:'/pages/index/history'
  149. })
  150. },
  151. goSearch(){
  152. uni.navigateTo({
  153. url:'/pages/index/search'
  154. })
  155. },
  156. stBtn(){
  157. var that = this;
  158. console.log("识图识图识图识图")
  159. uni.authorize({
  160. scope: 'scope.camera',
  161. success() {
  162. console.log("chengg");
  163. uni.chooseImage({
  164. sourceType: ['album','camera'],
  165. count:1,
  166. success: (chooseImageRes) => {
  167. console.log(chooseImageRes)
  168. const tempFilePaths = chooseImageRes.tempFilePaths;
  169. this.fileURl=tempFilePaths[0]
  170. uni.showLoading({ title: '加载中'});
  171. uni.uploadFile({
  172. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  173. filePath: tempFilePaths[0],
  174. name: 'photo',
  175. /* formData: {
  176. 'user': 'test'
  177. }, */
  178. success: (uploadFileRes) => {
  179. var data=JSON.parse(uploadFileRes.data);
  180. uni.hideLoading();
  181. if(data.code!=1){
  182. console.log(data.data)
  183. that.vinNum=data.data;
  184. that.queryCarModelGroupByVinAggregation()
  185. }else{
  186. uni.showToast({
  187. title: data.msg,
  188. duration: 3000,
  189. icon:'none',
  190. });
  191. }
  192. //console.log(JSON.parse(uploadFileRes.data).data );
  193. },fail(err) {
  194. console.log(err)
  195. uni.showToast({
  196. title: '拉取失败',
  197. icon:'none',
  198. duration: 3000,
  199. });
  200. },
  201. complete(obj){
  202. uni.hideLoading();
  203. if(obj.statusCode!=200){
  204. uni.showToast({
  205. title: 'vin扫描失败,请重试',
  206. icon:'none',
  207. duration: 3000,
  208. });
  209. console.log("vin扫描失败,请重试")
  210. }
  211. }
  212. });
  213. },fail(err){
  214. console.log("上传失败")
  215. console.log(err)
  216. }
  217. });
  218. },fail(err) {
  219. uni.showToast({
  220. title: '授权失败',
  221. icon:'none',
  222. duration: 3000,
  223. });
  224. console.log("授权失败")
  225. uni.showModal({
  226. title: '是否重新授权识图功能',
  227. success(res) {
  228. if (res.confirm) {
  229. uni.openSetting({
  230. success() {
  231. console.log('开启权限成功');
  232. },
  233. fail() {
  234. console.log('开启权限失败');
  235. }
  236. });
  237. } else if (res.cancel) {
  238. console.log('拒绝开启开启权限');
  239. }
  240. }
  241. });
  242. }
  243. })
  244. },
  245. queryCarModelGroupByVinAggregation(){
  246. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  247. vin: this.vinNum,type:2
  248. }, 'POST').then(res => {
  249. if(res.code!=1){
  250. this.moreVinList=res.data;
  251. if(this.moreVinList.length>1){
  252. this.ckCarShow=true;
  253. }else{
  254. this.gobyItem(this.moreVinList[0])
  255. }
  256. }
  257. else {
  258. uni.showToast({
  259. title: res.msg,
  260. duration: 3000,
  261. icon:'none',
  262. });
  263. }
  264. })
  265. },
  266. ckcarClose(){
  267. this.ckCarShow=false;
  268. }
  269. },
  270. onShareAppMessage(){
  271. }
  272. }
  273. </script>
  274. <style scoped>
  275. .aaaaa{
  276. width: 500rpx;
  277. background-color: #1A1A1A;
  278. }
  279. .ckcarJtimg{
  280. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  281. }
  282. .ckcarlineBox{
  283. padding:24rpx ;
  284. border-bottom: 1px solid #EEEEEE;
  285. }
  286. .ckcarLeft{
  287. font-weight: 400;line-height: 36rpx;
  288. color: #1A1A1A;font-size: 26rpx;
  289. }
  290. .ckcarBox{
  291. width: 100vw;height: 100vh;
  292. background:rgba(0, 0, 0, 0.4) ;
  293. position: fixed;top: 0;left: 0;
  294. }
  295. .ckcar{
  296. width: 750rpx;
  297. height: 772rpx;
  298. background: #FFFFFF;
  299. border-radius: 24rpx 24rpx 0rpx 0rpx;
  300. position: absolute;
  301. left: 0;
  302. bottom: 0;
  303. }
  304. .ckcarClose{
  305. width: 30rpx;height: 30rpx;
  306. }
  307. .ckcarTitle{
  308. font-weight: 500;font-size: 28rpx;
  309. color: #1A1A1A;
  310. line-height: 40rpx;
  311. }
  312. .ckcarTop{
  313. padding: 40rpx 26rpx 20rpx 24rpx;
  314. }
  315. .content{
  316. min-height: 100vh;background: #F4F5F7;
  317. }
  318. .top{
  319. width: 100%;height: 385rpx;
  320. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  321. background-size: 100% 100%;
  322. }
  323. .topNavBox{
  324. background: #D53533;
  325. width: 750rpx;
  326. position: fixed;
  327. top: 0;
  328. left: 0;
  329. z-index: 111;
  330. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  331. background-size: 100%;
  332. }
  333. .searchInputBox{
  334. width: 634rpx;display: flex;
  335. height: 80rpx;
  336. background: #FFFFFF;
  337. border-radius: 16rpx;
  338. }
  339. .simg{
  340. width: 34rpx;height: 34rpx;margin-top: 23rpx;margin-left:30rpx;
  341. }
  342. .stimg{
  343. width: 44rpx;height: 44rpx;
  344. }
  345. .searchBox{
  346. display: flex;padding: 20rpx 24rpx;
  347. justify-content: space-between;
  348. }
  349. .ssinput{
  350. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  351. width: 500rpx;
  352. }
  353. .ip{
  354. color: #999999;
  355. }
  356. .shitu{
  357. font-weight: 400;
  358. color: #FFFFFF;font-size: 22rpx;
  359. }
  360. .st{
  361. text-align: center;
  362. }
  363. .historybox{
  364. padding: 0 18rpx; margin-top: -88rpx;
  365. }
  366. .history{
  367. background: #FFFFFF;
  368. border-radius: 16rpx;
  369. padding: 20rpx;padding-bottom: 0;
  370. }
  371. .jiantouimg{
  372. width: 26rpx;height: 26rpx;margin-top: 7rpx;
  373. }
  374. .historyTop{
  375. display: flex;justify-content: space-between;
  376. padding-bottom: 30rpx;
  377. }
  378. .historyTitle{
  379. font-weight: 500;font-size: 28rpx;
  380. color: #1A1A1A;line-height: 40rpx;
  381. }
  382. .historylinecarImg{
  383. width: 54rpx;
  384. height: 54rpx;
  385. }
  386. .historylinecar{
  387. font-weight: 400;font-size: 26rpx;
  388. color: #1A1A1A;
  389. line-height: 46rpx;width: 576rpx;
  390. }
  391. .historyLine{
  392. display: flex;justify-content: space-between;
  393. padding: 15rpx 0;border-top: 1rpx solid #EEEEEE;
  394. }
  395. .indexnav{
  396. height: 44px;
  397. line-height: 44px;
  398. text-align: center;
  399. font-size: 36rpx;
  400. color: #FFFFFF;
  401. }
  402. .historyLogoBox{
  403. display: flex;align-items: center;
  404. }
  405. </style>