broker.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {extend name="public/base"/}
  2. {block name="css"}
  3. <style>
  4. </style>
  5. {/block}
  6. {block name="body"}
  7. <van-nav-bar
  8. class="nav-theme"
  9. :fixed="true"
  10. :placeholder="true"
  11. >
  12. <template #title>
  13. <span class="text-white">省外经纪人注册</span>
  14. </template>
  15. </van-nav-bar>
  16. <van-image src="__STATIC__/images/applet/bg/broker.png"></van-image>
  17. <van-form @submit="onSubmit">
  18. <van-cell-group>
  19. <van-field
  20. v-model="form.title"
  21. required
  22. label="姓名"
  23. placeholder="请输入姓名"
  24. :rules="[
  25. { required: true, message: '请输入姓名' }
  26. ]"
  27. ></van-field>
  28. <van-field
  29. v-model="form.mobile"
  30. required
  31. label="手机号"
  32. placeholder="请输入手机号"
  33. :rules="[
  34. { required: true, message: '请输入手机号' },
  35. { validator, message: '请输入正确的手机号'}
  36. ]"
  37. ></van-field>
  38. <van-field
  39. v-model="agent_name"
  40. is-link
  41. required
  42. readonly
  43. label="门店"
  44. placeholder="选择门店"
  45. @click="showAgent = true"
  46. :rules="[
  47. { required: true, message: '请选择门店' }
  48. ]"
  49. ></van-field>
  50. <van-popup v-model:show="showAgent" round position="bottom">
  51. <van-picker
  52. :columns="agentList"
  53. @cancel="showAgent = false"
  54. @confirm="onAgentListConfirm"
  55. ></van-picker>
  56. </van-popup>
  57. <van-field
  58. v-model="form.region"
  59. required
  60. label="区域"
  61. placeholder="请输入区域"
  62. :rules="[
  63. { required: true, message: '请输入区域' }
  64. ]"
  65. ></van-field>
  66. </van-cell-group>
  67. <div style="margin: 16px;">
  68. <van-button block type="primary" native-type="submit">确定</van-button>
  69. </div>
  70. </van-form>
  71. {/block}
  72. {block name="script"}
  73. <script>
  74. function v_setup() {
  75. let base = {};
  76. //表单
  77. base.form = Vue.reactive({
  78. title: '',
  79. mobile: '',
  80. agent_id: 0,
  81. region: '',
  82. });
  83. //门店选择
  84. base.agent_name = Vue.ref('');
  85. base.showAgent = Vue.ref(false);
  86. base.agentList = Vue.reactive({$agent_list});
  87. base.onAgentListConfirm = ({selectedOptions}) => {
  88. base.showAgent.value = false;
  89. base.form.agent_id = selectedOptions[0].value;
  90. base.agent_name.value = selectedOptions[0].text;
  91. };
  92. //登录
  93. base.onSubmit = () => {
  94. const param = base.form;
  95. postJson("{:url('login/brokerPost')}", param).then(({data}) => {
  96. location.href = data.url;
  97. });
  98. };
  99. //手机号验证
  100. base.validator = (val) => {
  101. return /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(val);
  102. };
  103. return base;
  104. }
  105. </script>
  106. {/block}