detail.vue 13 KB

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