vinDetail.vue 6.4 KB

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