vinquery.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="vinbox">
  3. <view style="height: 90rpx;"></view>
  4. <view class="carSs">
  5. <view class="carssBox" @click="vinLog">
  6. <img src="../../static/img/icon_search.png" alt="" class="carSsImg">
  7. <input type="text" placeholder="请输入17位车架号查询" class="carssInput" v-model="vinNum" @confirm="vincx">
  8. </view>
  9. <view class="search-history" v-if="vinLogShow">
  10. <view class="historyLine" @click="vinLogBtn(item)" v-for="(item,index) in vinLogList">{{item.vin}}</view>
  11. </view>
  12. </view>
  13. <view class="vincxBox" @click.stop="vinLogShow=false">
  14. <view class="vinupbox">
  15. <img src="../../static/img/btn_pic.png" alt="" class="vinupImg" @click="upimg">
  16. <img :src="fileURl" alt="" class="vinupImg2" v-if="fileURl">
  17. <img src="../../static/img/icon_search_del.png" v-if="fileURl" alt="" class="vinupNo" @click="fileURl=''">
  18. </view>
  19. <view class="vincxBtn" @click="vincx">查询</view>
  20. </view>
  21. <view class="vinmsbox" @click.stop="vinLogShow=false">
  22. <view class="vinms">*拍照时请将识别代码完整置于相机内</view>
  23. <view>
  24. <img src="../../static/img/bg_vin.png" alt="" class="vinmsImg">
  25. </view>
  26. </view>
  27. <view class="moreVinBox" v-if="moreVinShow" @click.stop="moreVinShow=false">
  28. <view class="moreVin">
  29. <view class="moreVinTop">选择车型</view>
  30. <view class="moreVinline" v-for="(item,index) in moreVinList" @click.stop="golist(item)">
  31. <view class="moreVinlineTxt">{{item.title}}</view>
  32. <img src="../../static/img/icon_jiantou@2x.png" alt="" class="moreVinJt">
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. vinLogList:[],
  43. vinLogShow:false,
  44. vinNum:'',
  45. fileURl:'',
  46. moreVinShow:false,
  47. moreVinList:'',
  48. }
  49. },
  50. onLoad() {
  51. },
  52. methods: {
  53. golist(item){
  54. uni.navigateTo({
  55. url:'list?name='+item.value+'&nLevelID='+item.carModelInfo.nLevelID+'&id='+item.ids+'&vin='+this.vinNum
  56. })
  57. },
  58. upimg(){
  59. var that = this;
  60. uni.showLoading({ title: '加载中'});
  61. uni.chooseImage({
  62. sourceType: ['album','camera'],
  63. count:1,
  64. success: (chooseImageRes) => {
  65. console.log(chooseImageRes)
  66. const tempFilePaths = chooseImageRes.tempFilePaths;
  67. //that.file=tempFilePaths[0];
  68. this.fileURl=tempFilePaths[0]
  69. /* that.$http('vinByOpenApi/scanner', {
  70. photo:chooseImageRes.tempFiles[0]
  71. }, 'POST').then(res => {
  72. if(res.code!=1){
  73. }else{
  74. uni.showToast({
  75. title: res.msg,
  76. duration: 3000,
  77. icon:'none',
  78. });
  79. }
  80. }) */
  81. uni.uploadFile({
  82. url: that.$baseURL+'scanner?action=/vinByOpenApi/scanner', //仅为示例,非真实的接口地址
  83. filePath: tempFilePaths[0],
  84. name: 'photo',
  85. /* formData: {
  86. 'user': 'test'
  87. }, */
  88. success: (uploadFileRes) => {
  89. var data=JSON.parse(uploadFileRes.data);
  90. uni.hideLoading();
  91. if(data.code!=1){
  92. console.log(data.data)
  93. that.vinNum=data.data
  94. }else{
  95. uni.showToast({
  96. title: data.msg,
  97. duration: 3000,
  98. icon:'none',
  99. });
  100. }
  101. //console.log(JSON.parse(uploadFileRes.data).data );
  102. }
  103. });
  104. }
  105. });
  106. },
  107. vinLog(){
  108. this.$fetchPost('vinLog', {
  109. }).then(res => {
  110. this.vinLogList=res.data;
  111. this.vinLogShow=true;
  112. })
  113. },
  114. vinLogBtn(item){
  115. this.vinNum=item.vin
  116. this.onSearch()
  117. },
  118. vincx(){
  119. this.onSearch()
  120. },
  121. onSearch(){
  122. this.$http('matchingByOpen/queryCarModelGroupByVinAggregation', {
  123. vin: this.vinNum,type:2
  124. }, 'POST').then(res => {
  125. if(res.code!=1){
  126. if (res.data.length === 1) {
  127. this.saveVinLog({
  128. vin: this.vinNum,
  129. groupIDS: res.data[0].ids,
  130. title: res.data[0].title,
  131. nLevelID: res.data[0].nLevelIDs
  132. })
  133. this.vinLogShow = false;
  134. var item=res.data[0]
  135. uni.navigateTo({
  136. url:'list?name='+item.value+'&nLevelID='+item.carModelInfo.nLevelID+'&id='+item.ids+'&vin='+this.vinNum
  137. })
  138. }else{
  139. this.moreVinList=res.data;
  140. this.moreVinShow=true;
  141. }
  142. }
  143. else {
  144. this.vinLogShow = false
  145. // this.groupList = res
  146. uni.showToast({
  147. title: res.msg,
  148. duration: 3000,
  149. icon:'none',
  150. });
  151. }
  152. })
  153. },
  154. saveVinLog(item){
  155. this.$fetchPost('saveVinLog', {
  156. vin: this.value,
  157. groupIDS: item.ids,
  158. title: item.title,
  159. nLevelID: item.nLevelIDs
  160. }).then(res => {
  161. //this.vinLogList=res.data
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style scoped>
  168. .carSs{
  169. width: 750rpx;
  170. height: 96rpx;
  171. background: #FFFFFF;
  172. padding-top: 24rpx;
  173. position: relative;
  174. }
  175. .carssBox{
  176. width: 702rpx;
  177. height: 72rpx;
  178. background: #F4F5F7;
  179. border-radius: 36rpx;
  180. margin: 0 auto;
  181. }
  182. .carSsImg{
  183. width: 40rpx;
  184. height: 40rpx;
  185. margin-top: 16rpx;
  186. margin-left: 20rpx;
  187. }
  188. .carssInput{
  189. line-height:72rpx;
  190. font-size: 28rpx;
  191. height:72rpx;
  192. padding-left: 16rpx;
  193. width: 600rpx;
  194. }
  195. .carssBox{
  196. display: flex;
  197. }
  198. .vinupImg{
  199. width: 208rpx;height: 203rpx;
  200. }
  201. .vincxBox{
  202. background: #FFFFFF;
  203. margin-top: 20rpx;
  204. padding: 30rpx;
  205. }
  206. .vinupbox{
  207. text-align: center;
  208. position: relative;
  209. }
  210. .vincxBtn{
  211. width: 560rpx;
  212. height: 74rpx;
  213. background: #3F90F7;
  214. border-radius: 37rpx;
  215. text-align: center;
  216. color: #FFFFFF;
  217. font-size: 30rpx;
  218. line-height: 74rpx;
  219. margin: 0 auto;
  220. margin-top: 40rpx;
  221. }
  222. .vinmsImg{
  223. width: 460rpx;
  224. }
  225. .vinupImg2{
  226. width: 160rpx;
  227. height: 160rpx;
  228. position: absolute;
  229. top:0;
  230. left: 270rpx;
  231. }
  232. .vinupNo{
  233. width: 35rpx;
  234. height: 35rpx;
  235. position: absolute;
  236. top: -18rpx;
  237. left: 420rpx;
  238. z-index: 10;
  239. }
  240. .vinmsbox{
  241. text-align: center;
  242. background: #FFFFFF;
  243. margin-top: 20rpx;
  244. padding-top: 30rpx;
  245. height: calc(100vh - 800rpx);
  246. }
  247. .vinms{
  248. color: #666666;
  249. font-size: 26rpx;
  250. padding-bottom: 20rpx;
  251. }
  252. .search-history{
  253. background: #FFFFFF;
  254. border: 1px solid #f0f0f0;
  255. z-index: 10;
  256. position: absolute;
  257. width: 600rpx;
  258. left: 75rpx;
  259. top: 100rpx;
  260. }
  261. .historyLine{
  262. color: #323233;
  263. padding: 15rpx;
  264. border-bottom: 1px solid #ebedf0;
  265. }
  266. .moreVinBox{
  267. position: fixed;
  268. width: 100vw;
  269. height: 100vh;
  270. background: rgba(0,0,0,0.5);
  271. top: 0;
  272. left: 0;
  273. z-index: 9999;
  274. }
  275. .moreVinTop{
  276. color: #FFFFFF;
  277. background: #3f90f7;
  278. border-radius: 20rpx 20rpx 0 0;
  279. line-height: 100rpx;
  280. padding-left: 24rpx;
  281. font-size: 28rpx;
  282. }
  283. .moreVin{
  284. background: #FFFFFF;
  285. width: 600rpx;
  286. margin-left: 75rpx;
  287. margin-top: 40vh;
  288. border-radius: 20rpx;
  289. overflow: hidden;
  290. }
  291. .moreVinline{
  292. display: flex;
  293. justify-content: space-between;
  294. font-size: 24rpx;
  295. color: #323233;
  296. padding: 30rpx 24rpx;
  297. border-bottom: 1px solid #ebedf0;
  298. }
  299. .moreVinJt{
  300. width: 12rpx;
  301. height: 20rpx;
  302. margin-top: 8rpx;
  303. }
  304. </style>