OemSearch.vue 5.1 KB

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