detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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"
  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="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 src="../../static/imgs/cirlce/home.png" mode="widthFix" style="width: 32rpx;"
  75. v-if="item.lookPage==1"></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-body>
  81. <u-picker @cancel="isShowCard=false" :show="isShowCard" :columns="cardList" keyName="cardBusiness"
  82. @confirm="cardConfirm"></u-picker>
  83. <u-toast ref="uToast"></u-toast>
  84. <u-modal :show="show" :content='content' @confirm="$u.debounce(joinCircle, 500)" showCancelButton
  85. @cancel="show=false" @close="show=false" closeOnClickOverlay></u-modal>
  86. <u-modal :show="isShowChangeCard" content='确定交换名片?' @confirm="$u.debounce(confirmChangeSubmit, 500)"
  87. showCancelButton @cancel="isShowChangeCard=false" @close="isShowChangeCard=false"
  88. closeOnClickOverlay></u-modal>
  89. </view>
  90. </template>
  91. <script>
  92. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  93. export default {
  94. mixins: [MescrollMixin], // 使用mixin
  95. data() {
  96. return {
  97. selectIndex: 0,
  98. isShowChangeCard: false,
  99. dataObj: {
  100. circleName: '',
  101. cardNum: '',
  102. circleLabel: []
  103. },
  104. userInfo: {},
  105. canReset: false,
  106. cardList: [],
  107. isShowCard: false,
  108. show: false,
  109. content: '加入后其他用户查看您的名片和主页,确认加入圈子?',
  110. cardId: '',
  111. id: '',
  112. changeCardList: [],
  113. cardStatus: '',
  114. isMyCard: false,
  115. swapNameCards: false,
  116. selectMycard: {},
  117. selectRowCard: {}
  118. };
  119. },
  120. onShow() {
  121. this.$nextTick(function() {
  122. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  123. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  124. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  125. });
  126. },
  127. onLoad(options) {
  128. console.log(options)
  129. this.userInfo = uni.getStorageSync("userInfo")
  130. this.id = options.val
  131. },
  132. methods: {
  133. confirmChangeSubmit() {
  134. this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'add', {
  135. cardExchangeInfo: JSON.stringify({
  136. sendId: this.userInfo.id,
  137. receiveId: this.selectRowCard.receiveId,
  138. sendCardId: this.selectMycard.id,
  139. receiveCardId: this.selectRowCard.id,
  140. circleName: this.dataObj.circleName
  141. }),
  142. }, failres => {
  143. console.log('res+++++', failres.errmsg)
  144. this.$refs.uToast.show({
  145. type: 'error',
  146. message: failres.errmsg,
  147. })
  148. uni.hideLoading()
  149. }).then(res => {
  150. this.isShowChangeCard = false
  151. this.$refs.uToast.show({
  152. type: 'success',
  153. message: "操作成功!"
  154. })
  155. setTimeout(() => {
  156. this.mescroll.resetUpScroll()
  157. }, 500)
  158. })
  159. },
  160. changeMyCard() {
  161. this.$request.baseRequest('admin.unimall.circleCardInfo', 'update', {
  162. circleCardInfo: JSON.stringify({
  163. circleId: this.dataObj.id,
  164. cardId: this.cardId,
  165. commonId: this.userInfo.id
  166. }),
  167. }, failres => {
  168. console.log('res+++++', failres.errmsg)
  169. this.$refs.uToast.show({
  170. type: 'error',
  171. message: failres.errmsg,
  172. })
  173. uni.hideLoading()
  174. }).then(res => {
  175. this.isShowCard = false
  176. this.$refs.uToast.show({
  177. type: 'success',
  178. message: "更改圈子名片成功!",
  179. })
  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. }
  337. .content1 {
  338. display: flex;
  339. padding: 40rpx;
  340. box-sizing: border-box;
  341. .right {
  342. width: 100%;
  343. display: flex;
  344. flex-direction: column;
  345. justify-content: space-evenly;
  346. .top {
  347. width: 100%;
  348. .text {
  349. color: #fff;
  350. font-weight: bold;
  351. }
  352. .join {
  353. background: #42568C;
  354. color: #fff;
  355. position: absolute;
  356. right: 0rpx;
  357. padding: 15rpx 20rpx;
  358. font-size: 26rpx;
  359. border-radius: 50rpx 0rpx 0rpx 50rpx;
  360. }
  361. }
  362. .bottom {
  363. .text {
  364. color: #ffffff90;
  365. background: #f1f5ff20;
  366. padding: 8rpx 20rpx;
  367. margin-right: 10rpx;
  368. border-radius: 20rpx;
  369. font-size: 26rpx;
  370. }
  371. }
  372. }
  373. }
  374. .no-text {
  375. color: #969393;
  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. .item {
  422. align-items: flex-start;
  423. padding: 34rpx 40rpx 0 40rpx;
  424. }
  425. .top {
  426. .left {
  427. margin-right: 36rpx;
  428. }
  429. .right {
  430. .row1 {
  431. margin-bottom: 10rpx;
  432. .name {
  433. font-size: 38rpx;
  434. font-weight: bold;
  435. color: #000000;
  436. margin-right: 26rpx;
  437. }
  438. .post {
  439. font-size: 26rpx;
  440. font-weight: 500;
  441. color: #666666;
  442. }
  443. }
  444. .row2 {
  445. font-size: 26rpx;
  446. font-weight: bold;
  447. color: #333333;
  448. }
  449. }
  450. }
  451. .bottom {
  452. padding: 20rpx 40rpx 40rpx 40rpx;
  453. }
  454. .btn {
  455. background: #11225350;
  456. width: 145rpx;
  457. display: flex;
  458. justify-content: space-evenly;
  459. padding: 15rpx 0;
  460. border-radius: 32rpx;
  461. position: absolute;
  462. top: 35rpx;
  463. right: 23rpx;
  464. }
  465. }
  466. .line {
  467. text-align: center;
  468. }
  469. </style>