Files
jjx-wap-sign-only/pages/user/buyer.vue
T
2026-10-08 18:36:23 +08:00

741 lines
26 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template> <!-- 买家中心 -->
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uititle title="买家中心"></uititle>
<!-- 选项卡 -->
<view class="layout layout-tab flex justify-between align-center">
<view :class="['tab', {active: menuIndex === 1}]" @click="handTab(1)">询价单</view>
<view :class="['tab', {active: menuIndex === 0}]" @click="handTab(0)">加工单</view>
<view :class="['tab', {active: menuIndex === 3}]" @click="handTab(3)">旧货</view>
<view :class="['tab', {active: menuIndex === 2}]" @click="handTab(2)">自营询价</view>
</view>
<!-- 统计数量和操作按钮 -->
<view class="layout layout-total bg-white">
<view class="tp-box flex justify-center align-center" v-if="menuIndex !== 2">
<view :class="['tp flex-1 text-center', {active: activeName === 'all'}]"
@click="changeStatus('all')">全部
</view>
<view :class="['tp flex-1 text-center', {active: activeName === 'noQuote'}]"
@click="changeStatus('noQuote')">
待报价
</view>
<view :class="['tp flex-1 text-center', {active: activeName === 'notPick'}]"
@click="changeStatus('notPick')">
待选商
</view>
<view :class="['tp flex-1 text-center', {active: activeName === 'picked'}]"
@click="changeStatus('picked')">
已成交
</view>
</view>
<!-- <view class="search-box flex justify-between m-top-30">-->
<!-- <view class="date" @click="isCalendar = true">-->
<!-- <u&#45;&#45;input-->
<!-- placeholder="日期"-->
<!-- v-model="calendarValue"-->
<!-- suffixIcon="calendar"-->
<!-- prefixIconStyle="font-size: 32px;color: #909399"-->
<!-- :customStyle="inputClass"-->
<!-- :disabled="true"-->
<!-- disabledColor="#fff"-->
<!-- ></u&#45;&#45;input>-->
<!-- </view>-->
<!-- <view style="width: 30rpx;"></view>-->
<!-- <u&#45;&#45;input-->
<!-- placeholder="搜索编号或品名"-->
<!-- suffixIcon="search"-->
<!-- prefixIconStyle="font-size: 32px;color: #909399"-->
<!-- :customStyle="inputClass"-->
<!-- ></u&#45;&#45;input>-->
<!-- </view>-->
</view>
</u-sticky>
<!-- 列表 -->
<view class="layout layout-list">
<template v-if="menuIndex === 0">
<view class="item" v-for="(item, index) in processList" :key="index">
<view class="hava flex justify-start">
<view class="ing">{{ item.status === 0 ? '发布中' : '已选商' }}</view>
<view class="ed m-left-10">{{ item.title }}</view>
</view>
<view class="flex justify-between items-center w-100p">
<view class="text-main text-25 p-10">{{
item.signMethod === 1 ? '线下签单' : '线上签约'
}}
</view>
<view class="flex justify-start m-top-10" v-if="item.status === 1 && item.signMethod === 1">
<view class="bao bao-2 m-left-10" @click="processChangeToOnlineSign(item._id, index)">
切换线上交易
</view>
</view>
<view @click="showProcessModal(item)">
<u-text size="small" type="primary" :text="`收到${ item.quoteNum }个报价`"/>
</view>
</view>
<view class="text red m-top-10 font-bold">
加工量:{{ item.num }}
</view>
<view class="text date m-top-10">
<text class="m-right-20">交易编码:{{ item.orderNo }}</text>
<text>{{ item._add_time_str }}发布</text>
</view>
<!-- 按钮 -->
<!-- <text @click="showProcessModal(item)">收到{{ item.quoteNum }}个报价</text>-->
<!-- <view class="op-btn btn-2 btnredplain">编辑报价</view>-->
<!-- 章 -->
<view class="zhang">
<image class="full" src="/static/img/unchoose.png" mode="" v-if="item.status === 0"></image>
<image class="full" src="/static/img/choose.png" mode="" v-else></image>
</view>
<view class="flex justify-end items-center mt-10">
<view class="mr-10">
<u-button size="mini" type="success"
v-if="item.status !== 0 && item.signMethod !== 1 && item.contract"
@click.native="$jump(`/pages/public/contract?tab=${item.contract ? (item.contract.status === 1 ? 1 : (item.contract.status === 2 ) ? 2 : 0) : 0}`)"
>
{{
item.contract ? (item.contract.status === 1 ? '去签署合同' : (item.contract.status === 0) ? '去创建合同' : '查看合同')
: '去创建合同'
}}
</u-button>
</view>
<view class="mr-10" v-if="item.status === 0">
<u-button size="mini" type="error"
@click.native="showProcessModal(item)"
>查看意向合作列表
</u-button>
</view>
<view v-else>
<u-button size="mini" type="success" plain
@click.native="showOtherUser(item)"
>查看交易方
</u-button>
</view>
</view>
</view>
</template>
<template v-if="menuIndex === 1">
<view class="item" v-for="(item, index) in enquiryList" :key="index">
<view class="hava flex justify-start">
<view class="ing">{{ item.status === 0 ? '发布中' : '已选商' }}</view>
<view class="ed m-left-10">{{ item.title }}</view>
</view>
<view class="flex justify-between items-center w-100p">
<view class="text-main text-25 p-10">{{
item.signMethod === 1 ? '线下签单' : '线上签约'
}}
</view>
<view class="flex justify-start m-top-10" v-if="item.status === 1 && item.signMethod === 1">
<view class="bao bao-2 m-left-10" @click="enquiryChangeToOnlineSign(item._id, index)">
切换线上交易
</view>
</view>
<view @click="showEnquiryModal(item)">
<u-text size="small" type="primary" :text="`收到${ item.quoteNum }个报价`"/>
</view>
</view>
<view class="text red m-top-10">
{{ item.productNum }} | {{ item.fullAddress }}
</view>
<view class="text date m-top-10">
<text class="m-right-20">交易编码:{{ item.enquiryNo }}</text>
<text>{{ item._add_time_str }}更新</text>
</view>
<!-- 按钮 -->
<!-- <view class="op-btn btn-2 btnredplain">编辑报价</view>-->
<!-- 章 -->
<view class="zhang">
<image class="full" src="/static/img/unchoose.png" mode="" v-if="item.status === 0"></image>
<image class="full" src="/static/img/choose.png" mode="" v-else></image>
</view>
<view class="flex justify-end items-center mt-15">
<view class="mr-15" v-if="item.status === 1 && item.signMethod !== 1">
<u-button size="mini" type="success"
@click.native="$jump(`/pages/public/contract?tab=${item.contract ? (item.contract.status === 1 ? 1 : (item.contract.status === 2 ) ? 2 : 0) : 0}`)">
{{
item.contract ? (item.contract.status === 1 ? '去签署合同' : (item.contract.status === 0) ? '去创建合同' : '查看合同')
: '去创建合同'
}}
</u-button>
</view>
<view class="mr-15" v-if="item.status === 2 && parseInt(item.tradeMethod) === 1">
<u-button size="mini" type="success" plain
@click.native="$jump('/pages/shop/order')">去订单
</u-button>
</view>
<view class="mr-15" v-if="item.status === 0">
<u-button size="mini" type="error"
@click.native="showEnquiryModal(item)"
>查看意向合作列表
</u-button>
</view>
<view v-else>
<u-button size="mini" type="success" plain
@click.native="showOtherUser(item)">查看交易方
</u-button>
</view>
</view>
</view>
</template>
<template v-if="menuIndex === 2">
<view class="item" v-for="(item, index) in selfSupportList.rows" :key="index">
<view class="hava flex justify-start">
<view class="ing">{{
item.status === 0 ? '待报价' : (item.status === 1 ? '待选商' : '已选商')
}}
</view>
<view class="ed m-left-10">询价地址</view>
</view>
<view class="text red m-top-10">
{{ item.province.name }}{{ item.city.name }}
</view>
<view class="text date m-top-10">
<text>{{ item._add_time_str }}更新</text>
</view>
<view class="zhang" style="top: 40%">
<image class="full" src="/static/img/unchoose.png" mode="" v-if="item.status === 1"></image>
<image class="full" src="/static/img/choose.png" mode="" v-if="item.status === 2"></image>
</view>
<view class="flex justify-end items-center mt-15">
<view class="mr-15" v-if="item.status !== 0 && item.signMethod !== 1 && item.contract">
<u-button size="mini" type="success"
@click.native="$jump(`/pages/public/contract?tab=${item.contract ? (item.contract.status === 1 ? 1 : (item.contract.status === 2 ) ? 2 : 0) : 0}`)">
{{
item.contract ? (item.contract.status === 1 ? '去签署合同' : (item.contract.status === 0) ? '去创建合同' : '查看合同')
: '去创建合同'
}}
</u-button>
</view>
<view class="mr-15">
<u-button size="mini" plain
@click.native="showDetail(item)">查看详情
</u-button>
</view>
<view>
<u-button size="mini" type="success" plain v-if="item.status === 2"
@click.native="showOtherUser(item)">查看交易方
</u-button>
</view>
</view>
</view>
</template>
<template v-if="menuIndex === 3">
<view class="item" v-for="(item, index) in oldList" :key="index">
<view class="hava flex justify-start">
<view class="ing">{{ item.status === 0 ? '发布中' : '已选商' }}</view>
<view class="ed m-left-10">{{ item.title }}</view>
</view>
<view class="text-main text-25 p-10">{{ item.signMethod === 1 ? '线下签单' : '线上签约' }}</view>
<view class="flex justify-start m-top-10" v-if="item.status === 1 && item.signMethod === 1">
<view class="bao bao-2 m-left-10" @click="oldChangeToOnlineSign(item._id, index)">切换线上交易
</view>
</view>
<view class="text red m-top-10">
{{ item.typeStr }} | {{
(item.addressRegion && item.addressRegion.province) ? `${item.addressRegion.province.name}${item.addressRegion.city.name}${item.addressRegion.area.name}${item.addressDetail}` : ''
}}
</view>
<view class="text date m-top-10 flex flex-col justify-start items-start">
<text class="m-right-20">交易编码:{{ item._id }}</text>
<text>{{ item._add_time_str }}发布</text>
</view>
<view class="flex justify-end items-center">
<view class="mr-15"
v-if="item.status !== 0 && item.signMethod !== 1 && item.contract && item.contract.status === 1">
<u-button size="mini" type="success"
@click.native="$jump('/pages/public/contract?tab=1')">
签署合同
</u-button>
</view>
<view class="mr-15"
v-if="item.status !== 0 && item.signMethod !== 1 && item.contract && item.contract.status === 2">
<u-button size="mini" type="success"
@click.native="$jump('/pages/public/contract?tab=2')">
查看合同
</u-button>
</view>
<view class="mr-15"
v-if="item.status !== 0 && item.signMethod !== 1 && (!item.contract || item.contract.status === 0)">
<u-button size="mini" type="success"
@click.native="$jump('/pages/public/contract?tab=0')">
合同待创建
</u-button>
</view>
<view class="mr-15">
<u-button size="mini" type="success" plain
@click.native="showOtherUser(item)">查看交易方
</u-button>
</view>
</view>
</view>
</template>
</view>
<u-calendar
:show="isCalendar"
mode="single"
@confirm="handCalendarConfirm"
@close="isCalendar = false"
></u-calendar>
<enquiry-modal ref="enquiryModal"/>
<process-modal ref="processModal"/>
<self-support-modal ref="selfSupportModal"/>
<contact-modal ref="contactModal"/>
</view>
</template>
<script>
import uititle from '@/components/common/title'
import cmsearch from '@/components/common/search'
import cmempty from '@/components/common/empty'
import EnquiryModal from "./components/enquiryModal.vue";
import ProcessModal from "./components/processModal.vue";
import EnquiryData from "./components/enquiryData.vue";
import SelfSupportModal from "./components/selfSupportModal.vue";
import ContactModal from "@/components/ContactModal.vue";
const d = new Date()
const year = d.getFullYear()
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
const date = d.getDate()
export default {
components: {
ContactModal,
uititle,
cmsearch,
cmempty,
EnquiryData,
ProcessModal,
EnquiryModal,
SelfSupportModal,
},
data() {
return {
defaultDate: '${year}-${month}-${date}',
isCalendar: false,
calendarValue: '',
inputClass: {
height: '20px',
borderRadius: 0,
},
tpIndex: 0,
activeName: 'all',
value: '',
value1: '',
options: [{
value: '金久信自营',
label: '金久信自营'
}],
menuIndex: 1,
formData: {
status: 0,
tradeMethod: null
},
tableData: {},
pageSize: 10,
enquiryList: [],
processList: [],
selfSupportList: {},
total: 0,
notPickNum: 0,
pickedNum: 0,
noQuoteNum: 0,
allNum: 0,
userInfo: null,
oldList: []
}
},
methods: {
handTab(index) {
this.menuIndex = index
this.handleCurrentChange(1)
},
handTp(index) {
this.tpIndex = index
},
handCalendarConfirm(e) {
this.calendarValue = e[0]
this.isCalendar = false
},
handCreate() {
vk.navigateTo('/pages/public/create')
},
menuSelect(e) {
this.menuIndex = parseInt(e)
this.formData.status = parseInt(e)
this.handleCurrentChange(1)
},
handleCurrentChange(page) {
if (this.menuIndex === 1) this.getEnquiryList(page)
else if (this.menuIndex === 0) this.getProcessList(page)
else if (this.menuIndex === 2) this.getSelfSupportList(page)
else if (this.menuIndex === 3) this.getOldList(page)
},
changeStatus(status) {
this.activeName = status
if (this.menuIndex === 1) this.getEnquiryList(1)
else if (this.menuIndex === 0) this.getProcessList(1)
else if (this.menuIndex === 2) this.getSelfSupportList(1)
else if (this.menuIndex === 3) this.getOldList(1)
},
getEnquiryList(pageIndex = 1) {
vk.callFunction({
url: 'client/enquiry/sheet/kh/getList',
title: '加载中...',
data: {
userId: this.userInfo._id,
pageIndex,
pageSize: this.pageSize,
status: this.activeName
},
success: (res) => {
this.enquiryList = res.rows.map(val => {
let str = ''
val.productNum = ''
// if (val.productList !== undefined && val.productList.length > 0 && val.productList[0].addressRegion !== undefined && val.productList[0].addressRegion.length > 0) {
// let provinceIndex = 0, cityIndex = 0, areaIndex = 0
// this.provinceData.forEach((item, index) => {
// if (parseInt(val.productList[0].addressRegion[0]) === parseInt(item.code)) {
// provinceIndex = index
// str = item.name
// }
// })
// this.cityData[provinceIndex].forEach((item, index) => {
// if (parseInt(val.productList[0].addressRegion[1]) === parseInt(item.code)) {
// cityIndex = index
// str += `-${item.name}`
// }
// })
// this.areaData[provinceIndex][cityIndex].forEach((item, index) => {
// if (parseInt(val.productList[0].addressRegion[2]) === parseInt(item.code)) {
// areaIndex = index
// str += `-${item.name}`
// }
// })
// // str += val.productList[0].addressDetail
// }
const productNumList = []
val.productList.forEach((item, index) => {
if (item.procureNumber) productNumList.push(item.procureNumber + item.procureUnit)
})
val.productNum = productNumList.join('/')
val.fullAddress = val.addressRegion.province.name + '-' + val.addressRegion.city.name + '-' + val.addressRegion.area.name + '-' + val.addressDetail
return val
})
this.total = res.total
this.allNum = res.all
this.notPickNum = res.notPickNum
this.noQuoteNum = res.noQuoteNum
this.pickedNum = res.pickedNum
this.quoteNum = res.quoteNum
}
})
},
getProcessList(pageIndex = 1) {
vk.callFunction({
url: 'client/process/sheet/pub/getList',
title: '加载中...',
data: {
isUser: true,
userId: this.userInfo._id,
pageIndex,
pageSize: this.pageSize,
status: this.activeName
},
success: (res) => {
this.processList = res.rows
this.total = res.total
this.allNum = res.all
this.notPickNum = res.notPickNum
this.pickedNum = res.pickedNum
this.quoteNum = res.quoteNum
this.noQuoteNum = res.noQuoteNum
}
})
},
async getSelfSupportList(pageIndex = 1) {
this.selfSupportList = await vk.callFunction({
url: 'client/selfSupport/kh/getList',
data: {
pageIndex,
pageSize: this.pageSize,
}
})
this.showList = true
},
showEnquiryModal(item) {
this.$refs.enquiryModal.open(item)
},
showProcessModal(item) {
this.$refs.processModal.open(item)
},
editEnquiry(id) {
vk.navigateTo(`/pages/enquiry/release?id=${id}`)
},
enquiryChangeToOnlineSign(id, index) {
uni.showModal({
title: '提示',
content: `确认将该订单转为线上签订吗?`,
success: async res => {
if (res.confirm) {
await vk.callFunction({
url: ' client/enquiry/sheet/kh/changeToOnlineSign',
title: '加载中...',
data: {
id
}
})
uni.showModal({
title: '提示',
content: `切换成功,是否去创建合同?`,
success: res => {
if (res.confirm) vk.navigateTo({url: '/pages/public/contract'});
}
})
this.enquiryList[index].signMethod = 0
}
}
})
},
processChangeToOnlineSign(id, index) {
uni.showModal({
title: '提示',
content: `确认将该订单转为线上签订吗?`,
success: async res => {
if (res.confirm) {
await vk.callFunction({
url: 'client/process/sheet/kh/changeToOnlineSign',
title: '加载中...',
data: {
id
}
})
uni.showModal({
title: '提示',
content: `切换成功,是否去创建合同?`,
success: res => {
if (res.confirm) vk.navigateTo({url: '/pages/public/contract'});
}
})
this.processList[index].signMethod = 0
}
}
})
},
showOtherUser(item) {
const mine = this.userInfo._id === item.uid ? item.user : item.otherUser
const otherUser = this.userInfo._id === item.uid ? item.otherUser : item.user
const mineName = mine.accountType === 2 ? mine.company.companyName : mine.person.personName
const otherName = otherUser.accountType === 2 ? otherUser.company.companyName : otherUser.person.personName
this.$refs.contactModal.open(otherUser.businessCard.companyMobile, mine.businessCard.companyMobile, otherName, mineName)
},
showDetail(info) {
this.$refs.selfSupportModal.open(info)
},
getOldList(pageIndex = 1) {
vk.callFunction({
url: 'client/old/kh/getList',
data: {
quoteUid: this.userInfo._id,
pageIndex,
pageSize: this.pageSize,
buyerOnly: true,
// signMethod: 'all',
signMethod: this.oldSignMethod === 'all' ? null : this.oldSignMethod
},
success: (res) => {
this.oldList = res.rows.map(item => {
if (item.type === 0) item.typeStr = '拍卖'
else if (item.type === 1) item.typeStr = '采购'
else if (item.type === 2) item.typeStr = '租赁'
else if (item.type === 3) item.typeStr = '物资回收'
if (item.addressRegion && item.addressRegion.length > 0)
item.address = item?.addressRegion[0]?.name + item?.addressRegion[1]?.name + item?.addressRegion[2]?.name + item.addressDetail
return item
})
this.total = res.total
}
})
},
},
onLoad(options) {
this.userInfo = vk.getStorageSync('uni_id_user_info')
if (options.menuIndex) {
this.menuIndex = parseInt(options.menuIndex)
}
if (this.menuIndex === 1) this.getEnquiryList()
else if (this.menuIndex === 0) this.getProcessList()
else if (this.menuIndex === 2) this.getSelfSupportList()
else if (this.menuIndex === 3) this.getOldList()
},
}
</script>
<style lang="scss">
.layout-tab {
height: 100rpx;
padding: 0 30rpx;
background: #f1f1f1;
.tab {
margin: 0 20rpx;
padding: 10rpx 0rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #666666;
}
.active {
position: relative;
color: #A92924;
&::after {
position: absolute;
left: 0;
bottom: 0;
z-index: 9;
content: '';
width: 100%;
height: 1px;
background: #A92924;
}
}
}
.layout-total {
padding: 0rpx 30rpx 20rpx;
.tp-box {
border-bottom: 1px solid #f2f2f2;
}
.tp {
position: relative;
margin-right: 30rpx;
padding: 20rpx 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #333333;
&:last-child {
margin-right: 0;
}
}
.active {
color: #A92924;
border-bottom: 1px solid #A92924;
}
}
.layout-list {
margin: 20rpx 20rpx;
.item {
position: relative;
margin-top: 30rpx;
padding: 30rpx 20rpx;
background: #ffffff;
border-radius: 10rpx;
&:nth-child(1) {
margin-top: 0;
}
.text {
font-size: 24rpx;
line-height: 40rpx;
color: #A92924;
}
.date {
color: #9a9a9a;
}
.ing {
width: 100rpx;
height: 40rpx;
padding-left: 10rpx;
font-size: 22rpx;
line-height: 40rpx;
color: #ffffff;
background: url('~@/static/img/ing.png') center no-repeat;
background-size: 100% 100%;
}
.ed {
font-size: 28rpx;
line-height: 44rpx;
color: #4f4f4f;
}
.bao {
// transform: scale(.8);
padding: 2rpx 10rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #A92924;
border: 1px solid #A92924;
}
.bao-2 {
color: #ffffff;
border-color: #E99D42;
background: #E99D42;
}
.zhang {
position: absolute;
right: 10rpx;
top: 60%;
z-index: 90;
margin-top: -60rpx;
width: 80rpx;
height: 70rpx;
}
.op-btn {
position: absolute;
right: 20rpx;
top: 40rpx;
z-index: 90;
width: 140rpx;
height: 40rpx;
font-size: 24rpx;
line-height: 40rpx;
text-align: center;
border: 1px solid #ffffff;
}
.btnred {
color: #ffffff;
border-color: #A92924;
background: #A92924;
}
.btnredplain {
color: #A92924;
border-color: #A92924;
}
.btngreen {
color: #ffffff;
border-color: #81B337;
background: #81B337;
}
.btngreenplain {
color: #81B337;
border-color: #81B337;
}
.btn-2 {
top: 100rpx;
}
}
}
</style>