modelTwo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. if(this.vin){
  143. var url = 'http://byweb.66km.cn/#/home?token='+token//+'&cachekey='+cachekey
  144. }else{
  145. var url = 'http://byweb.66km.cn/#/home?token='+token+'&cachekey='+cachekey
  146. }
  147. window.location.href =url
  148. },
  149. restrainClickOne(item) {
  150. this.param = item.param;
  151. this.token = item.token;
  152. if (item.next_restrain == 1) {
  153. this.getYsone()
  154. } else {
  155. this.getYsDlist()
  156. }
  157. },
  158. restrainClickTwo(item) {
  159. this.param = item.param;
  160. this.token = item.token;
  161. if (item.next_restrain == 1) {
  162. //this.getYsDlist()
  163. this.getYsone()
  164. } else {
  165. this.getYsDlist()
  166. }
  167. },
  168. getYsDlist() {
  169. uni.showLoading({
  170. title: '加载中'
  171. });
  172. this.$http('advancedEpc/getSubgroup', {
  173. vin: this.vin,
  174. access_time: this.access_time,
  175. param: this.param,
  176. token: this.token,
  177. epc_id:this.epc_id,
  178. }, 'GET').then(res => {
  179. uni.hideLoading();
  180. //console.log(res.data.number);
  181. if (res.data.number == 200 || res.data.number == 5212) {
  182. this.caption = res.data.result.caption;
  183. this.brand_name = res.data.result.brand_name;
  184. this.access_time = res.data.result.access_time;
  185. this.restrainShow2 = false;
  186. this.restrainShow1 = false;
  187. this.lastShow = true;
  188. this.childrenList = res.data.result.list;
  189. this.oldList = this.childrenList
  190. } else {
  191. uni.showToast({
  192. title: res.data.message,
  193. icon: 'none',
  194. duration: 3000
  195. });
  196. }
  197. });
  198. },
  199. getYsone() {
  200. uni.showLoading({
  201. title: '加载中'
  202. });
  203. this.$http('advancedEpc/getSubgroup', {
  204. vin: this.vin,
  205. access_time: this.access_time,
  206. param: this.param,
  207. token: this.token,
  208. epc_id:this.epc_id,
  209. }, 'GET').then(res => {
  210. uni.hideLoading();
  211. //console.log(res.data.number);
  212. if (res.data.number == 200 || res.data.number == 5212) {
  213. this.caption = res.data.result.caption;
  214. this.brand_name = res.data.result.brand_name;
  215. this.access_time = res.data.result.access_time;
  216. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  217. 'subgroup') { //约束
  218. console.log("约束2")
  219. if(res.data.result.list[0].next_restrain==1){
  220. this.restrainShow2 = true;
  221. this.restrainShow1 = false;
  222. this.restrainList2 = res.data.result.list;
  223. }else{
  224. this.lastShow = true;
  225. this.restrainShow2 = false;
  226. this.restrainShow1 = false;
  227. this.childrenList = res.data.result.list;
  228. this.oldList = this.childrenList
  229. }
  230. } else {
  231. this.lastShow = true;
  232. this.restrainShow1 = false;
  233. this.childrenList = res.data.result.list;
  234. this.oldList = this.childrenList
  235. }
  236. } else {
  237. uni.showToast({
  238. title: res.data.message,
  239. icon: 'none',
  240. duration: 3000
  241. });
  242. }
  243. });
  244. },
  245. getData() {
  246. uni.showLoading({
  247. title: '加载中'
  248. });
  249. this.$http('advancedEpc/getSubgroup', {
  250. vin: this.vin,
  251. access_time: this.zzTime,
  252. param: this.param,
  253. token: this.token,
  254. epc_id:this.epc_id,
  255. }, 'GET').then(res => {
  256. uni.hideLoading();
  257. //console.log(res.data.number);
  258. if (res.data.number == 200 || res.data.number == 5212) {
  259. this.caption = res.data.result.caption;
  260. this.brand_name = res.data.result.brand_name;
  261. this.access_time = res.data.result.access_time;
  262. if (res.data.result.level_identify == 'group_restrain' ) { //约束
  263. console.log("约束1")
  264. this.restrainShow1 = true;
  265. this.restrainList1 = res.data.result.list;
  266. } else {
  267. if(res.data.result.list[0].next_restrain==1){
  268. this.restrainShow1 = true;
  269. this.restrainList1 = res.data.result.list;
  270. }else{
  271. this.lastShow = true;
  272. this.childrenList = res.data.result.list;
  273. this.oldList = this.childrenList
  274. }
  275. }
  276. } else {
  277. uni.showToast({
  278. title: res.data.message,
  279. icon: 'none',
  280. duration: 3000
  281. });
  282. }
  283. });
  284. },
  285. goCarDetail() {
  286. uni.navigateTo({
  287. url: 'CarDetail'
  288. })
  289. },
  290. goThree(item, index) {
  291. var that = this;
  292. uni.setStorage({
  293. key: 'childrenList',
  294. data: that.childrenList,
  295. success: function() {
  296. uni.navigateTo({
  297. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  298. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index+'&epc_id='+that.epc_id
  299. })
  300. }
  301. });
  302. },
  303. childrenkeyup() {
  304. this.childrenList = this.oldList;
  305. if (this.childrenss == '') {
  306. this.childrenList = this.oldList;
  307. } else {
  308. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  309. }
  310. },
  311. query(list, keyWord, attribute = 'caption') {
  312. const reg = new RegExp(keyWord) // 创建正则表达式
  313. const arr = []
  314. for (let i = 0; i < list.length; i++) {
  315. if (reg.test(list[i][attribute])) {
  316. arr.push(list[i])
  317. }
  318. }
  319. return arr
  320. },
  321. }
  322. }
  323. </script>
  324. <style scoped>
  325. .searchImg {
  326. width: 40rpx;
  327. height: 40rpx;
  328. margin-top: 16rpx;
  329. margin-left: 20rpx;
  330. }
  331. .searchBox {
  332. padding-top: 24rpx;
  333. width: 100vw;
  334. }
  335. .inputBox {
  336. width: 702rpx;
  337. height: 72rpx;
  338. background: #F4F5F7;
  339. border-radius: 36rpx;
  340. margin-left: 24rpx;
  341. display: flex;
  342. position: relative;
  343. }
  344. .topInput {
  345. font-size: 28rpx;
  346. height: 72rpx;
  347. line-height: 72rpx;
  348. padding-left: 16rpx;
  349. width: 500rpx;
  350. }
  351. .content {
  352. background: #F4F5F7;
  353. min-height: 100vh;
  354. width: 100vw;
  355. padding-bottom: constant(safe-area-inset-bottom);
  356. padding-bottom: env(safe-area-inset-bottom);
  357. }
  358. .zdyNavBox {
  359. width: 100vw;
  360. background: #FFFFFF;
  361. position: fixed;
  362. top: 0;
  363. left: 0;
  364. z-index: 9999999;
  365. }
  366. .zdyNav {
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. padding: 14rpx 6rpx;
  371. }
  372. .zdyNavLeft{
  373. width: 120rpx;
  374. display: flex;
  375. }
  376. .goHomeBox{
  377. padding-left: 20rpx;
  378. padding-top: 6rpx;
  379. }
  380. .goHomeImg{
  381. width: 20px;
  382. height: 20px;
  383. }
  384. .gobackBox{
  385. padding-left: 20rpx;
  386. padding-top: 6rpx;
  387. }
  388. .gobackImg{
  389. width: 10px;
  390. height: 20px;
  391. padding-right: 20rpx;
  392. }
  393. .zdyNavTitle {
  394. background: #FFFFFF;
  395. text-align: center;
  396. /* font-size: 32rpx; */
  397. /* font-weight: bold; */
  398. font-size: 18px!important;
  399. color: #333333!important;
  400. }
  401. .zdyNavRight {
  402. background: #FFFFFF;
  403. text-align: center;
  404. font-size: 28rpx;
  405. color: #3F90F7;
  406. width: 120rpx;
  407. }
  408. .top {
  409. padding: 20rpx 0;
  410. }
  411. .topCont {
  412. width: 750rpx;
  413. height: 160rpx;
  414. background: #FFFFFF;
  415. }
  416. .carLogo {
  417. width: 72rpx;
  418. height: 72rpx;
  419. }
  420. .carTxt {
  421. font-size: 28rpx;
  422. font-family: PingFangSC-Medium, PingFang SC;
  423. font-weight: 500;
  424. color: #333333;
  425. line-height: 36rpx;
  426. width: 606rpx;
  427. }
  428. .carJt {
  429. width: 25rpx;
  430. height: 24rpx;
  431. margin-top: 6rpx;
  432. }
  433. .carBox {
  434. display: flex;
  435. justify-content: space-between;
  436. padding: 30rpx 24rpx 24rpx 34rpx;
  437. }
  438. .carBox2{
  439. background-color: #FFFFFF;
  440. padding: 30rpx 24rpx;
  441. }
  442. .carTxt2 {
  443. font-size: 28rpx;
  444. font-family: PingFangSC-Medium, PingFang SC;
  445. font-weight: 500;
  446. color: #333333;
  447. line-height: 36rpx;
  448. /* width: 606rpx; */
  449. height: 75rpx;
  450. /* 隐藏文字显示 ...超过2行省略 */
  451. overflow: hidden;
  452. -webkit-line-clamp: 2;
  453. text-overflow: ellipsis;
  454. display: -webkit-box;
  455. -webkit-box-orient: vertical;
  456. }
  457. .vinBox {
  458. display: flex;
  459. justify-content: space-between;
  460. padding-left: 34rpx;
  461. padding-right: 24rpx;
  462. }
  463. .vinBox2 {
  464. display: flex;
  465. align-items: center;
  466. }
  467. .detail {
  468. color: #3F90F7;
  469. font-size: 24rpx;
  470. margin-right: 10rpx;
  471. }
  472. .vinB {
  473. background: #F19D01;
  474. width: 60rpx;
  475. height: 30rpx;
  476. text-align: center;
  477. line-height: 30rpx;
  478. color: #FFFFFF;
  479. font-size: 22rpx;
  480. border-radius: 5rpx;
  481. }
  482. .vinNum {
  483. color: #999999;
  484. font-size: 24rpx;
  485. line-height: 30rpx;
  486. padding-left: 10rpx;
  487. }
  488. .mainBox {
  489. background: #FFFFFF;
  490. width: 100vw;
  491. }
  492. .maintitle {
  493. font-size: 28rpx;
  494. font-family: PingFangSC-Medium, PingFang SC;
  495. font-weight: 500;
  496. color: #333333;
  497. text-align: center;
  498. line-height: 88rpx;
  499. border-bottom: 1px solid #EEEEEE;
  500. position: relative;
  501. }
  502. .backZongImg {
  503. width: 25rpx;
  504. height: 24rpx;
  505. margin-top: 4rpx;
  506. }
  507. .backBox {
  508. display: flex;
  509. position: absolute;
  510. left: 23rpx;
  511. top: 28rpx;
  512. }
  513. .backTxt {
  514. color: #3F90F7;
  515. font-size: 24rpx;
  516. line-height: 33rpx;
  517. }
  518. .mainLineJt {
  519. width: 25rpx;
  520. height: 24rpx;
  521. margin-top: 8rpx;
  522. }
  523. .mainLine {
  524. display: flex;
  525. width: calc(100vw - 48rpx);
  526. border-bottom: 1px solid #EEEEEE;
  527. padding: 29rpx 24rpx;
  528. }
  529. .lineName {
  530. font-size: 26rpx;
  531. font-weight: bold;
  532. color: #333333;
  533. line-height: 40rpx;
  534. }
  535. .mainLine2 {
  536. display: flex;
  537. justify-content: space-between;
  538. border-bottom: 1px solid #EEEEEE;
  539. padding: 24rpx;
  540. }
  541. .lineName2 {
  542. font-size: 28rpx;
  543. font-family: PingFangSC-Regular, PingFang SC;
  544. font-weight: 400;
  545. color: #333333;
  546. line-height: 40rpx;
  547. }
  548. .lineIMg {
  549. width: 160rpx;
  550. height: 160rpx;
  551. }
  552. .lineRIght {
  553. padding-left: 20rpx;
  554. padding-right: 24rpx;
  555. }
  556. .lineBm {
  557. font-size: 24rpx;
  558. font-family: PingFangSC-Regular, PingFang SC;
  559. font-weight: 400;
  560. color: #999999;
  561. padding: 10rpx 0;
  562. }
  563. .linejs {
  564. font-size: 24rpx;
  565. font-family: PingFangSC-Regular, PingFang SC;
  566. font-weight: 400;
  567. color: #999999;
  568. }
  569. </style>