detail.vue 12 KB

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