modelTwo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="topCont">
  5. <view class="carBox">
  6. <image src="../../static/img/nocar.png" mode="" class="carLogo"></image>
  7. <view class="carTxt">{{brand_name}}</view>
  8. <!-- <image src="../../static/img/jt.png" mode="" class="carJt"></image> -->
  9. </view>
  10. <view class="vinBox">
  11. <view class="vinBox2">
  12. <view class="vinB">VIN</view>
  13. <view class="vinNum">{{vin}}</view>
  14. </view>
  15. <!-- <view class="vinBox2">
  16. <view class="detail" @click="goCarDetail()">车型详情</view>
  17. <image src="../../static/img/icon_arrow_blue_r@2x.png" mode="" style="width: 24rpx; height: 24rpx"></image>
  18. </view> -->
  19. </view>
  20. </view>
  21. </view>
  22. <view class="mainBox">
  23. <view class="maintitle">{{caption}}
  24. <view @click="goback" class="backBox">
  25. <image src="../../static/img/icon_arrow_blue_l@2x.png" mode="" class="backImg"></image>
  26. <view class="backTxt">返回总组</view>
  27. </view>
  28. </view>
  29. <view class="searchBox" v-if="lastShow">
  30. <view class="inputBox">
  31. <img src="../../static/img/icon_search.png" alt="" class="searchImg">
  32. <input type="text" placeholder="快速查找子组" class="topInput" v-model="childrenss"
  33. @confirm="childrenkeyup">
  34. </view>
  35. </view>
  36. <view class="mainLine" v-for="(item,index) in childrenList" @click="goThree(item,index)" v-if="lastShow">
  37. <view class="lineLeft">
  38. <image class="lineIMg" :src="item.image_url" v-if="item.image_url" mode=""></image>
  39. <image class="lineIMg" src="../../static/img/noimg.png" v-else mode=""></image>
  40. </view>
  41. <view class="lineRIght">
  42. <view class="lineName">{{item.caption}}</view>
  43. <view class="lineBm">{{item.code}}</view>
  44. <view class="linejs">{{item.remark}}</view>
  45. </view>
  46. </view>
  47. <view class="mainBox" v-if="restrainShow1">
  48. <view class="mainLine2" v-for="(item,index) in restrainList1" @click="restrainClickOne(item)">
  49. <view class="lineName2">{{item.caption}}</view>
  50. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  51. </view>
  52. </view>
  53. <view class="mainBox" v-if="restrainShow2">
  54. <view class="mainLine2" v-for="(item,index) in restrainList2" @click="restrainClickTwo(item)">
  55. <view class="lineName2">{{item.caption}}</view>
  56. <image src="../../static/img/jt.png" mode="" class="mainLineJt"></image>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. export default {
  64. data() {
  65. return {
  66. vin: '',
  67. brand_name: '',
  68. access_time: '',
  69. zzTime: '',
  70. caption: '',
  71. param: '',
  72. token: '',
  73. list: '',
  74. restrainShow1: false,
  75. restrainList1: '',
  76. restrainShow1: false,
  77. restrainList1: '',
  78. lastShow: false,
  79. childrenList: '',
  80. oldList: '',
  81. childrenss: '',
  82. }
  83. },
  84. onLoad(opt) {
  85. this.vin = opt.vin;
  86. this.zzTime = opt.zzTime;
  87. this.param = opt.param;
  88. this.token = opt.token;
  89. this.getData()
  90. },
  91. methods: {
  92. goback() {
  93. console.log('返回');
  94. uni.navigateBack({})
  95. },
  96. restrainClickOne(item) {
  97. this.param = item.param;
  98. this.token = item.token;
  99. if (item.next_restrain == 1) {
  100. this.getYsone()
  101. } else {
  102. this.getYsDlist()
  103. }
  104. },
  105. restrainClickTwo(item) {
  106. this.param = item.param;
  107. this.token = item.token;
  108. if (item.next_restrain == 1) {
  109. this.getYsDlist()
  110. } else {
  111. this.getYsDlist()
  112. }
  113. },
  114. getYsDlist() {
  115. uni.showLoading({
  116. title: '加载中'
  117. });
  118. this.$http('advancedEpc/getSubgroup', {
  119. vin: this.vin,
  120. access_time: this.access_time,
  121. param: this.param,
  122. token: this.token
  123. }, 'GET').then(res => {
  124. uni.hideLoading();
  125. //console.log(res.data.number);
  126. if (res.data.number == 200 || res.data.number == 5212) {
  127. this.caption = res.data.result.caption;
  128. this.brand_name = res.data.result.brand_name;
  129. this.access_time = res.data.result.access_time;
  130. this.restrainShow2 = false;
  131. this.restrainShow1 = false;
  132. this.lastShow = true;
  133. this.childrenList = res.data.result.list;
  134. this.oldList = this.childrenList
  135. } else {
  136. uni.showToast({
  137. title: res.data.message,
  138. icon: 'none',
  139. duration: 3000
  140. });
  141. }
  142. });
  143. },
  144. getYsone() {
  145. uni.showLoading({
  146. title: '加载中'
  147. });
  148. this.$http('advancedEpc/getSubgroup', {
  149. vin: this.vin,
  150. access_time: this.access_time,
  151. param: this.param,
  152. token: this.token
  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. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  161. 'subgroup') { //约束
  162. console.log("约束2")
  163. this.restrainShow2 = true;
  164. this.restrainShow1 = false;
  165. this.restrainList2 = res.data.result.list;
  166. } else {
  167. this.lastShow = true;
  168. this.childrenList = res.data.result.list;
  169. this.oldList = this.childrenList
  170. }
  171. } else {
  172. uni.showToast({
  173. title: res.data.message,
  174. icon: 'none',
  175. duration: 3000
  176. });
  177. }
  178. });
  179. },
  180. getData() {
  181. uni.showLoading({
  182. title: '加载中'
  183. });
  184. this.$http('advancedEpc/getSubgroup', {
  185. vin: this.vin,
  186. access_time: this.zzTime,
  187. param: this.param,
  188. token: this.token
  189. }, 'GET').then(res => {
  190. uni.hideLoading();
  191. //console.log(res.data.number);
  192. if (res.data.number == 200 || res.data.number == 5212) {
  193. this.caption = res.data.result.caption;
  194. this.brand_name = res.data.result.brand_name;
  195. this.access_time = res.data.result.access_time;
  196. if (res.data.result.level_identify == 'group_restrain' || res.data.result.level_identify ==
  197. 'subgroup') { //约束
  198. console.log("约束1")
  199. this.restrainShow1 = true;
  200. this.restrainList1 = res.data.result.list;
  201. } else {
  202. this.lastShow = true;
  203. this.childrenList = res.data.result.list;
  204. this.oldList = this.childrenList
  205. }
  206. } else {
  207. uni.showToast({
  208. title: res.data.message,
  209. icon: 'none',
  210. duration: 3000
  211. });
  212. }
  213. });
  214. },
  215. goCarDetail() {
  216. uni.navigateTo({
  217. url: 'CarDetail'
  218. })
  219. },
  220. goThree(item, index) {
  221. var that = this;
  222. uni.setStorage({
  223. key: 'childrenList',
  224. data: that.childrenList,
  225. success: function() {
  226. uni.navigateTo({
  227. url: 'vinDetail?vin=' + that.vin + '&token=' + item.token + '&param=' +
  228. item.param + '&access_time=' + that.access_time + '&tabIndex=' + index
  229. })
  230. }
  231. });
  232. },
  233. childrenkeyup() {
  234. this.childrenList = this.oldList;
  235. if (this.childrenss == '') {
  236. this.childrenList = this.oldList;
  237. } else {
  238. this.childrenList = this.query(this.childrenList, this.childrenss, 'caption')
  239. }
  240. },
  241. query(list, keyWord, attribute = 'caption') {
  242. const reg = new RegExp(keyWord) // 创建正则表达式
  243. const arr = []
  244. for (let i = 0; i < list.length; i++) {
  245. if (reg.test(list[i][attribute])) {
  246. arr.push(list[i])
  247. }
  248. }
  249. return arr
  250. },
  251. }
  252. }
  253. </script>
  254. <style scoped>
  255. .searchImg {
  256. width: 40rpx;
  257. height: 40rpx;
  258. margin-top: 16rpx;
  259. margin-left: 20rpx;
  260. }
  261. .searchBox {
  262. padding-top: 24rpx;
  263. }
  264. .inputBox {
  265. width: 702rpx;
  266. height: 72rpx;
  267. background: #F4F5F7;
  268. border-radius: 36rpx;
  269. margin-left: 24rpx;
  270. display: flex;
  271. position: relative;
  272. }
  273. .topInput {
  274. font-size: 28rpx;
  275. height: 72rpx;
  276. line-height: 72rpx;
  277. padding-left: 16rpx;
  278. width: 500rpx;
  279. }
  280. .content {
  281. background: #F4F5F7;
  282. min-height: 100vh;
  283. padding-bottom: constant(safe-area-inset-bottom);
  284. padding-bottom: env(safe-area-inset-bottom);
  285. }
  286. .top {
  287. padding: 20rpx 0;
  288. }
  289. .topCont {
  290. width: 750rpx;
  291. height: 185rpx;
  292. background: #FFFFFF;
  293. }
  294. .carLogo {
  295. width: 72rpx;
  296. height: 72rpx;
  297. }
  298. .carTxt {
  299. font-size: 28rpx;
  300. font-family: PingFangSC-Medium, PingFang SC;
  301. font-weight: 500;
  302. color: #333333;
  303. line-height: 36rpx;
  304. width: 606rpx;
  305. }
  306. .carJt {
  307. width: 25rpx;
  308. height: 24rpx;
  309. margin-top: 6rpx;
  310. }
  311. .carBox {
  312. display: flex;
  313. justify-content: space-between;
  314. padding: 30rpx 24rpx 24rpx 24rpx;
  315. }
  316. .vinBox {
  317. display: flex;
  318. justify-content: space-between;
  319. padding-left: 120rpx;
  320. padding-right: 24rpx;
  321. }
  322. .vinBox2 {
  323. display: flex;
  324. align-items: center;
  325. }
  326. .detail {
  327. color: #3F90F7;
  328. font-size: 24rpx;
  329. margin-right: 10rpx;
  330. }
  331. .vinB {
  332. background: #F19D01;
  333. width: 60rpx;
  334. height: 30rpx;
  335. text-align: center;
  336. line-height: 30rpx;
  337. color: #FFFFFF;
  338. font-size: 22rpx;
  339. border-radius: 5rpx;
  340. }
  341. .vinNum {
  342. color: #999999;
  343. font-size: 24rpx;
  344. line-height: 30rpx;
  345. padding-left: 10rpx;
  346. }
  347. .mainBox {
  348. background: #FFFFFF;
  349. }
  350. .maintitle {
  351. font-size: 28rpx;
  352. font-family: PingFangSC-Medium, PingFang SC;
  353. font-weight: 500;
  354. color: #333333;
  355. text-align: center;
  356. line-height: 88rpx;
  357. border-bottom: 1px solid #EEEEEE;
  358. position: relative;
  359. }
  360. .backImg {
  361. width: 25rpx;
  362. height: 24rpx;
  363. margin-top: 4rpx;
  364. }
  365. .backBox {
  366. display: flex;
  367. position: absolute;
  368. left: 23rpx;
  369. top: 28rpx;
  370. }
  371. .backTxt {
  372. color: #3F90F7;
  373. font-size: 24rpx;
  374. line-height: 33rpx;
  375. }
  376. .mainLineJt {
  377. width: 25rpx;
  378. height: 24rpx;
  379. margin-top: 8rpx;
  380. }
  381. .mainLine {
  382. display: flex;
  383. border-bottom: 1px solid #EEEEEE;
  384. padding: 29rpx 24rpx;
  385. }
  386. .lineName {
  387. font-size: 26rpx;
  388. font-family: PingFangSC-Regular, PingFang SC;
  389. font-weight: 500;
  390. color: #333333;
  391. line-height: 40rpx;
  392. width: 570rpx;
  393. word-wrap: break-word;
  394. /*强制换行*/
  395. overflow: hidden;
  396. /*超出隐藏*/
  397. text-overflow: ellipsis;
  398. /*隐藏后添加省略号*/
  399. white-space: nowrap;
  400. /*强制不换行*/
  401. }
  402. .mainLine2 {
  403. display: flex;
  404. justify-content: space-between;
  405. border-bottom: 1px solid #EEEEEE;
  406. padding: 24rpx;
  407. }
  408. .lineName2 {
  409. font-size: 28rpx;
  410. font-family: PingFangSC-Regular, PingFang SC;
  411. font-weight: 400;
  412. color: #333333;
  413. line-height: 40rpx;
  414. }
  415. .lineIMg {
  416. width: 100rpx;
  417. height: 85rpx;
  418. }
  419. .lineRIght {
  420. padding-left: 20rpx;
  421. }
  422. .lineBm {
  423. font-size: 24rpx;
  424. font-family: PingFangSC-Regular, PingFang SC;
  425. font-weight: 400;
  426. color: #999999;
  427. padding: 10rpx 0;
  428. }
  429. .linejs {
  430. font-size: 24rpx;
  431. font-family: PingFangSC-Regular, PingFang SC;
  432. font-weight: 400;
  433. color: #999999;
  434. width: 570rpx;
  435. word-wrap: break-word;
  436. /*强制换行*/
  437. overflow: hidden;
  438. /*超出隐藏*/
  439. text-overflow: ellipsis;
  440. /*隐藏后添加省略号*/
  441. white-space: nowrap;
  442. /*强制不换行*/
  443. }
  444. </style>