agentform.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view>
  3. <image class="echo-agentformpic" mode="widthFix" :src="param.agentformpic"></image>
  4. <view class="padding-xl"></view>
  5. <view class="cu-bar bg-white tabbar border shop foot">
  6. <view class="btn-group">
  7. <button class="cu-btn bg-red round shadow-blur" @tap="tabModal" style="width: 80%;">立即申请成为代理</button>
  8. </view>
  9. </view>
  10. <view class="cu-modal" :class="showform">
  11. <view class="cu-dialog">
  12. <view class="cu-bar bg-white justify-end">
  13. <view class="content">申请成为代理</view>
  14. <view class="action" @tap="tabModal">
  15. <text class="cuIcon-close text-red"></text>
  16. </view>
  17. </view>
  18. <view class="padding bg-white margin-top-xs echo-agentform">
  19. <form>
  20. <view class="cu-form-group">
  21. <view class="title">姓名</view>
  22. <input placeholder="请输入姓名" @input="bindInput" data-val="realname" :value="forminfo.realname"></input>
  23. </view>
  24. <view class="cu-form-group">
  25. <view class="title">手机号</view>
  26. <input placeholder="请输入手机号" @input="bindInput" data-val="mobile" :value="forminfo.mobile"></input>
  27. </view>
  28. <view class="cu-form-group">
  29. <view class="title">当前住址</view>
  30. <input placeholder="请输入当前住址" @input="bindInput" data-val="address" :value="forminfo.address"></input>
  31. </view>
  32. <view class="cu-form-group">
  33. <view class="title">身份证号</view>
  34. <input placeholder="请输入身份证号" @input="bindInput" data-val="idcard" :value="forminfo.idcard"></input>
  35. </view>
  36. <view class="cu-form-group solids-bottom">
  37. <view class="title">推荐人</view>
  38. <input placeholder="请输入推荐人" @input="bindInput" data-val="recommender" :value="forminfo.recommender"></input>
  39. </view>
  40. <view class="padding-lr padding-top flex flex-direction">
  41. <button class="cu-btn bg-orange margin-tb-sm lg" @tap="regBroker">确认提交</button>
  42. </view>
  43. </form>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. var _this;
  51. export default {
  52. data() {
  53. return {
  54. showform: '',
  55. param: {},
  56. isRotate: false,
  57. forminfo: {
  58. realname: "",
  59. mobile: "",
  60. address: "",
  61. idcard: "",
  62. recommender: ""
  63. }
  64. };
  65. },
  66. onLoad: function(){
  67. _this = this;
  68. _this.$req.ajax({
  69. path: "agent/pageform",
  70. data: {}
  71. }).then((data) => {
  72. _this.param = data.param;
  73. }).catch((err) => {
  74. uni.showModal({
  75. title: '信息提示',
  76. content: err,
  77. showCancel: false
  78. });
  79. });
  80. },
  81. methods: {
  82. regBroker: function() {
  83. if(_this.isRotate){
  84. return false;
  85. }
  86. _this.isRotate = true;
  87. _this.$req.ajax({
  88. path: "agent/regagent",
  89. data: {
  90. realname: _this.forminfo.realname,
  91. mobile: _this.forminfo.mobile,
  92. address: _this.forminfo.address,
  93. idcard: _this.forminfo.idcard,
  94. recommender: _this.forminfo.recommender
  95. }
  96. }).then((data) => {
  97. uni.showModal({
  98. title: '信息提示',
  99. content: "注册申请提交成功,请耐心等待。",
  100. showCancel: false,
  101. success: function(res) {
  102. if (res.confirm) {
  103. _this.forminfo = {
  104. realname: "",
  105. mobile: "",
  106. address: "",
  107. idcard: "",
  108. recommender: ""
  109. };
  110. _this.tabModal();
  111. }
  112. }
  113. });
  114. _this.isRotate = false;
  115. }).catch((err) => {
  116. uni.showModal({
  117. title: '信息提示',
  118. content: err,
  119. showCancel: false
  120. });
  121. _this.isRotate = false;
  122. });
  123. },
  124. bindInput: function(e) {
  125. var dataval = e.currentTarget.dataset.val;
  126. _this.forminfo[dataval] = e.detail.value;
  127. },
  128. tabModal: function() {
  129. _this.showform = _this.showform=="show" ? "" : "show";
  130. }
  131. }
  132. }
  133. </script>
  134. <style>
  135. .echo-agentformpic{ width: 100%; display: block; }
  136. .echo-agentform view.title{ text-align: left !important; width: 30%; }
  137. .echo-agentform input{ text-align: left !important; width: 70%; }
  138. </style>