teamUser.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="default_page adffc" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='团队成员'></cus-header>
  4. <view class="add" @click="handleAdd">+ 添加</view>
  5. <view class="list" v-if="list.length">
  6. <u-swipe-action>
  7. <u-swipe-action-item v-for="(item, index) in list" :key="index"
  8. :options="options" @click="e=>deleteUser(item,e)" :ref="'swipeAction' + index" :threshold="5"
  9. >
  10. <view class="swipe-action u-border-top u-border-bottom">
  11. <view class="swipe-action__content">
  12. <view class="lbox adfac">
  13. <template v-if="type">
  14. <image class="lbox-select" v-if="item.select" :src="imgBase+'selected.png'"></image>
  15. <image class="lbox-select" v-else :src="imgBase+'not_select.png'"></image>
  16. </template>
  17. <view class="lbox-info">
  18. <view class="lbox-info-top adfac">
  19. <text>{{item.realName}}</text>
  20. <template v-if="type">
  21. <view class="type">{{'赞助人Sponsor'}}</view>
  22. </template>
  23. </view>
  24. <view class="lbox-info-email">{{item.email}}</view>
  25. </view>
  26. <view class="lbox-edit" @click="handleEdit(item)">
  27. <u-icon name="edit-pen" size="42rpx" color="#B9B9B9"></u-icon>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </u-swipe-action-item>
  33. </u-swipe-action>
  34. </view>
  35. <view v-else class="adffcacjc" style="flex: 1;">
  36. <empty text='暂无团队人员,请添加'></empty>
  37. </view>
  38. <view class="btn" v-if="type">确定</view>
  39. </view>
  40. </template>
  41. <script>
  42. import empty from '@/components/pageEmpty/index.vue'
  43. export default {
  44. components:{ empty },
  45. data(){
  46. return {
  47. type:'',
  48. query:{
  49. page:1,
  50. limit:10,
  51. coachId:''
  52. },
  53. isOver:false,
  54. list:[],
  55. options: [
  56. {
  57. text: '删除',
  58. icon: 'trash',
  59. iconSize:'32rpx',
  60. style: {
  61. backgroundColor: '#f56c6c'
  62. }
  63. }
  64. ],
  65. }
  66. },
  67. onLoad(options) {
  68. this.type = options.type;
  69. this.query.coachId = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).id||''
  70. this.getList()
  71. },
  72. methods:{
  73. scrolltolower(){
  74. if(this.isOver) return
  75. this.getList()
  76. },
  77. getList(){
  78. this.$api.get('/core/member/page',this.query).then(({data:res})=>{
  79. if(res.code!==0) return this.$showToast(res.msg)
  80. this.list = [...this.list,...res.data.list]
  81. this.query.page++
  82. if(this.length>=res.data.total) this.isOver = true
  83. })
  84. },
  85. deleteUser(item,index){
  86. uni.showModal({
  87. title:'温馨提示',
  88. content:`是否确认删除团队成员【${item.realName}】?`,
  89. success: (res) => {
  90. if(res.confirm){
  91. this.$api.del('/core/member',[item.id]).then(({data:res})=>{
  92. if(res.code!==0) return this.$showToast(res.msg)
  93. this.query.page = 1;
  94. this.list = [];
  95. this.isOver = false;
  96. this.getList()
  97. })
  98. this.list.forEach((d, i) => {
  99. this.$refs['swipeAction' + i][0].closeHandler();
  100. })
  101. }
  102. }
  103. })
  104. },
  105. handleAdd(){
  106. uni.navigateTo({
  107. url:'/pagesMy/teamUserDetail'
  108. })
  109. },
  110. handleEdit(item){
  111. uni.navigateTo({
  112. url:'/pagesMy/teamUserDetail?id='+item.id
  113. })
  114. },
  115. }
  116. }
  117. </script>
  118. <style scoped lang="scss">
  119. ::v-deep .u-swipe-action-item{
  120. margin-top: 20rpx;
  121. }
  122. ::v-deep .swipe-action{
  123. border: none !important;
  124. }
  125. .default_page{
  126. padding: 0 24rpx;
  127. box-sizing: border-box;
  128. .add{
  129. width: calc(100% - 52rpx);
  130. height: 88rpx;
  131. background: #FFFFFF;
  132. border-radius: 44rpx;
  133. border: 1rpx solid #33A7A7;
  134. margin: 30rpx 26rpx 0;
  135. font-family: PingFang-SC, PingFang-SC;
  136. font-weight: bold;
  137. font-size: 32rpx;
  138. color: #009191;
  139. line-height: 88rpx;
  140. text-align: center;
  141. }
  142. .list{
  143. flex: 1;
  144. overflow-y: auto;
  145. margin-top: 20rpx;
  146. .lbox{
  147. background: #FFFFFF;
  148. box-shadow: inset 0rpx -1rpx 0rpx 0rpx rgba(229,231,235,0.5);
  149. border-radius: 24rpx;
  150. padding: 36rpx 24rpx 40rpx;
  151. margin-top: 20rpx;
  152. &-select{
  153. width: 36rpx;
  154. height: 36rpx;
  155. margin-right: 24rpx;
  156. }
  157. &-info{
  158. flex: 1;
  159. &-top{
  160. text{
  161. font-family: PingFang-SC, PingFang-SC;
  162. font-weight: bold;
  163. font-size: 32rpx;
  164. color: #002846;
  165. line-height: 32rpx;
  166. }
  167. .type{
  168. background: #FFF7DC;
  169. border-radius: 21rpx;
  170. padding: 6rpx 16rpx;
  171. font-family: PingFangSC, PingFang SC;
  172. font-weight: 400;
  173. font-size: 22rpx;
  174. color: #BA9B31;
  175. line-height: 30rpx;
  176. margin-left: 20rpx;
  177. }
  178. }
  179. &-email{
  180. font-family: PingFangSC, PingFang SC;
  181. font-weight: 400;
  182. font-size: 28rpx;
  183. color: #666666;
  184. line-height: 28rpx;
  185. margin-top: 30rpx;
  186. }
  187. }
  188. &-edit{
  189. width: 30rpx;
  190. height: 30rpx;
  191. }
  192. }
  193. }
  194. .btn{
  195. width: calc(100% - 52rpx);
  196. height: 88rpx;
  197. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);
  198. border-radius: 44rpx;
  199. font-family: PingFang-SC, PingFang-SC;
  200. font-weight: bold;
  201. font-size: 32rpx;
  202. color: #FFFFFF;
  203. line-height: 88rpx;
  204. text-align: center;
  205. letter-spacing: 2rpx;
  206. margin: 40rpx 26rpx 54rpx;
  207. }
  208. }
  209. </style>