Files
jjx-web/pages/spot/goods/detail.vue
T
b2894lxlx 16ebffc27e 1、新增黄页
2、新增学堂
3、其他调整、修改
2023-12-04 01:32:33 +08:00

593 lines
20 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>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/spot/goods/goods">现货市场</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item>{{ product.name }}</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="card">
<div class="card-header">
<view class="card-header-left">
<image class="logo" :src="product.user.businessCard.logo" mode="aspectFit"></image>
<view class="info">
<view v-if="product.user.accountType === 1" class="info-name">
{{ product.user.person.personName }}
</view>
<view v-if="product.user.accountType === 2" class="info-name">
{{ product.user.company.companyName }}
</view>
<view class="info-update">
<view class="info-update-time">
{{ product._add_time_str }}
</view>
<view class="info-update-business">
主营业务:{{ product.user.businessCard.mainBusiness }}
</view>
</view>
</view>
</view>
<view class="card-header-right">
<el-button v-if="vk.getVuex('$user.userInfo._id') !== product.userId" @click="toCooperate"
type="primary">申请合作
</el-button>
<el-button v-else @click="showDialog = true"
type="primary">查看合作申请
</el-button>
</view>
</div>
<view class="card-body">
<div class="part-head">
<h3>现货详情</h3>
</div>
<view v-if="product.user.accountType == 1" class="card-body-name">{{ product.user.person.personName }}
</view>
<view v-if="product.user.accountType == 2" class="card-body-name">{{ product.user.company.companyName }}
</view>
<view class="card-body-stock">库存:{{ product.stock }}吨</view>
<view class="card-body-address">
供货地:{{ product.address.province.name + "-" + product.address.city.name + "-" + product.address.area.name }}
</view>
</view>
<view class="card-body">
<div class="part-head">
<h3>附件</h3>
</div>
<ul class="el-upload-list el-upload-list--text">
<li @click="downloadFile(item)" v-for="(item,index) in product.files" :key="index" tabindex="0"
class="el-upload-list__item is-success">
<a class="el-upload-list__item-name">
<i class="el-icon-document"></i>
{{ item | getFileName }}
</a>
</li>
</ul>
</view>
<view class="card-body">
<div class="part-head">
<h3>已收到的合作申请</h3>
</div>
<vk-data-table :data="product.cooperateList" :columns="table1.columns"
:customRightBtns="table1.customRightBtns"></vk-data-table>
</view>
</view>
<el-dialog :visible.sync="showDialog" width="70%" :show-close="false">
<view slot="title" class="text-main text-40 m-30 flex justify-between items-center">
<text>收到的申请合作列表</text>
<el-button type="primary" @click.native="showDialog = false">关闭</el-button>
</view>
<view class="mt-15" v-if="product">
<view class="request-header">
<text class="flex-1">申请人</text>
<text class="flex-1">申请时间</text>
<text class="flex-1">联系方式</text>
<text class="flex-1">操作</text>
</view>
<view class="quote" v-for="(item, index) in product.cooperateList" :key="index">
<text class="flex-1">{{
item.user.accountType === 1 ? item.user.person.personName : item.user.company.companyName
}}
</text>
<text class="flex-1">{{ item._add_time_str }}</text>
<text class="flex-1">
{{ item.user.accountType === 1 ? item.user.person.mobile : item.user.company.mobile }}
</text>
<text class="flex-1">
<el-button type="primary" @click.native="doShowInfo(item)">查看申请详情</el-button>
</text>
</view>
</view>
</el-dialog>
<el-dialog :visible.sync="form1.props.show" title="申请合作" width="60%" mode="form">
<vk-data-form ref="table1" v-model="form1.data" :action="form1.props.action" :columns="form1.props.columns"
:rules="form1.props.rules" :form-type="form1.props.formType"
:loading.sync="form1.props.loading"
:beforeAction="form1.props.beforeAction" :auto-close="true" label-width="140px"
@success="onFormSuccess"></vk-data-form>
</el-dialog>
<vk-data-dialog
v-model="showInfo"
title="申请详情"
width="600px"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
></vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
</view>
</template>
<script>
export default {
data() {
return {
showDialog: false,
showInfo: false,
info: null,
infoColumns: [
{key: "company.companyName", title: "申请人", type: "text"},
{key: "company.mobile", title: "联系方式", type: "text"},
{key: "manager.personName", title: "代理人", type: "text"},
{key: "manager.mobile", title: "代理人联系方式", type: "text"},
],
product: {
name: '现货详情',
address: {
province: {},
city: {},
area: {},
},
user: {
businessCard: {},
},
cooperateList: []
},
// 表单相关开始-----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {},
// 表单属性
props: {
// 表单请求地址
action: "client/spot/goods/kh/addCooperate",
// 表单字段显示规则
columns: [{
key: "person",
title: "个人",
type: "object",
showLabel: false,
showRule: (formData) => {
return formData.person.personName != null
},
columns: [{
key: "personName",
title: "姓名",
type: "text",
readonly: true,
disabled: true
},
// {
// key: "idCard",
// title: "身份证号",
// type: "text",
// readonly: true,
// disabled: true
// },
{
key: "mobile",
title: "电话",
type: "text",
readonly: true,
disabled: true
},
]
},
{
key: "company",
title: "企业信息",
type: "object",
showLabel: false,
showRule: (formData) => {
return formData.company.companyName != null
},
columns: [{
key: "companyName",
title: "企业名称",
type: "text",
readonly: true,
disabled: true
},
{
key: "organization",
title: "统一社会信用代码",
type: "text",
readonly: true,
disabled: true
},
{
key: "legalName",
title: "法人",
type: "text",
readonly: true,
disabled: true
},
{
key: "legalMobile",
title: "法人电话",
type: "text",
readonly: true,
disabled: true
},
]
},
{
key: "manager",
title: "代理人",
type: "object",
showLabel: false,
showRule: (formData) => {
return formData.manager.personName != null
},
columns: [{
key: "personName",
title: "代理人",
type: "text",
readonly: true,
disabled: true
},
// {
// key: "idCard",
// title: "代理人身份证号",
// type: "text",
// readonly: true,
// disabled: true
// },
{
key: "mobile",
title: "代理人电话",
type: "text",
readonly: true,
disabled: true
},
]
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: 200,
showWordLimit: true,
},
],
// 表单验证规则
rules: {
text: [{
required: true,
message: "text不能为空",
trigger: "change"
},
{
required: true,
message: "text不能为空",
trigger: "change"
},
]
},
// add 代表添加 update 代表修改
formType: "",
// 表单是否在请求中
loading: false,
// 是否显示表单1 的弹窗
show: false,
beforeAction: (formData) => {
formData.goodsId = this.product._id
formData.goodsUserId = this.product.userId
return formData
},
}
},
// 表单相关结束-----------------------------------------------------------
table1: {
// 表格数据
data: [],
// 表格字段显示规则
columns: [{
key: "subjectName",
title: "申请人",
type: "text",
width: 400,
formatter: (val, row, column, index) => {
if (vk.getVuex('$user.userInfo._id') === this.product.userId) {
return val
}
if (row.accountType === 1) {
return vk.pubfn.hidden(val, 1, 1);
} else {
return vk.pubfn.hidden(val, 2, 4);
}
}
},
{
key: "subjectMobile",
title: "联系方式",
type: "text",
width: 120,
formatter: (val, row, column, index) => {
let str = val
if (row.managerMobile) {
str = row.managerMobile
}
if (vk.getVuex('$user.userInfo._id') == this.product.userId) {
return str
}
return vk.pubfn.hidden(str, 3, 4);
}
},
// {
// key: "remark",
// title: "备注",
// type: "textarea",
// width: 280,
// formatter: (val, row, column, index) => {
// let str = val
// if (row.managerMobile) {
// str = row.managerMobile
// }
// if (vk.getVuex('$user.userInfo._id') == this.product.userId) {
// return val
// }
// return "******";
// }
// },
],
customRightBtns: [{
title: '查看',
type: 'primary',
icon: 'el-icon-search',
disabled: (item) => {
return vk.getVuex('$user.userInfo._id') !== this.product.userId
},
onClick: (item) => {
this.doShowInfo(item)
}
},]
},
}
},
onLoad({
id
}) {
// 获取现货数据
vk.callFunction({
url: 'client/spot/goods/pub/getDetail',
title: '请求中...',
data: {
_id: id,
},
success: (data) => {
console.log(data);
this.product = data.data
}
});
// 获取用户数据
vk.userCenter.getCurrentUserInfo({
success: (data) => {
this.form1.data = _.pick(data.userInfo, [
'fadadaConfirm', 'person', 'company', 'manager', 'businessCard', 'accountType'
])
// 成功后的逻辑
console.log('form1: ', {
...this.form1.data
});
}
});
},
methods: {
downloadFile(url) {
location.href = url
},
showCooperate() {
this.table2.show = true
},
async toCooperate() {
const {userInfo} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
this.$confirm('您尚未认证, 是否前往认证?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
this.$confirm('请完善名片信息', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=business-card'});
})
} else {
this.form1.props.show = true
}
// vk.navigateTo('/pages/spot/goods/cooperate?id=' + this.product._id);
},
getCertUrl() {
vk.callFunction({
url: 'client/fadada.getVerifyUrl',
success: (res) => {
location.href = res.data.url
}
});
},
onFormSuccess() {
this.form1.props.show = false
},
doShowInfo(info) {
this.info = info
this.showInfo = true
}
},
filters: {
getFileName(url) {
const arr = url.split("/")
return arr[arr.length - 1]
}
}
}
</script>
<style scoped lang="scss">
.card {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 30px;
}
.card-body {
padding-top: 30px;
.card-body-name {
font-size: 18px;
font-weight: bold;
}
.card-body-stock {
font-size: 14px;
margin: 20px 0;
}
.card-body-address {
font-size: 14px;
}
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 0 60rpx 0;
border-bottom: 1px solid rgba(187, 187, 187, 0.37);
&-left {
display: flex;
align-items: center;
}
.logo {
width: 80px;
height: 80px;
}
.info {
padding-left: 30px;
}
.info-name {
font-size: 24px;
}
.info-update {
margin-top: 10px;
display: flex;
color: #A7A7A7;
font-size: 14px;
}
.info-update-time {
margin-right: 30px;
}
}
.part-head {
margin-bottom: 12px;
}
.part-head h3 {
line-height: 28px;
color: #a92924;
font-size: 20px;
text-indent: 15px;
position: relative;
}
.part-head h3:before {
content: " ";
width: 4px;
height: 16px;
background: #a92924;
display: inline-block;
position: absolute;
top: 6px;
left: 0;
}
.request-header {
border: 1px solid #EDEDED;
background-color: #FFF8F1;
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
margin-top: 30px;
text {
text-align: center;
}
}
.quote {
border-left: 1px solid #EDEDED;
border-right: 1px solid #EDEDED;
border-bottom: 1px solid #EDEDED;
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
text {
text-align: center;
}
}
</style>