modelTwo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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. restrainShow2: 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 + '&vin=' + this.vin + '&param=' + this.param +
  114. '&token=' + this.token + '&access_time=' + this.access_time
  115. })
  116. },
  117. goback() {
  118. console.log('返回');
  119. uni.navigateBack({})
  120. },
  121. restrainClickOne(item) {
  122. this.param = item.param;
  123. this.token = item.token;
  124. if (item.next_restrain == 1) {
  125. this.getYsone()
  126. } else {
  127. this.getYsDlist()
  128. }
  129. },
  130. restrainClickTwo(item) {
  131. this.param = item.param;
  132. this.token = item.token;
  133. if (item.next_restrain == 1) {
  134. this.getYsDlist()
  135. } else {
  136. this.getYsDlist()
  137. }
  138. },
  139. getYsDlist() {
  140. uni.showLoading({
  141. title: '加载中'
  142. });
  143. this.$http('advancedEpc/getSubgroup', {
  144. vin: this.vin,
  145. access_time: this.access_time,
  146. param: this.param,
  147. token: this.token
  148. }, 'GET').then(res => {
  149. uni.hideLoading();
  150. //console.log(res.data.number);
  151. if (res.data.number == 200 || res.data.number == 5212) {
  152. this.caption = res.data.result.caption;
  153. this.brand_name = res.data.result.brand_name;
  154. this.access_time = res.data.result.access_time;
  155. this.restrainShow2 = false;
  156. this.restrainShow1 = false;
  157. this.lastShow = true;
  158. this.childrenList = res.data.result.list;
  159. this.oldList = this.childrenList
  160. } else {
  161. uni.showToast({
  162. title: res.data.message,
  163. icon: 'none',
  164. duration: 3000
  165. });
  166. }
  167. });
  168. },
  169. getYsone() {
  170. uni.showLoading({
  171. title: '加载中'
  172. });
  173. this.$http('advancedEpc/getSubgroup', {
  174. vin: this.vin,
  175. access_time: this.access_time,
  176. param: this.param,
  177. token: this.token
  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. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  186. 'subgroup') { //约束
  187. console.log("约束2")
  188. this.restrainShow2 = true;
  189. this.restrainShow1 = false;
  190. this.restrainList2 = res.data.result.list;
  191. } else {
  192. this.lastShow = true;
  193. this.childrenList = res.data.result.list;
  194. this.oldList = this.childrenList
  195. }
  196. } else {
  197. uni.showToast({
  198. title: res.data.message,
  199. icon: 'none',
  200. duration: 3000
  201. });
  202. }
  203. });
  204. },
  205. getData() {
  206. uni.showLoading({
  207. title: '加载中'
  208. });
  209. this.$http('advancedEpc/getSubgroup', {
  210. vin: this.vin,
  211. access_time: this.zzTime,
  212. param: this.param,
  213. token: this.token
  214. }, 'GET').then(res => {
  215. uni.hideLoading();
  216. //console.log(res.data.number);
  217. if (res.data.number == 200 || res.data.number == 5212) {
  218. this.caption = res.data.result.caption;
  219. this.brand_name = res.data.result.brand_name;
  220. this.access_time = res.data.result.access_time;
  221. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  222. 'subgroup') { //约束
  223. console.log("约束1")
  224. this.restrainShow1 = true;
  225. this.restrainList1 = res.data.result.list;
  226. } else {
  227. this.lastShow = true;
  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. goCarDetail() {
  241. uni.navigateTo({
  242. url: 'CarDetail'
  243. })
  244. },
  245. goThree(item, index) {
  246. var that = this;
  247. uni.setStorage({
  248. key: 'childrenList',
  249. data: that.childrenList,
  250. success: function() {
  251. uni.navigateTo({
  252. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  253. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index
  254. })
  255. }
  256. });
  257. },
  258. childrenkeyup() {
  259. this.childrenList = this.oldList;
  260. if (this.childrenss == '') {
  261. this.childrenList = this.oldList;
  262. } else {
  263. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  264. }
  265. },
  266. query(list, keyWord, attribute = 'caption') {
  267. const reg = new RegExp(keyWord) // 创建正则表达式
  268. const arr = []
  269. for (let i = 0; i < list.length; i++) {
  270. if (reg.test(list[i][attribute])) {
  271. arr.push(list[i])
  272. }
  273. }
  274. return arr
  275. },
  276. }
  277. }
  278. </script>
  279. <style scoped>
  280. .searchImg {
  281. width: 40rpx;
  282. height: 40rpx;
  283. margin-top: 16rpx;
  284. margin-left: 20rpx;
  285. }
  286. .searchBox {
  287. padding-top: 24rpx;
  288. width: 100vw;
  289. }
  290. .inputBox {
  291. width: 702rpx;
  292. height: 72rpx;
  293. background: #F4F5F7;
  294. border-radius: 36rpx;
  295. margin-left: 24rpx;
  296. display: flex;
  297. position: relative;
  298. }
  299. .topInput {
  300. font-size: 28rpx;
  301. height: 72rpx;
  302. line-height: 72rpx;
  303. padding-left: 16rpx;
  304. width: 500rpx;
  305. }
  306. .content {
  307. background: #F4F5F7;
  308. min-height: 100vh;
  309. width: 100vw;
  310. padding-bottom: constant(safe-area-inset-bottom);
  311. padding-bottom: env(safe-area-inset-bottom);
  312. }
  313. .zdyNavBox {
  314. width: 100vw;
  315. background: #FFFFFF;
  316. position: fixed;
  317. top: 0;
  318. left: 0;
  319. z-index: 9999999;
  320. }
  321. .zdyNav {
  322. height: 44px;
  323. display: flex;
  324. justify-content: space-between;
  325. align-items: center;
  326. }
  327. .backImg {
  328. width: 44rpx;
  329. height: 44rpx;
  330. margin-left: 10rpx;
  331. margin-right: 20rpx;
  332. }
  333. .homeImg {
  334. width: 44rpx;
  335. height: 44rpx;
  336. }
  337. .zdyNavLeft {
  338. display: flex;
  339. align-items: center;
  340. }
  341. .zdyNavTitle {
  342. height: 44px;
  343. background: #FFFFFF;
  344. text-align: center;
  345. font-size: 34rpx;
  346. line-height: 44px;
  347. }
  348. .zdyNavRight{
  349. height: 44px;
  350. background: #FFFFFF;
  351. text-align: center;
  352. font-size: 28rpx;
  353. line-height: 44px;
  354. color: #3F90F7;
  355. margin-right: 24rpx;
  356. }
  357. .top {
  358. padding: 20rpx 0;
  359. }
  360. .topCont {
  361. width: 750rpx;
  362. height: 185rpx;
  363. background: #FFFFFF;
  364. }
  365. .carLogo {
  366. width: 72rpx;
  367. height: 72rpx;
  368. }
  369. .carTxt {
  370. font-size: 28rpx;
  371. font-family: PingFangSC-Medium, PingFang SC;
  372. font-weight: 500;
  373. color: #333333;
  374. line-height: 36rpx;
  375. width: 606rpx;
  376. }
  377. .carJt {
  378. width: 25rpx;
  379. height: 24rpx;
  380. margin-top: 6rpx;
  381. }
  382. .carBox {
  383. display: flex;
  384. justify-content: space-between;
  385. padding: 30rpx 24rpx 24rpx 24rpx;
  386. }
  387. .vinBox {
  388. display: flex;
  389. justify-content: space-between;
  390. padding-left: 120rpx;
  391. padding-right: 24rpx;
  392. }
  393. .vinBox2 {
  394. display: flex;
  395. align-items: center;
  396. }
  397. .detail {
  398. color: #3F90F7;
  399. font-size: 24rpx;
  400. margin-right: 10rpx;
  401. }
  402. .vinB {
  403. background: #F19D01;
  404. width: 60rpx;
  405. height: 30rpx;
  406. text-align: center;
  407. line-height: 30rpx;
  408. color: #FFFFFF;
  409. font-size: 22rpx;
  410. border-radius: 5rpx;
  411. }
  412. .vinNum {
  413. color: #999999;
  414. font-size: 24rpx;
  415. line-height: 30rpx;
  416. padding-left: 10rpx;
  417. }
  418. .mainBox {
  419. background: #FFFFFF;
  420. width: 100vw;
  421. }
  422. .maintitle {
  423. font-size: 28rpx;
  424. font-family: PingFangSC-Medium, PingFang SC;
  425. font-weight: 500;
  426. color: #333333;
  427. text-align: center;
  428. line-height: 88rpx;
  429. border-bottom: 1px solid #EEEEEE;
  430. position: relative;
  431. }
  432. .backZongImg {
  433. width: 25rpx;
  434. height: 24rpx;
  435. margin-top: 4rpx;
  436. }
  437. .backBox {
  438. display: flex;
  439. position: absolute;
  440. left: 23rpx;
  441. top: 28rpx;
  442. }
  443. .backTxt {
  444. color: #3F90F7;
  445. font-size: 24rpx;
  446. line-height: 33rpx;
  447. }
  448. .mainLineJt {
  449. width: 25rpx;
  450. height: 24rpx;
  451. margin-top: 8rpx;
  452. }
  453. .mainLine {
  454. display: flex;
  455. width: calc(100vw - 48rpx);
  456. border-bottom: 1px solid #EEEEEE;
  457. padding: 29rpx 24rpx;
  458. }
  459. .lineName {
  460. font-size: 26rpx;
  461. font-weight: bold;
  462. color: #333333;
  463. line-height: 40rpx;
  464. }
  465. .mainLine2 {
  466. display: flex;
  467. justify-content: space-between;
  468. border-bottom: 1px solid #EEEEEE;
  469. padding: 24rpx;
  470. }
  471. .lineName2 {
  472. font-size: 28rpx;
  473. font-family: PingFangSC-Regular, PingFang SC;
  474. font-weight: 400;
  475. color: #333333;
  476. line-height: 40rpx;
  477. }
  478. .lineIMg {
  479. width: 160rpx;
  480. height: 160rpx;
  481. }
  482. .lineRIght {
  483. padding-left: 20rpx;
  484. padding-right: 24rpx;
  485. }
  486. .lineBm {
  487. font-size: 24rpx;
  488. font-family: PingFangSC-Regular, PingFang SC;
  489. font-weight: 400;
  490. color: #999999;
  491. padding: 10rpx 0;
  492. }
  493. .linejs {
  494. font-size: 24rpx;
  495. font-family: PingFangSC-Regular, PingFang SC;
  496. font-weight: 400;
  497. color: #999999;
  498. }
  499. </style>