detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="content">
  3. <view class="bgc">
  4. <view class="content1">
  5. <view class="left">
  6. <image :src="dataObj.circleHead" mode="aspectFill" class="img"></image>
  7. </view>
  8. <view class="right">
  9. <view class="top flex flex-between">
  10. <view class="text">
  11. {{dataObj.circleName}}({{dataObj.cardNum}})
  12. </view>
  13. <span class="join" @click="$u.debounce(addCircle, 500)" v-if="!dataObj.circleCardInfo">
  14. <uni-icons type="plusempty" size="12" color="#fff"
  15. style="margin:0 10rpx;font-weight: bold;"></uni-icons>加入
  16. </span>
  17. <span class="join" @click="exitCircle" v-else>
  18. 退出
  19. </span>
  20. </view>
  21. <view style='flex-wrap: wrap;' class="bottom flex">
  22. <view v-for="item in dataObj.circleLabel" class="text">
  23. {{item}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content2">
  29. <view class="top flex-between">
  30. <view class="span">
  31. <span :class="selectIndex==0?'active':'text'" @click="changeCardStatus(0)">全部</span>
  32. <span @click="changeCardStatus(1)" :class="selectIndex==1?'active':'text'">已交换</span>
  33. <span @click="changeCardStatus(2)" :class="selectIndex==2?'active':'text'">未交换</span>
  34. </view>
  35. <view class="right flex" v-if="dataObj.circleCardInfo" @click="myCardClick">
  36. <image src="../../static/imgs/cirlce/account.png" mode="widthFix"
  37. style="width: 36rpx;margin-right: 15rpx;height: auto;"></image>我的名片
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="relative" style='top:150px;'>
  43. <mescroll-uni height='1200' :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback" >
  44. <view class="content3" v-for="(item,index) in changeCardList"
  45. :style="item.currentBackground?'background:url('+item.currentBackground+');background-size:100% 100%':''"
  46. :key="index">
  47. <view class="flex item">
  48. <view class="top flex">
  49. <view class="left">
  50. <u--image :src="item.headSculpture?item.headSculpture:'https://cdn.uviewui.com/uview/album/1.jpg'" shape="circle" width="66px"
  51. height="66px"></u--image>
  52. </view>
  53. <view class="right">
  54. <view class="row1">
  55. <text class="name">{{item.name}}</text>
  56. <text class="post">{{item.post}}</text>
  57. </view>
  58. <view class="row2">
  59. {{item.companyName}}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="line">
  65. <image src="../../static/imgs/cirlce/line.png" mode="widthFix" style="width: 95%;height: auto;"></image>
  66. </view>
  67. <view class="bottom" v-if="item.scopeOfBusiness">
  68. {{item.scopeOfBusiness}}
  69. </view>
  70. <view class="bottom no-text" v-else>
  71. 暂无业务描述
  72. </view>
  73. <view class="flex btn" v-if="item.lookPage==1||item.notDisplay!=1">
  74. <image @click='toHome(item)' src="../../static/imgs/cirlce/home.png" mode="widthFix" style="width: 32rpx;"
  75. v-if="item.lookPage==1&&item.personalHomeId"></image>
  76. <image src="../../static/imgs/cirlce/change.png" mode="widthFix" style="width: 32rpx;"
  77. @click="changeCard(item)" v-if="item.notDisplay!=1"></image>
  78. </view>
  79. </view>
  80. </mescroll-uni>
  81. </view>
  82. <u-picker :immediateChange ="true" @cancel="isShowCard=false" :show="isShowCard" :columns="cardList" keyName="cardBusiness"
  83. @confirm="cardConfirm"></u-picker>
  84. <u-toast ref="uToast"></u-toast>
  85. <u-modal :show="show" :content='content' @confirm="$u.debounce(joinCircle, 500)" showCancelButton
  86. @cancel="show=false" @close="show=false" closeOnClickOverlay></u-modal>
  87. <u-modal :show="show1" content='确定退出圈子' @confirm="$u.debounce(exitCircleConfirm, 500)" showCancelButton
  88. @cancel="show1=false" @close="show1=false" closeOnClickOverlay></u-modal>
  89. <u-modal :show="isShowChangeCard" content='确定交换名片?' @confirm="$u.debounce(confirmChangeSubmit, 500)"
  90. showCancelButton @cancel="isShowChangeCard=false" @close="isShowChangeCard=false"
  91. closeOnClickOverlay></u-modal>
  92. </view>
  93. </template>
  94. <script>
  95. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  96. export default {
  97. mixins: [MescrollMixin], // 使用mixin
  98. data() {
  99. return {
  100. upOption: {
  101. page: {
  102. size: 10 // 每页数据的数量,默认10
  103. },
  104. auto: false,
  105. noMoreSize: 1,
  106. empty: {
  107. tip: '暂无相关数据'
  108. },
  109. textNoMore:'没有更多了~',
  110. textColor:'#bbb'
  111. },
  112. selectIndex: 0,
  113. isShowChangeCard: false,
  114. show1:false,
  115. dataObj: {
  116. circleName: '',
  117. cardNum: '',
  118. circleLabel: []
  119. },
  120. userInfo: {},
  121. canReset: false,
  122. cardList: [],
  123. isShowCard: false,
  124. show: false,
  125. content: '加入后其他用户查看您的名片和主页,确认加入圈子?',
  126. cardId: '',
  127. id: '',
  128. changeCardList: [],
  129. cardStatus: '',
  130. isMyCard: false,
  131. swapNameCards: false,
  132. selectMycard: {},
  133. selectRowCard: {}
  134. };
  135. },
  136. onShow() {
  137. this.$nextTick(function() {
  138. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  139. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  140. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  141. });
  142. },
  143. onLoad(options) {
  144. console.log(options)
  145. this.userInfo = uni.getStorageSync("userInfo")
  146. this.id = options.val
  147. },
  148. methods: {
  149. toHome(item){
  150. uni.navigateTo({
  151. url:'/pages/circle/lookHome?id='+item.personalHomeId
  152. })
  153. },
  154. confirmChangeSubmit() {
  155. this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'add', {
  156. cardExchangeInfo: JSON.stringify({
  157. sendId: this.userInfo.id,
  158. receiveId: this.selectRowCard.receiveId,
  159. sendCardId: this.selectMycard.id,
  160. receiveCardId: this.selectRowCard.id,
  161. circleName: this.dataObj.circleName
  162. }),
  163. }, failres => {
  164. console.log('res+++++', failres.errmsg)
  165. uni.showToast({
  166. icon:"none",
  167. title: failres.errmsg,
  168. duration: 3000
  169. });
  170. uni.hideLoading()
  171. }).then(res => {
  172. this.isShowChangeCard = false
  173. uni.showToast({
  174. icon:"success",
  175. title: '操作成功!',
  176. duration: 2000
  177. });
  178. setTimeout(() => {
  179. this.mescroll.resetUpScroll()
  180. }, 500)
  181. })
  182. },
  183. changeMyCard() {
  184. this.$request.baseRequest('admin.unimall.circleCardInfo', 'update', {
  185. circleCardInfo: JSON.stringify({
  186. circleId: this.dataObj.id,
  187. cardId: this.cardId,
  188. commonId: this.userInfo.id
  189. }),
  190. }, failres => {
  191. console.log('res+++++', failres.errmsg)
  192. uni.showToast({
  193. icon:"none",
  194. title: failres.errmsg,
  195. duration: 3000
  196. });
  197. uni.hideLoading()
  198. }).then(res => {
  199. this.isShowCard = false
  200. uni.showToast({
  201. icon:"success",
  202. title: '更改圈子名片成功!',
  203. duration: 2000
  204. });
  205. this.mescroll.resetUpScroll()
  206. })
  207. },
  208. myCardClick() {
  209. this.isShowCard = true
  210. this.isMyCard = true
  211. },
  212. changeCardStatus(val) {
  213. this.selectIndex = val
  214. this.cardStatus = val
  215. this.getCardList({
  216. num: 1,
  217. size: 10
  218. })
  219. },
  220. exitCircle() {
  221. console.log(11111)
  222. this.show1=true
  223. },
  224. exitCircleConfirm(){
  225. this.$request.baseRequest('admin.unimall.circleCardInfo', 'delete', {
  226. id: this.dataObj.circleCardInfo.id,
  227. }, failres => {
  228. console.log('res+++++', failres.errmsg)
  229. uni.showToast({
  230. icon:"none",
  231. title: failres.errmsg,
  232. duration: 3000
  233. });
  234. uni.hideLoading()
  235. }).then(res => {
  236. this.isShowCard = false
  237. this.show1=false
  238. uni.showToast({
  239. icon:"success",
  240. title: '退出成功!',
  241. duration: 2000
  242. });
  243. this.mescroll.resetUpScroll()
  244. })
  245. },
  246. cardConfirm(e) {
  247. console.log("e", e)
  248. this.cardId = e.value[0].id
  249. if (this.isMyCard) {
  250. this.changeMyCard()
  251. } else if (this.swapNameCards) {
  252. this.selectMycard = e.value[0]
  253. this.isShowCard = false
  254. this.isShowChangeCard = true
  255. } else {
  256. this.joinCircle()
  257. }
  258. },
  259. joinCircle() {
  260. this.$request.baseRequest('admin.unimall.circleCardInfo', 'add', {
  261. circleCardInfo: JSON.stringify({
  262. circleId: this.dataObj.id,
  263. cardId: this.cardId,
  264. commonId: this.userInfo.id
  265. }),
  266. }, failres => {
  267. console.log('res+++++', failres.errmsg)
  268. uni.showToast({
  269. icon:"none",
  270. title: failres.errmsg,
  271. duration: 3000
  272. });
  273. uni.hideLoading()
  274. }).then(res => {
  275. this.isShowCard = false
  276. this.show = false
  277. uni.showToast({
  278. icon:"success",
  279. title: '加入成功!',
  280. duration: 2000
  281. });
  282. this.mescroll.resetUpScroll()
  283. })
  284. },
  285. addCircle() {
  286. if (this.cardList[0].length == 1) {
  287. // console.log(this.cardList[0])
  288. this.cardId = this.cardList[0][0].id
  289. this.show = true
  290. } else if (this.cardList[0].length > 1) {
  291. this.isShowCard = true
  292. } else {
  293. uni.showToast({
  294. icon:"none",
  295. title: '您还没有自己的名片,请创建后再加入圈子!',
  296. duration: 2000
  297. });
  298. // this.$refs.uToast.show({
  299. // type: 'error',
  300. // message: "您还没有自己的名片,请创建后再加入圈子",
  301. // })
  302. }
  303. },
  304. getCardList(page) {
  305. uni.showLoading({
  306. title: '数据加载中'
  307. })
  308. this.$request.baseRequest('admin.unimall.circleManagementInfo', 'circleCardlist', {
  309. commonId: this.userInfo.id,
  310. id: this.dataObj.id,
  311. status: this.cardStatus,
  312. page: page.num,
  313. limit: page.size,
  314. }, failres => {
  315. console.log('res+++++', failres.errmsg)
  316. uni.hideLoading()
  317. uni.showToast({
  318. icon:"none",
  319. title: failres.errmsg,
  320. duration: 3000
  321. });
  322. }).then(res => {
  323. uni.hideLoading()
  324. console.log(11)
  325. let curPageData = res.data.items;
  326. let totalPage = res.data.total;
  327. let curPageLen = curPageData.length;
  328. this.mescroll.endByPage(curPageLen, totalPage);
  329. console.log(res.data)
  330. // this.makeData(res.data)
  331. if (page.num == 1) this.changeCardList = []; //如果是第一页需手动置空列表
  332. this.changeCardList = this.changeCardList.concat(curPageData); //追加新数据
  333. for(let i = 0;i<this.changeCardList.length;i++){
  334. if(this.changeCardList[i].scopeOfBusiness&&this.changeCardList[i].scopeOfBusiness.length>90){
  335. this.changeCardList[i].scopeOfBusiness = this.changeCardList[i].scopeOfBusiness.substr(0,90) + '...' ;
  336. }
  337. }
  338. })
  339. },
  340. async upCallback(page) {
  341. //获取名片
  342. await this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  343. commonId: this.userInfo.id
  344. }, failres => {
  345. console.log('res+++++', failres.errmsg)
  346. uni.showToast({
  347. icon:"none",
  348. title: failres.errmsg,
  349. duration: 3000
  350. });
  351. }).then(res => {
  352. this.cardList = [res.data.items]
  353. })
  354. await this.$request.baseRequest('admin.unimall.circleManagementInfo', 'get', {
  355. commonId: this.userInfo.id,
  356. id: this.id
  357. }, failres => {
  358. console.log('res+++++', failres.errmsg)
  359. uni.hideLoading()
  360. uni.showToast({
  361. icon:"none",
  362. title: failres.errmsg,
  363. duration: 3000
  364. });
  365. }).then(res => {
  366. console.log(res.data)
  367. this.dataObj = res.data
  368. this.dataObj.circleLabel = res.data.circleLabel.split(",")
  369. })
  370. this.getCardList(page)
  371. },
  372. changeCard(val) {
  373. if(!this.dataObj.circleCardInfo){
  374. uni.showToast({
  375. icon:"none",
  376. title: "请先加入圈子!",
  377. duration: 2000
  378. });
  379. }else{
  380. this.selectRowCard = val
  381. this.swapNameCards = true
  382. this.isShowCard = true
  383. }
  384. },
  385. }
  386. }
  387. </script>
  388. <style lang="scss">
  389. .bgc {
  390. background-color: #112253;
  391. padding-bottom: 100rpx;
  392. position:fixed;
  393. top:0;
  394. width:100%;
  395. }
  396. .content1 {
  397. display: flex;
  398. padding: 40rpx;
  399. box-sizing: border-box;
  400. .right {
  401. width: 100%;
  402. display: flex;
  403. flex-direction: column;
  404. justify-content: space-evenly;
  405. .top {
  406. width: 100%;
  407. .text {
  408. color: #fff;
  409. font-weight: bold;
  410. }
  411. .join {
  412. background: #0A173D;
  413. color: #fff;
  414. position: absolute;
  415. right: 0rpx;
  416. padding: 15rpx 20rpx;
  417. font-size: 26rpx;
  418. border-radius: 50rpx 0rpx 0rpx 50rpx;
  419. }
  420. }
  421. .bottom {
  422. .text {
  423. color: #ffffff50;
  424. background: #f1f5ff20;
  425. padding: 10rpx 20rpx;
  426. margin:0 10rpx 10rpx 0;
  427. border-radius: 10rpx;
  428. font-size: 26rpx;
  429. }
  430. }
  431. }
  432. }
  433. .no-text {
  434. color: #969393;
  435. }
  436. .img {
  437. width: 122rpx;
  438. height: 122rpx;
  439. border-radius: 10px;
  440. margin-right: 30rpx;
  441. }
  442. .content2 {
  443. padding: 0 40rpx 40rpx 40rpx;
  444. box-sizing: border-box;
  445. .text {
  446. font-size: 26rpx;
  447. font-weight: 500;
  448. color: #FFFFFF;
  449. opacity: 0.5;
  450. margin-right: 56rpx;
  451. }
  452. .active {
  453. font-size: 32rpx;
  454. font-weight: bold;
  455. color: #FFFFFF;
  456. position: relative;
  457. margin-right: 56rpx;
  458. }
  459. .active:after {
  460. position: absolute;
  461. bottom: -20rpx;
  462. content: '';
  463. width: 50%;
  464. height: 6rpx;
  465. border-radius: 40rpx;
  466. background: #FFFFFF;
  467. right: 0;
  468. left: 0;
  469. margin: auto;
  470. }
  471. .right {
  472. color: #D7C08B;
  473. font-size: 26rpx;
  474. }
  475. }
  476. .content3 {
  477. position: relative;
  478. border-radius: 30rpx;
  479. background: red;
  480. box-sizing: border-box;
  481. height:400rpx;
  482. .item {
  483. align-items: flex-start;
  484. padding: 34rpx 40rpx 0 40rpx;
  485. }
  486. .top {
  487. .left {
  488. margin-right: 36rpx;
  489. }
  490. .right {
  491. .row1 {
  492. margin-bottom: 10rpx;
  493. .name {
  494. font-size: 38rpx;
  495. font-weight: bold;
  496. color: #000000;
  497. margin-right: 26rpx;
  498. }
  499. .post {
  500. font-size: 26rpx;
  501. font-weight: 500;
  502. color: #666666;
  503. }
  504. }
  505. .row2 {
  506. font-size: 26rpx;
  507. font-weight: bold;
  508. color: #333333;
  509. }
  510. }
  511. }
  512. .bottom {
  513. padding: 20rpx 60rpx 0rpx 60rpx;
  514. font-size: 26rpx;
  515. }
  516. .btn {
  517. background: #11225350;
  518. width: 145rpx;
  519. display: flex;
  520. justify-content: space-evenly;
  521. padding: 15rpx 0;
  522. border-radius: 32rpx;
  523. position: absolute;
  524. top: 35rpx;
  525. right: 40rpx;
  526. }
  527. }
  528. .line {
  529. text-align: center;
  530. }
  531. </style>