xzdl.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="content">
  3. <view class="row b-b">
  4. <text class="tit">选择升级身份</text>
  5. <picker @change="bindlevel" :range="levelList" range-key="name">
  6. <input type="text" placeholder="请选择" class="item-val" v-model="chooseLevel" disabled>
  7. </picker>
  8. </view>
  9. <view class="row b-b">
  10. <text class="tit">选择代理区域</text>
  11. <pickerAddress class="input" @change="onCityClick">{{addressDetail||'请选择地址'}}</pickerAddress>
  12. <!-- <text class="iconfont iconlocation"></text> -->
  13. </view>
  14. <button class="add-btn" @click="loaded?'':confirm()">提交</button>
  15. </view>
  16. </template>
  17. <script>
  18. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  19. import {sqdl} from '@/api/user.js'
  20. export default {
  21. components: {
  22. pickerAddress,
  23. },
  24. data() {
  25. return {
  26. loaded: false,
  27. addressDetail: '',
  28. chooseLevel: '请选择',
  29. leveleId: '',
  30. levelList: [{
  31. name: 'vip代理',
  32. id: 1
  33. },
  34. {
  35. name: '区域代理',
  36. id: 2
  37. }
  38. ],
  39. addressData: {
  40. name: '',
  41. mobile: '',
  42. address: {
  43. province: '',
  44. city: '',
  45. district: ''
  46. },
  47. area: '',
  48. default: false
  49. }
  50. }
  51. },
  52. onLoad() {
  53. },
  54. onShow() {
  55. },
  56. onReachBottom() {
  57. },
  58. onReady() {
  59. },
  60. methods: {
  61. bindlevel(e) {
  62. this.chooseLevel = this.levelList[e.detail.value].name
  63. this.leveleId = this.levelList[e.detail.value].id
  64. },
  65. onCityClick({data}) {
  66. let address = this.addressData.address;
  67. address.province = data[0];
  68. address.city = data[1];
  69. address.district = data[2];
  70. this.addressDetail = data.join('');
  71. },
  72. confirm() {
  73. let obj = this
  74. if(obj.chooseLevel == '请选择') {
  75. return obj.$api.msg('请选择升级身份')
  76. }
  77. if(obj.addressDetail == '') {
  78. return obj.$api.msg('请选择代理区域')
  79. }
  80. obj.loaded = true
  81. sqdl({
  82. type: obj.leveleId,
  83. address:obj.addressDetail
  84. }).then(res => {
  85. uni.showToast({
  86. title:'提交成功',
  87. duration:2000
  88. });
  89. setTimeout(()=> {
  90. uni.switchTab({
  91. url: '/pages/user/user'
  92. })
  93. },1500)
  94. }).catch(err => {
  95. console.log(err)
  96. obj.loaded = false
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .row {
  104. display: flex;
  105. align-items: center;
  106. position: relative;
  107. padding: 0 30rpx;
  108. height: 110rpx;
  109. background: #fff;
  110. .tit {
  111. flex-shrink: 0;
  112. width: 200rpx;
  113. font-size: 30rpx;
  114. color: $font-color-dark;
  115. }
  116. .input {
  117. flex-grow: 1;
  118. font-size: 30rpx;
  119. color: $font-color-dark;
  120. text-align: right;
  121. line-height: 110rpx;
  122. }
  123. .item-val {
  124. // background-color: red;
  125. width: 490rpx;
  126. height: 110rpx;
  127. line-height: 120rpx;
  128. text-align: right;
  129. color: #000;
  130. }
  131. .iconlocation {
  132. font-size: 36rpx;
  133. color: $font-color-light;
  134. }
  135. }
  136. .add-btn {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. width: 690rpx;
  141. height: 80rpx;
  142. margin: 60rpx auto;
  143. font-size: $font-lg;
  144. color: #fff;
  145. background-color: $base-color;
  146. border-radius: 10rpx;
  147. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  148. }
  149. </style>