diff --git a/pages/index/fabu.vue b/pages/index/fabu.vue
index ad15f8c..49ffec0 100644
--- a/pages/index/fabu.vue
+++ b/pages/index/fabu.vue
@@ -1,6 +1,6 @@
-
+
@@ -10,8 +10,7 @@
标题
-
@@ -22,7 +21,8 @@
地区
- 河南
+ {{form.area}}
+
请选择地区
@@ -30,7 +30,7 @@
-
+
详细地址
@@ -48,8 +48,7 @@
联系人
-
@@ -60,8 +59,7 @@
联系电话
-
@@ -76,17 +74,15 @@
详细信息
-
-
+
-
+
+
-
+
项目类型
-
+
+
+ {{form.type||'请选择项目类型'}}
+
+
+
+
@@ -118,144 +123,150 @@
选择标签
- 河南
- 选择
+ 选择
+ 河南
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 确认发布
-
- 确认发布
-
-
-
-
-
-
-
- 《责任承诺确认书》
-
-
-
-
-
-
-
- 取消
- 我同意
- 我同意
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 我已阅读并同意
+ 《发布须知》
+
+
+
+ 确认发布
+
+
+
+
+
+
+ 《责任承诺确认书》
+
+
+
+
+
+
+
+ 取消
+ 我同意
+ 我同意
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -277,6 +288,9 @@
address,
region
} from '@/sheep/validate/form';
+ import {
+ baseUrl
+ } from '@/sheep/config';
const state = reactive({
showRegion: false,
@@ -293,59 +307,68 @@
address,
region,
},
+ formData: {
+ content: '',
+ phone: '',
+ images: [],
+ type: '',
+ },
+ imageFiles: [],
});
+ const popupStyle = {
+ width: '620rpx',
+ padding: '50rpx 40rpx 42rpx 40rpx',
+ height: '984rpx',
+ margin: '0 auto', // 水平居中
+ display: 'flex',
+ justifyContent: 'start',
+ alignItems: 'center',
+ flexColumn: 'column'
+ }
const proCity = ref('')
const form = ref({
- title: null,
+ title: '',
area: '',
- address_detail: null,
- content: null,
- stock: null,
- cate_idsName: null,
- address1: null,
- categoryId: null,
tags: '',
+ contacts: '',
+ contact_number: '',
+ content: '',
+ address_detail: '',
+ type: '',
+ images: '',
+ province: '',
+ city: '',
cate_ids: '',
- province: null,
- district: null,
- keywords: null,
+ cateName: '',
+ imageList: [],
})
+
const onRegionConfirm = (e) => {
console.log('onRegionConfirm', e);
state.model = {
...state.model,
...e,
};
- proCity.value = state.model.province_name + " " + state.model.city_name
+ form.value.area = state.model.province_name + " " + state.model.city_name
+
+ console.log('onRegionConfirm33', state.model, proCity.value);
+ form.value.province = state.model.province_id
+ form.value.city = state.model.city_id
console.log('onRegionConfirm33', state.model, proCity.value);
state.showRegion = false;
};
-
-
- const show = ref(false)
- const showPopbq = ref(false)
- const tagList = ref(false)
- const tagShowList = ref(false)
- const priceShow = ref(false)
- const cardShow = ref(false)
- const list = ref([]);//已选择标签
- const current = ref();
+ const show = ref(false) //发布须知显隐
+ const agreeAdd = ref(false) //同意须知的勾选
+ const agreeShow = ref(false) //须知的同意按钮
+ const Negotiate = ref('') //富文本
+ const cardShow = ref(false) //身份认证
const status = ref(0)
-
onShow(() => {
getTagList();
+ getTypeList();
})
-
- //标签
- function openPopbq() {
- showPopbq.value = true;
- // getTagList();
- }
- function closebq() {
- showPopbq.value = false;
- }
async function getTagList() {
const res = await sheep.$api.rent.tagsList({});
if (res.code == 1) {
@@ -363,58 +386,226 @@
console.log('tagList', tagList.value, tagShowList.value);
}
}
+ async function getTypeList() {
+ const res = await sheep.$api.rent.listType({});
+ if (res.code == 1) {
+ typeList.value = res.data
+ typeShowList.value = Object.values(typeList.value)
+ console.log('typeList', typeList.value, typeShowList.value);
+ }
+ }
+
+
+ //项目类型
+ const showType = ref(false)
+ const typeList = ref([])
+ const typeShowList = ref([])
+ const typeName = ref('')
+ const typeIndex = ref(0); //已选择项目类型
+ function closeType() {
+ console.log('取消type', typeIndex.value);
+ showType.value = false
+ }
+
+ function selectType(e) {
+ console.log('选择项目类型', e);
+ typeIndex.value = e.detail.value;
+ form.value.type = typeShowList.value[typeIndex.value];
+ showType.value = false;
+ }
+
+
+ //标签
+ const showPopbq = ref(false)
+ const tagList = ref([])
+ const tagShowList = ref([])
+ const selectTagslist = ref([]); //已选择标签
+ const tagSelectedNum = ref(0)
+
+ function openPopbq() {
+ showPopbq.value = true;
+ }
+
+ function closebq() {
+ showPopbq.value = false;
+ }
//选中标签
function addbq(item, index) {
- current.value = index;
-
- console.log('选择标签',current.value);
- tagShowList.value[current.value].isSelect = true
- // let arrbql = uni.getStorageSync("zjlist");
- // let arrbq = JSON.parse(arrbql);
- // let isbq = true;
- // for (let i = 0; i < arrbq.length; i++) {
- // if (arrbq[i].id == val.id) {
- // uni.showToast({
- // title: "已选择该标签",
- // icon: "none",
- // duration: 2000,
- // });
- // return isbq = false;
- // }
- // }
- // if (list.value.length < 3) {
- // if (isbq) {
- // list.value.push(val);
- // uni.setStorageSync('zjlist', JSON.stringify(list.value))
- // }
- // } else {
- // uni.showToast({
- // title: "最多添加3个标签",
- // icon: "none",
- // duration: 2000,
- // });
- // }
- // let arr = list.value.map((item) => {
- // return item.name
- // })
- // form.value.cate_idsName = arr.join(',');
+ if (tagShowList.value[index].isSelect == false) {
+ if (tagSelectedNum.value < 3) {
+ tagSelectedNum.value += 1;
+ tagShowList.value[index].isSelect = true;
+ } else {
+ uni.showToast({
+ title: '最多选择三个标签',
+ icon: 'none'
+ })
+ }
+ } else {
+ if (tagSelectedNum.value > 0) {
+ tagSelectedNum.value -= 1;
+ tagShowList.value[index].isSelect = false;
+ } else {
+ uni.showToast({
+ title: '至少选择一个',
+ icon: 'none'
+ })
+ }
+ }
+ console.log('选择标签', tagSelectedNum.value);
}
- //删除标签(本地)
- function removebq(i) {
- list.value.splice(i, 1);
- uni.setStorageSync('zjlist', JSON.stringify(list.value))
- let arr = list.value.map((item) => {
- return item.name
- })
- form.value.cate_idsName = arr.join(',')
- }
-
+
function checkTagTrue() {
console.log('确定选择的标签');
+ selectTagslist.value = []
+ for (let i = 0; i < tagShowList.value.length; i++) {
+ if (tagShowList.value[i].isSelect == true) {
+ selectTagslist.value.push(tagShowList.value[i])
+ }
+ }
+ console.log('selectTagslist', selectTagslist.value);
+ showPopbq.value = false
+ }
+
+ //删除标签(本地)
+ function removebq(i) {
+ selectTagslist.value.splice(i, 1);
+ tagSelectedNum.value -= 1;
+ console.log('删除标签', tagSelectedNum.value);
+ let arr = selectTagslist.value.map((item) => {
+ return item.name
+ })
+ }
+
+ function change() {
+ agreeAdd.value = true;
+ show.value = false
+ }
+ //同意
+ function handleScroll() {
+ console.log(123)
+ agreeShow.value = true
+ }
+
+ function apply() {
+ if (agreeAdd.value == false) {
+ uni.showToast({
+ title: '请先同意发布须知',
+ icon: 'none',
+ })
+ return
+ }
+ form.value.cate_ids = selectTagslist.value.map((item) => item.id).join(',')
+ console.log('cate_ids', form.value.cate_ids, state.formData.images);
+
+ form.value.images = state.formData.images.join(',');
+ console.log('images', form.value.images);
+
+ if (form.value.title == '') {
+ uni.showToast({
+ title: '请输入标题',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.province == '' && form.value.city == '') {
+ uni.showToast({
+ title: '请选择地区',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.address_detail == '') {
+ uni.showToast({
+ title: '请输入详细地址',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.contacts == '') {
+ uni.showToast({
+ title: '请输入联系人',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.contact_number == '') {
+ uni.showToast({
+ title: '请输入联系人电话',
+ icon: 'none',
+ })
+ return
+ }
+ if (!/^1[3-9]\d{9}$/.test(form.value.contact_number)) {
+ uni.showToast({
+ title: '请输入正确的手机号',
+ icon: 'none',
+ duration: 2000
+ })
+ return;
+ }
+ if (form.value.content == '') {
+ uni.showToast({
+ title: '请输入详细信息',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.images == '') {
+ uni.showToast({
+ title: '请上传图片',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.type == '') {
+ uni.showToast({
+ title: '请选择项目类型',
+ icon: 'none',
+ })
+ return
+ }
+ if (form.value.cate_ids == '') {
+ uni.showToast({
+ title: '请选择标签',
+ icon: 'none',
+ })
+ return
+ }
+ console.log('apply——form:', form.value);
}