goodsList.vue 15 KB

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