【前端】纸掌柜h5端
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.

325 lines
8.2 KiB

<template>
<view class="warpper">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="询价列表"></uni-nav-bar>
<view class="">
<view class="status-bar">
<view v-for="(item, index) in statusBarArray" :key="index" :class="{ box: true, 'box--selected': current == index }" @click="selectStatus(item, index)">
{{ item }}
</view>
</view>
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback" style="background-color: #ffffff">
<view class="content" v-for="(item, index) in list" :key="index">
<uGap v-if="index > 0"></uGap>
<view class="header">
<view class="header-title">{{ item.belongEnterpriseName }}</view>
<view class="header-value">
<text :class="item.status == 30131 || item.status == 30138 ? 'failure' : ''">{{ item.status | statusName }}</text>
</view>
</view>
<view class="box" v-if="item.status != 30116 || item.status != 30131">
<view class="list-box" v-for="(sitem, sindex) in item.itemList" :key="sindex">
<image class="image" :src="sitem.productImg || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/ztb_pic/testPic.jfif'" mode=""></image>
<view class="info-box">
<view class="name">{{ sitem.brandName }}</view>
<view class="value">
{{ sitem.categoryName }}/{{ sitem.paperName }}/{{ sitem.gramWeight }}g/{{ sitem.width }}*{{ sitem.length }}/{{ sitem.quantity }}张
</view>
</view>
</view>
</view>
<view class="box" v-else>
<view class="list-box" v-for="(sitem, sindex) in item.reply.replyItemList" :key="sindex">
<image class="image" :src="sitem.productImg || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/ztb_pic/testPic.jfif'" mode=""></image>
<view class="info-box">
<view class="name">{{ sitem.brandName }}</view>
<view class="value">
{{ sitem.categoryName }}/{{ sitem.paperName }}/{{ sitem.gramWeight }}g/{{ sitem.width }}*{{ sitem.length }}/{{ sitem.quantity }}
</view>
</view>
</view>
</view>
<view class="other" v-if="item.status == 30116 || item.status == 30131">
<view class="left">{{ item.createTime }}</view>
<view class="right">
<view class="">
<text class="price" v-if="item.reply">¥ {{ item.reply.totalPrice }}</text>
</view>
<view class="btn" @tap="placeOrderTap(item,item.reply.replyItemList)" v-if="item.status == 30116">去下单</view>
</view>
</view>
</view>
</scroll-list>
</view>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import uGap from '@/components/u-gap/u-gap.vue'
import { getEnquiryOrder, createByEnquiry } from '@/apis/enquiryListApi.js'
export default {
components: { uGap },
data() {
return {
current: 0,
statusBarArray: ['全部', '待报价', '已报价', '已成交'],
option: {
size: 10,
auto: true,
emptyText: '暂无数据~',
background: '#F7F8FA',
disabled: false,
emptyImage: '/static/imgs/order/order-empty.png'
},
pagination: {
status: 0,
pageNum: 0, // 初始会执行一次下拉加载
pageSize: 10
},
list: []
}
},
filters: {
statusName(e) {
let name = ''
switch (e) {
case 30114:
name = '待报价'
break
case 30116:
name = '已报价'
break
case 30131:
name = '已成交'
break
case 30138:
name = '已失效'
break
default:
break
}
return name
}
},
onShow() {
// this.getList()
},
methods: {
go2,
back,
selectStatus(item, index) {
this.current = index
this.pagination.status = index
this.downCallback()
},
getList() {
return new Promise((resolve, reject) => {
getEnquiryOrder({ ...this.pagination })
.then(res => {
// console.log('询价列表', res.records)
if (res) {
if (this.pagination.pageNum == 1) {
this.list = res.records
} else {
this.list = this.list.concat(res.records)
}
resolve({ list: this.list, total: res.total })
} else {
reject()
}
})
.catch(err => {
reject(err)
})
})
},
downCallback() {
this.pagination.pageNum = 1
this.getList()
.then(({ list, total }) => {
this.$refs.list.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.list.refreshFail()
})
},
upCallback() {
this.pagination.pageNum++
this.getList()
.then(({ list, total }) => {
this.$refs.list.loadSuccess({ list, total })
})
.catch(() => {
this.$refs.list.loadFail()
})
},
// 确认下单
placeOrderTap(item, replyItemList) {
console.log('replyItemList', replyItemList)
const params = {
enquiryId: item.id,
orderGoodsList: replyItemList,
purchaserEnterpriseId: this.$store.state.companyInfo.id,
userId: this.$store.state.userInfo.userId,
// purchaserEnterpriseId: '677166943471538176',
// userId: '573244119569272832',
}
createByEnquiry(params).then(res => {
if (res) {
uni.showToast({
title: '下单成功',
icon: 'success'
})
setTimeout(() => {
go2('order-make', { orderId: item.orderId })
}, 500)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.warpper {
display: flex;
flex-direction: column;
flex: 1;
height: 100vh;
.status-bar {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
// border-bottom: 2rpx solid #DDDDDD;
background-color: #fff;
border-bottom: 2rpx solid rgba($color: #dddddd, $alpha: 0.8);
height: 90rpx;
.box {
height: 86rpx;
flex-grow: 0;
flex-shrink: 0;
color: #000000;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
// border-bottom: 4rpx solid #f8f8f8;
}
.box--selected {
border-bottom: 4rpx solid #007aff;
color: #007aff;
}
}
.content {
.header {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 88rpx;
background: #ffffff;
padding: 0rpx 32rpx;
border-bottom: 2rpx solid #dddddd;
.header-title {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 500;
}
.header-value {
font-size: 30rpx;
color: #ff5368;
letter-spacing: 0;
text-align: right;
font-weight: 500;
.failure {
color: #888888;
}
}
}
.box {
padding: 24rpx 32rpx;
.list-box:nth-last-child(even) {
border-bottom: 2rpx solid #dddddd;
}
.list-box {
display: flex;
flex-direction: row;
height: 148rpx;
background: #ffffff;
padding: 24rpx 0rpx;
.image {
width: 100rpx;
height: 100rpx;
flex: 0 0 100rpx;
margin-right: 20rpx;
}
.info-box {
.name {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
text-align: left;
font-weight: 400;
padding-top: 4rpx;
}
.value {
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
text-align: left;
font-weight: 400;
padding-top: 26rpx;
}
}
}
}
.other {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 80rpx;
background: #ffffff;
border-top: 2rpx solid #dddddd;
.left {
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
text-align: left;
font-weight: 400;
}
.right {
display: flex;
align-items: center;
.price {
font-size: 30rpx;
color: #ff5368;
letter-spacing: 0;
text-align: right;
font-weight: 500;
}
.btn {
margin-left: 24rpx;
width: 132rpx;
height: 54rpx;
line-height: 54rpx;
background: #007aff;
border-radius: 27rpx;
font-size: 28rpx;
color: #ffffff;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
}
}
}
}
</style>