modelTwo.vue 14 KB

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