myInfo.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. radioChange(n) {
  102. console.log('radioChange', n);
  103. },
  104. init() {
  105. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  106. commonId: this.userInfo.id
  107. }, failres => {
  108. this.$refs.uToast.show({
  109. type: 'error',
  110. message: failres.errmsg,
  111. })
  112. uni.hideLoading()
  113. }).then(res => {
  114. this.cardList = res.data.items
  115. })
  116. },
  117. toEditCard(val) {
  118. uni.navigateTo({
  119. url: "/pages/mySet/editCard?itemVal="+JSON.stringify(val)
  120. })
  121. },
  122. delCard() {
  123. let _data = {}
  124. if (this.radiovalue == '仅从自己名片列表删除') {
  125. _data = {
  126. id: this.id
  127. }
  128. } else {
  129. _data = {
  130. id: this.id,
  131. deleteCondition: 1
  132. }
  133. }
  134. that.$request.baseRequest('admin.unimall.cardManagementInfo', 'delete', _data, failres => {
  135. this.$refs.uToast.show({
  136. type: 'error',
  137. message: failres.errmsg,
  138. })
  139. uni.hideLoading()
  140. }).then(res => {
  141. this.isShowDel = false
  142. this.$refs.uToast.show({
  143. type: 'success',
  144. message: '删除成功!',
  145. })
  146. this.init()
  147. })
  148. },
  149. del(val) {
  150. this.id = val
  151. this.isShowDel = true
  152. },
  153. addCard() {
  154. uni.navigateTo({
  155. url: "/pages/mySet/newCard"
  156. })
  157. },
  158. topMarking(val) {
  159. that.$request.baseRequest('admin.unimall.cardManagementInfo', 'top', {
  160. cardManagementInfo: JSON.stringify({
  161. id: val.id
  162. })
  163. }, failres => {
  164. this.$refs.uToast.show({
  165. type: 'error',
  166. message: failres.errmsg,
  167. })
  168. uni.hideLoading()
  169. }).then(res => {
  170. this.$refs.uToast.show({
  171. type: 'success',
  172. message: '置顶成功!',
  173. })
  174. this.init()
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .card-list-item {
  182. border: 1px solid #ccc;
  183. border-radius: 30rpx;
  184. padding: 40rpx;
  185. box-sizing: border-box;
  186. .left {
  187. width: 30%;
  188. .top {
  189. margin-bottom: 20rpx;
  190. }
  191. .img {
  192. width: 80%;
  193. }
  194. .bottom {}
  195. }
  196. .right {
  197. .row1 {
  198. .line {
  199. width: 1px;
  200. height: 20px;
  201. margin: 0 20rpx;
  202. background: black;
  203. }
  204. }
  205. }
  206. }
  207. </style>