Merge branch 'lj'

# Conflicts:
#	service/request.js
This commit is contained in:
LuoShijie
2023-11-18 23:07:21 +08:00
11 changed files with 1075 additions and 528 deletions

View File

@@ -1,90 +1,189 @@
<template>
<<template>
<view>
<u-form>
<view class="name">
<text class="text">名称</text>
<u-input v-model="form.name" placeholder="请输入姓名" placeholder-class="input-class" border="bottom" color="#A0A0A0"></u-input>
</view>
<view class="id">
<text class="text">身份证号</text>
<u-input v-model="form.idcode" placeholder="请输入身份证号码" placeholder-class="input-class" border="bottom" color="#A0A0A0"></u-input>
</view>
<view class="payment" @click="show = true">
<view class="left-payment">
<text class="text">支付信息</text>
<text class="label">请选择支付方式</text>
</view>
<u-icon name="arrow-right" size="30px" top="10rpx"></u-icon>
</view>
<u-divider></u-divider>
<u-picker mode="region" :show="show" :closeOnClickOverlay="true" @close="show = false" :columns="columns" @confirm="confirmCheckWay"></u-picker>
</u-form>
<view class="submit-btn">
<u-button @click="submit" color="linear-gradient(to right, #E86262, #CC3333)" :size="normal" shape="circle" class="submit-btn">提交审核</u-button>
<view v-if="member!=2">
<view class="name">
<text class="text">名称</text>
<u-input v-model="submitForm.real_name" placeholder="请输入姓名" placeholder-class="input-class" border="bottom"
color="#A0A0A0" :disabled="disabled" disabledColor="#ffffff"></u-input>
</view>
<view class="id">
<text class="text">身份证号</text>
<u-input v-model="submitForm.idcard" placeholder="请输入身份证号码" placeholder-class="input-class" border="bottom"
color="#A0A0A0" :disabled="disabled" disabledColor="#ffffff"></u-input>
</view>
</view>
<view v-if="member==2" class="hhr">
<image src="../../static/my/hz_bj.png" mode="aspectFit" style="width: 247rpx;height: 189rpx;"></image>
<view class="hhr-text">已是合伙人</view>
</view>
<view class="submit-btn">
<button v-if="member==2" open-type="contact" session-from="sessionFrom" class="service-btn">
联系客服
</button>
<u-button v-else @click="submit" :color="color" :size="normal" shape="circle" class="submit-btn"
:disabled="btnDisabled">{{btnText}}</u-button>
</view>
<u-modal :show="show" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
<rich-text :nodes="content"></rich-text>
</u-modal>
</view>
</template>
<script>
import form from 'uview-ui/libs/config/props/form';
export default {
data() {
return {
color: '#CC3333',
btnText: '提交审核',
member: '',
show: false,
submitForm:{
name:'',
idcode:''
disabled: false,
btnDisabled: false,
content: `申请已提交, 请等待后台审核`,
submitForm: {
real_name: '',
idcard: ''
}
}
},
onShow() {
this.getInfo()
},
methods: {
submit(){
console.log('提交',form);
//this.$u.api.submit( this.form )
uni.$u.toast('提交成功')
getInfo() {
this.$api.getUser().then(res => {
var data = res.data.data
if (data) {
this.member = data.member
if (data.member == 1) {
this.disabled = true
this.btnDisabled = true
this.color = "#C6C6C6"
this.btnText = "审核中…"
}
// else if (data.member == 2) {
// this.disabled = false
// this.btnDisabled = false
// this.color = "#CC3333"
// this.btnText = "联系客服"
// }
}
})
},
confirmCheckWay(e){
confirm() {
uni.reLaunch({
url: '/pages/my/my'
})
// if (this.needAsk == 1) {
// uni.reLaunch({
// url: '/pages/index/index'
// })
// }
},
submit() {
if (this.member == 0) {
let reg =
/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; //正则表达式定义身份证号正确格式
if (!reg.test(this.submitForm.idcard)) { //判断身份证号格式时候正确
this.$toast.warn('请输入正确的身份证号格式')
return false
}
if (this.submitForm.real_name == "") {
this.$toast.warn('请完善数据')
return false
}
if (this.submitForm.real_name && this.submitForm.idcard) {
let data = {
...this.submitForm,
uid: uni.getStorageSync('uid')
}
console.log('成', data);
this.$api.toBePartner(data).then(res => {
if (res.data.msg == "提交成功") {
this.show = true
}
})
}
} else if (this.member == 2) {
console.log('联系客服');
}
}
}
}
</script>
<style>
.input-class{
font-weight:1rpx;
color: #A0A0A0;
<style lang="scss">
.service-btn {
height: 40px;
background-color: #CC3333;
color: #fff;
border-radius: 25px;
font-size: 32rpx;
}
.submit-btn{
.hhr {
margin-top: 50rpx;
margin-bottom: 50rpx;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.hhr-text {
margin-top: 28rpx;
width: 186rpx;
height: 50rpx;
font-size: 36rpx;
font-family: PingFang-SC, PingFang-SC;
font-weight: 800;
color: #F20C0C;
line-height: 50rpx;
letter-spacing: 1px;
}
}
.u-modal__button-group__wrapper--hover {
background: #0EBB5B !important;
}
.input-class {
font-weight: 1rpx;
color: #A0A0A0;
}
.submit-btn {
width: 80%;
margin-top: 50rpx;
translate: 10%;
}
.text{
margin-left: 20rpx;
.name,
.id {
padding: 10rpx;
}
.payment{
.text {
margin-left: 20rpx;
}
.payment {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
}
.left-payment{
.left-payment {
display: flex;
flex-direction: column;
}
.label{
.label {
margin-top: 10rpx;
margin-left: 17rpx;
margin-left: 17rpx;
color: #c1c1c1;
/* font-size: 27rpx; */
}
</style>
</style>

View File

@@ -1,7 +1,7 @@
<template>
<view class="detail" ref="viewref">
<view class="swiper">
<u-swiper :list="shopInfo.pics" keyName="pics" height="500rpx" radius="0"></u-swiper>
<u-swiper :list="shopInfo.pics" height="500rpx" radius="0"></u-swiper>
</view>
<view class="sub-detail u-flex">
<view class="title">
@@ -100,7 +100,17 @@
this.$api.getShopDetail(type, id).then(res => {
const data = res.data.data
if (res.data.code == 1) {
data.pics = [this.$api.imgUrl + data.pics]
console.log('data.pics', data.pics);
var arr = [];
var arr1 = [];
let obj = {}
arr = data.pics.split(",")
arr.map(item => {
obj = this.$api.imgUrl + item
arr1.push(obj)
})
data.pics = arr1
console.log('arr', arr1);
this.shopInfo = data
}
})

View File

@@ -8,12 +8,12 @@
</view>
</view> -->
<view class="content">
<map id="map" @markertap="markerClick" @regionchange="handleRegionChange()" :markers="marker"
:show-location="true" :latitude="lat" :longitude="lng" :show-scale="true"></map>
<map id="map" @markertap="markerClick" @regionchange="handleRegionChange()" :markers="marker" show-location="true"
:latitude="lat" :longitude="lng" :show-scale="true"></map>
</view>
<!-- <view class="down-shop">
<view class="down-shop" v-if="showShop">
<ShowShopListItem :shopInfo="shopList" :is-adshow="true" :show-style="0"></ShowShopListItem>
</view> -->
</view>
</view>
</template>
@@ -22,6 +22,7 @@
data() {
return {
radius: '',
showShop: false,
scaleM: [{
scale: 3,
milo: 1000000
@@ -82,29 +83,40 @@
}
],
scale: '',
lat: '30.48772', //纬度
lng: '104.080145', //经度
marker: [{ //用户当前位置
id: 1,
latitude: 30.48772,
longitude: 104.080145,
iconPath: '../../../static/map/sp_icon_dw.png',
width: '58rpx',
height: '72rpx',
rotate: 0,
alpha: 1
},
//周围标记点
{
id: 2,
latitude: 30.488573,
longitude: 104.081248,
// iconPath: '../../../static/map/sp_icon_dw.png',
width: '58rpx',
height: '72rpx',
rotate: 0,
alpha: 1
}
lat: uni.getStorageSync('latitude'), //纬度
lng: uni.getStorageSync('longitude'), //经度
marker: [
// { //用户当前位置
// id: 1,
// latitude: uni.getStorageSync('latitude'),
// longitude: uni.getStorageSync('longitude'),
// // iconPath: '../../../static/map/sp_icon_hdw.png',
// width: '58rpx',
// height: '72rpx',
// rotate: 0,
// alpha: 1
// },
// { //用户当前位置
// id: 2,
// latitude: 30.48772,
// longitude: 104.080145,
// iconPath: '../../../static/map/sp_icon_dw.png',
// width: '58rpx',
// height: '72rpx',
// rotate: 0,
// alpha: 1
// },
// //周围标记点
// {
// id: 2,
// latitude: 30.488573,
// longitude: 104.081248,
// // iconPath: '../../../static/map/sp_icon_dw.png',
// width: '58rpx',
// height: '72rpx',
// rotate: 0,
// alpha: 1
// }
],
shopList: {
shopid: 1,
@@ -149,9 +161,10 @@
},
watch: {
scale(newVal, oldVal) {
console.log('thisscale',newVal, Math.round(newVal));
let ra=''
this.scaleM.forEach(item => {
console.log('thisscale', newVal, Math.round(newVal));
this.showShop = false
let ra = ''
this.scaleM.forEach(item => {
if (item.scale == Math.round(newVal)) {
ra = item.milo
}
@@ -168,35 +181,63 @@
}
},
created() {
this.getMapList()
// this.getMapList()
},
methods: {
getDetail(type, id) {
this.$api.getShopDetail(type, id).then(res => {
console.log('详情', res);
const data = res.data.data
if (res.data.code == 1) {
this.shopList = data
// {
// shopid: 1,
// pics: this.$api.imgUrl + data.pics,
// tt: data.tt,
// num: data.num,
// zujin: data.zujin,
// date: data.update_time,
// area1: data.area1,
// address: data.address,
// mianji: data.mianji,
// zhuanrangfei: "转让费:" + data.zhuanrangfei,
// trade: data.trade,
// lianxiren: data.lianxiren,
// mobile: data.mobile,
// }
// data.pics = [this.$api.imgUrl + data.pics]
// this.shopInfo = data
}
})
},
handleRegionChange(e) {
console.log('地图缩放层级变化, 只能监听拖拽, 不能监听缩放', e);
},
getMapList(radius) {
console.log('this.radius',radius);
console.log('longitude', uni.getStorageSync('longitude'));
console.log('latitude', uni.getStorageSync('latitude'));
const realData = {
longitude: uni.getStorageSync('longitude'),
latitude: uni.getStorageSync('latitude'),
radius: 100
radius: radius * 1000
}
console.log('realData.radius', realData.radius);
const mockData = {
longitude: 23.40,
latitude: 116.38,
radius: 1111111111
}
this.$api.getMap(mockData).then(res => {
this.$api.getMap(realData).then(res => {
console.log('getMap', res);
let obj = {}
let arr = []
if (res.statusCode === 200) {
if (res.data.code == 1) {
res.data.data.forEach(item => {
obj = {
id: parseInt(item.id),
latitude: item.lat,
longitude: item.lng,
// iconPath: '../../../static/map/sp_icon_dw.png',
iconPath: '../../../static/map/sp_icon_dw.png',
width: '58rpx',
height: '72rpx',
rotate: 0,
@@ -204,7 +245,18 @@
}
arr.push(obj)
})
// this.marker=arr
this.marker = [{ //用户当前位置
id: 1,
latitude: realData.latitude,
longitude: realData.longitude,
iconPath: '../../../static/map/sp_icon_hdw.png',
width: '58rpx',
height: '72rpx',
rotate: 0,
alpha: 1
},
...arr,
]
console.log('this.marker', this.marker);
}
})
@@ -212,12 +264,20 @@
// 图标点击
markerClick(e) {
console.log('标记点击', e);
this.showShop = true
let markerId = e.markerId; //点击标记点, 获取id, 查询店铺详情, 展示在下方
this.getDetail(1, markerId)
this.marker.forEach(item => {
if (markerId === item.id) {
item.iconPath = ""
console.log('变红');
item.iconPath = "../../../static/map/sp_icon_hdw.png"
item.width = '58rpx'
item.height = '72rpx'
} else {
console.log('变绿');
item.iconPath = "../../../static/map/sp_icon_dw.png"
item.width = '58rpx'
item.height = '72rpx'
}
})
},

View File

@@ -7,10 +7,11 @@
<u-avatar :src="src" size="100rpx"></u-avatar>
</view>
<view class="username">{{username}}</view>
<image v-if="member==2" src="../../static/my/wo_icon_hhr.png" mode="aspectFit"
style="width: 115rpx;height: 34rpx;"></image>
<view class="account">账号:{{account}}
<u-icon name="edit-pen" class="edit-icon" size="20" color="#fff" @click="toEdit"></u-icon>
</view>
</view>
<view class="publish">
<u-cell-group>
@@ -45,8 +46,9 @@
data() {
return {
src: 'https://cdn.uviewui.com/uview/album/2.jpg',
account: '123',
username: '用户名',
account: '',
username: '',
member: '',
isLoad: true
}
},
@@ -56,6 +58,7 @@
return
}
this.isLoad = true
this.getInfo()
},
methods: {
reOnLoad() {
@@ -65,7 +68,7 @@
return
}
this.isLoad = true
if(this.isLoad){
if (this.isLoad) {
this.getInfo()
}
},
@@ -101,7 +104,10 @@
if (data) {
this.src = this.$api.imgUrl + data.avatar
this.username = data.nickname
this.member = data.member
this.account = data.sn
uni.setStorageSync("uid", data.user_id)
uni.setStorageSync("member", data.member)
}
})
}
@@ -119,7 +125,7 @@
justify-content: center;
align-items: center;
flex-direction: column;
gap: 10rpx;
// gap: 10rpx;
.profile-bgi {
position: absolute;

View File

@@ -2,53 +2,59 @@
<view class="form">
<u-form :model="form" ref="uForm">
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
</view>
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
v-model="form.region" @confirm="regionConfirm"></u-picker>
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
</view>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="karma">
<text @click="show3 = true" class="checkedtext" v-if="form.karma.length>0">{{form.karma}}</text>
<text @click="show3 = true" class="checktext" v-else>请选择业态</text>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercialForm">
<text @click="choosecommercialForm" class="checkedtext"
v-if="form.commercialForm.length>0">{{form.commercialForm}}</text>
<text @click="choosecommercialForm" class="checktext" v-else>请选择业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
<u-icon name="arrow-right" size="30px" @click="choosecommercialForm"></u-icon>
</view>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false" :columns="[Karmacolumns]"
v-model="form.karma" @confirm="karmaConfirm"></u-picker>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
:columns="[Karmacolumns]" v-model="form.commercialForm" @confirm="karmaConfirm"></u-picker>
</u-form-item>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="size">
<u-input v-model="form.size" placeholder="请输入面积" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="area">
<u-input v-model="form.area" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="预计投资" label-position="top" border-bottom="true" label-width="auto" prop="transferFee">
<u-input v-model="form.transferFee" placeholder="请输入预计投资" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
<u-input v-model="form.rent" placeholder="请输入租金" placeholder-class="input-class" border="none"></u-input>
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="预计投资" label-position="top" border-bottom="true" label-width="auto" prop="sell">
<u-input v-model="form.sell" placeholder="请输入预计投资" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contactPerson">
<u-input v-model="form.contactPerson" placeholder="请输入联系人姓名" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="phone">
<u-input v-model="form.phone" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="introduce">
<u-input v-model="form.introduce" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="details">
<u-input v-model="form.details" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
</u-form>
<view class="bug-figure"></view>
@@ -62,31 +68,24 @@
export default {
data() {
return {
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
ShopInfomation: {
city: '',
area: '',
count: 0,
},
regionColumns: [],
form: {
title: '',
region: '',
place: '',
trade: '',
karma: '',
size: '',
business: '',
commercialForm: '',
area: '',
transferFee: '',
rent: '',
sell: '',
name: '',
call: '',
introduce: ''
contactPerson: '',
phone: '',
details: '',
id: '',
},
Classcolumns: [],
ClassCheckId:'',
ClassCheckId: '',
Karmacolumns: [],
pid:[],
pid: [],
show1: false,
show2: false,
show3: false,
@@ -96,37 +95,42 @@
message: '请输入标题',
trigger: ['change', 'blur']
}],
'trade': [{
'business': [{
required: true,
message: '请选择行业',
trigger: ['change', 'blur']
trigger: ['change']
}],
'region': [{
required: true,
message: '请选择地区',
trigger: ['change', 'blur']
trigger: ['change']
}],
'karma': [{
'commercialForm': [{
required: true,
message: '请选择业态',
trigger: ['change', 'blur']
trigger: ['change']
}],
'name': [{
'area': [{
required: true,
message: '请输入姓名',
message: '请输入面积',
trigger: ['change', 'blur']
}],
'sell': [{
'transferFee': [{
required: true,
message: '请输入转让金',
trigger: ['change', 'blur']
}],
'introduce': [{
'contactPerson': [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
'details': [{
required: true,
message: '请输入介绍',
trigger: ['change', 'blur']
}],
'size': [{
'area': [{
required: true,
message: '请输入面积',
trigger: ['change', 'blur']
@@ -136,31 +140,29 @@
message: '请输入租金',
trigger: ['change', 'blur']
}],
'place': [{
required: true,
message: '请输入地址',
trigger: ['change', 'blur']
}],
'call':[{
required: true,
message: '请输入电话号码',
},
{
validator: (rule, value, callback) => {
if(value) {
return this.$u.test.mobile(value);
} else {
return true
}
'phone': [{
required: true,
message: '请输入电话号码',
},
message: '号码不正确',
trigger: ['change','blur'],
}]
{
validator: (rule, value, callback) => {
if (value) {
return this.$u.test.mobile(value);
} else {
return true
}
},
message: '号码不正确',
trigger: ['change', 'blur'],
}
]
},
}
},
methods: {
preview(e) {
console.log('预览', e);
},
handleSearchAddress() {
uni.navigateTo({
url: '/pages/publish/chooseAddress/chooseAddress'
@@ -168,40 +170,68 @@
},
submit() {
this.$refs.uForm.validate().then(res => {
console.log("提交表单信息:" + JSON.stringify(this.form))
uni.$u.toast('发布成功')
// 调用服务端入表接口W
console.log("提交表单信息:", this.form)
this.$api.publishAddress(this.form).then(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('校验失败')
})
},
tradeConfirm(e){
choosecommercialForm() {
if (!this.form.business) {
uni.$u.toast('请先选择行业')
return false
} else {
this.show3 = true
}
},
getRegionList() {
var that = this
uni.request({
url: 'https://apis.map.qq.com/ws/district/v1/getchildren?id=' + uni.getStorageSync('city_code') + '&key=' +
that.$api.key,
success(res) {
that.regionColumns = [res.data.result[0].map(item => item.fullname)]
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
tradeConfirm(e) {
this.show2 = false
this.form.trade = e.value[0]
this.form.business = e.value[0]
this.ClassCheckId = this.pid[e.indexs[0]]
this.$api.getClassList(this.ClassCheckId).then(res => {
// console.log(res);
this.Karmacolumns = res.data.data.map((item) => {
return item = item.name
})
return item = item.name
})
})
},
karmaConfirm(e){
karmaConfirm(e) {
this.show3 = false
this.form.karma = e.value[0]
this.form.commercialForm = e.value[0]
},
regionConfirm(e){
regionConfirm(e) {
this.show1 = false
this.form.region = e.value[0]
},
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
onLoad() {
this.$api.getClassList().then(res =>{
this.getRegionList()
this.$api.getClassList().then(res => {
// console.log(res.data.data.length);
this.Classcolumns = res.data.data.map((item) => {
return item = item.name
@@ -209,15 +239,15 @@
this.pid = res.data.data.map((item) => {
return item = item.id
})
})
},
computed:{
isChecked(index){
if(index.length > 0)
return true;
computed: {
isChecked(index) {
if (index.length > 0)
return true;
else
return false;
return false;
}
}
}
@@ -244,7 +274,12 @@
justify-content: center;
align-items: center;
background-color: #F8F8F8;
height: 300rpx;
// height: 300rpx;
.count {
margin-bottom: 30px;
}
// margin-right: 20px;
}
@@ -267,12 +302,14 @@
font-weight: 1px;
color: #c1c4c7;
}
.checkedtext{
.checkedtext {
margin-top: 5rpx;
font-size: 28rpx;
font-weight: 1px;
border-style: none;
}
.picker {
display: flex;
justify-content: space-between;

View File

@@ -2,52 +2,50 @@
<view class="form">
<u-form :model="form" ref="uForm">
<view class="upload">
<u-upload max-count="5" upload-icon="photo"></u-upload>
<text class="count">发布房源图片({{ShopInfomation.count}}/5)</text>
<view style="padding-left: 20rpx;margin-top: 20rpx;">
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
multiple :maxCount="5" :on-preview="preview"></u-upload>
</view>
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
<text class="count">发布房源图片({{imageLength}}/5)</text>
</view>
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="项目标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place" label-width="auto">
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="changeAddress"></u-input>
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
</view>
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
v-model="form.region" @confirm="regionConfirm"></u-picker>
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择行业</text>
<u-form-item label="项目地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="changeAddress"></u-input>
</u-form-item>
<u-form-item label="项目行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择项目行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
</view>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="karma">
<text @click="show3 = true" class="checkedtext" v-if="form.karma.length>0">{{form.karma}}</text>
<text @click="show3 = true" class="checktext" v-else>请选择业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
</view>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false" :columns="[Karmacolumns]"
v-model="form.karma" @confirm="karmaConfirm"></u-picker>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contact">
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="introduce">
<u-input v-model="form.introduce" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
<u-input v-model="form.content" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
</u-form>
<view class="bug-figure"></view>
@@ -61,31 +59,28 @@
export default {
data() {
return {
imageLength: '0',
fileList1: [],
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
ShopInfomation: {
city: '',
area: '',
count: 0,
},
form: {
title: '',
region: '',
place: '',
trade: '',
karma: '',
size: '',
rent: '',
sell: '',
name: '',
call: '',
introduce: ''
address: '',
business: '',
mobile: '',
contact:'',
content: '',
images: [],
longitude: '',
latitude: '',
id: '',
},
Classcolumns: [],
ClassCheckId:'',
ClassCheckId: '',
Karmacolumns: [],
pid:[],
pid: [],
show1: false,
show2: false,
show3: false,
@@ -95,76 +90,127 @@
message: '请输入标题',
trigger: ['change', 'blur']
}],
'trade': [{
'business': [{
required: true,
message: '请选择行业',
trigger: ['change', 'blur']
trigger: ['change']
}],
'region': [{
required: true,
message: '请选择地区',
trigger: ['change', 'blur']
trigger: ['change']
}],
'karma': [{
required: true,
message: '请选择业态',
trigger: ['change', 'blur']
}],
'name': [{
'contact': [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
'sell': [{
required: true,
message: '请输入转让金',
trigger: ['change', 'blur']
}],
'introduce': [{
'content': [{
required: true,
message: '请输入介绍',
trigger: ['change', 'blur']
}],
'size': [{
required: true,
message: '请输入面积',
trigger: ['change', 'blur']
}],
'rent': [{
required: true,
message: '请输入租金',
trigger: ['change', 'blur']
}],
'place': [{
'address': [{
required: true,
message: '请输入地址',
trigger: ['change', 'blur']
}],
'call':[{
required: true,
message: '请输入电话号码',
},
{
validator: (rule, value, callback) => {
if(value) {
return this.$u.test.mobile(value);
} else {
return true
}
'mobile': [{
required: true,
message: '请输入电话号码',
},
message: '号码不正确',
trigger: ['change','blur'],
}]
{
validator: (rule, value, callback) => {
if (value) {
return this.$u.test.mobile(value);
} else {
return true
}
},
message: '号码不正确',
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('发布成功')
this.$api.publishInvestment(this.form).then(res => {
console.log(res);
})
}).catch(errors => {
console.log("失败信息:" + JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
},
changeAddress(e) {
// console.log('changeAddress', e);
this.getAddressList(e)
@@ -176,50 +222,42 @@
that.$api.key,
success(res) {
console.log('diz', res.data.result.location);
console.log('lat', res.data.result.location.lat);
console.log('lng', res.data.result.location.lng);
// 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
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
submit() {
this.$refs.uForm.validate().then(res => {
console.log("提交表单信息:" + JSON.stringify(this.form))
uni.$u.toast('发布成功')
// 调用服务端入表接口W
}).catch(errors => {
console.log("失败信息:" + JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
},
tradeConfirm(e){
tradeConfirm(e) {
this.show2 = false
this.form.trade = e.value[0]
this.form.business = e.value[0]
this.ClassCheckId = this.pid[e.indexs[0]]
this.$api.getClassList(this.ClassCheckId).then(res => {
// console.log(res);
this.Karmacolumns = res.data.data.map((item) => {
return item = item.name
})
return item = item.name
})
})
},
karmaConfirm(e){
karmaConfirm(e) {
this.show3 = false
this.form.karma = e.value[0]
this.form.commercial = e.value[0]
},
regionConfirm(e){
regionConfirm(e) {
this.show1 = false
this.form.region = e.value[0]
},
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
onLoad() {
this.$api.getClassList().then(res =>{
this.$api.getClassList().then(res => {
// console.log(res.data.data.length);
this.Classcolumns = res.data.data.map((item) => {
return item = item.name
@@ -227,15 +265,15 @@
this.pid = res.data.data.map((item) => {
return item = item.id
})
})
},
computed:{
isChecked(index){
if(index.length > 0)
return true;
computed: {
isChecked(index) {
if (index.length > 0)
return true;
else
return false;
return false;
}
}
}
@@ -262,7 +300,11 @@
justify-content: center;
align-items: center;
background-color: #F8F8F8;
height: 300rpx;
// height: 300rpx;
.count {
margin-bottom: 30px;
}
// margin-right: 20px;
}
@@ -285,12 +327,14 @@
font-weight: 1px;
color: #c1c4c7;
}
.checkedtext{
.checkedtext {
margin-top: 5rpx;
font-size: 28rpx;
font-weight: 1px;
border-style: none;
}
.picker {
display: flex;
justify-content: space-between;

View File

@@ -2,54 +2,71 @@
<view class="form">
<u-form :model="form" ref="uForm">
<view class="upload">
<u-upload max-count="5" upload-icon="photo"></u-upload>
<text class="count">发布店铺图片({{ShopInfomation.count}}/5)</text>
<view style="padding-left: 20rpx;margin-top: 20rpx;">
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
multiple :maxCount="5" :on-preview="preview"></u-upload>
</view>
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
<text class="count">发布房源图片({{imageLength}}/5)</text>
</view>
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
</view>
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
v-model="form.region" @confirm="regionConfirm"></u-picker>
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place" label-width="auto">
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="适合行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
</view>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="size">
<u-input v-model="form.size" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="详情" label-position="top" border-bottom="true" label-width="auto" prop="introduce">
<u-input v-model="form.introduce" placeholder="请输入详情" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
</u-form>
<view class="bug-figure"></view>
<u-button @click="submit" color="linear-gradient(to right, #E86262, #CC3333)" :size="normal" shape="circle" class="submit-btn">发布</u-button>
<view class="bug-figure"></view>
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
</view>
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
v-model="form.region" @confirm="regionConfirm"></u-picker>
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="changeAddress"></u-input>
</u-form-item>
<u-form-item label="适合行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
</view>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercial">
<text @click="show3 = true" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
<text @click="show3 = true" class="checktext" v-else>请选择店铺业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
</view>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
:columns="[Karmacolumns]" v-model="form.commercial" @confirm="karmaConfirm"></u-picker>
</u-form-item>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="area">
<u-input v-model="form.area" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contact">
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
<u-input v-model="form.content" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
</u-form>
<view class="bug-figure"></view>
<u-button @click="submit" color="linear-gradient(to right, #E86262, #CC3333)" :size="normal" shape="circle"
class="submit-btn">发布</u-button>
<view class="bug-figure"></view>
</view>
</template>
@@ -57,56 +74,66 @@
export default {
data() {
return {
regionColumns:[JSON.parse(uni.getStorageSync('regionList'))]||[],
ShopInfomation:{
city:'',
area:'',
count:0,
},
imageLength: '0',
fileList1: [],
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
form: {
title: '',
region: '',
place: '',
trade: '',
size: '',
address: '',
business: '',
commercial: '',
area: '',
rent: '',
name: '',
call: '',
introduce: ''
contact:'',
mobile: '',
content: '',
images: [],
longitude: '',
latitude: '',
id: '',
},
Classcolumns:[],
show1:false,
show2:false,
show3:false,
Classcolumns: [],
ClassCheckId: '',
Karmacolumns: [],
pid: [],
show1: false,
show2: false,
show3: false,
rules: {
'title': [{
required: true,
message: '请输入标题',
trigger: ['change', 'blur']
}],
'trade': [{
'business': [{
required: true,
message: '请选择行业',
trigger: ['change', 'blur']
trigger: ['change']
}],
'region': [{
required: true,
message: '请选择地区',
trigger: ['change', 'blur']
trigger: ['change']
}],
'name': [{
'commercial': [{
required: true,
message: '请选择业态',
trigger: ['change']
}],
'contact': [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
'introduce': [{
'content': [{
required: true,
message: '请输入介绍',
trigger: ['change', 'blur']
}],
'size': [{
'area': [{
required: true,
message: '请输入面积',
trigger: ['change', 'blur']
@@ -116,123 +143,239 @@
message: '请输入租金',
trigger: ['change', 'blur']
}],
'place': [{
'address': [{
required: true,
message: '请输入地址',
trigger: ['change', 'blur']
}],
'call':[{
required: true,
message: '请输入电话号码',
},
{
validator: (rule, value, callback) => {
if(value) {
return this.$u.test.mobile(value);
} else {
return true
}
'mobile': [{
required: true,
message: '请输入电话号码',
},
message: '号码不正确',
trigger: ['change','blur'],
}]
{
validator: (rule, value, callback) => {
if (value) {
return this.$u.test.mobile(value);
} else {
return true
}
},
message: '号码不正确',
trigger: ['change', 'blur'],
}
]
},
}
},
methods: {
confirmArea(e) {
this.ShopInfomation.city = e.value[0]
this.ShopInfomation.area = e.value[1]
this.show1 = false
// 删除图片
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('发布成功')
// 调用服务端入表接口W
this.$api.publishRent(this.form).then(res => {
console.log(res);
})
}).catch(errors => {
console.log("失败信息:" + JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
},
tradeConfirm(e){
this.show2 = false
this.form.trade = e.value[0]
changeAddress(e) {
// console.log('changeAddress', e);
this.getAddressList(e)
},
regionConfirm(e){
getAddressList(value) {
var that = this
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + value + '&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
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
tradeConfirm(e) {
this.show2 = false
this.form.business = e.value[0]
this.ClassCheckId = this.pid[e.indexs[0]]
this.$api.getClassList(this.ClassCheckId).then(res => {
// console.log(res);
this.Karmacolumns = res.data.data.map((item) => {
return item = item.name
})
})
},
karmaConfirm(e) {
this.show3 = false
this.form.commercial = e.value[0]
},
regionConfirm(e) {
this.show1 = false
this.form.region = e.value[0]
}
},
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
onLoad() {
this.$api.getClassList().then(res =>{
this.$api.getClassList().then(res => {
// console.log(res.data.data.length);
this.Classcolumns = res.data.data.map((item) => {
return item = item.name
})
this.pid = res.data.data.map((item) => {
return item = item.id
})
})
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
computed: {
isChecked(index) {
if (index.length > 0)
return true;
else
return false;
}
}
}
</script>
<style lang="scss">
.count{
}
.form{
.count {}
.form {
margin-left: 20px;
margin-right: 20px;
}
.input-class{
.input-class {
font-size: 30rpx;
font-weight:1px;
font-weight: 1px;
border-style: none;
}
.upload{
.upload {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #F8F8F8;
height: 300rpx;
// height: 300rpx;
.count {
margin-bottom: 30px;
}
// margin-right: 20px;
}
.submit-btn{
.submit-btn {
width: 80%;
}
.bug-figure{
.bug-figure {
height: 100rpx;
}
.checkbox1{
.checkbox1 {
display: flex;
justify-content: space-between;
}
.checktext{
.checktext {
margin-top: 5rpx;
font-size: 30rpx;
font-weight:1px;
font-weight: 1px;
color: #c1c4c7;
}
.checkedtext{
.checkedtext {
margin-top: 5rpx;
font-size: 28rpx;
font-weight: 1px;
border-style: none;
}
.picker{
.picker {
display: flex;
justify-content: space-between;
}
.arrow-icon{
.arrow-icon {
position: absolute;
right: 10rpx;
transform: translateY(-20rpx);
}
</style>
</style>

View File

@@ -2,62 +2,68 @@
<view class="form">
<u-form :model="form" ref="uForm">
<view class="upload">
<u-upload max-count="5" upload-icon="photo"></u-upload>
<text class="count">发布房源图片({{ShopInfomation.count}}/5)</text>
<view style="padding-left: 20rpx;margin-top: 20rpx;">
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
multiple :maxCount="5"></u-upload>
</view>
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
<text class="count">发布房源图片({{imageLength}}/5})</text>
</view>
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
</view>
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
v-model="form.region" @confirm="regionConfirm"></u-picker>
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place" label-width="auto">
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="changeAddress"></u-input>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@focus="changeAddressFocus" @blur="changeAddress"></u-input>
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
</view>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="karma">
<text @click="show3 = true" class="checkedtext" v-if="form.karma.length>0">{{form.karma}}</text>
<text @click="show3 = true" class="checktext" v-else>请选择店铺业态</text>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercial">
<text @click="chooseCommercial" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
<text @click="chooseCommercial" class="checktext" v-else>请选择店铺业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
<u-icon name="arrow-right" size="30px" @click="chooseCommercial"></u-icon>
</view>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false" :columns="[Karmacolumns]"
v-model="form.karma" @confirm="karmaConfirm"></u-picker>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
:columns="[Karmacolumns]" v-model="form.commercial" @confirm="karmaConfirm"></u-picker>
</u-form-item>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="size">
<u-input v-model="form.size" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="area">
<u-input v-model="form.area" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="转让费(万元)" label-position="top" border-bottom="true" label-width="auto" prop="sell">
<u-input v-model="form.sell" placeholder="请输入店铺转让费" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="转让费(万元)" label-position="top" border-bottom="true" label-width="auto" prop="transferFee">
<u-input v-model="form.transferFee" placeholder="请输入店铺转让费" placeholder-class="input-class"
border="none"></u-input>
</u-form-item>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contact">
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="introduce">
<u-input v-model="form.introduce" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
<u-input v-model="form.content" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
</u-form>
<view class="bug-figure"></view>
@@ -66,36 +72,35 @@
<view class="bug-figure"></view>
</view>
</template>
<script>
export default {
data() {
return {
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
ShopInfomation: {
city: '',
area: '',
count: 0,
},
imageLength: 0,
fileList1: [],
regionColumns: [],
form: {
title: '',
region: '',
place: '',
trade: '',
karma: '',
size: '',
address: '',
business: '',
commercial: '',
area: '',
rent: '',
sell: '',
name: '',
call: '',
introduce: ''
transferFee: '',
mobile: '',
content: '',
images: [],
longitude: '',
latitude: '',
id: '',
},
Classcolumns: [],
ClassCheckId:'',
ClassCheckId: '',
Karmacolumns: [],
pid:[],
pid: [],
show1: false,
show2: false,
show3: false,
@@ -105,37 +110,37 @@
message: '请输入标题',
trigger: ['change', 'blur']
}],
'trade': [{
'business': [{
required: true,
message: '请选择行业',
trigger: ['change', 'blur']
trigger: ['change']
}],
'region': [{
required: true,
message: '请选择地区',
trigger: ['change', 'blur']
trigger: ['change']
}],
'karma': [{
'commercial': [{
required: true,
message: '请选择业态',
trigger: ['change', 'blur']
trigger: ['change']
}],
'name': [{
'contact': [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
'sell': [{
'transferFee': [{
required: true,
message: '请输入转让金',
trigger: ['change', 'blur']
}],
'introduce': [{
'content': [{
required: true,
message: '请输入介绍',
trigger: ['change', 'blur']
}],
'size': [{
'area': [{
required: true,
message: '请输入面积',
trigger: ['change', 'blur']
@@ -145,31 +150,80 @@
message: '请输入租金',
trigger: ['change', 'blur']
}],
'place': [{
'address': [{
required: true,
message: '请输入地址',
trigger: ['change', 'blur']
}],
'call':[{
required: true,
message: '请输入电话号码',
},
{
validator: (rule, value, callback) => {
if(value) {
return this.$u.test.mobile(value);
} else {
return true
}
'mobile': [{
required: true,
message: '请输入电话号码',
},
message: '号码不正确',
trigger: ['change','blur'],
}]
{
validator: (rule, value, callback) => {
if (value) {
return this.$u.test.mobile(value);
} else {
return true
}
},
message: '号码不正确',
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++) {
const result = await this.uploadFilePromise(lists[i].url)
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'
@@ -177,59 +231,121 @@
},
submit() {
this.$refs.uForm.validate().then(res => {
console.log("提交表单信息:" + JSON.stringify(this.form))
uni.$u.toast('发布成功')
// 调用服务端入表接口W
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(','));
if (this.form.latitude && this.form.longitude) {
console.log('经纬度都存在');
} else {
uni.$u.toast('请输入准确地址')
return false
}
let data = {
...this.form,
images: temp.join(',')
}
console.log('提交表单信息', data);
// console.log("提交表单信息:" + JSON.stringify(this.form))
this.$api.publishTransfer(data).then(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))
// uni.$u.toast('校验失败')
})
},
chooseCommercial() {
if (!this.form.business) {
uni.$u.toast('请先选择行业')
return false
} else {
this.show3 = true
}
},
changeAddressFocus() {
if (!this.form.region) {
uni.$u.toast('请先选择区域')
return false
}
},
changeAddress(e) {
// console.log('changeAddress', e);
this.getAddressList(e)
},
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);
console.log('lng', res.data.result.location.lng);
that.regionColumns = [res.data.result[0].map(item => item.fullname)]
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
tradeConfirm(e){
getAddressList(value) {
if (!this.form.region) {
uni.$u.toast('请先选择区域')
return false
}
var that = this
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' +
that.$api.key,
success(res) {
console.log('地址转经纬度', res.data);
if (res.data.message == "query ok") {
// 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
} else {
uni.$u.toast('请输入准确地址')
}
},
fail(err) {
console.log('请求区域失败:', err);
}
})
},
tradeConfirm(e) {
this.show2 = false
this.form.trade = e.value[0]
this.form.business = e.value[0]
this.ClassCheckId = this.pid[e.indexs[0]]
this.$api.getClassList(this.ClassCheckId).then(res => {
// console.log(res);
this.Karmacolumns = res.data.data.map((item) => {
return item = item.name
})
return item = item.name
})
})
},
karmaConfirm(e){
karmaConfirm(e) {
this.show3 = false
this.form.karma = e.value[0]
this.form.commercial = e.value[0]
},
regionConfirm(e){
regionConfirm(e) {
this.show1 = false
this.form.region = e.value[0]
},
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
onLoad() {
this.$api.getClassList().then(res =>{
this.getRegionList()
this.$api.getClassList().then(res => {
// console.log(res.data.data.length);
this.Classcolumns = res.data.data.map((item) => {
return item = item.name
@@ -237,20 +353,19 @@
this.pid = res.data.data.map((item) => {
return item = item.id
})
})
},
computed:{
isChecked(index){
if(index.length > 0)
return true;
computed: {
isChecked(index) {
if (index.length > 0)
return true;
else
return false;
return false;
}
}
}
</script>
<style lang="scss">
.count {}
@@ -272,8 +387,12 @@
justify-content: center;
align-items: center;
background-color: #F8F8F8;
height: 300rpx;
// height: 300rpx;
// margin-right: 20px;
.count {
margin-bottom: 30px;
}
}
.submit-btn {
@@ -295,12 +414,14 @@
font-weight: 1px;
color: #c1c4c7;
}
.checkedtext{
.checkedtext {
margin-top: 5rpx;
font-size: 28rpx;
font-weight: 1px;
border-style: none;
}
.picker {
display: flex;
justify-content: space-between;

View File

@@ -1,5 +1,4 @@
const serverHost = 'https://spsp.feashow.com/api' //http://xx.xxx.xx
const service = {
get(url, data) {
const header = {}
@@ -254,6 +253,34 @@ const apiService = {
resolve(service.get(url))
})
},
//发布店铺转让
publishTransfer(data){
const url = `/shop/transfer/`
return new Promise((resolve, reject) => {
resolve(service.post(url, data))
})
},
//发布店铺出租
publishRent(data){
const url = `/shop/rent/`
return new Promise((resolve, reject) => {
resolve(service.post(url, data))
})
},
//发布找店地址
publishAddress(data){
const url = `/shop/selection/`
return new Promise((resolve, reject) => {
resolve(service.post(url, data))
})
},
//发布项目招商
publishInvestment(data){
const url = `/shop/investment/`
return new Promise((resolve, reject) => {
resolve(service.post(url, data))
})
},
// 获得成交案例
getSuccList(type){
if (!type) {

BIN
static/my/hz_bj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
static/my/wo_icon_hhr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB