SimpleOemSearch.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="box">
  3. <view class="brand">当前品牌:{{brand}}</view>
  4. <!-- 搜索 -->
  5. <view class="searchBox">
  6. <image src="../../static/img/icon_search.png" class="searchImg"></image>
  7. <input type="text" class="searchInput" placeholder='配件名称/原厂OEM' v-model="inputValue" @confirm="search" />
  8. <image src="../../static/img/icon_close.png" class="searchClose" v-if="inputValue!=''" @click="clear">
  9. </image>
  10. </view>
  11. <view @click="goCarModelList(item)" class="commentBox" v-for="(item,index) in itemList" :key="index">
  12. <view class="name">{{item.caption}}</view>
  13. <view class="comment">{{item.description}}</view>
  14. <view class="code">{{item.extened}}</view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. components: {
  21. },
  22. data() {
  23. return {
  24. inputValue: '',
  25. tabIndex: 0,
  26. historyList: [],
  27. itemData: {},
  28. itemList: [],
  29. brandList: [],
  30. brand: '',
  31. epc_id: '',
  32. vin: '',
  33. token: '',
  34. param: '',
  35. access_time: '',
  36. page: 1,
  37. total_page: 1,
  38. brand_name:'',
  39. title:'', //搜索
  40. caption:'',
  41. }
  42. },
  43. onLoad(opt) {
  44. this.brand = opt.brand_name;
  45. this.epc_id = opt.epc_id;
  46. this.vin = opt.vin;
  47. this.token = opt.token;
  48. this.param = opt.param;
  49. this.access_time = opt.access_time;
  50. this.brand_name = opt.brand_name;
  51. this.title = opt.title;
  52. this.inputValue = opt.title;
  53. this.caption = opt.caption;
  54. if(this.title){
  55. this.search();
  56. }
  57. },
  58. methods: {
  59. search() {
  60. if (!this.inputValue) return;
  61. this.$emit('search', this.inputValue);
  62. this.page = 1;
  63. this.getItemData();
  64. },
  65. clear() {
  66. this.inputValue = ''
  67. this.$emit('search', '');
  68. },
  69. goCarModelList(partnumObj) {
  70. let partnum = partnumObj.partnum;
  71. //查询 advancedEpc/findApplicableModels
  72. this.findApplicableModels(partnumObj);
  73. },
  74. tabClick(num) {
  75. this.tabIndex = num;
  76. },
  77. findApplicableModels(partnumObj){
  78. this.$http('/advancedEpc/findApplicableModels', {
  79. epc_id: this.epc_id,
  80. partnum: partnumObj.partnum,
  81. page: this.page
  82. }, 'GET').then(res => {
  83. if(res.code==0 && res.data.result.list.length > 0){
  84. const list = res.data.result.list;
  85. let thisItem = list.find(x => x.caption.includes(this.caption) )
  86. if(thisItem !=undefined){
  87. this.param = thisItem.param;
  88. this.token = thisItem.token;
  89. uni.navigateTo({
  90. url: 'SonGroup?epc_id=' + this.epc_id + '&token=' + this.token+'&param='+this.param
  91. +'&access_time='+this.access_time
  92. })
  93. }
  94. }
  95. });
  96. },
  97. getFindInModel(item){
  98. this.$http('/advancedEpc/findInModel', {
  99. epc_id: this.epc_id,
  100. token: item.token,
  101. param: item.param,
  102. access_time: this.access_time,
  103. page: this.page,
  104. }, 'GET').then(res => {
  105. if(res.code==0 && res.data.result.list.length > 0){
  106. const list = res.data.result.list;
  107. let thisItem = list.find(x => x.caption.includes(this.caption) )
  108. if(thisItem !=undefined){
  109. this.param = thisItem.param;
  110. this.token = thisItem.token;
  111. }
  112. }
  113. });
  114. },
  115. goSearch(str) {
  116. this.inputValue = str
  117. this.page = 1;
  118. this.getItemData();
  119. },
  120. // 配件查询
  121. getItemData() {
  122. uni.showLoading({
  123. title: '加载中'
  124. });
  125. this.$http('advancedEpc/findParts', {
  126. epc_id: this.epc_id,
  127. keyword: this.inputValue,
  128. vin: this.vin,
  129. token: this.token,
  130. param: this.param,
  131. access_time: this.access_time,
  132. page: this.page,
  133. }, 'GET').then(res => {
  134. uni.hideLoading();
  135. this.itemData = res.data.result;
  136. this.access_time = this.itemData.access_time;
  137. var list = res.data.result.list;
  138. this.total_page = res.data.result.total_page;
  139. if (this.page == 1) {
  140. this.itemList = list;
  141. } else if (list.length != 0) {
  142. this.itemList = this.itemList.concat(list)
  143. }
  144. if (this.itemList.length == 0) {
  145. uni.showToast({
  146. title: '暂无符合要求的配件',
  147. icon: 'none',
  148. duration: 2000
  149. });
  150. }
  151. });
  152. },
  153. },
  154. // 下拉刷新 上拉加载更多
  155. onPullDownRefresh() {
  156. // this.page = 1
  157. // this.getItemData()
  158. setTimeout(function() {
  159. uni.stopPullDownRefresh();
  160. }, 1000);
  161. },
  162. onReachBottom() {
  163. if (this.page <= this.total_page) {
  164. this.page++;
  165. this.getItemData()
  166. }
  167. }
  168. }
  169. </script>
  170. <style>
  171. .box {
  172. min-height: 100vh;
  173. background: #FFFFFF;
  174. padding-bottom: constant(safe-area-inset-bottom);
  175. padding-bottom: env(safe-area-inset-bottom);
  176. }
  177. .brand {
  178. /* background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%); */
  179. background: #3F90F7;
  180. padding: 24rpx;
  181. color: #FFFFFF;
  182. font-size: 28rpx;
  183. }
  184. .tab {
  185. background: #FFFFFF;
  186. display: flex;
  187. justify-content: space-around;
  188. line-height: 87rpx;
  189. /* position: fixed; */
  190. width: calc(100vw - 100rpx);
  191. padding-left: 50rpx;
  192. padding-right: 50rpx;
  193. height: 87rpx;
  194. /* z-index: 11; */
  195. }
  196. .tabLine {
  197. font-size: 32rpx;
  198. color: #999999;
  199. text-align: center;
  200. }
  201. .tabActive {
  202. color: #3F90F7;
  203. font-weight: bold;
  204. border-bottom: 4rpx solid #3F90F7;
  205. }
  206. .searchBoxBg {
  207. width: 100%;
  208. background-color: #FFFFFF;
  209. border-top: 1rpx solid #EEEEEE;
  210. border-bottom: 1rpx solid #EEEEEE;
  211. }
  212. .searchBox {
  213. height: 72rpx;
  214. margin: 24rpx;
  215. background-color: #F4F5F7;
  216. border-radius: 36rpx;
  217. display: flex;
  218. position: relative;
  219. }
  220. .searchImg {
  221. margin-top: 20rpx;
  222. margin-left: 20rpx;
  223. width: 32rpx;
  224. height: 32rpx;
  225. }
  226. .searchInput {
  227. height: 72rpx;
  228. font-size: 28rpx;
  229. padding-left: 16rpx;
  230. width: 78%;
  231. }
  232. .searchClose {
  233. position: absolute;
  234. width: 36rpx;
  235. height: 36rpx;
  236. right: 36rpx;
  237. top: 20rpx;
  238. }
  239. .history {
  240. padding: 24rpx;
  241. }
  242. .historyTop {
  243. display: flex;
  244. justify-content: space-between;
  245. }
  246. .historyDelImg {
  247. width: 34rpx;
  248. height: 34rpx;
  249. }
  250. .historyTopTxt {
  251. font-size: 28rpx;
  252. font-weight: 400;
  253. color: #666666;
  254. line-height: 34rpx;
  255. }
  256. .historyLIneBox {
  257. display: inline-flex;
  258. flex-wrap: wrap;
  259. }
  260. .historyLIne {
  261. color: #333333;
  262. font-size: 24rpx;
  263. height: 64rpx;
  264. background: #F4F5F7;
  265. border-radius: 32rpx;
  266. line-height: 64rpx;
  267. padding: 0 24rpx;
  268. margin-top: 20rpx;
  269. margin-right: 24rpx;
  270. }
  271. .commentBox {
  272. padding: 20rpx 24rpx;
  273. border-bottom: 1rpx solid #EEEEEE;
  274. }
  275. .name {
  276. color: #333333;
  277. font-size: 26rpx;
  278. font-weight: bold;
  279. padding-top: 16rpx;
  280. padding-bottom: 10rpx;
  281. }
  282. .comment {
  283. color: #999999;
  284. font-size: 24rpx;
  285. padding-bottom: 14rpx;
  286. }
  287. .code {
  288. color: #3F90F7;
  289. font-size: 24rpx;
  290. }
  291. </style>