vinDetail.vue 6.3 KB

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