OemSearch.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 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 @click="goCarModelList(item.partnum)" 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: [1, 2, 3, 4, 5],
  39. itemData: {},
  40. itemList: [],
  41. brandList: [],
  42. brand: '本田',
  43. epc_id: '1014',
  44. page: 1,
  45. total_page: 1
  46. }
  47. },
  48. onLoad() {
  49. this.getBrandData();
  50. this.getItemData();
  51. },
  52. methods: {
  53. goCarModelList(partnum) {
  54. uni.navigateTo({
  55. url: 'CarModelList?epc_id=' + this.epc_id + '&partnum=' + partnum
  56. })
  57. },
  58. tabClick(num) {
  59. this.tabIndex = num;
  60. },
  61. search(val) {
  62. // console.log(val);
  63. this.searchValue = val
  64. this.page = 1;
  65. this.getItemData();
  66. },
  67. getBrandData() {
  68. uni.showLoading({
  69. title: '加载中'
  70. });
  71. this.$http('advancedEpc/getBrands', {
  72. }, 'GET').then(res => {
  73. uni.hideLoading();
  74. this.brandList = res.data.result.list;
  75. console.log(this.brandList);
  76. });
  77. },
  78. // 配件查询
  79. getItemData() {
  80. uni.showLoading({
  81. title: '加载中'
  82. });
  83. this.$http('advancedEpc/findParts', {
  84. epc_id: this.epc_id,
  85. keyword: this.searchValue,
  86. page: this.page,
  87. }, 'GET').then(res => {
  88. uni.hideLoading();
  89. this.itemData = res.data.result;
  90. var list = res.data.result.list;
  91. this.total_page = res.data.result.total_page;
  92. if (list.length != 0) {
  93. this.itemList = this.itemList.concat(list)
  94. }
  95. });
  96. },
  97. },
  98. onReachBottom() {
  99. if (this.page <= this.total_page) {
  100. this.page++;
  101. this.getItemData()
  102. }
  103. }
  104. }
  105. </script>
  106. <style>
  107. .box {
  108. min-height: 100vh;
  109. background: #FFFFFF;
  110. }
  111. .brand {
  112. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  113. padding: 24rpx;
  114. color: #FFFFFF;
  115. font-size: 28rpx;
  116. }
  117. .tab {
  118. background: #FFFFFF;
  119. display: flex;
  120. justify-content: space-around;
  121. line-height: 87rpx;
  122. /* position: fixed; */
  123. width: calc(100vw - 100rpx);
  124. padding-left: 50rpx;
  125. padding-right: 50rpx;
  126. height: 87rpx;
  127. /* z-index: 11; */
  128. }
  129. .tabLine {
  130. font-size: 32rpx;
  131. color: #999999;
  132. text-align: center;
  133. }
  134. .tabActive {
  135. color: #3F90F7;
  136. font-weight: bold;
  137. border-bottom: 4rpx solid #3F90F7;
  138. }
  139. .searchBoxBg {
  140. width: 100%;
  141. background-color: #FFFFFF;
  142. border-top: 1rpx solid #EEEEEE;
  143. border-bottom: 1rpx solid #EEEEEE;
  144. }
  145. .searchBox {
  146. display: flex;
  147. height: 72rpx;
  148. margin: 24rpx;
  149. background-color: #F4F5F7;
  150. border-radius: 36rpx;
  151. }
  152. .history {
  153. padding: 24rpx;
  154. }
  155. .historyTop {
  156. display: flex;
  157. justify-content: space-between;
  158. }
  159. .historyDelImg {
  160. width: 34rpx;
  161. height: 34rpx;
  162. }
  163. .historyTopTxt {
  164. font-size: 28rpx;
  165. font-weight: 400;
  166. color: #666666;
  167. line-height: 34rpx;
  168. }
  169. .historyLIneBox {
  170. display: inline-flex;
  171. flex-wrap: wrap;
  172. }
  173. .historyLIne {
  174. color: #333333;
  175. font-size: 24rpx;
  176. height: 64rpx;
  177. background: #F4F5F7;
  178. border-radius: 32rpx;
  179. line-height: 64rpx;
  180. padding: 0 24rpx;
  181. margin-top: 20rpx;
  182. margin-right: 24rpx;
  183. }
  184. .commentBox {
  185. padding: 20rpx 24rpx;
  186. border-bottom: 1rpx solid #EEEEEE;
  187. }
  188. .name {
  189. color: #333333;
  190. font-size: 26rpx;
  191. font-weight: bold;
  192. padding-top: 16rpx;
  193. padding-bottom: 10rpx;
  194. }
  195. .comment {
  196. color: #999999;
  197. font-size: 24rpx;
  198. padding-bottom: 14rpx;
  199. }
  200. .code {
  201. color: #3F90F7;
  202. font-size: 24rpx;
  203. }
  204. </style>