sgoodsList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view class="content">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'搜索'"></homenav>
  4. <view class="sTopBox">
  5. <view class="searchInputBox" >
  6. <image src="../../static/img/icon_search.png" mode="" class="simg"></image>
  7. <input v-model="name" type="text" placeholder="请输入商品"
  8. placeholder-class="ip" class="ssinput" @confirm="searchFn" focus>
  9. <image src="../../static/img/icon_search_del.png" mode="" class="search_del" @click="searchDel"></image>
  10. </view>
  11. <view class="searchBtn" @click="searchFn">
  12. 搜索
  13. </view>
  14. </view>
  15. <view style="height: 20rpx;background: #F4F5F7;"></view>
  16. <view class="cont">
  17. <view class="goosLeft">
  18. <view class="goodsLefeLine" :class="{glActive:leftIndex==index}"
  19. @click="leftFn(index,item)" v-for="(item,index) in leftData">
  20. <view class="leftKK" v-if="leftIndex==index"></view>
  21. <view v-else class="leftKK2"></view>
  22. <view class="glName">{{item.name}}</view>
  23. </view>
  24. </view>
  25. <view class="jiyouBox">
  26. <view class="jylineBox">
  27. <view class="jyline" v-for="(item,index) in MaintainPartList" @click="godetail(item)"><!-- MaintainPartList -->
  28. <view class="jyimgBox">
  29. <image v-if="item.imgs.split(',')[0]" :src="item.imgs.split(',')[0]" mode="aspectFit" class="jyimg"></image>
  30. <image v-else src="../../static/img/noimg.png" mode="aspectFit" class="jyimg"></image>
  31. </view>
  32. <view class="lineRgiht">
  33. <view class="goodsName">{{item.name}} </view>
  34. <view class="goodsMs">型号:{{item.specificationModel}} <span class="factoryNumber" v-if="item.factoryNumber">{{item.factoryNumber}}</span></view>
  35. <view class="goodsMs modelRemark" @click.stop="modelRemarkFn(item.modelRemark)">适用车型:{{item.modelRemark}}</view>
  36. <view class="lineBottom">
  37. <view class="gengduosp" @click.stop="goSp(item)">更多适配</view>
  38. <view class="correction" ></view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view style="width: 500rpx;padding-top: 200rpx;" v-if="MaintainPartList.length==0">
  44. <nodata ></nodata>
  45. </view>
  46. </view>
  47. </view>
  48. <uni-popup ref="popup" background-color="#fff">
  49. <!-- <uni-popup-message type="center" :message="messageText" :duration="2000"></uni-popup-message> -->
  50. <view class="popup-content" ><text
  51. class="text">{{messageText}}</text></view>
  52. </uni-popup>
  53. </view>
  54. </template>
  55. <script>
  56. import nodata from '../../components/nodata/nodata.vue'
  57. import homenav from "../../components/homenav/nav.vue"
  58. export default {
  59. components: {
  60. nodata,homenav
  61. },
  62. data() {
  63. return {
  64. optdata:'',
  65. MaintainPartList:[],
  66. oilusage:'',
  67. iStatusBarHeight:'',
  68. loading:false,
  69. spec:'',
  70. modelRemarkNum:1,
  71. oldMaintainPartList:'',
  72. componentCode:'',
  73. leftData:[
  74. {name:'全部',componentCode:''},
  75. {name:'点火线圈',componentCode:'001006003'},
  76. {name:'火花塞',componentCode:'001006001'},
  77. ],
  78. leftIndex:0,
  79. pageIndex:1,
  80. name:'',
  81. messageText:'',
  82. }
  83. },
  84. onLoad(opt) {
  85. console.log(opt)
  86. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  87. this.optdata=opt;
  88. this.queryMaintainPartList()
  89. // this.queryOilInfoByGroupID()
  90. },
  91. methods: {
  92. modelRemarkFn(txt){
  93. this.messageText=txt
  94. this.$refs.popup.open('center')
  95. },
  96. leftFn(index,item){
  97. this.pageIndex=1
  98. this.MaintainPartList=[]
  99. this.leftIndex=index
  100. this.componentCode=item.componentCode
  101. // this.componentName=item.name
  102. this.queryMaintainPartList()
  103. },
  104. goinstallation(){
  105. uni.navigateTo({
  106. url:'installation?groupIds='+this.optdata.id+'&componentId='
  107. })
  108. },
  109. modelRemarkTab(num){
  110. this.modelRemarkNum=num
  111. if(num == 1){
  112. var name='0-10万公里'
  113. var arr=[]
  114. this.oldMaintainPartList.forEach(item=>{
  115. var state=false
  116. item.ruleList.forEach(v=>{
  117. if(v.version == name){
  118. state=true
  119. }
  120. })
  121. if(state){
  122. arr.push(item)
  123. }
  124. })
  125. this.MaintainPartList=arr
  126. //this.MaintainPartList= this.oldMaintainPartList.filter(item => item.modelRemark.includes(name))
  127. }else{
  128. var name='10万公里以上'
  129. var arr=[]
  130. this.oldMaintainPartList.forEach(item=>{
  131. var state=false
  132. item.ruleList.forEach(v=>{
  133. if(v.version == name){
  134. state=true
  135. }
  136. })
  137. if(state){
  138. arr.push(item)
  139. }
  140. })
  141. this.MaintainPartList=arr
  142. //this.MaintainPartList= this.oldMaintainPartList.filter(item => item.modelRemark.includes(name))
  143. }
  144. },
  145. searchFn(){
  146. this.pageIndex=1
  147. this.MaintainPartList=[]
  148. this.queryMaintainPartList()
  149. },
  150. searchDel(){
  151. this.name=''
  152. },
  153. queryMaintainPartList(){
  154. this.loading=false;
  155. uni.showLoading({ title: '加载中'});
  156. this.$http('partsByOpen/queryPartsListV2', {
  157. //groupId:this.optdata.id,
  158. pageSize:20,
  159. pageIndex:this.pageIndex,
  160. categoryCodes:this.componentCode,
  161. name:this.name
  162. },'POST').then(res => {
  163. this.loading=true;
  164. uni.hideLoading();
  165. //this.MaintainPartList=res.data
  166. this.MaintainPartList=this.MaintainPartList.concat(res.data)
  167. // this.oldMaintainPartList=res.data
  168. // this.modelRemarkTab(1)
  169. })
  170. },
  171. queryOilInfoByGroupID(){
  172. var that=this;
  173. this.$http('matchingByOpen/queryOilInfoByGroupID', {
  174. // mileage:'30000',
  175. groupId:this.optdata.id,
  176. },'POST').then(res => {
  177. var arr = res.data
  178. arr.forEach(item=>{
  179. if(item[0]=='机油'){
  180. that.oilusage=item[2]
  181. that.spec=item[1]
  182. }
  183. })
  184. console.log(that.oilusage)
  185. })
  186. },
  187. goby(){
  188. uni.navigateTo({
  189. url:'/pages/index/maintenance?nLevelID='+this.optdata.nLevelID+'&id='+this.optdata.id
  190. })
  191. },
  192. goSp(item){
  193. var title=item.brand+item.name
  194. var title2=item.partsCode+" | "+item.specificationModel
  195. uni.navigateTo({
  196. url:'adaptationsMore?partsId='+item.id+'&title='+title+'&title2='+title2
  197. })
  198. },
  199. godetail(e){
  200. uni.navigateTo({
  201. url:'/pages/index/goodsDetail?id='+e.id
  202. })
  203. },
  204. gopz(){
  205. uni.navigateTo({
  206. url:'/pages/index/carConfiguration?nLevelID='+this.optdata.nLevelID
  207. })
  208. }
  209. },
  210. // 上拉加载更多
  211. onReachBottom() {
  212. this.pageIndex++;
  213. this.queryMaintainPartList()
  214. },
  215. }
  216. </script>
  217. <style scoped lang="less">
  218. .salesLine{
  219. display: flex;
  220. font-size: 24rpx;
  221. line-height: 30rpx;
  222. padding: 20rpx 0;
  223. }
  224. .salesLeft{
  225. width: 200rpx;
  226. color: #999999;
  227. }
  228. .content {
  229. /* min-height: 100vh;
  230. background: #F4F5F7; */
  231. }
  232. .jyimgBox{
  233. border: 1px solid #EEEEEE; width: 90rpx;border-radius: 10rpx;
  234. height: 90rpx;
  235. }
  236. .box {
  237. padding: 0 24rpx;
  238. background: #ffffff;
  239. }
  240. .historylinecarImg{
  241. width: 54rpx;
  242. height: 54rpx;
  243. }
  244. .historyLogoBox{
  245. display: flex;align-items: center;
  246. padding-right: 14rpx;
  247. }
  248. .historylinecar {
  249. font-weight: 500;
  250. font-size: 26rpx;
  251. color: #1A1A1A;
  252. line-height: 46rpx;
  253. width: 636rpx;
  254. }
  255. .historyLine {
  256. display: flex;
  257. padding: 30rpx 0;
  258. /* border-top: 1rpx solid #EEEEEE; */
  259. padding-bottom: 16rpx;
  260. }
  261. .cont {
  262. /* padding: 30rpx 24rpx; */
  263. display: flex;
  264. /* margin-top: 20rpx; */
  265. }
  266. .toplineImg{
  267. width: 35rpx;
  268. height: 34rpx;
  269. }
  270. .topName{
  271. line-height: 34rpx;font-weight: 400;
  272. color: #FFFFFF;font-size: 28rpx;padding-left: 16rpx;
  273. }
  274. .topBox{
  275. width: 702rpx;
  276. height: 98rpx;
  277. background: #FFFFFF linear-gradient(132deg, #FF8635 0%, #FF4828 100%);
  278. border-radius: 16rpx;
  279. display: flex;justify-content: center;
  280. }
  281. .topsx{
  282. width: 2rpx;background: #ffffff;
  283. margin-left: 85rpx;margin-right: 85rpx;
  284. height: 54rpx;margin-top: 22rpx;
  285. }
  286. .topLine{
  287. display: flex;padding-top: 34rpx;
  288. }
  289. .jiyouTop{
  290. display: flex;justify-content: space-between;
  291. }
  292. .jiyouBox{
  293. background: #ffffff;
  294. padding-top: 0;
  295. }
  296. .jiyoutopTitle{
  297. font-weight: 500;font-size: 28rpx;
  298. color: #1A1A1A;
  299. line-height: 40rpx;
  300. }
  301. .jyzl{
  302. font-weight: 400;line-height: 40rpx;
  303. color: #666666;font-size: 24rpx;
  304. }
  305. .jyimg{
  306. width: 90rpx;
  307. height: 90rpx;
  308. border-radius: 10rpx;
  309. }
  310. .jyline{
  311. padding-bottom: 26rpx;
  312. display: flex;
  313. border-bottom: 1px solid #eaeaea;
  314. padding-top: 26rpx;
  315. padding-left: 20rpx;
  316. }
  317. .jyName{
  318. font-weight: 400;font-size: 22rpx;
  319. color: #1A1A1A;
  320. line-height:36rpx ;
  321. overflow: hidden;
  322. text-overflow: ellipsis;
  323. display: -webkit-box;
  324. -webkit-box-orient: vertical;
  325. -webkit-line-clamp: 2;
  326. padding-top: 10rpx;
  327. }
  328. .best{
  329. color: #FF4F00;border-radius: 6rpx;
  330. padding: 0 8rpx;border: 1px solid #FF4F00;
  331. }
  332. .jylineBox{
  333. /* display: flex;justify-content: space-between;flex-wrap: wrap; */
  334. }
  335. .historyLineVin{
  336. display: flex;background: #ffffff;
  337. }
  338. .historyLineCar{
  339. display: flex;justify-content: space-between;
  340. }
  341. .vinNum{
  342. font-weight: 400;font-size: 22rpx;padding-left: 10rpx;
  343. color: #999999;line-height: 30rpx;
  344. }
  345. .vinms{
  346. width: 38rpx;
  347. height: 26rpx;
  348. background: linear-gradient(224deg, #FFDA28 0%, #FFBF35 100%);
  349. border-radius: 4rpx;
  350. text-align: center;
  351. line-height: 26rpx;
  352. font-weight: 600;
  353. color: #FFFFFF;
  354. font-size: 18rpx;
  355. margin-top: 2rpx;
  356. }
  357. .ruleListSpan{
  358. font-weight: 400;
  359. font-size: 22rpx;
  360. color: #999999;
  361. line-height: 36rpx;
  362. padding-right: 6rpx;
  363. }
  364. .modelRemarkBox{
  365. display: flex;padding-bottom: 20rpx;
  366. }
  367. .modelRemarkLine{
  368. background: #eee;
  369. padding: 6rpx 20rpx;
  370. border-radius: 6rpx;
  371. margin-right: 30rpx;
  372. font-size: 26rpx;
  373. }
  374. .activeMr{
  375. background: #FFFFFF linear-gradient(132deg, #FF8635 0%, #FF4828 100%);
  376. color: #FFF;
  377. }
  378. .topBtnBox{
  379. display: flex;padding-bottom: 30rpx;
  380. padding-left: 70rpx;
  381. }
  382. .topBtn{
  383. font-weight: 400;
  384. font-size: 26rpx;
  385. color: #F19D01;
  386. width: 180rpx;
  387. height: 56rpx;
  388. border-radius: 28rpx;
  389. border: 1px solid #F19D01;
  390. line-height: 56rpx;
  391. text-align: center;
  392. margin-right: 30rpx;
  393. }
  394. .copyVin{
  395. font-weight: 400;
  396. font-size: 22rpx;
  397. color: #3C3C3C;
  398. width: 62rpx;
  399. height: 34rpx;
  400. background: #F4F5F7;
  401. border-radius: 4rpx;
  402. line-height: 34rpx;
  403. text-align: center;
  404. margin-left: 16rpx;
  405. }
  406. .brandBox{
  407. display: flex;
  408. }
  409. .brandBtn{
  410. font-size: 26rpx;
  411. color: #3C3C3C;
  412. padding: 10rpx 20rpx;
  413. background: #F6F6F6;
  414. border-radius: 6rpx;
  415. margin-right: 20rpx;
  416. }
  417. .lineRgiht{
  418. padding-left: 16rpx;
  419. }
  420. .goodsName{
  421. font-size: 30rpx;
  422. color: #222;
  423. line-height: 40rpx;
  424. }
  425. .goodsMs{
  426. font-size: 26rpx;
  427. color: #3C3C3C;
  428. line-height: 33rpx;
  429. padding-top: 6rpx;
  430. }
  431. .sTopBox{
  432. display: flex;padding: 30rpx 24rpx;
  433. padding-bottom: 20rpx;
  434. }
  435. .searchBtn{
  436. font-weight: 400;font-size: 28rpx;padding-left: 24rpx;
  437. color: #3E86F0;line-height: 80rpx;
  438. }
  439. .searchInputBox{
  440. width: 600rpx;display: flex;
  441. height: 80rpx;position: relative;
  442. background: #F9F9F9;
  443. border-radius: 16rpx;
  444. }
  445. .ssinput{
  446. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  447. width: 480rpx;
  448. }
  449. .search_del{
  450. width: 36rpx;height: 36rpx;padding-top: 23rpx;padding-bottom: 10px;padding-right: 24rpx;
  451. position: absolute;
  452. right: 0;
  453. z-index: 11;
  454. }
  455. .simg{
  456. width: 36rpx;height: 34rpx;margin-top: 25rpx;margin-left:30rpx;
  457. }
  458. .goosLeft{
  459. width: 170rpx;
  460. font-size: 26rpx;
  461. color: #3C3C3C;
  462. background: #F6F6F6;
  463. height: calc(100vh - 350rpx);
  464. }
  465. .goodscont{
  466. display: flex;margin-top: 20rpx;
  467. min-height: calc(100vh - 450rpx);
  468. }
  469. .goodsLefeLine{
  470. display: flex;justify-content: center;
  471. padding: 22rpx 10rpx;
  472. }
  473. .glActive{
  474. background: #ffffff;
  475. }
  476. .glActive .glName{
  477. font-weight: 500;
  478. font-size: 30rpx;
  479. color: #E60006;
  480. /* border-left:4rpx solid #E60006; */
  481. }
  482. .leftKK{
  483. background: #E60006;
  484. width: 6rpx ;
  485. height: 24rpx;
  486. border-radius: 4rpx;
  487. margin-top: 6rpx;
  488. overflow: hidden;
  489. }
  490. .leftKK2{
  491. width: 4rpx ;
  492. }
  493. .glName{
  494. width: 170rpx;text-align: center;
  495. font-size: 30rpx;
  496. }
  497. .modelRemark{
  498. overflow: hidden;
  499. text-overflow: ellipsis;
  500. white-space: nowrap; /* 防止文本换行 */
  501. width: 430rpx;
  502. }
  503. .popup-content {
  504. display: flex;
  505. align-items: center;
  506. justify-content: center;
  507. padding: 15px;
  508. background-color: #fff;
  509. max-height: 60vh;
  510. overflow: scroll;
  511. }
  512. .factoryNumber{
  513. padding: 0 10rpx;
  514. border-radius: 8rpx;
  515. border:1px solid #E60006;
  516. margin-left: 10rpx;
  517. display: inline-block;
  518. /* background: #E60006; */
  519. font-size: 26rpx;
  520. color: #E60006;
  521. }
  522. .lineBottom{
  523. display: flex;justify-content: space-between;
  524. font-size: 26rpx;
  525. padding-top: 10rpx;
  526. }
  527. .correction{
  528. color: #999999;padding-right: 4rpx;
  529. }
  530. .gengduosp{
  531. color: #E60006;
  532. }
  533. </style>