selectList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="checked" v-for="(item,index) in checkList">
  5. <view class="checked-box">
  6. <view class="checked-img">
  7. <image :src="item.img" mode=""></image>
  8. </view>
  9. <view class="checked-text">
  10. <view class="checked-name">{{item.nickname}}</view>
  11. <view class="checked-phone">{{item.phone}}</view>
  12. </view>
  13. </view>
  14. <!-- <radio value="1" :checked="xuanze==='1'" @click="checked('1')"></radio> -->
  15. <view class="">
  16. <radio @click="click(item,index)" :key="index" :checked="isChange == index" color="#6EAB4E">
  17. </radio>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="button" @click="navJiedian()">
  22. 确认
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. // import {
  28. // getReferralList
  29. // } from '@/api/user.js';
  30. // import{ getReferralList}
  31. // import {
  32. // getChooseList
  33. // } from '@/api/user.js';
  34. import {
  35. getChooseList,
  36. addJiedian
  37. } from '@/api/user.js'
  38. export default {
  39. data() {
  40. return {
  41. parent_area:'',
  42. patent:'',
  43. uid: '',
  44. wuyue: [],
  45. isChange: -1, //单选
  46. checkList: [{
  47. img: '',
  48. name: '',
  49. phone: '',
  50. }
  51. ]
  52. }
  53. },
  54. onLoad(option) {
  55. // this.getChoosesList()
  56. this.getla()
  57. console.log(option)
  58. this.parent_area = option.parent_area
  59. this.patent = option.patent
  60. },
  61. methods: {
  62. getla() {
  63. let obj = this
  64. getChooseList().then(res => {
  65. console.log(res, '11111')
  66. obj.checkList = res.data.data
  67. })
  68. },
  69. //判断当前index是否与ischange相等,再次点击取消
  70. click(item,index) {
  71. console.log(item,'item')
  72. this.uid = item.uid
  73. this.isChange = index
  74. },
  75. navJiedian(){
  76. if(this.uid == '') {
  77. return this.$api.msg('请选择用户')
  78. }
  79. console.log(this.patent,this.parent_area,'dddddddddddddddddddd')
  80. addJiedian({
  81. patent:this.patent ,
  82. parent_area: this.parent_area,
  83. uid: this.uid,
  84. }).then(res=>{
  85. this.$api.msg(res.msg)
  86. console.log(res,'11122344')
  87. this.$api.prePage().loadData()
  88. setTimeout(()=> {
  89. uni.navigateBack({})
  90. },1000)
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. page {
  98. padding: 0;
  99. margin: 0;
  100. height: 100%;
  101. background-color: #F8F6F6;
  102. .page {
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. }
  107. .button {
  108. margin-top: 60rpx;
  109. width: 699rpx;
  110. height: 90rpx;
  111. border-radius: 45px;
  112. text-align: center;
  113. line-height: 70rpx;
  114. height: 70rpx;
  115. background: #6EAB4E;
  116. font-size: 28rpx;
  117. font-weight: 500;
  118. color: #FFFFFF;
  119. }
  120. .content {
  121. width: 100%;
  122. display: flex;
  123. flex-wrap: nowrap;
  124. flex-direction: column;
  125. margin-top: 20rpx;
  126. background-color: #FFFFFF;
  127. .checked {
  128. height: 130rpx;
  129. margin: 0 30rpx;
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. .checked-box {
  134. display: flex;
  135. .checked-img {
  136. width: 80rpx;
  137. height: 80rpx;
  138. border-radius: 50%;
  139. overflow: hidden;
  140. image {
  141. width: 100%;
  142. height: 100%;
  143. }
  144. }
  145. .checked-text {
  146. margin-left: 20rpx;
  147. display: flex;
  148. flex-direction: column;
  149. justify-content: space-between;
  150. .checked-name {
  151. font-size: 30rpx;
  152. font-weight: 500;
  153. color: #3F454B;
  154. }
  155. .checked-phone {
  156. font-size: 22rpx;
  157. font-weight: 400;
  158. color: #999999;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>