vinDetail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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. var url = 'http://byweb.66km.cn/#/home?token='+token+'&cachekey='+cachekey
  115. window.location.href =url
  116. },
  117. upGroup() {
  118. this.tabIndex -= 1;
  119. if (this.tabIndex <= 0) {
  120. this.tabIndex = 1
  121. }
  122. this.param = this.groupData[this.tabIndex - 1].param;
  123. this.token = this.groupData[this.tabIndex - 1].token;
  124. this.getItemData();
  125. },
  126. downGroup() {
  127. this.tabIndex += 1;
  128. if (this.tabIndex >= this.groupData.length) {
  129. this.tabIndex = this.groupData.length
  130. }
  131. this.param = this.groupData[this.tabIndex - 1].param;
  132. this.token = this.groupData[this.tabIndex - 1].token;
  133. this.getItemData();
  134. },
  135. // 子组配件列表
  136. getItemData() {
  137. uni.showLoading({
  138. title: '加载中'
  139. });
  140. this.$http('/advancedEpc/getParts', {
  141. vin: this.vin,
  142. token: this.token,
  143. param: this.param,
  144. access_time: this.access_time,
  145. epc_id:this.epc_id
  146. }, 'GET').then(res => {
  147. uni.hideLoading();
  148. this.epc_id = res.data.result.epc_id;
  149. this.itemList = res.data.result.list.rows;
  150. this.bannerArr = res.data.result.list.image_info;
  151. console.log('itemList++', this.itemList);
  152. if (this.bannerArr.length == 0) {
  153. this.loading = true;
  154. }
  155. });
  156. },
  157. goOemDetail(item) {
  158. uni.navigateTo({
  159. url: 'OemDetail?epc_id=' + this.epc_id + '&partsnum=' + item.partnum + '&weizhi=' + item
  160. .refernum + '&yongliang=' + item.qty
  161. })
  162. },
  163. previewImage(imgUrl) {
  164. var arr = [];
  165. var img = imgUrl
  166. arr.push(img)
  167. // 预览图片
  168. uni.previewImage({
  169. urls: arr,
  170. current: img,
  171. longPressActions: {
  172. itemList: ['发送给朋友', '保存图片', '收藏'],
  173. success: function(data) {
  174. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  175. },
  176. fail: function(err) {
  177. console.log(err.errMsg);
  178. }
  179. }
  180. });
  181. }
  182. },
  183. // 下拉刷新 上拉加载更多
  184. onPullDownRefresh() {
  185. // this.page = 1
  186. // this.getItemData()
  187. setTimeout(function() {
  188. uni.stopPullDownRefresh();
  189. }, 1000);
  190. },
  191. onReachBottom() {
  192. if (this.page <= this.total_page) {
  193. this.page++;
  194. this.getPeijianData()
  195. }
  196. }
  197. }
  198. </script>
  199. <style scoped>
  200. .comment{
  201. padding-bottom: constant(safe-area-inset-bottom);
  202. padding-bottom: env(safe-area-inset-bottom);
  203. }
  204. .quanImg {
  205. width: 100vw;
  206. height: 352rpx;
  207. }
  208. .swiper,
  209. .swiper-item,
  210. .swpImg {
  211. width: 100%;
  212. height: 352rpx;
  213. }
  214. .top {
  215. position: relative;
  216. }
  217. .enlarge {
  218. position: absolute;
  219. width: 44rpx;
  220. height: 44rpx;
  221. right: 30rpx;
  222. bottom: 34rpx;
  223. }
  224. .mainBox {
  225. width: 100vw;
  226. }
  227. .mainTop {
  228. padding: 28rpx 25rpx;
  229. display: flex;
  230. justify-content: space-between;
  231. border-bottom: 1rpx solid #EEEEEE;
  232. }
  233. .arrowBox {
  234. display: flex;
  235. align-items: center;
  236. }
  237. .arrow {
  238. width: 24rpx;
  239. height: 24rpx;
  240. }
  241. .title {
  242. font-size: 24rpx;
  243. color: #3F90F7;
  244. }
  245. .page {
  246. font-size: 28rpx;
  247. color: #333333;
  248. }
  249. .commentBox {
  250. padding: 20rpx 24rpx;
  251. border-bottom: 1rpx solid #EEEEEE;
  252. }
  253. .line {
  254. display: flex;
  255. align-items: center;
  256. }
  257. .wei {
  258. color: #F19D01;
  259. font-size: 22rpx;
  260. background: #FDF7EB;
  261. border-radius: 4px;
  262. padding: 0 8rpx;
  263. }
  264. .yong {
  265. color: #666666;
  266. font-size: 22rpx;
  267. margin-left: 10rpx;
  268. }
  269. .name {
  270. color: #333333;
  271. font-size: 26rpx;
  272. font-weight: bold;
  273. padding-top: 16rpx;
  274. padding-bottom: 10rpx;
  275. }
  276. .comment {
  277. color: #999999;
  278. font-size: 24rpx;
  279. padding-bottom: 14rpx;
  280. }
  281. .forLine {
  282. display: flex;
  283. justify-content: space-between;
  284. align-items: center;
  285. }
  286. .code {
  287. color: #3F90F7;
  288. font-size: 24rpx;
  289. }
  290. .price {
  291. color: #999999;
  292. font-size: 24rpx;
  293. }
  294. .orangePrice {
  295. color: #FF4F00;
  296. font-weight: bold;
  297. }
  298. .zdyNavBox {
  299. width: 100vw;
  300. background: #FFFFFF;
  301. position: fixed;
  302. top: 0;
  303. left: 0;
  304. z-index: 9999999;
  305. }
  306. .zdyNav {
  307. display: flex;
  308. justify-content: space-between;
  309. align-items: center;
  310. padding: 14rpx 6rpx;
  311. }
  312. .zdyNavLeft{
  313. width: 120rpx;
  314. display: flex;
  315. }
  316. .goHomeBox{
  317. padding-left: 20rpx;
  318. padding-top: 6rpx;
  319. }
  320. .goHomeImg{
  321. width: 20px;
  322. height: 20px;
  323. }
  324. .gobackBox{
  325. padding-left: 20rpx;
  326. padding-top: 6rpx;
  327. }
  328. .gobackImg{
  329. width: 10px;
  330. height: 20px;
  331. padding-right: 20rpx;
  332. }
  333. .zdyNavTitle {
  334. background: #FFFFFF;
  335. text-align: center;
  336. /* font-size: 32rpx; */
  337. /* font-weight: bold; */
  338. font-size: 18px!important;
  339. color: #333333!important;
  340. }
  341. .zdyNavRight {
  342. background: #FFFFFF;
  343. text-align: center;
  344. font-size: 28rpx;
  345. color: #3F90F7;
  346. width: 120rpx;
  347. }
  348. </style>