gardenFloatingPanel.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <floating-panel class="floating-panel" v-model:height="height" :anchors="anchors">
  3. <div class="v-select-defalut-group">
  4. <el-select class="v-select" v-model="value" placeholder="综合">
  5. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  6. </el-select>
  7. <el-select class="v-select" v-model="value" placeholder="品种">
  8. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  9. </el-select>
  10. <el-select class="v-select" v-model="value" placeholder="树龄">
  11. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  12. </el-select>
  13. <el-select class="v-select" v-model="value" placeholder="价格">
  14. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  15. </el-select>
  16. </div>
  17. <div class="list">
  18. <div class="list-item" v-for="(item, index) in list" :key="index">
  19. <checkbox @change="changeCheck" v-model="item.checked"></checkbox>
  20. <div class="defalut" :class="{ active: item.select }">
  21. <div class="item-flex" @click="handleItem(index)">
  22. <img class="img" src="@/assets/img/mine/img-photo.png" alt="" />
  23. <div class="item-text" >
  24. <div class="name">
  25. <span>{{ item.name }}</span>
  26. <div class="mark">综合评分:92分</div>
  27. <div class="age">树龄:16年</div>
  28. </div>
  29. <div class="txt">单价:<span>12元/斤</span></div>
  30. <div class="txt progress">
  31. 剩余可购:
  32. <el-progress
  33. class="bar"
  34. :percentage="70"
  35. :stroke-width="8"
  36. color="#00BEDB"
  37. :format="format"
  38. />
  39. </div>
  40. </div>
  41. </div>
  42. <div class="stepper" v-show="item.checked">
  43. <span>认养数量(斤):</span>
  44. <stepper v-model="stepperValue" min="50" integer @plus="plus" />
  45. <div class="total">¥<span>{{12 * stepperValue}}</span></div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="footer">
  51. <div class="all">
  52. <checkbox v-model="checked"></checkbox>
  53. <span>全选本页</span>
  54. </div>
  55. <div class="footer-right">
  56. <div class="total">
  57. <div class="num">合计<span>¥</span><span class="value">{{12 * stepperValue}}</span></div>
  58. <div class="text">已选择 <span>{{checkedList.length}}</span> 棵树</div>
  59. </div>
  60. <div class="button" :class="{active:checkedList.length}">确认认养</div>
  61. </div>
  62. </div>
  63. </floating-panel>
  64. </template>
  65. <script setup>
  66. import { FloatingPanel } from "vant";
  67. import { ref } from "vue";
  68. import { Checkbox, Stepper } from "vant";
  69. const format = (percentage) => `100/200`;
  70. const anchors = [30, Math.round(0.4 * window.innerHeight)];
  71. const height = ref(anchors[1]);
  72. const list = ref([
  73. {
  74. status: 0,
  75. name: "桂味",
  76. checked: false,
  77. select: true,
  78. },
  79. {
  80. status: 0,
  81. name: "糯米糍",
  82. checked: false,
  83. select: false,
  84. },
  85. {
  86. status: 1,
  87. name: "井冈红糯",
  88. checked: false,
  89. select: false,
  90. },
  91. ]);
  92. const value = ref("");
  93. const options = [
  94. {
  95. value: "Option1",
  96. label: "Option1",
  97. },
  98. {
  99. value: "Option2",
  100. label: "Option2",
  101. }
  102. ];
  103. const checkedList = ref([])
  104. const changeCheck = () => {
  105. checkedList.value = list.value.filter(item =>item.checked)
  106. };
  107. const selectList = ref([])
  108. const handleItem = (index) =>{
  109. list.value[index].select = !list.value[index].select
  110. selectList.value = list.value.filter(item =>item.select)
  111. }
  112. const checked = ref(false);
  113. const stepperValue = ref(50)
  114. const plus = () =>{
  115. console.log('12');
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .floating-panel {
  120. ::v-deep {
  121. .van-floating-panel__content {
  122. background: #f2f3f5;
  123. }
  124. .van-checkbox__icon .van-icon {
  125. border-color: #00bedb;
  126. }
  127. .van-checkbox__icon--checked .van-icon {
  128. background: #00bedb;
  129. }
  130. .van-stepper__minus, .van-stepper__plus{
  131. background: rgba(0, 190, 219, 0.2);
  132. color: #00BEDB;
  133. }
  134. .van-stepper__input{
  135. background: transparent;
  136. color: #00BEDB;
  137. }
  138. }
  139. .v-select-defalut-group {
  140. border-bottom: 1px solid #f5f5f5;
  141. padding: 0 12px 12px 12px;
  142. background: #fff;
  143. .v-select + .v-select {
  144. margin-left: 4px;
  145. }
  146. }
  147. .list {
  148. width: 100%;
  149. height: calc(100% - 100px);
  150. overflow-y: auto;
  151. .list-item {
  152. padding: 12px;
  153. position: relative;
  154. display: flex;
  155. align-items: center;
  156. background: #fff;
  157. .item-flex {
  158. display: flex;
  159. padding: 8px 0 8px 5px;
  160. box-sizing: border-box;
  161. width: 100%;
  162. }
  163. .img {
  164. width: 68px;
  165. height: 68px;
  166. border-radius: 8px;
  167. margin-right: 8px;
  168. }
  169. .defalut{
  170. margin-left: 6px;
  171. width: calc(100% - 24px);
  172. border-radius: 8px;
  173. border: 1px solid transparent;
  174. }
  175. .active {
  176. background: rgba(0, 190, 219, 0.06);
  177. border-color: rgba(0, 190, 219, 0.6);
  178. }
  179. .item-text {
  180. color: #999999;
  181. font-size: 12px;
  182. line-height: 1.7;
  183. .name {
  184. display: flex;
  185. align-items: center;
  186. span {
  187. font-size: 15px;
  188. color: #000;
  189. font-weight: 500;
  190. margin-right: 3px;
  191. }
  192. div {
  193. margin-left: 4px;
  194. border-radius: 4px;
  195. font-size: 12px;
  196. padding: 2px 5px;
  197. &.mark {
  198. background: rgba(50, 203, 226, 0.25);
  199. color: #00bedb;
  200. }
  201. &.age {
  202. background: rgba(255, 196, 0, 0.2);
  203. color: #f0a400;
  204. }
  205. }
  206. }
  207. .txt {
  208. span {
  209. color: #000;
  210. }
  211. }
  212. .progress {
  213. display: flex;
  214. align-items: center;
  215. .bar {
  216. width: calc(100% - 60px);
  217. ::v-deep {
  218. .el-progress__text {
  219. font-size: 12px !important;
  220. min-width: auto;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. .stepper{
  227. margin-left:70px;
  228. padding-bottom: 8px;
  229. display: flex;
  230. align-items: center;
  231. .total{
  232. color: #FF6200;
  233. margin-left: 15px;
  234. span{
  235. font-size: 22px;
  236. }
  237. }
  238. }
  239. }
  240. .list-item + .list-item {
  241. margin-top: 12px;
  242. }
  243. }
  244. .footer {
  245. background: #fff;
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. padding: 8px 12px;
  250. box-sizing: border-box;
  251. .all {
  252. display: flex;
  253. align-items: center;
  254. border: 1px solid #01bbd8;
  255. border-radius: 20px;
  256. color: #01bbd8;
  257. padding: 8px;
  258. span {
  259. margin-left: 3px;
  260. }
  261. }
  262. .footer-right {
  263. display: flex;
  264. align-items: center;
  265. font-size: 12px;
  266. .total {
  267. margin-right: 12px;
  268. .num{
  269. letter-spacing: 1.5px;
  270. span{
  271. color: #FF6200;
  272. }
  273. .value{
  274. font-size: 16px;
  275. }
  276. }
  277. .text {
  278. color: #999999;
  279. span {
  280. color: #11d9f7;
  281. }
  282. }
  283. }
  284. .button {
  285. background: #c3f1fa;
  286. color: #fff;
  287. font-size: 16px;
  288. padding: 8px 35px;
  289. border-radius: 20px;
  290. &.active{
  291. background: linear-gradient(180deg,#18E0FF,#00C5E3);
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </style>