modelTwo.vue 12 KB

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