add.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div style="padding: 10px">
  3. <u--input
  4. placeholder="请输入手机号"
  5. prefixIcon="search"
  6. prefixIconStyle="font-size: 22px;color: #909399"
  7. border="surround"
  8. v-model="phone"
  9. >
  10. <template slot="suffix">
  11. <u-button
  12. @click="query"
  13. text="搜索"
  14. style="
  15. height: 30px;
  16. border-radius: 20px;
  17. background: linear-gradient(87deg, #28d141 0%, #28ef8c 100%);
  18. color: white;
  19. "
  20. ></u-button>
  21. </template>
  22. </u--input>
  23. <u-loading-icon
  24. :show="loading"
  25. size="50"
  26. vertical
  27. text="加载中..."
  28. textSize="30"
  29. style="margin-top: 20px"
  30. ></u-loading-icon>
  31. <div v-if="userInfo">
  32. <view class="main">
  33. <view class="item">
  34. <view class="left">
  35. <img :src="userInfo.headUrl" alt="" class="img" />
  36. </view>
  37. <view class="right">
  38. <view class="right_contont">
  39. <view style="width: 80%">
  40. <view class="title"
  41. >{{ userInfo.nick }}
  42. <view
  43. style="
  44. width: 130rpx;
  45. height: 40rpx;
  46. background: linear-gradient(270deg, #f0ff00 0%, #00cf07 100%);
  47. border-radius: 4rpx;
  48. display: flex;
  49. flex-direction: row;
  50. justify-content: center;
  51. align-items: center;
  52. font-size: 24rpx;
  53. color: #ffffff;
  54. margin-left: 5px;
  55. "
  56. >
  57. {{
  58. userInfo.userTypes.includes(2)
  59. ? "供应商认证"
  60. : userInfo.userTypes.includes(4)
  61. ? "司机认证"
  62. : userInfo.userTypes.includes(7)
  63. ? "同城供应商认证"
  64. : userInfo.userTypes.includes(8)
  65. ? "同城司机认证"
  66. : "采购商认证"
  67. }}
  68. </view>
  69. </view>
  70. <view class="phone">{{ userInfo.phone }}</view>
  71. </view>
  72. <view @click="addUser(userInfo)">
  73. <u-button
  74. type="primary"
  75. text="添加"
  76. color="linear-gradient( 275deg, #01CF6C 0%, #07E278 100%)"
  77. shape="circle"
  78. style="height: 30px"
  79. ></u-button>
  80. </view>
  81. </view>
  82. <view class="remake"> {{ userInfo.introduction }} </view>
  83. </view>
  84. </view>
  85. </view>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import TUIChatEngine, {
  91. TUIFriendService,
  92. TUIConversationService,
  93. TUIGroupService,
  94. TUIUserService,
  95. TUITranslateService,
  96. AddFriendParams,
  97. JoinGroupParams,
  98. } from "@tencentcloud/chat-uikit-engine";
  99. import { Toast, TOAST_TYPE } from "../../TUIKit/components/common/Toast/index";
  100. export default {
  101. data() {
  102. return {
  103. phone: "",
  104. userInfo: "",
  105. loading: false,
  106. };
  107. },
  108. methods: {
  109. query() {
  110. this.loading = true;
  111. this.api.getUserInfoByPhone(this.phone).then((res) => {
  112. if (res.code === 200) {
  113. console.log(res);
  114. this.userInfo = res.data;
  115. this.loading = false;
  116. }
  117. });
  118. },
  119. addUser(record) {
  120. console.log(record.id);
  121. let params = {
  122. remark: "",
  123. source: "AddSource_Type_Web",
  124. to: JSON.stringify(record.id),
  125. wording: "",
  126. };
  127. TUIFriendService.addFriend(params)
  128. .then(() => {
  129. Toast({
  130. message: TUITranslateService.t("TUIContact.申请已发送"),
  131. type: TOAST_TYPE.SUCCESS,
  132. });
  133. })
  134. .catch((error) => {
  135. console.log(error);
  136. Toast({
  137. message: TUITranslateService.t(error),
  138. type: TOAST_TYPE.ERROR,
  139. });
  140. });
  141. },
  142. },
  143. };
  144. </script>
  145. <style lang="scss" scope>
  146. ::v-deep .u-input {
  147. border: 1px solid #00d36e;
  148. border-radius: 20px;
  149. }
  150. .main {
  151. .item {
  152. display: flex;
  153. flex-direction: row;
  154. align-items: center;
  155. padding: 10px;
  156. background: white;
  157. .left {
  158. width: 20%;
  159. .img {
  160. width: 110rpx;
  161. height: 110rpx;
  162. border-radius: 50%;
  163. }
  164. }
  165. .right {
  166. width: 80%;
  167. line-height: 25px;
  168. .remake {
  169. font-weight: 400;
  170. font-size: 28rpx;
  171. color: #999999;
  172. }
  173. .right_contont {
  174. display: flex;
  175. flex-direction: row;
  176. align-items: center;
  177. .gys {
  178. width: 168rpx;
  179. height: 28rpx;
  180. font-weight: 500;
  181. font-size: 24rpx;
  182. color: #ff8b2f;
  183. line-height: 28rpx;
  184. font-style: normal;
  185. }
  186. .cgs {
  187. width: 168rpx;
  188. height: 28rpx;
  189. font-weight: 500;
  190. font-size: 24rpx;
  191. color: #00d36d;
  192. line-height: 28rpx;
  193. font-style: normal;
  194. }
  195. }
  196. .value {
  197. display: flex;
  198. flex-direction: row;
  199. align-items: center;
  200. height: 60rpx;
  201. }
  202. .title {
  203. display: flex;
  204. flex-direction: row;
  205. align-items: center;
  206. font-weight: 600;
  207. font-size: 32rpx;
  208. color: #333333;
  209. }
  210. .phone {
  211. font-weight: 600;
  212. font-size: 28rpx;
  213. color: #999999;
  214. }
  215. }
  216. }
  217. }
  218. </style>