vipUserItem.vue 12 KB

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