123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- <template>
- <view>
- <view class="guess-section">
- <view class="cu-card article no-card Regular" style='width: 100%;'>
- <view class="top-tap Regular">
- <view class="top-tap-item">港口</view>
- <view class="top-tap-item">价格</view>
- <view class="top-tap-item">较昨日</view>
- </view>
- </view>
- <view class="guess-list">
- <view v-for="(item, index) in newsInfo" :key="index" class="guess-item">
- <view class="cu-card article no-card">
- <view class="cu-item shadow factoryItem justify-between align-center" style="display:flex;">
- <view class="flex-item">
- <view class='factory Regular'>{{item.port}}</view>
- <view class='wrap Regular'>{{item.goodsName}}</view>
- </view>
- <view class="flex-item">
- <view class='price NumberBold'>{{item.price}}</view>
- <view class='wrap Regular'>
- <text style='margin-right:5px;'>
- <image style='width:11px;height:11px;'
- src='../../static/img/homepage/water@3x.png'>
- </image>
- <={{item.waterContent}}</text>
- <text>
- <image style='width:11px;height:11px;'
- src='../../static/img/homepage/unitweight@3x.png'></image>
- >={{item.bulkDensity}}
- </text>
- </view>
- </view>
- <view class='flex-item positive NumberBold' v-if='item.comparePrice>0'>
- <image class='up' src='../../static/img/homepage/shangsheng.png'>{{item.comparePrice}}
- </image>
- </view>
- <view class='flex-item negative NumberBold' v-if='item.comparePrice<0'>
- <image class='down' src='../../static/img/homepage/xiajiang.png'>{{-item.comparePrice}}
- </image>
- </view>
- <view class="flex-item Regular" v-if='item.comparePrice==0'>-</view>
- </view>
- </view>
- </view>
- </view>
- <view v-show="isLoadMore">
- <uni-load-more :status="loadStatus"></uni-load-more>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- name: "sale",
- data() {
- return {
- titleNViewBackground: '',
- swiperCurrent: 0,
- swiperLength: 0,
- carouselList: [],
- windowSpuList: [],
- categoryPickList: [],
- categoryButtomList: [],
- salesTop: [],
- saleInfo: [],
- portInfo: [],
- banner: undefined,
- isVip: false,
- pages: 1, //页数
- limit: 10, //每次取条目数
- loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- isLoadMore: false, //是否加载中
- showTran: true,
- list: [],
- scrollTop: 0,
- cardCur: 0,
- dotStyle: false,
- newsInfo: [],
- categoryList: [],
- pages: 1, //页数
- limit: 10, //每次取条目数
- loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- TabCur: 0,
- category: 0,
- current: 0,
- infoList1: []
- };
- },
- onReady() {},
- onShow() {
- uni.showTabBar()
- this.pages = 1
- this.isLoadMore = false
- this.loadStatus = 'more'
- this.loadData()
- },
- onLoad(options) {
- var that = this
- var infoList = [];
- // uni.request({
- // url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
- // // url: "https://hq.sinajs.cn/list=C2109",
- // header: {
- // 'content-type': 'application/x-www-form-urlencoded'
- // },
- // success: function(result) {
- // // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
- // var tmp = result.data.split('"')
- // for (var i = 1; i < tmp.length; i = i + 2) {
- // var list = tmp[i].split(",")
- // var data = {
- // goodsName: list[0],
- // newPrice: list[6],
- // openPrice: list[2]
- // }
- // if (data.goodsName) {
- // infoList.push(data)
- // }
- // }
- // let name = 'infoList';
- // let value = infoList;
- // that.$store.commit('$uStore', {
- // name,
- // value
- // });
- // // console.log("infoList",infoList)
- // },
- // fail: function(e) {
- // console.log('error in...')
- // // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
- // reject(e)
- // },
- // })
- },
- onPageScroll(e) {
- this.scrollTop = e.scrollTop;
- },
- onReachBottom() { //上拉触底函数
- if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
- this.isLoadMore = true
- this.pages += 1
- this.getIndexSaleData()
- }
- },
- onPullDownRefresh() {
- this.pages = 1
- this.isLoadMore = false
- this.loadStatus = 'loading'
- this.loadData()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- methods: {
- async loadData() {
- var that = this
- // 新闻内容
- that.$api.request('news', 'getPortPriceInfo', {
- category: this.category,
- page: this.pages,
- limit: this.limit
- }, failres => {
- that.$api.msg(failres.errmsg)
- this.isLoadMore = false
- this.loadStatus = 'nomore'
- if (this.pages > 1) {
- this.pages = 1
- }
- uni.hideLoading()
- }).then(res => {
- let data = res.data
- that.newsInfo = data
- uni.hideLoading()
- })
-
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .price {
- color: #FD714F;
- }
- .container {
- margin: 10rpx 10rpx 10rpx 10rpx;
- }
- .cu-tag.badge {
- right: 26rpx;
- }
- .up,
- .down {
- width: 7.5px;
- height: 9px;
- position: relative;
- vertical-align: middle;
- margin-right: 2px;
- margin-top: 5px;
- }
- .gird-left,
- .gird-right {}
- .cu-tag.radius[class*="line"]::after {
- border-radius: 66rpx;
- }
- .goTop {
- height: 32px;
- width: 32px;
- position: fixed;
- bottom: 200rpx;
- right: 30rpx;
- border-radius: 50%;
- }
- .goTop image {
- width: 32px;
- height: 32px;
- }
- .flex {
- display: flex;
- }
- .text-white {
- color: #fff;
- }
- .cu-card {
- border-bottom: 1rpx solid #f8f8f8;
- text-align: center;
- }
- .factory {
- font-size: 28rpx;
- }
- .positive {
- color: #FD714F;
- font-size: 28rpx;
- }
- .negative {
- color: #22C572;
- font-size: 28rpx;
- }
- .wrap {
- font-size: 20rpx;
- color: rgba(0, 0, 0, 0.5);
- }
- .align-center {
- align-items: center;
- }
- .flex-direction-row {
- flex-direction: row;
- }
- .factoryItem {
- padding: 20rpx 0;
- }
- /* #ifdef MP */
- .mp-search-box {
- // position:relative;
- left: 0;
- top: 30upx;
- z-index: 9999;
- width: 100%;
- padding: 0 80upx;
- background: rgba(255, 170, 0, 0.6);
- .ser-input {
- flex: 1;
- height: 56upx;
- line-height: 56upx;
- text-align: center;
- font-size: 28upx;
- color: $font-color-base;
- border-radius: 10px;
- background: rgba(255, 255, 255, .6);
- }
- }
- .desc {
- width: 73%;
- margin-right: 2%;
- }
- .justify-between {
- justify-content: space-between;
- }
- page {
- .cate-section {
- position: relative;
- z-index: 5;
- border-radius: 16upx 16upx 0 0;
- margin-top: -20upx;
- }
- .carousel-section {
- padding: 0;
- .titleNview-placing {
- padding-top: 0;
- height: 0;
- }
- .carousel {
- .carousel-item {
- padding: 0;
- }
- }
- .swiper-dots {
- left: 50%;
- bottom: 5upx;
- transform: translateX(-50%);
- }
- }
- }
- /* #endif */
- .cuIcon-notification::before {
- color: #f37b1;
- }
- .cu-card.article>.cu-item .content>image {
- height: 3.4em;
- margin-right: 0rpx;
- margin-top: 24rpx;
- }
- .screen-swiper.price-swiper {
- height: 70rpx;
- min-height: 70rpx;
- background: #fff;
- margin-bottom: 10px;
- }
- .swiper-item {
- border-radius: 5%;
- }
- .guess-section {
- margin-bottom: 120rpx;
- margin-top: 20rpx;
- padding: 0;
- .guess-item {
- width: 100%;
- padding: 0 48rpx;
- border-bottom: 1px solid #EEEEEE;
- }
- }
- .guess-section .price {
- color: #FD714F;
- font-size: 34rpx;
- font-weight: 600;
- }
- page {
- background: #f5f5f5;
- }
- .m-t {
- margin-top: 16upx;
- }
- .top-tap {
- display: flex;
- font-size: 27rpx;
- padding: 20rpx 48rpx;
- justify-content: space-between;
- .top-tap-item {
- color: #B2B3BB;
- }
- .top-tap-item:nth-of-type(1) {
- width: 40%;
- display: flex;
- justify-content: flex-start;
- }
- ;
- .top-tap-item:nth-of-type(2) {
- width: 40%;
- display: flex;
- justify-content: center;
- }
- ;
- .top-tap-item:nth-of-type(3) {
- width: 20%;
- display: flex;
- justify-content: flex-end;
- }
- }
- .flex-item:nth-of-type(1) {
- width: 40%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- }
- .flex-item:nth-of-type(2) {
- width: 40%;
- }
- .flex-item:nth-of-type(3) {
- width: 20%;
- display: flex;
- justify-content: flex-end;
- }
- .guess-list {
- width: 100%;
- }
- </style>
|