modelThree.vue 7.1 KB

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