modelTwo.vue 13 KB

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