modelThree.vue 7.5 KB

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