add-member.blade.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. @extends('layouts.base')
  2. @section('title', '添加会员详情')
  3. @section('content')
  4. <link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
  5. <style scoped>
  6. /* 标题 */
  7. .el-form-item__label {
  8. font-weight: 600;
  9. }
  10. /* 头部 */
  11. .head {
  12. position: relative;
  13. height: 800px;
  14. }
  15. /* 表单盒子 */
  16. .form_item_box {
  17. width: 1200px;
  18. margin: 50px auto
  19. }
  20. /* 头像 */
  21. .head_portrait {
  22. width: 90px;
  23. height: 90px;
  24. margin-top: 13px;
  25. border-radius: 5px;
  26. }
  27. /* 脚部 */
  28. /* .fixed {
  29. margin-left: -10px;
  30. width: 100%;
  31. padding: 0;
  32. padding-top: 10px;
  33. position: absolute;
  34. bottom: 0;
  35. box-shadow: 0px -1px 10px rgba(0, 0, 0, .1);
  36. } */
  37. /* 页脚盒子 */
  38. /* .fixed_box {
  39. width: 300px;
  40. height: 40px;
  41. margin: 0 auto;
  42. } */
  43. .inp-w{
  44. width:600px;
  45. }
  46. </style>
  47. <div class="all">
  48. <div id="app">
  49. <!-- 面包屑导航 -->
  50. <div style="margin-top:20px">
  51. <el-breadcrumb style="user-select:none;" separator-class="el-icon-arrow-right">
  52. <el-breadcrumb-item :to="{ path: '/' }"><span @click="hisGo(-1)">会员管理</span></el-breadcrumb-item>
  53. <el-breadcrumb-item :to="{ path: '/' }"><span @click="hisGo(-1)">全部会员</span></el-breadcrumb-item>
  54. <el-breadcrumb-item :to="{ path: '/' }">添加会员</el-breadcrumb-item>
  55. </el-breadcrumb>
  56. </div>
  57. <!-- 头部 -->
  58. <div class="total-head head">
  59. <div class="vue-title">
  60. <div class="vue-title-left"></div>
  61. <div class="vue-title-content">添加会员</div>
  62. </div>
  63. <el-form label-width="100px" :model="ruleForm" style="cursor: pointer;" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  64. <!-- 表单列表 -->
  65. <div class="form_item_box">
  66. <el-form-item label="粉丝">
  67. <div>
  68. <img class="head_portrait" :src="avatar" alt="">
  69. </div>
  70. </el-form-item>
  71. <el-form-item prop="bindPhone" label="绑定手机">
  72. <el-input clearable v-model=" ruleForm.bindPhone" class="inp-w" autocomplete="off"></el-input>
  73. </el-form-item>
  74. <el-form-item prop="loginPad" label="登录密码">
  75. <el-input clearable v-model="ruleForm.loginPad" type="password" class="inp-w" autocomplete="off">
  76. </el-input>
  77. </el-form-item>
  78. <el-form-item prop="affirmPad" label="确认密码">
  79. <el-input clearable v-model="ruleForm.affirmPad" type="password" class="inp-w" autocomplete="off">
  80. </el-input>
  81. </el-form-item>
  82. </div>
  83. </el-form>
  84. </div>
  85. <div class="total-floo fixed">
  86. <div class="fixed_box">
  87. <el-form>
  88. <el-form-item>
  89. <el-button @click="sumbit('ruleForm')" type="primary">提交</el-button>
  90. <el-button @click="returnEvent">返回</el-button>
  91. </el-form-item>
  92. </el-form>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <script>
  98. const vm = new Vue({
  99. el: "#app",
  100. name: "auth",
  101. delimiters: ["[[", "]]"],
  102. data() {
  103. //校验手机号
  104. let validatorPhone = function(rule, value, callback) {
  105. if (value === '') {
  106. callback(new Error('手机号不能为空'))
  107. } else {
  108. if (!value||isNaN(value)||value.length!=11) {
  109. callback(new Error('手机号格式错误'))
  110. }
  111. callback();
  112. return false;
  113. let reg = /^[1][3,4,5,7,8][0-9]{9}$/;
  114. if (!reg.test(value)) {
  115. callback(new Error('手机号格式错误'))
  116. };
  117. callback();
  118. }
  119. };
  120. //校验密码
  121. let validatePass = (rule, value, callback) => {
  122. if (value === '') {
  123. callback(new Error('请输入密码'));
  124. } else {
  125. if (this.ruleForm.affirmPad !== '') {
  126. this.$refs.ruleForm.validateField('affirmPad');
  127. }
  128. callback();
  129. }
  130. };
  131. //校验确认密码
  132. let validatePass2 = (rule, value, callback) => {
  133. if (value === '') {
  134. callback(new Error('请再次输入密码'));
  135. } else if (value !== this.ruleForm.loginPad) {
  136. callback(new Error('两次输入密码不一致!'));
  137. } else {
  138. callback();
  139. }
  140. }
  141. return {
  142. avatar: "",
  143. ruleForm: {
  144. bindPhone: '',
  145. loginPad: '',
  146. affirmPad: ''
  147. },
  148. rules: {
  149. bindPhone: [{
  150. validator: validatorPhone,
  151. trigger: 'blur'
  152. }],
  153. loginPad: [{
  154. validator: validatePass,
  155. trigger: 'blur'
  156. }],
  157. affirmPad: [{
  158. validator: validatePass2,
  159. trigger: 'blur'
  160. }],
  161. }
  162. }
  163. },
  164. created() {
  165. this.postAddVip();
  166. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  167. // window.onload = function() {
  168. // let all = document.querySelector(".all");
  169. // let h = window.innerHeight * 0.05;
  170. // all.style.paddingBottom = h + "px";
  171. // }
  172. },
  173. methods: {
  174. //回退
  175. hisGo(i) {
  176. // console.log(i);
  177. history.go(i)
  178. },
  179. postAddVip(i) {
  180. this.$http.post("{!!yzWebFullUrl('member.member.add-member-data')!!}", {
  181. item: i,
  182. mobile: this.ruleForm.bindPhone,
  183. password: this.ruleForm.loginPad,
  184. confirm_password: this.ruleForm.affirmPad,
  185. }).then(res => {
  186. console.log(res);
  187. let {
  188. data
  189. } = res.body;
  190. this.avatar = data.img
  191. //弹框
  192. // console.log(res.data.result);
  193. // console.log(res.data.msg);
  194. if (i === 1) {
  195. if (res.data.result === 1) {
  196. this.$message.success(res.data.msg);
  197. let url = `{!! yzWebFullUrl('member.member.index') !!}`;
  198. setTimeout(() => {
  199. window.location.href = url;
  200. }, 1000)
  201. } else {
  202. this.$message.error(res.data.msg + "请重新输入")
  203. }
  204. }
  205. })
  206. },
  207. sumbit(formName) {
  208. this.$refs[formName].validate((valid) => {
  209. if (valid) {
  210. this.postAddVip(1);
  211. } else {
  212. return false;
  213. }
  214. });
  215. },
  216. returnEvent() {
  217. history.go(-1);
  218. }
  219. }
  220. })
  221. </script>@endsection