From 90a0ab46cba232a041eb2e4df79031d2d27314c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=82=93=E6=B4=81?= <209192278@qq.com>
Date: Sat, 18 Nov 2023 22:53:52 +0800
Subject: [PATCH] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E5=8F=91=E5=B8=83?=
=?UTF-8?q?=E6=89=BE=E5=BA=97=E5=9C=B0=E5=9D=80=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../publish/publishAddress/publishAddress.vue | 162 ++++++------------
.../publishTransfer/publishTransfer.vue | 2 +-
2 files changed, 54 insertions(+), 110 deletions(-)
diff --git a/pages/publish/publishAddress/publishAddress.vue b/pages/publish/publishAddress/publishAddress.vue
index 07e0219..7df2dc4 100644
--- a/pages/publish/publishAddress/publishAddress.vue
+++ b/pages/publish/publishAddress/publishAddress.vue
@@ -16,10 +16,6 @@
-
-
-
{{form.business}}
@@ -30,14 +26,18 @@
-
- {{form.commercial}}
- 请选择业态
+
+ {{form.commercialForm}}
+ 请选择业态
-
+
+ :columns="[Karmacolumns]" v-model="form.commercialForm" @confirm="karmaConfirm">
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -67,26 +68,19 @@
export default {
data() {
return {
- imageLength: '0',
- fileList1: [],
- regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
-
+ regionColumns: [],
form: {
title: '',
region: '',
- address: '',
business: '',
- commercial: '',
- transferFee:'',
+ commercialForm: '',
+ area: '',
+ transferFee: '',
rent: '',
- contact:'',
- mobile: '',
- content: '',
- // images: [],
- longitude: '',
- latitude: '',
+ contactPerson: '',
+ phone: '',
+ details: '',
id: '',
-
},
Classcolumns: [],
ClassCheckId: '',
@@ -111,22 +105,27 @@
message: '请选择地区',
trigger: ['change']
}],
- 'commercial': [{
+ 'commercialForm': [{
required: true,
message: '请选择业态',
trigger: ['change']
}],
+ 'area': [{
+ required: true,
+ message: '请输入面积',
+ trigger: ['change', 'blur']
+ }],
'transferFee': [{
required: true,
message: '请输入转让金',
trigger: ['change', 'blur']
}],
- 'contact': [{
+ 'contactPerson': [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
- 'content': [{
+ 'details': [{
required: true,
message: '请输入介绍',
trigger: ['change', 'blur']
@@ -141,12 +140,7 @@
message: '请输入租金',
trigger: ['change', 'blur']
}],
- 'address': [{
- required: true,
- message: '请输入地址',
- trigger: ['change', 'blur']
- }],
- 'mobile': [{
+ 'phone': [{
required: true,
message: '请输入电话号码',
},
@@ -162,101 +156,49 @@
trigger: ['change', 'blur'],
}
]
-
},
}
},
methods: {
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
preview(e) {
console.log('预览', e);
},
- // 新增图片
- async afterRead(event) {
- // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- console.log('lists[i].url', lists[i].url);
- const result = await this.uploadFilePromise(lists[i].url)
- console.log('result', result);
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- this.imageLength = fileListLen
- }
- },
- uploadFilePromise(filePath) {
- return new Promise((resolve, reject) => {
- const token = uni.getStorageSync('loginToken')
- const a = uni.uploadFile({
- url: this.$api.uploadImgUrl,
- filePath: filePath,
- name: 'file',
- header: {
- "Content-Type": "multipart/form-data",
- 'Authorization': token
- },
- success: (res) => {
- resolve(JSON.parse(res.data).data.url)
- }
- });
- })
- },
handleSearchAddress() {
uni.navigateTo({
url: '/pages/publish/chooseAddress/chooseAddress'
})
},
submit() {
- const temp = []
- if (this.fileList1.length > 0) {
- this.fileList1.map(item => {
- const url = item.url
- temp.push(url.replace(this.imgUrl + '/', ''))
- })
- }
- console.log('images---', temp.join(','));
this.$refs.uForm.validate().then(res => {
- console.log("提交表单信息:" + JSON.stringify(this.form))
- uni.$u.toast('发布成功')
+ console.log("提交表单信息:", this.form)
this.$api.publishAddress(this.form).then(res => {
- console.log(res);
+ console.log('发布找店地址', res);
+ if (res.data.code == 1) {
+ uni.$u.toast('发布成功')
+ } else {
+ uni.$u.toast(res.data.msg)
+ }
})
}).catch(errors => {
- console.log("失败信息:" + JSON.stringify(errors))
+ console.log("失败信息:", JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
},
- changeAddress(e) {
- // console.log('changeAddress', e);
- this.getAddressList(e)
+ choosecommercialForm() {
+ if (!this.form.business) {
+ uni.$u.toast('请先选择行业')
+ return false
+ } else {
+ this.show3 = true
+ }
},
- getAddressList(value) {
+ getRegionList() {
var that = this
uni.request({
- url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + value + '&key=' +
+ url: 'https://apis.map.qq.com/ws/district/v1/getchildren?id=' + uni.getStorageSync('city_code') + '&key=' +
that.$api.key,
success(res) {
- console.log('diz', res.data.result.location);
- // console.log('lat', res.data.result.location.lat);
- that.form.latitude = res.data.result.location.lat
- // console.log('lng', res.data.result.location.lng);
- that.form.longitude = res.data.result.location.lng
+ that.regionColumns = [res.data.result[0].map(item => item.fullname)]
},
fail(err) {
console.log('请求区域失败:', err);
@@ -276,7 +218,7 @@
},
karmaConfirm(e) {
this.show3 = false
- this.form.commercial = e.value[0]
+ this.form.commercialForm = e.value[0]
},
regionConfirm(e) {
this.show1 = false
@@ -288,6 +230,7 @@
},
onLoad() {
+ this.getRegionList()
this.$api.getClassList().then(res => {
// console.log(res.data.data.length);
this.Classcolumns = res.data.data.map((item) => {
@@ -336,6 +279,7 @@
.count {
margin-bottom: 30px;
}
+
// margin-right: 20px;
}
diff --git a/pages/publish/publishTransfer/publishTransfer.vue b/pages/publish/publishTransfer/publishTransfer.vue
index a8ee782..adc855e 100644
--- a/pages/publish/publishTransfer/publishTransfer.vue
+++ b/pages/publish/publishTransfer/publishTransfer.vue
@@ -41,7 +41,7 @@
{{form.commercial}}
请选择店铺业态
-
+