pingbi.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="page-box">
  3. <navBar title="屏蔽公司" color="#000" />
  4. <view class="margin-lr-xl">
  5. <view class="margin-top">
  6. <view class="text-bold" style="font-size: 44upx; color: #333333">屏蔽公司</view>
  7. <view class="text-sm margin-top-sm" style="color: #999999"
  8. >添加屏蔽公司后,你和这些公司Boss,都不会被相互推荐 你的查看行为也不会告知对方
  9. </view>
  10. </view>
  11. <view class="box margin-top">
  12. <view class="margin-left-xs">
  13. <image src="../static/qiye.png" style="width: 36upx; height: 34upx"></image>
  14. </view>
  15. <view class="text-left" style="width: 70%">
  16. <u-input
  17. v-model="value"
  18. @input="change()"
  19. type="text"
  20. placeholder="输入添加屏蔽公司名称"
  21. inputAlign="text-align:left"
  22. />
  23. </view>
  24. <view class="add" @click="addpingbi()">添加</view>
  25. </view>
  26. <view class="searchList" v-if="show">
  27. <view
  28. class="searchList-item"
  29. @click="selectcompany(item.companyId, item.companyName)"
  30. v-for="(item, index) in companyList"
  31. :key
  32. >
  33. {{ item.companyName }}
  34. </view>
  35. </view>
  36. <view class="margin-top-xl">
  37. <view
  38. class="flex align-center justify-between"
  39. style="margin-bottom: 20rpx"
  40. v-for="(item, index) in pingbiList"
  41. :key="index"
  42. >
  43. <view style="color: #000000">{{
  44. item.company ? item.company.companyName : ""
  45. }}</view>
  46. <view class="btn" @click="jiebang(item.shieldCompanyId)">解除屏蔽</view>
  47. </view>
  48. </view>
  49. <empty v-if="pingbiList.length == 0" />
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import empty from "@/components/empty.vue";
  55. import navBar from "@/components/nav-bar/index.vue";
  56. export default {
  57. components: {
  58. empty,
  59. navBar,
  60. },
  61. data() {
  62. return {
  63. show: false,
  64. value: "",
  65. page: 1,
  66. limit: 10,
  67. userId: "",
  68. companyList: [],
  69. companyId: "",
  70. pingbiList: [],
  71. cont: "",
  72. };
  73. },
  74. onLoad() {
  75. this.getDataList();
  76. },
  77. onPullDownRefresh() {
  78. this.page = 1;
  79. this.getDataList();
  80. },
  81. onReachBottom() {
  82. if (this.page == this.cont) {
  83. uni.showToast({
  84. title: "已经到底了",
  85. icon: "none",
  86. });
  87. } else {
  88. this.page += 1;
  89. this.getDataList();
  90. }
  91. },
  92. methods: {
  93. //解除屏蔽
  94. jiebang(shieldCompanyId) {
  95. let _this = this;
  96. uni.showModal({
  97. title: "提示",
  98. content: "确认解除该公司的屏蔽?",
  99. complete(iet) {
  100. if (iet.confirm) {
  101. _this.$Request
  102. .post("/app/shieldCompany/deleteShieldCompany", {
  103. shieldCompanyId: shieldCompanyId,
  104. })
  105. .then((res) => {
  106. if (res.code == 0) {
  107. uni.showToast({
  108. title: "解除成功",
  109. });
  110. _this.getDataList();
  111. } else {
  112. uni.showToast({
  113. title: res.msg,
  114. icon: "none",
  115. });
  116. }
  117. });
  118. }
  119. },
  120. });
  121. },
  122. //屏蔽公司
  123. addpingbi() {
  124. if (this.companyId == "") {
  125. uni.showToast({
  126. title: "请选择公司",
  127. icon: "none",
  128. });
  129. return;
  130. }
  131. let _this = this;
  132. uni.showModal({
  133. title: "提示",
  134. content: "确认屏蔽该公司吗?",
  135. complete(iet) {
  136. console.log(iet);
  137. if (iet.confirm) {
  138. _this.$Request
  139. .postJson("/app/shieldCompany/insertShieldCompany", {
  140. companyId: _this.companyId,
  141. shieldType: 1,
  142. userId: uni.getStorageSync("userId"),
  143. })
  144. .then((res) => {
  145. if (res.code == 0) {
  146. uni.showToast({
  147. title: "屏蔽成功",
  148. });
  149. _this.companyId = "";
  150. _this.value = "";
  151. _this.show = false;
  152. _this.getDataList();
  153. } else {
  154. uni.showToast({
  155. title: res.msg,
  156. icon: "none",
  157. });
  158. _this.companyId = "";
  159. _this.value = "";
  160. _this.show = false;
  161. _this.getDataList();
  162. }
  163. });
  164. }
  165. },
  166. });
  167. },
  168. //选择要屏蔽的公司
  169. selectcompany(companyId, companyName) {
  170. this.value = companyName;
  171. this.companyId = companyId;
  172. this.show = false;
  173. },
  174. //搜索公司
  175. change(e) {
  176. if (this.value == "") {
  177. this.show = false;
  178. return;
  179. }
  180. let data = {
  181. page: 1,
  182. limit: 999,
  183. status: 2,
  184. companyName: this.value,
  185. };
  186. this.$Request.get("/app/company/selectCompanyList", data).then((res) => {
  187. if (res.code == 0) {
  188. this.companyList = res.data.records;
  189. if (this.companyList.length > 0) {
  190. this.show = true;
  191. }
  192. }
  193. });
  194. },
  195. //查询屏蔽列表
  196. getDataList() {
  197. let data = {
  198. page: this.page,
  199. limit: this.limit,
  200. userId: uni.getStorageSync("userId"),
  201. };
  202. this.$Request.get("/app/shieldCompany/selectShieldList", data).then((res) => {
  203. uni.stopPullDownRefresh();
  204. if (res.code == 0) {
  205. this.cont = res.data.totalPage;
  206. if (this.page == 1) {
  207. this.pingbiList = res.data.list;
  208. } else {
  209. this.pingbiList = [...this.pingbiList, ...res.data.list];
  210. }
  211. }
  212. });
  213. },
  214. },
  215. };
  216. </script>
  217. <style lang="less">
  218. .page-box {
  219. position: absolute;
  220. left: 0;
  221. bottom: 0;
  222. right: 0;
  223. top: 0;
  224. overflow: hidden;
  225. display: flex;
  226. flex-direction: column;
  227. }
  228. .margin-lr-xl{
  229. flex: 1;
  230. overflow: hidden;
  231. overflow-y: auto;
  232. // width: 100%;
  233. }
  234. page {
  235. background: #ffffff;
  236. }
  237. .searchList {
  238. width: 100%;
  239. background-color: #f7f7f7;
  240. padding-left: 10rpx;
  241. padding-right: 10rpx;
  242. }
  243. .searchList-item {
  244. padding: 20rpx;
  245. }
  246. .box {
  247. background: #f7f7f7;
  248. padding: 10upx;
  249. display: flex;
  250. align-items: center;
  251. justify-content: space-around;
  252. }
  253. .add {
  254. background: #016bf6;
  255. color: #ffffff;
  256. padding: 15upx 30upx;
  257. border-radius: 8upx;
  258. }
  259. .btn {
  260. background: rgba(0, 184, 143, 0.1);
  261. border-radius: 31upx;
  262. color: #016bf6;
  263. padding: 10rpx 27rpx;
  264. }
  265. </style>