myInfo.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="content">
  3. <view class="card-list">
  4. <view class="row" v-for="(item,index) in cardList" :key="index">
  5. <view class="title-name">
  6. {{item.cardBusiness}}
  7. </view>
  8. <view class="flex card-list-item">
  9. <view class="left">
  10. <view class="top flex-row-center">
  11. <image :src="item.headSculpture" mode="widthFix" class="img"></image>
  12. </view>
  13. <view class="bottom flex flex-evenly">
  14. <uni-icons type="home" size="20" @click="toHome(item)"></uni-icons>
  15. <uni-icons type="home" size="20"></uni-icons>
  16. <uni-icons type="redo" size="20"></uni-icons>
  17. </view>
  18. </view>
  19. <view class="right">
  20. <view class="row1 flex">
  21. <text>{{item.name}}</text>
  22. <text class="line"></text>
  23. <text>{{item.post}}</text>
  24. </view>
  25. <view class="row2">
  26. {{item.companyName}}
  27. </view>
  28. <view class="row3" @click="toMap">
  29. <uni-icons type="redo" size="20"></uni-icons>
  30. <text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
  31. </view>
  32. <view class="row3">
  33. <uni-icons type="redo" size="20"></uni-icons>
  34. <text>{{item.phone}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="car-bottom flex">
  39. <u-button text="置顶" @click="topMarking(item)" throttle-time='1000'></u-button>
  40. <!-- <button @click="$u.debounce(topMarking, 500)">置顶</button> -->
  41. <!-- <button @click="$u.debounce(topMarking(item), 500)">置顶</button> -->
  42. <u-button text="删除" @click="del(item.id)" throttle-time='1000'></u-button>
  43. <button @click="toEditCard(item)">编辑</button>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="upload">
  48. <view class="solids" @click="addCard">
  49. <text class=''>添加新名片</text>
  50. </view>
  51. </view>
  52. <u-toast ref="uToast"></u-toast>
  53. <u-popup :show="isShowDel" @close="isShowDel=false" mode="center">
  54. <view>
  55. <text>删除名片自动退出关联得圈子,确定删除?</text>
  56. <u-radio-group v-model="radiovalue" placement="column">
  57. <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist" :key="index"
  58. :label="item.name" :name="item.name" @change="radioChange">
  59. </u-radio>
  60. </u-radio-group>
  61. <view class="flex">
  62. <view class="">
  63. 取消
  64. </view>
  65. <view class="" @click="delCard">
  66. 删除
  67. </view>
  68. </view>
  69. </view>
  70. </u-popup>
  71. </view>
  72. </template>
  73. <script>
  74. var that;
  75. export default {
  76. data() {
  77. return {
  78. id: '',
  79. radiovalue: '仅从自己名片列表删除',
  80. radiolist: [{
  81. name: '仅从自己名片列表删除',
  82. disabled: false
  83. },
  84. {
  85. name: '从所有拥有此名片用户列表删除',
  86. disabled: false
  87. }
  88. ],
  89. isShowDel: false,
  90. cardList: []
  91. };
  92. },
  93. onLoad() {
  94. that = this
  95. this.userInfo = uni.getStorageSync("userInfo")
  96. },
  97. onShow() {
  98. this.init()
  99. },
  100. methods: {
  101. toHome(item){
  102. uni.navigateTo({
  103. url: "/pages/mySet/myHome?id="+item.personalHomeId
  104. })
  105. },
  106. radioChange(n) {
  107. console.log('radioChange', n);
  108. },
  109. init() {
  110. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  111. commonId: this.userInfo.id
  112. }, failres => {
  113. this.$refs.uToast.show({
  114. type: 'error',
  115. message: failres.errmsg,
  116. })
  117. uni.hideLoading()
  118. }).then(res => {
  119. this.cardList = res.data.items
  120. })
  121. },
  122. toEditCard(val) {
  123. uni.navigateTo({
  124. url: "/pages/mySet/editCard?itemVal="+JSON.stringify(val)
  125. })
  126. },
  127. delCard() {
  128. let _data = {}
  129. if (this.radiovalue == '仅从自己名片列表删除') {
  130. _data = {
  131. id: this.id
  132. }
  133. } else {
  134. _data = {
  135. id: this.id,
  136. deleteCondition: 1
  137. }
  138. }
  139. that.$request.baseRequest('admin.unimall.cardManagementInfo', 'delete', _data, failres => {
  140. this.$refs.uToast.show({
  141. type: 'error',
  142. message: failres.errmsg,
  143. })
  144. uni.hideLoading()
  145. }).then(res => {
  146. this.isShowDel = false
  147. this.$refs.uToast.show({
  148. type: 'success',
  149. message: '删除成功!',
  150. })
  151. this.init()
  152. })
  153. },
  154. del(val) {
  155. this.id = val
  156. this.isShowDel = true
  157. },
  158. addCard() {
  159. uni.navigateTo({
  160. url: "/pages/mySet/newCard"
  161. })
  162. },
  163. topMarking(val) {
  164. that.$request.baseRequest('admin.unimall.cardManagementInfo', 'top', {
  165. cardManagementInfo: JSON.stringify({
  166. id: val.id
  167. })
  168. }, failres => {
  169. this.$refs.uToast.show({
  170. type: 'error',
  171. message: failres.errmsg,
  172. })
  173. uni.hideLoading()
  174. }).then(res => {
  175. this.$refs.uToast.show({
  176. type: 'success',
  177. message: '置顶成功!',
  178. })
  179. this.init()
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .card-list-item {
  187. border: 1px solid #ccc;
  188. border-radius: 30rpx;
  189. padding: 40rpx;
  190. box-sizing: border-box;
  191. .left {
  192. width: 30%;
  193. .top {
  194. margin-bottom: 20rpx;
  195. }
  196. .img {
  197. width: 80%;
  198. }
  199. .bottom {}
  200. }
  201. .right {
  202. .row1 {
  203. .line {
  204. width: 1px;
  205. height: 20px;
  206. margin: 0 20rpx;
  207. background: black;
  208. }
  209. }
  210. }
  211. }
  212. </style>