detail.vue 13 KB

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