OemSearch.vue 4.5 KB

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