邓洁 : 发布店铺转让接口
This commit is contained in:
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
watch: {
|
||||
scale(newVal, oldVal) {
|
||||
console.log('thisscale', newVal, Math.round(newVal));
|
||||
this.showShop = false
|
||||
let ra = ''
|
||||
this.scaleM.forEach(item => {
|
||||
if (item.scale == Math.round(newVal)) {
|
||||
@@ -268,10 +269,12 @@
|
||||
this.getDetail(1, markerId)
|
||||
this.marker.forEach(item => {
|
||||
if (markerId === item.id) {
|
||||
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'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="upload">
|
||||
<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>
|
||||
multiple :maxCount="5"></u-upload>
|
||||
</view>
|
||||
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
||||
<text class="count">发布房源图片({{imageLength}}/5})</text>
|
||||
@@ -17,7 +17,6 @@
|
||||
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>
|
||||
@@ -26,7 +25,7 @@
|
||||
</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>
|
||||
@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="business">
|
||||
@@ -39,8 +38,8 @@
|
||||
: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>
|
||||
<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>
|
||||
</view>
|
||||
@@ -78,9 +77,9 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageLength: '0',
|
||||
imageLength: 0,
|
||||
fileList1: [],
|
||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||
regionColumns: [],
|
||||
|
||||
form: {
|
||||
title: '',
|
||||
@@ -198,9 +197,7 @@
|
||||
})
|
||||
})
|
||||
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',
|
||||
@@ -234,40 +231,90 @@
|
||||
})
|
||||
},
|
||||
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.publishTransfer(this.form).then(res => {
|
||||
console.log(res);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
})
|
||||
},
|
||||
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);
|
||||
@@ -296,9 +343,9 @@
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.getRegionList()
|
||||
this.$api.getClassList().then(res => {
|
||||
// console.log(res.data.data.length);
|
||||
this.Classcolumns = res.data.data.map((item) => {
|
||||
|
||||
Reference in New Issue
Block a user