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