|
@@ -5,7 +5,7 @@
|
|
|
<view class="flex flex_column data-item">
|
|
|
<text>名称</text>
|
|
|
<view class="list-item-right flex_1 flex justify_between">
|
|
|
- <u-input class="flex_1" :custom-style="inputClass" v-model="form.contactName" placeholder="请输入店铺名称" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
+ <u-input class="flex_1" :custom-style="inputClass" v-model="form.name" placeholder="请输入店铺名称" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex flex_column data-item last">
|
|
@@ -15,7 +15,7 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="list-item-right flex_1 flex justify_between">
|
|
|
- <u-input class="flex_1" :custom-style="inputClass" v-model="form.contactPhone" placeholder="请输入联系电话" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
+ <u-input class="flex_1" :custom-style="inputClass" v-model="form.mobile" placeholder="请输入联系电话" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -23,14 +23,14 @@
|
|
|
<view class="flex flex_column data-item">
|
|
|
<text>地址</text>
|
|
|
<view class="list-item-right flex_1 flex justify_between">
|
|
|
- <u-input class="flex_1" :custom-style="inputClass" v-model="form.contactAddress" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
+ <u-input class="flex_1" :custom-style="inputClass" v-model="form.receiveAddress.receiveAreasName" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
<u-icon class="back-img" name="arrow-right" color="#9DA8B5" @click="selectAddress"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex flex_column data-item last">
|
|
|
<text>详细地址</text>
|
|
|
<view class="list-item-right flex_1 flex justify_between">
|
|
|
- <u-input class="flex_1" :custom-style="inputClass" v-model="form.detailAddress" placeholder="请输入详细地址" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
+ <u-input class="flex_1" :custom-style="inputClass" v-model="form.receiveAddress.receiveAddress" placeholder="请输入详细地址" placeholder-style="color:'#bbb';font-size:18px"/>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -57,16 +57,21 @@
|
|
|
|
|
|
<script>
|
|
|
import {saveImgToAliOss} from '@/libs/tools.js'
|
|
|
+ import { shopDetails,savShop } from '@/api/shop.js'
|
|
|
export default{
|
|
|
data(){
|
|
|
return{
|
|
|
photograph: [],
|
|
|
- imageHeader:'', // 图片路径
|
|
|
form:{
|
|
|
- contactName:'', // 名称
|
|
|
- contactPhone:'', // 手机号码
|
|
|
- contactAddress:"", // 通信地址
|
|
|
- detailAddress:'' // 详细地址
|
|
|
+ name:'', // 名称
|
|
|
+ mobile:'', // 手机号码
|
|
|
+ receiveAddress: {
|
|
|
+ provinceName: '',// 省
|
|
|
+ cityName: '',// 市
|
|
|
+ districtName: '', // 区
|
|
|
+ receiveAddress: '',// 详细地址
|
|
|
+ receiveAreasName:''
|
|
|
+ }
|
|
|
},
|
|
|
itemId:'',// 店铺id
|
|
|
pageInfo:{}, // 页面数据
|
|
@@ -85,9 +90,16 @@
|
|
|
methods:{
|
|
|
// 获取详情信息
|
|
|
getDetailInfo(){
|
|
|
- getDetailInfo({id:this.itemId}).then(res=>{
|
|
|
+ shopDetails({id:this.itemId}).then(res=>{
|
|
|
if(res.status==200){
|
|
|
- this.pageInfo=res.data
|
|
|
+ this.form.name=res.data.name? res.data.name:''
|
|
|
+ this.form.mobile=res.data.mobile
|
|
|
+ this.form.receiveAddress.provinceName=res.data.receiveAddressVO?res.data.receiveAddressVO.provinceName:''
|
|
|
+ this.form.receiveAddress.cityName=res.data.receiveAddressVO?res.data.receiveAddressVO.cityName:''
|
|
|
+ this.form.receiveAddress.districtName=res.data.receiveAddressVO?res.data.receiveAddressVO.districtName:''
|
|
|
+ this.form.receiveAddress.receiveAddress=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAddress:''
|
|
|
+ this.form.receiveAddress.receiveAreasName=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAreasName:''
|
|
|
+ this.photograph=res.data.receiveAddressVO?res.data.receiveAddressVO.headerImageList:[]
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
title: res.message,
|
|
@@ -102,10 +114,10 @@
|
|
|
success:(res)=>{
|
|
|
if(res){
|
|
|
this.getArea(res.address)
|
|
|
- console.log(res,'------------------地址信息',this.getArea(res.address))
|
|
|
- this.form.contactAddress=res.address
|
|
|
- this.form.lat=res.latitude
|
|
|
- this.form.lng=res.longitude
|
|
|
+ // this.form.contactAddress=res.address
|
|
|
+ // this.form.lat=res.latitude
|
|
|
+ // this.form.lng=res.longitude
|
|
|
+ this.form.receiveAddress.receiveAreasName= res.address
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -149,16 +161,73 @@
|
|
|
this.photograph.splice(index)
|
|
|
}, 500);
|
|
|
},
|
|
|
+ //截取省市区
|
|
|
+ getArea(str) {
|
|
|
+ // let area = {}
|
|
|
+ let index11 = 0
|
|
|
+ let index1 = str.indexOf("省")
|
|
|
+ if (index1 == -1) {
|
|
|
+ index11 = str.indexOf("自治区")
|
|
|
+ if (index11 != -1) {
|
|
|
+ this.form.receiveAddress.provinceName = str.substring(0, index11 + 3)
|
|
|
+ } else {
|
|
|
+ this.form.receiveAddress.provinceName= str.substring(0, 0)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.form.receiveAddress.provinceName = str.substring(0, index1 + 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ let index2 = str.indexOf("市")
|
|
|
+ if (index11 == -1) {
|
|
|
+ this.form.receiveAddress.cityName = str.substring(index11 + 1, index2 + 1)
|
|
|
+ } else {
|
|
|
+ if (index11 == 0) {
|
|
|
+ this.form.receiveAddress.cityName = str.substring(index1 + 1, index2 + 1)
|
|
|
+ } else {
|
|
|
+ this.form.receiveAddress.cityName = str.substring(index11 + 3, index2 + 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let index3 = str.lastIndexOf("区")
|
|
|
+ if (index3 == -1) {
|
|
|
+ index3 = str.indexOf("县")
|
|
|
+ this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
|
|
|
+ } else {
|
|
|
+ this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
|
|
|
+ }
|
|
|
+ // return this.area;
|
|
|
+ if(this.form.receiveAddress==''){
|
|
|
+ this.form.receiveAddress.provinceName=this.form.receiveAddress.cityName
|
|
|
+ }
|
|
|
+ },
|
|
|
// 保存
|
|
|
submit(){
|
|
|
const testVal=/^1[34578]\d{9}$/
|
|
|
- if (!testVal.test(this.form.contactPhone)) {
|
|
|
+ if (!testVal.test(this.form.mobile)) {
|
|
|
uni.showToast({
|
|
|
title: '请输入正确的联系电话',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
+ const params=Object.assign(this.form,{sourceTypeReserve:'rider'})
|
|
|
+ if(this.photograph.length>0){
|
|
|
+ params.receiveAddress.headerImageList=this.photograph
|
|
|
+ }
|
|
|
+ if(this.itemId){
|
|
|
+ params.id=this.itemId
|
|
|
+ }
|
|
|
+ console.log(params,'-----------提交参数')
|
|
|
+ savShop(params).then(res=>{
|
|
|
+ console.log(res)
|
|
|
+ if(res.status==200){
|
|
|
+ uni.navigateBack({})
|
|
|
+ }
|
|
|
+ uni.showToast({
|
|
|
+ title:res.message,
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|