|
@@ -5,22 +5,36 @@
|
|
|
@change="calendarChange"
|
|
|
show-arrow
|
|
|
/>
|
|
|
- </div>
|
|
|
- <van-sticky :offset-bottom="10" position="bottom" class="add-box">
|
|
|
- <div class="add-bg" @click="toAdd">
|
|
|
- <van-icon name="add-o" size="45" />
|
|
|
+ <!-- 时间列表 -->
|
|
|
+ <div class="records-box">
|
|
|
+ <RecordInRow
|
|
|
+ :time_record_list="time_record_list"
|
|
|
+ :monthlyStr="monthlyStr"
|
|
|
+ :yearStr="yearStr"
|
|
|
+ ></RecordInRow>
|
|
|
+ </div>
|
|
|
+ <div :offset-bottom="10" position="bottom" class="add-box">
|
|
|
+ <div class="add-bg" @click="toAdd">
|
|
|
+ <van-icon name="add-o" size="45" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </van-sticky>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { watch, ref, onMounted } from 'vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { loginUser, getUserInfo } from '@/api/api.ts'
|
|
|
+import { loginUser, getUserInfo, getAllRecordyDate } from '@/api/api.ts'
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
+import RecordInRow from '@/components/RecordInRow.vue'
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
-
|
|
|
+const userDate = ref('')
|
|
|
+const yearStr = ref('')
|
|
|
+const monthlyStr = ref('')
|
|
|
+import { useCommonStore } from '@/store/common'
|
|
|
+const commonStore = useCommonStore()
|
|
|
+const time_record_list = ref([])
|
|
|
|
|
|
async function getuserToken() {
|
|
|
const res = await loginUser({
|
|
@@ -38,10 +52,38 @@ async function getuserInfo() {
|
|
|
|
|
|
onMounted(() => {
|
|
|
console.log('home onShow')
|
|
|
+ commonStore.initBook()
|
|
|
})
|
|
|
|
|
|
const calendarChange = (date) => {
|
|
|
console.log(40, dayjs(date).format('YYYY-MM-DD'))
|
|
|
+ userDate.value = dayjs(date).format('YYYY-MM-DD')
|
|
|
+ yearStr.value = dayjs(date).format('YYYY')
|
|
|
+ monthlyStr.value = dayjs(date).format('MM')
|
|
|
+}
|
|
|
+
|
|
|
+watch(userDate, () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ getAllRecordyDateFn()
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+const getAllRecordyDateFn = async () => {
|
|
|
+ const res = await getAllRecordyDate(commonStore.bookInfo.id, userDate.value)
|
|
|
+ console.log(59, res)
|
|
|
+ let totalFee = 0
|
|
|
+ res.forEach((element) => {
|
|
|
+ totalFee += Number(element.total_fee)
|
|
|
+ })
|
|
|
+ console.log(64, totalFee)
|
|
|
+
|
|
|
+ time_record_list.value = [
|
|
|
+ {
|
|
|
+ time: userDate,
|
|
|
+ totalFee,
|
|
|
+ record_list: res
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
|
|
|
const toAdd = () => {
|
|
@@ -58,6 +100,9 @@ const toAdd = () => {
|
|
|
.add-box {
|
|
|
text-align: right;
|
|
|
padding-right: 12px;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 30px;
|
|
|
+ right: 12px;
|
|
|
.add-bg {
|
|
|
border-radius: 50%;
|
|
|
background-color: aqua;
|