vinDetail.vue 7.5 KB

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