portprice.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view>
  3. <view class="guess-section">
  4. <view class="cu-card article no-card Regular" style='width: 100%;'>
  5. <view class="top-tap Regular">
  6. <view class="top-tap-item">港口</view>
  7. <view class="top-tap-item">价格</view>
  8. <view class="top-tap-item">较昨日</view>
  9. </view>
  10. </view>
  11. <view class="guess-list">
  12. <view v-for="(item, index) in newsInfo" :key="index" class="guess-item">
  13. <view class="cu-card article no-card">
  14. <view class="cu-item shadow factoryItem justify-between align-center" style="display:flex;">
  15. <view class="flex-item">
  16. <view class='factory Regular'>{{item.port}}</view>
  17. <view class='wrap Regular'>{{item.goodsName}}</view>
  18. </view>
  19. <view class="flex-item">
  20. <view class='price NumberBold'>{{item.price}}</view>
  21. <view class='wrap Regular'>
  22. <text style='margin-right:5px;'>
  23. <image style='width:11px;height:11px;'
  24. src='../../static/img/homepage/water@3x.png'>
  25. </image>
  26. <={{item.waterContent}}</text>
  27. <text>
  28. <image style='width:11px;height:11px;'
  29. src='../../static/img/homepage/unitweight@3x.png'></image>
  30. >={{item.bulkDensity}}
  31. </text>
  32. </view>
  33. </view>
  34. <view class='flex-item positive NumberBold' v-if='item.comparePrice>0'>
  35. <image class='up' src='../../static/img/homepage/shangsheng.png'>{{item.comparePrice}}
  36. </image>
  37. </view>
  38. <view class='flex-item negative NumberBold' v-if='item.comparePrice<0'>
  39. <image class='down' src='../../static/img/homepage/xiajiang.png'>{{-item.comparePrice}}
  40. </image>
  41. </view>
  42. <view class="flex-item Regular" v-if='item.comparePrice==0'>-</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view v-show="isLoadMore">
  48. <uni-load-more :status="loadStatus"></uni-load-more>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. mapState
  56. } from 'vuex';
  57. export default {
  58. name: "sale",
  59. data() {
  60. return {
  61. titleNViewBackground: '',
  62. swiperCurrent: 0,
  63. swiperLength: 0,
  64. carouselList: [],
  65. windowSpuList: [],
  66. categoryPickList: [],
  67. categoryButtomList: [],
  68. salesTop: [],
  69. saleInfo: [],
  70. portInfo: [],
  71. banner: undefined,
  72. isVip: false,
  73. pages: 1, //页数
  74. limit: 10, //每次取条目数
  75. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  76. isLoadMore: false, //是否加载中
  77. showTran: true,
  78. list: [],
  79. scrollTop: 0,
  80. cardCur: 0,
  81. dotStyle: false,
  82. newsInfo: [],
  83. categoryList: [],
  84. pages: 1, //页数
  85. limit: 10, //每次取条目数
  86. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  87. TabCur: 0,
  88. category: 0,
  89. current: 0,
  90. infoList1: []
  91. };
  92. },
  93. onReady() {},
  94. onShow() {
  95. uni.showTabBar()
  96. this.pages = 1
  97. this.isLoadMore = false
  98. this.loadStatus = 'more'
  99. this.loadData()
  100. },
  101. onLoad(options) {
  102. var that = this
  103. var infoList = [];
  104. // uni.request({
  105. // url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
  106. // // url: "https://hq.sinajs.cn/list=C2109",
  107. // header: {
  108. // 'content-type': 'application/x-www-form-urlencoded'
  109. // },
  110. // success: function(result) {
  111. // // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
  112. // var tmp = result.data.split('"')
  113. // for (var i = 1; i < tmp.length; i = i + 2) {
  114. // var list = tmp[i].split(",")
  115. // var data = {
  116. // goodsName: list[0],
  117. // newPrice: list[6],
  118. // openPrice: list[2]
  119. // }
  120. // if (data.goodsName) {
  121. // infoList.push(data)
  122. // }
  123. // }
  124. // let name = 'infoList';
  125. // let value = infoList;
  126. // that.$store.commit('$uStore', {
  127. // name,
  128. // value
  129. // });
  130. // // console.log("infoList",infoList)
  131. // },
  132. // fail: function(e) {
  133. // console.log('error in...')
  134. // // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
  135. // reject(e)
  136. // },
  137. // })
  138. },
  139. onPageScroll(e) {
  140. this.scrollTop = e.scrollTop;
  141. },
  142. onReachBottom() { //上拉触底函数
  143. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  144. this.isLoadMore = true
  145. this.pages += 1
  146. this.getIndexSaleData()
  147. }
  148. },
  149. onPullDownRefresh() {
  150. this.pages = 1
  151. this.isLoadMore = false
  152. this.loadStatus = 'loading'
  153. this.loadData()
  154. setTimeout(function() {
  155. uni.stopPullDownRefresh();
  156. }, 1000);
  157. },
  158. computed: {
  159. ...mapState(['hasLogin', 'userInfo'])
  160. },
  161. methods: {
  162. async loadData() {
  163. var that = this
  164. // 新闻内容
  165. that.$api.request('news', 'getPortPriceInfo', {
  166. category: this.category,
  167. page: this.pages,
  168. limit: this.limit
  169. }, failres => {
  170. that.$api.msg(failres.errmsg)
  171. this.isLoadMore = false
  172. this.loadStatus = 'nomore'
  173. if (this.pages > 1) {
  174. this.pages = 1
  175. }
  176. uni.hideLoading()
  177. }).then(res => {
  178. let data = res.data
  179. that.newsInfo = data
  180. uni.hideLoading()
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style scoped lang="scss">
  187. .price {
  188. color: #FD714F;
  189. }
  190. .container {
  191. margin: 10rpx 10rpx 10rpx 10rpx;
  192. }
  193. .cu-tag.badge {
  194. right: 26rpx;
  195. }
  196. .up,
  197. .down {
  198. width: 7.5px;
  199. height: 9px;
  200. position: relative;
  201. vertical-align: middle;
  202. margin-right: 2px;
  203. margin-top: 5px;
  204. }
  205. .gird-left,
  206. .gird-right {}
  207. .cu-tag.radius[class*="line"]::after {
  208. border-radius: 66rpx;
  209. }
  210. .goTop {
  211. height: 32px;
  212. width: 32px;
  213. position: fixed;
  214. bottom: 200rpx;
  215. right: 30rpx;
  216. border-radius: 50%;
  217. }
  218. .goTop image {
  219. width: 32px;
  220. height: 32px;
  221. }
  222. .flex {
  223. display: flex;
  224. }
  225. .text-white {
  226. color: #fff;
  227. }
  228. .cu-card {
  229. border-bottom: 1rpx solid #f8f8f8;
  230. text-align: center;
  231. }
  232. .factory {
  233. font-size: 28rpx;
  234. }
  235. .positive {
  236. color: #FD714F;
  237. font-size: 28rpx;
  238. }
  239. .negative {
  240. color: #22C572;
  241. font-size: 28rpx;
  242. }
  243. .wrap {
  244. font-size: 20rpx;
  245. color: rgba(0, 0, 0, 0.5);
  246. }
  247. .align-center {
  248. align-items: center;
  249. }
  250. .flex-direction-row {
  251. flex-direction: row;
  252. }
  253. .factoryItem {
  254. padding: 20rpx 0;
  255. }
  256. /* #ifdef MP */
  257. .mp-search-box {
  258. // position:relative;
  259. left: 0;
  260. top: 30upx;
  261. z-index: 9999;
  262. width: 100%;
  263. padding: 0 80upx;
  264. background: rgba(255, 170, 0, 0.6);
  265. .ser-input {
  266. flex: 1;
  267. height: 56upx;
  268. line-height: 56upx;
  269. text-align: center;
  270. font-size: 28upx;
  271. color: $font-color-base;
  272. border-radius: 10px;
  273. background: rgba(255, 255, 255, .6);
  274. }
  275. }
  276. .desc {
  277. width: 73%;
  278. margin-right: 2%;
  279. }
  280. .justify-between {
  281. justify-content: space-between;
  282. }
  283. page {
  284. .cate-section {
  285. position: relative;
  286. z-index: 5;
  287. border-radius: 16upx 16upx 0 0;
  288. margin-top: -20upx;
  289. }
  290. .carousel-section {
  291. padding: 0;
  292. .titleNview-placing {
  293. padding-top: 0;
  294. height: 0;
  295. }
  296. .carousel {
  297. .carousel-item {
  298. padding: 0;
  299. }
  300. }
  301. .swiper-dots {
  302. left: 50%;
  303. bottom: 5upx;
  304. transform: translateX(-50%);
  305. }
  306. }
  307. }
  308. /* #endif */
  309. .cuIcon-notification::before {
  310. color: #f37b1;
  311. }
  312. .cu-card.article>.cu-item .content>image {
  313. height: 3.4em;
  314. margin-right: 0rpx;
  315. margin-top: 24rpx;
  316. }
  317. .screen-swiper.price-swiper {
  318. height: 70rpx;
  319. min-height: 70rpx;
  320. background: #fff;
  321. margin-bottom: 10px;
  322. }
  323. .swiper-item {
  324. border-radius: 5%;
  325. }
  326. .guess-section {
  327. margin-bottom: 120rpx;
  328. margin-top: 20rpx;
  329. padding: 0;
  330. .guess-item {
  331. width: 100%;
  332. padding: 0 48rpx;
  333. border-bottom: 1px solid #EEEEEE;
  334. }
  335. }
  336. .guess-section .price {
  337. color: #FD714F;
  338. font-size: 34rpx;
  339. font-weight: 600;
  340. }
  341. page {
  342. background: #f5f5f5;
  343. }
  344. .m-t {
  345. margin-top: 16upx;
  346. }
  347. .top-tap {
  348. display: flex;
  349. font-size: 27rpx;
  350. padding: 20rpx 48rpx;
  351. justify-content: space-between;
  352. .top-tap-item {
  353. color: #B2B3BB;
  354. }
  355. .top-tap-item:nth-of-type(1) {
  356. width: 40%;
  357. display: flex;
  358. justify-content: flex-start;
  359. }
  360. ;
  361. .top-tap-item:nth-of-type(2) {
  362. width: 40%;
  363. display: flex;
  364. justify-content: center;
  365. }
  366. ;
  367. .top-tap-item:nth-of-type(3) {
  368. width: 20%;
  369. display: flex;
  370. justify-content: flex-end;
  371. }
  372. }
  373. .flex-item:nth-of-type(1) {
  374. width: 40%;
  375. display: flex;
  376. flex-direction: column;
  377. align-items: flex-start;
  378. }
  379. .flex-item:nth-of-type(2) {
  380. width: 40%;
  381. }
  382. .flex-item:nth-of-type(3) {
  383. width: 20%;
  384. display: flex;
  385. justify-content: flex-end;
  386. }
  387. .guess-list {
  388. width: 100%;
  389. }
  390. </style>