123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <view class="water-container">
- <view class="water-date" @click="showDatePicker">
- <text>{{ defaultTime }}</text>
- <tui-icon name="turningdown" color="#C9CDD4" :size="24"></tui-icon>
- </view>
- <view class="water-all">
- <view class="all-item">
- <text>收入</text>
- <text>{{ todayWater[0].income || "0" }}</text>
- </view>
- <view class="all-item">
- <text>支出</text>
- <text>{{ todayWater[0].expenditure || "0" }}</text>
- </view>
- </view>
- <view class="water-order">
- <view class="order-title">订单明细</view>
- <template v-if="dayOrderList.length > 0">
- <view class="order-list">
- <view
- class="order-item"
- v-for="(item, index) in dayOrderList"
- :key="index"
- >
- <view class="item-text">
- <text>订单单号</text>
- <text>{{ item.orderFormid }}</text>
- </view>
- <view class="item-text">
- <text>订单金额</text>
- <text>{{ item.money }}</text>
- </view>
- <view class="item-text">
- <text>收支类型</text>
- <text>{{ item.incomeType }}</text>
- </view>
- <view class="item-text">
- <text>流水类型</text>
- <text>{{ item.waterType }}</text>
- </view>
- <view class="item-text">
- <text>到账时间</text>
- <text>{{ item.time }}</text>
- </view>
- </view>
- </view>
- </template>
- <template v-else>
- <view class="no-data">
- <image src="@/static/image/order/empty.png" />
- <text>暂无数据</text>
- </view>
- </template>
- </view>
- <tui-datetime
- ref="dateTime"
- :setDateTime="defaultTime"
- :type="defaultType"
- color="#EA5C1E"
- :radius="true"
- @confirm="dateConfirm"
- ></tui-datetime>
- </view>
- </template>
- <script>
- import { getDayDetail } from "@/config/index";
- import { getNowDate } from "@/utils/index";
- export default {
- props: {
- type: {
- type: String,
- default: "",
- },
- financialData: {
- type: Object,
- default: () => {},
- },
- },
- created() {
- if (this.type == 1) {
- this.defaultType = 2;
- this.defaultTime = getNowDate(3);
- } else if (this.type == 2) {
- this.defaultType = 3;
- this.defaultTime = getNowDate(2);
- }
- },
- computed: {
- // 过滤当日流水
- todayWater() {
- // 判断当前有没有数据
- if (Object.keys(this.financialData).length <= 0) return "";
- let list = this.financialData.finances.filter((item) => {
- return item.time == this.defaultTime;
- });
- if (list.length > 0) {
- // 给获取当日订单数据参数赋值
- this.queryOrder.time = this.defaultTime;
- // 请求当日订单数据
- this.getDayOrder();
- } else {
- // 重置订单数据
- this.dayOrderList = [];
- }
- return list;
- },
- },
- data() {
- return {
- // 请求总流水的参数
- waterAll: {
- condition: "1",
- time: "",
- },
- // 默认时间
- defaultTime: "",
- // 控制年月
- defaultType: 2,
- // 请求 日 订单数据的参数
- queryOrder: {
- income: "",
- page: 1,
- pageSize: 10,
- state: "",
- time: "",
- },
- // 订单数据列表
- dayOrderList: [],
- // 订单总数
- dayOrderTotal: 0,
- };
- },
- methods: {
- // 获取当日订单数据
- async getDayOrder() {
- let res = await getDayDetail(this.queryOrder);
- this.dayOrderList = res.data.list;
- this.dayOrderTotal = res.data.total;
- },
- // 控制日期选择显示
- showDatePicker() {
- this.$refs.dateTime && this.$refs.dateTime.show();
- },
- // 日期确定点击
- dateConfirm(date) {
- // 对日期重新赋值
- this.defaultTime = date.result;
-
- },
- },
- watch: {
- type(val) {
- if (val == 1) {
- this.defaultType = 2;
- this.defaultTime = getNowDate(3);
- } else if (val == 2) {
- this.defaultType = 3;
- this.defaultTime = getNowDate(2);
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .water-container {
- padding: 0 32rpx;
- box-sizing: border-box;
- .water-date {
- margin: 32rpx 0;
- font-size: 28rpx;
- color: #3d3d3d;
- font-weight: 400;
- @include flex(flex-start, null, 13rpx);
- }
- .water-all {
- @include flex(space-between, null);
- .all-item {
- width: 304rpx;
- height: 104rpx;
- border-radius: 8rpx;
- background-color: #fff3ee;
- padding: 16rpx;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- text {
- &:nth-of-type(1) {
- font-size: 24rpx;
- color: rgba(77, 51, 39, 0.41);
- font-weight: 500;
- }
- &:nth-of-type(2) {
- font-size: 28rpx;
- color: #ea5c1e;
- font-weight: 900;
- }
- }
- }
- }
- .water-order {
- width: 100%;
- margin-top: 32rpx;
- .order-title {
- position: relative;
- color: rgba(0, 0, 0, 0.9);
- font-size: 28rpx;
- font-weight: 600;
- &::after {
- content: "";
- position: absolute;
- left: -32rpx;
- top: 50%;
- transform: translateY(-50%);
- width: 8rpx;
- height: 24rpx;
- background-color: #ea5c1e;
- }
- }
- .order-list {
- width: 100%;
- margin-top: 32rpx;
- .order-item {
- margin-top: 16rpx;
- padding: 0 16rpx 16rpx;
- box-sizing: border-box;
- width: 100%;
- background-color: #f5f4f3;
- border-radius: 16rpx;
- .item-text {
- width: 100%;
- @include flex(flex-start);
- height: 44rpx;
- line-height: 44rpx;
- padding-top: 16rpx;
- text {
- font-size: 28rpx;
- &:nth-of-type(1) {
- width: 208rpx;
- color: rgba(0, 0, 0, 0.4);
- }
- &:nth-of-type(2) {
- color: #000000;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- }
- }
- .no-data {
- height: 736rpx;
- @include flex(center, column, 32rpx);
- image {
- width: 320rpx;
- height: 320rpx;
- display: block;
- }
- text {
- color: rgba(0, 0, 0, 0.4);
- font-size: 28rpx;
- font-weight: 600;
- }
- }
- }
- }
- </style>
|