123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <view>
- <form>
- <view class="cu-form-group margin-top">
- <view class="title"><text class="text-red text-bold padding-right-xs">*</text>姓名</view>
- <input placeholder="请输入姓名" data-val="title" @input="bindInput"></input>
- </view>
- <view class="cu-form-group">
- <view class="title"><text class="text-red text-bold padding-right-xs">*</text>手机号</view>
- <input placeholder="请输入手机号" data-val="mobile" @input="bindInput"></input>
- </view>
- <view class="cu-form-group">
- <view class="title"><text class="text-red text-bold padding-right-xs">*</text>代理门店</view>
- <picker mode="selector" @change="agentChange" :value="agentIndex" :range="agentArray" range-key="title">
- <view class="picker">
- {{agentArray[agentIndex].title}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title"><text class="text-red text-bold padding-right-xs">*</text>镇街</view>
- <picker mode="multiSelector" @change="TownChange" @columnchange="TownColumnChange" :value="townIndex" :range="townArray">
- <view class="picker">
- {{townArray[0][townIndex[0]]}},{{townArray[1][townIndex[1]]}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title"><text class="text-red text-bold padding-right-xs">*</text>区域</view>
- <input placeholder="请输入区域" data-val="region" @input="bindInput"></input>
- </view>
- <view class="cu-form-group">
- <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 工作地点</view>
- <view style="flex: 1; font-size: 30rpx; color: #AAAAAA; line-height: 100rpx;">
- <input placeholder="详细地址" disabled :value="address" v-if="address"></input>
- <button class="cu-btn bg-blue margin-tb-sm lg" style="width: 100%;" @tap="gpsmap()">地图选位置</button>
- </view>
- </view>
- <view class="padding flex flex-direction bg-white">
- <button class="cu-btn bg-blue margin-tb-sm lg" @tap="submit">立即提交</button>
- </view>
- <view class="bg-white padding-lr padding-bottom">申请经济人后等待后台审核</view>
- </form>
- </view>
- </template>
- <script>
- var _this;
- export default {
- data() {
- return {
- isRotate: false,
- address: '',
- userinfo: {},
- forminfo: {
- title: '',
- mobile: '',
- region: '',
- latitude: 0,
- longitude: 0,
- },
- agentArray: [],
- agentIndex: 0,
- townArray: [
- [],
- [],
- ],
- townIndex: [0,0],
- village: [],
- };
- },
- onLoad: function(){
- _this = this;
- _this.userinfo = _this.checkLogin("/pages/my/myinfo");
- //公司
- _this.$req.ajax({
- path: "index/getAgent",
- data: {}
- }).then((data) => {
- _this.agentArray = data;
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- //镇街
- _this.$req.ajax({
- path: "index/getTown",
- data: {}
- }).then((data) => {
- _this.townArray = [data.town,data.village[0]];
- _this.village = data.village
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- },
- methods: {
- bindInput(e) {
- var dataval = e.currentTarget.dataset.val;
- _this.forminfo[dataval] = e.detail.value;
- },
- agentChange(e) {
- this.agentIndex = e.detail.value
- },
- TownChange(e) {
- this.townIndex = e.detail.value
- },
- TownColumnChange(e) {
- let townIndex = _this.townIndex;
- //公司变更
- if (e.detail.column == 0) {
- _this.townArray[1] = _this.village[e.detail.value];
- _this.townIndex = [e.detail.value,0];
- _this.$forceUpdate();
- }
-
- //街道变更
- if (e.detail.column == 1) {
- townIndex[1] = e.detail.value;
- _this.townIndex = townIndex;
- _this.$forceUpdate();
- }
- },
- RegionChange(e) {
- this.region = e.detail.value
- },
- //打开地图
- gpsmap:function(){
- uni.chooseLocation({
- success: function (res) {
- _this.address=res.address;
- _this.forminfo.latitude=res.latitude;
- _this.forminfo.longitude=res.longitude;
- }
- });
- },
- submit() {
- if (_this.isRotate) {
- return false;
- }
- _this.isRotate = true;
-
- let data = _this.forminfo;
- let validate = {"title":"姓名","mobile":"手机号","region":"区域","latitude":"请点击地图选择位置"};
- for (var i in validate) {
- if (data[i] == "") {
- uni.showModal({
- title: '信息提示',
- content: validate[i]+"不能为空",
- showCancel: false
- });
- _this.isRotate = false;
- return false;
- }
- }
-
- data.userid = _this.userinfo.id;
- data.workerid = _this.agentArray[_this.agentIndex].workerid;
- data.agentid = _this.agentArray[_this.agentIndex].id;
- data.town = _this.townArray[0][_this.townIndex[0]];
- data.village = _this.townArray[1][_this.townIndex[1]];
-
- _this.$req.ajax({
- path: "broker/apply",
- data: data
- }).then((data) => {
- uni.showModal({
- title: '信息提示',
- content: '提交成功,等待管理员审核',
- showCancel: false,
- success: function() {
- uni.reLaunch({
- url: '/pages/index/index'
- });
- },
- });
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- _this.isRotate = false;
- });
- },
- }
- }
- </script>
- <style>
- .cu-form-group .title {
- min-width: calc(4em + 15px);
- }
- </style>
|