Files
jjx-wap/pages/junk/publish.vue
T
2026-10-08 18:34:09 +08:00

147 lines
4.6 KiB
Vue

<template>
<view class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<uititle title="发布旧货信息"></uititle>
</u-sticky>
<u-tabs :list="tabList" @click="click"></u-tabs>
<view class="layout layout-publish m-top-10 bg-white p-30" v-if="user && pass">
<type_0 :urgentAmount="urgentAmount" :remainOldNum="remainOldNum" v-if="activeIndex === 0"
:buyOldNumAmount="buyOldNumAmount" :user="user" :unit-list="unitList"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
<type_1 :urgentAmount="urgentAmount" :remainOldNum="remainOldNum" v-if="activeIndex === 1"
:buyOldNumAmount="buyOldNumAmount" :user="user"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
<type_2 :urgentAmount="urgentAmount" :remainOldNum="remainOldNum" v-if="activeIndex === 2"
:buyOldNumAmount="buyOldNumAmount" :user="user"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
<type_3 :urgentAmount="urgentAmount" :remainOldNum="remainOldNum" :user="user" v-if="activeIndex === 3"
:buyOldNumAmount="buyOldNumAmount" :contactList="contactList"/>
</view>
</view>
</template>
<script>
import uititle from "@/components/common/title.vue";
import Type_0 from "./release/type_0.vue";
import Type_1 from "./release/type_1.vue";
import Type_2 from "./release/type_2.vue";
import Type_3 from "./release/type_3.vue";
import {getUserLevelLabel} from "@/util";
export default {
name: "publish",
components: {uititle, Type_3, Type_2, Type_1, Type_0},
data() {
return {
tabList: [{
name: '拍卖信息发布',
}, {
name: '采购信息发布',
}, {
name: '租赁信息发布'
}, {
name: '物资回收信息发布'
}],
activeIndex: 0,
urgentAmount: 1,
remainOldNum: 0,
buyOldNumAmount: 5,
agreement: '',
commonContractUrl: '',
contactList: [],
unitList: [],
user: null,
pass: false,
}
},
methods: {
click({index}) {
this.activeIndex = index
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
if (!this.contactList.length) {
return uni.showModal({
title: '提示',
content: '您还未添加联系人,请先添加联系人',
showCancel: false,
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 8)
uni.switchTab({url: '/pages/user/user'})
}
}
})
}
this.pass = true
},
async getUrgentAmount() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6587dd2fe0ec19027452c5b5'
},
})
this.urgentAmount = res.content
},
async getBuyOldAmount() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6587dd54189f86d49b3d5ff5'
},
})
this.buyOldNumAmount = res.content
},
async getUserInfo() {
const {userInfo} = await vk.userCenter.getCurrentUserInfo()
this.remainOldNum = userInfo.remainOldNum ? parseInt(userInfo.remainOldNum) : 0
this.user = userInfo
console.log(this.user)
},
async getUnitList() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: 'a45325976635f10600341a7f2f472cd1'
},
})
this.unitList = res.content.split(',')
},
},
async onShow() {
vk.userCenter.getCurrentUserInfo({
success: (data) => {
this.remainOldNum = data.userInfo.remainOldNum ? parseInt(data.userInfo.remainOldNum) : 0
if (this.remainOldNum === 0) {
this.$confirm('您的旧货发布次数已用完,是否立即购买?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const {data} = await vk.callFunction({
url: 'client/old/kh/buyNum',
})
vk.navigateTo({
url: `/pages/shop/pay?id=${data}`
})
}).catch(() => {
vk.navigateBack()
})
}
}
});
await this.getUserInfo()
await this.getContactList()
await this.getUrgentAmount()
await this.getBuyOldAmount()
// await this.getAgreement()
await this.getUnitList()
},
}
</script>