add.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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: 114rpx;
  45. height: 60rpx;
  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. width: 100rpx;
  53. height: 28rpx;
  54. font-family: PingFangSC, PingFang SC;
  55. font-weight: 500;
  56. font-size: 20rpx;
  57. color: #ffffff;
  58. line-height: 28rpx;
  59. text-align: left;
  60. font-style: normal;
  61. margin-left: 5px;
  62. "
  63. >
  64. {{
  65. userInfo.userType == 1
  66. ? "采购商认证"
  67. : userInfo.userType == 2
  68. ? "供应商认证"
  69. : userInfo.userType == 3
  70. ? "司机认证"
  71. : "采购商认证"
  72. }}
  73. </view>
  74. </view>
  75. <view class="phone">{{ userInfo.phone }}</view>
  76. </view>
  77. <view @click="addUser(userInfo)">
  78. <u-button
  79. type="primary"
  80. text="添加"
  81. color="linear-gradient( 275deg, #01CF6C 0%, #07E278 100%)"
  82. shape="circle"
  83. style="height: 30px"
  84. ></u-button>
  85. </view>
  86. </view>
  87. <view class="remake"> {{ userInfo.introduction }} </view>
  88. </view>
  89. </view>
  90. </view>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import TUIChatEngine, {
  96. TUIFriendService,
  97. TUIConversationService,
  98. TUIGroupService,
  99. TUIUserService,
  100. TUITranslateService,
  101. AddFriendParams,
  102. JoinGroupParams,
  103. } from "@tencentcloud/chat-uikit-engine";
  104. import { Toast, TOAST_TYPE } from "../../TUIKit/components/common/Toast/index";
  105. export default {
  106. data() {
  107. return {
  108. phone: "",
  109. userInfo: "",
  110. loading: false,
  111. };
  112. },
  113. methods: {
  114. query() {
  115. this.loading = true;
  116. this.api.getUserInfoByPhone(this.phone).then((res) => {
  117. if (res.code === 200) {
  118. console.log(res);
  119. this.userInfo = res.data;
  120. this.loading = false;
  121. }
  122. });
  123. },
  124. addUser(record) {
  125. console.log(record.id);
  126. let params = {
  127. remark: "",
  128. source: "AddSource_Type_Web",
  129. to: JSON.stringify(record.id),
  130. wording: "",
  131. };
  132. TUIFriendService.addFriend(params)
  133. .then(() => {
  134. Toast({
  135. message: TUITranslateService.t("TUIContact.申请已发送"),
  136. type: TOAST_TYPE.SUCCESS,
  137. });
  138. })
  139. .catch((error) => {
  140. console.log(error);
  141. Toast({
  142. message: TUITranslateService.t(error),
  143. type: TOAST_TYPE.ERROR,
  144. });
  145. });
  146. },
  147. },
  148. };
  149. </script>
  150. <style lang="scss" scope>
  151. ::v-deep .u-input {
  152. border: 1px solid #00d36e;
  153. border-radius: 20px;
  154. }
  155. .main {
  156. .item {
  157. display: flex;
  158. flex-direction: row;
  159. align-items: center;
  160. padding: 10px;
  161. background: white;
  162. .left {
  163. width: 20%;
  164. .img {
  165. width: 110rpx;
  166. height: 110rpx;
  167. border-radius: 50%;
  168. }
  169. }
  170. .right {
  171. width: 80%;
  172. line-height: 25px;
  173. .remake {
  174. font-weight: 400;
  175. font-size: 28rpx;
  176. color: #999999;
  177. }
  178. .right_contont {
  179. display: flex;
  180. flex-direction: row;
  181. align-items: center;
  182. .gys {
  183. width: 168rpx;
  184. height: 28rpx;
  185. font-weight: 500;
  186. font-size: 24rpx;
  187. color: #ff8b2f;
  188. line-height: 28rpx;
  189. font-style: normal;
  190. }
  191. .cgs {
  192. width: 168rpx;
  193. height: 28rpx;
  194. font-weight: 500;
  195. font-size: 24rpx;
  196. color: #00d36d;
  197. line-height: 28rpx;
  198. font-style: normal;
  199. }
  200. }
  201. .value {
  202. display: flex;
  203. flex-direction: row;
  204. align-items: center;
  205. height: 60rpx;
  206. }
  207. .title {
  208. display: flex;
  209. flex-direction: row;
  210. align-items: center;
  211. font-weight: 600;
  212. font-size: 32rpx;
  213. color: #333333;
  214. }
  215. .phone {
  216. font-weight: 600;
  217. font-size: 28rpx;
  218. color: #999999;
  219. }
  220. }
  221. }
  222. }
  223. </style>