183 lines
4.3 KiB
Vue
183 lines
4.3 KiB
Vue
<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> |