Files
dvcp_v2_wxcp_app/library/project/xincheng/AppMerchantManage/add.vue
2024-10-31 14:34:57 +08:00

247 lines
5.9 KiB
Vue

<template>
<div class="add">
<div class="item">
<span class="tips">*</span>
<div class="border">
<span class="label">店名</span>
<span class="value">
<input type="text" placeholder="请输入" v-model="form.businessName" maxlength="20">
</span>
</div>
</div>
<div class="item mar-b0">
<span class="tips">*</span>
<div class="border">
<span class="label">地址</span>
</div>
</div>
<div class="text-area">
<textarea placeholder="请输入" v-model="form.businessAddress" maxlength="50"></textarea>
</div>
<div class="item">
<span class="tips">*</span>
<div class="border">
<span class="label">店长</span>
<span class="value">
<input type="text" placeholder="请输入" v-model="form.bossName">
</span>
</div>
</div>
<div class="item">
<span class="tips"></span>
<div class="border">
<span class="label">电话</span>
<span class="value">
<input type="text" placeholder="请输入" v-model="form.telephone" maxlength="11">
</span>
</div>
</div>
<div class="item">
<span class="tips"></span>
<div class="border">
<span class="label">身份证号</span>
<span class="value">
<input type="text" placeholder="请输入" v-model="form.cardId" maxlength="18">
</span>
</div>
</div>
<div class="item mar-b0">
<span class="tips"></span>
<div class="border">
<span class="label">门店照片</span>
</div>
</div>
<div class="text-area">
<AiUploader :def.sync="form.storePicUrl" :limit="1" multiple action="/admin/file/add2" style="padding-bottom:16px;"></AiUploader>
</div>
<!-- <AiUploader v-model="form.files" :limit="9" multiple action="/admin/file/add2"></AiUploader> -->
<div class="item">
<span class="tips"></span>
<div class="border">
<span class="label">地图标注</span>
<span class="value" style="color:#3D94FB;" @click="chooseLocation">{{ form.lat ? '已标绘' : '地图标绘' }}</span>
</div>
</div>
<AiGap h="112"/>
<div class="btn" @click="save">保存</div>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'add',
appName: '新增商户',
data() {
return {
name: '',
files: [],
form: {
bossName: '',
businessAddress: '',
businessName: '',
lat: '',
lng: '',
storePicUrl: [],
telephone: ''
},
id: ''
}
},
computed: {...mapState(['user'])},
onLoad (query) {
if (query.id) {
this.id = query.id
this.getInfo()
}
uni.$on('chooseAddress', e => {
this.form.lat = e.lat
this.form.lng = e.lng
})
},
methods: {
chooseLocation () {
// uni.chooseLocation({
// success: res => {
// this.form.lat = res.latitude
// this.form.lng = res.longitude
// }
// })
uni.navigateTo({
url: './ChooseAddess'
})
},
getInfo () {
this.$loading()
this.$http.post(`/app/appcompany/getDetailById?id=${this.id}`).then(res => {
if (res.code === 0) {
this.form = {
...this.form,
...res.data,
storePicUrl: res.data.storePicUrl ? [{url: res.data.storePicUrl}] : []
}
}
})
},
save () {
if (!this.form.bossName) {
return this.$u.toast('请输入店名')
}
if (!this.form.businessAddress) {
return this.$u.toast('请输入所在地址')
}
if (!this.form.businessName) {
return this.$u.toast('请输入店长名称')
}
this.$loading()
this.$http.post('/api/appcompany/addORUpdate', {
...this.form,
storePicUrl: this.form.storePicUrl.length ? this.form.storePicUrl[0].url : ''
}).then(res => {
if (res.code === 0) {
this.$u.toast('提交成功')
setTimeout(() => {
uni.$emit('update')
uni.navigateBack({
delta: 1
})
}, 500)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.add {
.item{
width: 100%;
padding-left: 14px;
background: #FFF;
box-sizing: border-box;
display: flex;
margin-bottom: 16px;
.tips{
width: 18px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #FF4466;
line-height: 44px;
padding: 34px 0 34px 0;
}
.border{
width: calc(100% - 18px);
padding: 34px 32px 34px 0;
line-height: 44px;
line-height: 44px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
display: flex;
box-sizing: border-box;
.label{
width: 170px;
}
.value{
width: calc(100% - 170px);
text-align: right;
img{
width: 32px;
height: 32px;
margin-left: 8px;
vertical-align: middle;
}
}
.color-999{
color: #999;
}
}
}
.mar-b0{
margin-bottom: 0;
}
.text-area{
width: 100%;
background-color: #fff;
padding: 0 32px;
margin-bottom: 16px;
box-sizing: border-box;
textarea{
width: 100%;
height: 88px;
padding-bottom: 32px;
}
}
.btn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
height: 112px;
line-height: 112px;
background: #3975C6;
box-shadow: inset 0px 2px 0px 0px #EEEEEE;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFF;
}
}
</style>