vinDetail.vue 8.2 KB

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