vinDetail.vue 6.6 KB

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