1107
This commit is contained in:
@@ -0,0 +1,497 @@
|
||||
<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>
|
||||
@@ -0,0 +1,320 @@
|
||||
<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 url="/pages/spot/goods/goods">现货市场</navigator></el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</view> -->
|
||||
|
||||
<view class="carousel">
|
||||
<el-carousel height="170px">
|
||||
<el-carousel-item v-for="item in 4" :key="item">
|
||||
<image class="carousel-img"
|
||||
src="http://jyx.gxwebsoft.com/uploads/20210506/600fc93e6b85324b3ea1373ee264290d.jpg"
|
||||
mode="aspectFill"></image>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<view class="goods-options">
|
||||
<el-row class="">
|
||||
<el-button @click="toRelease" type="primary" round>发布/编辑我的现货</el-button>
|
||||
<!-- <el-button type="primary" round plain>我发布的现货</el-button> -->
|
||||
</el-row>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 筛选表单 -->
|
||||
<view class="filter-outer">
|
||||
<el-form @submit.native.prevent label-width="80px">
|
||||
<el-form-item label="关键词">
|
||||
<el-input @keyup.enter.native="search" clearable placeholder="输入关键字搜索" v-model="keyword">
|
||||
<el-button @click="search(1)" type="primary" slot="append" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类">
|
||||
<el-tabs>
|
||||
<el-tab-pane v-for="(item, index) in categoryTreeData" :label="item.name" :key="item._id">
|
||||
<el-checkbox-group v-model="checkCategoryList[index]">
|
||||
<el-checkbox v-for="(citem, cindex) in item.children" :label="citem"
|
||||
:key="cindex">{{citem.name}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
</el-form-item>
|
||||
<el-form-item label="城市">
|
||||
<el-checkbox-group v-model="checkProvinceList">
|
||||
<!-- <el-checkbox :label="{code:0,name: '全国'}">全国</el-checkbox> -->
|
||||
<el-checkbox :checked="cindex == 0" v-for="(citem, cindex) in provinceData" :label="citem"
|
||||
:key="cindex">{{citem.name}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="已选">
|
||||
<view class="tags">
|
||||
<el-tag v-for="(item, index) in checkCategoryArr" :key="index">{{item.name}}</el-tag>
|
||||
</view>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<view class="goods-list">
|
||||
<view v-for="(item, index) in goodsData.rows" :key="index" class="goods">
|
||||
<view class="goods-title">{{item.name}}</view>
|
||||
<view class="goods-stock">库存:{{item.stock}}吨</view>
|
||||
<view class="goods-address">供货地:{{item.addressStr}}</view>
|
||||
<view class="goods-image">
|
||||
<image :src="item.user.businessCard.logo" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view v-if="item.user.accountType == 1" class="goods-company">{{item.user.person.personName}}</view>
|
||||
<view v-if="item.user.accountType == 2" class="goods-company">{{item.user.company.companyName}}</view>
|
||||
<el-button @click="vk.navigateTo('/pages/spot/goods/detail?id=' + item._id);" type="primary" plain round size="small">立即查看</el-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="paginatio">
|
||||
<el-pagination
|
||||
@current-change="search"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:total="goodsData.total">
|
||||
</el-pagination>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
|
||||
provinces.unshift({
|
||||
code: 9999,
|
||||
name: '全国'
|
||||
})
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
categoryTreeData: [],
|
||||
provinceData: provinces,
|
||||
checkCategoryList: [],
|
||||
checkProvinceList: [],
|
||||
keyword: '',
|
||||
goodsData: {
|
||||
total: 0,
|
||||
rows: []
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.search(1)
|
||||
vk.callFunction({
|
||||
url: 'client/spot/category/pub/getTree',
|
||||
title: '请求中...',
|
||||
data: {
|
||||
|
||||
},
|
||||
success: (data) => {
|
||||
this.categoryTreeData = data.rows
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
this.checkCategoryList.push([])
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
toRelease() {
|
||||
|
||||
if (!vk.getVuex('$user.userInfo.fadadaConfirm')) {
|
||||
this.$confirm('您尚未认证, 是否前往认证?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.getCertUrl()
|
||||
})
|
||||
}else if(vk.pubfn.isNull(vk.getVuex('$user.userInfo.businessCard'))) {
|
||||
this.$confirm('请完善名片信息', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
vk.navigateTo('/pages/user/user?menu=business-card');
|
||||
})
|
||||
}else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/spot/release/release'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
search(pageIndex) {
|
||||
const categoryIds = []
|
||||
this.checkCategoryList.forEach(item => {
|
||||
item.forEach(sitem => {
|
||||
categoryIds.push(sitem._id)
|
||||
})
|
||||
})
|
||||
|
||||
let provinceCodes = this.checkProvinceList.map(item => item.code)
|
||||
|
||||
if (provinceCodes.includes(9999)) {
|
||||
provinceCodes = []
|
||||
}
|
||||
|
||||
vk.callFunction({
|
||||
url: 'client/spot/goods/pub/getList',
|
||||
data: {
|
||||
pageIndex: pageIndex,
|
||||
pageSize: 20,
|
||||
keyword: this.keyword,
|
||||
categoryIds: categoryIds,
|
||||
provinceCodes: provinceCodes
|
||||
|
||||
},
|
||||
success: (data) => {
|
||||
console.log('data: ',data);
|
||||
data.rows.forEach(item => {
|
||||
try {
|
||||
item.addressStr = item.address.province.name + "-" + item.address.city.name + "-" + item.address.area.name
|
||||
} catch(err){
|
||||
item.addressStr = ""
|
||||
}
|
||||
})
|
||||
this.goodsData = data
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
checkCategoryArr() {
|
||||
let arr = []
|
||||
this.checkCategoryList.forEach(item => {
|
||||
arr.push(...item)
|
||||
})
|
||||
|
||||
this.checkProvinceList.forEach(item => {
|
||||
arr.push({
|
||||
...item
|
||||
})
|
||||
})
|
||||
return arr
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.carousel {
|
||||
width: 1200px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.carousel-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.goods-options {
|
||||
background-color: #FFFFFF;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.filter-outer {
|
||||
width: 1200px;
|
||||
margin: 20px auto;
|
||||
background-color: #FFFFFF;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.goods-list {
|
||||
width: 1200px;
|
||||
margin: 20px auto;
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.goods {
|
||||
width: 217px;
|
||||
height: 280px;
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.05);
|
||||
text-align: center;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 25px;
|
||||
|
||||
&-title {
|
||||
font-size: 15px;
|
||||
color: #101010;
|
||||
height: 62px;
|
||||
padding-top: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&-stock {
|
||||
font-size: 12px;
|
||||
color: #BD3124;
|
||||
}
|
||||
|
||||
&-address {
|
||||
font-size: 12px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 200px;
|
||||
height: 70px;
|
||||
margin: 0 auto;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&-company {
|
||||
color: #4F4F4F;
|
||||
font-size: 14px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
&-buy {
|
||||
width: 108px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(169, 41, 36, 1);
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
font-family: Roboto;
|
||||
border: 1px solid rgba(169, 41, 36, 1);
|
||||
margin: 0 auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.paginatio{
|
||||
float: none;
|
||||
width: 1200px;
|
||||
margin: 20px auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,175 @@
|
||||
<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>发布现货</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</view>
|
||||
|
||||
<view class="form-view">
|
||||
<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"
|
||||
:before-action="form1.props.beforeAction" :auto-close="true" label-width="140px"
|
||||
@success="onFormSuccess">
|
||||
<template v-slot:name="{ form, keyName }">
|
||||
<el-input v-model="productName" readonly placeholder="请添加现货分类"></el-input>
|
||||
</template>
|
||||
</vk-data-form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 表单相关开始-----------------------------------------------------------
|
||||
form1: {
|
||||
// 表单请求数据,此处可以设置默认值
|
||||
data: {
|
||||
|
||||
},
|
||||
// 表单属性
|
||||
props: {
|
||||
// 表单请求地址
|
||||
action: "client/spot/goods/kh/addUpdate",
|
||||
// 表单字段显示规则
|
||||
columns: [{
|
||||
key: "name",
|
||||
title: "现货名称",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
key: "categoryIds",
|
||||
title: "现货分类",
|
||||
type: "checkbox",
|
||||
action: "client/spot/category/pub/getList",
|
||||
actionData: {
|
||||
whereJson: {
|
||||
level: 2
|
||||
}
|
||||
},
|
||||
props: {
|
||||
list: "data",
|
||||
value: "_id",
|
||||
label: "name"
|
||||
},
|
||||
watch: ({
|
||||
option
|
||||
}) => {
|
||||
console.log('res: ', option)
|
||||
|
||||
this.form1.data.name = option.map(item => item.name).join('、')
|
||||
this.productName = option.map(item => item.name).join('、')
|
||||
console.log(this.form1);
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
key: "stock",
|
||||
title: "库存(吨)",
|
||||
type: "number"
|
||||
},
|
||||
{
|
||||
key: "address",
|
||||
title: "供货地",
|
||||
type: "address"
|
||||
},
|
||||
{
|
||||
key: "files",
|
||||
title: "附件文档",
|
||||
type: "file",
|
||||
buttonText: "点击上传",
|
||||
limit: 9,
|
||||
accept: ".jpg,.png,.xlsx,.doc,.docx",
|
||||
tips: '上传自有采购单图片或文档,支持jpg/png/word/excel'
|
||||
},
|
||||
|
||||
|
||||
],
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
categoryIds: [
|
||||
{
|
||||
required: true,
|
||||
message: "现货名称不能为空",
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value.length > 5) {
|
||||
callback(new Error('最多选择五个分类'));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
],
|
||||
stock: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写库存",
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
{
|
||||
min: 0,
|
||||
type: 'number',
|
||||
message: "库存不能小于0",
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
],
|
||||
address: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写地址",
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
// add 代表添加 update 代表修改
|
||||
formType: "add",
|
||||
// 表单是否在请求中
|
||||
loading: false,
|
||||
// 是否显示表单1 的弹窗
|
||||
show: false
|
||||
}
|
||||
},
|
||||
productName: ''
|
||||
// 表单相关结束-----------------------------------------------------------
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
vk.callFunction({
|
||||
url: 'client/spot/goods/kh/getSelfOne',
|
||||
success: (res) => {
|
||||
if(res.data) {
|
||||
this.$refs.form1.setResetFormData(res.data);
|
||||
this.$refs.form1.resetForm();
|
||||
this.productName = res.data.name
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
onFormSuccess() {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.form-view {
|
||||
width: 1200px;
|
||||
margin: 0 auto;
|
||||
background-color: #FFFFFF;
|
||||
padding: 20rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user