<style scoped> .container{ min-height: 100%; background:#f6f6f6; padding:30rpx; } </style> <template> <view class="container"> <u-form class="card inline" errorType="toast" :model="formData" ref="form" :rules="rules" labelWidth="auto"> <d-form label="当前位置" type="map" @position="formData.lat=$event.latitude;formData.lng=$event.longitude"/> <d-form label="位置详情" required field="position" v-model="formData.position"/> <d-form label="凭证" required field="pic" :num="3" :value="imgs" type="upImg" @imgs="formData.pic=$event"/> <d-form label="描述" type="textarea" v-model="formData.remark"/> <d-form label="是否处理" type="radio" :columns="[{label:'是',value:1},{label:'否',value:0}]" v-model="formData.flagDeal"/> </u-form> <button class="cu-btn round bg-green shadow submit" @click="submit">保存</button> </view> </template> <script> export default { data(){ return{ formData:{ lng:"", lat:"", position:"", remark:"", pic:'', flagDeal:0, }, imgs:[], rules:{ pic:{required:true,message:"请上传凭证!",trigger:'blur'}, position:{required:true,message:"请输入位置详情!",trigger:"blur"}, }, eventChannel:null, } }, onLoad(){ this.eventChannel=this.getOpenerEventChannel() this.eventChannel.on("detail",e=>{ this.formData=e this.imgs=(e.pic||"").split(',').filter(v=>v) }) }, methods:{ submit(){ this.$refs.form.validate().then(async valid=>{ if(valid){ this.eventChannel.emit('update',this.formData) uni.navigateBack() } }) }, } } </script>