vinDetail.vue 6.5 KB

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