123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- <template>
- <view>
- <view>
- <picker @change="locationChange" :value="location" :range="locationType">
- <view class="picker">
- {{location>-1?locationType[location]:'请选择'}}
- </view>
- </picker>
- </view>
- <view class='tag tag-bule radius line-pink'>采购</view>
- <view class='tag tag-bule radius line-pink'>销售</view>
- <view class="cu-bar search bg-white">
- <view class="search-form round" @click="naviageToPage('/pageA/product/lookup?TabCur=')">
- <text style='color: #ccc;' class="cuIcon-search"></text>
- <input type="text" placeholder="请输入货名或标题" confirm-type="search"></input>
- </view>
- </view>
- <view class='tag tag-bule radius line-pink' @click="sousuo">玉米</view>
- <view class='tag tag-bule radius line-pink' @click="sousuo">大豆</view>
- <view class='tag tag-bule radius line-pink' @click="sousuo">小麦</view>
- <view class='tag tag-bule radius line-pink' @click="sousuo">水稻</view>
- <view class='tag tag-bule radius line-pink' @click="sousuo">高粱</view>
- <view class="introduce-section">
- <view v-for="(item, index) in buyInfo" :key="index" class="guess-item" @click="navToDetailPage(item)">
- <view class="price-box">
- <view class="title">{{item.title}}</view>
- <template v-if='item.isFutures==0'>
- <view v-if="item.price !== 0" class="title-tip">
- <text class="price-tip">¥</text>
- <text class="price">{{item.price}}</text>
- <text class="price-tip">元/吨</text>
- </view>
- <view v-else class="title-tip">
- <text>市场价</text>
- </view>
- </template>
- <view class="title-tip" v-if='item.isFutures==1'>
- <text style='color:#828282;margin-bottom:10rpx;display:inline-block;'
- class="price-tip">今日基差</text>
- <view>
- <text class="price-tip">¥</text>
- <text class="price">{{item.basis}}</text>
- <text class="price-tip">元/吨</text>
- </view>
- </view>
- </view>
- <view class='tag tag-bule radius line-pink' v-if='item.isFutures==0'>现货</view>
- <view class='tag tag-bule radius line-pink' v-if='item.isFutures==1'>期货</view>
- <view class='tag tag-green radius line-green'>{{item.goodsName}}</view>
- <view class='tag tag-yellow radius line-yellow'>易粮易运</view>
- </view>
- <view v-show="isLoadMore">
- <uni-load-more :status="loadStatus"></uni-load-more>
- </view>
- </view>
- <u-back-top :scroll-top="scrollTop" tips="顶部" :custom-style="{backgroundColor: '#a0cfff',color: '#2979ff'}"
- :iconStyle="{color: '#2979ff',fontSize: '34rpx'}" mode="square" icon="arrow-up"></u-back-top>
- <drag-button :isDock="true" :existTabBar="true" :isIcon="true" text="发布" location="20" @btnClick="fabu" />
- </view>
- </template>
- <script>
- export default {
- name: "business",
- data() {
- return {
- PageCur: "buy",
- buyInfo: [],
- pages: 1, //页数
- limit: 10, //每次取条目数
- loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- isLoadMore: false, //是否加载中
- showTran: true,
- scrollTop: 0,
- categoryList: [{
- title: '我要买粮',
- id: '0'
- }, {
- title: '我要卖粮',
- id: '1'
- }],
- TabCur: 0,
- current: 1,
- location: 0,
- locationType: ['黑龙江省', '河南省', '山东省', '安徽省', '吉林省', '河北省', '江苏省', '内蒙古自治区', '四川省', '湖南省', '湖北省', '辽宁省',
- '江西省', '云南省', '新疆维吾尔自治区', '山西省', '广西壮族自治区', '陕西省', '广东省', '甘肃省', '重庆市', '贵州省', '浙江省', '福建省',
- '宁夏回族自治区', '天津市', '海南省', '青海省', '西藏自治区', '上海市', '北京市'
- ]
- }
- },
- onShow() {
- uni.showTabBar()
- },
- onLoad(options) {
- console.log("buy onload")
- // #ifdef H5
- this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
- // #endif
- this.cateId = options.tid ? options.tid : 0;
- this.keywords = options.keywords ? options.keywords : ''
- this.loadData();
- },
- onPageScroll(e) {
- this.scrollTop = e.scrollTop;
- },
- //下拉刷新
- onPullDownRefresh() {
- this.pages = 1
- this.isLoadMore = false
- this.loadStatus = 'loading'
- this.loadData()
- },
- onReachBottom() { //上拉触底函数
- if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
- this.isLoadMore = true
- this.pages += 1
- this.getIndexBuyData()
- }
- },
- methods: {
- naviageToPage(page) {
- page = page + this.TabCur
- uni.navigateTo({
- url: page,
- fail() {
- uni.switchTab({
- url: page
- })
- }
- })
- },
- locationChange(e) {
- this.location = e.detail.value
- },
- tabSelect(e) {
- this.TabCur = e.currentTarget.dataset.id;
- this.category = this.TabCur
- this.pages = 1
- this.loadData()
- },
- fabu() {
- uni.navigateTo({
- url: `/pageB/trust/trust`
- })
- },
- //加载商品 ,带下拉刷新和上滑加载
- async loadData(type = 'add', loading) {
- const that = this
- uni.showLoading({
- title: '正在加载',
- mask: true
- })
- var param1 = ''
- var param2 = ''
- if (that.TabCur == 0) {
- param1 = 'integral'
- param2 = 'getIndexData'
- } else {
- param1 = 'buy'
- param2 = 'getBuyListInfo'
- }
- console.log(param1, param2)
- that.$api.request(param1, param2, {
- page: 1,
- limit: 10
- }, failres => {
- that.$api.msg(failres.errmsg)
- that.isLoadMore = false
- that.loadStatus = 'nomore'
- if (that.pages > 1) {
- that.pages -= 1
- }
- uni.hideLoading()
- }).then(res => {
- let data = null
- if (that.TabCur == 0) {
- data = res.data.saleInfo
- } else {
- data = res.data
- }
- uni.stopPullDownRefresh()
- //采购信息
- if (data.length > 0) {
- that.buyInfo = data
- that.isLoadMore = false
- } else {
- if (that.pages > 1) {
- that.pages -= 1
- }
- that.isLoadMore = true
- that.loadStatus = 'nomore'
- }
- uni.hideLoading()
- })
- },
- //详情
- navToDetailPage(item) {
- let id = item.id;
- if (item.price === 0) {
- this.contactUs();
- } else {
- if (this.TabCur == 0) {
- uni.navigateTo({
- url: `/pageA/product/detail?id=${id}`
- })
- } else {
- uni.navigateTo({
- url: `/pageA/product/detail_buy?id=${id}`
- })
- }
- }
- },
- contactUs() {
- const that = this
- uni.makePhoneCall({
- // 手机号
- phoneNumber: '15145408888',
- // 成功回调
- success: (res) => {
- console.log('调用成功!')
- },
- // 失败回调
- fail: (res) => {
- console.log('调用失败!')
- }
- });
- },
- getIndexBuyData() {
- const that = this
- var pages = that.pages
- var limit = that.limit
- uni.showLoading({
- title: '正在加载',
- mask: true
- })
- that.$api.request('buy', 'getBuyListInfo', {
- page: pages,
- limit: limit
- }, failres => {
- that.$api.msg(failres.errmsg)
- that.isLoadMore = false
- that.loadStatus = 'nomore'
- if (that.pages > 1) {
- that.pages -= 1
- }
- uni.hideLoading()
- }).then(res => {
- let data = res.data
- //采购信息
- if (data.length > 0) {
- that.buyInfo = that.buyInfo.concat(data)
- that.isLoadMore = false
- } else {
- if (that.pages > 1) {
- that.pages -= 1
- }
- that.isLoadMore = true
- that.loadStatus = 'nomore'
- }
- uni.hideLoading()
- })
- }
- }
- }
- </script>
- <style>
- page,
- .content {
- // background: $page-color-base;
- }
- .cu-tag.badge {
- right: 26rpx;
- }
- .cu-item {
- height: 80rpx;
- display: inline-block;
- line-height: 80rpx;
- }
- .search-form {
- background: #fff;
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
- }
- .title-tip {
- color: #E63113;
- text-align: right;
- }
- .tag-bule {
- background: #CDE7FB;
- color: #0B4572;
- }
- .tag-green {
- background: #C6F7BC;
- color: #065112;
- }
- .tag-yellow {
- background: #FBF4B1;
- color: #5C4409;
- }
- .tag {
- padding: 5px;
- display: inline-flex;
- font-size: 22rpx;
- margin: 3px;
- }
- .text-white {
- color: #fff;
- }
- .text-white text {
- position: relative;
- z-index: 2;
- background: linear-gradient(45deg, #3DC146, #B2D612);
- padding: 5px 10px;
- border-radius: 38rpx;
- }
- .guess-section {
- padding-bottom: 100upx;
- display: flex;
- flex-wrap: wrap;
- padding: 0 30upx;
- background: #fff;
- .guess-item {
- display: flex;
- flex-direction: column;
- width: 98%;
- border-bottom: 1px solid #ccc;
- }
- .image-wrapper {
- width: 100%;
- height: 330upx;
- border-radius: 3px;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- opacity: 1;
- }
- }
- .title {
- font-size: $font-lg;
- color: #121212;
- }
- .price-orther {
- font-size: $font-sm;
- color: $font-color-base;
- }
- .price {
- font-size: 64rpx;
- color: #39b54a;
- line-height: 1;
- padding-right: 10upx;
- }
- .goods1 {
- font-size: $font-sm;
- color: $font-color-base;
- }
- .goods2 {
- font-size: $font-sm;
- color: $font-color-base;
- padding-left: 10%;
- }
- .goods3 {
- font-size: $font-sm;
- color: $font-color-base;
- padding-left: 10%;
- }
- .goods4 {
- font-size: $font-sm;
- color: #ff5500;
- }
- .goods5 {
- font-size: $font-sm;
- color: $font-color-base;
- }
- .view-item {
- width: 100%;
- // line-height: 40upx;
- padding-top: 10upx;
- }
- .confirm-btn {
- margin-left: 20%;
- }
- .date-time {
- margin-left: 30%;
- }
- .padding-xs-tmp {
- padding: 15upx 10upx 10upx 10upx;
- }
- }
- .navbar {
- position: fixed;
- left: 0;
- top: var(--window-top);
- display: flex;
- width: 100%;
- height: 80upx;
- background: #fff;
- box-shadow: 0 2upx 10upx rgba(0, 0, 0, .06);
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 30upx;
- color: $font-color-dark;
- position: relative;
- &.current {
- color: $base-color;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 120upx;
- height: 0;
- border-bottom: 4upx solid $base-color;
- }
- }
- }
- .p-box {
- display: flex;
- flex-direction: column;
- .yticon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 30upx;
- height: 14upx;
- line-height: 1;
- margin-left: 4upx;
- font-size: 26upx;
- color: #888;
- &.active {
- color: $base-color;
- }
- }
- .xia {
- transform: scaleY(-1);
- }
- }
- .cate-item {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- width: 80upx;
- position: relative;
- font-size: 44upx;
- &:after {
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- border-left: 1px solid #ddd;
- width: 0;
- height: 36upx;
- }
- }
- }
- /* 分类 */
- .cate-mask {
- position: fixed;
- left: 0;
- top: var(--window-top);
- bottom: 0;
- width: 100%;
- background: rgba(0, 0, 0, 0);
- z-index: 95;
- transition: .3s;
- .cate-content {
- width: 630upx;
- height: 100%;
- background: #fff;
- float: right;
- transform: translateX(100%);
- transition: .3s;
- }
- &.none {
- display: none;
- }
- &.show {
- background: rgba(0, 0, 0, .4);
- .cate-content {
- transform: translateX(0);
- }
- }
- }
- .cate-list {
- display: flex;
- flex-direction: column;
- height: 100%;
- .cate-item {
- display: flex;
- align-items: center;
- height: 90upx;
- padding-left: 30upx;
- font-size: 28upx;
- color: #555;
- position: relative;
- }
- .two {
- height: 64upx;
- color: #303133;
- font-size: 30upx;
- background: #f8f8f8;
- }
- .active {
- color: $base-color;
- }
- }
- /* 销售信息 */
- .introduce-section {
- background: #fff;
- padding: 20upx 30upx;
- padding-bottom: 100upx;
- .guess-item {
- padding-bottom: 20upx;
- border-bottom: 1px solid #ccc;
- }
- .title {
- font-size: 28upx;
- color: $font-color-dark;
- font-weight: bold;
- height: 50upx;
- line-height: 50upx;
- flex: 2.5;
- }
- .title-tip {
- flex: 1;
- }
- .price-box {
- display: flex;
- align-items: baseline;
- height: 70upx;
- padding: 10upx 0;
- font-size: 26upx;
- color: $uni-color-primary;
- }
- .price {
- font-size: $font-lg + 2upx;
- }
- .m-price {
- margin: 0 12upx;
- color: $font-color-light;
- text-decoration: line-through;
- }
- .coupon-tip {
- align-items: center;
- padding: 4upx 10upx;
- background: $uni-color-primary;
- font-size: $font-sm;
- color: #fff;
- border-radius: 6upx;
- line-height: 1;
- transform: translateY(-4upx);
- }
- .bot-row {
- display: flex;
- align-items: center;
- height: 50upx;
- font-size: $font-sm;
- color: $font-color-light;
- view {
- flex: 1;
- }
- }
- }
- </style>
|