modelTwo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <template>
  2. <view class="content">
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <view class="zdyNavLeft">
  8. <!-- <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon"
  9. style="color: rgb(0, 0, 0); font-size: 27px;"></i></div> -->
  10. <div class="gobackBox" @click="goback">
  11. <image src="/static/img/goback.png" mode="" class="gobackImg"></image>
  12. </div>
  13. <div class="goHomeBox" @click="goHome">
  14. <image src="/static/img/home.png" mode="" class="goHomeImg"></image>
  15. </div>
  16. </view>
  17. <view class="zdyNavTitle">车型件</view>
  18. <view v-if="param.length != 0" class="zdyNavRight" @click="goOemSearch()">OEM搜索</view>
  19. <view v-else style="width: 120rpx;"></view>
  20. </view>
  21. </view>
  22. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  23. <view style="height: 44px;"></view>
  24. <view v-if="type != 2" class="top">
  25. <view class="topCont">
  26. <view class="carBox">
  27. <!-- <image src="../../static/img/nocar.png" mode="" class="carLogo"></image> -->
  28. <view class="carTxt">{{description}}</view>
  29. <!-- <image src="../../static/img/jt.png" mode="" class="carJt"></image> -->
  30. </view>
  31. <view class="vinBox">
  32. <view class="vinBox2">
  33. <view class="vinB">VIN</view>
  34. <view class="vinNum">{{vin}}</view>
  35. </view>
  36. <view class="vinBox2" v-if="chexingMesList.length != 0">
  37. <view class="detail" @click="goCarDetail()">车型详情</view>
  38. <image src="../../static/img/icon_arrow_blue_r@2x.png" mode="" style="width: 24rpx; height: 24rpx"></image>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-else class="top">
  44. <view class="carBox2">
  45. <view class="carTxt2">{{description}}</view>
  46. </view>
  47. </view>
  48. <view class="mainBox">
  49. <view class="maintitle">{{caption}}
  50. <view @click="goback" class="backBox">
  51. <image src="../../static/img/icon_arrow_blue_l@2x.png" mode="" class="backZongImg"></image>
  52. <view class="backTxt">返回总组</view>
  53. </view>
  54. </view>
  55. <view class="searchBox" v-if="lastShow">
  56. <view class="inputBox">
  57. <img src="../../static/img/icon_search.png" alt="" class="searchImg">
  58. <input type="text" placeholder="快速查找子组" class="topInput" v-model="childrenss"
  59. @confirm="childrenkeyup">
  60. </view>
  61. </view>
  62. <view class="mainLine" v-for="(item,index) in childrenList" @click="goThree(item,index)" v-if="lastShow">
  63. <view class="lineLeft">
  64. <image class="lineIMg" :src="item.image_url" v-if="item.image_url" mode="aspectFit"></image>
  65. <image class="lineIMg" src="../../static/img/noimg.png" v-else mode="aspectFit"></image>
  66. </view>
  67. <view class="lineRIght">
  68. <view class="lineName">{{item.caption}}</view>
  69. <view class="lineBm">{{item.code}}</view>
  70. <view class="linejs" v-html="item.remark"></view>
  71. </view>
  72. </view>
  73. <view class="mainBox m1" v-if="restrainShow1">
  74. <view class="mainLine2" v-for="(item,index) in restrainList1" @click="restrainClickOne(item)">
  75. <view class="lineName2">{{item.caption}}</view>
  76. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  77. </view>
  78. </view>
  79. <view class="mainBox m2" v-if="restrainShow2">
  80. <view class="mainLine2" v-for="(item,index) in restrainList2" @click="restrainClickTwo(item)">
  81. <view class="lineName2">{{item.caption}}</view>
  82. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. vin: '',
  93. brand_name: '',
  94. access_time: '',
  95. zzTime: '',
  96. caption: '',
  97. param: '',
  98. token: '',
  99. list: '',
  100. restrainShow1: false,
  101. restrainList1: '',
  102. restrainShow2: false,
  103. restrainList2: '',
  104. lastShow: false,
  105. childrenList: '',
  106. oldList: '',
  107. childrenss: '',
  108. iStatusBarHeight: '',
  109. epc_id:'',
  110. description:'',
  111. chexingMesList:[],
  112. type:'',
  113. }
  114. },
  115. onLoad(opt) {
  116. this.vin = opt.vin;
  117. this.zzTime = opt.zzTime;
  118. this.param = opt.param;
  119. this.token = opt.token;
  120. this.epc_id = opt.epc_id;
  121. this.description=opt.description;
  122. this.type = opt.type;
  123. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  124. this.getData()
  125. this.chexingMesList = uni.getStorageSync('chexingMesList');
  126. },
  127. methods: {
  128. goOemSearch(){
  129. uni.navigateTo({
  130. url:'OemSearch?brand='+ this.brand_name + '&epc_id=' + this.epc_id + '&vin=' + this.vin + '&param=' + this.param +
  131. '&token=' + this.token + '&access_time=' + this.access_time
  132. })
  133. },
  134. goback() {
  135. console.log('返回');
  136. uni.navigateBack({})
  137. },
  138. goHome(){
  139. var token= uni.getStorageSync("token")
  140. var cachekey= uni.getStorageSync("cachekey")
  141. var url = 'http://byweb.66km.cn/#/home?token='+token+'&cachekey='+cachekey
  142. window.location.href =url
  143. },
  144. restrainClickOne(item) {
  145. this.param = item.param;
  146. this.token = item.token;
  147. if (item.next_restrain == 1) {
  148. this.getYsone()
  149. } else {
  150. this.getYsDlist()
  151. }
  152. },
  153. restrainClickTwo(item) {
  154. this.param = item.param;
  155. this.token = item.token;
  156. if (item.next_restrain == 1) {
  157. //this.getYsDlist()
  158. this.getYsone()
  159. } else {
  160. this.getYsDlist()
  161. }
  162. },
  163. getYsDlist() {
  164. uni.showLoading({
  165. title: '加载中'
  166. });
  167. this.$http('advancedEpc/getSubgroup', {
  168. vin: this.vin,
  169. access_time: this.access_time,
  170. param: this.param,
  171. token: this.token,
  172. epc_id:this.epc_id,
  173. }, 'GET').then(res => {
  174. uni.hideLoading();
  175. //console.log(res.data.number);
  176. if (res.data.number == 200 || res.data.number == 5212) {
  177. this.caption = res.data.result.caption;
  178. this.brand_name = res.data.result.brand_name;
  179. this.access_time = res.data.result.access_time;
  180. this.restrainShow2 = false;
  181. this.restrainShow1 = false;
  182. this.lastShow = true;
  183. this.childrenList = res.data.result.list;
  184. this.oldList = this.childrenList
  185. } else {
  186. uni.showToast({
  187. title: res.data.message,
  188. icon: 'none',
  189. duration: 3000
  190. });
  191. }
  192. });
  193. },
  194. getYsone() {
  195. uni.showLoading({
  196. title: '加载中'
  197. });
  198. this.$http('advancedEpc/getSubgroup', {
  199. vin: this.vin,
  200. access_time: this.access_time,
  201. param: this.param,
  202. token: this.token,
  203. epc_id:this.epc_id,
  204. }, 'GET').then(res => {
  205. uni.hideLoading();
  206. //console.log(res.data.number);
  207. if (res.data.number == 200 || res.data.number == 5212) {
  208. this.caption = res.data.result.caption;
  209. this.brand_name = res.data.result.brand_name;
  210. this.access_time = res.data.result.access_time;
  211. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  212. 'subgroup') { //约束
  213. console.log("约束2")
  214. if(res.data.result.list[0].next_restrain==1){
  215. this.restrainShow2 = true;
  216. this.restrainShow1 = false;
  217. this.restrainList2 = res.data.result.list;
  218. }else{
  219. this.lastShow = true;
  220. this.restrainShow2 = false;
  221. this.restrainShow1 = false;
  222. this.childrenList = res.data.result.list;
  223. this.oldList = this.childrenList
  224. }
  225. } else {
  226. this.lastShow = true;
  227. this.restrainShow1 = false;
  228. this.childrenList = res.data.result.list;
  229. this.oldList = this.childrenList
  230. }
  231. } else {
  232. uni.showToast({
  233. title: res.data.message,
  234. icon: 'none',
  235. duration: 3000
  236. });
  237. }
  238. });
  239. },
  240. getData() {
  241. uni.showLoading({
  242. title: '加载中'
  243. });
  244. this.$http('advancedEpc/getSubgroup', {
  245. vin: this.vin,
  246. access_time: this.zzTime,
  247. param: this.param,
  248. token: this.token,
  249. epc_id:this.epc_id,
  250. }, 'GET').then(res => {
  251. uni.hideLoading();
  252. //console.log(res.data.number);
  253. if (res.data.number == 200 || res.data.number == 5212) {
  254. this.caption = res.data.result.caption;
  255. this.brand_name = res.data.result.brand_name;
  256. this.access_time = res.data.result.access_time;
  257. if (res.data.result.level_identify == 'group_restrain' ) { //约束
  258. console.log("约束1")
  259. this.restrainShow1 = true;
  260. this.restrainList1 = res.data.result.list;
  261. } else {
  262. if(res.data.result.list[0].next_restrain==1){
  263. this.restrainShow1 = true;
  264. this.restrainList1 = res.data.result.list;
  265. }else{
  266. this.lastShow = true;
  267. this.childrenList = res.data.result.list;
  268. this.oldList = this.childrenList
  269. }
  270. }
  271. } else {
  272. uni.showToast({
  273. title: res.data.message,
  274. icon: 'none',
  275. duration: 3000
  276. });
  277. }
  278. });
  279. },
  280. goCarDetail() {
  281. uni.navigateTo({
  282. url: 'CarDetail'
  283. })
  284. },
  285. goThree(item, index) {
  286. var that = this;
  287. uni.setStorage({
  288. key: 'childrenList',
  289. data: that.childrenList,
  290. success: function() {
  291. uni.navigateTo({
  292. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  293. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index+'&epc_id='+that.epc_id
  294. })
  295. }
  296. });
  297. },
  298. childrenkeyup() {
  299. this.childrenList = this.oldList;
  300. if (this.childrenss == '') {
  301. this.childrenList = this.oldList;
  302. } else {
  303. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  304. }
  305. },
  306. query(list, keyWord, attribute = 'caption') {
  307. const reg = new RegExp(keyWord) // 创建正则表达式
  308. const arr = []
  309. for (let i = 0; i < list.length; i++) {
  310. if (reg.test(list[i][attribute])) {
  311. arr.push(list[i])
  312. }
  313. }
  314. return arr
  315. },
  316. }
  317. }
  318. </script>
  319. <style scoped>
  320. .searchImg {
  321. width: 40rpx;
  322. height: 40rpx;
  323. margin-top: 16rpx;
  324. margin-left: 20rpx;
  325. }
  326. .searchBox {
  327. padding-top: 24rpx;
  328. width: 100vw;
  329. }
  330. .inputBox {
  331. width: 702rpx;
  332. height: 72rpx;
  333. background: #F4F5F7;
  334. border-radius: 36rpx;
  335. margin-left: 24rpx;
  336. display: flex;
  337. position: relative;
  338. }
  339. .topInput {
  340. font-size: 28rpx;
  341. height: 72rpx;
  342. line-height: 72rpx;
  343. padding-left: 16rpx;
  344. width: 500rpx;
  345. }
  346. .content {
  347. background: #F4F5F7;
  348. min-height: 100vh;
  349. width: 100vw;
  350. padding-bottom: constant(safe-area-inset-bottom);
  351. padding-bottom: env(safe-area-inset-bottom);
  352. }
  353. .zdyNavBox {
  354. width: 100vw;
  355. background: #FFFFFF;
  356. position: fixed;
  357. top: 0;
  358. left: 0;
  359. z-index: 9999999;
  360. }
  361. .zdyNav {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. padding: 14rpx 6rpx;
  366. }
  367. .zdyNavLeft{
  368. width: 120rpx;
  369. display: flex;
  370. }
  371. .goHomeBox{
  372. padding-left: 20rpx;
  373. padding-top: 6rpx;
  374. }
  375. .goHomeImg{
  376. width: 20px;
  377. height: 20px;
  378. }
  379. .gobackBox{
  380. padding-left: 20rpx;
  381. padding-top: 6rpx;
  382. }
  383. .gobackImg{
  384. width: 10px;
  385. height: 20px;
  386. padding-right: 20rpx;
  387. }
  388. .zdyNavTitle {
  389. background: #FFFFFF;
  390. text-align: center;
  391. /* font-size: 32rpx; */
  392. /* font-weight: bold; */
  393. font-size: 18px!important;
  394. color: #333333!important;
  395. }
  396. .zdyNavRight {
  397. background: #FFFFFF;
  398. text-align: center;
  399. font-size: 28rpx;
  400. color: #3F90F7;
  401. width: 120rpx;
  402. }
  403. .top {
  404. padding: 20rpx 0;
  405. }
  406. .topCont {
  407. width: 750rpx;
  408. height: 160rpx;
  409. background: #FFFFFF;
  410. }
  411. .carLogo {
  412. width: 72rpx;
  413. height: 72rpx;
  414. }
  415. .carTxt {
  416. font-size: 28rpx;
  417. font-family: PingFangSC-Medium, PingFang SC;
  418. font-weight: 500;
  419. color: #333333;
  420. line-height: 36rpx;
  421. width: 606rpx;
  422. }
  423. .carJt {
  424. width: 25rpx;
  425. height: 24rpx;
  426. margin-top: 6rpx;
  427. }
  428. .carBox {
  429. display: flex;
  430. justify-content: space-between;
  431. padding: 30rpx 24rpx 24rpx 34rpx;
  432. }
  433. .carBox2{
  434. background-color: #FFFFFF;
  435. padding: 30rpx 24rpx;
  436. }
  437. .carTxt2 {
  438. font-size: 28rpx;
  439. font-family: PingFangSC-Medium, PingFang SC;
  440. font-weight: 500;
  441. color: #333333;
  442. line-height: 36rpx;
  443. /* width: 606rpx; */
  444. height: 75rpx;
  445. /* 隐藏文字显示 ...超过2行省略 */
  446. overflow: hidden;
  447. -webkit-line-clamp: 2;
  448. text-overflow: ellipsis;
  449. display: -webkit-box;
  450. -webkit-box-orient: vertical;
  451. }
  452. .vinBox {
  453. display: flex;
  454. justify-content: space-between;
  455. padding-left: 34rpx;
  456. padding-right: 24rpx;
  457. }
  458. .vinBox2 {
  459. display: flex;
  460. align-items: center;
  461. }
  462. .detail {
  463. color: #3F90F7;
  464. font-size: 24rpx;
  465. margin-right: 10rpx;
  466. }
  467. .vinB {
  468. background: #F19D01;
  469. width: 60rpx;
  470. height: 30rpx;
  471. text-align: center;
  472. line-height: 30rpx;
  473. color: #FFFFFF;
  474. font-size: 22rpx;
  475. border-radius: 5rpx;
  476. }
  477. .vinNum {
  478. color: #999999;
  479. font-size: 24rpx;
  480. line-height: 30rpx;
  481. padding-left: 10rpx;
  482. }
  483. .mainBox {
  484. background: #FFFFFF;
  485. width: 100vw;
  486. }
  487. .maintitle {
  488. font-size: 28rpx;
  489. font-family: PingFangSC-Medium, PingFang SC;
  490. font-weight: 500;
  491. color: #333333;
  492. text-align: center;
  493. line-height: 88rpx;
  494. border-bottom: 1px solid #EEEEEE;
  495. position: relative;
  496. }
  497. .backZongImg {
  498. width: 25rpx;
  499. height: 24rpx;
  500. margin-top: 4rpx;
  501. }
  502. .backBox {
  503. display: flex;
  504. position: absolute;
  505. left: 23rpx;
  506. top: 28rpx;
  507. }
  508. .backTxt {
  509. color: #3F90F7;
  510. font-size: 24rpx;
  511. line-height: 33rpx;
  512. }
  513. .mainLineJt {
  514. width: 25rpx;
  515. height: 24rpx;
  516. margin-top: 8rpx;
  517. }
  518. .mainLine {
  519. display: flex;
  520. width: calc(100vw - 48rpx);
  521. border-bottom: 1px solid #EEEEEE;
  522. padding: 29rpx 24rpx;
  523. }
  524. .lineName {
  525. font-size: 26rpx;
  526. font-weight: bold;
  527. color: #333333;
  528. line-height: 40rpx;
  529. }
  530. .mainLine2 {
  531. display: flex;
  532. justify-content: space-between;
  533. border-bottom: 1px solid #EEEEEE;
  534. padding: 24rpx;
  535. }
  536. .lineName2 {
  537. font-size: 28rpx;
  538. font-family: PingFangSC-Regular, PingFang SC;
  539. font-weight: 400;
  540. color: #333333;
  541. line-height: 40rpx;
  542. }
  543. .lineIMg {
  544. width: 160rpx;
  545. height: 160rpx;
  546. }
  547. .lineRIght {
  548. padding-left: 20rpx;
  549. padding-right: 24rpx;
  550. }
  551. .lineBm {
  552. font-size: 24rpx;
  553. font-family: PingFangSC-Regular, PingFang SC;
  554. font-weight: 400;
  555. color: #999999;
  556. padding: 10rpx 0;
  557. }
  558. .linejs {
  559. font-size: 24rpx;
  560. font-family: PingFangSC-Regular, PingFang SC;
  561. font-weight: 400;
  562. color: #999999;
  563. }
  564. </style>