modelTwo.vue 14 KB

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