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