index.vue 8.9 KB

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