OemSearch.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. padding-bottom: constant(safe-area-inset-bottom);
  101. padding-bottom: env(safe-area-inset-bottom);
  102. }
  103. .brand {
  104. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  105. padding: 24rpx;
  106. color: #FFFFFF;
  107. font-size: 28rpx;
  108. }
  109. .tab {
  110. background: #FFFFFF;
  111. display: flex;
  112. justify-content: space-around;
  113. line-height: 87rpx;
  114. /* position: fixed; */
  115. width: calc(100vw - 100rpx);
  116. padding-left: 50rpx;
  117. padding-right: 50rpx;
  118. height: 87rpx;
  119. /* z-index: 11; */
  120. }
  121. .tabLine {
  122. font-size: 32rpx;
  123. color: #999999;
  124. text-align: center;
  125. }
  126. .tabActive {
  127. color: #3F90F7;
  128. font-weight: bold;
  129. border-bottom: 4rpx solid #3F90F7;
  130. }
  131. .searchBoxBg {
  132. width: 100%;
  133. background-color: #FFFFFF;
  134. border-top: 1rpx solid #EEEEEE;
  135. border-bottom: 1rpx solid #EEEEEE;
  136. }
  137. .searchBox {
  138. display: flex;
  139. height: 72rpx;
  140. margin: 24rpx;
  141. background-color: #F4F5F7;
  142. border-radius: 36rpx;
  143. }
  144. .history {
  145. padding: 24rpx;
  146. }
  147. .historyTop {
  148. display: flex;
  149. justify-content: space-between;
  150. }
  151. .historyDelImg {
  152. width: 34rpx;
  153. height: 34rpx;
  154. }
  155. .historyTopTxt {
  156. font-size: 28rpx;
  157. font-weight: 400;
  158. color: #666666;
  159. line-height: 34rpx;
  160. }
  161. .historyLIneBox {
  162. display: inline-flex;
  163. flex-wrap: wrap;
  164. }
  165. .historyLIne {
  166. color: #333333;
  167. font-size: 24rpx;
  168. height: 64rpx;
  169. background: #F4F5F7;
  170. border-radius: 32rpx;
  171. line-height: 64rpx;
  172. padding: 0 24rpx;
  173. margin-top: 20rpx;
  174. margin-right: 24rpx;
  175. }
  176. .commentBox {
  177. padding: 20rpx 24rpx;
  178. border-bottom: 1rpx solid #EEEEEE;
  179. }
  180. .name {
  181. color: #333333;
  182. font-size: 26rpx;
  183. font-weight: bold;
  184. padding-top: 16rpx;
  185. padding-bottom: 10rpx;
  186. }
  187. .comment {
  188. color: #999999;
  189. font-size: 24rpx;
  190. padding-bottom: 14rpx;
  191. }
  192. .code {
  193. color: #3F90F7;
  194. font-size: 24rpx;
  195. }
  196. </style>