index.vue 10 KB

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