hookehuyr

新增待申领物资页面

1 /* 1 /*
2 * @Date: 2023-09-01 10:29:30 2 * @Date: 2023-09-01 10:29:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-07-23 10:50:32 4 + * @LastEditTime: 2024-07-23 14:41:12
5 * @FilePath: /temple_material_request/src/route.js 5 * @FilePath: /temple_material_request/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -18,6 +18,12 @@ export default [{ ...@@ -18,6 +18,12 @@ export default [{
18 title: '申领物资', 18 title: '申领物资',
19 } 19 }
20 }, { 20 }, {
21 + path: '/material_pre_request',
22 + component: () => import('@/views/material_pre_request.vue'),
23 + meta: {
24 + title: '待申领物资',
25 + }
26 +}, {
21 path: '/auth', 27 path: '/auth',
22 component: () => import('@/views/auth.vue'), 28 component: () => import('@/views/auth.vue'),
23 meta: { 29 meta: {
......
1 +<!--
2 + * @Date: 2024-07-23 12:53:15
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2024-07-23 16:05:39
5 + * @FilePath: /temple_material_request/src/views/material_pre_request.vue
6 + * @Description: 待申领物资页面
7 +-->
8 +<template>
9 + <div class="material-pre-request-page">
10 + <div class="list-wrapper">
11 + <van-row justify="space-between" class="select-all-item">
12 + <van-col span="8"><van-icon name="passed" size="1.25rem" />&nbsp;&nbsp;<span :style="{ color: styleColor.baseColor }">全选</span></van-col>
13 + <van-col span="16" :style="{ textAlign: 'right', fontSize: '0.85rem', color: styleColor.baseColor }">
14 + <van-icon name="records-o" />&nbsp;编辑
15 + <van-icon name="delete-o" />&nbsp;删除
16 + </van-col>
17 + </van-row>
18 + <van-list
19 + v-model:loading="loading"
20 + :finished="finished"
21 + finished-text="没有更多了"
22 + @load="onLoad"
23 + >
24 + <div v-for="item in list" :key="item" class="list-boxer">
25 + <van-row align="center" justify="space-between">
26 + <van-col span="16" style="display: flex;">
27 + <van-icon name="passed" size="1.25rem" />&nbsp;&nbsp;<div class="van-ellipsis" :style="{ color: styleColor.baseColor, textDecoration: 'underline' }" @click="onClickTitle(item)">床垫 1.2m*2m</div>
28 + </van-col>
29 + <van-col span="8" style="display: flex; align-items: center;">
30 + <van-field v-model="num_value" style="border: 1px solid #f0f0f0; padding: 0; border-radius: 5px;" label="" label-width="0" input-align="center" placeholder="数量" type="number" >
31 + <template #left-icon></template>
32 + </van-field>&nbsp;&nbsp;<span style="font-size: 0.9rem; color: #666;">个</span>
33 + </van-col>
34 + </van-row>
35 + </div>
36 + </van-list>
37 + <div style="height: 6rem;"></div>
38 + <div style="position: fixed; left: 0; right: 0; bottom:4.5rem; padding: 1rem;">
39 + <van-button icon="plus" type="primary" :color="styleColor.baseColor" plain block @click="addMore">添加更多</van-button>
40 + </div>
41 + </div>
42 + <div class="control-bar">
43 + <!-- -->
44 + <div style="display: flex; justify-content: space-between; align-items: center;">
45 + <div style="display: flex; align-items: center;" @click="showPicker = true">
46 + <div style="font-size: 0.85rem; color: #202020;">使用时间:</div>&nbsp;&nbsp;
47 + <div style="border: 1px solid #f0f0f0; border-radius: 5px; padding: 0.5rem 0.35rem 0.5rem 1rem; min-width: 6rem; font-size: 0.85rem; display: flex; align-items: center; justify-content: space-between;">{{ use_date }}&nbsp;&nbsp;<van-icon name="notes-o" size="1rem" :color="styleColor.baseColor" /></div>
48 + </div>
49 + <div style="display: flex; align-items: center;">
50 + <van-button type="primary" :color="styleColor.baseColor" @click="onConfirmRequest">确定申领</van-button>
51 + </div>
52 + </div>
53 + </div>
54 + </div>
55 +
56 + <van-popup v-model:show="showPicker" position="bottom">
57 + <van-date-picker
58 + v-model="currentDate"
59 + title="日期选择"
60 + :min-date="minDate"
61 + :max-date="maxDate"
62 + :columns-type="columns_type"
63 + @confirm="onConfirm"
64 + @cancel="showPicker = false"
65 + />
66 + </van-popup>
67 +
68 + <van-dialog v-model:show="showType" @confirm="onDialogConfirm" title="" show-cancel-button :confirm-button-color="styleColor.baseColor">
69 + <div style="padding: 1.5rem 0 0; text-align: center; font-size: 0.95rem; font-weight: bold;">请确认您本次是为哪个组别申领物资</div>
70 + <div style="display: flex; align-items: center; padding: 1rem;">
71 + <div style="font-size: 0.9rem; margin-right: 1rem; width: 5rem;">申领组:&nbsp;&nbsp;</div>
72 + <div>
73 + <van-radio-group v-model="type_checked" direction="horizontal" style="font-size: 0.9rem;">
74 + <van-radio name="1" :checked-color="styleColor.baseColor" style="margin-bottom: 0.25rem;">单选框 1</van-radio>
75 + <van-radio name="2" :checked-color="styleColor.baseColor" style="margin-bottom: 0.25rem;">单选框 2</van-radio>
76 + <van-radio name="3" :checked-color="styleColor.baseColor" style="margin-bottom: 0.25rem;">单选框 3</van-radio>
77 + </van-radio-group>
78 + </div>
79 + </div>
80 + </van-dialog>
81 +</template>
82 +
83 +<script setup>
84 +import { ref } from 'vue'
85 +import { useRoute, useRouter } from 'vue-router'
86 +
87 +import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
88 +//import { } from '@/utils/generateModules.js'
89 +//import { } from '@/utils/generateIcons.js'
90 +//import { } from '@/composables'
91 +import { styleColor } from "@/constant.js";
92 +import dayjs from "dayjs";
93 +
94 +const $route = useRoute();
95 +const $router = useRouter();
96 +useTitle($route.meta.title);
97 +
98 +const num_value = ref('');
99 +
100 +const list = ref([]);
101 +const loading = ref(false);
102 +const finished = ref(false);
103 +
104 +const onLoad = () => {
105 + // 异步更新数据
106 + // setTimeout 仅做示例,真实场景中一般为 ajax 请求
107 + setTimeout(() => {
108 + for (let i = 0; i < 10; i++) {
109 + list.value.push(list.value.length + 1);
110 + }
111 +
112 + // 加载状态结束
113 + loading.value = false;
114 +
115 + // 数据全部加载完成
116 + if (list.value.length >= 40) {
117 + finished.value = true;
118 + }
119 + }, 1000);
120 +};
121 +
122 +const onClickTitle = (item) => { // 点击物资标题回调
123 + console.warn(item);
124 +}
125 +
126 +const showPicker = ref(false);
127 +const currentDate = ref([]);
128 +const columns_type = ref(['year', 'month', 'day']);
129 +const minDate = ref();
130 +const maxDate = ref();
131 +const use_date = ref('');
132 +
133 +const onConfirm = ({ selectedValues, selectedOptions }) => {
134 + use_date.value = selectedValues.join("-");
135 + showPicker.value = false;
136 +};
137 +
138 +onMounted(() => {
139 + minDate.value = new Date()
140 +})
141 +
142 +const addMore = () => { // 添加更多回调
143 + console.warn('addMore');
144 +}
145 +
146 +const onConfirmRequest = () => { // 确定申领回调
147 + console.warn('onConfirmRequest');
148 + showType.value = true;
149 +}
150 +
151 +const showType = ref(false);
152 +const type_checked = ref('');
153 +
154 +const onDialogConfirm = () => {
155 + console.warn(type_checked.value);
156 +}
157 +</script>
158 +
159 +<style lang="less" scoped>
160 +.material-pre-request-page {
161 + .list-wrapper {
162 + position: relative;
163 + width: 100%;
164 + .select-all-item {
165 + padding: 0.5rem 1rem;
166 + }
167 + .list-boxer {
168 + margin: 0; padding: 1rem; border-top: 1px solid #f0f0f0;
169 + }
170 + }
171 +
172 + .control-bar {
173 + display: flex; position: fixed; padding: 1rem 1.5rem; left: 0; right: 0; bottom: 0; background-color: white; width: calc(100% - 3rem); box-shadow: 0rem -0.33rem 0.33rem 0.08rem rgba(0,0,0,0.06); display: flex; flex-direction: column;
174 + }
175 +}
176 +
177 +:deep(.van-picker__confirm) {
178 + color: #A67939;
179 +}
180 +</style>