vinDetail.vue 6.2 KB

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