detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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' 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. selectIndex: 0,
  101. isShowChangeCard: false,
  102. show1:false,
  103. dataObj: {
  104. circleName: '',
  105. cardNum: '',
  106. circleLabel: []
  107. },
  108. userInfo: {},
  109. canReset: false,
  110. cardList: [],
  111. isShowCard: false,
  112. show: false,
  113. content: '加入后其他用户查看您的名片和主页,确认加入圈子?',
  114. cardId: '',
  115. id: '',
  116. changeCardList: [],
  117. cardStatus: '',
  118. isMyCard: false,
  119. swapNameCards: false,
  120. selectMycard: {},
  121. selectRowCard: {}
  122. };
  123. },
  124. onShow() {
  125. this.$nextTick(function() {
  126. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  127. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  128. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  129. });
  130. },
  131. onLoad(options) {
  132. console.log(options)
  133. this.userInfo = uni.getStorageSync("userInfo")
  134. this.id = options.val
  135. },
  136. methods: {
  137. toHome(item){
  138. uni.navigateTo({
  139. url:'/pages/circle/lookHome?id='+item.personalHomeId
  140. })
  141. },
  142. confirmChangeSubmit() {
  143. this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'add', {
  144. cardExchangeInfo: JSON.stringify({
  145. sendId: this.userInfo.id,
  146. receiveId: this.selectRowCard.receiveId,
  147. sendCardId: this.selectMycard.id,
  148. receiveCardId: this.selectRowCard.id,
  149. circleName: this.dataObj.circleName
  150. }),
  151. }, failres => {
  152. console.log('res+++++', failres.errmsg)
  153. uni.showToast({
  154. icon:"none",
  155. title: failres.errmsg,
  156. duration: 3000
  157. });
  158. uni.hideLoading()
  159. }).then(res => {
  160. this.isShowChangeCard = false
  161. uni.showToast({
  162. icon:"success",
  163. title: '操作成功!',
  164. duration: 2000
  165. });
  166. setTimeout(() => {
  167. this.mescroll.resetUpScroll()
  168. }, 500)
  169. })
  170. },
  171. changeMyCard() {
  172. this.$request.baseRequest('admin.unimall.circleCardInfo', 'update', {
  173. circleCardInfo: JSON.stringify({
  174. circleId: this.dataObj.id,
  175. cardId: this.cardId,
  176. commonId: this.userInfo.id
  177. }),
  178. }, failres => {
  179. console.log('res+++++', failres.errmsg)
  180. uni.showToast({
  181. icon:"none",
  182. title: failres.errmsg,
  183. duration: 3000
  184. });
  185. uni.hideLoading()
  186. }).then(res => {
  187. this.isShowCard = false
  188. uni.showToast({
  189. icon:"success",
  190. title: '更改圈子名片成功!',
  191. duration: 2000
  192. });
  193. this.mescroll.resetUpScroll()
  194. })
  195. },
  196. myCardClick() {
  197. this.isShowCard = true
  198. this.isMyCard = true
  199. },
  200. changeCardStatus(val) {
  201. this.selectIndex = val
  202. this.cardStatus = val
  203. this.getCardList({
  204. num: 1,
  205. size: 10
  206. })
  207. },
  208. exitCircle() {
  209. console.log(11111)
  210. this.show1=true
  211. },
  212. exitCircleConfirm(){
  213. this.$request.baseRequest('admin.unimall.circleCardInfo', 'delete', {
  214. id: this.dataObj.circleCardInfo.id,
  215. }, failres => {
  216. console.log('res+++++', failres.errmsg)
  217. uni.showToast({
  218. icon:"none",
  219. title: failres.errmsg,
  220. duration: 3000
  221. });
  222. uni.hideLoading()
  223. }).then(res => {
  224. this.isShowCard = false
  225. this.show1=false
  226. uni.showToast({
  227. icon:"success",
  228. title: '退出成功!',
  229. duration: 2000
  230. });
  231. this.mescroll.resetUpScroll()
  232. })
  233. },
  234. cardConfirm(e) {
  235. console.log("e", e)
  236. this.cardId = e.value[0].id
  237. if (this.isMyCard) {
  238. this.changeMyCard()
  239. } else if (this.swapNameCards) {
  240. this.selectMycard = e.value[0]
  241. this.isShowCard = false
  242. this.isShowChangeCard = true
  243. } else {
  244. this.joinCircle()
  245. }
  246. },
  247. joinCircle() {
  248. this.$request.baseRequest('admin.unimall.circleCardInfo', 'add', {
  249. circleCardInfo: JSON.stringify({
  250. circleId: this.dataObj.id,
  251. cardId: this.cardId,
  252. commonId: this.userInfo.id
  253. }),
  254. }, failres => {
  255. console.log('res+++++', failres.errmsg)
  256. uni.showToast({
  257. icon:"none",
  258. title: failres.errmsg,
  259. duration: 3000
  260. });
  261. uni.hideLoading()
  262. }).then(res => {
  263. this.isShowCard = false
  264. this.show = false
  265. uni.showToast({
  266. icon:"success",
  267. title: '加入成功!',
  268. duration: 2000
  269. });
  270. this.mescroll.resetUpScroll()
  271. })
  272. },
  273. addCircle() {
  274. if (this.cardList[0].length == 1) {
  275. // console.log(this.cardList[0])
  276. this.cardId = this.cardList[0][0].id
  277. this.show = true
  278. } else if (this.cardList[0].length > 1) {
  279. this.isShowCard = true
  280. } else {
  281. uni.showToast({
  282. icon:"none",
  283. title: '您还没有自己的名片,请创建后再加入圈子!',
  284. duration: 2000
  285. });
  286. // this.$refs.uToast.show({
  287. // type: 'error',
  288. // message: "您还没有自己的名片,请创建后再加入圈子",
  289. // })
  290. }
  291. },
  292. getCardList(page) {
  293. uni.showLoading({
  294. title: '数据加载中'
  295. })
  296. this.$request.baseRequest('admin.unimall.circleManagementInfo', 'circleCardlist', {
  297. commonId: this.userInfo.id,
  298. id: this.dataObj.id,
  299. status: this.cardStatus,
  300. page: page.num,
  301. limit: page.size,
  302. }, failres => {
  303. console.log('res+++++', failres.errmsg)
  304. uni.hideLoading()
  305. uni.showToast({
  306. icon:"none",
  307. title: failres.errmsg,
  308. duration: 3000
  309. });
  310. }).then(res => {
  311. uni.hideLoading()
  312. console.log(11)
  313. let curPageData = res.data.items;
  314. let totalPage = res.data.total;
  315. let curPageLen = curPageData.length;
  316. this.mescroll.endByPage(curPageLen, totalPage);
  317. console.log(res.data)
  318. // this.makeData(res.data)
  319. if (page.num == 1) this.changeCardList = []; //如果是第一页需手动置空列表
  320. this.changeCardList = this.changeCardList.concat(curPageData); //追加新数据
  321. for(let i = 0;i<this.changeCardList.length;i++){
  322. if(this.changeCardList[i].scopeOfBusiness&&this.changeCardList[i].scopeOfBusiness.length>90){
  323. this.changeCardList[i].scopeOfBusiness = this.changeCardList[i].scopeOfBusiness.substr(0,90) + '...' ;
  324. }
  325. }
  326. })
  327. },
  328. async upCallback(page) {
  329. //获取名片
  330. await this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  331. commonId: this.userInfo.id
  332. }, failres => {
  333. console.log('res+++++', failres.errmsg)
  334. uni.showToast({
  335. icon:"none",
  336. title: failres.errmsg,
  337. duration: 3000
  338. });
  339. }).then(res => {
  340. this.cardList = [res.data.items]
  341. })
  342. await this.$request.baseRequest('admin.unimall.circleManagementInfo', 'get', {
  343. commonId: this.userInfo.id,
  344. id: this.id
  345. }, failres => {
  346. console.log('res+++++', failres.errmsg)
  347. uni.hideLoading()
  348. uni.showToast({
  349. icon:"none",
  350. title: failres.errmsg,
  351. duration: 3000
  352. });
  353. }).then(res => {
  354. console.log(res.data)
  355. this.dataObj = res.data
  356. this.dataObj.circleLabel = res.data.circleLabel.split(",")
  357. })
  358. this.getCardList(page)
  359. },
  360. changeCard(val) {
  361. if(!this.dataObj.circleCardInfo){
  362. uni.showToast({
  363. icon:"none",
  364. title: "请先加入圈子!",
  365. duration: 2000
  366. });
  367. }else{
  368. this.selectRowCard = val
  369. this.swapNameCards = true
  370. this.isShowCard = true
  371. }
  372. },
  373. }
  374. }
  375. </script>
  376. <style lang="scss">
  377. .bgc {
  378. background-color: #112253;
  379. padding-bottom: 100rpx;
  380. position:fixed;
  381. top:0;
  382. width:100%;
  383. }
  384. .content1 {
  385. display: flex;
  386. padding: 40rpx;
  387. box-sizing: border-box;
  388. .right {
  389. width: 100%;
  390. display: flex;
  391. flex-direction: column;
  392. justify-content: space-evenly;
  393. .top {
  394. width: 100%;
  395. .text {
  396. color: #fff;
  397. font-weight: bold;
  398. }
  399. .join {
  400. background: #0A173D;
  401. color: #fff;
  402. position: absolute;
  403. right: 0rpx;
  404. padding: 15rpx 20rpx;
  405. font-size: 26rpx;
  406. border-radius: 50rpx 0rpx 0rpx 50rpx;
  407. }
  408. }
  409. .bottom {
  410. .text {
  411. color: #ffffff50;
  412. background: #f1f5ff20;
  413. padding: 10rpx 20rpx;
  414. margin:0 10rpx 10rpx 0;
  415. border-radius: 10rpx;
  416. font-size: 26rpx;
  417. }
  418. }
  419. }
  420. }
  421. .no-text {
  422. color: #969393;
  423. }
  424. .img {
  425. width: 122rpx;
  426. height: 122rpx;
  427. border-radius: 10px;
  428. margin-right: 30rpx;
  429. }
  430. .content2 {
  431. padding: 0 40rpx 40rpx 40rpx;
  432. box-sizing: border-box;
  433. .text {
  434. font-size: 26rpx;
  435. font-weight: 500;
  436. color: #FFFFFF;
  437. opacity: 0.5;
  438. margin-right: 56rpx;
  439. }
  440. .active {
  441. font-size: 32rpx;
  442. font-weight: bold;
  443. color: #FFFFFF;
  444. position: relative;
  445. margin-right: 56rpx;
  446. }
  447. .active:after {
  448. position: absolute;
  449. bottom: -20rpx;
  450. content: '';
  451. width: 50%;
  452. height: 6rpx;
  453. border-radius: 40rpx;
  454. background: #FFFFFF;
  455. right: 0;
  456. left: 0;
  457. margin: auto;
  458. }
  459. .right {
  460. color: #D7C08B;
  461. font-size: 26rpx;
  462. }
  463. }
  464. .content3 {
  465. position: relative;
  466. border-radius: 30rpx;
  467. background: red;
  468. box-sizing: border-box;
  469. height:400rpx;
  470. .item {
  471. align-items: flex-start;
  472. padding: 34rpx 40rpx 0 40rpx;
  473. }
  474. .top {
  475. .left {
  476. margin-right: 36rpx;
  477. }
  478. .right {
  479. .row1 {
  480. margin-bottom: 10rpx;
  481. .name {
  482. font-size: 38rpx;
  483. font-weight: bold;
  484. color: #000000;
  485. margin-right: 26rpx;
  486. }
  487. .post {
  488. font-size: 26rpx;
  489. font-weight: 500;
  490. color: #666666;
  491. }
  492. }
  493. .row2 {
  494. font-size: 26rpx;
  495. font-weight: bold;
  496. color: #333333;
  497. }
  498. }
  499. }
  500. .bottom {
  501. padding: 20rpx 60rpx 0rpx 60rpx;
  502. font-size: 26rpx;
  503. }
  504. .btn {
  505. background: #11225350;
  506. width: 145rpx;
  507. display: flex;
  508. justify-content: space-evenly;
  509. padding: 15rpx 0;
  510. border-radius: 32rpx;
  511. position: absolute;
  512. top: 35rpx;
  513. right: 40rpx;
  514. }
  515. }
  516. .line {
  517. text-align: center;
  518. }
  519. </style>