vipUserItem.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class=" column flex-1 hb" style="height: 100%;">
  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 single-line-ellipsis"
  19. style="width: fit-content;">{{item.nickname}}</text>
  20. <image class="list-item-copy" src="@/static/images/copy_icon.png" mode="aspectFill"
  21. @click="copyId(item.nickname)">
  22. </image>
  23. </view>
  24. <text class="list-item-name one-t fs24 base-color-9 ">备注:{{item.remark}}</text>
  25. <view class="list-item-re">注册时间:{{item.createTime?item.createTime.substring(0,10):'--'}}
  26. </view>
  27. </view>
  28. </view>
  29. <image class="phone" src="@/static/manergevip/phone.png" mode="aspectFill"
  30. v-if="!isShowSelectAll" @click="tophone(item.phone)" @click.passive.stop></image>
  31. </view>
  32. <view class="list-item-desc">
  33. <view class="taglist ">
  34. <view><u-tag :text="item.companyUserNickName"
  35. size="mini" color="#029aff" bgColor="#fff" borderColor="#fff"></u-tag></view>
  36. <view v-for="(tag,i) in item.tag ? item.tag.split(',') : []" :key="index">
  37. <u-tag :text="tag" size="mini" color="#999" bgColor="#fff" borderColor="#fff"></u-tag>
  38. </view>
  39. </view>
  40. <view style="margin-top: 5px;" v-if="item.status==1">
  41. <text class="label u-border-right pr20" style="color:#00af05;" v-if="item.courseCountStatus==1">正常看课</text>
  42. <text class="label u-border-right pr20" style="color:#ff8921;"
  43. v-else-if="item.courseCountStatus==2">停止看课{{item.stopWatchDays || 0}}天</text>
  44. <text class="label u-border-right pr20" style="color:#f00;" v-else>未看过课</text>
  45. <text class="label pl20 ">参与营期</text><text class="value-num ">{{item.partCourseCount || 0}}</text>
  46. <text class="label u-border-left pl20">缺课数量</text><text class="value-num" style="color:red">{{item.missCourseCount || 0}}</text>
  47. </view>
  48. </view>
  49. <view class="justify-between align-center" v-if="!isShowSelectAll" @click.passive.stop>
  50. <view @click="changemore(item)"
  51. class="fs24 u-border ptb4 plr18 radius40 base-color-6">更多</view>
  52. <view class="justify-start">
  53. <view class="btn-box base-color base-bg-sure bor-blue" @click="openModel('label',item)"
  54. v-if="item.status==1">改标签</view>
  55. <view class="btn-box base-color-red base-bg-false bor-red"
  56. @click="openModel('disable',item)" v-if="item.status==1">禁用</view>
  57. <view class="btn-box base-color-red base-bg-false bor-red"
  58. @click="openModel('disabled',item)" v-if="item.status==0">取消禁用</view>
  59. <!-- <view class="btn-box base-color-red base-bg-false bor-red" @click="openModel('change',item)"
  60. v-if="item.status!=7 && user.userType==0">更换归属</view> -->
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <u-loadmore :status="status" />
  66. </scroll-view>
  67. <u-popup :show="showmore" @close="closemore" @open="openmore" >
  68. <view class="column align-center">
  69. <view class="m20" v-for="(items,index) in morelist"
  70. :key="items.value" @click="nameMore(items)">
  71. {{items.name}}</view>
  72. <u-modal :show="showlist" :title="titlelist" @confirm="confirmchange" >
  73. <view class="slot-content">
  74. <u-input :placeholder="contpl" v-model="changelist" v-if="selnum==0"></u-input>
  75. <u-input :placeholder="contpl" v-model="changeremark" v-if="selnum==1"></u-input>
  76. </view>
  77. </u-modal>
  78. </view>
  79. </u-popup>
  80. <u-notify ref="uNotify" message=""></u-notify>
  81. </view>
  82. </template>
  83. <script>
  84. import {getchangesUserInfo} from '@/api/courseManage.js'
  85. export default {
  86. props: {
  87. viplist: {
  88. type: Array,
  89. default: () => []
  90. },
  91. isShowSelectAll: {
  92. type: Boolean,
  93. default: false, //是否显示全选 由外部控制
  94. },
  95. pageOptions: {
  96. type: Object,
  97. default: () => ({
  98. pageNum: 1,
  99. pageSize: 8,
  100. })
  101. },
  102. status: {
  103. type: String,
  104. default: 'loadmore'
  105. }
  106. },
  107. data() {
  108. return {
  109. checkList: [],
  110. cccc: [false],
  111. user: [],
  112. isEnabled: true,
  113. triggered: false,
  114. stopWatchDays:'停止看课三天',
  115. showmore:false,
  116. contpl:'',
  117. changelist:'',
  118. changeremark:'',
  119. selnum:'',
  120. titlelist:'',
  121. showlist:false,
  122. groupid:'',
  123. openData:[],
  124. morelist:[
  125. {
  126. name:'改姓名',
  127. value:0,
  128. text:'请输入姓名'
  129. },
  130. {
  131. name:'改备注',
  132. value:1,
  133. text:'请输入备注'
  134. }
  135. ],
  136. }
  137. },
  138. mounted() {
  139. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  140. },
  141. methods: {
  142. changemore(data){
  143. this.openData=data
  144. this.groupid=data.userId,
  145. this.showmore=!this.showmore
  146. },
  147. confirmchange(){
  148. this.updatagroup()
  149. console.log(this.openData.userId)
  150. console.log(this.changeremark)
  151. console.log(this.changelist)
  152. this.showlist=false
  153. setTimeout(()=>{
  154. this.showmore=false
  155. },200)
  156. },
  157. updatagroup(){
  158. const data={
  159. fsUserId:this.openData.userId,
  160. remark:this.changeremark,
  161. nickName:this.changelist
  162. }
  163. getchangesUserInfo(data).then(res=>{
  164. if(res.code==200){
  165. uni.showToast({
  166. icon: 'none',
  167. title: "修改成功"
  168. })
  169. this.$emit('changelistname')
  170. }else{
  171. uni.showToast({
  172. icon: 'none',
  173. title: res.msg
  174. })
  175. }
  176. })
  177. },
  178. nameMore(item){
  179. console.log(item)
  180. this.titlelist=item.name
  181. this.contpl=item.text
  182. this.selnum=item.value
  183. console.log(this.openData)
  184. if(item.value==0){
  185. this.changelist=this.openData.nickname
  186. this.changeremark=this.openData.remark
  187. this.showlist=true
  188. }else if(item.value==1){
  189. this.changelist=this.openData.nickname
  190. this.changeremark=this.openData.remark
  191. this.showlist=true
  192. }
  193. },
  194. closemore(){
  195. this.showmore=!this.showmore
  196. },
  197. openmore(){},
  198. tophone(phone){
  199. console.log(phone)
  200. if(phone==null){
  201. uni.showToast({
  202. title: '用户暂时没有录入电话',
  203. icon: 'none',
  204. duration: 2000
  205. });
  206. }else{
  207. uni.setClipboardData({
  208. data: String(phone),
  209. success: () => {
  210. // 拨号跳转
  211. uni.makePhoneCall({
  212. phoneNumber: phone, // 电话号码
  213. success: () => {
  214. console.log('拨号成功');
  215. },
  216. fail: () => {
  217. console.log('拨号失败');
  218. }
  219. });
  220. },
  221. })
  222. }
  223. },
  224. copyId(id) {
  225. uni.setClipboardData({
  226. data: String(id),
  227. success: () => {
  228. uni.showToast({
  229. title: '复制成功',
  230. icon: 'none',
  231. duration: 2000
  232. });
  233. },
  234. })
  235. },
  236. pullDownRefresh() {
  237. // 下拉
  238. this.triggered = true; //下拉了状态为true
  239. setTimeout(() => {
  240. this.triggered = false;
  241. uni.stopPullDownRefresh()
  242. this.$emit('changePageOptions', {
  243. ...this.pageOptions,
  244. pageNum: 1
  245. })
  246. // listParmas.page = 1;//页码为1
  247. // reSetList()
  248. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  249. // 请求接口
  250. this.$emit('pullDownRefresh')
  251. }, 1000)
  252. },
  253. reachBottom() {
  254. //上拉
  255. // status这个是加载状态
  256. if (this.status === 'loadmore') {
  257. this.$emit('changeStatus', 'loading')
  258. uni.showNavigationBarLoading()
  259. setTimeout(() => {
  260. //触底页码+1
  261. // listParmas.page += 1;
  262. this.$emit('changePageOptions', {
  263. ...this.pageOptions,
  264. pageNum: this.pageOptions.pageNum + 1
  265. })
  266. //请求接口
  267. this.$emit('reachBottom')
  268. uni.hideNavigationBarLoading()
  269. }, 1000);
  270. }
  271. },
  272. morepage(item) {
  273. uni.navigateTo({
  274. url: '/pages/courseManage/vip/ManageDetail?id='+item.userId
  275. })
  276. uni.setStorageSync('detailUser', item)
  277. },
  278. openModel(tag, item) {
  279. if (tag == 'label') {
  280. this.$emit('getlableId', item.userId)
  281. } else if (tag == 'disable') {
  282. this.$emit('getuserId', item.userId)
  283. }else if (tag == 'disabled') {
  284. this.$emit('getuserIds', item.userId)
  285. console.log(item.userId)
  286. } else {
  287. this.$emit('change', item.userId)
  288. }
  289. },
  290. // 单选
  291. changeitem(index) {
  292. this.$emit('changeItem', index) //传参
  293. }
  294. // api请求参考
  295. /* v3写法 你改一下
  296. type=refresh表示刷新
  297. const getListData = async (type = 'refresh') => {
  298. loadStatus.value = 'loading'//加载状态变成正在加载中 ‘loading’
  299. // 开始请求接口
  300. const result = await getDataFn({
  301. ...parmas,
  302. ...listParmas.value,
  303. })
  304. if (result) {
  305. returnData.value = result.data
  306. const {
  307. last_page,//最后一页是第几页
  308. data,
  309. } = result.data
  310. // 如果下拉 数据为第一页的
  311. if (type == 'refresh') {
  312. listData.value = data
  313. } else {
  314. // 否则是触底 数据等于当前页然后追加下一页的
  315. listData.value = [...listData.value, ...data]
  316. }
  317. // 如果当前页》=最后一页 nomore 没有更多了
  318. if (listParmas.value.page >= last_page) {
  319. loadStatus.value = 'nomore';
  320. } else {//不然就是还有下一页 loadmore加载更多
  321. loadStatus.value = 'loadmore';
  322. }
  323. }
  324. }
  325. */
  326. }
  327. }
  328. </script>
  329. <style lang="scss" scoped>
  330. .btn-box {
  331. height: 26px;
  332. padding: 0 10px;
  333. margin-left: 10px;
  334. border-radius: 25px;
  335. font-weight: 400;
  336. font-size: 10px;
  337. line-height: 26px;
  338. box-sizing: border-box;
  339. }
  340. .list-item {
  341. padding: 10px;
  342. margin-bottom: 10px;
  343. background-color: #fff;
  344. border-radius: 12px;
  345. &-head {
  346. .phone {
  347. flex-shrink: 0;
  348. width: 30px;
  349. height: 30px;
  350. }
  351. &-l {
  352. flex: 1;
  353. overflow: hidden;
  354. margin-left: 10px;
  355. margin-right: 10px;
  356. }
  357. }
  358. &-copy {
  359. width: 20px;
  360. height: 20px;
  361. }
  362. &-re {
  363. font-size: 10px;
  364. // margin-top: 5px;
  365. }
  366. &-desc {
  367. padding: 5px;
  368. color: #999;
  369. font-size: 12px;
  370. }
  371. .label {
  372. margin-right: 4px;
  373. }
  374. .value-num {
  375. margin-right: 18px;
  376. color: #222;
  377. font-weight: bold;
  378. }
  379. .taglist {
  380. display: flex;
  381. align-items: center;
  382. flex-wrap: wrap;
  383. color: #555;
  384. padding-top: 5px;
  385. view {
  386. margin: 0 5px 0 0;
  387. }
  388. }
  389. &-footer {
  390. justify-content: flex-end;
  391. padding: 6px 0;
  392. .footer-tagbtn {
  393. color: #1677ff;
  394. background-color: #e7f2fe;
  395. border: 1px solid #c9e1fb;
  396. }
  397. .footer-red {
  398. color: #f93e3e;
  399. background-color: #fae7e7;
  400. border: 1px solid #f7a1a1;
  401. }
  402. &-btn {
  403. height: 26px;
  404. padding: 0 10px;
  405. margin-left: 10px;
  406. background-color: #f5f5f5;
  407. border-radius: 25px;
  408. font-weight: 400;
  409. font-size: 10px;
  410. line-height: 26px;
  411. border: 1px solid #f5f5f5;
  412. box-sizing: border-box;
  413. }
  414. }
  415. }
  416. </style>