497 lines
11 KiB
Vue
497 lines
11 KiB
Vue
<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" round>申请合作</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="form1.props.show" title="申请合作" width="600px" mode="form">
|
||
<vk-data-form ref="form1" 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>
|
||
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
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 "******";
|
||
}
|
||
},
|
||
{
|
||
key: "_add_time_str",
|
||
title: "申请时间",
|
||
type: "text",
|
||
width: 200
|
||
},
|
||
|
||
],
|
||
customRightBtns: [{
|
||
title: '查看',
|
||
type: 'primary',
|
||
icon: 'el-icon-search',
|
||
disabled: (item) => {
|
||
return vk.getVuex('$user.userInfo._id') != this.product.userId
|
||
},
|
||
onClick: (item) => {
|
||
vk.toast(`${item._id}-按钮1`);
|
||
}
|
||
}, ]
|
||
},
|
||
|
||
}
|
||
},
|
||
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
|
||
},
|
||
toCooperate() {
|
||
if (!this.form1.data.fadadaConfirm) {
|
||
this.$confirm('您尚未认证, 是否前往认证?', '提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
this.getCertUrl()
|
||
})
|
||
} 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
|
||
}
|
||
},
|
||
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;
|
||
}
|
||
</style> |