sgoodsList.vue 12 KB

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