|
@@ -59,6 +59,7 @@
|
|
|
<view class="submit-btn">
|
|
|
<image src="/static/img/contact/submit.png" mode="aspectFill" />
|
|
|
<button class="confirm-btn" :disabled="disabled" form-type="submit"></button>
|
|
|
+ <button form-type="reset" ref="resrtBtn" style="display:none;">取消</button>
|
|
|
</view>
|
|
|
</form>
|
|
|
</view>
|
|
@@ -80,6 +81,7 @@
|
|
|
|
|
|
<script>
|
|
|
import pickRegions from '@/components/pick-regions/pick-regions.vue';
|
|
|
+import { saveApply } from '@/api/apply';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -87,13 +89,14 @@ export default {
|
|
|
disabled:false,
|
|
|
form: {
|
|
|
customer_name: '',
|
|
|
- mobile: ''
|
|
|
+ mobile: '',
|
|
|
+ type: 0
|
|
|
},
|
|
|
region:[],
|
|
|
defaultRegionCode: '110101',
|
|
|
defaultRegion:['北京市','市辖区','东城区'],
|
|
|
typeIndex: -1,
|
|
|
- typeList: ["教学渠道代理", "思维芯游戏教室渠道代理", "家庭版渠道代理", "HOME&PLUS渠道代理", "探索小镇渠道代理(TOWN)", "合作园所(北京地区园所)"],
|
|
|
+ typeList: ["教学渠道代理", "思维芯游戏教室渠道代理", "家庭版渠道代理", "HOME&PLUS渠道代理", "探索小镇渠道代理(TOWN)", "合作园所(北京地区园所)"],
|
|
|
reqBody: {}
|
|
|
}
|
|
|
},
|
|
@@ -127,11 +130,74 @@ export default {
|
|
|
methods: {
|
|
|
formSubmit(e) {
|
|
|
console.log(e.detail.value);
|
|
|
+ console.log(this.typeIndex);
|
|
|
+ // {
|
|
|
+ // "entity": {
|
|
|
+ // "customer_name": "李哈哈测试22",
|
|
|
+ // "mobile": "13120373714",
|
|
|
+ // "address": "xxxxx"
|
|
|
+ // },
|
|
|
+ // "field": [{
|
|
|
+ // "fieldId": 135,
|
|
|
+ // "fieldName": "代理商类型",
|
|
|
+ // "value": "教学渠道代理",
|
|
|
+ // }]
|
|
|
+ // }
|
|
|
+ let formData = e.detail.value;
|
|
|
let rules = [
|
|
|
- { name: 'parentName', checkType: 'notnull', checkRule: '', errorMsg: '请填写家长姓名' },
|
|
|
- { name: 'parentPhone', checkType: 'phoneno', checkRule: '', errorMsg: '联系方式不正确'},
|
|
|
- // { name: 'address', checkType: 'notnull', checkRule: '', errorMsg: '请填写详细地址'},
|
|
|
+ { name: 'customerName', checkType: 'notnull', checkRule: '', errorMsg: '请填写姓名' },
|
|
|
+ { name: 'customerName', checkType: 'string', checkRule: '2,8', errorMsg: '请输入2-8位姓名' },
|
|
|
+ { name: 'type', checkType: 'in', checkRule: '0, 1, 2, 3, 4, 5', errorMsg: '意向不能为空' },
|
|
|
+ { name: 'mobile', checkType: 'notnull', checkRule: '', errorMsg: '请填写联系方式'},
|
|
|
+ { name: 'mobile', checkType: 'phoneno', checkRule: '', errorMsg: '联系方式不正确'},
|
|
|
]
|
|
|
+ let regionRule = [
|
|
|
+ { name: 'regionCode', checkType: 'notnull', checkRule: '', errorMsg: '请选择所在地区'},
|
|
|
+ ];
|
|
|
+ this.reqBody['regionCode'] = this.region;
|
|
|
+ let checkRes = this.$mGraceChecker.check(formData, rules);
|
|
|
+ if (!checkRes) {
|
|
|
+ // this.disabled = true;
|
|
|
+ this.$mHelper.toast(this.$mGraceChecker.error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let regionRes = this.$mGraceChecker.check(this.reqBody, regionRule)
|
|
|
+ if (!regionRes) {
|
|
|
+ this.$mHelper.toast(this.$mGraceChecker.error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (this.typeIndex == -1) {
|
|
|
+ this.$mHelper.toast('请选择您的意向');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ let entity = {
|
|
|
+ customer_name: formData.customerName,
|
|
|
+ mobile: formData.mobile,
|
|
|
+ address: this.region.map(item=>item.name).join(',')
|
|
|
+ };
|
|
|
+
|
|
|
+ let field = [{
|
|
|
+ fieldId: 135,
|
|
|
+ name: "代理商类型",
|
|
|
+ value: this.typeList[this.typeIndex]
|
|
|
+ }];
|
|
|
+
|
|
|
+ if (checkRes && regionRes && this.typeIndex != -1) {
|
|
|
+ this.$http.post(saveApply, {
|
|
|
+ entity,
|
|
|
+ field
|
|
|
+ }).then(res=> {
|
|
|
+ this.$mHelper.toast('提交成功!我们会在在第一时间内联系您');
|
|
|
+ this.$refs.resrtBtn.$dispatch('Form', 'uni-form-reset', {
|
|
|
+ type: 'reset'
|
|
|
+ })
|
|
|
+ this.typeIndex = -1;
|
|
|
+ this.region = []
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err')
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
typeChange(e) {
|
|
|
const index = e.detail.value;
|
|
@@ -148,7 +214,7 @@ export default {
|
|
|
|
|
|
<style lang="scss">
|
|
|
.contact {
|
|
|
- padding: 86upx 0 44upx;
|
|
|
+ padding: 86upx 0 120upx;
|
|
|
background: url('@/static/img/contact/bg.png') no-repeat #01A2E8;
|
|
|
background-size: cover;
|
|
|
.title {
|