detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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 @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. })
  322. },
  323. async upCallback(page) {
  324. //获取名片
  325. await this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  326. commonId: this.userInfo.id
  327. }, failres => {
  328. console.log('res+++++', failres.errmsg)
  329. uni.showToast({
  330. icon:"none",
  331. title: failres.errmsg,
  332. duration: 3000
  333. });
  334. }).then(res => {
  335. this.cardList = [res.data.items]
  336. })
  337. await this.$request.baseRequest('admin.unimall.circleManagementInfo', 'get', {
  338. commonId: this.userInfo.id,
  339. id: this.id
  340. }, failres => {
  341. console.log('res+++++', failres.errmsg)
  342. uni.hideLoading()
  343. uni.showToast({
  344. icon:"none",
  345. title: failres.errmsg,
  346. duration: 3000
  347. });
  348. }).then(res => {
  349. console.log(res.data)
  350. this.dataObj = res.data
  351. this.dataObj.circleLabel = res.data.circleLabel.split(",")
  352. })
  353. this.getCardList(page)
  354. },
  355. changeCard(val) {
  356. if(!this.dataObj.circleCardInfo){
  357. uni.showToast({
  358. icon:"none",
  359. title: "请先加入圈子!",
  360. duration: 2000
  361. });
  362. }else{
  363. this.selectRowCard = val
  364. this.swapNameCards = true
  365. this.isShowCard = true
  366. }
  367. },
  368. }
  369. }
  370. </script>
  371. <style lang="scss">
  372. .bgc {
  373. background-color: #112253;
  374. padding-bottom: 100rpx;
  375. position:fixed;
  376. top:0;
  377. width:100%;
  378. }
  379. .content1 {
  380. display: flex;
  381. padding: 40rpx;
  382. box-sizing: border-box;
  383. .right {
  384. width: 100%;
  385. display: flex;
  386. flex-direction: column;
  387. justify-content: space-evenly;
  388. .top {
  389. width: 100%;
  390. .text {
  391. color: #fff;
  392. font-weight: bold;
  393. }
  394. .join {
  395. background: #0A173D;
  396. color: #fff;
  397. position: absolute;
  398. right: 0rpx;
  399. padding: 15rpx 20rpx;
  400. font-size: 26rpx;
  401. border-radius: 50rpx 0rpx 0rpx 50rpx;
  402. }
  403. }
  404. .bottom {
  405. .text {
  406. color: #ffffff50;
  407. background: #f1f5ff20;
  408. padding: 10rpx 20rpx;
  409. margin:0 10rpx 10rpx 0;
  410. border-radius: 10rpx;
  411. font-size: 26rpx;
  412. }
  413. }
  414. }
  415. }
  416. .no-text {
  417. color: #969393;
  418. }
  419. .img {
  420. width: 122rpx;
  421. height: 122rpx;
  422. border-radius: 10px;
  423. margin-right: 30rpx;
  424. }
  425. .content2 {
  426. padding: 0 40rpx 40rpx 40rpx;
  427. box-sizing: border-box;
  428. .text {
  429. font-size: 26rpx;
  430. font-weight: 500;
  431. color: #FFFFFF;
  432. opacity: 0.5;
  433. margin-right: 56rpx;
  434. }
  435. .active {
  436. font-size: 32rpx;
  437. font-weight: bold;
  438. color: #FFFFFF;
  439. position: relative;
  440. margin-right: 56rpx;
  441. }
  442. .active:after {
  443. position: absolute;
  444. bottom: -20rpx;
  445. content: '';
  446. width: 50%;
  447. height: 6rpx;
  448. border-radius: 40rpx;
  449. background: #FFFFFF;
  450. right: 0;
  451. left: 0;
  452. margin: auto;
  453. }
  454. .right {
  455. color: #D7C08B;
  456. font-size: 26rpx;
  457. }
  458. }
  459. .content3 {
  460. position: relative;
  461. border-radius: 30rpx;
  462. background: red;
  463. box-sizing: border-box;
  464. margin: 0 20rpx 20rpx 20rpx;
  465. height:381rpx;
  466. .item {
  467. align-items: flex-start;
  468. padding: 34rpx 40rpx 0 40rpx;
  469. }
  470. .top {
  471. .left {
  472. margin-right: 36rpx;
  473. }
  474. .right {
  475. .row1 {
  476. margin-bottom: 10rpx;
  477. .name {
  478. font-size: 38rpx;
  479. font-weight: bold;
  480. color: #000000;
  481. margin-right: 26rpx;
  482. }
  483. .post {
  484. font-size: 26rpx;
  485. font-weight: 500;
  486. color: #666666;
  487. }
  488. }
  489. .row2 {
  490. font-size: 26rpx;
  491. font-weight: bold;
  492. color: #333333;
  493. }
  494. }
  495. }
  496. .bottom {
  497. padding: 20rpx 40rpx 40rpx 40rpx;
  498. }
  499. .btn {
  500. background: #11225350;
  501. width: 145rpx;
  502. display: flex;
  503. justify-content: space-evenly;
  504. padding: 15rpx 0;
  505. border-radius: 32rpx;
  506. position: absolute;
  507. top: 35rpx;
  508. right: 23rpx;
  509. }
  510. }
  511. .line {
  512. text-align: center;
  513. }
  514. </style>