This commit is contained in:
2026-10-08 18:36:23 +08:00
commit 8a1da677e4
904 changed files with 111327 additions and 0 deletions
+193
View File
@@ -0,0 +1,193 @@
<template> <!-- 现货市场-申请合作(企业和个人可共用页面) -->
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uititle title="申请合作"></uititle>
</u-sticky>
<view class="layout layout-title m-top-20">填写合作信息</view>
<view class="layout layout-apply m-top-10 bg-white">
<view class="group flex align-center" v-if="userInfo.accountType === 2">
<view class="lb need m-right-30">企业名称:</view>
<view class="vl flex-1">
<input class="input" type="text" placeholder="请输入内容" v-model="formData.companyName"/>
</view>
</view>
<view class="group flex align-center">
<view class="lb need m-right-30">联系人姓名:</view>
<view class="vl flex-1">
<input class="input" type="text" placeholder="请输入内容" v-model="formData.name"/>
</view>
</view>
<view class="group flex align-center">
<view class="lb need m-right-30">联系人电话:</view>
<view class="vl flex-1">
<input class="input" type="text" placeholder="请输入内容" v-model="formData.mobile"/>
</view>
</view>
<view class="group flex align-center">
<view class="lb need m-right-30">合作留言:</view>
<view class="vl flex-1">
<input class="input" type="text" placeholder="请输入内容" v-model="formData.remark"/>
</view>
</view>
<!-- <view class="flex justify-between align-center m-top-20">-->
<!-- <view class="before">是否对以上信息进行详细核实</view>-->
<!-- <radio-group class="flex justify-between align-center" @change="radioChange">-->
<!-- <label class="m-left-30" v-for="(item, index) in radioEnum" :key="item.value">-->
<!-- <radio :value="item.value" color="#A92924" :checked="index === current"-->
<!-- style="transform:scale(0.7)"/>-->
<!-- <text class="before">{{ item.name }}</text>-->
<!-- </label>-->
<!-- </radio-group>-->
<!-- </view>-->
<view class="group flex align-center">
<view class="lb need m-right-30">附件:</view>
<view class="flex-1">
<u-upload
:fileList="formData.files"
@afterRead="afterRead"
@delete="deletePic"
accept="file"
:maxCount="10"
multiple
>
</u-upload>
</view>
</view>
<u-button class="public-btn" text="提交" @click="addCoop"></u-button>
</view>
</view>
</template>
<script>
import uititle from '@/components/common/title'
import dayjs from "dayjs";
import md5 from "js-md5";
export default {
components: {
uititle,
},
data() {
return {
current: 0,
radioEnum: [
{value: 0, name: '是',},
{value: 0, name: '否',}
],
formData: {
goodsId: null,
goodsUserId: null,
companyName: '',
name: '',
mobile: '',
remark: '',
files: []
},
userInfo: null
};
},
methods: {
afterRead({file}) {
for (let i = 0; i < file.length; i++) {
const item = file[i]
const suffix = item.name.split('.').pop()
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.files.push({url: res.fileList[0].tempFileURL})
})
}
})
}
},
deletePic({index}) {
this.formData.files.splice(index, 1)
},
addCoop() {
if (!this.formData.name) return this.$message.error('请填写联系人姓名')
if (!this.formData.mobile) return this.$message.error('请填写联系方式')
if (this.formData.files) this.formData.files = this.formData.files.map(item => item.url)
vk.callFunction({
url: 'client/spot/goods/kh/addCooperate',
data: this.formData
})
this.$message.success('提交成功')
setTimeout(() => {
uni.navigateBack()
}, 1500)
},
},
onLoad({id, userId}) {
this.formData.goodsId = id
this.formData.goodsUserId = userId
this.userInfo = vk.getStorageSync('uni_id_user_info')
if (this.userInfo.accountType === 1) {
this.formData.name = this.userInfo.person.personName
this.formData.mobile = this.userInfo.person.mobile
} else {
this.formData.companyName = this.userInfo.company.companyName
this.formData.mobile = this.userInfo.company.mobile
if (this.userInfo.manager) this.formData.name = this.userInfo.manager.personName
}
}
}
</script>
<style lang="scss">
.public-btn {
width: 95%;
margin-top: 60rpx;
color: #ffffff;
background: #A92924;
}
.layout-title {
padding: 20rpx 30rpx;
font-size: 28rpx;
font-weight: 600;
line-height: 44rpx;
color: #A92924;
}
.layout-apply {
margin: 20rpx 30rpx;
padding: 50rpx 20rpx;
border-radius: 18rpx;
}
.group {
padding: 20rpx 0;
}
.lb {
position: relative;
width: 180rpx;
font-size: 24rpx;
line-height: 40rpx;
color: #666666;
text-align: right;
}
.vl {
padding: 12rpx 20rpx;
border: 1px solid #f2f2f2;
}
.input {
font-size: 24rpx;
line-height: 40rpx;
color: #101010;
}
.before {
font-size: 24rpx;
line-height: 40rpx;
color: #333333;
}
</style>
+405
View File
@@ -0,0 +1,405 @@
<template> <!-- 现货详情 -->
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uiheader></uiheader>
</u-sticky>
<!-- 内容 -->
<view class="layout layout-detail" v-if="product">
<view class="company flex m-top-20" v-if="product.user">
<view class="logo">
<image class="full" v-if="product.user.businessCard && product.user.businessCard.logo"
:src="product.user.businessCard.logo" mode="aspectFit"></image>
</view>
<view class="info flex-1 p-left-20">
<view class="name flex justify-start align-center">
<view class="name-text">
{{ product.user.accountType === 2 ? product.user.company.companyName : product.user.person.personName }}
</view>
<!-- 认证图标 -->
<!-- <view class="name-icon m-left-20">-->
<!-- <image class="full" src="/static/img/idente.png" mode=""></image>-->
<!-- </view>-->
</view>
<view class="zhu" v-if="product.user.accountType === 2">
主营业务:{{
(product.user.company.mainSpotCategory && product.user.company.mainSpotCategory.length > 0) ? product.user.company.mainSpotCategory.join() : ''
}}
</view>
<view class="flex justify-between items-center">
<view class="zhu">
{{ product._add_time_str }} 发布
</view>
<view class="ml-20">
<u-button size="mini" plain type="primary" @click="$jump(`/pages/yellow/detail?id=${product.user._id}`)">
查看主页
</u-button>
</view>
</view>
</view>
</view>
<view class="card-title m-top-30">现货详情</view>
<view class="detail m-top-20">
<view class="detail-title">{{ product.name }}</view>
<view class="detail-text">库存 :{{ parseInt(product.stock) }}吨</view>
<view class="detail-text">供货地:{{
product.address.province.name + "-" + product.address.city.name + "-" + product.address.area.name
}}
</view>
</view>
<view class="card-body">
<view class="card-title m-top-30">报价有效期</view>
<view class="detail-text">截止: {{
dayjs(product.answerEndTime).format('YYYY-MM-DD HH:mm:ss')
}}
</view>
</view>
<view class="card-title m-top-30">产品规格单价</view>
<view class="m-top-20">
<file-type v-for="(item, index) in product.files" :key="index" :item="item"/>
</view>
<view class="card-title m-top-30">产品现场图片</view>
<view class="m-top-20">
<file-type v-for="(item, index) in product.images" :key="index" :item="item"/>
</view>
<view class="card-title m-top-30">已收到的合作申请</view>
<view class="table-box m-top-30">
<!-- <view class="thead">-->
<!-- <view class="tr">-->
<!-- <view class="th">企业</view>-->
<!-- <view class="th">申请人</view>-->
<!-- <view class="th">联系方式</view>-->
<!-- <view class="th">合作留言</view>-->
<!-- <view class="th">申请时间</view>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="tbody">-->
<!-- <view class="flex" v-for="(item, index) in product.cooperateList" :key="index">-->
<!-- <view class="w-25p td-n">{{-->
<!-- item.user.accountType === 2 ? item.user.company.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6") : item.user.person.personName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6")-->
<!-- }}-->
<!-- </view>-->
<!-- <view class="w-25p td-n">{{ item.name }}</view>-->
<!-- <view class="w-25p td-n">-->
<!-- <text class="u-line-2">{{ item.mobile }}</text>-->
<!-- </view>-->
<!-- <view class="w-25p td-n u-line-2">{{ item.remark }}</view>-->
<!-- <view class="w-25p td-n">{{ item._add_time_str }}</view>-->
<!-- </view>-->
<!-- </view>-->
<view class="flex justify-start items-start flex-col mb-25 border rounded p-20 "
style="border-style: dashed" v-for="(item, index) in product.cooperateList" :key="index">
<p class="mb-10" v-if="item.user.accountType === 2">企业: {{
item.user.accountType === 2 ? item.user.company.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6") : item.user.person.personName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6")
}}</p>
<p class="mb-10">申请人: {{ item.name }}</p>
<!-- <p class="mb-10">联系方式: {{ item.mobile }}</p>-->
<p class="mb-10">联系方式: ********</p>
<p class="mb-10">合作留言: {{ item.remark }}</p>
<view class="mb-10 flex justify-start " v-if="product.isMine">
<text>附件:</text>
<file-type v-for="(file, fileIndex) in item.files" class="mx-15" :item="file" :key="fileIndex"/>
</view>
<p class="mb-10">申请时间: {{ item._add_time_str }}</p>
</view>
</view>
</view>
<!-- 底部 -->
<view class="fiexd-bottom flex justify-between align-center bg-white">
<u-icon name="integral" color="#A92924" size="26"></u-icon>
<view class="text red flex-1 m-left-20">{{ product.cooperateList.length }}家已经申请合作</view>
<view class="apply-btn" @click="toCooperate" v-if="userInfo._id !== product.userId">申请合作</view>
</view>
<!-- 弹出窗 -->
</view>
</template>
<script>
import uiheader from '@/components/index/header'
import FileType from "@/components/file-type/file-type.vue";
import dayjs from "dayjs";
export default {
components: {
FileType,
uiheader,
},
data() {
return {
isPopup: false,
product: null,
allChildCate: [],
userInfo: null
};
},
methods: {
dayjs,
getCategoryTreeData(id) {
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
data: {},
success: (data) => {
this.allChildCate = []
data.rows.forEach(item => {
item.children.forEach(child => {
this.allChildCate.push(child)
})
})
this.getInfo(id)
}
});
},
applyLink() {
uni.$u.route('/pages/goods/apply', {
id: 0,
});
},
getInfo(_id) {
vk.callFunction({
url: 'client/spot/goods/pub/getDetail',
title: '请求中...',
data: {
_id,
},
success: (data) => {
this.product = data.data
this.product.user.company.mainSpotCategory = []
if (this.product.user.company && this.product.user.company.mainSpotCategoryIds) {
this.allChildCate.forEach(child => {
if (this.product.user.company.mainSpotCategoryIds.includes(child._id)) {
this.product.user.company.mainSpotCategory.push(child.name)
}
})
}
}
});
},
async toCooperate() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (accountNum === 0) {
uni.showModal({
title: '提示',
content: '请先到个人中心添加收款账户',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 7)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else {
vk.navigateTo({url: `/pages/goods/apply?id=${this.product._id}&userId=${this.product.userId}`});
}
},
},
onLoad({id}) {
this.userInfo = vk.getStorageSync('uni_id_user_info')
this.getCategoryTreeData(id)
}
}
</script>
<style lang="scss">
page {
padding-bottom: 150rpx;
background: #ffffff;
}
.card-title {
position: relative;
padding-left: 20rpx;
font-size: 28rpx;
font-weight: 600;
line-height: 48rpx;
color: #A92924;
&:before {
position: absolute;
left: 0;
top: 50%;
z-index: 9;
margin-top: -14rpx;
content: '';
width: 6rpx;
height: 28rpx;
background: #A92924;
}
.more {
font-size: 24rpx;
font-weight: normal;
color: #999999;
}
}
.layout-detail {
padding: 20rpx 30rpx;
}
.company {
padding-bottom: 40rpx;
border-bottom: 1px solid #f2f2f2;
.logo {
width: 120rpx;
height: 120rpx;
}
.name-text {
//max-width: 380rpx;
font-size: 30rpx;
font-weight: 600;
line-height: 40rpx;
color: #333333;
}
.name-icon {
width: 80rpx;
height: 32rpx;
}
.zhu {
margin-top: 10rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #999999;
}
}
.detail-title {
font-size: 26rpx;
font-weight: 600;
line-height: 40rpx;
color: #101010;
}
.detail-text {
margin-top: 10rpx;
font-size: 24rpx;
line-height: 40rpx;
color: #999999;
}
.fiexd-bottom {
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
width: 100%;
height: 130rpx;
padding: 0 30rpx;
box-sizing: border-box;
border-top: 1px solid #f2f2f2;
.text {
font-size: 26rpx;
line-height: 40rpx;
}
.apply-btn {
width: 220rpx;
height: 70rpx;
font-size: 26rpx;
line-height: 70rpx;
text-align: center;
color: #ffffff;
background: #A92924;
}
}
.table-box {
font-size: 24rpx;
line-height: 28rpx;
text-align: center;
}
.tr {
display: flex;
justify-content: space-between;
align-items: center;
}
.th {
color: #666 !important;
background: #FFF8F2;
}
.th, .td {
display: flex;
justify-content: center;
align-items: center;
width: 50%;
height: 76rpx;
color: #999;
overflow: hidden;
box-sizing: border-box;
border-left: 1px solid #f2f2f2;
border-right: 1px solid #f2f2f2;
border-bottom: 1px solid #f2f2f2;
}
.td-n {
//height: 70rpx;
display: flex;
align-items: center;
justify-content: center;
border-right: 1px solid #f2f2f2;
border-bottom: 1px solid #f2f2f2;
background: #ffffff;
}
.td-3 {
width: 33.33%;
}
.popup-box {
padding: 20rpx 20rpx;
}
.popup-title {
padding: 18rpx 0;
border-bottom: 1px solid #A92924;
.title {
font-size: 24rpx;
line-height: 40rpx;
color: #A92924;
}
.close {
width: 80rpx;
height: 40rpx;
font-size: 22rpx;
line-height: 40rpx;
text-align: center;
color: #ffffff;
background: #A92924;
}
}
</style>
+421
View File
@@ -0,0 +1,421 @@
<template> <!-- 现货市场 -->
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uiheader title="现货市场"></uiheader>
<!-- 搜索栏 -->
<cmsearch :k="keyword" @search="afterSearch"></cmsearch>
<!-- 轮播图-传值:list="数组" -->
<cmswiper page="spot" height="320rpx"></cmswiper>
<!-- 选择器 -->
<view class="bg-white p-20 flex justify-center items-center">
<view class="flex-1 mx-20">
<u-button type="primary" shape="circle" size="mini" @click="toRelease">发布现货</u-button>
</view>
<view class="flex-1 mx-20">
<u-button type="primary" shape="circle" size="mini" plain @click="toMy">我的现货</u-button>
</view>
</view>
<view class="layout-pick flex justify-between align-center bg-white">
<view class="ip down" @click="isPick=true">现货类型:{{ pickValue }}</view>
<view class="ip down" @click="showAddress">供货地:{{ locationValue }}</view>
</view>
</u-sticky>
<!-- 列表数据 -->
<view class="layout-goods">
<view class="goods-box p-top-10">
<uiswiper :ad="9" padding="10rpx 0"></uiswiper>
<uiswiper :ad="10" padding="10rpx 0"></uiswiper>
<view class="item bg-white" @click="detailLink(item._id)" v-for="(item, index) in goodsData.rows"
:key="index">
<view class="top" v-if="item.isTop">特别推荐</view>
<view class="top" v-if="!item.isTop && index < 10">最新</view>
<view class="askfor">立即查看</view>
<view class="title text-single">{{ item.name }}</view>
<view class="text m-top-10">
<text class="red">库存:{{ parseInt(item.stock) }}吨</text>
</view>
<view class="text">供货地:{{ item.address.province.name }}-{{
item.address.city.name
}}-{{ item.address.area.name }}
</view>
<view class="flex justify-between align-center">
<view class="company flex justify-center align-center flex-nowrap">
<view class="text flex-1 text-single" v-if="item.user && item.user.company">
<template v-if="item.user">
<text v-if="item.user.accountType === 1">{{
item.user.person.personName.replace(/^(.).*$/, "$1**")
}}
</text>
<text v-if="item.user.accountType === 2">{{
item.user.company.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6")
}}
</text>
</template>
</view>
</view>
</view>
<view class="date">{{ item._add_time_str }} 更新</view>
</view>
</view>
</view>
<!-- 没有数据 -->
<cmempty></cmempty>
<!-- 按钮 -->
<!-- <view class="issue" @click="toRelease">-->
<!-- <u-icon name="plus" color="#fff" size="24"></u-icon>-->
<!-- </view>-->
<!-- <view class="my" @click="toMy">-->
<!-- <u-icon name="account" color="#A92924" size="24"></u-icon>-->
<!-- </view>-->
<!-- 选择器 -->
<u-picker v-if="isPick" :show="isPick" :columns="[categoryTreeData, categoryTreeData[cateIndex[0]].children]"
key-name="name" @confirm="handConfirmPick" @change="handleChangeCate" @cancel="isPick = false">
<template #more>
<text @click="resetCate">重置</text>
</template>
</u-picker>
<AddressSelect ref="AddressSelect" @confirm="regionConfirm"/>
<collapse></collapse>
</view>
</template>
<script>
import uiheader from '@/components/index/header'
import cmsearch from '@/components/common/search'
import cmempty from '@/components/common/empty'
import cmswiper from '@/components/common/swiper'
import AddressSelect from "@/components/AddressSelect.vue";
import Collapse from "@/components/index/collapse.vue";
import uiswiper from "@/components/index/swiper.vue";
export default {
components: {
uiswiper,
Collapse,
AddressSelect,
uiheader,
cmsearch,
cmempty,
cmswiper,
},
data() {
return {
isLogin: false,
sex: '',
isPick: false,
pickValue: '全部',
isLocation: false,
locationValue: '全国',
region: {
province: {
code: null,
name: null,
}
},
pageSize: 500,
goodsData: {
rows: []
},
keyword: '',
categoryTreeData: [],
cateIndex: [0, 0],
cateId: null,
};
},
methods: {
getCategoryTreeData() {
vk.callFunction({
url: 'client/spot/category/pub/getTree',
data: {},
success: (data) => {
this.categoryTreeData = data.rows
}
});
},
showAddress() {
this.$refs.AddressSelect.open(this.region, 1, true);
},
regionConfirm({province}) {
this.region = {province}
this.locationValue = `${province.name}`
this.search(1)
},
detailLink(id) {
vk.navigateTo(`/pages/goods/detail?id=${id}`);
},
handleChangeCate({indexs}) {
this.cateIndex = indexs
},
handConfirmPick({value}) {
this.pickValue = value[1].name
this.cateId = value[1]._id
this.isPick = false
this.search(1)
},
resetCate() {
this.cateIndex = [0, 0]
this.pickValue = '全部'
this.cateId = null
this.isPick = false
this.search(1)
},
async toRelease() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (accountNum === 0) {
uni.showModal({
title: '提示',
content: '请先到个人中心添加收款账户',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 7)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else {
vk.navigateTo({
url: '/pages/goods/publish'
})
}
},
async toMy() {
const {userInfo} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else this.$jump('/pages/goods/my')
},
afterSearch(keyword) {
this.keyword = keyword
this.search(1)
},
search(pageIndex) {
this.loading = true
vk.callFunction({
url: 'client/spot/goods/pub/getList',
title: '请求中...',
data: {
pageIndex: pageIndex,
pageSize: this.pageSize,
keyword: this.keyword,
categoryIds: this.cateId ? [this.cateId] : null,
// categoryIds: this.checkCategoryList,
provinceCodes: this.region.province.code ? [this.region.province.code] : null
},
success: (data) => {
this.loading = false
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
}
});
},
getCertUrl() {
vk.callFunction({
url: 'client/fadada.getVerifyUrl',
success: (res) => {
location.href = res.data.url
}
});
},
},
onLoad(option) {
if (option.keyword) this.keyword = option.keyword
this.getCategoryTreeData()
this.search()
}
}
</script>
<style lang="scss">
page {
}
.layout-pick {
// width: 690rpx;
height: 68rpx;
padding: 0 30rpx;
font-size: 24rpx;
line-height: 40rpx;
color: #4F4F4F;
.ip {
position: relative;
max-width: 50%;
height: 40rpx;
padding-right: 30rpx;
overflow: hidden;
box-sizing: border-box;
}
.down::after {
position: absolute;
right: 10rpx;
top: 50%;
z-index: 9;
content: '';
margin-top: -6rpx;
width: 0;
height: 0;
border-left: 10rpx solid transparent;
border-right: 10rpx solid transparent;
border-top: 12rpx solid #999999;
}
}
.layout-goods {
// width: 690rpx;
padding: 10rpx 30rpx;
.item {
position: relative;
margin-top: 10rpx;
padding: 10rpx 20rpx 20rpx;
border-radius: 12rpx;
.title {
width: 80%;
font-size: 30rpx;
font-weight: 600;
line-height: 48rpx;
color: #101010;
}
.link, .askfor {
position: absolute;
right: 20rpx;
top: 16rpx;
z-index: 9;
font-size: 24rpx;
line-height: 36rpx;
color: #A92924;
padding: 4rpx 8rpx;
}
.link {
border: 1px solid #A92924;
}
.text {
font-size: 24rpx;
line-height: 36rpx;
color: #999999;
}
.red {
margin-right: 20rpx;
color: #A92924;
}
.date {
font-size: 24rpx;
line-height: 36rpx;
color: #9a9a9a;
}
.company {
height: 40rpx;
.icon {
width: 40rpx;
height: 40rpx;
}
.text {
//width: 300rpx;
height: 40rpx;
font-size: 26rpx;
line-height: 40rpx;
color: #4f4f4f;
}
}
}
.item:nth-child(1) {
margin-top: 0 !important;
}
}
.red {
color: #A92924 !important;
}
.my {
position: fixed;
right: 30rpx;
bottom: 220rpx;
z-index: 99;
display: flex;
justify-content: center;
align-items: center;
width: 90rpx;
height: 90rpx;
border-radius: 50%;
background: white;
border: 1px solid #A92924;
}
.top {
position: absolute;
right: 0;
bottom: 0;
background-color: rgba(169, 41, 36, 1);
padding: 2px 5px;
border-radius: 5px 0 5px 0;
color: #FFFFFF;
font-size: 25rpx;
}
</style>
+183
View File
@@ -0,0 +1,183 @@
<template>
<view class="wrap">
<u-sticky offset-top="0" customNavHeight="0">
<uititle title="我发布的现货"></uititle>
</u-sticky>
<view class="issue" @click="toRelease">
<u-icon name="plus" color="#fff" size="24"></u-icon>
</view>
<view class="layout-goods">
<view class="goods-box p-top-10" v-if="list.length">
<view class="item bg-white" @click="detailLink(item._id)" v-for="(item, index) in list"
:key="index">
<view class="askfor">查看详情</view>
<view class="title text-single">{{ item.name }}</view>
<view class="text m-top-10">
<text class="red">库存:{{ parseInt(item.stock) }}吨</text>
<text>供货地:{{ item.address.province.name }}-{{ item.address.city.name }}</text>
</view>
<view class="flex justify-between align-center m-top-10">
<view class="company flex justify-center align-center flex-nowrap">
<view class="text flex-1 text-single" v-if="userInfo && userInfo.company">
{{ userInfo.company.companyName }}
</view>
</view>
</view>
<view class="date">{{ item._add_time_str }} 更新</view>
</view>
</view>
<u-empty v-else text="您未发布现货"></u-empty>
</view>
</view>
</template>
<script>
import uititle from '@/components/common/title'
export default {
name: "my",
components: {uititle},
data() {
return {
list: [],
userInfo: null
}
},
methods: {
detailLink(id) {
vk.navigateTo(`/pages/goods/detail?id=${id}`, {
id
});
},
async getList() {
const {rows} = await vk.callFunction({
url: 'client/spot/goods/kh/getSelfOne'
})
this.list = rows
},
async toRelease() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
uni.showModal({
title: '提示',
content: '您尚未认证, 是否前往认证?',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 0)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
uni.showModal({
title: '提示',
content: '请完善名片信息',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 1)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else if (accountNum === 0) {
uni.showModal({
title: '提示',
content: '请先到个人中心添加收款账户',
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 7)
uni.switchTab({url: '/pages/user/user'})
}
}
})
} else {
vk.navigateTo({
url: '/pages/goods/publish'
})
}
},
},
onShow() {
this.userInfo = vk.getStorageSync('uni_id_user_info')
this.getList()
}
}
</script>
<style lang="scss" scoped>
.layout-goods {
// width: 690rpx;
padding: 10rpx 30rpx;
.item {
position: relative;
margin-top: 30rpx;
padding: 10rpx 20rpx 20rpx;
border-radius: 12rpx;
.title {
width: 90%;
font-size: 30rpx;
font-weight: 600;
line-height: 48rpx;
color: #101010;
}
.link, .askfor {
position: absolute;
right: 20rpx;
top: 16rpx;
z-index: 9;
font-size: 24rpx;
line-height: 36rpx;
color: #A92924;
padding: 4rpx 8rpx;
}
.link {
border: 1px solid #A92924;
}
.text {
font-size: 24rpx;
line-height: 36rpx;
color: #999999;
}
.red {
margin-right: 20rpx;
color: #A92924;
}
.date {
font-size: 24rpx;
line-height: 36rpx;
color: #9a9a9a;
}
.company {
height: 40rpx;
.icon {
width: 40rpx;
height: 40rpx;
}
.text {
//width: 300rpx;
height: 40rpx;
font-size: 26rpx;
line-height: 40rpx;
color: #4f4f4f;
}
}
}
.item:nth-child(1) {
margin-top: 0 !important;
}
}
</style>
+372
View File
@@ -0,0 +1,372 @@
<template>
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<!-- 顶部 -->
<uititle title="发布现货"></uititle>
</u-sticky>
<view class="layout layout-publish m-top-20">
<view class="group flex align-center">
<view class="lb need m-right-20">现货名称:</view>
<view class="vl flex-1">
<u--input
disabled
placeholder="请输入内容"
border="surround"
v-model="formData.name"
></u--input>
</view>
</view>
<view class="tag-title m-top-30">
点击添加现货
<text class="limit">(至少选择1个现货,最多可选择5个现货)</text>
</view>
<view class="tag-box flex justify-start flex-wrap">
<view :class="['item', formData.categoryIds.includes(item._id) ? 'active' : '']"
style="flex: 0 0 30%"
v-for="(item,index) in goodsCate" :key="index"
@click="handTag(item)">{{ item.name }}
</view>
</view>
<view class="group flex align-center">
<view class="lb need m-right-20">库存约:</view>
<view class="vl" style="width: 300rpx;">
<u--input
placeholder="请输入内容"
border="surround"
v-model="formData.stock"
></u--input>
</view>
<view class="fix m-left-20">吨</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">供货地:</view>
<view class="vl flex-1" @click="showAddress">
<u--input
readonly
placeholder="请选择"
border="surround"
v-model="address"
suffixIcon="arrow-down"
style="pointer-events:none"
>
</u--input>
</view>
</view>
<view class="group m-top-30">
<view class="lb m-right-20">产品规格单价:</view>
<view class="m-top-30">
<u-upload
accept="file"
:fileList="formData.files"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="10"
></u-upload>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">报价有效期:</view>
<view class="vl flex-1" @click.native="isPickDate = true">
<u--input
style="pointer-events:none"
readonly
placeholder="请输入内容"
suffixIcon="calendar"
v-model="formData.answerEndTime"
></u--input>
</view>
</view>
<view class="group m-top-30">
<view class="lb m-right-20">产品现场图片:</view>
<view class="m-top-30">
<u-upload
accept="image"
:fileList="formData.images"
@afterRead="afterReadImages"
@delete="deletePicImages"
multiple
:maxCount="10"
></u-upload>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">是否购买全国广告位:</view>
<view class="vl flex-1">
<u-switch v-model="formData.buyAll" @change="getAmount(true)"></u-switch>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">是否购买省份广告位:</view>
<view class="vl flex-1">
<u-switch v-model="formData.buyTop"
:disabled="address === '' || totalAmount === 0"
@change="getAmount()"></u-switch>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">购买广告位时长(月):</view>
<view class="vl flex-1">
<u-number-box v-model="formData.buyTopNum"></u-number-box>
</view>
</view>
<p class="text-main text-25 my-20" v-if="formData.buyAll">您已选择购买全国广告位,无法继续购买省份广告位</p>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">广告位价格:</view>
<view class="vl flex-1">
{{ totalAmount }}元
</view>
</view>
<u-button class="public-btn" text="提交" @click.native="add"></u-button>
</view>
<AddressSelect ref="AddressSelect" @confirm="regionConfirm"/>
<u-datetime-picker :show="isPickDate" v-model="answerEndTime" mode="date"
:minDate="minDate" @cancel="isPickDate = false"
@confirm="handConfirmDate"></u-datetime-picker>
</view>
</template>
<script>
import uititle from '@/components/common/title'
import AddressSelect from "@/components/AddressSelect.vue";
import dayjs from 'dayjs'
export default {
components: {
AddressSelect,
uititle,
},
data() {
return {
tagIndex: -1,
fileList1: [],
formData: {
name: '',
stock: '',
answerEndTime: '',
buyTop: false,
buyAll: false,
buyTopNum: 1,
categoryIds: [],
files: [],
images: [],
address: {}
},
address: '',
amount: '',
answerEndTime: '',
goodsCate: [],
isPickDate: false,
minDate: Number(new Date()),
};
},
methods: {
handConfirmDate({value}) {
this.formData.answerEndTime = dayjs(value).format('YYYY-MM-DD')
this.isPickDate = false
},
changeBuyAll(val) {
if (val && this.formData.buyTop) this.formData.buyTop = false
},
handTag(val) {
const index = this.formData.categoryIds.findIndex(item => item === val._id)
if (index === -1 && this.formData.categoryIds.length === 5) return this.$message.error('最多选择五个分类')
if (index === -1) this.formData.categoryIds.push(val._id)
else this.formData.categoryIds.splice(index, 1)
this.formData.name = this.formData.categoryIds.map(item => this.goodsCate.find(val => val._id === item).name).join('、')
},
afterRead({file}) {
file.forEach(item => {
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + item.name,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.files.push({
url: res.fileList[0].tempFileURL,
name: item.name
})
})
}
})
})
},
deletePic({index}) {
this.formData.files.splice(index, 1)
},
afterReadImages({file}) {
file.forEach(item => {
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + item.name,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.images.push({
url: res.fileList[0].tempFileURL,
name: item.name
})
})
}
})
})
},
deletePicImages({index}) {
this.formData.images.splice(index, 1)
},
async getGoodsCate() {
const {data} = await vk.callFunction({
url: 'client/spot/category/pub/getList',
data: {
whereJson: {
level: 2
}
}
});
this.goodsCate = data
},
showAddress() {
this.$refs.AddressSelect.open(this.address);
},
regionConfirm({province, city, area}) {
this.formData.address = {province, city, area}
this.address = `${province.name} ${city.name} ${area.name}`
this.getAmount()
},
async add() {
if (this.formData.categoryIds.length === 0) return this.$message.error('请选择分类')
if (!this.formData.stock) return this.$message.error('请填写库存')
if (JSON.stringify(this.formData.address) === '{}') return this.$message.error('请选择供货地')
this.formData.files = this.formData.files.map(i => i.url)
this.formData.images = this.formData.images.map(i => i.url)
const res = await vk.callFunction({
title: '请求中...',
url: 'client/spot/goods/kh/addUpdate',
data: this.formData
})
if (this.formData.buyTop || this.formData.buyAll) {
vk.navigateTo({
url: `/pages/shop/pay?id=${res.data}`
})
} else uni.redirectTo({url: '/pages/goods/goods'});
},
onFormSuccess(res) {
if (this.formData.buyTop) {
vk.navigateTo({
url: `/pages/shop/pay?id=${res.data.data}`
})
} else uni.redirectTo({url: '/pages/goods/goods'});
},
getAmount(isAll = false) {
this.amount = 0
if (!isAll && JSON.stringify(this.form1.data.address) === '{}') return
if (isAll) {
this.formData.buyTop = !this.formData.buyAll
}else {
this.formData.buyAll = !this.formData.buyTop
}
vk.callFunction({
url: 'client/spot/amount/pub/getDetail',
data: {
province: isAll ? -1 : this.form1.data.address.province.code,
},
success: (res) => {
if (res.data) {
this.amount = parseFloat(res.data.amount)
}
}
});
},
},
onLoad() {
this.getGoodsCate()
},
computed: {
totalAmount() {
let amount = 0
if (this.amount) amount = this.amount * this.formData.buyTopNum
return amount
}
}
}
</script>
<style lang="scss">
page {
background: #ffffff;
}
.public-btn {
width: 95%;
margin-top: 60rpx;
color: #ffffff;
background: #A92924;
}
.layout-publish {
padding: 20rpx 30rpx;
}
.tag-title {
font-size: 26rpx;
line-height: 40rpx;
color: #000000;
.limit {
font-size: 24rpx;
color: #999999;
}
}
.tag-box {
padding: 20rpx 0;
.item {
padding: 6rpx 10rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #555555;
}
.active {
color: #A92924;
}
}
.lb, .fix {
position: relative;
font-size: 26rpx;
line-height: 40rpx;
color: #666666;
}
.lbx {
font-size: 24rpx;
color: #999999;
}
.download {
padding: 8rpx 20rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #A92924;
border: 1px solid #A92924;
}
.need::before {
position: absolute;
left: -16rpx;
top: 50%;
z-index: 9;
margin-top: -12rpx;
content: '*';
color: #A92924;
font-size: 32rpx;
line-height: 1;
}
</style>