form.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="container operator clearfix">
  3. <view class="operator-content">
  4. <view class="operator-from">
  5. <view class="from-row">
  6. <input
  7. class="input"
  8. type="text"
  9. v-model="params.linkName"
  10. placeholder="请输入运营人员姓名"
  11. maxlength="6"
  12. />
  13. </view>
  14. <view class="from-row">
  15. <input
  16. class="input"
  17. type="text"
  18. v-model="params.mobile"
  19. placeholder="请输入运营人员手机号"
  20. maxlength="11"
  21. />
  22. </view>
  23. <button
  24. class="add-btn"
  25. :disabled="disabled"
  26. :class="[disabled ? 'disabled' : '']"
  27. @click="hanldConfirm"
  28. >
  29. 确定
  30. </button>
  31. </view>
  32. <view class="operator-text">
  33. <view class="text-main">
  34. <view class="h1">注意事项:</view> <view>1. 添加运营人员后,运营人员会收到一条邀请码短信</view>
  35. <view>2.运营人员直接使用邀请码进行登录“丽格集采联盟”小程序,同时绑定微信。</view>
  36. <view>3.绑定后,运营人员可通过微信直接登录“丽格集采联盟”小程序。</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import authorize from '@/common/config/authorize.js'
  44. export default {
  45. data() {
  46. return {
  47. params: {
  48. mobile: '',
  49. linkName: '',
  50. userId: 0,
  51. clubId: 0,
  52. configFlag: 2
  53. }
  54. }
  55. },
  56. onLoad(option) {},
  57. computed: {
  58. disabled() {
  59. return !(this.params.mobile && this.params.linkName)
  60. }
  61. },
  62. methods: {
  63. //提交
  64. async hanldConfirm() {
  65. if (!/(^1[0-9][0-9]{9}$)/.test(this.params.mobile)) {
  66. this.$util.msg('请输入正确的手机号码')
  67. return
  68. }
  69. const use = await this.$api.getStorage()
  70. this.params.userId = use.userId
  71. this.params.clubId = use.clubId
  72. this.addOperator(this.params)
  73. },
  74. async addOperator(params){
  75. try{
  76. const res = await this.UserService.PostAddOperator(params)
  77. this.$util.msg(res.msg, 2000, true, 'success')
  78. setTimeout(() => {
  79. uni.navigateBack()
  80. }, 2000)
  81. }catch(error){
  82. this.$util.msg(error.msg, 2000)
  83. }
  84. }
  85. },
  86. onShow() {
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. page {
  92. height: auto;
  93. background: $bg-color;
  94. border-top: 1px solid #ebebeb;
  95. }
  96. .operator {
  97. padding-top: 160rpx;
  98. .operator-content {
  99. width: 100%;
  100. padding: 0 75rpx;
  101. box-sizing: border-box;
  102. .operator-from {
  103. width: 100%;
  104. height: auto;
  105. .from-row {
  106. height: 40rpx;
  107. padding: 24rpx 0;
  108. background: #ffffff;
  109. margin-bottom: 40rpx;
  110. font-size: $font-size-28;
  111. color: $text-color;
  112. border-bottom: 1px solid #e1e1e1;
  113. .input {
  114. width: 100%;
  115. height: 100%;
  116. text-align: left;
  117. }
  118. }
  119. }
  120. .operator-text {
  121. width: 100%;
  122. height: auto;
  123. margin-top: 50rpx;
  124. line-height: 40rpx;
  125. .title {
  126. margin-bottom: 50rpx;
  127. .icon-gantanhao-yuankuang {
  128. font-size: $font-size-32;
  129. color: #166ce1;
  130. margin-right: 10rpx;
  131. }
  132. .text-m {
  133. font-size: $font-size-30;
  134. color: #166ce1;
  135. }
  136. .text-s {
  137. font-size: $font-size-24;
  138. color: #999999;
  139. }
  140. }
  141. .text-main {
  142. width: 100%;
  143. height: auto;
  144. view {
  145. line-height: 40rpx;
  146. font-size: $font-size-24;
  147. color: #999999;
  148. text-align: justify;
  149. margin-bottom: 10rpx;
  150. &.h1 {
  151. color: #666666;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. .add-btn {
  158. width: 600rpx;
  159. height: 88rpx;
  160. font-size: $font-size-28;
  161. line-height: 88rpx;
  162. color: #ffffff;
  163. margin: 0 auto;
  164. text-align: center;
  165. background: $btn-confirm;
  166. border-radius: 44rpx;
  167. margin-top: 80rpx;
  168. &.disabled {
  169. background: #e1e1e1;
  170. border-radius: 44rpx;
  171. }
  172. }
  173. .add-btn.disabled {
  174. background: #f8f8f8;
  175. border-radius: 44rpx;
  176. }
  177. }
  178. </style>