vipUserItem.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="pb130 column flex-1 hb">
  3. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled" :refresher-triggered="triggered"
  4. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh"
  5. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  6. @refresherabort="triggered = false" @scrolltolower="reachBottom">
  7. <view v-for="(item,index) in viplist" :key="index" class="justify-start align-center">
  8. <u-checkbox-group @change="changeitem(index)" v-if="isShowSelectAll">
  9. <u-checkbox :checked="item.checked" shape="circle" activeColor="#FF6C47" :name="true"
  10. labelColor="#FF6C47" />
  11. </u-checkbox-group>
  12. <view class="list-item w100" @click="morepage(item)" >
  13. <view class="list-item-head x-bc">
  14. <view class="x-f" style="flex: 1;overflow: hidden;">
  15. <u-avatar :src='item.avatar'></u-avatar>
  16. <view class="list-item-head-l">
  17. <view style="flex: 1;overflow: hidden;display: flex;" @click.passive.stop>
  18. <text class="list-item-name one-t">{{item.nickName}}</text>
  19. <image class="list-item-copy" src="@/static/images/copy_icon.png" mode="aspectFill"
  20. @click="copyId(item.userId)">
  21. </image>
  22. </view>
  23. <view class="list-item-re">注册时间:{{item.createTime?item.createTime.substring(0,10):'--'}}
  24. </view>
  25. </view>
  26. </view>
  27. <image class="phone" src="@/static/manergevip/phone.png" mode="aspectFill"
  28. v-if="!isShowSelectAll" @click="tophone(item.phone)" @click.passive.stop></image>
  29. </view>
  30. <view class="list-item-desc">
  31. <view class="taglist">
  32. <!-- <view><u-tag text="停止看课三天" size="mini" color="#1677ff" bgColor="#fff" borderColor="#fff"></u-tag></view>
  33. <view v-for="(tag,i) in item.tags ? item.tags.split(',') : []" >
  34. <u-tag :text="tag" size="mini" color="#999" bgColor="#fff" borderColor="#fff"></u-tag>
  35. </view> -->
  36. <!-- <view class="base-color-red">停止看课 3 天</view>
  37. <view class="u-border-right u-border-left plr10 base-color-9">
  38. 参与营期 <text class="bold pl6 base-color-3">1</text></view>
  39. <view class="base-color-9">缺课数量 <text class="base-color-red pl8">2</text></view> -->
  40. </view>
  41. <!-- <view style="margin-top: 5px;">
  42. <text class="label" style="color:red;margin-right: 20px;">停止看课{{item.watchCount || 0}}天</text>
  43. <text class="label">参与营期</text><text class="value-num">{{item.watchCount || 0}}</text>
  44. <text class="label">缺课数量</text><text class="value-num" style="color:red">{{item.watchComlpleteCount || 0}}</text>
  45. </view> -->
  46. <view class="justify-start">
  47. <view class="base-color mr8 pr8 u-border-right" v-if="user.userType==0">
  48. {{item.companyUsernickName}}
  49. </view>
  50. <view class="justify-around">
  51. <view v-for="(item,index) in item.tagsName" :key="index" class="mlr4">{{item}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="justify-between" v-if="!isShowSelectAll" @click.passive.stop>
  56. <view @click="morepage(item)">更多</view>
  57. <view class="justify-start">
  58. <view class="btn-box base-color base-bg-sure bor-blue" @click="openModel('label',item)"
  59. v-if="item.isBlack==0">改标签</view>
  60. <view class="btn-box base-color-red base-bg-false bor-red"
  61. @click="openModel('disable',item)" v-if="item.isBlack==0">禁用</view>
  62. <view class="btn-box base-color-red base-bg-false bor-red" @click="openModel('change',item)"
  63. v-if="item.isBlack==0 && user.userType==0">更换归属</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <u-loadmore :status="status" />
  69. </scroll-view>
  70. <u-notify ref="uNotify" message=""></u-notify>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. props: {
  76. viplist: {
  77. type: Array,
  78. default: () => []
  79. },
  80. isShowSelectAll: {
  81. type: Boolean,
  82. default: false, //是否显示全选 由外部控制
  83. },
  84. pageOptions: {
  85. type: Object,
  86. default: () => ({
  87. pageNum: 1,
  88. pageSize: 12,
  89. })
  90. },
  91. status: {
  92. type: String,
  93. default: 'loadmore'
  94. }
  95. },
  96. data() {
  97. return {
  98. checkList: [],
  99. cccc: [false],
  100. user: [],
  101. isEnabled: true,
  102. triggered: false,
  103. }
  104. },
  105. mounted() {
  106. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  107. },
  108. methods: {
  109. tophone(phone){
  110. console.log(phone)
  111. if(phone==null){
  112. uni.showToast({
  113. title: '用户暂时没有录入电话',
  114. icon: 'none',
  115. duration: 2000
  116. });
  117. }else{
  118. uni.setClipboardData({
  119. data: String(phone),
  120. success: () => {
  121. // 拨号跳转
  122. uni.makePhoneCall({
  123. phoneNumber: phone, // 电话号码
  124. success: () => {
  125. console.log('拨号成功');
  126. },
  127. fail: () => {
  128. console.log('拨号失败');
  129. }
  130. });
  131. },
  132. })
  133. }
  134. },
  135. copyId(id) {
  136. uni.setClipboardData({
  137. data: String(id),
  138. success: () => {
  139. uni.showToast({
  140. title: '复制成功',
  141. icon: 'none',
  142. duration: 2000
  143. });
  144. },
  145. })
  146. },
  147. pullDownRefresh() {
  148. // 下拉
  149. this.triggered = true; //下拉了状态为true
  150. setTimeout(() => {
  151. this.triggered = false;
  152. uni.stopPullDownRefresh()
  153. this.$emit('changePageOptions', {
  154. ...this.pageOptions,
  155. pageNum: 1
  156. })
  157. // listParmas.page = 1;//页码为1
  158. // reSetList()
  159. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  160. // 请求接口
  161. this.$emit('pullDownRefresh')
  162. }, 1000)
  163. },
  164. reachBottom() {
  165. //上拉
  166. // status这个是加载状态
  167. if (this.status === 'loadmore') {
  168. this.$emit('changeStatus', 'loading')
  169. uni.showNavigationBarLoading()
  170. setTimeout(() => {
  171. //触底页码+1
  172. // listParmas.page += 1;
  173. this.$emit('changePageOptions', {
  174. ...this.pageOptions,
  175. pageNum: this.pageOptions.pageNum + 1
  176. })
  177. //请求接口
  178. this.$emit('reachBottom')
  179. uni.hideNavigationBarLoading()
  180. }, 1000);
  181. }
  182. },
  183. morepage(item) {
  184. uni.navigateTo({
  185. url: '/pages/courseManage/vip/ManageDetail'
  186. })
  187. uni.setStorageSync('detailUser', item)
  188. },
  189. openModel(tag, item) {
  190. if (tag == 'label') {
  191. this.$emit('getlableId', item.userId)
  192. } else if (tag == 'disable') {
  193. this.$emit('getuserId', item.userId)
  194. console.log(item.userId)
  195. } else {
  196. this.$emit('change', item.userId)
  197. }
  198. },
  199. // 单选
  200. changeitem(index) {
  201. this.$emit('changeItem', index) //传参
  202. }
  203. // api请求参考
  204. /* v3写法 你改一下
  205. type=refresh表示刷新
  206. const getListData = async (type = 'refresh') => {
  207. loadStatus.value = 'loading'//加载状态变成正在加载中 ‘loading’
  208. // 开始请求接口
  209. const result = await getDataFn({
  210. ...parmas,
  211. ...listParmas.value,
  212. })
  213. if (result) {
  214. returnData.value = result.data
  215. const {
  216. last_page,//最后一页是第几页
  217. data,
  218. } = result.data
  219. // 如果下拉 数据为第一页的
  220. if (type == 'refresh') {
  221. listData.value = data
  222. } else {
  223. // 否则是触底 数据等于当前页然后追加下一页的
  224. listData.value = [...listData.value, ...data]
  225. }
  226. // 如果当前页》=最后一页 nomore 没有更多了
  227. if (listParmas.value.page >= last_page) {
  228. loadStatus.value = 'nomore';
  229. } else {//不然就是还有下一页 loadmore加载更多
  230. loadStatus.value = 'loadmore';
  231. }
  232. }
  233. }
  234. */
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .btn-box {
  240. height: 26px;
  241. padding: 0 10px;
  242. margin-left: 10px;
  243. border-radius: 25px;
  244. font-weight: 400;
  245. font-size: 10px;
  246. line-height: 26px;
  247. box-sizing: border-box;
  248. }
  249. .list-item {
  250. padding: 10px;
  251. margin-bottom: 10px;
  252. background-color: #fff;
  253. border-radius: 12px;
  254. &-head {
  255. .phone {
  256. flex-shrink: 0;
  257. width: 30px;
  258. height: 30px;
  259. }
  260. &-l {
  261. flex: 1;
  262. overflow: hidden;
  263. margin-left: 10px;
  264. margin-right: 10px;
  265. }
  266. }
  267. &-copy {
  268. width: 20px;
  269. height: 20px;
  270. }
  271. &-re {
  272. font-size: 10px;
  273. margin-top: 5px;
  274. }
  275. &-desc {
  276. padding: 5px;
  277. color: #999;
  278. font-size: 12px;
  279. }
  280. .label {
  281. margin-right: 4px;
  282. }
  283. .value-num {
  284. margin-right: 18px;
  285. color: #222;
  286. font-weight: bold;
  287. }
  288. .taglist {
  289. display: flex;
  290. align-items: center;
  291. flex-wrap: wrap;
  292. color: #555;
  293. padding-top: 5px;
  294. view {
  295. margin: 0 5px 5px 0;
  296. }
  297. }
  298. &-footer {
  299. justify-content: flex-end;
  300. padding: 6px 0;
  301. .footer-tagbtn {
  302. color: #1677ff;
  303. background-color: #e7f2fe;
  304. border: 1px solid #c9e1fb;
  305. }
  306. .footer-red {
  307. color: #f93e3e;
  308. background-color: #fae7e7;
  309. border: 1px solid #f7a1a1;
  310. }
  311. &-btn {
  312. height: 26px;
  313. padding: 0 10px;
  314. margin-left: 10px;
  315. background-color: #f5f5f5;
  316. border-radius: 25px;
  317. font-weight: 400;
  318. font-size: 10px;
  319. line-height: 26px;
  320. border: 1px solid #f5f5f5;
  321. box-sizing: border-box;
  322. }
  323. }
  324. }
  325. </style>