modelTwo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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" v-if="chexingMesList.length != 0">
  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. chexingMesList:[],
  98. }
  99. },
  100. onLoad(opt) {
  101. this.vin = opt.vin;
  102. this.zzTime = opt.zzTime;
  103. this.param = opt.param;
  104. this.token = opt.token;
  105. this.epc_id = opt.epc_id;
  106. this.description=opt.description;
  107. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  108. this.getData()
  109. this.chexingMesList = uni.getStorageSync('chexingMesList');
  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. epc_id:this.epc_id,
  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' ) { //约束
  224. console.log("约束1")
  225. this.restrainShow1 = true;
  226. this.restrainList1 = res.data.result.list;
  227. } else {
  228. if(res.data.result.list[0].next_restrain==1){
  229. this.restrainShow1 = true;
  230. this.restrainList1 = res.data.result.list;
  231. }else{
  232. this.lastShow = true;
  233. this.childrenList = res.data.result.list;
  234. this.oldList = this.childrenList
  235. }
  236. }
  237. } else {
  238. uni.showToast({
  239. title: res.data.message,
  240. icon: 'none',
  241. duration: 3000
  242. });
  243. }
  244. });
  245. },
  246. goCarDetail() {
  247. uni.navigateTo({
  248. url: 'CarDetail'
  249. })
  250. },
  251. goThree(item, index) {
  252. var that = this;
  253. uni.setStorage({
  254. key: 'childrenList',
  255. data: that.childrenList,
  256. success: function() {
  257. uni.navigateTo({
  258. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  259. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index+'&epc_id='+that.epc_id
  260. })
  261. }
  262. });
  263. },
  264. childrenkeyup() {
  265. this.childrenList = this.oldList;
  266. if (this.childrenss == '') {
  267. this.childrenList = this.oldList;
  268. } else {
  269. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  270. }
  271. },
  272. query(list, keyWord, attribute = 'caption') {
  273. const reg = new RegExp(keyWord) // 创建正则表达式
  274. const arr = []
  275. for (let i = 0; i < list.length; i++) {
  276. if (reg.test(list[i][attribute])) {
  277. arr.push(list[i])
  278. }
  279. }
  280. return arr
  281. },
  282. }
  283. }
  284. </script>
  285. <style scoped>
  286. .searchImg {
  287. width: 40rpx;
  288. height: 40rpx;
  289. margin-top: 16rpx;
  290. margin-left: 20rpx;
  291. }
  292. .searchBox {
  293. padding-top: 24rpx;
  294. width: 100vw;
  295. }
  296. .inputBox {
  297. width: 702rpx;
  298. height: 72rpx;
  299. background: #F4F5F7;
  300. border-radius: 36rpx;
  301. margin-left: 24rpx;
  302. display: flex;
  303. position: relative;
  304. }
  305. .topInput {
  306. font-size: 28rpx;
  307. height: 72rpx;
  308. line-height: 72rpx;
  309. padding-left: 16rpx;
  310. width: 500rpx;
  311. }
  312. .content {
  313. background: #F4F5F7;
  314. min-height: 100vh;
  315. width: 100vw;
  316. padding-bottom: constant(safe-area-inset-bottom);
  317. padding-bottom: env(safe-area-inset-bottom);
  318. }
  319. .zdyNavBox {
  320. width: 100vw;
  321. background: #FFFFFF;
  322. position: fixed;
  323. top: 0;
  324. left: 0;
  325. z-index: 9999999;
  326. }
  327. .zdyNav {
  328. display: flex;
  329. justify-content: space-between;
  330. align-items: center;
  331. padding: 14rpx 6rpx;
  332. }
  333. .zdyNavTitle {
  334. background: #FFFFFF;
  335. text-align: center;
  336. font-size: 32rpx;
  337. font-weight: bold;
  338. }
  339. .zdyNavRight {
  340. background: #FFFFFF;
  341. text-align: center;
  342. font-size: 28rpx;
  343. color: #3F90F7;
  344. width: 120rpx;
  345. }
  346. .top {
  347. padding: 20rpx 0;
  348. }
  349. .topCont {
  350. width: 750rpx;
  351. height: 160rpx;
  352. background: #FFFFFF;
  353. }
  354. .carLogo {
  355. width: 72rpx;
  356. height: 72rpx;
  357. }
  358. .carTxt {
  359. font-size: 28rpx;
  360. font-family: PingFangSC-Medium, PingFang SC;
  361. font-weight: 500;
  362. color: #333333;
  363. line-height: 36rpx;
  364. width: 606rpx;
  365. }
  366. .carJt {
  367. width: 25rpx;
  368. height: 24rpx;
  369. margin-top: 6rpx;
  370. }
  371. .carBox {
  372. display: flex;
  373. justify-content: space-between;
  374. padding: 30rpx 24rpx 24rpx 34rpx;
  375. }
  376. .vinBox {
  377. display: flex;
  378. justify-content: space-between;
  379. padding-left: 34rpx;
  380. padding-right: 24rpx;
  381. }
  382. .vinBox2 {
  383. display: flex;
  384. align-items: center;
  385. }
  386. .detail {
  387. color: #3F90F7;
  388. font-size: 24rpx;
  389. margin-right: 10rpx;
  390. }
  391. .vinB {
  392. background: #F19D01;
  393. width: 60rpx;
  394. height: 30rpx;
  395. text-align: center;
  396. line-height: 30rpx;
  397. color: #FFFFFF;
  398. font-size: 22rpx;
  399. border-radius: 5rpx;
  400. }
  401. .vinNum {
  402. color: #999999;
  403. font-size: 24rpx;
  404. line-height: 30rpx;
  405. padding-left: 10rpx;
  406. }
  407. .mainBox {
  408. background: #FFFFFF;
  409. width: 100vw;
  410. }
  411. .maintitle {
  412. font-size: 28rpx;
  413. font-family: PingFangSC-Medium, PingFang SC;
  414. font-weight: 500;
  415. color: #333333;
  416. text-align: center;
  417. line-height: 88rpx;
  418. border-bottom: 1px solid #EEEEEE;
  419. position: relative;
  420. }
  421. .backZongImg {
  422. width: 25rpx;
  423. height: 24rpx;
  424. margin-top: 4rpx;
  425. }
  426. .backBox {
  427. display: flex;
  428. position: absolute;
  429. left: 23rpx;
  430. top: 28rpx;
  431. }
  432. .backTxt {
  433. color: #3F90F7;
  434. font-size: 24rpx;
  435. line-height: 33rpx;
  436. }
  437. .mainLineJt {
  438. width: 25rpx;
  439. height: 24rpx;
  440. margin-top: 8rpx;
  441. }
  442. .mainLine {
  443. display: flex;
  444. width: calc(100vw - 48rpx);
  445. border-bottom: 1px solid #EEEEEE;
  446. padding: 29rpx 24rpx;
  447. }
  448. .lineName {
  449. font-size: 26rpx;
  450. font-weight: bold;
  451. color: #333333;
  452. line-height: 40rpx;
  453. }
  454. .mainLine2 {
  455. display: flex;
  456. justify-content: space-between;
  457. border-bottom: 1px solid #EEEEEE;
  458. padding: 24rpx;
  459. }
  460. .lineName2 {
  461. font-size: 28rpx;
  462. font-family: PingFangSC-Regular, PingFang SC;
  463. font-weight: 400;
  464. color: #333333;
  465. line-height: 40rpx;
  466. }
  467. .lineIMg {
  468. width: 160rpx;
  469. height: 160rpx;
  470. }
  471. .lineRIght {
  472. padding-left: 20rpx;
  473. padding-right: 24rpx;
  474. }
  475. .lineBm {
  476. font-size: 24rpx;
  477. font-family: PingFangSC-Regular, PingFang SC;
  478. font-weight: 400;
  479. color: #999999;
  480. padding: 10rpx 0;
  481. }
  482. .linejs {
  483. font-size: 24rpx;
  484. font-family: PingFangSC-Regular, PingFang SC;
  485. font-weight: 400;
  486. color: #999999;
  487. }
  488. </style>