index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="searchBox">
  5. <view class="searchInputBox" @click="goSearch">
  6. <image src="../../static/img/icon_search.png" mode="" class="simg"></image>
  7. <input type="text" placeholder="请输入车型品牌或车系名称" placeholder-class="ip" class="ssinput">
  8. </view>
  9. <view class="st" @click="stBtn">
  10. <image src="../../static/img/icon_shitu.png" mode="" class="stimg"></image>
  11. <view class="shitu">识图</view>
  12. </view>
  13. </view>
  14. </view>
  15. <!-- 历史查询 -->
  16. <view class="historybox ">
  17. <view class="history">
  18. <view class="historyTop" @click="gohistory">
  19. <view class="historyTitle">历史查询</view>
  20. <image src="../../static/img/icon_arrow.png" mode="" class="jiantouimg"></image>
  21. </view>
  22. <view class="historyLine" v-for="(item,index) in historyList" v-if="index<3">
  23. <image :src="item.logo" mode="" class="historylinecarImg"></image>
  24. <view class="historylinecar">{{item.title}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <carModel ref="carModelView" ></carModel>
  29. <!-- 选择车型 -->
  30. <view class="ckcarBox" v-if="ckCarShow" >
  31. <view class="ckcar" @click.stop="">
  32. <view class="ckcarTop flex">
  33. <view class="ckcarTitle">请选择车型</view>
  34. <image src="../../static/img/icon_quxiao.png" mode="" class="ckcarClose" @click="ckcarClose"></image>
  35. </view>
  36. <view class="ckcarlineBox" v-for="(item,index) in moreVinList">
  37. <view class="ckcarline flex">
  38. <view class="ckcarLeft">{{item.title}}</view>
  39. <image src="../../static/img/icon_arrow.png" mode="" class="ckcarJtimg"></image>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import carModel from './carModel.vue'
  48. export default {
  49. components: {
  50. carModel, //注册子组件
  51. },
  52. data() {
  53. return {
  54. fileURl: '',
  55. ckCarShow:false,
  56. vinNum:'',
  57. moreVinList:[],
  58. historyList:[],
  59. }
  60. },
  61. onLoad() {
  62. var that=this;
  63. this.uniLogin()
  64. setTimeout(function(){
  65. that.$refs.carModelView.getdata();
  66. },500)
  67. },
  68. methods: {
  69. uniLogin(){
  70. var that=this;
  71. uni.login({
  72. provider: 'weixin',
  73. success: function (loginRes) {
  74. console.log(loginRes);
  75. that.getWxOpenID(loginRes)
  76. }
  77. });
  78. },
  79. getWxOpenID(e){
  80. var that=this;
  81. this.$http2('sys/getWxOpenID', {
  82. code:e.code,
  83. },'GET').then(res => {
  84. uni.setStorage({
  85. key: 'wxdata',
  86. data: res.data,
  87. success: function () {
  88. that.queryHistory()
  89. }
  90. });
  91. })
  92. },
  93. queryHistory(){
  94. this.$http2('queryHistory', {
  95. },'POST').then(res => {
  96. this.historyList=res.data
  97. })
  98. },
  99. gohistory(){
  100. uni.navigateTo({
  101. url:'/pages/index/history'
  102. })
  103. },
  104. goSearch(){
  105. uni.navigateTo({
  106. url:'/pages/index/search'
  107. })
  108. },
  109. stBtn(){
  110. var that = this;
  111. uni.showLoading({ title: '加载中'});
  112. uni.chooseImage({
  113. sourceType: ['album','camera'],
  114. count:1,
  115. success: (chooseImageRes) => {
  116. console.log(chooseImageRes)
  117. const tempFilePaths = chooseImageRes.tempFilePaths;
  118. this.fileURl=tempFilePaths[0]
  119. uni.uploadFile({
  120. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  121. filePath: tempFilePaths[0],
  122. name: 'photo',
  123. /* formData: {
  124. 'user': 'test'
  125. }, */
  126. success: (uploadFileRes) => {
  127. var data=JSON.parse(uploadFileRes.data);
  128. uni.hideLoading();
  129. if(data.code!=1){
  130. console.log(data.data)
  131. that.vinNum=data.data;
  132. that.queryCarModelGroupByVinAggregation()
  133. }else{
  134. uni.showToast({
  135. title: data.msg,
  136. duration: 3000,
  137. icon:'none',
  138. });
  139. }
  140. //console.log(JSON.parse(uploadFileRes.data).data );
  141. }
  142. });
  143. }
  144. });
  145. },
  146. queryCarModelGroupByVinAggregation(){
  147. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  148. vin: this.vinNum,type:2
  149. }, 'POST').then(res => {
  150. if(res.code!=1){
  151. this.moreVinList=res.data;
  152. this.ckCarShow=true;
  153. }
  154. else {
  155. uni.showToast({
  156. title: res.msg,
  157. duration: 3000,
  158. icon:'none',
  159. });
  160. }
  161. })
  162. },
  163. ckcarClose(){
  164. this.ckCarShow=false;
  165. }
  166. }
  167. }
  168. </script>
  169. <style scoped>
  170. .ckcarJtimg{
  171. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  172. }
  173. .ckcarlineBox{
  174. padding:24rpx ;
  175. border-bottom: 1px solid #EEEEEE;
  176. }
  177. .ckcarLeft{
  178. font-weight: 400;line-height: 36rpx;
  179. color: #1A1A1A;font-size: 26rpx;
  180. }
  181. .ckcarBox{
  182. width: 100vw;height: 100vh;
  183. background:rgba(0, 0, 0, 0.4) ;
  184. position: fixed;top: 0;left: 0;
  185. }
  186. .ckcar{
  187. width: 750rpx;
  188. height: 772rpx;
  189. background: #FFFFFF;
  190. border-radius: 24rpx 24rpx 0rpx 0rpx;
  191. position: absolute;
  192. left: 0;
  193. bottom: 0;
  194. }
  195. .ckcarClose{
  196. width: 30rpx;height: 30rpx;
  197. }
  198. .ckcarTitle{
  199. font-weight: 500;font-size: 28rpx;
  200. color: #1A1A1A;
  201. line-height: 40rpx;
  202. }
  203. .ckcarTop{
  204. padding: 40rpx 26rpx 20rpx 24rpx;
  205. }
  206. .content{
  207. min-height: 100vh;background: #F4F5F7;
  208. }
  209. .top{
  210. width: 100%;height: 230rpx;
  211. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  212. background-size: 100% 100%;
  213. }
  214. .searchInputBox{
  215. width: 634rpx;display: flex;
  216. height: 80rpx;
  217. background: #FFFFFF;
  218. border-radius: 16rpx;
  219. }
  220. .simg{
  221. width: 34rpx;height: 34rpx;margin-top: 23rpx;margin-left:30rpx;
  222. }
  223. .stimg{
  224. width: 44rpx;height: 44rpx;
  225. }
  226. .searchBox{
  227. display: flex;padding: 30rpx 24rpx;
  228. justify-content: space-between;
  229. }
  230. .ssinput{
  231. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  232. }
  233. .ip{
  234. color: #999999;
  235. }
  236. .shitu{
  237. font-weight: 400;
  238. color: #FFFFFF;font-size: 22rpx;
  239. }
  240. .st{
  241. text-align: center;
  242. }
  243. .historybox{
  244. padding: 0 24rpx; margin-top: -80rpx;
  245. }
  246. .history{
  247. background: #FFFFFF;
  248. border-radius: 16rpx;
  249. padding: 30rpx;padding-bottom: 0;
  250. }
  251. .jiantouimg{
  252. width: 26rpx;height: 26rpx;margin-top: 7rpx;
  253. }
  254. .historyTop{
  255. display: flex;justify-content: space-between;
  256. padding-bottom: 30rpx;
  257. }
  258. .historyTitle{
  259. font-weight: 500;font-size: 28rpx;
  260. color: #1A1A1A;line-height: 40rpx;
  261. }
  262. .historylinecarImg{
  263. width: 46rpx;
  264. height: 46rpx;
  265. }
  266. .historylinecar{
  267. font-weight: 400;font-size: 26rpx;
  268. color: #1A1A1A;
  269. line-height: 37rpx;width: 576rpx;
  270. }
  271. .historyLine{
  272. display: flex;justify-content: space-between;
  273. padding: 30rpx 0;border-top: 1rpx solid #EEEEEE;
  274. }
  275. </style>