detail.vue 14 KB

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