plant.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <view>
  3. <view class="guess-section">
  4. <view class="cu-card article no-card" style='width: 100%;'>
  5. <view class="top-tap Regular" style="display:flex;">
  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 class="guess-list-item" v-for="(item, index) in newsInfo" :key="index">
  13. <view class="flex-item">
  14. <view class='factory Medium'>{{item.factory}}</view>
  15. <view class='wrap Regular'>{{item.city}} {{item.factoryType}}</view>
  16. </view>
  17. <view class="flex-item">
  18. <!-- <view class='price NumberBold'>{{item.price}}</view>
  19. <view class='wrap Regular'>
  20. <text style='margin-right:5px;'>
  21. <image style='width:11px;height:11px;'
  22. src='../../static/img/homepage/water@3x.png'>
  23. </image>
  24. <={{item.waterContent}}</text>
  25. <text>
  26. <image style='width:11px;height:11px;'
  27. src='../../static/img/homepage/unitweight@3x.png'></image>
  28. >={{item.bulkDensity}}
  29. </text>
  30. </view>
  31. </view> -->
  32. <!-- <view class='price NumberBold guess-item-item'>{{item.price}}</view> -->
  33. <view class='price NumberBold guess-item-item'>{{item.price}}</view>
  34. <view class='wrap Regular'>
  35. <text style='margin-right:5px;'>
  36. <image style='width:11px;height:11px;'
  37. src='../../static/img/homepage/water@3x.png'>
  38. </image>
  39. <={{item.waterContent}}</text>
  40. <text>
  41. <image style='width:11px;height:11px;'
  42. src='../../static/img/homepage/unitweight@3x.png'></image>
  43. >={{item.bulkDensity}}
  44. </text>
  45. </view>
  46. </view>
  47. <view class='positive NumberBold guess-item-item' v-if='item.comparePrice>0'>
  48. <image class='up' src='../../static/img/homepage/shangsheng.png'>{{item.comparePrice}}
  49. </image>
  50. </view>
  51. <view class='negative NumberBold guess-item-item' v-if='item.comparePrice<0'>
  52. <image class='down' src='../../static/img/homepage/xiajiang.png'>{{-item.comparePrice}}
  53. </image>
  54. </view>
  55. <view class="guess-item-item Regular" v-if='item.comparePrice==0'>-</view>
  56. </view>
  57. </view>
  58. <view v-show="isLoadMore">
  59. <uni-load-more :status="loadStatus"></uni-load-more>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapState
  67. } from 'vuex';
  68. export default {
  69. name: "sale",
  70. data() {
  71. return {
  72. titleNViewBackground: '',
  73. swiperCurrent: 0,
  74. swiperLength: 0,
  75. carouselList: [],
  76. windowSpuList: [],
  77. categoryPickList: [],
  78. categoryButtomList: [],
  79. salesTop: [],
  80. saleInfo: [],
  81. portInfo: [],
  82. banner: undefined,
  83. isVip: false,
  84. pages: 1, //页数
  85. limit: 10, //每次取条目数
  86. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  87. isLoadMore: false, //是否加载中
  88. showTran: true,
  89. list: [],
  90. scrollTop: 0,
  91. cardCur: 0,
  92. dotStyle: false,
  93. newsInfo: [],
  94. categoryList: [],
  95. pages: 1, //页数
  96. limit: 10, //每次取条目数
  97. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  98. TabCur: 0,
  99. category: 0,
  100. current: 0,
  101. infoList1: []
  102. };
  103. },
  104. onReady() {},
  105. onShow() {
  106. uni.showTabBar()
  107. this.pages = 1
  108. this.isLoadMore = false
  109. this.loadStatus = 'more'
  110. this.loadData()
  111. },
  112. onLoad(options) {
  113. var that = this
  114. var infoList = [];
  115. // uni.request({
  116. // url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
  117. // // url: "https://hq.sinajs.cn/list=C2109",
  118. // header: {
  119. // 'content-type': 'application/x-www-form-urlencoded'
  120. // },
  121. // success: function(result) {
  122. // // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
  123. // var tmp = result.data.split('"')
  124. // for (var i = 1; i < tmp.length; i = i + 2) {
  125. // var list = tmp[i].split(",")
  126. // var data = {
  127. // goodsName: list[0],
  128. // newPrice: list[6],
  129. // openPrice: list[2]
  130. // }
  131. // if (data.goodsName) {
  132. // infoList.push(data)
  133. // }
  134. // }
  135. // let name = 'infoList';
  136. // let value = infoList;
  137. // that.$store.commit('$uStore', {
  138. // name,
  139. // value
  140. // });
  141. // // console.log("infoList",infoList)
  142. // },
  143. // fail: function(e) {
  144. // console.log('error in...')
  145. // // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
  146. // reject(e)
  147. // },
  148. // })
  149. },
  150. onPageScroll(e) {
  151. this.scrollTop = e.scrollTop;
  152. },
  153. onReachBottom() { //上拉触底函数
  154. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  155. this.isLoadMore = true
  156. this.pages += 1
  157. this.getIndexSaleData()
  158. }
  159. },
  160. onPullDownRefresh() {
  161. this.pages = 1
  162. this.isLoadMore = false
  163. this.loadStatus = 'loading'
  164. this.loadData()
  165. setTimeout(function() {
  166. uni.stopPullDownRefresh();
  167. }, 1000);
  168. },
  169. computed: {
  170. ...mapState(['hasLogin', 'userInfo'])
  171. },
  172. methods: {
  173. DotStyle(e) {
  174. this.dotStyle = e.detail.value
  175. },
  176. cardSwiper(e) {
  177. this.cardCur = e.detail.current
  178. },
  179. hangqing() {
  180. uni.navigateTo({
  181. url: `/pageB/news/news`
  182. })
  183. },
  184. tabSelect(e) {
  185. this.TabCur = e.currentTarget.dataset.id;
  186. this.category = this.TabCur
  187. this.pages = 1
  188. this.loadData()
  189. },
  190. //回到顶部
  191. goTop(e) { // 一键回到顶部
  192. console.log(e)
  193. if (wx.pageScrollTo) {
  194. wx.pageScrollTo({
  195. scrollTop: 0
  196. })
  197. } else {
  198. wx.showModal({
  199. title: '提示',
  200. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  201. })
  202. }
  203. },
  204. async loadData() {
  205. var that = this
  206. var _gp = ''
  207. var _mt = ''
  208. if (this.TabCur == 0) {
  209. _gp = 'news'
  210. _mt = 'getFactoryPriceInfo'
  211. } else if (this.TabCur == 1) {
  212. _gp = 'news'
  213. _mt = 'getPortPriceInfo'
  214. } else if (this.TabCur == 2) {
  215. _gp = 'news'
  216. _mt = 'getNewsInfo'
  217. }
  218. // 新闻内容
  219. that.$api.request(_gp, _mt, {
  220. category: this.category,
  221. page: this.pages,
  222. limit: this.limit
  223. }, failres => {
  224. that.$api.msg(failres.errmsg)
  225. this.isLoadMore = false
  226. this.loadStatus = 'nomore'
  227. if (this.pages > 1) {
  228. this.pages = 1
  229. }
  230. uni.hideLoading()
  231. }).then(res => {
  232. let data = res.data
  233. that.newsInfo = data
  234. uni.hideLoading()
  235. })
  236. },
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. .container {
  242. margin: 10rpx 10rpx 10rpx 10rpx;
  243. }
  244. .cu-tag.badge {
  245. right: 26rpx;
  246. }
  247. .up,
  248. .down {
  249. width: 7.5px;
  250. height: 9px;
  251. position: relative;
  252. vertical-align: middle;
  253. margin-right: 2px;
  254. }
  255. .gird-left,
  256. .gird-right {}
  257. .cu-tag.radius[class*="line"]::after {
  258. border-radius: 66rpx;
  259. }
  260. .goTop {
  261. height: 32px;
  262. width: 32px;
  263. position: fixed;
  264. bottom: 200rpx;
  265. right: 30rpx;
  266. border-radius: 50%;
  267. }
  268. .goTop image {
  269. width: 32px;
  270. height: 32px;
  271. }
  272. .flex {
  273. display: flex;
  274. }
  275. .text-white {
  276. color: #fff;
  277. }
  278. .cu-card {
  279. border-bottom: 1rpx solid #f8f8f8;
  280. text-align: center;
  281. }
  282. .factory {
  283. font-size: 28rpx;
  284. }
  285. .positive {
  286. color: #FD714F;
  287. font-size: 28rpx;
  288. }
  289. .negative {
  290. color: #22C572;
  291. font-size: 28rpx;
  292. font-weight: 900;
  293. }
  294. .wrap {
  295. font-size: 24rpx;
  296. color: #B2B3BB;
  297. }
  298. .align-center {
  299. align-items: center;
  300. }
  301. .flex-direction-row {
  302. flex-direction: row;
  303. }
  304. .factoryItem {
  305. padding: 20rpx 0;
  306. }
  307. /* #ifdef MP */
  308. .mp-search-box {
  309. // position:relative;
  310. left: 0;
  311. top: 30upx;
  312. z-index: 9999;
  313. width: 100%;
  314. padding: 0 80upx;
  315. background: rgba(255, 170, 0, 0.6);
  316. .ser-input {
  317. flex: 1;
  318. height: 56upx;
  319. line-height: 56upx;
  320. text-align: center;
  321. font-size: 28upx;
  322. color: $font-color-base;
  323. border-radius: 10px;
  324. background: rgba(255, 255, 255, .6);
  325. }
  326. }
  327. .desc {
  328. width: 73%;
  329. margin-right: 2%;
  330. }
  331. .justify-between {
  332. justify-content: space-between;
  333. }
  334. page {
  335. .cate-section {
  336. position: relative;
  337. z-index: 5;
  338. border-radius: 16upx 16upx 0 0;
  339. margin-top: -20upx;
  340. }
  341. .carousel-section {
  342. padding: 0;
  343. .titleNview-placing {
  344. padding-top: 0;
  345. height: 0;
  346. }
  347. .carousel {
  348. .carousel-item {
  349. padding: 0;
  350. }
  351. }
  352. .swiper-dots {
  353. left: 50%;
  354. bottom: 5upx;
  355. transform: translateX(-50%);
  356. }
  357. }
  358. }
  359. /* #endif */
  360. .cuIcon-notification::before {
  361. color: #f37b1;
  362. }
  363. .cu-card.article>.cu-item .content>image {
  364. height: 3.4em;
  365. margin-right: 0rpx;
  366. margin-top: 24rpx;
  367. }
  368. .screen-swiper.price-swiper {
  369. height: 70rpx;
  370. min-height: 70rpx;
  371. background: #fff;
  372. margin-bottom: 10px;
  373. }
  374. .swiper-item {
  375. border-radius: 5%;
  376. }
  377. .guess-section {
  378. padding: 0;
  379. margin-top: 20rpx;
  380. }
  381. .guess-section .guess-item {
  382. width: 100%;
  383. background: green;
  384. border-bottom: 1px solid #EEEEEE;
  385. }
  386. .guess-section .price {
  387. font-size: 34rpx;
  388. color: #FD714F;
  389. }
  390. page {
  391. background: #f5f5f5;
  392. }
  393. .m-t {
  394. margin-top: 16upx;
  395. }
  396. /* 销售信息 */
  397. .introduce-section {
  398. background: #fff;
  399. padding: 20upx 30upx;
  400. padding-bottom: 100upx;
  401. .guess-item {
  402. padding-bottom: 20upx;
  403. border-bottom: 1px solid #ccc;
  404. }
  405. .title {
  406. font-size: 28upx;
  407. color: $font-color-dark;
  408. font-weight: bold;
  409. height: 50upx;
  410. line-height: 50upx;
  411. flex: 2.5;
  412. }
  413. .title-tip {
  414. flex: 1;
  415. }
  416. .price-box {
  417. display: flex;
  418. align-items: baseline;
  419. height: 70upx;
  420. padding: 10upx 0;
  421. font-size: 26upx;
  422. color: $uni-color-primary;
  423. }
  424. .price {
  425. font-size: $font-lg + 2upx;
  426. }
  427. .m-price {
  428. margin: 0 12upx;
  429. color: $font-color-light;
  430. text-decoration: line-through;
  431. }
  432. .coupon-tip {
  433. align-items: center;
  434. padding: 4upx 10upx;
  435. background: $uni-color-primary;
  436. font-size: $font-sm;
  437. color: #fff;
  438. border-radius: 6upx;
  439. line-height: 1;
  440. transform: translateY(-4upx);
  441. }
  442. .bot-row {
  443. display: flex;
  444. align-items: center;
  445. height: 50upx;
  446. font-size: $font-sm;
  447. color: $font-color-light;
  448. view {
  449. flex: 1;
  450. }
  451. }
  452. }
  453. .top-tap {
  454. display: flex;
  455. font-size: 27rpx;
  456. padding: 20rpx 48rpx;
  457. justify-content: space-between;
  458. .top-tap-item {
  459. color: #B2B3BB;
  460. }
  461. .top-tap-item:nth-of-type(1) {
  462. flex: 3;
  463. display: flex;
  464. justify-content: flex-start;
  465. }
  466. .top-tap-item:nth-of-type(2) {
  467. flex: 3;
  468. display: flex;
  469. justify-content: center;
  470. }
  471. .top-tap-item:nth-of-type(3) {
  472. flex: 1;
  473. display: flex;
  474. justify-content: flex-end;
  475. }
  476. }
  477. .flex-item:nth-of-type(1) {
  478. width: 40%;
  479. display: flex;
  480. flex-direction: column;
  481. align-items: flex-start;
  482. }
  483. .flex-item:nth-of-type(2) {
  484. width: 40%;
  485. }
  486. .flex-item:nth-of-type(3) {
  487. width: 20%;
  488. display: flex;
  489. justify-content: flex-end;
  490. }
  491. .guess-list {
  492. width: 100%;
  493. .guess-list-item {
  494. padding: 20rpx 47rpx;
  495. display: flex;
  496. width: 100%;
  497. border-bottom: 1px solid #EEEEEE;
  498. .guess-item-item:nth-of-type(1) {
  499. flex: 3;
  500. display: flex;
  501. justify-content: flex-start;
  502. flex-direction: column;
  503. }
  504. ;
  505. .guess-item-item:nth-of-type(2) {
  506. flex: 3;
  507. display: flex;
  508. justify-content: center;
  509. align-items: center;
  510. }
  511. .guess-item-item:nth-of-type(3) {
  512. flex: 1;
  513. display: flex;
  514. justify-content: flex-end;
  515. align-items: center;
  516. }
  517. }
  518. }
  519. .flex-item{
  520. text-align: center;
  521. }
  522. </style>