OemSearch.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. if (this.itemList.length == 0) {
  101. uni.showToast({
  102. title: '暂无符合要求的配件',
  103. icon: 'none',
  104. duration: 2000
  105. });
  106. }
  107. });
  108. },
  109. },
  110. // 下拉刷新 上拉加载更多
  111. onPullDownRefresh() {
  112. // this.page = 1
  113. // this.getItemData()
  114. setTimeout(function() {
  115. uni.stopPullDownRefresh();
  116. }, 1000);
  117. },
  118. onReachBottom() {
  119. if (this.page <= this.total_page) {
  120. this.page++;
  121. this.getItemData()
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. .box {
  128. min-height: 100vh;
  129. background: #FFFFFF;
  130. padding-bottom: constant(safe-area-inset-bottom);
  131. padding-bottom: env(safe-area-inset-bottom);
  132. }
  133. .brand {
  134. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  135. padding: 24rpx;
  136. color: #FFFFFF;
  137. font-size: 28rpx;
  138. }
  139. .tab {
  140. background: #FFFFFF;
  141. display: flex;
  142. justify-content: space-around;
  143. line-height: 87rpx;
  144. /* position: fixed; */
  145. width: calc(100vw - 100rpx);
  146. padding-left: 50rpx;
  147. padding-right: 50rpx;
  148. height: 87rpx;
  149. /* z-index: 11; */
  150. }
  151. .tabLine {
  152. font-size: 32rpx;
  153. color: #999999;
  154. text-align: center;
  155. }
  156. .tabActive {
  157. color: #3F90F7;
  158. font-weight: bold;
  159. border-bottom: 4rpx solid #3F90F7;
  160. }
  161. .searchBoxBg {
  162. width: 100%;
  163. background-color: #FFFFFF;
  164. border-top: 1rpx solid #EEEEEE;
  165. border-bottom: 1rpx solid #EEEEEE;
  166. }
  167. .searchBox {
  168. display: flex;
  169. height: 72rpx;
  170. margin: 24rpx;
  171. background-color: #F4F5F7;
  172. border-radius: 36rpx;
  173. }
  174. .history {
  175. padding: 24rpx;
  176. }
  177. .historyTop {
  178. display: flex;
  179. justify-content: space-between;
  180. }
  181. .historyDelImg {
  182. width: 34rpx;
  183. height: 34rpx;
  184. }
  185. .historyTopTxt {
  186. font-size: 28rpx;
  187. font-weight: 400;
  188. color: #666666;
  189. line-height: 34rpx;
  190. }
  191. .historyLIneBox {
  192. display: inline-flex;
  193. flex-wrap: wrap;
  194. }
  195. .historyLIne {
  196. color: #333333;
  197. font-size: 24rpx;
  198. height: 64rpx;
  199. background: #F4F5F7;
  200. border-radius: 32rpx;
  201. line-height: 64rpx;
  202. padding: 0 24rpx;
  203. margin-top: 20rpx;
  204. margin-right: 24rpx;
  205. }
  206. .commentBox {
  207. padding: 20rpx 24rpx;
  208. border-bottom: 1rpx solid #EEEEEE;
  209. }
  210. .name {
  211. color: #333333;
  212. font-size: 26rpx;
  213. font-weight: bold;
  214. padding-top: 16rpx;
  215. padding-bottom: 10rpx;
  216. }
  217. .comment {
  218. color: #999999;
  219. font-size: 24rpx;
  220. padding-bottom: 14rpx;
  221. }
  222. .code {
  223. color: #3F90F7;
  224. font-size: 24rpx;
  225. }
  226. </style>