Files
dvcp_v2_wxcp_app/library/project/xincheng/AppMerchantManage/add.vue

247 lines
5.9 KiB
Vue
Raw Normal View History

2022-07-01 15:11:11 +08:00
<template>
<div class="add">
2022-07-01 16:16:59 +08:00
<div class="item">
<span class="tips">*</span>
<div class="border">
<span class="label">店名</span>
<span class="value">
2022-07-02 16:23:35 +08:00
<input type="text" placeholder="请输入" v-model="form.businessName" maxlength="20">
2022-07-01 16:16:59 +08:00
</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">
2022-07-02 16:23:35 +08:00
<textarea placeholder="请输入" v-model="form.businessAddress" maxlength="50"></textarea>
2022-07-01 16:16:59 +08:00
</div>
<div class="item">
<span class="tips">*</span>
<div class="border">
<span class="label">店长</span>
<span class="value">
2022-07-01 18:38:34 +08:00
<input type="text" placeholder="请输入" v-model="form.bossName">
2022-07-01 16:16:59 +08:00
</span>
</div>
</div>
<div class="item">
<span class="tips"></span>
<div class="border">
<span class="label">电话</span>
<span class="value">
2022-07-01 18:38:34 +08:00
<input type="text" placeholder="请输入" v-model="form.telephone" maxlength="11">
2022-07-01 16:16:59 +08:00
</span>
</div>
</div>
<div class="item">
<span class="tips"></span>
<div class="border">
<span class="label">身份证号</span>
<span class="value">
2022-07-02 16:23:35 +08:00
<input type="text" placeholder="请输入" v-model="form.cardId" maxlength="18">
2022-07-01 16:16:59 +08:00
</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">
2022-07-01 18:38:34 +08:00
<AiUploader :def.sync="form.storePicUrl" :limit="1" multiple action="/admin/file/add2" style="padding-bottom:16px;"></AiUploader>
2022-07-01 16:16:59 +08:00
</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>
2022-07-02 16:58:20 +08:00
<span class="value" style="color:#3D94FB;" @click="chooseLocation">{{ form.lat ? '已标绘' : '地图标绘' }}</span>
2022-07-01 16:16:59 +08:00
</div>
</div>
<AiGap h="112"/>
2022-07-01 17:49:20 +08:00
<div class="btn" @click="save">保存</div>
2022-07-01 15:11:11 +08:00
</div>
</template>
<script>
2022-07-02 16:17:55 +08:00
import {mapState} from 'vuex'
2022-07-01 15:11:11 +08:00
2022-07-02 16:17:55 +08:00
export default {
name: 'add',
appName: '新增商户',
data() {
return {
name: '',
files: [],
form: {
bossName: '',
businessAddress: '',
businessName: '',
lat: '',
lng: '',
storePicUrl: [],
telephone: ''
},
id: ''
2022-07-01 17:49:20 +08:00
}
2022-07-02 16:17:55 +08:00
},
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
computed: {...mapState(['user'])},
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
onLoad (query) {
2022-07-02 16:58:20 +08:00
if (query.id) {
2022-07-02 16:23:35 +08:00
this.id = query.id
this.getInfo()
}
2022-07-04 08:55:10 +08:00
uni.$on('chooseAddress', e => {
this.form.lat = e.lat
this.form.lng = e.lng
})
2022-07-02 16:17:55 +08:00
},
2022-07-01 15:11:11 +08:00
2022-07-02 16:17:55 +08:00
methods: {
chooseLocation () {
2022-07-04 08:55:10 +08:00
// uni.chooseLocation({
// success: res => {
// this.form.lat = res.latitude
// this.form.lng = res.longitude
// }
// })
uni.navigateTo({
url: './ChooseAddess'
2022-07-02 16:17:55 +08:00
})
},
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
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}] : []
}
}
})
},
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
save () {
if (!this.form.bossName) {
return this.$u.toast('请输入店名')
2022-07-01 17:49:20 +08:00
}
2022-07-02 16:17:55 +08:00
if (!this.form.businessAddress) {
return this.$u.toast('请输入所在地址')
}
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
if (!this.form.businessName) {
return this.$u.toast('请输入店长名称')
}
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
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('提交成功')
2022-07-01 17:49:20 +08:00
2022-07-02 16:17:55 +08:00
setTimeout(() => {
uni.$emit('update')
uni.navigateBack({
delta: 1
})
}, 500)
2022-07-04 08:55:10 +08:00
}
2022-07-02 16:17:55 +08:00
})
2022-07-01 17:49:20 +08:00
}
}
2022-07-01 15:11:11 +08:00
}
</script>
<style lang="scss" scoped>
.add {
2022-07-01 16:16:59 +08:00
.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;
}
2022-07-01 15:11:11 +08:00
}
</style>