OESearch.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="box">
  3. <!-- <view class="brand">当前品牌:{{this.itemList[0].brands}}</view> -->
  4. <!-- <view class="tab">
  5. <view class="tabLine" :class="{tabActive:tabIndex==0}" @click="tabClick(0)">品牌下搜索</view>
  6. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">车型下搜索</view>
  7. </view> -->
  8. <!-- 搜索 -->
  9. <view class="searchBox">
  10. <image src="../../static/img/icon_search.png" class="searchImg"></image>
  11. <input type="text" class="searchInput" placeholder='OE/品牌号' v-model="inputValue" @confirm="search" />
  12. <image src="../../static/img/icon_close.png" class="searchClose" v-if="inputValue!=''" @click="clear">
  13. </image>
  14. </view>
  15. <view class="history" v-if="inputValue.length==0">
  16. <view class="historyTop">
  17. <view class="historyTopTxt">示例数据</view>
  18. <!-- <image src="../../static/img/icon_delete.png" mode="" class="historyDelImg"></image> -->
  19. </view>
  20. <view v-for="(item,index) in 1" class="historyLIneBox">
  21. <view class="historyLIne" @click="goSearch('16176RTA004')">16176RTA004</view>
  22. </view>
  23. </view>
  24. <view @click="goCarModelList(item.partsnum)" class="commentBox" v-for="(item,index) in itemList" :key="index">
  25. <view class="name">{{item.description}}</view>
  26. <view class="comment">{{item.brands}}</view>
  27. <view class="code">{{inputValue}}</view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. components: {
  34. },
  35. data() {
  36. return {
  37. inputValue: '',
  38. tabIndex: 0,
  39. historyList: [],
  40. itemData: {},
  41. itemList: [],
  42. brandList: [],
  43. brand: '',
  44. epc_id: '',
  45. vin: '',
  46. token: '',
  47. param: '',
  48. access_time: '',
  49. page: 1,
  50. total_page: 1,
  51. om:'',
  52. }
  53. },
  54. onLoad(opt) {
  55. console.log('opt+', opt);
  56. this.om = opt.om;
  57. this.inputValue=opt.om
  58. this.find()
  59. },
  60. methods: {
  61. search() {
  62. if (!this.inputValue) return;
  63. //console.log(this.inputValue);
  64. this.$emit('search', this.inputValue);
  65. this.page = 1;
  66. this.find();
  67. },
  68. clear() {
  69. this.inputValue = ''
  70. this.$emit('search', '');
  71. },
  72. goCarModelList(partnum) {
  73. uni.navigateTo({
  74. url: 'OEDetail?partnum=' + partnum
  75. })
  76. },
  77. tabClick(num) {
  78. this.tabIndex = num;
  79. },
  80. goSearch(str) {
  81. this.inputValue = str
  82. this.page = 1;
  83. this.getItemData();
  84. },
  85. // 配件查询
  86. find() {
  87. uni.showLoading({
  88. title: '加载中'
  89. });
  90. this.$http('advancedEpc/parts/find', {
  91. partsnums: this.inputValue,
  92. }, 'GET').then(res => {
  93. uni.hideLoading();
  94. if (res.data.number == 200 || res.data.number == 5212) {
  95. this.itemList=res.data.result
  96. } else {
  97. uni.showToast({
  98. title: res.data.message,
  99. icon: 'none',
  100. duration: 3000
  101. });
  102. }
  103. });
  104. },
  105. },
  106. // 下拉刷新 上拉加载更多
  107. onPullDownRefresh() {
  108. // this.page = 1
  109. // this.getItemData()
  110. setTimeout(function() {
  111. uni.stopPullDownRefresh();
  112. }, 1000);
  113. },
  114. onReachBottom() {
  115. if (this.page <= this.total_page) {
  116. this.page++;
  117. this.getItemData()
  118. }
  119. }
  120. }
  121. </script>
  122. <style>
  123. .box {
  124. min-height: 100vh;
  125. background: #FFFFFF;
  126. padding-bottom: constant(safe-area-inset-bottom);
  127. padding-bottom: env(safe-area-inset-bottom);
  128. }
  129. .brand {
  130. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  131. padding: 24rpx;
  132. color: #FFFFFF;
  133. font-size: 28rpx;
  134. }
  135. .tab {
  136. background: #FFFFFF;
  137. display: flex;
  138. justify-content: space-around;
  139. line-height: 87rpx;
  140. /* position: fixed; */
  141. width: calc(100vw - 100rpx);
  142. padding-left: 50rpx;
  143. padding-right: 50rpx;
  144. height: 87rpx;
  145. /* z-index: 11; */
  146. }
  147. .tabLine {
  148. font-size: 32rpx;
  149. color: #999999;
  150. text-align: center;
  151. }
  152. .tabActive {
  153. color: #3F90F7;
  154. font-weight: bold;
  155. border-bottom: 4rpx solid #3F90F7;
  156. }
  157. .searchBoxBg {
  158. width: 100%;
  159. background-color: #FFFFFF;
  160. border-top: 1rpx solid #EEEEEE;
  161. border-bottom: 1rpx solid #EEEEEE;
  162. }
  163. .searchBox {
  164. height: 72rpx;
  165. margin: 24rpx;
  166. background-color: #F4F5F7;
  167. border-radius: 36rpx;
  168. display: flex;
  169. position: relative;
  170. }
  171. .searchImg {
  172. margin-top: 20rpx;
  173. margin-left: 20rpx;
  174. width: 32rpx;
  175. height: 32rpx;
  176. }
  177. .searchInput {
  178. height: 72rpx;
  179. font-size: 28rpx;
  180. padding-left: 16rpx;
  181. width: 78%;
  182. }
  183. .searchClose {
  184. position: absolute;
  185. width: 36rpx;
  186. height: 36rpx;
  187. right: 36rpx;
  188. top: 20rpx;
  189. }
  190. .history {
  191. padding: 24rpx;
  192. }
  193. .historyTop {
  194. display: flex;
  195. justify-content: space-between;
  196. }
  197. .historyDelImg {
  198. width: 34rpx;
  199. height: 34rpx;
  200. }
  201. .historyTopTxt {
  202. font-size: 28rpx;
  203. font-weight: 400;
  204. color: #666666;
  205. line-height: 34rpx;
  206. }
  207. .historyLIneBox {
  208. display: inline-flex;
  209. flex-wrap: wrap;
  210. }
  211. .historyLIne {
  212. color: #333333;
  213. font-size: 24rpx;
  214. height: 64rpx;
  215. background: #F4F5F7;
  216. border-radius: 32rpx;
  217. line-height: 64rpx;
  218. padding: 0 24rpx;
  219. margin-top: 20rpx;
  220. margin-right: 24rpx;
  221. }
  222. .commentBox {
  223. padding: 20rpx 24rpx;
  224. border-bottom: 1rpx solid #EEEEEE;
  225. }
  226. .name {
  227. color: #333333;
  228. font-size: 26rpx;
  229. font-weight: bold;
  230. padding-top: 16rpx;
  231. padding-bottom: 10rpx;
  232. }
  233. .comment {
  234. color: #999999;
  235. font-size: 24rpx;
  236. padding-bottom: 14rpx;
  237. }
  238. .code {
  239. color: #3F90F7;
  240. font-size: 24rpx;
  241. }
  242. </style>