modelTwo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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 + '&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. }
  289. .inputBox {
  290. width: 702rpx;
  291. height: 72rpx;
  292. background: #F4F5F7;
  293. border-radius: 36rpx;
  294. margin-left: 24rpx;
  295. display: flex;
  296. position: relative;
  297. }
  298. .topInput {
  299. font-size: 28rpx;
  300. height: 72rpx;
  301. line-height: 72rpx;
  302. padding-left: 16rpx;
  303. width: 500rpx;
  304. }
  305. .content {
  306. background: #F4F5F7;
  307. min-height: 100vh;
  308. width: 100vw;
  309. padding-bottom: constant(safe-area-inset-bottom);
  310. padding-bottom: env(safe-area-inset-bottom);
  311. }
  312. .zdyNavBox {
  313. width: 100vw;
  314. background: #FFFFFF;
  315. position: fixed;
  316. top: 0;
  317. left: 0;
  318. z-index: 9999999;
  319. }
  320. .zdyNav {
  321. height: 44px;
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: center;
  325. }
  326. .backImg {
  327. width: 44rpx;
  328. height: 44rpx;
  329. margin-left: 10rpx;
  330. margin-right: 20rpx;
  331. }
  332. .homeImg {
  333. width: 44rpx;
  334. height: 44rpx;
  335. }
  336. .zdyNavLeft {
  337. display: flex;
  338. align-items: center;
  339. }
  340. .zdyNavTitle {
  341. height: 44px;
  342. background: #FFFFFF;
  343. text-align: center;
  344. font-size: 34rpx;
  345. line-height: 44px;
  346. }
  347. .zdyNavRight{
  348. height: 44px;
  349. background: #FFFFFF;
  350. text-align: center;
  351. font-size: 28rpx;
  352. line-height: 44px;
  353. color: #3F90F7;
  354. margin-right: 24rpx;
  355. }
  356. .top {
  357. padding: 20rpx 0;
  358. }
  359. .topCont {
  360. width: 750rpx;
  361. height: 185rpx;
  362. background: #FFFFFF;
  363. }
  364. .carLogo {
  365. width: 72rpx;
  366. height: 72rpx;
  367. }
  368. .carTxt {
  369. font-size: 28rpx;
  370. font-family: PingFangSC-Medium, PingFang SC;
  371. font-weight: 500;
  372. color: #333333;
  373. line-height: 36rpx;
  374. width: 606rpx;
  375. }
  376. .carJt {
  377. width: 25rpx;
  378. height: 24rpx;
  379. margin-top: 6rpx;
  380. }
  381. .carBox {
  382. display: flex;
  383. justify-content: space-between;
  384. padding: 30rpx 24rpx 24rpx 24rpx;
  385. }
  386. .vinBox {
  387. display: flex;
  388. justify-content: space-between;
  389. padding-left: 120rpx;
  390. padding-right: 24rpx;
  391. }
  392. .vinBox2 {
  393. display: flex;
  394. align-items: center;
  395. }
  396. .detail {
  397. color: #3F90F7;
  398. font-size: 24rpx;
  399. margin-right: 10rpx;
  400. }
  401. .vinB {
  402. background: #F19D01;
  403. width: 60rpx;
  404. height: 30rpx;
  405. text-align: center;
  406. line-height: 30rpx;
  407. color: #FFFFFF;
  408. font-size: 22rpx;
  409. border-radius: 5rpx;
  410. }
  411. .vinNum {
  412. color: #999999;
  413. font-size: 24rpx;
  414. line-height: 30rpx;
  415. padding-left: 10rpx;
  416. }
  417. .mainBox {
  418. background: #FFFFFF;
  419. width: 100vw;
  420. }
  421. .maintitle {
  422. font-size: 28rpx;
  423. font-family: PingFangSC-Medium, PingFang SC;
  424. font-weight: 500;
  425. color: #333333;
  426. text-align: center;
  427. line-height: 88rpx;
  428. border-bottom: 1px solid #EEEEEE;
  429. position: relative;
  430. }
  431. .backZongImg {
  432. width: 25rpx;
  433. height: 24rpx;
  434. margin-top: 4rpx;
  435. }
  436. .backBox {
  437. display: flex;
  438. position: absolute;
  439. left: 23rpx;
  440. top: 28rpx;
  441. }
  442. .backTxt {
  443. color: #3F90F7;
  444. font-size: 24rpx;
  445. line-height: 33rpx;
  446. }
  447. .mainLineJt {
  448. width: 25rpx;
  449. height: 24rpx;
  450. margin-top: 8rpx;
  451. }
  452. .mainLine {
  453. display: flex;
  454. width: 100vw;
  455. border-bottom: 1px solid #EEEEEE;
  456. padding: 29rpx 24rpx;
  457. }
  458. .lineName {
  459. font-size: 26rpx;
  460. font-weight: bold;
  461. color: #333333;
  462. line-height: 40rpx;
  463. }
  464. .mainLine2 {
  465. display: flex;
  466. justify-content: space-between;
  467. border-bottom: 1px solid #EEEEEE;
  468. padding: 24rpx;
  469. }
  470. .lineName2 {
  471. font-size: 28rpx;
  472. font-family: PingFangSC-Regular, PingFang SC;
  473. font-weight: 400;
  474. color: #333333;
  475. line-height: 40rpx;
  476. }
  477. .lineIMg {
  478. width: 160rpx;
  479. height: 160rpx;
  480. }
  481. .lineRIght {
  482. padding-left: 20rpx;
  483. padding-right: 24rpx;
  484. }
  485. .lineBm {
  486. font-size: 24rpx;
  487. font-family: PingFangSC-Regular, PingFang SC;
  488. font-weight: 400;
  489. color: #999999;
  490. padding: 10rpx 0;
  491. }
  492. .linejs {
  493. font-size: 24rpx;
  494. font-family: PingFangSC-Regular, PingFang SC;
  495. font-weight: 400;
  496. color: #999999;
  497. }
  498. </style>