【前端】云工厂的纸掌柜app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
6.8 KiB

<template>
<view class="my-offer">
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="">
<view class="my-offer-title">我的报价</view>
<view slot="left"></view>
<view slot="right"></view>
</uni-nav-bar>
</view>
<scroll-list style="touch-action: none" ref="orderRef" :option="orderOption" @load="orderUp" @refresh="orderDown">
<view v-for="(items, index) in orderData" :key="index" @click="myPriceInfo(items)">
<view class="list-border list-title-line">
<text class="list-title">{{ items.belongEnterpriseName }}</text>
<text class="list-title-Subtitle" :style="{ color: controlItems[items.replyStatus] == '已过期' ? '#888888' : '#FF5368' }">
{{ controlItems[items.replyStatus] }}
</text>
</view>
<view class="list-border list-info-line" v-for="(item, index) in items.itemList" :key="index">
<view class="list-info" :class="index === items.itemList.length ? 'list-border' : ''">
<view><image class="list-image" :src="item.productImg || '../../static/logo.png'"></image></view>
<view class="list-info-content">
<view class="list-info-title">{{ item.brandName }}{{ item.categoryName }}</view>
<view class="list-info-text">
<text>{{ item.categoryName }}/{{ item.brandName }}/</text>
<text>{{ item.gramWeight }}g/{{ item.width }}*{{ item.length }}/{{ item.quantity }}</text>
</view>
</view>
</view>
</view>
<view class="list-border list-bottom-content">
<view>
<text class="list-time">{{ transformTime(items.replyTime) }}</text>
</view>
<view>
<text class="list-title-Subtitle">¥{{ items.totalPrice }}</text>
</view>
</view>
<uGap></uGap>
</view>
</scroll-list>
</view>
</template>
<script>
import { back, go2 } from '@/utils/hook.js'
import uGap from '@/components/u-gap/u-gap.vue'
import { getMyReplyList } from '@/apis/trade.js'
import { difTime } from '@/utils/index'
export default {
components: {
uGap
},
data() {
return {
orderPagination: {
pageNum: 0, // 初始会执行一次下拉加载
pageSize: 10
},
orderData: [],
controlCurrent: 0,
controlItems: {
30128: '待报价',
30130: '已报价',
30139: '已下单',
30102: '已过期'
},
orderOption: {
size: 10,
auto: true,
emptyText: '暂无报价信息~',
background: '#F7F8FA',
fontSize: '40rpx'
},
orderParams: {
cooperationState: 0,
latitude: 23.12616,
longitude: 113.38466,
km: 5
}
}
},
watch: {
orderParams: {
handler(val) {
this.getMyReplyListQuery()
},
deep: true
}
},
onLoad(option) {
if (option) {
option.latitude && (this.params.latitude = option.latitude)
option.longitude && (this.params.longitude = option.longitude)
option.km && (this.params.km = option.km)
}
this.getMyReplyListQuery()
},
methods: {
transformTime(time) {
if (!time) {
return '-'
}
const { day, hours, minutes, seconds } = difTime(new Date(), time)
if (day > 0) {
return `${day}天前`
}
if (hours > 0) {
return `${hours}小时前`
}
if (minutes > 0) {
return `${minutes}分钟前`
}
return `${seconds}秒前`
},
back,
// 获取我的报价
getMyReplyListQuery() {
return new Promise((resolve, reject) => {
getMyReplyList({ ...this.orderPagination })
.then((res) => {
if (res) {
if (this.orderPagination.pageNum == 1) {
this.orderData = res.records
} else {
this.orderData = this.orderData.concat(res.records)
}
resolve({ list: this.orderData, total: res.total })
}
})
.catch((err) => {
reject(err)
})
})
},
//订单分页
orderUp(page) {
this.orderPagination.pageNum++
this.getMyReplyListQuery()
.then(({ list, total }) => {
this.$refs.orderRef.loadSuccess({ list, total })
})
.catch(() => {
this.$refs.orderRef.loadFail()
})
},
//订单分页
orderDown() {
this.orderPagination.pageNum = 1
this.getMyReplyListQuery()
.then(({ list, total }) => {
this.$refs.orderRef.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.orderRef.refreshFail()
})
},
//跳转我的报价详情
myPriceInfo(item) {
go2('quotation-details', item)
}
}
}
</script>
<style lang="scss">
.my-offer {
margin-bottom: 0rpx;
.list-border {
// border-top: 1px solid rgba(221,221,221,0.5);
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
}
.list-title-line {
line-height: 88rpx;
padding-left: 48rpx;
background: #ffffff;
}
.my-offer-title {
width: 100%;
font-family: PingFangSC-Medium;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.list-title {
font-family: PingFangSC-Semibold;
font-size: 30rpx;
color: #000000;
letter-spacing: 0;
font-weight: 600;
}
.list-title-Subtitle {
font-family: PingFangSC-Medium;
font-size: 30rpx;
color: #ff5368;
letter-spacing: 0;
text-align: right;
font-weight: 500;
float: right;
margin-right: 32rpx;
}
.list-info-line {
padding-left: 48rpx;
line-height: 70rpx;
background: #ffffff;
}
.list-info-content {
margin-left: 48rpx;
}
.list-info-title {
font-family: PingFangSC-Medium;
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
text-align: left;
font-weight: 550;
}
.list-info-text {
font-family: PingFangSC-Regular;
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
text-align: left;
line-height: 64rpx;
font-weight: 400;
}
.list-image {
width: 100rpx;
height: 100rpx;
margin-top: 20rpx;
}
.list-info {
display: flex;
}
.list-bottom-content {
align-items: center;
padding-left: 48rpx;
height: 80rpx;
background: #ffffff;
display: flex;
justify-content: space-between;
}
.list-time {
font-family: PingFangSC-Regular;
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
line-height: 64rpx;
font-weight: 400;
}
}
</style>