modelTwo.vue 12 KB

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