vipUserItem.vue 12 KB

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