modelTwo.vue 13 KB

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