sqdl.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 20rpx;">
  4. </view>
  5. <view class="tab">
  6. <view class="bd-wrap flex">
  7. <view class="bg-name">
  8. 姓名:
  9. </view>
  10. <view class="bg-val">
  11. <input type="text" value="" placeholder="请输入您的姓名" class="val-ipt" v-model="name" ref="name" />
  12. </view>
  13. </view>
  14. <view class="bd-wrap flex">
  15. <view class="bg-name">
  16. 联系方式:
  17. </view>
  18. <view class="bg-val">
  19. <input type="text" value="" placeholder="请输入您的联系方式" class="val-ipt" v-model="phone" ref="phone" />
  20. </view>
  21. </view>
  22. <!-- <pickerAddress class="input" @change="onCityClick">{{addressDetail||'请选择地址'}}</pickerAddress> -->
  23. <view class="bd-wrap flex">
  24. <view class="bg-name">
  25. 所在地区:
  26. </view>
  27. <view class="bg-val">
  28. <pickerAddress class="input" @change="onCityClick">{{address||'请选择地址'}}</pickerAddress>
  29. </view>
  30. </view>
  31. <view class="bd-wrap flex">
  32. <view class="bg-name">
  33. 详细地址:
  34. </view>
  35. <view class="bg-val">
  36. <input type="text" value="" placeholder="请输入详细地址" class="val-ipt" v-model="addressDetail"
  37. ref="address" />
  38. </view>
  39. </view>
  40. <view class="bd-wrap flex">
  41. <view class="bg-name">
  42. 店名或公司名称:
  43. </view>
  44. <view class="bg-val">
  45. <input type="text" value="" placeholder="请输入店名或公司名称" class="val-ipt" v-model="storename"
  46. ref="storenamae" />
  47. </view>
  48. </view>
  49. <view class="bd-wrap flex" v-if="!userInfo.spread_uid">
  50. <view class="bg-name">
  51. 推荐人:
  52. </view>
  53. <view class="bg-val">
  54. <input type="text" value="" placeholder="请输入推荐人UID(可选填)" class="val-ipt" v-model="spread"
  55. ref="storenamae" />
  56. </view>
  57. </view>
  58. <view class="bd-wrap flex">
  59. <view class="bg-name">
  60. 等级:
  61. </view>
  62. <view class="bg-val">
  63. <picker @change="bindLevelChange" :value="index" :range="levelList" mode="selector"
  64. range-key="name">
  65. <view class="val-ipt ">{{chooseLevel.name||'请选择等级'}}</view>
  66. </picker>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="btm-btn" @click="enroll">
  71. 提交申请
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  77. import {
  78. enroll
  79. } from '@/api/index.js'
  80. import {
  81. getLevelList,
  82. } from '@/api/user.js'
  83. import {
  84. mapState,
  85. mapMutations
  86. } from 'vuex';
  87. export default {
  88. components: {
  89. pickerAddress
  90. },
  91. data() {
  92. return {
  93. levelList: [],
  94. index: 0,
  95. chooseLevel: '',
  96. name: '',
  97. phone: '',
  98. address: '',
  99. storename: '',
  100. spread: '',
  101. addressDetail: '',
  102. loading: false,
  103. };
  104. },
  105. onLoad(opt) {
  106. this.getLevelList()
  107. },
  108. onShow() {
  109. },
  110. onReachBottom() {
  111. },
  112. computed: {
  113. ...mapState('user', ['userInfo'])
  114. },
  115. methods: {
  116. // 选中城市切换
  117. onCityClick({
  118. data
  119. }) {
  120. // let address = this.addressData.address;
  121. // address.province = data[0];
  122. // address.city = data[1];
  123. // address.district = data[2];
  124. this.address = data.join('-');
  125. },
  126. getLevelList() {
  127. getLevelList().then(res => {
  128. this.levelList = res.data
  129. })
  130. },
  131. bindLevelChange(e) {
  132. console.log(e)
  133. this.chooseLevel = this.levelList[e.detail.value]
  134. },
  135. enroll() {
  136. let that = this
  137. console.log('bin');
  138. if (that.loading) {
  139. return
  140. }
  141. if (that.name == '') {
  142. return that.$api.msg('请输入您的姓名')
  143. }
  144. if (that.phone == '') {
  145. return that.$api.msg('请输入您的联系方式')
  146. }
  147. console.log(that.chooseLevel, '123456');
  148. if (!that.chooseLevel) {
  149. return that.$api.msg('请选择你的等级')
  150. }
  151. that.loading = true
  152. enroll({
  153. uid: that.userInfo.uid,
  154. name: that.name,
  155. phone: that.phone,
  156. address: that.address,
  157. storename: that.storename,
  158. spread: that.spread,
  159. addressDetail: that.addressDetail,
  160. level: that.chooseLevel.id,
  161. level_name: that.chooseLevel.name
  162. }).then(res => {
  163. console.log(res);
  164. uni.showToast({
  165. title: '提交成功',
  166. duration: 2000
  167. });
  168. setTimeout(() => {
  169. uni.switchTab({
  170. url: '/pages/user/user'
  171. })
  172. that.loading = false
  173. }, 1500)
  174. }).catch(err => {
  175. console.log('err');
  176. that.loading = false
  177. })
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. .tab {
  184. width: 690rpx;
  185. margin: auto;
  186. // height: 606rpx;
  187. background: #FFFFFF;
  188. border-radius: 10rpx;
  189. }
  190. .bd-wrap {
  191. width: 690rpx;
  192. // height: 100rpx;
  193. padding: 20rpx 0;
  194. background-color: #fff;
  195. border-bottom: 1px solid #f2f2f2;
  196. // line-height: 100rpx;
  197. font-size: 32rpx;
  198. position: relative;
  199. .code {
  200. position: absolute;
  201. width: 100rpx;
  202. height: 100rpx;
  203. right: 10rpx;
  204. color: #f64342;
  205. font-size: 23rpx;
  206. }
  207. .bg-name {
  208. width: 280rpx;
  209. height: 100%;
  210. padding-left: 20rpx;
  211. }
  212. .bg-val {
  213. width: 430rpx;
  214. height: 100%;
  215. .val-ipt {
  216. display: inline-block;
  217. width: 100%;
  218. height: 100%;
  219. // background-color: #009100;
  220. padding-left: 10rpx;
  221. }
  222. }
  223. }
  224. .btm-btn {
  225. margin: 105rpx auto 0;
  226. width: 654rpx;
  227. height: 82rpx;
  228. background: linear-gradient(180deg, #3C82E6, #5395F5);
  229. border-radius: 10rpx;
  230. font-size: 34rpx;
  231. font-weight: 500;
  232. color: #FFFFFF;
  233. text-align: center;
  234. line-height: 82rpx;
  235. }
  236. </style>