form.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. onShareAppMessage(res) {
  87. //分享转发
  88. if (res.from === 'button') {
  89. // 来自页面内转发按钮
  90. }
  91. return {
  92. title: '联合丽格集采商城',
  93. path: 'pages/tabBar/home/index',
  94. imageUrl: `${this.staticUrl}icon_share_home@2x.png`
  95. }
  96. },
  97. onShow() {
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. page {
  103. height: auto;
  104. background: $bg-color;
  105. border-top: 1px solid #ebebeb;
  106. }
  107. .operator {
  108. padding-top: 160rpx;
  109. .operator-content {
  110. width: 100%;
  111. padding: 0 75rpx;
  112. box-sizing: border-box;
  113. .operator-from {
  114. width: 100%;
  115. height: auto;
  116. .from-row {
  117. height: 40rpx;
  118. padding: 24rpx 0;
  119. background: #ffffff;
  120. margin-bottom: 40rpx;
  121. font-size: $font-size-28;
  122. color: $text-color;
  123. border-bottom: 1px solid #e1e1e1;
  124. .input {
  125. width: 100%;
  126. height: 100%;
  127. text-align: left;
  128. }
  129. }
  130. }
  131. .operator-text {
  132. width: 100%;
  133. height: auto;
  134. margin-top: 50rpx;
  135. line-height: 40rpx;
  136. .title {
  137. margin-bottom: 50rpx;
  138. .icon-gantanhao-yuankuang {
  139. font-size: $font-size-32;
  140. color: #166ce1;
  141. margin-right: 10rpx;
  142. }
  143. .text-m {
  144. font-size: $font-size-30;
  145. color: #166ce1;
  146. }
  147. .text-s {
  148. font-size: $font-size-24;
  149. color: #999999;
  150. }
  151. }
  152. .text-main {
  153. width: 100%;
  154. height: auto;
  155. view {
  156. line-height: 40rpx;
  157. font-size: $font-size-24;
  158. color: #999999;
  159. text-align: justify;
  160. margin-bottom: 10rpx;
  161. &.h1 {
  162. color: #666666;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. .add-btn {
  169. width: 600rpx;
  170. height: 88rpx;
  171. font-size: $font-size-28;
  172. line-height: 88rpx;
  173. color: #ffffff;
  174. margin: 0 auto;
  175. text-align: center;
  176. background: $btn-confirm;
  177. border-radius: 44rpx;
  178. margin-top: 80rpx;
  179. &.disabled {
  180. background: #e1e1e1;
  181. border-radius: 44rpx;
  182. }
  183. }
  184. .add-btn.disabled {
  185. background: #f8f8f8;
  186. border-radius: 44rpx;
  187. }
  188. }
  189. </style>