detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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. <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;"></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%;"></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. this.$refs.uToast.show({
  154. type: 'error',
  155. message: failres.errmsg,
  156. })
  157. uni.hideLoading()
  158. }).then(res => {
  159. this.isShowChangeCard = false
  160. this.$refs.uToast.show({
  161. type: 'success',
  162. message: "操作成功!"
  163. })
  164. setTimeout(() => {
  165. this.mescroll.resetUpScroll()
  166. }, 500)
  167. })
  168. },
  169. changeMyCard() {
  170. this.$request.baseRequest('admin.unimall.circleCardInfo', 'update', {
  171. circleCardInfo: JSON.stringify({
  172. circleId: this.dataObj.id,
  173. cardId: this.cardId,
  174. commonId: this.userInfo.id
  175. }),
  176. }, failres => {
  177. console.log('res+++++', failres.errmsg)
  178. this.$refs.uToast.show({
  179. type: 'error',
  180. message: failres.errmsg,
  181. })
  182. uni.hideLoading()
  183. }).then(res => {
  184. this.isShowCard = false
  185. this.$refs.uToast.show({
  186. type: 'success',
  187. message: "更改圈子名片成功!",
  188. })
  189. this.mescroll.resetUpScroll()
  190. })
  191. },
  192. myCardClick() {
  193. this.isShowCard = true
  194. this.isMyCard = true
  195. },
  196. changeCardStatus(val) {
  197. this.selectIndex = val
  198. this.cardStatus = val
  199. this.getCardList({
  200. num: 1,
  201. size: 10
  202. })
  203. },
  204. exitCircle() {
  205. console.log(11111)
  206. this.show1=true
  207. },
  208. exitCircleConfirm(){
  209. this.$request.baseRequest('admin.unimall.circleCardInfo', 'delete', {
  210. id: this.dataObj.circleCardInfo.id,
  211. }, failres => {
  212. console.log('res+++++', failres.errmsg)
  213. this.$refs.uToast.show({
  214. type: 'error',
  215. message: failres.errmsg,
  216. })
  217. uni.hideLoading()
  218. }).then(res => {
  219. this.isShowCard = false
  220. this.show1=false
  221. this.$refs.uToast.show({
  222. type: 'success',
  223. message: "退出成功!",
  224. })
  225. this.mescroll.resetUpScroll()
  226. })
  227. },
  228. cardConfirm(e) {
  229. console.log("e", e)
  230. this.cardId = e.value[0].id
  231. if (this.isMyCard) {
  232. this.changeMyCard()
  233. } else if (this.swapNameCards) {
  234. this.selectMycard = e.value[0]
  235. this.isShowCard = false
  236. this.isShowChangeCard = true
  237. } else {
  238. this.joinCircle()
  239. }
  240. },
  241. joinCircle() {
  242. this.$request.baseRequest('admin.unimall.circleCardInfo', 'add', {
  243. circleCardInfo: JSON.stringify({
  244. circleId: this.dataObj.id,
  245. cardId: this.cardId,
  246. commonId: this.userInfo.id
  247. }),
  248. }, failres => {
  249. console.log('res+++++', failres.errmsg)
  250. this.$refs.uToast.show({
  251. type: 'error',
  252. message: failres.errmsg,
  253. })
  254. uni.hideLoading()
  255. }).then(res => {
  256. this.isShowCard = false
  257. this.show = false
  258. this.$refs.uToast.show({
  259. type: 'success',
  260. message: "加入成功!",
  261. })
  262. this.mescroll.resetUpScroll()
  263. })
  264. },
  265. addCircle() {
  266. if (this.cardList[0].length == 1) {
  267. // console.log(this.cardList[0])
  268. this.cardId = this.cardList[0][0].id
  269. this.show = true
  270. } else if (this.cardList[0].length > 1) {
  271. this.isShowCard = true
  272. } else {
  273. this.$refs.uToast.show({
  274. type: 'error',
  275. message: "您还没有自己的名片,请创建后再加入圈子",
  276. })
  277. }
  278. },
  279. getCardList(page) {
  280. uni.showLoading({
  281. title: '数据加载中'
  282. })
  283. this.$request.baseRequest('admin.unimall.circleManagementInfo', 'circleCardlist', {
  284. commonId: this.userInfo.id,
  285. id: this.dataObj.id,
  286. status: this.cardStatus,
  287. page: page.num,
  288. limit: page.size,
  289. }, failres => {
  290. console.log('res+++++', failres.errmsg)
  291. this.$refs.uToast.show({
  292. type: 'error',
  293. message: failres.errmsg,
  294. })
  295. uni.hideLoading()
  296. }).then(res => {
  297. uni.hideLoading()
  298. console.log(11)
  299. let curPageData = res.data.items;
  300. let totalPage = res.data.total;
  301. let curPageLen = curPageData.length;
  302. this.mescroll.endByPage(curPageLen, totalPage);
  303. console.log(res.data)
  304. // this.makeData(res.data)
  305. if (page.num == 1) this.changeCardList = []; //如果是第一页需手动置空列表
  306. this.changeCardList = this.changeCardList.concat(curPageData); //追加新数据
  307. })
  308. },
  309. async upCallback(page) {
  310. //获取名片
  311. await this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  312. commonId: this.userInfo.id
  313. }, failres => {
  314. console.log('res+++++', failres.errmsg)
  315. this.$refs.uToast.show({
  316. type: 'error',
  317. message: failres.errmsg,
  318. })
  319. }).then(res => {
  320. this.cardList = [res.data.items]
  321. })
  322. await this.$request.baseRequest('admin.unimall.circleManagementInfo', 'get', {
  323. commonId: this.userInfo.id,
  324. id: this.id
  325. }, failres => {
  326. console.log('res+++++', failres.errmsg)
  327. this.$refs.uToast.show({
  328. type: 'error',
  329. message: failres.errmsg,
  330. })
  331. uni.hideLoading()
  332. }).then(res => {
  333. console.log(res.data)
  334. this.dataObj = res.data
  335. this.dataObj.circleLabel = res.data.circleLabel.split(",")
  336. })
  337. this.getCardList(page)
  338. },
  339. changeCard(val) {
  340. if(!this.dataObj.circleCardInfo){
  341. this.$refs.uToast.show({
  342. type: 'error',
  343. message: '请先加入圈子!',
  344. })
  345. }else{
  346. this.selectRowCard = val
  347. this.swapNameCards = true
  348. this.isShowCard = true
  349. }
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss">
  355. .bgc {
  356. background-color: #112253;
  357. padding-bottom: 100rpx;
  358. position:fixed;
  359. top:0;
  360. width:100%;
  361. }
  362. .content1 {
  363. display: flex;
  364. padding: 40rpx;
  365. box-sizing: border-box;
  366. .right {
  367. width: 100%;
  368. display: flex;
  369. flex-direction: column;
  370. justify-content: space-evenly;
  371. .top {
  372. width: 100%;
  373. .text {
  374. color: #fff;
  375. font-weight: bold;
  376. }
  377. .join {
  378. background: #0A173D;
  379. color: #fff;
  380. position: absolute;
  381. right: 0rpx;
  382. padding: 15rpx 20rpx;
  383. font-size: 26rpx;
  384. border-radius: 50rpx 0rpx 0rpx 50rpx;
  385. }
  386. }
  387. .bottom {
  388. .text {
  389. color: #ffffff50;
  390. background: #f1f5ff20;
  391. padding: 10rpx 20rpx;
  392. margin:0 10rpx 10rpx 0;
  393. border-radius: 10rpx;
  394. font-size: 26rpx;
  395. }
  396. }
  397. }
  398. }
  399. .no-text {
  400. color: #969393;
  401. }
  402. .img {
  403. width: 122rpx;
  404. margin-right: 30rpx;
  405. }
  406. .content2 {
  407. padding: 0 40rpx 40rpx 40rpx;
  408. box-sizing: border-box;
  409. .text {
  410. font-size: 26rpx;
  411. font-weight: 500;
  412. color: #FFFFFF;
  413. opacity: 0.5;
  414. margin-right: 56rpx;
  415. }
  416. .active {
  417. font-size: 32rpx;
  418. font-weight: bold;
  419. color: #FFFFFF;
  420. position: relative;
  421. margin-right: 56rpx;
  422. }
  423. .active:after {
  424. position: absolute;
  425. bottom: -20rpx;
  426. content: '';
  427. width: 50%;
  428. height: 6rpx;
  429. border-radius: 40rpx;
  430. background: #FFFFFF;
  431. right: 0;
  432. left: 0;
  433. margin: auto;
  434. }
  435. .right {
  436. color: #D7C08B;
  437. font-size: 26rpx;
  438. }
  439. }
  440. .content3 {
  441. position: relative;
  442. border-radius: 30rpx;
  443. background: red;
  444. box-sizing: border-box;
  445. margin: 0 20rpx 20rpx 20rpx;
  446. height:381rpx;
  447. .item {
  448. align-items: flex-start;
  449. padding: 34rpx 40rpx 0 40rpx;
  450. }
  451. .top {
  452. .left {
  453. margin-right: 36rpx;
  454. }
  455. .right {
  456. .row1 {
  457. margin-bottom: 10rpx;
  458. .name {
  459. font-size: 38rpx;
  460. font-weight: bold;
  461. color: #000000;
  462. margin-right: 26rpx;
  463. }
  464. .post {
  465. font-size: 26rpx;
  466. font-weight: 500;
  467. color: #666666;
  468. }
  469. }
  470. .row2 {
  471. font-size: 26rpx;
  472. font-weight: bold;
  473. color: #333333;
  474. }
  475. }
  476. }
  477. .bottom {
  478. padding: 20rpx 40rpx 40rpx 40rpx;
  479. }
  480. .btn {
  481. background: #11225350;
  482. width: 145rpx;
  483. display: flex;
  484. justify-content: space-evenly;
  485. padding: 15rpx 0;
  486. border-radius: 32rpx;
  487. position: absolute;
  488. top: 35rpx;
  489. right: 23rpx;
  490. }
  491. }
  492. .line {
  493. text-align: center;
  494. }
  495. </style>