friendList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div class="list-wrap">
  3. <div class="list-header">
  4. <el-input class="search" v-model="input" placeholder="搜索">
  5. <template #prefix>
  6. <el-icon><search /></el-icon>
  7. </template>
  8. </el-input>
  9. <div class="button">
  10. <img src="@/assets/img/mine/firend-icon.png" alt="" />
  11. 新增好友
  12. </div>
  13. </div>
  14. <div class="list">
  15. <collapse v-model="activeNames">
  16. <collapse-item :name="index" v-for="(item, index) in list" :key="index" :is-link="false">
  17. <template #title>
  18. <el-icon class="icon"><CaretRight /></el-icon>
  19. {{ item.name }}
  20. <span class="span">{{ item.children.length }}</span>
  21. </template>
  22. <template #value>
  23. <div @click.stop="hadnleManage(item)" class="text">管理</div>
  24. </template>
  25. <div class="list-item" v-for="(ele, idx) in item.children" :key="idx + ele.id">
  26. <div class="item-flex">
  27. <img class="photo" src="@/assets/img/mine/img-photo.png" alt="" />
  28. <div class="item-text">
  29. <div class="name">
  30. <span>{{ ele.name }}</span>
  31. <el-icon color="#00BEDB" size="16"><Edit /></el-icon>
  32. </div>
  33. <div>电话:19875236548</div>
  34. <div>地址:湖北省武汉市富里唱鑫园5023</div>
  35. </div>
  36. </div>
  37. </div>
  38. </collapse-item>
  39. </collapse>
  40. </div>
  41. <div class="footer">
  42. <div class="btn" @click="showPopup">新建分组</div>
  43. <div class="btn big-btn" @click="handleShow">我要定制</div>
  44. </div>
  45. </div>
  46. <!-- 添加分组弹窗 -->
  47. <add-popup :show="showGroupPopup"></add-popup>
  48. <!-- 定制详情 -->
  49. <popup class="custom-popup" position="bottom" v-model:show="customShow">
  50. <div class="popup-title">
  51. <span>定制详情</span>
  52. </div>
  53. <div class="popup-cont">
  54. <div class="select-row">
  55. <span>平均斤数</span>
  56. <el-select class="select" v-model="value" placeholder="请选择">
  57. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  58. </el-select>
  59. </div>
  60. <div class="tips">总斤数为 <span>{{value2.length * 5}}</span> 斤</div>
  61. <div class="select-row">
  62. <span class="label">优先 分配果树</span>
  63. <el-select class="select" v-model="value1" placeholder="请选择">
  64. <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
  65. </el-select>
  66. </div>
  67. <div class="select-row">
  68. <span>分配列表({{value2.length}})</span>
  69. <el-select class="select select-width" v-model="value2" placeholder="请选择" multiple collapse-tags :max-collapse-tags="1">
  70. <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value" />
  71. </el-select>
  72. </div>
  73. </div>
  74. <div class="popup-button">
  75. <div class="cancel" @click="customShow = false">取消定制</div>
  76. <div @click="handleDistribution">确认分配</div>
  77. </div>
  78. </popup>
  79. <!-- 分配树木 -->
  80. <popup class="distribution-popup" round position="bottom" closeable v-model:show="distributionShow">
  81. <div class="title">请选择 优先分配果树</div>
  82. <distribution-list class="distribution-cont" @changeActive="changeActive"></distribution-list>
  83. <div class="button-wrap">
  84. <div class="button" @click="handleOk">确认</div>
  85. </div>
  86. </popup>
  87. </template>
  88. <script setup>
  89. import { ref } from "vue";
  90. import { Collapse, CollapseItem, Popup } from "vant";
  91. import distributionList from "./distributionList.vue";
  92. import { useRouter } from "vue-router";
  93. import { ElMessage } from 'element-plus'
  94. import addPopup from "../components/addPopup.vue";
  95. const router = useRouter();
  96. //新建分组
  97. const showGroupPopup = ref(false);
  98. const showPopup = () => {
  99. showGroupPopup.value = true;
  100. };
  101. //我要定制
  102. const customShow = ref(false);
  103. const handleShow = () => {
  104. value.value = 'Option1'
  105. value1.value = ''
  106. value2.value = ''
  107. customShow.value = true;
  108. };
  109. const input = ref("");
  110. const distributionShow = ref(false);
  111. // 果树选中的监听事件
  112. const checkedList = ref([])
  113. const changeActive = (arr) =>{
  114. checkedList.value = arr
  115. }
  116. const handleOk = () =>{
  117. if(checkedList.value.length){
  118. customShow.value = false
  119. distributionShow.value = false
  120. }else{
  121. ElMessage.warning('请选择果树!')
  122. }
  123. }
  124. //确认分配
  125. const handleDistribution = () =>{
  126. if(value2.value.length){
  127. distributionShow.value = true
  128. }else{
  129. ElMessage.warning('请选择好友!')
  130. }
  131. }
  132. const value = ref('Option1')
  133. const options = [
  134. {
  135. value: 'Option1',
  136. label: '5斤/人',
  137. },
  138. {
  139. value: 'Option2',
  140. label: '10斤/人',
  141. },
  142. {
  143. value: 'Option2',
  144. label: '15斤/人',
  145. },
  146. ]
  147. const value1 = ref('')
  148. const options1 = [
  149. {
  150. value: 'Option1',
  151. label: '5斤/人',
  152. },
  153. {
  154. value: 'Option2',
  155. label: '10斤/人',
  156. },
  157. {
  158. value: 'Option2',
  159. label: '15斤/人',
  160. },
  161. ]
  162. const value2 = ref('')
  163. const options2 = [
  164. {
  165. value: '1',
  166. label: '好友1',
  167. },
  168. {
  169. value: '2',
  170. label: '好友2',
  171. },
  172. {
  173. value: '3',
  174. label: '好友3',
  175. },
  176. ]
  177. // 管理
  178. const hadnleManage = (value) => {
  179. router.push(`/manage?name=${value.name}&total=${value.children.length}&isGroup=${value.isGroup}`);
  180. };
  181. const list = ref([
  182. {
  183. name: "常用列表",
  184. id: "1",
  185. isGroup: 0,
  186. children: [
  187. {
  188. id: "3",
  189. name: "糯米糍",
  190. },
  191. {
  192. id: "4",
  193. name: "桂味",
  194. },
  195. ],
  196. },
  197. {
  198. name: "未分组标签好友",
  199. id: "2",
  200. isGroup: 1,
  201. children: [
  202. {
  203. id: "5",
  204. name: "井冈红糯",
  205. },
  206. {
  207. id: "6",
  208. name: "测试",
  209. },
  210. ],
  211. },
  212. {
  213. name: "其他列表",
  214. id: "3",
  215. children: [],
  216. },
  217. ]);
  218. const activeNames = ref([0]);
  219. </script>
  220. <style lang="scss" scoped>
  221. .list-wrap {
  222. margin: 0 12px;
  223. .list-header {
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. .search {
  228. width: 90px;
  229. margin-right: 10px;
  230. --el-input-placeholder-color: #00bedb;
  231. ::v-deep {
  232. .el-input__wrapper {
  233. box-shadow: none;
  234. border: 1px solid #18d2ef;
  235. background: transparent;
  236. border-radius: 20px;
  237. }
  238. .el-input__prefix,
  239. .el-input__inner {
  240. color: #00bedb;
  241. }
  242. }
  243. }
  244. .button {
  245. width: calc(100% - 100px);
  246. background: #c8f1f7;
  247. color: #00bedb;
  248. border: 1px solid #00d5f6;
  249. display: flex;
  250. align-items: center;
  251. justify-content: center;
  252. padding: 8px;
  253. border-radius: 20px;
  254. img {
  255. width: 20px;
  256. height: 17px;
  257. margin-right: 6px;
  258. }
  259. }
  260. }
  261. .list {
  262. width: 100%;
  263. height: 100%;
  264. margin-top: 12px;
  265. .text {
  266. color: #17c2dd;
  267. }
  268. ::v-deep {
  269. .van-cell {
  270. border-radius: 5px 5px 0 0;
  271. justify-content: space-between;
  272. .van-cell__value {
  273. flex: none;
  274. }
  275. .van-cell__title {
  276. display: flex;
  277. align-items: center;
  278. .icon {
  279. margin-right: 3px;
  280. color: #bfbfbf;
  281. font-size: 16px;
  282. }
  283. .span {
  284. color: rgba(0, 0, 0, 0.4);
  285. margin-left: 10px;
  286. }
  287. }
  288. }
  289. .van-collapse-item__title--expanded {
  290. .van-cell__title {
  291. .icon {
  292. transform: rotate(90deg);
  293. }
  294. }
  295. }
  296. .van-collapse-item + .van-collapse-item {
  297. margin-top: 12px;
  298. }
  299. }
  300. .list-item {
  301. border-radius: 12px;
  302. background: #fff;
  303. position: relative;
  304. display: flex;
  305. justify-content: space-between;
  306. align-items: center;
  307. .item-flex {
  308. display: flex;
  309. align-items: center;
  310. }
  311. .photo {
  312. width: 68px;
  313. height: 68px;
  314. border-radius: 8px;
  315. margin-right: 12px;
  316. background: red;
  317. }
  318. .item-text {
  319. color: #999999;
  320. font-size: 12px;
  321. line-height: 1.6;
  322. .name {
  323. display: flex;
  324. align-items: center;
  325. span {
  326. font-size: 15px;
  327. color: #000;
  328. font-weight: 500;
  329. margin-right: 5px;
  330. }
  331. }
  332. }
  333. }
  334. .list-item + .list-item {
  335. margin-top: 12px;
  336. }
  337. }
  338. .footer {
  339. display: flex;
  340. flex-direction: column;
  341. align-items: center;
  342. margin-top: 12px;
  343. .btn {
  344. font-size: 12px;
  345. color: #7f7f7f;
  346. padding: 5px 45px;
  347. background: rgba(201, 201, 201, 0.27);
  348. border-radius: 20px;
  349. }
  350. .big-btn {
  351. font-size: 14px;
  352. color: #fff;
  353. padding: 8px 80px;
  354. margin-top: 25px;
  355. background: linear-gradient(160deg, #18e0ff, #16afc6);
  356. }
  357. }
  358. }
  359. // 定制详情
  360. .custom-popup {
  361. width: calc(100% - 20px);
  362. border-radius: 8px;
  363. padding: 10px 14px;
  364. box-sizing: border-box;
  365. bottom: 50px;
  366. left: 10px;
  367. border: 1px solid #00bedb;
  368. background: linear-gradient(0deg, #ffffff 60%, #8ef0ff 100%);
  369. .popup-title {
  370. font-size: 16px;
  371. font-weight: 500;
  372. margin-bottom: 12px;
  373. position: relative;
  374. span {
  375. position: relative;
  376. z-index: 2;
  377. }
  378. &::before {
  379. content: "";
  380. position: absolute;
  381. width: 90px;
  382. height: 8px;
  383. border-radius: 8px;
  384. background: linear-gradient(120deg, #18e0ff, rgb(255, 255, 255, 0));
  385. bottom: 0;
  386. }
  387. }
  388. .popup-cont {
  389. .select-row + .select-row{
  390. margin-top: 5px;
  391. }
  392. .select-row {
  393. border: 1px solid rgba(0, 190, 219, 0.8);
  394. padding: 3px 0 3px 10px;
  395. border-radius: 5px;
  396. display: flex;
  397. justify-content: space-between;
  398. align-items: center;
  399. background: #fff;
  400. .label{
  401. color: #00BEDB;
  402. }
  403. .select{
  404. width: 32%;
  405. ::v-deep{
  406. .el-select__wrapper{
  407. box-shadow: none;
  408. }
  409. .el-select__caret,.el-select__placeholder{
  410. color: #00BEDB;
  411. text-align: right;
  412. }
  413. .el-select__placeholder.is-transparent{
  414. color: rgba(0, 190, 219, 0.3);
  415. }
  416. }
  417. }
  418. .select-width{
  419. width: 48%;
  420. }
  421. }
  422. .tips{
  423. font-size: 12px;
  424. margin: 6px;
  425. span{
  426. color: #00BEDB;
  427. }
  428. }
  429. }
  430. .popup-button {
  431. display: flex;
  432. padding-top: 12px;
  433. border-top: 1px solid rgba(0, 190, 219, 0.17);
  434. div {
  435. font-size: 12px;
  436. width: calc(100% - 108px - 20px);
  437. padding: 8px;
  438. border-radius: 20px;
  439. background: #00d5f6;
  440. color: #fff;
  441. text-align: center;
  442. border: 1px solid transparent;
  443. }
  444. .cancel {
  445. width: 108px;
  446. margin-right: 20px;
  447. background: #f4f4f4;
  448. border: 1px solid #e5e4e4;
  449. color: #aaaaaa;
  450. }
  451. }
  452. }
  453. .distribution-popup {
  454. padding-top: 30px;
  455. height: 60%;
  456. overflow: auto;
  457. bottom: 50px;
  458. .title {
  459. margin-left: 12px;
  460. font-size: 16px;
  461. font-weight: 500;
  462. margin-bottom: 12px;
  463. }
  464. .distribution-cont{
  465. height: calc(100% - 95px);
  466. overflow-y: auto;
  467. }
  468. .button-wrap{
  469. background: #fff;
  470. padding: 15px;
  471. display: flex;
  472. justify-content: center;
  473. .button{
  474. background: #18E0FF;
  475. color: #fff;
  476. font-size: 12px;
  477. padding: 7px 86px;
  478. border-radius: 20px;
  479. }
  480. }
  481. }
  482. </style>