index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <extend name="public/base"/>
  2. <block name="css">
  3. <style>
  4. .add {width:50px;height:50px;line-height:50px;background:#FF589B;border-radius:50%;position:fixed;bottom:70px;right:20px;color:white;text-align:center;}
  5. .lw-list .list-item{padding:5px 10px;margin-top:10px;background:white;}
  6. .lw-list .list-content {display:flex;align-items:center;}
  7. .lw-list .list-content .list-left {width:50px;height:50px;}
  8. .lw-list .list-content .list-left img {width:50px;height:50px;}
  9. .lw-list .list-content .list-right {margin-left:20px;width:100%;}
  10. .lw-list .list-content .list-right .name {color:black;height:30px;line-height:30px;}
  11. .lw-list .list-content .list-right .name .mobile {font-size:14px;color:var(--blue);}
  12. .lw-list .list-content .list-right .name .status {color:#666;font-size:14px;float:right;}
  13. .lw-list .list-content .list-right .desc {color:#666;font-size:14px;height:20px;line-height:20px;}
  14. .lw-list .list-tool {border-top:1px solid #f8f9fb;margin-top:5px;display:flex;justify-content:flex-end;align-items:center;padding-top:5px;}
  15. .lw-list .list-tool .tool-btn {margin-left:5px;font-size:14px;border:1px solid #ccc;padding:5px 10px;border-radius:20px;color:#555;}
  16. .lw-list .list-tool .tool-btn.delete {border-color:var(--pink);color:var(--pink);}
  17. .lw-list .list-tool .tool-btn.match {border-color:var(--blue);color:var(--blue);}
  18. </style>
  19. </block>
  20. <block name="body">
  21. <van-nav-bar class="bg-pink">
  22. <template #title>
  23. <span style="color:white;">信息库</span>
  24. </template>
  25. </van-nav-bar>
  26. <form action="/">
  27. <van-search
  28. v-model="form.keyword"
  29. placeholder="请输入姓名或电话或编号"
  30. @search="onRefresh"
  31. ></van-search>
  32. </form>
  33. <van-dropdown-menu>
  34. <van-dropdown-item v-model="status" :options="status_list" @change="statusChange"></van-dropdown-item>
  35. </van-dropdown-menu>
  36. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  37. <van-list
  38. v-model="loading"
  39. :finished="finished"
  40. finished-text="没有更多了"
  41. @load="onLoad"
  42. >
  43. <div class="lw-list">
  44. <div class="list-item" v-for="item in list">
  45. <div class="list-content">
  46. <div class="list-left">
  47. <img :src="dealAvatar(item.avatar,item.sex)" alt="">
  48. </div>
  49. <div class="list-right">
  50. <div class="name">{{item.realname}} <span class="mobile" v-if="item.mobile">({{item.mobile}})</span> <span class="status">{{item.status_text}}</span></div>
  51. <div class="desc">编号:{{item.id}}</div>
  52. <div class="desc">{{item.sex_text}} • {{item.age}}岁 • {{dealHigh(item.high)}}</div>
  53. </div>
  54. </div>
  55. <div class="list-tool">
  56. <div class="tool-btn" @click="toInfo(item.id)">基本资料</div>
  57. <div class="tool-btn" @click="toMating(item.id)">择偶要求</div>
  58. <div class="tool-btn match" @click="matchField(item.id)">智能匹配</div>
  59. <div class="tool-btn" @click="toFollow(item.id)">跟进</div>
  60. </div>
  61. <div class="list-tool">
  62. <div class="tool-btn">
  63. <van-popover
  64. v-model="showPopover"
  65. trigger="click"
  66. :actions="actions"
  67. @select="toStatus(item.id,$event)"
  68. >
  69. <template #reference>
  70. 更改状态
  71. </template>
  72. </van-popover>
  73. </div>
  74. <div class="tool-btn delete" @click="toDelete(item.id)">删除</div>
  75. </div>
  76. </div>
  77. </div>
  78. </van-list>
  79. </van-pull-refresh>
  80. <van-popup v-model="showMatch">
  81. <div style="width:80vw;padding:10px;">
  82. <p style="text-align:center;">请选择必须的匹配项目</p>
  83. <van-checkbox v-model="match_field.age" style="margin-top:20px;">年龄</van-checkbox>
  84. <van-checkbox v-model="match_field.high" style="margin-top:20px;">身高</van-checkbox>
  85. <van-checkbox v-model="match_field.weight" style="margin-top:20px;">体重</van-checkbox>
  86. <van-checkbox v-model="match_field.animal" style="margin-top:20px;">生肖</van-checkbox>
  87. <van-checkbox v-model="match_field.native" style="margin-top:20px;">籍贯</van-checkbox>
  88. <van-checkbox v-model="match_field.education" style="margin-top:20px;">学历</van-checkbox>
  89. <van-checkbox v-model="match_field.income" style="margin-top:20px;">年收入</van-checkbox>
  90. <van-checkbox v-model="match_field.have_house" style="margin-top:20px;">是否有房</van-checkbox>
  91. <van-checkbox v-model="match_field.have_car" style="margin-top:20px;">是否有车</van-checkbox>
  92. <van-checkbox v-model="match_field.with_parent_live" style="margin-top:20px;">婚后是否愿意与父母同住</van-checkbox>
  93. <van-checkbox v-model="match_field.smoke" style="margin-top:20px;">是否吸烟</van-checkbox>
  94. <van-checkbox v-model="match_field.drink" style="margin-top:20px;">是否喝酒</van-checkbox>
  95. <van-checkbox v-model="match_field.want_birth" style="margin-top:20px;">是否生育</van-checkbox>
  96. <div style="padding:16px;">
  97. <van-button block class="bg-pink" @click="toMatch">开始匹配</van-button>
  98. </div>
  99. </div>
  100. </van-popup>
  101. <div class="add" @click="toAdd">添加</div>
  102. <van-tabbar v-model="active" active-color="#FF589B" :before-change="tabbarChange">
  103. <van-tabbar-item>
  104. <span>信息库</span>
  105. <template #icon>
  106. <van-icon name="home-o" size="25px"></van-icon>
  107. </template>
  108. </van-tabbar-item>
  109. <van-tabbar-item url="{:url('matchmaker/my/index')}">
  110. <span>个人中心</span>
  111. <template #icon>
  112. <van-icon name="contact" size="25px"></van-icon>
  113. </template>
  114. </van-tabbar-item>
  115. </van-tabbar>
  116. </block>
  117. <block name="script">
  118. <script>
  119. new Vue({
  120. el: '#app',
  121. data() {
  122. return {
  123. active: 0,
  124. form: {
  125. keyword: '',
  126. status: {$status},
  127. },
  128. list: [],
  129. page: 1,
  130. loading: false,
  131. finished: false,
  132. refreshing: false,
  133. status: {$status},
  134. status_list: [
  135. { text: '全部状态', value: 0 },
  136. { text: '待审核', value: 1 },
  137. { text: '审核通过', value: 2 },
  138. { text: '审核不通过', value: 3 },
  139. { text: '热恋', value: 4 },
  140. { text: '已婚', value: 5 },
  141. ],
  142. showPopover:false,
  143. actions: [
  144. { text: '待审核', value: 1 },
  145. { text: '审核通过', value: 2 },
  146. { text: '审核不通过', value: 3 },
  147. { text: '热恋', value: 4 },
  148. { text: '已婚', value: 5 },
  149. ],
  150. showMatch:false,
  151. match_field:{
  152. age: false,
  153. high: false,
  154. weight: false,
  155. animal: false,
  156. native: false,
  157. education: false,
  158. income: false,
  159. have_house: false,
  160. have_car: false,
  161. with_parent_live: false,
  162. smoke: false,
  163. drink: false,
  164. want_birth: false,
  165. },
  166. match_id: 0,
  167. };
  168. },
  169. methods: {
  170. tabbarChange() {
  171. return false;
  172. },
  173. dealAvatar(avatar,sex) {
  174. if (avatar == '') {
  175. return '__TMPL__/public/assets/images/matchmaker/avatar' + sex + '.png'
  176. } else {
  177. return avatar;
  178. }
  179. },
  180. dealHigh(high) {
  181. return high ? high + 'CM' : '保密';
  182. },
  183. toAdd() {
  184. location.href = '{:url("matchmaker/user/infoAdd")}';
  185. },
  186. toInfo(id) {
  187. location.href = '{:url("matchmaker/user/infoEdit")}?id=' + id;
  188. },
  189. toMating(id) {
  190. location.href = '{:url("matchmaker/user/matingEdit")}?id=' + id;
  191. },
  192. toMatch() {
  193. let arr = [];
  194. for (let field in this.match_field) {
  195. if (this.match_field[field]) {
  196. arr.push(field);
  197. }
  198. }
  199. location.href = '{:url("matchmaker/user/match")}?id=' + this.match_id + '&match_field=' + arr.join(',');
  200. },
  201. toFollow(id) {
  202. location.href = '{:url("matchmaker/user/follow")}?id=' + id;
  203. },
  204. toDelete(id) {
  205. vant.Dialog.confirm({
  206. title: '提示',
  207. message: '将会删除该用户所有信息,跟进记录等,并且无法恢复,确认删除吗?',
  208. })
  209. .then(() => {
  210. $.post("{:url('user/deleteUser')}", {id:id}, function (json) {
  211. location.reload();
  212. }, 'json');
  213. })
  214. .catch(() => {
  215. // on cancel
  216. });
  217. },
  218. matchField(id) {
  219. this.match_id = id;
  220. this.match_field = [];
  221. this.showMatch = true;
  222. },
  223. toStatus(id,action) {
  224. $.post("{:url('user/statusUser')}", {id:id,status:action.value}, function (json) {
  225. location.reload();
  226. }, 'json');
  227. },
  228. onLoad() {
  229. //参数
  230. let self = this;
  231. let param = this.form;
  232. param.page = this.page;
  233. this.page++;
  234. $.post("{:url('listUser')}", this.form, function (json) {
  235. //下拉刷新
  236. if (self.refreshing) {
  237. self.refreshing = false;
  238. }
  239. // 加载状态结束
  240. self.loading = false;
  241. if (json.data.length == 0) {
  242. // 数据全部加载完成
  243. self.finished = true;
  244. } else {
  245. // 增加数据
  246. for (let i = 0; i < json.data.length; i++) {
  247. self.list.push(json.data[i]);
  248. }
  249. }
  250. }, 'json');
  251. },
  252. onRefresh() {
  253. // 清空列表数据
  254. this.list = [];
  255. this.page = 1;
  256. this.loading = true;
  257. this.finished = false;
  258. this.onLoad();
  259. },
  260. statusChange(value) {
  261. location.href = "{:url('index')}?status=" + value;
  262. },
  263. },
  264. });
  265. </script>
  266. </block>