vinDetail.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="content">
  3. <view class="zdyNavBox">
  4. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  5. <view class="zdyNav">
  6. <view class="zdyNavLeft">
  7. <!-- <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon"
  8. style="color: rgb(0, 0, 0); font-size: 27px;"></i></div> -->
  9. <div class="gobackBox" @click="goback">
  10. <image src="/static/img/goback.png" mode="" class="gobackImg"></image>
  11. </div>
  12. <div class="goHomeBox" @click="goHome">
  13. <image src="/static/img/home.png" mode="" class="goHomeImg"></image>
  14. </div>
  15. </view>
  16. <view class="zdyNavTitle">车型件</view>
  17. <view style="width: 120rpx;"></view>
  18. </view>
  19. </view>
  20. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  21. <view style="height: 44px;"></view>
  22. <view class="top">
  23. <!-- 轮播图 -->
  24. <swiper class="swiper" :circular="true" :indicator-dots="true" indicator-active-color="#FF4F00"
  25. v-if="bannerArr.length>0">
  26. <swiper-item v-for="(item,index) in bannerArr">
  27. <image :src="item.pic_url" mode="" class="swpImg"></image>
  28. <image @click="previewImage(item.pic_url)" src="../../static/img/icon_fangda@2x.png" mode="" class="enlarge">
  29. </image>
  30. </swiper-item>
  31. </swiper>
  32. <image v-if="loading" class="swiper" src="../../static/img/barner_noimg.png" mode=""></image>
  33. </view>
  34. <view style="height: 20rpx;background: #F4F5F7;"></view>
  35. <view class="mainBox">
  36. <view class="mainTop">
  37. <view v-if="tabIndex > 1" class="arrowBox">
  38. <image src="../../static/img/icon_arrow_blue_l@2x.png" mode="" class="arrow"></image>
  39. <view class="title" @click="upGroup">上一组</view>
  40. </view>
  41. <view v-else class="arrowBox">
  42. <image src="../../static/img/icon_arrow_jindian_l@2x.png" mode="" class="arrow"></image>
  43. <view class="title" style="color: #999999;">上一组</view>
  44. </view>
  45. <view class="page">{{tabIndex}}/{{groupData.length}}</view>
  46. <view v-if="tabIndex < groupData.length" class="arrowBox">
  47. <view class="title" @click="downGroup">下一组</view>
  48. <image src="../../static/img/icon_arrow_blue_r@2x.png" mode="" class="arrow"></image>
  49. </view>
  50. <view v-else class="arrowBox">
  51. <view class="title" style="color: #999999;">下一组</view>
  52. <image src="../../static/img/icon_arrow_jindian_r@2x.png" mode="" class="arrow"></image>
  53. </view>
  54. </view>
  55. <view class="commentBox" v-for="(item,index) in itemList" :key="index" v-if="item.disabled==0">
  56. <view class="line">
  57. <view class="wei">位置{{item.refernum}}</view>
  58. <view class="yong">用量{{item.qty}}</view>
  59. </view>
  60. <view class="name" v-html="item.description"></view>
  61. <view class="comment">{{item.remark}}</view>
  62. <view class="forLine">
  63. <view @click="goOemDetail(item)" class="code">{{item.partnum.join()}}</view>
  64. <view class="price">4S店价:
  65. <span class="orangePrice">¥ {{item.price}}</span>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. title: 'Hello',
  77. vin: '',
  78. epc_id: '',
  79. token: '',
  80. param: '',
  81. access_time: '',
  82. groupData: [],
  83. itemList: [],
  84. bannerArr: [],
  85. tabIndex: 1,
  86. page: 1,
  87. total_page: 1,
  88. epc_id:'',
  89. loading:false,
  90. iStatusBarHeight:'',
  91. }
  92. },
  93. onLoad(opt) {
  94. // console.log('opt++',opt);
  95. this.vin = opt.vin;
  96. this.tabIndex = Number( opt.tabIndex)+1;
  97. this.groupData = uni.getStorageSync('childrenList');
  98. this.token = opt.token;
  99. this.param = opt.param;
  100. this.access_time = opt.access_time;
  101. this.epc_id=opt.epc_id
  102. this.getItemData();
  103. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  104. },
  105. methods: {
  106. goback() {
  107. console.log('返回');
  108. uni.navigateBack({})
  109. //window.history.back()
  110. },
  111. goHome(){
  112. var token= uni.getStorageSync("token")
  113. var cachekey= uni.getStorageSync("cachekey")
  114. if(this.vin){
  115. var url = 'http://byweb.66km.cn/#/home?token='+token//+'&cachekey='+cachekey
  116. }else{
  117. var url = 'http://byweb.66km.cn/#/home?token='+token+'&cachekey='+cachekey
  118. }
  119. //var url = 'http://byweb.66km.cn/#/home?token='+token+'&cachekey='+cachekey
  120. window.location.href =url
  121. },
  122. upGroup() {
  123. this.tabIndex -= 1;
  124. if (this.tabIndex <= 0) {
  125. this.tabIndex = 1
  126. }
  127. this.param = this.groupData[this.tabIndex - 1].param;
  128. this.token = this.groupData[this.tabIndex - 1].token;
  129. this.getItemData();
  130. },
  131. downGroup() {
  132. this.tabIndex += 1;
  133. if (this.tabIndex >= this.groupData.length) {
  134. this.tabIndex = this.groupData.length
  135. }
  136. this.param = this.groupData[this.tabIndex - 1].param;
  137. this.token = this.groupData[this.tabIndex - 1].token;
  138. this.getItemData();
  139. },
  140. // 子组配件列表
  141. getItemData() {
  142. uni.showLoading({
  143. title: '加载中'
  144. });
  145. this.$http('/advancedEpc/getParts', {
  146. vin: this.vin,
  147. token: this.token,
  148. param: this.param,
  149. access_time: this.access_time,
  150. epc_id:this.epc_id
  151. }, 'GET').then(res => {
  152. uni.hideLoading();
  153. this.epc_id = res.data.result.epc_id;
  154. this.itemList = res.data.result.list.rows;
  155. this.bannerArr = res.data.result.list.image_info;
  156. console.log('itemList++', this.itemList);
  157. if (this.bannerArr.length == 0) {
  158. this.loading = true;
  159. }
  160. });
  161. },
  162. goOemDetail(item) {
  163. uni.navigateTo({
  164. url: 'OemDetail?epc_id=' + this.epc_id + '&partsnum=' + item.partnum + '&weizhi=' + item
  165. .refernum + '&yongliang=' + item.qty
  166. })
  167. },
  168. previewImage(imgUrl) {
  169. var arr = [];
  170. var img = imgUrl
  171. arr.push(img)
  172. // 预览图片
  173. uni.previewImage({
  174. urls: arr,
  175. current: img,
  176. longPressActions: {
  177. itemList: ['发送给朋友', '保存图片', '收藏'],
  178. success: function(data) {
  179. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  180. },
  181. fail: function(err) {
  182. console.log(err.errMsg);
  183. }
  184. }
  185. });
  186. }
  187. },
  188. // 下拉刷新 上拉加载更多
  189. onPullDownRefresh() {
  190. // this.page = 1
  191. // this.getItemData()
  192. setTimeout(function() {
  193. uni.stopPullDownRefresh();
  194. }, 1000);
  195. },
  196. onReachBottom() {
  197. if (this.page <= this.total_page) {
  198. this.page++;
  199. this.getPeijianData()
  200. }
  201. }
  202. }
  203. </script>
  204. <style scoped>
  205. .comment{
  206. padding-bottom: constant(safe-area-inset-bottom);
  207. padding-bottom: env(safe-area-inset-bottom);
  208. }
  209. .quanImg {
  210. width: 100vw;
  211. height: 352rpx;
  212. }
  213. .swiper,
  214. .swiper-item,
  215. .swpImg {
  216. width: 100%;
  217. height: 352rpx;
  218. }
  219. .top {
  220. position: relative;
  221. }
  222. .enlarge {
  223. position: absolute;
  224. width: 44rpx;
  225. height: 44rpx;
  226. right: 30rpx;
  227. bottom: 34rpx;
  228. }
  229. .mainBox {
  230. width: 100vw;
  231. }
  232. .mainTop {
  233. padding: 28rpx 25rpx;
  234. display: flex;
  235. justify-content: space-between;
  236. border-bottom: 1rpx solid #EEEEEE;
  237. }
  238. .arrowBox {
  239. display: flex;
  240. align-items: center;
  241. }
  242. .arrow {
  243. width: 24rpx;
  244. height: 24rpx;
  245. }
  246. .title {
  247. font-size: 24rpx;
  248. color: #3F90F7;
  249. }
  250. .page {
  251. font-size: 28rpx;
  252. color: #333333;
  253. }
  254. .commentBox {
  255. padding: 20rpx 24rpx;
  256. border-bottom: 1rpx solid #EEEEEE;
  257. }
  258. .line {
  259. display: flex;
  260. align-items: center;
  261. }
  262. .wei {
  263. color: #F19D01;
  264. font-size: 22rpx;
  265. background: #FDF7EB;
  266. border-radius: 4px;
  267. padding: 0 8rpx;
  268. }
  269. .yong {
  270. color: #666666;
  271. font-size: 22rpx;
  272. margin-left: 10rpx;
  273. }
  274. .name {
  275. color: #333333;
  276. font-size: 26rpx;
  277. font-weight: bold;
  278. padding-top: 16rpx;
  279. padding-bottom: 10rpx;
  280. }
  281. .comment {
  282. color: #999999;
  283. font-size: 24rpx;
  284. padding-bottom: 14rpx;
  285. }
  286. .forLine {
  287. display: flex;
  288. justify-content: space-between;
  289. align-items: center;
  290. }
  291. .code {
  292. color: #3F90F7;
  293. font-size: 24rpx;
  294. }
  295. .price {
  296. color: #999999;
  297. font-size: 24rpx;
  298. }
  299. .orangePrice {
  300. color: #FF4F00;
  301. font-weight: bold;
  302. }
  303. .zdyNavBox {
  304. width: 100vw;
  305. background: #FFFFFF;
  306. position: fixed;
  307. top: 0;
  308. left: 0;
  309. z-index: 9999999;
  310. }
  311. .zdyNav {
  312. display: flex;
  313. justify-content: space-between;
  314. align-items: center;
  315. padding: 14rpx 6rpx;
  316. }
  317. .zdyNavLeft{
  318. width: 120rpx;
  319. display: flex;
  320. }
  321. .goHomeBox{
  322. padding-left: 20rpx;
  323. padding-top: 6rpx;
  324. }
  325. .goHomeImg{
  326. width: 20px;
  327. height: 20px;
  328. }
  329. .gobackBox{
  330. padding-left: 20rpx;
  331. padding-top: 6rpx;
  332. }
  333. .gobackImg{
  334. width: 10px;
  335. height: 20px;
  336. padding-right: 20rpx;
  337. }
  338. .zdyNavTitle {
  339. background: #FFFFFF;
  340. text-align: center;
  341. /* font-size: 32rpx; */
  342. /* font-weight: bold; */
  343. font-size: 18px!important;
  344. color: #333333!important;
  345. }
  346. .zdyNavRight {
  347. background: #FFFFFF;
  348. text-align: center;
  349. font-size: 28rpx;
  350. color: #3F90F7;
  351. width: 120rpx;
  352. }
  353. </style>