vinDetail.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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-else 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">{{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. }
  70. },
  71. onLoad(opt) {
  72. // console.log('opt++',opt);
  73. this.vin = opt.vin;
  74. this.tabIndex = Number( opt.tabIndex)+1;
  75. this.groupData = uni.getStorageSync('childrenList');
  76. this.token = opt.token;
  77. this.param = opt.param;
  78. this.access_time = opt.access_time;
  79. this.getItemData();
  80. },
  81. methods: {
  82. upGroup() {
  83. this.tabIndex -= 1;
  84. if (this.tabIndex <= 0) {
  85. this.tabIndex = 1
  86. }
  87. this.param = this.groupData[this.tabIndex - 1].param;
  88. this.token = this.groupData[this.tabIndex - 1].token;
  89. this.getItemData();
  90. },
  91. downGroup() {
  92. this.tabIndex += 1;
  93. if (this.tabIndex >= this.groupData.length) {
  94. this.tabIndex = this.groupData.length
  95. }
  96. this.param = this.groupData[this.tabIndex - 1].param;
  97. this.token = this.groupData[this.tabIndex - 1].token;
  98. this.getItemData();
  99. },
  100. // 子组配件列表
  101. getItemData() {
  102. uni.showLoading({
  103. title: '加载中'
  104. });
  105. this.$http('/advancedEpc/getParts', {
  106. vin: this.vin,
  107. token: this.token,
  108. param: this.param,
  109. access_time: this.access_time,
  110. }, 'GET').then(res => {
  111. uni.hideLoading();
  112. this.epc_id = res.data.result.epc_id;
  113. this.itemList = res.data.result.list.rows;
  114. this.bannerArr = res.data.result.list.image_info;
  115. console.log('itemList++', this.itemList);
  116. });
  117. },
  118. goOemDetail(item) {
  119. uni.navigateTo({
  120. url: 'OemDetail?epc_id=' + this.epc_id + '&partsnum=' + item.partnum + '&weizhi=' + item
  121. .refernum + '&yongliang=' + item.qty
  122. })
  123. },
  124. previewImage(imgUrl) {
  125. var arr = [];
  126. var img = imgUrl
  127. arr.push(img)
  128. // 预览图片
  129. uni.previewImage({
  130. urls: arr,
  131. current: img,
  132. longPressActions: {
  133. itemList: ['发送给朋友', '保存图片', '收藏'],
  134. success: function(data) {
  135. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  136. },
  137. fail: function(err) {
  138. console.log(err.errMsg);
  139. }
  140. }
  141. });
  142. }
  143. },
  144. // 下拉刷新 上拉加载更多
  145. onPullDownRefresh() {
  146. // this.page = 1
  147. // this.getItemData()
  148. setTimeout(function() {
  149. uni.stopPullDownRefresh();
  150. }, 1000);
  151. },
  152. onReachBottom() {
  153. if (this.page <= this.total_page) {
  154. this.page++;
  155. this.getPeijianData()
  156. }
  157. }
  158. }
  159. </script>
  160. <style scoped>
  161. .comment{
  162. padding-bottom: constant(safe-area-inset-bottom);
  163. padding-bottom: env(safe-area-inset-bottom);
  164. }
  165. .quanImg {
  166. width: 100vw;
  167. height: 352rpx;
  168. }
  169. .swiper,
  170. .swiper-item,
  171. .swpImg {
  172. width: 100%;
  173. height: 352rpx;
  174. }
  175. .top {
  176. position: relative;
  177. }
  178. .enlarge {
  179. position: absolute;
  180. width: 44rpx;
  181. height: 44rpx;
  182. right: 30rpx;
  183. bottom: 34rpx;
  184. }
  185. .mainBox {
  186. width: 100vw;
  187. }
  188. .mainTop {
  189. padding: 28rpx 25rpx;
  190. display: flex;
  191. justify-content: space-between;
  192. border-bottom: 1rpx solid #EEEEEE;
  193. }
  194. .arrowBox {
  195. display: flex;
  196. align-items: center;
  197. }
  198. .arrow {
  199. width: 24rpx;
  200. height: 24rpx;
  201. }
  202. .title {
  203. font-size: 24rpx;
  204. color: #3F90F7;
  205. }
  206. .page {
  207. font-size: 28rpx;
  208. color: #333333;
  209. }
  210. .commentBox {
  211. padding: 20rpx 24rpx;
  212. border-bottom: 1rpx solid #EEEEEE;
  213. }
  214. .line {
  215. display: flex;
  216. align-items: center;
  217. }
  218. .wei {
  219. color: #F19D01;
  220. font-size: 22rpx;
  221. background: #FDF7EB;
  222. border-radius: 4px;
  223. padding: 0 8rpx;
  224. }
  225. .yong {
  226. color: #666666;
  227. font-size: 22rpx;
  228. margin-left: 10rpx;
  229. }
  230. .name {
  231. color: #333333;
  232. font-size: 26rpx;
  233. font-weight: bold;
  234. padding-top: 16rpx;
  235. padding-bottom: 10rpx;
  236. }
  237. .comment {
  238. color: #999999;
  239. font-size: 24rpx;
  240. padding-bottom: 14rpx;
  241. }
  242. .forLine {
  243. display: flex;
  244. justify-content: space-between;
  245. align-items: center;
  246. }
  247. .code {
  248. color: #3F90F7;
  249. font-size: 24rpx;
  250. }
  251. .price {
  252. color: #999999;
  253. font-size: 24rpx;
  254. }
  255. .orangePrice {
  256. color: #FF4F00;
  257. font-weight: bold;
  258. }
  259. </style>