vipUserItem.vue 11 KB

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