|
|
@@ -1,3 +1,6 @@
|
|
|
+<!--
|
|
|
+ 支出列表:DateSelect 旁可选记账时间(payTime,默认) / 发生时间(sendTime);「修改」仍改 sendTime。
|
|
|
+-->
|
|
|
<template>
|
|
|
<view class="app-content">
|
|
|
<view style="padding:20upx 0 30upx 50upx;font-size:32upx;">
|
|
|
@@ -7,9 +10,22 @@
|
|
|
<text style="margin-left:70upx;" @click="changePayMan()">{{ getStaffName }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view style="margin-left:50upx;margin-bottom:26upx;position:relative;">
|
|
|
- <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='今年' />
|
|
|
- </view>
|
|
|
+ <view class="date-filter-row">
|
|
|
+ <!-- 记账时间 / 发生时间:只切换筛字段,共用同一 DateSelect -->
|
|
|
+ <view class="time-type-row">
|
|
|
+ <view
|
|
|
+ class="time-type-item"
|
|
|
+ :class="{ active: timeType === 'pay' }"
|
|
|
+ @click="changeTimeType('pay')"
|
|
|
+ >记账时间</view>
|
|
|
+ <view
|
|
|
+ class="time-type-item"
|
|
|
+ :class="{ active: timeType === 'send' }"
|
|
|
+ @click="changeTimeType('send')"
|
|
|
+ >发生时间</view>
|
|
|
+ </view>
|
|
|
+ <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='今年' />
|
|
|
+ </view>
|
|
|
<block v-if="!$util.isEmpty(list.data)">
|
|
|
<view v-for="(item, index) in list.data" :key="index">
|
|
|
<view style="background-color: white;margin-bottom:15upx;padding:18upx 0 18upx 30upx;font-size:28upx;position:relative;">
|
|
|
@@ -19,10 +35,11 @@
|
|
|
</view>
|
|
|
<view v-if="item.remark!=''" style="color:red;margin-top:8upx;">备注:{{ item.remark }}</view>
|
|
|
<view style="margin-top:8upx;">付款:<text>{{item.staffName?item.staffName:''}}</text></view>
|
|
|
+ <!-- 展示/修改发生时间 sendTime;payTime 仅登记时间不可改 -->
|
|
|
<view style="margin-top:8upx;" @click="openPicker(item)">
|
|
|
- 时间:{{ item.payTime.substr(5,11) }}
|
|
|
+ 发生时间:{{ displaySendTime(item) }}
|
|
|
<text style="margin-left:35upx;color:#409eff;">修改</text>
|
|
|
- <text style="margin-left:35upx;color:#969292;" v-if="item.payTime!='0000-00-00 00:00:00' && item.addTime.substr(5,5)!=item.payTime.substr(5,5)">
|
|
|
+ <text style="margin-left:35upx;color:#969292;" v-if="showAddTimeTip(item)">
|
|
|
添加时间 {{ item.addTime.substr(5,11) }}
|
|
|
</text>
|
|
|
</view>
|
|
|
@@ -69,7 +86,7 @@
|
|
|
|
|
|
<script>
|
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
-import { getExpendList,getTypeList,changePayTime,deleteExpend } from '@/api/expend'
|
|
|
+import { getExpendList,getTypeList,changeSendTime,deleteExpend } from '@/api/expend'
|
|
|
import list from '@/mixins/list'
|
|
|
import { getAllStaff } from "@/api/shop-admin"
|
|
|
import DateSelect from "@/components/module/dateSelect"
|
|
|
@@ -94,8 +111,11 @@ export default {
|
|
|
searchTime:'',
|
|
|
startTime:'',
|
|
|
endTime:'',
|
|
|
+ // pay=记账时间(默认) / send=发生时间
|
|
|
+ timeType: 'pay',
|
|
|
showPicker:false,
|
|
|
currentInfo:{},
|
|
|
+ defaultPickerDate:'',
|
|
|
pageAction:{refresh:0}
|
|
|
};
|
|
|
},
|
|
|
@@ -119,11 +139,43 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 切换记账时间 / 发生时间后刷新列表 */
|
|
|
+ changeTimeType(type) {
|
|
|
+ if (this.timeType === type) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.timeType = type
|
|
|
+ this.resetList()
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ /** 列表展示 sendTime;历史空值回退 payTime */
|
|
|
+ displaySendTime(item) {
|
|
|
+ const t = (item && item.sendTime) ? item.sendTime : ''
|
|
|
+ if (t && t.indexOf('0000-00-00') !== 0) {
|
|
|
+ return t.substr(5, 11)
|
|
|
+ }
|
|
|
+ const pay = (item && item.payTime) ? item.payTime : ''
|
|
|
+ return pay ? pay.substr(5, 11) : ''
|
|
|
+ },
|
|
|
+ /** 业务日与添加日不同时提示添加时间 */
|
|
|
+ showAddTimeTip(item) {
|
|
|
+ if (!item || !item.addTime) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const t = (item.sendTime && item.sendTime.indexOf('0000-00-00') !== 0)
|
|
|
+ ? item.sendTime
|
|
|
+ : (item.payTime || '')
|
|
|
+ if (!t || t.indexOf('0000-00-00') === 0) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return item.addTime.substr(5, 5) !== t.substr(5, 5)
|
|
|
+ },
|
|
|
+ /** 修改支出业务时间 sendTime */
|
|
|
confirmPicker(e) {
|
|
|
let that = this
|
|
|
that.$util.confirmModal({content:'确认修改?'},() => {
|
|
|
that.showPicker = false
|
|
|
- changePayTime({id:that.currentInfo.id,date:e.value}).then(res=>{
|
|
|
+ changeSendTime({id:that.currentInfo.id,date:e.value}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
that.$msg(res.msg)
|
|
|
that.resetList()
|
|
|
@@ -134,6 +186,11 @@ export default {
|
|
|
},
|
|
|
openPicker(info){
|
|
|
this.currentInfo = info
|
|
|
+ // 修改弹窗默认落到当前发生日(sendTime,空则 payTime)
|
|
|
+ const t = (info.sendTime && String(info.sendTime).indexOf('0000-00-00') !== 0)
|
|
|
+ ? info.sendTime
|
|
|
+ : (info.payTime || '')
|
|
|
+ this.defaultPickerDate = t ? String(t).substr(0, 10) : ''
|
|
|
this.showPicker = true
|
|
|
},
|
|
|
selectDateFn(val) {
|
|
|
@@ -212,8 +269,16 @@ export default {
|
|
|
this.$util.pageTo({url: '/admin/expend/addExpend'})
|
|
|
},
|
|
|
async init(){
|
|
|
- const res = await getExpendList({ page:this.list.page,bx:this.bx,type:this.type,staffId:this.getStaffId,searchTime: this.searchTime,
|
|
|
- startTime: this.startTime,endTime: this.endTime,})
|
|
|
+ const res = await getExpendList({
|
|
|
+ page: this.list.page,
|
|
|
+ bx: this.bx,
|
|
|
+ type: this.type,
|
|
|
+ staffId: this.getStaffId,
|
|
|
+ searchTime: this.searchTime,
|
|
|
+ startTime: this.startTime,
|
|
|
+ endTime: this.endTime,
|
|
|
+ timeType: this.timeType
|
|
|
+ })
|
|
|
if (this.$util.isEmpty(res.data.list)){
|
|
|
this.completes(res)
|
|
|
return
|
|
|
@@ -253,6 +318,38 @@ export default {
|
|
|
.app-content{
|
|
|
padding-bottom:120upx;
|
|
|
}
|
|
|
+.date-filter-row {
|
|
|
+ margin: 0 20upx 26upx 20upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .time-type-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-right: 12upx;
|
|
|
+ }
|
|
|
+ .time-type-item {
|
|
|
+ height: 56upx;
|
|
|
+ line-height: 56upx;
|
|
|
+ padding: 0 16upx;
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #666;
|
|
|
+ background: #f5f5f5;
|
|
|
+ border-radius: 8upx;
|
|
|
+ margin-right: 10upx;
|
|
|
+ &:last-child {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ &.active {
|
|
|
+ color: #fff;
|
|
|
+ background: #3385ff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bar {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
.class-popup-style{
|
|
|
z-index:99999;
|
|
|
}
|
|
|
@@ -270,4 +367,4 @@ export default {
|
|
|
font-size: 30upx;
|
|
|
line-height: 56rpx;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|