OemSearch.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="box">
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <view class="zdyNavLeft">
  8. <!-- <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon"
  9. style="color: rgb(0, 0, 0); font-size: 27px;"></i></div> -->
  10. <div class="gobackBox" @click="goback">
  11. <image src="/static/img/goback.png" mode="" class="gobackImg"></image>
  12. </div>
  13. <div class="goHomeBox" @click="goHome">
  14. <image src="/static/img/home.png" mode="" class="goHomeImg"></image>
  15. </div>
  16. </view>
  17. <view class="zdyNavTitle"> OEM搜索 </view>
  18. <view style="width: 120rpx;"></view>
  19. </view>
  20. </view>
  21. <view class="brand">当前品牌:{{brand}}</view>
  22. <!-- <view class="tab">
  23. <view class="tabLine" :class="{tabActive:tabIndex==0}" @click="tabClick(0)">品牌下搜索</view>
  24. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">车型下搜索</view>
  25. </view> -->
  26. <!-- 搜索 -->
  27. <view class="searchBox">
  28. <image src="../../static/img/icon_search.png" class="searchImg"></image>
  29. <input type="text" class="searchInput" placeholder='配件名称/原厂OEM' v-model="inputValue" @confirm="search" />
  30. <image src="../../static/img/icon_close.png" class="searchClose" v-if="inputValue!=''" @click="clear">
  31. </image>
  32. </view>
  33. <view class="history" v-if="inputValue.length==0">
  34. <view class="historyTop">
  35. <view class="historyTopTxt">示例数据</view>
  36. <!-- <image src="../../static/img/icon_delete.png" mode="" class="historyDelImg"></image> -->
  37. </view>
  38. <view v-for="(item,index) in 1" class="historyLIneBox">
  39. <view class="historyLIne" @click="goSearch('16400RZDH01')">16400RZDH01</view>
  40. </view>
  41. </view>
  42. <view @click="goCarModelList(item.partnum)" class="commentBox" v-for="(item,index) in itemList" :key="index">
  43. <view class="name">{{item.caption}}</view>
  44. <view class="comment">{{item.description}}</view>
  45. <view class="code">{{item.extened}}</view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. components: {
  52. },
  53. data() {
  54. return {
  55. inputValue: '',
  56. tabIndex: 0,
  57. historyList: [],
  58. itemData: {},
  59. itemList: [],
  60. brandList: [],
  61. brand: '',
  62. epc_id: '',
  63. vin: '',
  64. token: '',
  65. param: '',
  66. access_time: '',
  67. page: 1,
  68. total_page: 1,
  69. iStatusBarHeight: '',
  70. }
  71. },
  72. onLoad(opt) {
  73. console.log('opt+', opt);
  74. this.brand = opt.brand;
  75. this.epc_id = opt.epc_id;
  76. this.vin = opt.vin;
  77. this.token = opt.token;
  78. this.param = opt.param;
  79. this.access_time = opt.access_time;
  80. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  81. },
  82. methods: {
  83. goback() {
  84. console.log('返回');
  85. uni.navigateBack({})
  86. //window.history.back()
  87. },
  88. goHome(){
  89. var token= uni.getStorageSync("token")
  90. /* var encodedToken= uni.getStorageSync("encodedToken")
  91. var token = decodeURIComponent(encodedToken) */
  92. //var token=getHashQuery('token')
  93. var url = 'http://byweb.66km.cn/#/home?token='+token
  94. //window.history.back()
  95. window.location.href =url
  96. },
  97. search() {
  98. if (!this.inputValue) return;
  99. //console.log(this.inputValue);
  100. this.$emit('search', this.inputValue);
  101. this.page = 1;
  102. this.getItemData();
  103. },
  104. clear() {
  105. this.inputValue = ''
  106. this.$emit('search', '');
  107. },
  108. goCarModelList(partnum) {
  109. uni.navigateTo({
  110. url: 'CarModelList?epc_id=' + this.epc_id + '&partnum=' + partnum
  111. })
  112. },
  113. tabClick(num) {
  114. this.tabIndex = num;
  115. },
  116. goSearch(str) {
  117. this.inputValue = str
  118. this.page = 1;
  119. this.getItemData();
  120. },
  121. // 配件查询
  122. getItemData() {
  123. uni.showLoading({
  124. title: '加载中'
  125. });
  126. this.$http('advancedEpc/findParts', {
  127. epc_id: this.epc_id,
  128. keyword: this.inputValue,
  129. vin: this.vin,
  130. token: this.token,
  131. param: this.param,
  132. access_time: this.access_time,
  133. page: this.page,
  134. }, 'GET').then(res => {
  135. uni.hideLoading();
  136. this.itemData = res.data.result;
  137. var list = res.data.result.list;
  138. this.total_page = res.data.result.total_page;
  139. if (this.page == 1) {
  140. this.itemList = list;
  141. } else if (list.length != 0) {
  142. this.itemList = this.itemList.concat(list)
  143. }
  144. if (this.itemList.length == 0) {
  145. uni.showToast({
  146. title: '暂无符合要求的配件',
  147. icon: 'none',
  148. duration: 2000
  149. });
  150. }
  151. });
  152. },
  153. },
  154. // 下拉刷新 上拉加载更多
  155. onPullDownRefresh() {
  156. // this.page = 1
  157. // this.getItemData()
  158. setTimeout(function() {
  159. uni.stopPullDownRefresh();
  160. }, 1000);
  161. },
  162. onReachBottom() {
  163. if (this.page <= this.total_page) {
  164. this.page++;
  165. this.getItemData()
  166. }
  167. }
  168. }
  169. </script>
  170. <style>
  171. .box {
  172. min-height: 100vh;
  173. background: #FFFFFF;
  174. padding-bottom: constant(safe-area-inset-bottom);
  175. padding-bottom: env(safe-area-inset-bottom);
  176. }
  177. .brand {
  178. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  179. padding: 24rpx;
  180. color: #FFFFFF;
  181. font-size: 28rpx;
  182. }
  183. .tab {
  184. background: #FFFFFF;
  185. display: flex;
  186. justify-content: space-around;
  187. line-height: 87rpx;
  188. /* position: fixed; */
  189. width: calc(100vw - 100rpx);
  190. padding-left: 50rpx;
  191. padding-right: 50rpx;
  192. height: 87rpx;
  193. /* z-index: 11; */
  194. }
  195. .tabLine {
  196. font-size: 32rpx;
  197. color: #999999;
  198. text-align: center;
  199. }
  200. .tabActive {
  201. color: #3F90F7;
  202. font-weight: bold;
  203. border-bottom: 4rpx solid #3F90F7;
  204. }
  205. .searchBoxBg {
  206. width: 100%;
  207. background-color: #FFFFFF;
  208. border-top: 1rpx solid #EEEEEE;
  209. border-bottom: 1rpx solid #EEEEEE;
  210. }
  211. .searchBox {
  212. height: 72rpx;
  213. margin: 24rpx;
  214. background-color: #F4F5F7;
  215. border-radius: 36rpx;
  216. display: flex;
  217. position: relative;
  218. }
  219. .searchImg {
  220. margin-top: 20rpx;
  221. margin-left: 20rpx;
  222. width: 32rpx;
  223. height: 32rpx;
  224. }
  225. .searchInput {
  226. height: 72rpx;
  227. font-size: 28rpx;
  228. padding-left: 16rpx;
  229. width: 78%;
  230. }
  231. .searchClose {
  232. position: absolute;
  233. width: 36rpx;
  234. height: 36rpx;
  235. right: 36rpx;
  236. top: 20rpx;
  237. }
  238. .history {
  239. padding: 24rpx;
  240. }
  241. .historyTop {
  242. display: flex;
  243. justify-content: space-between;
  244. }
  245. .historyDelImg {
  246. width: 34rpx;
  247. height: 34rpx;
  248. }
  249. .historyTopTxt {
  250. font-size: 28rpx;
  251. font-weight: 400;
  252. color: #666666;
  253. line-height: 34rpx;
  254. }
  255. .historyLIneBox {
  256. display: inline-flex;
  257. flex-wrap: wrap;
  258. }
  259. .historyLIne {
  260. color: #333333;
  261. font-size: 24rpx;
  262. height: 64rpx;
  263. background: #F4F5F7;
  264. border-radius: 32rpx;
  265. line-height: 64rpx;
  266. padding: 0 24rpx;
  267. margin-top: 20rpx;
  268. margin-right: 24rpx;
  269. }
  270. .commentBox {
  271. padding: 20rpx 24rpx;
  272. border-bottom: 1rpx solid #EEEEEE;
  273. }
  274. .name {
  275. color: #333333;
  276. font-size: 26rpx;
  277. font-weight: bold;
  278. padding-top: 16rpx;
  279. padding-bottom: 10rpx;
  280. }
  281. .comment {
  282. color: #999999;
  283. font-size: 24rpx;
  284. padding-bottom: 14rpx;
  285. }
  286. .code {
  287. color: #3F90F7;
  288. font-size: 24rpx;
  289. }
  290. .zdyNavBox {
  291. width: 100vw;
  292. background: #FFFFFF;
  293. position: fixed;
  294. top: 0;
  295. left: 0;
  296. z-index: 9999999;
  297. }
  298. .zdyNav {
  299. display: flex;
  300. justify-content: space-between;
  301. align-items: center;
  302. padding: 14rpx 6rpx;
  303. }
  304. .zdyNavLeft{
  305. width: 120rpx;
  306. display: flex;
  307. }
  308. .goHomeBox{
  309. padding-left: 20rpx;
  310. padding-top: 6rpx;
  311. }
  312. .goHomeImg{
  313. width: 20px;
  314. height: 20px;
  315. }
  316. .gobackBox{
  317. padding-left: 20rpx;
  318. padding-top: 6rpx;
  319. }
  320. .gobackImg{
  321. width: 10px;
  322. height: 20px;
  323. padding-right: 20rpx;
  324. }
  325. .zdyNavTitle {
  326. background: #FFFFFF;
  327. text-align: center;
  328. /* font-size: 32rpx; */
  329. /* font-weight: bold; */
  330. font-size: 18px!important;
  331. color: #333333!important;
  332. }
  333. .zdyNavRight {
  334. background: #FFFFFF;
  335. text-align: center;
  336. font-size: 28rpx;
  337. color: #3F90F7;
  338. width: 120rpx;
  339. }
  340. </style>