modelTwo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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. <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon" style="color: rgb(0, 0, 0); font-size: 27px; width: 120rpx;"></i></div>
  8. <view class="zdyNavTitle">车型件</view>
  9. <view v-if="param.length != 0" class="zdyNavRight" @click="goOemSearch()">OEM搜索</view>
  10. <view v-else style="width: 120rpx;"></view>
  11. </view>
  12. </view>
  13. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  14. <view style="height: 44px;"></view>
  15. <view class="top">
  16. <view class="topCont">
  17. <view class="carBox">
  18. <!-- <image src="../../static/img/nocar.png" mode="" class="carLogo"></image> -->
  19. <view class="carTxt">{{description}}</view>
  20. <!-- <image src="../../static/img/jt.png" mode="" class="carJt"></image> -->
  21. </view>
  22. <view class="vinBox">
  23. <view class="vinBox2">
  24. <view class="vinB">VIN</view>
  25. <view class="vinNum">{{vin}}</view>
  26. </view>
  27. <view class="vinBox2">
  28. <view class="detail" @click="goCarDetail()">车型详情</view>
  29. <image src="../../static/img/icon_arrow_blue_r@2x.png" mode="" style="width: 24rpx; height: 24rpx"></image>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="mainBox">
  35. <view class="maintitle">{{caption}}
  36. <view @click="goback" class="backBox">
  37. <image src="../../static/img/icon_arrow_blue_l@2x.png" mode="" class="backZongImg"></image>
  38. <view class="backTxt">返回总组</view>
  39. </view>
  40. </view>
  41. <view class="searchBox" v-if="lastShow">
  42. <view class="inputBox">
  43. <img src="../../static/img/icon_search.png" alt="" class="searchImg">
  44. <input type="text" placeholder="快速查找子组" class="topInput" v-model="childrenss"
  45. @confirm="childrenkeyup">
  46. </view>
  47. </view>
  48. <view class="mainLine" v-for="(item,index) in childrenList" @click="goThree(item,index)" v-if="lastShow">
  49. <view class="lineLeft">
  50. <image class="lineIMg" :src="item.image_url" v-if="item.image_url" mode="aspectFit"></image>
  51. <image class="lineIMg" src="../../static/img/noimg.png" v-else mode="aspectFit"></image>
  52. </view>
  53. <view class="lineRIght">
  54. <view class="lineName">{{item.caption}}</view>
  55. <view class="lineBm">{{item.code}}</view>
  56. <view class="linejs">{{item.remark}}</view>
  57. </view>
  58. </view>
  59. <view class="mainBox" v-if="restrainShow1">
  60. <view class="mainLine2" v-for="(item,index) in restrainList1" @click="restrainClickOne(item)">
  61. <view class="lineName2">{{item.caption}}</view>
  62. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  63. </view>
  64. </view>
  65. <view class="mainBox" v-if="restrainShow2">
  66. <view class="mainLine2" v-for="(item,index) in restrainList2" @click="restrainClickTwo(item)">
  67. <view class="lineName2">{{item.caption}}</view>
  68. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. vin: '',
  79. brand_name: '',
  80. access_time: '',
  81. zzTime: '',
  82. caption: '',
  83. param: '',
  84. token: '',
  85. list: '',
  86. restrainShow1: false,
  87. restrainList1: '',
  88. restrainShow2: false,
  89. restrainList1: '',
  90. lastShow: false,
  91. childrenList: '',
  92. oldList: '',
  93. childrenss: '',
  94. iStatusBarHeight: '',
  95. epc_id:'',
  96. description:'',
  97. }
  98. },
  99. onLoad(opt) {
  100. this.vin = opt.vin;
  101. this.zzTime = opt.zzTime;
  102. this.param = opt.param;
  103. this.token = opt.token;
  104. this.epc_id = opt.epc_id;
  105. this.description=opt.description;
  106. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  107. this.getData()
  108. },
  109. methods: {
  110. goOemSearch(){
  111. uni.navigateTo({
  112. url:'OemSearch?brand='+ this.brand_name + '&epc_id=' + this.epc_id + '&vin=' + this.vin + '&param=' + this.param +
  113. '&token=' + this.token + '&access_time=' + this.access_time
  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' ) { //约束
  221. console.log("约束1")
  222. this.restrainShow1 = true;
  223. this.restrainList1 = res.data.result.list;
  224. } else {
  225. if(res.data.result.list[0].next_restrain==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. }
  234. } else {
  235. uni.showToast({
  236. title: res.data.message,
  237. icon: 'none',
  238. duration: 3000
  239. });
  240. }
  241. });
  242. },
  243. goCarDetail() {
  244. uni.navigateTo({
  245. url: 'CarDetail'
  246. })
  247. },
  248. goThree(item, index) {
  249. var that = this;
  250. uni.setStorage({
  251. key: 'childrenList',
  252. data: that.childrenList,
  253. success: function() {
  254. uni.navigateTo({
  255. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  256. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index
  257. })
  258. }
  259. });
  260. },
  261. childrenkeyup() {
  262. this.childrenList = this.oldList;
  263. if (this.childrenss == '') {
  264. this.childrenList = this.oldList;
  265. } else {
  266. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  267. }
  268. },
  269. query(list, keyWord, attribute = 'caption') {
  270. const reg = new RegExp(keyWord) // 创建正则表达式
  271. const arr = []
  272. for (let i = 0; i < list.length; i++) {
  273. if (reg.test(list[i][attribute])) {
  274. arr.push(list[i])
  275. }
  276. }
  277. return arr
  278. },
  279. }
  280. }
  281. </script>
  282. <style scoped>
  283. .searchImg {
  284. width: 40rpx;
  285. height: 40rpx;
  286. margin-top: 16rpx;
  287. margin-left: 20rpx;
  288. }
  289. .searchBox {
  290. padding-top: 24rpx;
  291. width: 100vw;
  292. }
  293. .inputBox {
  294. width: 702rpx;
  295. height: 72rpx;
  296. background: #F4F5F7;
  297. border-radius: 36rpx;
  298. margin-left: 24rpx;
  299. display: flex;
  300. position: relative;
  301. }
  302. .topInput {
  303. font-size: 28rpx;
  304. height: 72rpx;
  305. line-height: 72rpx;
  306. padding-left: 16rpx;
  307. width: 500rpx;
  308. }
  309. .content {
  310. background: #F4F5F7;
  311. min-height: 100vh;
  312. width: 100vw;
  313. padding-bottom: constant(safe-area-inset-bottom);
  314. padding-bottom: env(safe-area-inset-bottom);
  315. }
  316. .zdyNavBox {
  317. width: 100vw;
  318. background: #FFFFFF;
  319. position: fixed;
  320. top: 0;
  321. left: 0;
  322. z-index: 9999999;
  323. }
  324. .zdyNav {
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. padding: 14rpx 6rpx;
  329. }
  330. .zdyNavTitle {
  331. background: #FFFFFF;
  332. text-align: center;
  333. font-size: 32rpx;
  334. font-weight: bold;
  335. }
  336. .zdyNavRight {
  337. background: #FFFFFF;
  338. text-align: center;
  339. font-size: 28rpx;
  340. color: #3F90F7;
  341. width: 120rpx;
  342. }
  343. .top {
  344. padding: 20rpx 0;
  345. }
  346. .topCont {
  347. width: 750rpx;
  348. height: 160rpx;
  349. background: #FFFFFF;
  350. }
  351. .carLogo {
  352. width: 72rpx;
  353. height: 72rpx;
  354. }
  355. .carTxt {
  356. font-size: 28rpx;
  357. font-family: PingFangSC-Medium, PingFang SC;
  358. font-weight: 500;
  359. color: #333333;
  360. line-height: 36rpx;
  361. width: 606rpx;
  362. }
  363. .carJt {
  364. width: 25rpx;
  365. height: 24rpx;
  366. margin-top: 6rpx;
  367. }
  368. .carBox {
  369. display: flex;
  370. justify-content: space-between;
  371. padding: 30rpx 24rpx 24rpx 34rpx;
  372. }
  373. .vinBox {
  374. display: flex;
  375. justify-content: space-between;
  376. padding-left: 34rpx;
  377. padding-right: 24rpx;
  378. }
  379. .vinBox2 {
  380. display: flex;
  381. align-items: center;
  382. }
  383. .detail {
  384. color: #3F90F7;
  385. font-size: 24rpx;
  386. margin-right: 10rpx;
  387. }
  388. .vinB {
  389. background: #F19D01;
  390. width: 60rpx;
  391. height: 30rpx;
  392. text-align: center;
  393. line-height: 30rpx;
  394. color: #FFFFFF;
  395. font-size: 22rpx;
  396. border-radius: 5rpx;
  397. }
  398. .vinNum {
  399. color: #999999;
  400. font-size: 24rpx;
  401. line-height: 30rpx;
  402. padding-left: 10rpx;
  403. }
  404. .mainBox {
  405. background: #FFFFFF;
  406. width: 100vw;
  407. }
  408. .maintitle {
  409. font-size: 28rpx;
  410. font-family: PingFangSC-Medium, PingFang SC;
  411. font-weight: 500;
  412. color: #333333;
  413. text-align: center;
  414. line-height: 88rpx;
  415. border-bottom: 1px solid #EEEEEE;
  416. position: relative;
  417. }
  418. .backZongImg {
  419. width: 25rpx;
  420. height: 24rpx;
  421. margin-top: 4rpx;
  422. }
  423. .backBox {
  424. display: flex;
  425. position: absolute;
  426. left: 23rpx;
  427. top: 28rpx;
  428. }
  429. .backTxt {
  430. color: #3F90F7;
  431. font-size: 24rpx;
  432. line-height: 33rpx;
  433. }
  434. .mainLineJt {
  435. width: 25rpx;
  436. height: 24rpx;
  437. margin-top: 8rpx;
  438. }
  439. .mainLine {
  440. display: flex;
  441. width: calc(100vw - 48rpx);
  442. border-bottom: 1px solid #EEEEEE;
  443. padding: 29rpx 24rpx;
  444. }
  445. .lineName {
  446. font-size: 26rpx;
  447. font-weight: bold;
  448. color: #333333;
  449. line-height: 40rpx;
  450. }
  451. .mainLine2 {
  452. display: flex;
  453. justify-content: space-between;
  454. border-bottom: 1px solid #EEEEEE;
  455. padding: 24rpx;
  456. }
  457. .lineName2 {
  458. font-size: 28rpx;
  459. font-family: PingFangSC-Regular, PingFang SC;
  460. font-weight: 400;
  461. color: #333333;
  462. line-height: 40rpx;
  463. }
  464. .lineIMg {
  465. width: 160rpx;
  466. height: 160rpx;
  467. }
  468. .lineRIght {
  469. padding-left: 20rpx;
  470. padding-right: 24rpx;
  471. }
  472. .lineBm {
  473. font-size: 24rpx;
  474. font-family: PingFangSC-Regular, PingFang SC;
  475. font-weight: 400;
  476. color: #999999;
  477. padding: 10rpx 0;
  478. }
  479. .linejs {
  480. font-size: 24rpx;
  481. font-family: PingFangSC-Regular, PingFang SC;
  482. font-weight: 400;
  483. color: #999999;
  484. }
  485. </style>