add.vue 6.8 KB

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