| | |
| | | </view> |
| | | <view class="item"> |
| | | |
| | | <!-- <u-form-item class="form-item" labelWidth="100" label="场所地址:" required prop="location"> |
| | | <u--input border="none" v-model="form.location" placeholder="请选择场所地址"> |
| | | <u-form-item @click="showPicker = true" class="form-item" labelWidth="100" label="楼栋:" required |
| | | prop="buildingCode"> |
| | | <u--input border="none" disabledColor="#ffffff" v-model="form.building" placeholder="请选择"> |
| | | </u--input> |
| | | </u-form-item> --> |
| | | <u-icon slot="right" name="arrow-right"></u-icon> |
| | | </u-form-item> |
| | | |
| | | <u-form-item class="form-item" labelWidth="100" label="场所名称:" required prop="placeName"> |
| | | <u--input border="none" v-model="form.placeName" placeholder="请输入当前位置"> |
| | | <u--input border="none" v-model="form.placeName" placeholder="请输入"> |
| | | </u--input> |
| | | </u-form-item> |
| | | |
| | | <u-form-item @click="popup" class="form-item" labelWidth="100" label="标签:" required prop="label"> |
| | | <u--input border="none" placeholder="请选择地址标签"> |
| | | <u--input border="none" disabled disabledColor="#ffffff" placeholder="请选择"> |
| | | </u--input> |
| | | <u-icon slot="right" name="arrow-right"></u-icon> |
| | | </u-form-item> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <u-form-item class="form-item" labelWidth="100" label="备注:" prop="location"> |
| | | <u--input border="none" v-model="form.remark" placeholder="请输入备注"> |
| | | <u-form-item class="form-item" labelWidth="100" label="备注:" prop="remark"> |
| | | <u--input border="none" v-model="form.remark" placeholder="请输入"> |
| | | </u--input> |
| | | </u-form-item> |
| | | |
| | | <u-form-item class="form-item" labelWidth="100" label="经纬度:" prop="location"> |
| | | <u--input border="none" v-model="form.jwd" placeholder="请输入经纬度"> |
| | | <u--input border="none" disabled disabledColor="#ffffff" v-model="form.jwd" placeholder="请输入"> |
| | | </u--input> |
| | | </u-form-item> |
| | | </view> |
| | |
| | | </view> |
| | | |
| | | <view class="item"> |
| | | <u-form-item class="form-item" labelWidth="100" label="场所负责人:" prop="principal"> |
| | | <u--input border="none" v-model="form.principal" placeholder="请输入场所负责人"> |
| | | <u-form-item class="form-item" labelWidth="100" required label="场所负责人:" prop="username"> |
| | | <u--input border="none" v-model="form.username" placeholder="请输入"> |
| | | </u--input> |
| | | </u-form-item> |
| | | <u-form-item class="form-item" labelWidth="100" label="手机号:" prop="location"> |
| | | <u--input border="none" v-model="form.phone" placeholder="请输入手机号"> |
| | | <u-form-item class="form-item" labelWidth="100" required label="手机号:" prop="phone"> |
| | | <u--input border="none" v-model="form.phone" placeholder="请输入"> |
| | | </u--input> |
| | | </u-form-item> |
| | | </view> |
| | |
| | | <view class="orange item">85.9</view> |
| | | <view class="green item"></view> |
| | | </view> |
| | | </template></box-title> |
| | | </template> |
| | | </box-title> |
| | | </view> |
| | | |
| | | <view class="item"> |
| | |
| | | |
| | | <view class="bottom"> |
| | | <view class="btn"> |
| | | <u-button @click="addRent" type="primary" text="提交"></u-button> |
| | | <u-button @click="submit" type="primary" text="提交"></u-button> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </uni-popup> |
| | | |
| | | |
| | | <u-picker :show="showPicker" :defaultIndex="defaultIndex" ref="uPicker" keyName="name" :loading="pickerLoading" |
| | | :columns="pickColumns" @change="changeHandler" @confirm="confirmPicker" |
| | | @cancel="showPicker = false"></u-picker> |
| | | |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { |
| | | getLabelList |
| | | } from "@/api/label/label"; |
| | | import { |
| | | getDoorplateAddressList |
| | | } from "@/api/doorplateAddress/doorplateAddress"; |
| | | import { |
| | | add |
| | | } from "@/api/place/place"; |
| | | export default { |
| | | mixins: [uploadMixin], |
| | | components: { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | |
| | | showPicker: false, |
| | | pickerLoading: false, |
| | | pickColumns: [], |
| | | defaultIndex: [0, 0, 0, 0, 0], |
| | | |
| | | selectValue: [], |
| | | |
| | | form: { |
| | | buildingCode: "", |
| | | label: "", |
| | | remark: "", |
| | | imageUrls: [], |
| | | }, |
| | | rules: { |
| | | 'userInfo.name': { |
| | | 'buildingCode': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请填写姓名', |
| | | message: '请选择楼栋', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'placeName': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入场所名称', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'label': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请选择标签', |
| | | trigger: ['blur', 'change'], |
| | | }, |
| | | 'username': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入场所负责人', |
| | | trigger: ['blur', 'change'], |
| | | }, |
| | | 'phone': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入手机号', |
| | | trigger: ['blur', 'change'], |
| | | }, |
| | | }, |
| | | |
| | |
| | | showLabelList: [] |
| | | } |
| | | }, |
| | | created() {}, |
| | | watch: { |
| | | activeIds: { |
| | | handler(newVal) { |
| | | this.form.label = newVal.join(",") |
| | | } |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | this.buildColumn() |
| | | }, |
| | | mounted() { |
| | | |
| | | }, |
| | |
| | | }, |
| | | onShow() { |
| | | this.getLabel() |
| | | this.getLocation() |
| | | }, |
| | | methods: { |
| | | |
| | | //表单提交 |
| | | submit() { |
| | | const that = this |
| | | this.$refs.form.validate().then(valid => { |
| | | |
| | | if (valid) { |
| | | |
| | | |
| | | if (this.form.images.length > 0) { |
| | | let urls = [] |
| | | this.form.images.forEach(e => { |
| | | urls.push(e.url) |
| | | }) |
| | | this.form.imageUrls = urls.join(",") |
| | | } |
| | | add(this.form).then(res => { |
| | | uni.showToast({ |
| | | icon: 'success', |
| | | title: '提交成功', |
| | | success() { |
| | | setTimeout(() => { |
| | | that.$u.func.globalNavigator( |
| | | "/pages/home/index", "switchTab") |
| | | }, 1000) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | async buildColumn() { |
| | | |
| | | //设置街道 |
| | | const townStreet = await this.getDoorplateAddressList(null, "townStreet") |
| | | this.setColumn(townStreet, 0) |
| | | //设置社区 |
| | | const nei = await this.getDoorplateAddressList(townStreet[0].code, "nei") |
| | | this.setColumn(nei, 1) |
| | | //设置路 |
| | | const streetRu = await this.getDoorplateAddressList(nei[0].code, "streetRu") |
| | | this.setColumn(streetRu, 2) |
| | | //设置地区 |
| | | const district = await this.getDoorplateAddressList(streetRu[0].code, "district") |
| | | this.setColumn(district, 3) |
| | | //设置楼栋 |
| | | const building = await this.getDoorplateAddressList(district[0].code, "building") |
| | | this.setColumn(building, 4) |
| | | }, |
| | | |
| | | setColumn(data, index) { |
| | | this.$set(this.pickColumns, index, data) |
| | | }, |
| | | |
| | | getLocation() { |
| | | const that = this |
| | | uni.getLocation({ |
| | | type: 'wgs84', // 坐标系类型 |
| | | success: function(res) { |
| | | var latitude = res.latitude; // 维度 |
| | | var longitude = res.longitude; // 经度 |
| | | |
| | | that.form.lng = longitude |
| | | that.form.lat = latitude |
| | | |
| | | that.form.jwd = longitude + "," + latitude |
| | | }, |
| | | fail: function(res) { |
| | | console.log('获取定位失败:' + res.errMsg); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | async getDoorplateAddressList(code, type) { |
| | | const res = await getDoorplateAddressList(code, type) |
| | | return res.data |
| | | }, |
| | | |
| | | confirmPicker(e) { |
| | | console.log(e, "--------------------") |
| | | |
| | | if (e.value[4]) { |
| | | this.selectValue = e.value |
| | | |
| | | let arr = this.selectValue.map(e => e.name) |
| | | this.form.building = arr.join("") |
| | | |
| | | this.form.buildingCode = e.value[4].code |
| | | } |
| | | this.showPicker = false |
| | | }, |
| | | |
| | | async changeHandler(e) { |
| | | const { |
| | | columnIndex, |
| | | index, |
| | | // 微信小程序无法将picker实例传出来,只能通过ref操作 |
| | | picker = this.$refs.uPicker |
| | | } = e |
| | | console.log(e, "/*/*/*") |
| | | let item = e.values[columnIndex][index] |
| | | console.log(item, "-----------") |
| | | //街道 |
| | | if (columnIndex === 0) { |
| | | //获取社区列表 |
| | | const nei = await this.getDoorplateAddressList(item.code, "nei") |
| | | picker.setColumnValues(1, nei) |
| | | |
| | | const streetRu = await this.getDoorplateAddressList(nei[0].code, "streetRu") |
| | | picker.setColumnValues(2, streetRu) |
| | | |
| | | const district = await this.getDoorplateAddressList(streetRu[0].code, "district") |
| | | picker.setColumnValues(3, district) |
| | | |
| | | const building = await this.getDoorplateAddressList(district[0].code, "building") |
| | | picker.setColumnValues(4, building) |
| | | } |
| | | |
| | | if (columnIndex === 1) { |
| | | const streetRu = await this.getDoorplateAddressList(item.code, "streetRu") |
| | | picker.setColumnValues(2, streetRu) |
| | | |
| | | const district = await this.getDoorplateAddressList(streetRu[0].code, "district") |
| | | picker.setColumnValues(3, district) |
| | | |
| | | const building = await this.getDoorplateAddressList(district[0].code, "building") |
| | | picker.setColumnValues(4, building) |
| | | } |
| | | |
| | | if (columnIndex === 2) { |
| | | |
| | | const district = await this.getDoorplateAddressList(item.code, "district") |
| | | picker.setColumnValues(3, district) |
| | | |
| | | const building = await this.getDoorplateAddressList(district[0].code, "building") |
| | | picker.setColumnValues(4, building) |
| | | } |
| | | |
| | | if (columnIndex === 3) { |
| | | const building = await this.getDoorplateAddressList(item.code, "building") |
| | | picker.setColumnValues(4, building) |
| | | } |
| | | |
| | | }, |
| | | |
| | | //弹出层打开 |
| | | popup() { |
| | | this.$refs.uniPopup.open() |
| | |
| | | |
| | | .item { |
| | | |
| | | .form-item { |
| | | /deep/ .form-item { |
| | | background-color: #ffffff; |
| | | padding: 2rpx 10px; |
| | | border-bottom: 1px solid #eff1f3; |