sgoodsList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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. searchDel(){
  147. this.name=''
  148. },
  149. queryMaintainPartList(){
  150. this.loading=false;
  151. uni.showLoading({ title: '加载中'});
  152. this.$http('partsByOpen/queryPartsListV2', {
  153. //groupId:this.optdata.id,
  154. pageSize:20,
  155. pageIndex:this.pageIndex,
  156. categoryCodes:this.componentCode,
  157. name:this.name
  158. },'POST').then(res => {
  159. this.loading=true;
  160. uni.hideLoading();
  161. //this.MaintainPartList=res.data
  162. this.MaintainPartList=this.MaintainPartList.concat(res.data)
  163. // this.oldMaintainPartList=res.data
  164. // this.modelRemarkTab(1)
  165. })
  166. },
  167. queryOilInfoByGroupID(){
  168. var that=this;
  169. this.$http('matchingByOpen/queryOilInfoByGroupID', {
  170. // mileage:'30000',
  171. groupId:this.optdata.id,
  172. },'POST').then(res => {
  173. var arr = res.data
  174. arr.forEach(item=>{
  175. if(item[0]=='机油'){
  176. that.oilusage=item[2]
  177. that.spec=item[1]
  178. }
  179. })
  180. console.log(that.oilusage)
  181. })
  182. },
  183. goby(){
  184. uni.navigateTo({
  185. url:'/pages/index/maintenance?nLevelID='+this.optdata.nLevelID+'&id='+this.optdata.id
  186. })
  187. },
  188. godetail(e){
  189. uni.navigateTo({
  190. url:'/pages/index/goodsDetail?id='+e.id
  191. })
  192. },
  193. gopz(){
  194. uni.navigateTo({
  195. url:'/pages/index/carConfiguration?nLevelID='+this.optdata.nLevelID
  196. })
  197. }
  198. },
  199. // 上拉加载更多
  200. onReachBottom() {
  201. this.pageIndex++;
  202. this.queryMaintainPartList()
  203. },
  204. }
  205. </script>
  206. <style scoped lang="less">
  207. .salesLine{
  208. display: flex;
  209. font-size: 24rpx;
  210. line-height: 30rpx;
  211. padding: 20rpx 0;
  212. }
  213. .salesLeft{
  214. width: 200rpx;
  215. color: #999999;
  216. }
  217. .content {
  218. /* min-height: 100vh;
  219. background: #F4F5F7; */
  220. }
  221. .jyimgBox{
  222. border: 1px solid #EEEEEE; width: 90rpx;border-radius: 10rpx;
  223. height: 90rpx;
  224. }
  225. .box {
  226. padding: 0 24rpx;
  227. background: #ffffff;
  228. }
  229. .historylinecarImg{
  230. width: 54rpx;
  231. height: 54rpx;
  232. }
  233. .historyLogoBox{
  234. display: flex;align-items: center;
  235. padding-right: 14rpx;
  236. }
  237. .historylinecar {
  238. font-weight: 500;
  239. font-size: 26rpx;
  240. color: #1A1A1A;
  241. line-height: 46rpx;
  242. width: 636rpx;
  243. }
  244. .historyLine {
  245. display: flex;
  246. padding: 30rpx 0;
  247. /* border-top: 1rpx solid #EEEEEE; */
  248. padding-bottom: 16rpx;
  249. }
  250. .cont {
  251. /* padding: 30rpx 24rpx; */
  252. display: flex;
  253. /* margin-top: 20rpx; */
  254. }
  255. .toplineImg{
  256. width: 35rpx;
  257. height: 34rpx;
  258. }
  259. .topName{
  260. line-height: 34rpx;font-weight: 400;
  261. color: #FFFFFF;font-size: 28rpx;padding-left: 16rpx;
  262. }
  263. .topBox{
  264. width: 702rpx;
  265. height: 98rpx;
  266. background: #FFFFFF linear-gradient(132deg, #FF8635 0%, #FF4828 100%);
  267. border-radius: 16rpx;
  268. display: flex;justify-content: center;
  269. }
  270. .topsx{
  271. width: 2rpx;background: #ffffff;
  272. margin-left: 85rpx;margin-right: 85rpx;
  273. height: 54rpx;margin-top: 22rpx;
  274. }
  275. .topLine{
  276. display: flex;padding-top: 34rpx;
  277. }
  278. .jiyouTop{
  279. display: flex;justify-content: space-between;
  280. }
  281. .jiyouBox{
  282. background: #ffffff;
  283. padding-top: 0;
  284. }
  285. .jiyoutopTitle{
  286. font-weight: 500;font-size: 28rpx;
  287. color: #1A1A1A;
  288. line-height: 40rpx;
  289. }
  290. .jyzl{
  291. font-weight: 400;line-height: 40rpx;
  292. color: #666666;font-size: 24rpx;
  293. }
  294. .jyimg{
  295. width: 90rpx;
  296. height: 90rpx;
  297. border-radius: 10rpx;
  298. }
  299. .jyline{
  300. padding-bottom: 26rpx;
  301. display: flex;
  302. border-bottom: 1px solid #eaeaea;
  303. padding-top: 26rpx;
  304. padding-left: 20rpx;
  305. }
  306. .jyName{
  307. font-weight: 400;font-size: 22rpx;
  308. color: #1A1A1A;
  309. line-height:36rpx ;
  310. overflow: hidden;
  311. text-overflow: ellipsis;
  312. display: -webkit-box;
  313. -webkit-box-orient: vertical;
  314. -webkit-line-clamp: 2;
  315. padding-top: 10rpx;
  316. }
  317. .best{
  318. color: #FF4F00;border-radius: 6rpx;
  319. padding: 0 8rpx;border: 1px solid #FF4F00;
  320. }
  321. .jylineBox{
  322. /* display: flex;justify-content: space-between;flex-wrap: wrap; */
  323. }
  324. .historyLineVin{
  325. display: flex;background: #ffffff;
  326. }
  327. .historyLineCar{
  328. display: flex;justify-content: space-between;
  329. }
  330. .vinNum{
  331. font-weight: 400;font-size: 22rpx;padding-left: 10rpx;
  332. color: #999999;line-height: 30rpx;
  333. }
  334. .vinms{
  335. width: 38rpx;
  336. height: 26rpx;
  337. background: linear-gradient(224deg, #FFDA28 0%, #FFBF35 100%);
  338. border-radius: 4rpx;
  339. text-align: center;
  340. line-height: 26rpx;
  341. font-weight: 600;
  342. color: #FFFFFF;
  343. font-size: 18rpx;
  344. margin-top: 2rpx;
  345. }
  346. .ruleListSpan{
  347. font-weight: 400;
  348. font-size: 22rpx;
  349. color: #999999;
  350. line-height: 36rpx;
  351. padding-right: 6rpx;
  352. }
  353. .modelRemarkBox{
  354. display: flex;padding-bottom: 20rpx;
  355. }
  356. .modelRemarkLine{
  357. background: #eee;
  358. padding: 6rpx 20rpx;
  359. border-radius: 6rpx;
  360. margin-right: 30rpx;
  361. font-size: 26rpx;
  362. }
  363. .activeMr{
  364. background: #FFFFFF linear-gradient(132deg, #FF8635 0%, #FF4828 100%);
  365. color: #FFF;
  366. }
  367. .topBtnBox{
  368. display: flex;padding-bottom: 30rpx;
  369. padding-left: 70rpx;
  370. }
  371. .topBtn{
  372. font-weight: 400;
  373. font-size: 26rpx;
  374. color: #F19D01;
  375. width: 180rpx;
  376. height: 56rpx;
  377. border-radius: 28rpx;
  378. border: 1px solid #F19D01;
  379. line-height: 56rpx;
  380. text-align: center;
  381. margin-right: 30rpx;
  382. }
  383. .copyVin{
  384. font-weight: 400;
  385. font-size: 22rpx;
  386. color: #3C3C3C;
  387. width: 62rpx;
  388. height: 34rpx;
  389. background: #F4F5F7;
  390. border-radius: 4rpx;
  391. line-height: 34rpx;
  392. text-align: center;
  393. margin-left: 16rpx;
  394. }
  395. .brandBox{
  396. display: flex;
  397. }
  398. .brandBtn{
  399. font-size: 26rpx;
  400. color: #3C3C3C;
  401. padding: 10rpx 20rpx;
  402. background: #F6F6F6;
  403. border-radius: 6rpx;
  404. margin-right: 20rpx;
  405. }
  406. .lineRgiht{
  407. padding-left: 16rpx;
  408. }
  409. .goodsName{
  410. font-size: 30rpx;
  411. color: #222;
  412. line-height: 40rpx;
  413. }
  414. .goodsMs{
  415. font-size: 26rpx;
  416. color: #3C3C3C;
  417. line-height: 33rpx;
  418. padding-top: 6rpx;
  419. }
  420. .sTopBox{
  421. display: flex;padding: 30rpx 24rpx;
  422. padding-bottom: 20rpx;
  423. }
  424. .searchBtn{
  425. font-weight: 400;font-size: 28rpx;padding-left: 24rpx;
  426. color: #3E86F0;line-height: 80rpx;
  427. }
  428. .searchInputBox{
  429. width: 600rpx;display: flex;
  430. height: 80rpx;position: relative;
  431. background: #F9F9F9;
  432. border-radius: 16rpx;
  433. }
  434. .ssinput{
  435. font-size: 28rpx;font-weight: 400;padding-left: 24rpx;line-height: 80rpx;height: 80rpx;
  436. width: 480rpx;
  437. }
  438. .search_del{
  439. width: 36rpx;height: 36rpx;padding-top: 23rpx;padding-bottom: 10px;padding-right: 24rpx;
  440. position: absolute;
  441. right: 0;
  442. z-index: 11;
  443. }
  444. .simg{
  445. width: 36rpx;height: 34rpx;margin-top: 25rpx;margin-left:30rpx;
  446. }
  447. .goosLeft{
  448. width: 170rpx;
  449. font-size: 26rpx;
  450. color: #3C3C3C;
  451. background: #F6F6F6;
  452. height: calc(100vh - 350rpx);
  453. }
  454. .goodscont{
  455. display: flex;margin-top: 20rpx;
  456. min-height: calc(100vh - 450rpx);
  457. }
  458. .goodsLefeLine{
  459. display: flex;justify-content: center;
  460. padding: 22rpx 10rpx;
  461. }
  462. .glActive{
  463. background: #ffffff;
  464. }
  465. .glActive .glName{
  466. font-weight: 500;
  467. font-size: 30rpx;
  468. color: #E60006;
  469. /* border-left:4rpx solid #E60006; */
  470. }
  471. .leftKK{
  472. background: #E60006;
  473. width: 6rpx ;
  474. height: 24rpx;
  475. border-radius: 4rpx;
  476. margin-top: 6rpx;
  477. overflow: hidden;
  478. }
  479. .leftKK2{
  480. width: 4rpx ;
  481. }
  482. .glName{
  483. width: 170rpx;text-align: center;
  484. font-size: 30rpx;
  485. }
  486. .modelRemark{
  487. overflow: hidden;
  488. text-overflow: ellipsis;
  489. white-space: nowrap; /* 防止文本换行 */
  490. width: 430rpx;
  491. }
  492. .popup-content {
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. padding: 15px;
  497. background-color: #fff;
  498. max-height: 60vh;
  499. overflow: scroll;
  500. }
  501. .factoryNumber{
  502. padding: 0 10rpx;
  503. border-radius: 8rpx;
  504. border:1px solid #E60006;
  505. margin-left: 10rpx;
  506. display: inline-block;
  507. /* background: #E60006; */
  508. font-size: 26rpx;
  509. color: #E60006;
  510. }
  511. </style>