apply.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="apply-agent">
  3. <view class="banner d-c-c d-c" v-if="top_background!=''">
  4. <image :src="top_background" mode="widthFix"></image>
  5. </view>
  6. <!--申请成功-->
  7. <template v-if="!is_applying ">
  8. <view class="form-wrap p30 f30">
  9. <view class="p30 d-c-c gray3 f40 fb">
  10. {{words.apply.words.title.value}}
  11. </view>
  12. <form @submit="formSubmit" @reset="formReset">
  13. <view class="form-item border-b">
  14. <view class="field-name">邀请人</view>
  15. {{referee_name}}
  16. </view>
  17. <view class="form-item border-b">
  18. <view class="field-name">姓名</view>
  19. <input class="flex-1 ml20" name="name" type="text" value="" placeholder-class="grary" placeholder="请输入姓名" />
  20. </view>
  21. <view class="form-item border-b">
  22. <view class="field-name">手机号</view>
  23. <input class="flex-1 ml20" name="mobile" type="number" value="" placeholder-class="grary" placeholder="请输入手机" />
  24. </view>
  25. <view class="d-c-c p-20-0 f28">
  26. <checkbox-group @change="changeFunc">
  27. <checkbox value="checkbox" :checked="is_read" />
  28. </checkbox-group>
  29. <text>我已阅读并了解</text>
  30. <text class="red" @click="isPopup=true">
  31. 【{{ words.apply.words.license.value }}】
  32. </text>
  33. </view>
  34. <view class="d-c-c mt30">
  35. <button class="btn-red" form-type="submit">{{ words.apply.words.submit.value }}</button>
  36. </view>
  37. </form>
  38. </view>
  39. </template>
  40. <!--分销商审核中-->
  41. <template v-if="is_applying">
  42. <view class="d-c-c pt30">
  43. <text style=" font-size: 100rpx;" class="icon iconfont icon-icon_xianshi-xian"></text>
  44. </view>
  45. <view class="p-30-0 d-c-c gray6 f30">
  46. {{ words.apply.words.wait_audit.value }}
  47. </view>
  48. <view class="p30 mt30 d-c-c">
  49. <button type="primary" class="btn-red" @click="gotoShop">{{ words.apply.words.goto_mall.value }}</button>
  50. </view>
  51. </template>
  52. <!--协议-->
  53. <Popup :show="isPopup" msg="申请协议">
  54. <view class="agreement-content f28 lh150">
  55. {{agreement}}
  56. </view>
  57. <view class="ww100 pt20 d-c-c">
  58. <button type="primary" class="btn-red" @click="isPopup=false">我已阅读</button>
  59. </view>
  60. </Popup>
  61. </view>
  62. </template>
  63. <script>
  64. import Popup from '@/components/uni-popup.vue'
  65. export default {
  66. components: {
  67. Popup
  68. },
  69. data() {
  70. return {
  71. /*弹窗是否打开*/
  72. isPopup: false,
  73. /*是否阅读了规则*/
  74. is_read:false,
  75. agreement: '',
  76. is_applying: false,
  77. referee_name:'',
  78. words:{},
  79. is_agent:'',
  80. /*顶部背景*/
  81. top_background: '',
  82. /*小程序订阅消息*/
  83. temlIds: [],
  84. }
  85. },
  86. mounted() {
  87. /*数据*/
  88. this.getData();
  89. },
  90. methods: {
  91. /*获取数据*/
  92. getData() {
  93. let self = this;
  94. uni.showLoading({
  95. title: '加载中'
  96. })
  97. self._get('user.agent/apply', {
  98. platform: self.getPlatform(),
  99. referee_id: uni.getStorageSync('referee_id')
  100. }, function(res) {
  101. uni.hideLoading();
  102. self.top_background = res.data.background;
  103. self.is_applying = res.data.is_applying;
  104. self.referee_name = res.data.referee_name!=null?res.data.referee_name:'平台';
  105. self.is_agent=res.data.is_agent;
  106. self.words = res.data.words;
  107. self.temlIds = res.data.template_arr;
  108. self.agreement = res.data.license;
  109. /*设置标题*/
  110. uni.setNavigationBarTitle({
  111. title: self.words.apply.title.value
  112. });
  113. if(self.is_agent){
  114. uni.navigateBack({});
  115. }
  116. });
  117. },
  118. /*申请*/
  119. formSubmit: function(e) {
  120. let formdata = e.detail.value;
  121. formdata.referee_id=uni.getStorageSync('referee_id');
  122. let self = this;
  123. if(formdata.name==''){
  124. uni.showToast({
  125. title: '请输入姓名!',
  126. icon:'none'
  127. });
  128. return;
  129. }
  130. if(formdata.mobile.length==''){
  131. uni.showToast({
  132. title: '请输入手机号!',
  133. icon: 'none'
  134. });
  135. return;
  136. }
  137. if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(formdata.mobile)) {
  138. uni.showToast({
  139. title: '手机有误,请重填!',
  140. icon: 'none'
  141. });
  142. return;
  143. }
  144. if(!self.is_read){
  145. uni.showToast({
  146. title: '请同意协议!',
  147. icon:'none'
  148. });
  149. return;
  150. }
  151. let callback = function(){
  152. uni.showLoading({
  153. title: '正在提交',
  154. mask: true
  155. })
  156. self._post('plus.agent.apply/submit', formdata, function(res) {
  157. uni.hideLoading();
  158. uni.showToast({
  159. title: '申请成功'
  160. });
  161. self.getData();
  162. });
  163. };
  164. self.subMessage(self.temlIds, callback);
  165. },
  166. /*去商城看看*/
  167. gotoShop(){
  168. uni.switchTab({
  169. url:'/pages/index/index'
  170. })
  171. },
  172. /*同意协议*/
  173. changeFunc(e){
  174. if(e.target.value.length>0){
  175. this.is_read=true;
  176. }else{
  177. this.is_read=false;
  178. }
  179. }
  180. }
  181. }
  182. </script>
  183. <style>
  184. .apply-agent .banner {
  185. background-repeat: no-repeat;
  186. background-size: 100%;
  187. }
  188. .apply-agent .banner image{ width: 100%;}
  189. .form-wrap {
  190. background: #FFFFFF;
  191. box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, .2);
  192. }
  193. .form-item {
  194. padding: 20rpx 0;
  195. margin-bottom: 20rpx;
  196. display: flex;
  197. justify-content: flex-start;
  198. align-items: center;
  199. font-size: 28rpx;
  200. }
  201. .form-item .field-name {
  202. width: 180rpx;
  203. }
  204. .form-item input {
  205. font-size: 28rpx;
  206. }
  207. .agreement-content {
  208. max-height: 60vh;
  209. overflow-y: auto;
  210. }
  211. .apply-agent .btn-red{
  212. width: 600rpx;
  213. height: 88rpx;
  214. line-height: 88rpx;
  215. border-radius: 44rpx;
  216. box-shadow: 0 8rpx 16rpx 0 rgba(226,35,26,.6);}
  217. </style>