vipUserItem.vue 12 KB

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