modelTwo.vue 13 KB

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