index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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. uni.chooseImage({
  159. sourceType: ['album','camera'],
  160. count:1,
  161. success: (chooseImageRes) => {
  162. console.log(chooseImageRes)
  163. const tempFilePaths = chooseImageRes.tempFilePaths;
  164. this.fileURl=tempFilePaths[0]
  165. uni.showLoading({ title: '加载中'});
  166. uni.uploadFile({
  167. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  168. filePath: tempFilePaths[0],
  169. name: 'photo',
  170. /* formData: {
  171. 'user': 'test'
  172. }, */
  173. success: (uploadFileRes) => {
  174. var data=JSON.parse(uploadFileRes.data);
  175. uni.hideLoading();
  176. if(data.code!=1){
  177. console.log(data.data)
  178. that.vinNum=data.data;
  179. that.queryCarModelGroupByVinAggregation()
  180. }else{
  181. uni.showToast({
  182. title: data.msg,
  183. duration: 3000,
  184. icon:'none',
  185. });
  186. }
  187. //console.log(JSON.parse(uploadFileRes.data).data );
  188. }
  189. });
  190. }
  191. });
  192. },
  193. queryCarModelGroupByVinAggregation(){
  194. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  195. vin: this.vinNum,type:2
  196. }, 'POST').then(res => {
  197. if(res.code!=1){
  198. this.moreVinList=res.data;
  199. if(this.moreVinList.length>1){
  200. this.ckCarShow=true;
  201. }else{
  202. this.gobyItem(this.moreVinList[0])
  203. }
  204. }
  205. else {
  206. uni.showToast({
  207. title: res.msg,
  208. duration: 3000,
  209. icon:'none',
  210. });
  211. }
  212. })
  213. },
  214. ckcarClose(){
  215. this.ckCarShow=false;
  216. }
  217. },
  218. onShareAppMessage(){
  219. }
  220. }
  221. </script>
  222. <style scoped>
  223. .aaaaa{
  224. width: 500rpx;
  225. background-color: #1A1A1A;
  226. }
  227. .ckcarJtimg{
  228. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  229. }
  230. .ckcarlineBox{
  231. padding:24rpx ;
  232. border-bottom: 1px solid #EEEEEE;
  233. }
  234. .ckcarLeft{
  235. font-weight: 400;line-height: 36rpx;
  236. color: #1A1A1A;font-size: 26rpx;
  237. }
  238. .ckcarBox{
  239. width: 100vw;height: 100vh;
  240. background:rgba(0, 0, 0, 0.4) ;
  241. position: fixed;top: 0;left: 0;
  242. }
  243. .ckcar{
  244. width: 750rpx;
  245. height: 772rpx;
  246. background: #FFFFFF;
  247. border-radius: 24rpx 24rpx 0rpx 0rpx;
  248. position: absolute;
  249. left: 0;
  250. bottom: 0;
  251. }
  252. .ckcarClose{
  253. width: 30rpx;height: 30rpx;
  254. }
  255. .ckcarTitle{
  256. font-weight: 500;font-size: 28rpx;
  257. color: #1A1A1A;
  258. line-height: 40rpx;
  259. }
  260. .ckcarTop{
  261. padding: 40rpx 26rpx 20rpx 24rpx;
  262. }
  263. .content{
  264. min-height: 100vh;background: #F4F5F7;
  265. }
  266. .top{
  267. width: 100%;height: 385rpx;
  268. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  269. background-size: 100% 100%;
  270. }
  271. .topNavBox{
  272. background: #D53533;
  273. width: 750rpx;
  274. position: fixed;
  275. top: 0;
  276. left: 0;
  277. z-index: 111;
  278. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  279. background-size: 100%;
  280. }
  281. .searchInputBox{
  282. width: 634rpx;display: flex;
  283. height: 80rpx;
  284. background: #FFFFFF;
  285. border-radius: 16rpx;
  286. }
  287. .simg{
  288. width: 34rpx;height: 34rpx;margin-top: 23rpx;margin-left:30rpx;
  289. }
  290. .stimg{
  291. width: 44rpx;height: 44rpx;
  292. }
  293. .searchBox{
  294. display: flex;padding: 20rpx 24rpx;
  295. justify-content: space-between;
  296. }
  297. .ssinput{
  298. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  299. width: 500rpx;
  300. }
  301. .ip{
  302. color: #999999;
  303. }
  304. .shitu{
  305. font-weight: 400;
  306. color: #FFFFFF;font-size: 22rpx;
  307. }
  308. .st{
  309. text-align: center;
  310. }
  311. .historybox{
  312. padding: 0 18rpx; margin-top: -88rpx;
  313. }
  314. .history{
  315. background: #FFFFFF;
  316. border-radius: 16rpx;
  317. padding: 20rpx;padding-bottom: 0;
  318. }
  319. .jiantouimg{
  320. width: 26rpx;height: 26rpx;margin-top: 7rpx;
  321. }
  322. .historyTop{
  323. display: flex;justify-content: space-between;
  324. padding-bottom: 30rpx;
  325. }
  326. .historyTitle{
  327. font-weight: 500;font-size: 28rpx;
  328. color: #1A1A1A;line-height: 40rpx;
  329. }
  330. .historylinecarImg{
  331. width: 54rpx;
  332. height: 54rpx;
  333. }
  334. .historylinecar{
  335. font-weight: 400;font-size: 26rpx;
  336. color: #1A1A1A;
  337. line-height: 46rpx;width: 576rpx;
  338. }
  339. .historyLine{
  340. display: flex;justify-content: space-between;
  341. padding: 15rpx 0;border-top: 1rpx solid #EEEEEE;
  342. }
  343. .indexnav{
  344. height: 44px;
  345. line-height: 44px;
  346. text-align: center;
  347. font-size: 36rpx;
  348. color: #FFFFFF;
  349. }
  350. .historyLogoBox{
  351. display: flex;align-items: center;
  352. }
  353. </style>