list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <view>
  3. <view class="list-header flex_c_r">
  4. <view class="header-btn" v-if="isAdmin" @click="clickAdmin">
  5. <view class="icon-setting2"></view>
  6. <view>服务管理</view>
  7. </view>
  8. <view class="header-btn-close" v-else @click="clickAdmin">
  9. 退出管理
  10. </view>
  11. </view>
  12. <scroll-view refresher-enabled :refresher-triggered="isRefreshing" @refresherrefresh="onCustomRefresh"
  13. class="list-main" @scrolltolower="scrolltolower" scroll-y>
  14. <view>
  15. <view v-for="(item, index) in data" :key="index + 'lists'" class="list-item flex_c_c">
  16. <view class="item-radio-box flex_c_c" v-if="!isAdmin">
  17. <view :class="[activeIds.includes(item.id) ? 'item-radio-active' : 'item-radio']"
  18. @click="activeDate(item)"></view>
  19. </view>
  20. <view class="item-main flex_c_s_l">
  21. <view class="item-header flex_c_s">
  22. <view class="item-title">{{ item.name }}</view>
  23. <view class="item-tags">
  24. <view class="item-tag-ok" v-if="item.status === '1'">已发布</view>
  25. <view class="item-tag-ex" v-if="item.status === '2'">待审核</view>
  26. </view>
  27. </view>
  28. <view class="item-text">{{ item.text }}</view>
  29. <view class="item-footer flex_c_s">
  30. <view class="item-price flex_c_c">
  31. <view class="dor">¥</view>
  32. <view class="price">{{ item.price }}/{{ item.desc }}
  33. </view>
  34. </view>
  35. <view class="item-date">{{ item.date }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. <view class="list-footer flex_s_c" v-if="!isAdmin">
  42. <view class="footer-radio-box flex_c_c" @click="activeAll()">
  43. <view :class="[activeIds.length === data.length ? 'item-radio-active' : 'item-radio']"
  44. ></view>
  45. <view class="footer-radio-text">全选</view>
  46. </view>
  47. <view class="footer-btn-add" @click="onAdd"> 新增 </view>
  48. <view class="footer-btn-up" @click="onUp"> 上线 </view>
  49. <view class="footer-btn-delete" @click="onDelete"> 删除 </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script setup>
  54. import { ref } from 'vue';
  55. const isAdmin = ref(false);
  56. const isRefreshing = ref(false)
  57. const data = ref([
  58. {
  59. id: '1',
  60. name: '老人生活-健康监测',
  61. status: '1',
  62. text: '依托先进的便携式检测设备与专业检测技术,打破传统检测的时空限制,可提供上门检测服务,让客户在舒适的环境中完成健康筛查',
  63. price: '200',
  64. desc: '次',
  65. date: '2025-6-12 17:50'
  66. },
  67. {
  68. id: '2',
  69. name: '老人生活-健康监测',
  70. status: '2',
  71. text: '依托先进的便携式检测设备与专业检测技术,打破传统检测的时空限制,可提供上门检测服务,让客户在舒适的环境中完成健康筛查',
  72. price: '200',
  73. desc: '次',
  74. date: '2025-6-12 17:50'
  75. },
  76. ])
  77. const activeIds = ref([])
  78. const onCustomRefresh = () => {
  79. isRefreshing.value = true;
  80. setTimeout(() => {
  81. isRefreshing.value = false;
  82. }, 1000);
  83. };
  84. const scrolltolower = () => {
  85. };
  86. const clickAdmin = () => {
  87. console.log(1);
  88. isAdmin.value = !isAdmin.value;
  89. };
  90. const activeDate = async (record) => {
  91. try {
  92. if (activeIds.value.includes(record.id)) {
  93. activeIds.value = activeIds.value.filter(item => item !== record.id)
  94. return;
  95. }
  96. activeIds.value.push(record.id);
  97. } catch (error) {
  98. console.log("TCL: activeDate -> error", error)
  99. }
  100. }
  101. const activeAll = async () => {
  102. try {
  103. if(data.value.length !== activeIds.value.length){
  104. activeIds.value = data.value.map(item => item.id);
  105. return
  106. }
  107. activeIds.value = [];
  108. } catch (error) {
  109. console.log("TCL: activeAll -> error", error)
  110. }
  111. };
  112. const onAdd =async () => {
  113. try {
  114. uni.navigateTo({
  115. url: `/pages_home/pages/serviceManagement/index`
  116. })
  117. } catch (error) {
  118. console.log("TCL: onAdd -> error", error)
  119. }
  120. }
  121. const onUp =async () => {
  122. try {
  123. } catch (error) {
  124. console.log("TCL: onUp -> error", error)
  125. }
  126. }
  127. const onDelete =async () => {
  128. try {
  129. } catch (error) {
  130. console.log("TCL: onDelete -> error", error)
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. @import "./index.scss";
  136. .list-main {
  137. padding: 20rpx 0;
  138. position: fixed;
  139. left: 0px;
  140. top: 92rpx;
  141. right: 0px;
  142. bottom: 0;
  143. background: #F5F5F5;
  144. overflow: hidden;
  145. overflow-y: auto;
  146. padding-bottom: 176rpx;
  147. }
  148. .list-header {
  149. height: 92rpx;
  150. padding: 0 34rpx;
  151. .header-btn {
  152. border-radius: 6rpx;
  153. background: #FFF7E8;
  154. padding: 11.2rpx 23.9rpx;
  155. font-family: PingFang SC;
  156. font-size: 28rpx;
  157. font-weight: normal;
  158. line-height: 32rpx;
  159. display: flex;
  160. align-items: center;
  161. letter-spacing: normal;
  162. color: #FF7D00;
  163. .icon-setting {
  164. margin-right: 6rpx;
  165. }
  166. }
  167. .header-btn-close {
  168. @extend .header-btn;
  169. color: #4E5969;
  170. background: #F2F3F5;
  171. }
  172. }
  173. .item-radio {
  174. width: 34rpx;
  175. height: 34rpx;
  176. border-radius: 34rpx;
  177. border: 4rpx solid #C4C4C4;
  178. }
  179. .item-radio-active {
  180. @extend .item-radio;
  181. border: none;
  182. @extend .whether-radio-active;
  183. }
  184. .list-item {
  185. padding: 24rpx 40rpx;
  186. margin-bottom: 20rpx;
  187. background: #fff;
  188. gap: 44rpx;
  189. .item-radio-box {
  190. min-width: 44rpx;
  191. }
  192. .item-main {
  193. flex: 1;
  194. gap: 22rpx;
  195. .item-header {
  196. width: 100%;
  197. .item-title {
  198. margin-top: 24rpx;
  199. font-family: PingFang SC;
  200. font-size: 36rpx;
  201. font-weight: normal;
  202. line-height: 44rpx;
  203. letter-spacing: normal;
  204. /* 外部/Neutral/10强调、正文标题 */
  205. color: #1D2129;
  206. }
  207. .item-tags {
  208. .item-tag {
  209. border-radius: 4rpx;
  210. padding: 4rpx 10rpx;
  211. font-family: PingFang SC;
  212. font-size: 30rpx;
  213. font-weight: normal;
  214. line-height: 40rpx;
  215. text-align: center;
  216. display: flex;
  217. align-items: center;
  218. letter-spacing: normal;
  219. }
  220. .item-tag-ok {
  221. @extend .item-tag;
  222. background: #E8FFEA;
  223. color: #00B42A;
  224. }
  225. .item-tag-ex {
  226. @extend .item-tag;
  227. background: #E8F3FF;
  228. color: #165DFF;
  229. }
  230. }
  231. }
  232. .item-text {
  233. font-family: PingFang SC;
  234. font-size: 30rpx;
  235. font-weight: normal;
  236. line-height: 40rpx;
  237. text-align: justify;
  238. /* 浏览器可能不支持 */
  239. letter-spacing: normal;
  240. color: #86909C;
  241. display: -webkit-box;
  242. -webkit-box-orient: vertical;
  243. -webkit-line-clamp: 3;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. }
  247. .item-footer {
  248. width: 100%;
  249. .item-price {
  250. font-family: PingFang SC;
  251. font-size: 32rpx;
  252. font-weight: normal;
  253. line-height: 42rpx;
  254. text-align: right;
  255. letter-spacing: normal;
  256. color: #F53F3F;
  257. /* ¥ */
  258. .dor {
  259. font-family: PingFang SC;
  260. font-weight: 400;
  261. font-size: 24rpx;
  262. font-variation-settings: "opsz" auto;
  263. }
  264. /* 200/次 */
  265. .price {
  266. font-family: PingFang SC;
  267. font-weight: 400;
  268. font-size: 32rpx;
  269. font-variation-settings: "opsz" auto;
  270. }
  271. }
  272. .item-date {
  273. font-family: PingFang SC;
  274. font-size: 28rpx;
  275. font-weight: normal;
  276. line-height: 40rpx;
  277. letter-spacing: normal;
  278. color: #86909C;
  279. }
  280. }
  281. }
  282. }
  283. .list-footer {
  284. position: fixed;
  285. bottom: 0rpx;
  286. left: 0px;
  287. right: 0;
  288. z-index: 999;
  289. background: #fff;
  290. padding-bottom: 60rpx;
  291. height: 176rpx;
  292. gap: 30rpx;
  293. padding: 24rpx 50rpx ;
  294. .footer-radio-box {
  295. margin-top: 28rpx;
  296. margin-right: 25rpx;
  297. .footer-radio-text{
  298. font-family: PingFang SC;
  299. font-size: 32rpx;
  300. font-weight: normal;
  301. line-height: 44rpx;
  302. text-align: right;
  303. display: flex;
  304. align-items: center;
  305. letter-spacing: normal;
  306. /* 文字/text-5 */
  307. color: #1D2129;
  308. margin-left: 6rpx;
  309. }
  310. }
  311. .footer-btn {
  312. border-radius: 200rpx;
  313. box-sizing: border-box;
  314. /* 错误/danger-6 */
  315. border: 2rpx solid ;
  316. padding: 15rpx 32rpx;
  317. font-family: PingFang SC;
  318. font-size: 30rpx;
  319. font-weight: normal;
  320. line-height: 42rpx;
  321. display: flex;
  322. align-items: center;
  323. letter-spacing: normal;
  324. }
  325. .footer-btn-add {
  326. @extend .footer-btn;
  327. border-color: #F53F3F;
  328. color: #F53F3F;
  329. }
  330. .footer-btn-up {
  331. @extend .footer-btn;
  332. border-color: #FFECE8;
  333. background: #FFECE8;
  334. color: #F53F3F;
  335. }
  336. .footer-btn-delete {
  337. @extend .footer-btn;
  338. border-color: #F53F3F;
  339. background: #F53F3F;
  340. color: #fff;
  341. }
  342. }
  343. </style>