vipUserItem.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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="imgPath+'/app/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="imgPath+'/app/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.repeatCompanyUserName?item.repeatCompanyUserName: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&&item.isRepeatFans!==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&&item.isRepeatFans!==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&&item.isRepeatFans!==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&&item.isRepeatFans!==1">取消禁用</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. computed: {
  108. imgPath() {
  109. return this.$store.state.imgpath
  110. }
  111. },
  112. data() {
  113. return {
  114. checkList: [],
  115. cccc: [false],
  116. user: [],
  117. isEnabled: true,
  118. triggered: false,
  119. stopWatchDays:'停止看课三天',
  120. showmore:false,
  121. contpl:'',
  122. changelist:'',
  123. changeremark:'',
  124. selnum:'',
  125. titlelist:'',
  126. showlist:false,
  127. groupid:'',
  128. openData:[],
  129. morelist:[
  130. {
  131. name:'改姓名',
  132. value:0,
  133. text:'请输入姓名'
  134. },
  135. {
  136. name:'改备注',
  137. value:1,
  138. text:'请输入备注'
  139. }
  140. ],
  141. }
  142. },
  143. mounted() {
  144. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  145. },
  146. methods: {
  147. changemore(data){
  148. this.openData=data
  149. this.groupid=data.userId,
  150. this.showmore=!this.showmore
  151. },
  152. confirmchange(){
  153. this.updatagroup()
  154. console.log(this.openData.userId)
  155. console.log(this.changeremark)
  156. console.log(this.changelist)
  157. this.showlist=false
  158. setTimeout(()=>{
  159. this.showmore=false
  160. },200)
  161. },
  162. updatagroup(){
  163. const data={
  164. fsUserId:this.openData.userId,
  165. remark:this.changeremark,
  166. nickName:this.changelist
  167. }
  168. getchangesUserInfo(data).then(res=>{
  169. if(res.code==200){
  170. uni.showToast({
  171. icon: 'none',
  172. title: "修改成功"
  173. })
  174. this.$emit('changelistname')
  175. }else{
  176. uni.showToast({
  177. icon: 'none',
  178. title: res.msg
  179. })
  180. }
  181. })
  182. },
  183. nameMore(item){
  184. console.log(item)
  185. this.titlelist=item.name
  186. this.contpl=item.text
  187. this.selnum=item.value
  188. console.log(this.openData)
  189. if(item.value==0){
  190. this.changelist=this.openData.nickname
  191. this.changeremark=this.openData.remark
  192. this.showlist=true
  193. }else if(item.value==1){
  194. this.changelist=this.openData.nickname
  195. this.changeremark=this.openData.remark
  196. this.showlist=true
  197. }
  198. },
  199. closemore(){
  200. this.showmore=!this.showmore
  201. },
  202. openmore(){},
  203. tophone(phone){
  204. console.log(phone)
  205. if(phone==null){
  206. uni.showToast({
  207. title: '用户暂时没有录入电话',
  208. icon: 'none',
  209. duration: 2000
  210. });
  211. }else{
  212. uni.setClipboardData({
  213. data: String(phone),
  214. success: () => {
  215. // 拨号跳转
  216. uni.makePhoneCall({
  217. phoneNumber: phone, // 电话号码
  218. success: () => {
  219. console.log('拨号成功');
  220. },
  221. fail: () => {
  222. console.log('拨号失败');
  223. }
  224. });
  225. },
  226. })
  227. }
  228. },
  229. copyId(id) {
  230. uni.setClipboardData({
  231. data: String(id),
  232. success: () => {
  233. uni.showToast({
  234. title: '复制成功',
  235. icon: 'none',
  236. duration: 2000
  237. });
  238. },
  239. })
  240. },
  241. pullDownRefresh() {
  242. // 下拉
  243. this.triggered = true; //下拉了状态为true
  244. setTimeout(() => {
  245. this.triggered = false;
  246. uni.stopPullDownRefresh()
  247. this.$emit('changePageOptions', {
  248. ...this.pageOptions,
  249. pageNum: 1
  250. })
  251. // listParmas.page = 1;//页码为1
  252. // reSetList()
  253. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  254. // 请求接口
  255. this.$emit('pullDownRefresh')
  256. }, 1000)
  257. },
  258. reachBottom() {
  259. //上拉
  260. // status这个是加载状态
  261. if (this.status === 'loadmore') {
  262. this.$emit('changeStatus', 'loading')
  263. uni.showNavigationBarLoading()
  264. setTimeout(() => {
  265. //触底页码+1
  266. // listParmas.page += 1;
  267. this.$emit('changePageOptions', {
  268. ...this.pageOptions,
  269. pageNum: this.pageOptions.pageNum + 1
  270. })
  271. //请求接口
  272. this.$emit('reachBottom')
  273. uni.hideNavigationBarLoading()
  274. }, 1000);
  275. }
  276. },
  277. morepage(item) {
  278. uni.navigateTo({
  279. url: '/pages/courseManage/vip/ManageDetail?id='+item.userId
  280. })
  281. uni.setStorageSync('detailUser', item)
  282. },
  283. openModel(tag, item) {
  284. if (tag == 'label') {
  285. this.$emit('getlableId', item.userId)
  286. } else if (tag == 'disable') {
  287. this.$emit('getuserId', item.userId)
  288. }else if (tag == 'disabled') {
  289. this.$emit('getuserIds', item.userId)
  290. console.log(item.userId)
  291. } else {
  292. this.$emit('change', item.userId)
  293. }
  294. },
  295. // 单选
  296. changeitem(index) {
  297. this.$emit('changeItem', index) //传参
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. .btn-box {
  304. height: 26px;
  305. padding: 0 10px;
  306. margin-left: 10px;
  307. border-radius: 25px;
  308. font-weight: 400;
  309. font-size: 10px;
  310. line-height: 26px;
  311. box-sizing: border-box;
  312. }
  313. .list-item {
  314. padding: 10px;
  315. margin-bottom: 10px;
  316. background-color: #fff;
  317. border-radius: 12px;
  318. &-head {
  319. .phone {
  320. flex-shrink: 0;
  321. width: 25px;
  322. height: 25px;
  323. }
  324. &-l {
  325. flex: 1;
  326. overflow: hidden;
  327. margin-left: 10px;
  328. margin-right: 10px;
  329. }
  330. }
  331. &-copy {
  332. width: 20px;
  333. height: 20px;
  334. }
  335. &-re {
  336. font-size: 10px;
  337. // margin-top: 5px;
  338. }
  339. &-desc {
  340. padding: 5px;
  341. color: #999;
  342. font-size: 12px;
  343. }
  344. .label {
  345. margin-right: 4px;
  346. }
  347. .value-num {
  348. margin-right: 18px;
  349. color: #222;
  350. font-weight: bold;
  351. }
  352. .taglist {
  353. display: flex;
  354. align-items: center;
  355. flex-wrap: wrap;
  356. color: #555;
  357. padding-top: 5px;
  358. view {
  359. margin: 0 5px 0 0;
  360. }
  361. }
  362. &-footer {
  363. justify-content: flex-end;
  364. padding: 6px 0;
  365. .footer-tagbtn {
  366. color: #1677ff;
  367. background-color: #e7f2fe;
  368. border: 1px solid #c9e1fb;
  369. }
  370. .footer-red {
  371. color: #f93e3e;
  372. background-color: #fae7e7;
  373. border: 1px solid #f7a1a1;
  374. }
  375. &-btn {
  376. height: 26px;
  377. padding: 0 10px;
  378. margin-left: 10px;
  379. background-color: #f5f5f5;
  380. border-radius: 25px;
  381. font-weight: 400;
  382. font-size: 10px;
  383. line-height: 26px;
  384. border: 1px solid #f5f5f5;
  385. box-sizing: border-box;
  386. }
  387. }
  388. }
  389. </style>