OemSearch.vue 4.3 KB

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