index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 3">
  23. <image src="http://img.db.66km.cn/carbrandlogo/B - 宝马.png" mode="" class="historylinecarImg"></image>
  24. <view class="historylinecar">华晨宝马iX3 G08 电动 HA001N0电动领先型 ( 改款 )(2021-2021)过长换行</view>
  25. </view>
  26. </view>
  27. </view>
  28. <carModel ref="carModelView" ></carModel>
  29. <!-- 选择车型 -->
  30. <view class="ckcarBox" v-if="ckCarShow">
  31. <view class="ckcar">
  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. }
  59. },
  60. onLoad() {
  61. var that=this;
  62. setTimeout(function(){
  63. that.$refs.carModelView.getdata();
  64. },500)
  65. },
  66. methods: {
  67. gohistory(){
  68. uni.navigateTo({
  69. url:'/pages/index/history'
  70. })
  71. },
  72. goSearch(){
  73. uni.navigateTo({
  74. url:'/pages/index/search'
  75. })
  76. },
  77. stBtn(){
  78. var that = this;
  79. uni.showLoading({ title: '加载中'});
  80. uni.chooseImage({
  81. sourceType: ['album','camera'],
  82. count:1,
  83. success: (chooseImageRes) => {
  84. console.log(chooseImageRes)
  85. const tempFilePaths = chooseImageRes.tempFilePaths;
  86. this.fileURl=tempFilePaths[0]
  87. uni.uploadFile({
  88. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  89. filePath: tempFilePaths[0],
  90. name: 'photo',
  91. /* formData: {
  92. 'user': 'test'
  93. }, */
  94. success: (uploadFileRes) => {
  95. var data=JSON.parse(uploadFileRes.data);
  96. uni.hideLoading();
  97. if(data.code!=1){
  98. console.log(data.data)
  99. that.vinNum=data.data;
  100. that.queryCarModelGroupByVinAggregation()
  101. }else{
  102. uni.showToast({
  103. title: data.msg,
  104. duration: 3000,
  105. icon:'none',
  106. });
  107. }
  108. //console.log(JSON.parse(uploadFileRes.data).data );
  109. }
  110. });
  111. }
  112. });
  113. },
  114. queryCarModelGroupByVinAggregation(){
  115. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  116. vin: this.vinNum,type:2
  117. }, 'POST').then(res => {
  118. if(res.code!=1){
  119. this.moreVinList=res.data;
  120. this.ckCarShow=true;
  121. }
  122. else {
  123. uni.showToast({
  124. title: res.msg,
  125. duration: 3000,
  126. icon:'none',
  127. });
  128. }
  129. })
  130. },
  131. ckcarClose(){
  132. this.ckCarShow=false;
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped>
  138. .ckcarJtimg{
  139. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  140. }
  141. .ckcarlineBox{
  142. padding:24rpx ;
  143. border-bottom: 1px solid #EEEEEE;
  144. }
  145. .ckcarLeft{
  146. font-weight: 400;line-height: 36rpx;
  147. color: #1A1A1A;font-size: 26rpx;
  148. }
  149. .ckcarBox{
  150. width: 100vw;height: 100vh;
  151. background:rgba(0, 0, 0, 0.4) ;
  152. position: fixed;top: 0;left: 0;
  153. }
  154. .ckcar{
  155. width: 750rpx;
  156. height: 772rpx;
  157. background: #FFFFFF;
  158. border-radius: 24rpx 24rpx 0rpx 0rpx;
  159. position: absolute;
  160. left: 0;
  161. bottom: 0;
  162. }
  163. .ckcarClose{
  164. width: 30rpx;height: 30rpx;
  165. }
  166. .ckcarTitle{
  167. font-weight: 500;font-size: 28rpx;
  168. color: #1A1A1A;
  169. line-height: 40rpx;
  170. }
  171. .ckcarTop{
  172. padding: 40rpx 26rpx 20rpx 24rpx;
  173. }
  174. .content{
  175. min-height: 100vh;background: #F4F5F7;
  176. }
  177. .top{
  178. width: 100%;height: 230rpx;
  179. background: url('http://dmsphoto.66km.com.cn/thFiles/DE1573A0-1C08-4243-8313-C0BA094406D0.png') no-repeat;
  180. background-size: 100% 100%;
  181. }
  182. .searchInputBox{
  183. width: 634rpx;display: flex;
  184. height: 80rpx;
  185. background: #FFFFFF;
  186. border-radius: 16rpx;
  187. }
  188. .simg{
  189. width: 34rpx;height: 34rpx;margin-top: 23rpx;margin-left:30rpx;
  190. }
  191. .stimg{
  192. width: 44rpx;height: 44rpx;
  193. }
  194. .searchBox{
  195. display: flex;padding: 30rpx 24rpx;
  196. justify-content: space-between;
  197. }
  198. .ssinput{
  199. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  200. }
  201. .ip{
  202. color: #999999;
  203. }
  204. .shitu{
  205. font-weight: 400;
  206. color: #FFFFFF;font-size: 22rpx;
  207. }
  208. .st{
  209. text-align: center;
  210. }
  211. .historybox{
  212. padding: 0 24rpx; margin-top: -80rpx;
  213. }
  214. .history{
  215. background: #FFFFFF;
  216. border-radius: 16rpx;
  217. padding: 30rpx;padding-bottom: 0;
  218. }
  219. .jiantouimg{
  220. width: 26rpx;height: 26rpx;margin-top: 7rpx;
  221. }
  222. .historyTop{
  223. display: flex;justify-content: space-between;
  224. padding-bottom: 30rpx;
  225. }
  226. .historyTitle{
  227. font-weight: 500;font-size: 28rpx;
  228. color: #1A1A1A;line-height: 40rpx;
  229. }
  230. .historylinecarImg{
  231. width: 46rpx;
  232. height: 46rpx;
  233. }
  234. .historylinecar{
  235. font-weight: 400;font-size: 26rpx;
  236. color: #1A1A1A;
  237. line-height: 37rpx;width: 576rpx;
  238. }
  239. .historyLine{
  240. display: flex;justify-content: space-between;
  241. padding: 30rpx 0;border-top: 1rpx solid #EEEEEE;
  242. }
  243. </style>