Commit 277e963d authored by 刘文虎's avatar 刘文虎

1账单回收站, 2修复收据账单金额过长时图片大写金额无法显示BUG

parent 91ad6dc5
...@@ -3,7 +3,7 @@ import request from "@/utils/request.js" ...@@ -3,7 +3,7 @@ import request from "@/utils/request.js"
// 天气 // 天气
export async function getWeather(data) { export async function getWeather(data) {
return request({ return request({
url: `/rest/anno/weather/getWeather`, url: `/rest/anno/weather/v2/getWeather`,
method: 'GET', method: 'GET',
data, data,
noLoading: true noLoading: true
......
import request from "@/utils/request.js"
export async function getList(data) {
return request({
url: `/rest/user/getRecyclingStationList`,
method: 'GET',
data
})
}
export async function deleteById(data) {
return request({
url: `/rest/user/backRecyclingStation`,
method: 'GET',
data
})
}
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"name" : "扳手记账", "name" : "扳手记账",
"appid" : "__UNI__EDB8C7C", "appid" : "__UNI__EDB8C7C",
"description" : "", "description" : "",
"versionName" : "1.2.3", "versionName" : "1.2.4",
"versionCode" : 123, "versionCode" : 124,
"transformPx" : false, "transformPx" : false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus" : {
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], "abiFilters" : [ "arm64-v8a" ],
"autoSdkPermissions" : false, "autoSdkPermissions" : false,
"permissionExternalStorage" : { "permissionExternalStorage" : {
"request" : "none", "request" : "none",
......
...@@ -377,7 +377,16 @@ ...@@ -377,7 +377,16 @@
} }
} }
] ,{
"path" : "recyled/recyled",
"style" :
{
"navigationBarTitleText": "账单回收站",
"enablePullDownRefresh": false
}
}
]
}, },
{ {
"root": "pages/maintain-bill", "root": "pages/maintain-bill",
......
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
current: 0, // tabs组件的current值,表示当前活动的tab选项 current: 0, // tabs组件的current值,表示当前活动的tab选项
swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的 swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
tabs: debitNoteTabs, tabs: debitNoteTabs,
pages: debitNotePages, pages: JSON.parse(JSON.stringify(debitNotePages)),
activeItemStyle: { activeItemStyle: {
color: '#ff286d' color: '#ff286d'
}, },
...@@ -171,6 +171,7 @@ export default { ...@@ -171,6 +171,7 @@ export default {
this.swiperCurrent = current; this.swiperCurrent = current;
this.current = current; this.current = current;
console.log('-------animationfinish------'); console.log('-------animationfinish------');
console.log(this.currentPage);
if (this.currentPage.pageNumber === 1) { if (this.currentPage.pageNumber === 1) {
this.onRefresh(); this.onRefresh();
} }
......
...@@ -19,15 +19,15 @@ ...@@ -19,15 +19,15 @@
<view class="title-view">扳手记账</view> <view class="title-view">扳手记账</view>
</view> </view>
<view class="right-view" @click="$u.throttle(getWeather, 1000)"> <view class="right-view" @click="$u.throttle(getWeather, 1000)">
<view class="location-view"> <view class="location-view" v-if="!weather.text">
<view class="location-icon-view"><image :src="dingweidizhiImage"></image></view> <view class="location-icon-view"><image :src="dingweidizhiImage"></image></view>
<view>{{ weather.city || '查天气' }}</view> <view>查天气</view>
</view> </view>
<view class="weather-view" v-if="weather.weather"> <view class="weather-view" v-if="weather.text">
<!-- <view class="weather-icon-view"> <!-- <view class="weather-icon-view">
<image :src="weather.icon"></image> <image :src="weather.icon"></image>
</view> --> </view> -->
<view class="weather-text">{{ weather.weather }}</view> <view class="weather-text">{{ weather.text }}</view>
<view>{{ weather.temp }}℃</view> <view>{{ weather.temp }}℃</view>
</view> </view>
</view> </view>
...@@ -658,7 +658,7 @@ export default { ...@@ -658,7 +658,7 @@ export default {
color: #333333; color: #333333;
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 24rpx; // margin-left: 24rpx;
.weather-icon-view { .weather-icon-view {
margin-right: 8rpx; margin-right: 8rpx;
width: 28rpx; width: 28rpx;
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
</view> </view>
</view> </view>
<view class="voucher-head"> <view class="voucher-head">
<view class="voucher-head-item" :style="{ width: item.width }" v-for="(item, index) in voucherHeadOptions" :key="index"> <view class="voucher-head-item" :style="{ width: item.width }" v-for="(item, index) in voucherHeadOptions"
:key="index">
<view class="voucher-head-item-label"> <view class="voucher-head-item-label">
<text>{{ item.label }}</text> <text>{{ item.label }}</text>
<text>:</text> <text>:</text>
...@@ -22,20 +23,18 @@ ...@@ -22,20 +23,18 @@
<view class="table table-striped table-bordered table-hover view-userinfo"> <view class="table table-striped table-bordered table-hover view-userinfo">
<view class="tbody"> <view class="tbody">
<view class="tr border-bottom"> <view class="tr border-bottom">
<view class="td no-border-top" :style="{ width: item.width }" v-for="(item, index) in tableCellOptions" :key="index">{{ item.label }}</view> <view class="td no-border-top" :style="{ width: item.width }"
v-for="(item, index) in tableCellOptions" :key="index">{{ item.label }}</view>
<view class="td no-border-top no-border-right" style="width: 128rpx;">备注/说明</view> <view class="td no-border-top no-border-right" style="width: 128rpx;">备注/说明</view>
</view> </view>
<view class="tr"> <view class="tr">
<view class="td voucher-table-content" id="table-left"> <view class="td voucher-table-content" id="table-left">
<view class="tr" v-for="(detailItem, detailIndex) in expenseArray" :key="detailIndex"> <view class="tr" v-for="(detailItem, detailIndex) in expenseArray" :key="detailIndex">
<!-- textAlign: index === 1 ? 'left' : 'center' --> <!-- textAlign: index === 1 ? 'left' : 'center' -->
<view <view class="td"
class="td"
:class="{ 'no-border-top': detailIndex === 0, 'align-left': index === 1 && detailItem[item.value] && detailItem[item.value].length > 9 }" :class="{ 'no-border-top': detailIndex === 0, 'align-left': index === 1 && detailItem[item.value] && detailItem[item.value].length > 9 }"
:style="{ width: item.width }" :style="{ width: item.width }" v-for="(item, index) in tableCellOptions"
v-for="(item, index) in tableCellOptions" :key="index">
:key="index"
>
<text :class="{scale:platform==='4'}"> <text :class="{scale:platform==='4'}">
<text>{{ (detailItem.id && item.currencySign) || '' }}</text> <text>{{ (detailItem.id && item.currencySign) || '' }}</text>
<text v-if="index === 0">{{ detailIndex + 1 }}</text> <text v-if="index === 0">{{ detailIndex + 1 }}</text>
...@@ -44,7 +43,8 @@ ...@@ -44,7 +43,8 @@
</view> </view>
</view> </view>
</view> </view>
<view class="td no-border-right no-border-top remark-view" :style="{ width: '128rpx', 'max-height': initialHeight }"> <view class="td no-border-right no-border-top remark-view"
:style="{ width: '128rpx', 'max-height': initialHeight }">
<text v-text="detail.remark"></text> <text v-text="detail.remark"></text>
</view> </view>
</view> </view>
...@@ -66,10 +66,13 @@ ...@@ -66,10 +66,13 @@
</view> </view>
</view> </view>
<view class="voucher-table-declare"><text class="voucher-table-declare-text">本收据为电子凭证 , 具有同等效力</text></view> <view class="voucher-table-declare"><text class="voucher-table-declare-text">本收据为电子凭证 , 具有同等效力</text></view>
<view class="seal-view" v-if="detail.showSeal"><image :src="sealImage"></image></view> <view class="seal-view" v-if="detail.showSeal">
<image :src="sealImage"></image>
</view>
</view> </view>
<view class="voucher-head voucher-footer"> <view class="voucher-head voucher-footer">
<view class="voucher-head-item voucher-footer-item" v-for="(item, index) in voucherFooterOptions" :key="index"> <view class="voucher-head-item voucher-footer-item" v-for="(item, index) in voucherFooterOptions"
:key="index">
<view class="voucher-head-item-label"> <view class="voucher-head-item-label">
<text>{{ item.label }}</text> <text>{{ item.label }}</text>
<text>:</text> <text>:</text>
...@@ -82,109 +85,132 @@ ...@@ -82,109 +85,132 @@
</view> </view>
</view> </view>
<view class="voucher-preview" hover-class="u-hover-class" @click="preview"> <view class="voucher-preview" hover-class="u-hover-class" @click="preview">
<view class="voucher-preview-icon"><image :src="previewIcon" mode=""></image></view> <view class="voucher-preview-icon">
<image :src="previewIcon" mode=""></image>
</view>
<text>点击查看大图</text> <text>点击查看大图</text>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { voucherHeadOptions, voucherFooterOptions, tableCellOptions, canvasTableCellOptions, tableFooterOptions } from '@/utils/options/maintain-bill/index.js'; import {
import { refundFooterOptions, refundTableCellOptions, refundCanvasTableCellOptions } from '@/utils/options/maintain-bill/refund.js'; voucherHeadOptions,
import { billBaseUrl, baseUrl } from '@/utils/config.js'; voucherFooterOptions,
import { convertCurrency, keepTwoDecimalFull } from '@/utils/common.js'; tableCellOptions,
import { mapGetters } from 'vuex'; canvasTableCellOptions,
export default { tableFooterOptions
props: { } from '@/utils/options/maintain-bill/index.js';
detail: { import {
type: Object, refundFooterOptions,
default: () => { refundTableCellOptions,
return { refundCanvasTableCellOptions
expenseDetails: [] } from '@/utils/options/maintain-bill/refund.js';
}; import {
} billBaseUrl,
} baseUrl
}, } from '@/utils/config.js';
data() { import {
return { convertCurrency,
keepTwoDecimalFull, keepTwoDecimalFull
voucherHeadOptions, } from '@/utils/common.js';
tableFooterOptions, import {
previewIcon: billBaseUrl + 'yulanicon@3x.png', mapGetters
poster: null, } from 'vuex';
tableLeftHeight: 0 export default {
}; props: {
}, detail: {
computed: { type: Object,
...mapGetters(['platform', 'isIOS']), default: () => {
defaultColor() { return {
return this.detail.type === 'refund' ? '#875A38' : '#eb872f'; expenseDetails: []
}, };
borderColor() { }
return this.detail.type === 'refund' ? '#875A38' : '#cccccc';
},
voucherFooterOptions() {
return this.detail.type === 'refund' ? refundFooterOptions : voucherFooterOptions;
},
tableCellOptions() {
return this.detail.type === 'refund' ? refundTableCellOptions : tableCellOptions;
},
canvasTableCellOptions() {
return this.detail.type === 'refund' ? refundCanvasTableCellOptions : canvasTableCellOptions;
},
sealImage() {
return baseUrl + 'dianzishuiyin1@3x.png';
},
expenseArray() {
let length = 5 - this.detail.expenseDetails.length;
length = length > 0 ? length : 0;
let arr = this.detail.expenseDetails || [];
for (let i = 0; i < length; i++) {
arr.push({});
}
return arr;
},
arearAmount() {
let { receivableAmount, actualAmount } = this.detail;
return parseFloat(receivableAmount) - parseFloat(actualAmount);
},
expenseCount() {
if (this.detail.expenseDetails && this.detail.expenseDetails.length) {
let num = 0;
this.detail.expenseDetails.map(item => {
if (item.total) {
num += parseFloat(item.total);
}
});
return num;
} }
return 0;
}, },
upperCase() { data() {
return convertCurrency(this.expenseCount); return {
}, keepTwoDecimalFull,
androidHeight() { voucherHeadOptions,
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5; tableFooterOptions,
let h = 30; previewIcon: billBaseUrl + 'yulanicon@3x.png',
let height = `${length * h}rpx`; poster: null,
return this.tableLeftHeight ? this.tableLeftHeight + 'px' : height; tableLeftHeight: 0
}, };
initialHeight() {
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5;
let h = 30;
if (this.platform === '4') {
h=28
}
let height = `${length * h}rpx`;
return this.tableLeftHeight ? this.tableLeftHeight + 'px' : height;
}, },
scaleInitialHeight() { computed: {
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5; ...mapGetters(['platform', 'isIOS']),
let height = this.tableLeftHeight; defaultColor() {
console.log('height=====', height); return this.detail.type === 'refund' ? '#875A38' : '#eb872f';
// let zoom = 0.835; },
let zoom = 1; borderColor() {
// if (this.platform === '4') { return this.detail.type === 'refund' ? '#875A38' : '#cccccc';
},
voucherFooterOptions() {
return this.detail.type === 'refund' ? refundFooterOptions : voucherFooterOptions;
},
tableCellOptions() {
return this.detail.type === 'refund' ? refundTableCellOptions : tableCellOptions;
},
canvasTableCellOptions() {
return this.detail.type === 'refund' ? refundCanvasTableCellOptions : canvasTableCellOptions;
},
sealImage() {
return baseUrl + 'dianzishuiyin1@3x.png';
},
expenseArray() {
let length = 5 - this.detail.expenseDetails.length;
length = length > 0 ? length : 0;
let arr = this.detail.expenseDetails || [];
for (let i = 0; i < length; i++) {
arr.push({});
}
return arr;
},
arearAmount() {
let {
receivableAmount,
actualAmount
} = this.detail;
return parseFloat(receivableAmount) - parseFloat(actualAmount);
},
expenseCount() {
if (this.detail.expenseDetails && this.detail.expenseDetails.length) {
let num = 0;
this.detail.expenseDetails.map(item => {
if (item.total) {
num += parseFloat(item.total);
}
});
return num;
}
return 0;
},
upperCase() {
return convertCurrency(this.expenseCount);
},
androidHeight() {
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5;
let h = 30;
let height = `${length * h}rpx`;
return this.tableLeftHeight ? this.tableLeftHeight + 'px' : height;
},
initialHeight() {
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5;
let h = 30;
if (this.platform === '4') {
h = 28
}
let height = `${length * h}rpx`;
return this.tableLeftHeight ? this.tableLeftHeight + 'px' : height;
},
scaleInitialHeight() {
let length = this.expenseArray.length > 5 ? this.expenseArray.length : 5;
let height = this.tableLeftHeight;
console.log('height=====', height);
// let zoom = 0.835;
let zoom = 1;
// if (this.platform === '4') {
if (height < 300) { if (height < 300) {
height += 40; height += 40;
} else if (height < 500) { } else if (height < 500) {
...@@ -194,99 +220,97 @@ export default { ...@@ -194,99 +220,97 @@ export default {
} else if (height >= 800) { } else if (height >= 800) {
height += 100; height += 100;
} }
// } // }
console.log('zoom=====', zoom); console.log('zoom=====', zoom);
height = (zoom * height).toFixed(2) + 'px'; height = (zoom * height).toFixed(2) + 'px';
return height; return height;
}
},
mounted() {
setTimeout(() => {
this.initRemarkHeight();
}, 500);
},
methods: {
handleSaveVoucher() {
this.saveVoucher();
this.$emit('save', this.poster);
},
preview() {
uni.showLoading({
title: '加载中',
mask: true
});
if (!this.poster) {
this.saveVoucher();
} }
this.$emit('preview', this.poster);
}, },
/* 初始化备注栏高度 */ mounted() {
initRemarkHeight() { setTimeout(() => {
let view = uni this.initRemarkHeight();
.createSelectorQuery() }, 500);
.in(this)
.select('#table-left');
view.boundingClientRect(res => {
this.tableLeftHeight = res.height;
this.tableLeftWidth = res.width;
console.log('========res.height', res.height);
console.log('========res.width', res.width);
}).exec();
}, },
saveVoucher() { methods: {
let scale = 1; handleSaveVoucher() {
let orangeColor = this.defaultColor; this.saveVoucher();
let orangeBorderCss = '1rpx solid ' + orangeColor; this.$emit('save', this.poster);
let borderCss = `1px solid ${this.defaultColor}`; },
preview() {
let trCss = { uni.showLoading({
width: '100%', title: '加载中',
// height: '18px', mask: true
// lineHeight: '18px', });
'border-top': borderCss, if (!this.poster) {
display: 'flex' this.saveVoucher();
}; }
let thCss = { this.$emit('preview', this.poster);
// height: '100%', },
color: orangeColor, /* 初始化备注栏高度 */
padding: '2px', initRemarkHeight() {
'border-right': borderCss, let view = uni
// lineClamp: 1, .createSelectorQuery()
display: 'inline-block', .in(this)
textAlign: 'center', .select('#table-left');
boxSizing: 'border-box' view.boundingClientRect(res => {
}; this.tableLeftHeight = res.height;
let tdCss = { this.tableLeftWidth = res.width;
height: '100%', console.log('========res.height', res.height);
color: '#333333', console.log('========res.width', res.width);
padding: '2px', }).exec();
fontSize: '7px', },
lineHeight: '11px', saveVoucher() {
// lineClamp: 1, let scale = 1;
// 'border-right': borderCss, let orangeColor = this.defaultColor;
// display: 'inline-block', let orangeBorderCss = '1rpx solid ' + orangeColor;
display: 'flex', let borderCss = `1px solid ${this.defaultColor}`;
textAlign: 'center',
boxSizing: 'border-box' let trCss = {
}; width: '100%',
let headView = this.voucherHeadOptions.map((item, index) => { // height: '18px',
let view = { // lineHeight: '18px',
type: 'view', 'border-top': borderCss,
css: { display: 'flex'
width: item.width, };
display: 'inline-block', let thCss = {
fontSize: '7px', // height: '100%',
lineHeight: '11px', color: orangeColor,
'margin-bottom': '2px' padding: '2px',
}, 'border-right': borderCss,
views: [ // lineClamp: 1,
{ display: 'inline-block',
textAlign: 'center',
boxSizing: 'border-box'
};
let tdCss = {
height: '100%',
color: '#333333',
padding: '2px',
fontSize: '7px',
lineHeight: '11px',
// lineClamp: 1,
// 'border-right': borderCss,
// display: 'inline-block',
display: 'flex',
textAlign: 'center',
boxSizing: 'border-box'
};
let headView = this.voucherHeadOptions.map((item, index) => {
let view = {
type: 'view',
css: {
width: item.width,
display: 'inline-block',
fontSize: '7px',
lineHeight: '11px',
'margin-bottom': '2px'
},
views: [{
type: 'view', type: 'view',
css: { css: {
display: 'inline' display: 'inline'
}, },
views: [ views: [{
{
type: 'text', type: 'text',
css: { css: {
color: orangeColor color: orangeColor
...@@ -298,304 +322,288 @@ export default { ...@@ -298,304 +322,288 @@ export default {
css: { css: {
color: '#333333' color: '#333333'
}, },
text: item.value === 'customer' ? this.detail[item.value][item.childrenValue] || '' : this.detail[item.value] || '' text: item.value === 'customer' ? this.detail[item.value][item
.childrenValue
] || '' : this.detail[item.value] || ''
} }
] ]
} }]
] };
}; // if (index === this.voucherHeadOptions.length - 1) {
// if (index === this.voucherHeadOptions.length - 1) { // view.css.width = '70%';
// view.css.width = '70%'; // }
// } return view;
return view; });
}); let tableTr = this.canvasTableCellOptions.map(item => {
let tableTr = this.canvasTableCellOptions.map(item => { let view = {
let view = { type: 'view',
css: {
...thCss,
width: item.width
},
views: [{
type: 'text',
css: {},
text: item.label
}]
};
return view;
});
tableTr.push({
type: 'view', type: 'view',
css: { css: {
...thCss, ...thCss,
width: item.width width: `${66 * scale}px`,
borderRight: 'none'
}, },
views: [ views: [{
{
type: 'text',
css: {},
text: item.label
}
]
};
return view;
});
tableTr.push({
type: 'view',
css: {
...thCss,
width: `${66 * scale}px`,
borderRight: 'none'
},
views: [
{
type: 'text', type: 'text',
text: '备注/说明' text: '备注/说明'
} }]
] });
}); let tableBodyLeft = this.expenseArray.map((el, i) => {
let tableBodyLeft = this.expenseArray.map((el, i) => { let views = this.canvasTableCellOptions.map((item, index) => {
let views = this.canvasTableCellOptions.map((item, index) => { let textAlign = 'center';
let textAlign = 'center'; if (index === 1) {
if (index === 1) { if (el[item.value] && el[item.value].length > 9) {
if (el[item.value] && el[item.value].length > 9) { textAlign = 'left';
textAlign = 'left'; }
} }
} let view = {
type: 'view',
css: {
...tdCss,
textAlign: textAlign,
width: item.width,
display: 'inline-block'
},
views: [{
type: 'text',
text: (el.id && item.currencySign) || ''
},
{
type: 'text',
css: {
// lineClamp: 1
},
text: index === 0 ? i + 1 : el[item.value] || ''
}
]
};
if (index === this.canvasTableCellOptions.length) {
view.css['border-right'] = borderCss;
}
return view;
});
let view = { let view = {
type: 'view', type: 'view',
css: { css: {
...tdCss, ...trCss
textAlign: textAlign,
width: item.width,
display: 'inline-block'
}, },
views: [ views: views
{
type: 'text',
text: (el.id && item.currencySign) || ''
},
{
type: 'text',
css: {
// lineClamp: 1
},
text: index === 0 ? i + 1 : el[item.value] || ''
}
]
}; };
if (index === this.canvasTableCellOptions.length) { if (i === 0) {
view.css['border-right'] = borderCss; view.css['border-top'] = 'none';
} }
return view; return view;
}); });
let view = { console.log('tableBodyLeft', tableBodyLeft);
type: 'view', let tableBody = [{
css: { type: 'view',
...trCss css: {
}, width: `${260 * scale}px`,
views: views display: 'inline-block'
}; },
if (i === 0) { views: tableBodyLeft
view.css['border-top'] = 'none';
}
return view;
});
console.log('tableBodyLeft', tableBodyLeft);
let tableBody = [
{
type: 'view',
css: {
width: `${260 * scale}px`,
display: 'inline-block'
},
views: tableBodyLeft
},
{
type: 'view',
css: {
display: 'inline-block',
position: 'absolute',
top: '0px',
right: '0px',
padding: '0 2px',
width: `${63 * scale}px`,
// #ifdef APP-PLUS
right: '-1px',
// #endif
// height: `${this.expenseArray.length * 18}px`
height: this.initialHeight
}, },
views: [ {
{ type: 'view',
css: {
display: 'inline-block',
position: 'absolute',
top: '0px',
right: '0px',
padding: '0 2px',
width: `${63 * scale}px`,
// #ifdef APP-PLUS
right: '-1px',
// #endif
// height: `${this.expenseArray.length * 18}px`
height: this.initialHeight
},
views: [{
css: {}, css: {},
type: 'text', type: 'text',
// 'line-clamp': 6, // 'line-clamp': 6,
text: this.detail.remark text: this.detail.remark
} }]
]
}
];
if (this.platform === '4') {
// if (this.isIOS) {
// tableBody[1].css.width = `${55 * scale}px`;
// tableBody[1].views[0].css = { width: '55px', display: 'inline-block', boxSizing: 'border-box', height: '100%' };
// } else {
// tableBody[1].css.width = `${60 * scale}px`;
// tableBody[1].views[0].css = { verticalAlign: 'top', padding: '4px 3px 0 3px', width: '66px', display: 'inline-block', boxSizing: 'border-box', height: '100%' };
// }
}
let tableBorder = this.canvasTableCellOptions.map((item, index) => {
let left = -1;
this.canvasTableCellOptions.map((col, colIndex) => {
if (colIndex <= index) {
let width = parseInt(col.width.replace('px', ''));
left += width;
} }
];
if (this.platform === '4') {
// if (this.isIOS) {
// tableBody[1].css.width = `${55 * scale}px`;
// tableBody[1].views[0].css = { width: '55px', display: 'inline-block', boxSizing: 'border-box', height: '100%' };
// } else {
// tableBody[1].css.width = `${60 * scale}px`;
// tableBody[1].views[0].css = { verticalAlign: 'top', padding: '4px 3px 0 3px', width: '66px', display: 'inline-block', boxSizing: 'border-box', height: '100%' };
// }
}
let tableBorder = this.canvasTableCellOptions.map((item, index) => {
let left = -1;
this.canvasTableCellOptions.map((col, colIndex) => {
if (colIndex <= index) {
let width = parseInt(col.width.replace('px', ''));
left += width;
}
});
console.log('this.scaleInitialHeight', this.scaleInitialHeight);
let view = {
type: 'view',
css: {
position: 'absolute',
width: '1px',
height: this.scaleInitialHeight,
left: left,
// top: '10px',
background: this.defaultColor
}
};
return view;
}); });
console.log('this.scaleInitialHeight', this.scaleInitialHeight); let tableFooterCell = []
let view = { this.tableFooterOptions.map((item, index) => {
type: 'view', let text = item.value === 'upperCase' ? this.upperCase : this.keepTwoDecimalFull(this
css: { .expenseCount);
position: 'absolute', if (item.value === 'lowerCase' && text) {
width: '1px', text = '¥' + text;
height: this.scaleInitialHeight,
left: left,
// top: '10px',
background: this.defaultColor
} }
}; let label = {
return view; type: 'text',
}); css: {
let tableFooterCell = this.tableFooterOptions.map((item, index) => { color: orangeColor,
let text = item.value === 'upperCase' ? this.upperCase : this.keepTwoDecimalFull(this.expenseCount);
if (item.value === 'lowerCase' && text) {
text = '¥' + text;
}
let view = {
type: 'view',
css: {
height: '100%',
display: 'inline-block',
width: item.width,
textAlign: 'left',
lineHeight: '15px'
},
views: [
{
type: 'text',
css: {
color: orangeColor
},
text: item.label
}, },
{ text: item.label
type: 'text', }
text: text if(index===1){
} label.css.marginLeft="35px"
] }
}; let value = {
return view; css: {
}); width: item.width,
let tableFooter = [ color: orangeColor,
{ },
type: 'view', type: 'text',
css: { text: text
height: '100%', }
display: 'inline-block', tableFooterCell.push(label)
'border-right': borderCss, tableFooterCell.push(value)
width: '21px', });
textAlign: 'center', let tableFooter = [{
lineHeight: '15px' type: 'view',
}, css: {
views: [ height: '100%',
{ display: 'inline-block',
'border-right': borderCss,
width: '21px',
textAlign: 'center',
lineHeight: '15px'
},
views: [{
type: 'text', type: 'text',
text: '合计' text: '合计'
} }]
]
},
{
type: 'view',
css: {
height: '100%',
display: 'inline-block',
width: '295px',
textAlign: 'left',
lineHeight: '15px',
'margin-left': '8px',
background: '#FFFFFF'
}, },
views: tableFooterCell {
} type: 'view',
]; css: {
let tableView = [ height: '100%',
// 表头 display: 'inline-block',
{ width: '295px',
type: 'view', textAlign: 'left',
css: { lineHeight: '15px',
...trCss, 'margin-left': '8px',
'border-top': 'none' background:'#ffffff'
}, },
views: tableTr views: tableFooterCell
}, }
// 表格tbody ];
{ let tableView = [
type: 'view', // 表头
css: { {
width: '100%', type: 'view',
'border-top': borderCss css: {
// #ifdef APP-PLUS ...trCss,
// display:'flex' 'border-top': 'none'
// #endif },
views: tableTr
}, },
views: [...tableBody, ...tableBorder] // 表格tbody
}, {
// 表格合计 type: 'view',
{ css: {
type: 'view', width: '100%',
css: { 'border-top': borderCss
width: '100%', // #ifdef APP-PLUS
height: '16px', // display:'flex'
display: 'flex', // #endif
'align-items': 'center', },
'border-top': borderCss, views: [...tableBody, ...tableBorder]
borderRight: 'none'
}, },
views: tableFooter // 表格合计
}, {
// 表格右侧说明 type: 'view',
{ css: {
type: 'view', width: '100%',
css: { height: '16px',
position: 'absolute', display: 'flex',
right: '-12px', 'align-items': 'center',
// top: '-5px', 'border-top': borderCss,
top: '0px', borderRight: 'none'
// #ifdef APP-PLUS },
right: '-8px', views: tableFooter
top: this.isIOS ? '0px' : '-9px',
// #endif
width: '5px',
fontSize: '5px',
lineHeight: '8px',
'text-align': 'center',
color: orangeColor
}, },
views: [ // 表格右侧说明
{ {
type: 'view',
css: {
position: 'absolute',
right: '-12px',
// top: '-5px',
top: '0px',
// #ifdef APP-PLUS
right: '-8px',
top: this.isIOS ? '0px' : '-9px',
// #endif
width: '5px',
fontSize: '5px',
lineHeight: '8px',
'text-align': 'center',
color: orangeColor
},
views: [{
type: 'text', type: 'text',
text: '本收据为电子凭证,具有同等效力' text: '本收据为电子凭证,具有同等效力'
} }]
] }
} ];
]; // 表格底部
// 表格底部 let footerView = this.voucherFooterOptions.map((item, index) => {
let footerView = this.voucherFooterOptions.map((item, index) => { let text = item.value === 'arearAmount' ? this.arearAmount : this.detail[item.value];
let text = item.value === 'arearAmount' ? this.arearAmount : this.detail[item.value]; let view = {
let view = { type: 'view',
type: 'view', css: {
css: { width: '25%',
width: '25%', display: 'inline-block',
display: 'inline-block', fontSize: '7px',
fontSize: '7px', lineHeight: '11px',
lineHeight: '11px', 'margin-bottom': '2px'
'margin-bottom': '2px' },
}, views: [{
views: [
{
type: 'view', type: 'view',
css: { css: {
display: 'inline' display: 'inline'
}, },
views: [ views: [{
{
type: 'text', type: 'text',
css: { css: {
color: orangeColor color: orangeColor
...@@ -610,57 +618,54 @@ export default { ...@@ -610,57 +618,54 @@ export default {
text: `${item.currencySign || ''}${text || ''}` text: `${item.currencySign || ''}${text || ''}`
} }
] ]
}]
};
if (index === this.voucherFooterOptions.length - 1) {
view.css.width = '75%';
}
return view;
});
// 印章
let sealView = {};
if (this.detail.showSeal) {
sealView = {
type: 'image',
src: this.sealImage,
css: {
position: 'fixed',
display: 'inline-block',
width: '112px',
height: '58px',
right: '36px',
bottom: '42px'
} }
] };
};
if (index === this.voucherFooterOptions.length - 1) {
view.css.width = '75%';
} }
return view; console.log(tableView);
}); this.poster = {
// 印章
let sealView = {};
if (this.detail.showSeal) {
sealView = {
type: 'image',
src: this.sealImage,
css: { css: {
position: 'fixed', width: `${351 * scale}px`,
display: 'inline-block', 'background-color': '#FFFFFF',
width: '112px', padding: '12px 8px 0px 8px',
height: '58px', color: '#333333'
right: '36px', },
bottom: '42px' views: [
} // 标题
}; {
} type: 'view',
console.log(tableView); css: {
this.poster = { position: 'absolute',
css: { top: '-10px',
width: `${351 * scale}px`, width: '325px',
'background-color': '#FFFFFF', display: 'flex',
padding: '12px 8px 0px 8px', justifyContent: 'center'
color: '#333333' },
}, views: [{
views: [
// 标题
{
type: 'view',
css: {
position: 'absolute',
top: '-10px',
width: '325px',
display: 'flex',
justifyContent: 'center'
},
views: [
{
type: 'view', type: 'view',
css: { css: {
display: 'inline-block' display: 'inline-block'
}, },
views: [ views: [{
{
type: 'text', type: 'text',
css: { css: {
display: 'inline-block', display: 'inline-block',
...@@ -688,291 +693,323 @@ export default { ...@@ -688,291 +693,323 @@ export default {
text: this.detail.repairShopName text: this.detail.repairShopName
} }
] ]
} }]
]
},
// 头部信息
{
type: 'view',
css: {
'margin-top': '30px',
// display: 'flex',
// 'flex-wrap': 'wrap',
overflow: 'hidden'
}, },
views: headView // 头部信息
}, {
// 表格 type: 'view',
{ css: {
type: 'view', 'margin-top': '30px',
css: { // display: 'flex',
width: '325px', // 'flex-wrap': 'wrap',
fontSize: '7px', overflow: 'hidden'
lineHeight: '11px', },
textAlign: 'left', views: headView
marginTop: '3px',
border: borderCss
}, },
views: tableView // 表格
}, {
// 底部信息 type: 'view',
{ css: {
type: 'view', width: '325px',
css: { fontSize: '7px',
'padding-top': '5px', lineHeight: '11px',
'padding-bottom': '12px', textAlign: 'left',
overflow: 'hidden', marginTop: '3px',
background: '#FFFFFF' border: borderCss
},
views: tableView
}, },
views: footerView // 底部信息
}, {
// 印章 type: 'view',
{ css: {
...sealView 'padding-top': '5px',
} 'padding-bottom': '12px',
] overflow: 'hidden',
}; background: '#FFFFFF'
},
views: footerView
},
// 印章
{
...sealView
}
]
};
}
} }
} };
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/static/styles/scss/table.scss'; @import '@/static/styles/scss/table.scss';
// 橙色字体 // 橙色字体
$orange-color: var(--color); $orange-color: var(--color);
.voucher {
padding: 24rpx 16rpx; .voucher {
background-color: #ffffff; padding: 24rpx 16rpx;
border-radius: 16rpx; background-color: #ffffff;
color: #333333; border-radius: 16rpx;
&-title { color: #333333;
display: flex;
justify-content: center; &-title {
align-items: center; display: flex;
font-size: 24rpx; justify-content: center;
font-weight: bold; align-items: center;
color: $orange-color; font-size: 24rpx;
line-height: 52rpx; font-weight: bold;
&-text { color: $orange-color;
// display: flex; line-height: 52rpx;
display: inline-block;
position: relative; &-text {
&-underline { // display: flex;
position: absolute; display: inline-block;
bottom: 0; position: relative;
left: 0;
width: 100%; &-underline {
height: 6rpx;
&::after {
content: '';
box-sizing: border-box; // 为了与原元素等大
position: absolute; position: absolute;
bottom: 0;
left: 0; left: 0;
top: 0; width: 100%;
width: 200%; height: 6rpx;
height: 200%;
border-top: 2rpx solid $orange-color; &::after {
border-bottom: 2rpx solid $orange-color; content: '';
transform: scale(0.5); box-sizing: border-box; // 为了与原元素等大
transform-origin: 0 0; position: absolute;
left: 0;
top: 0;
width: 200%;
height: 200%;
border-top: 2rpx solid $orange-color;
border-bottom: 2rpx solid $orange-color;
transform: scale(0.5);
transform-origin: 0 0;
}
} }
} }
} }
}
&-head { &-head {
margin-top: 16rpx; margin-top: 16rpx;
display: flex;
flex-wrap: wrap;
overflow: hidden;
&-item {
width: 30%;
display: flex; display: flex;
align-items: center; flex-wrap: wrap;
font-size: 16rpx; overflow: hidden;
line-height: 22rpx;
margin-bottom: 4rpx; &-item {
white-space: nowrap; width: 30%;
word-break: break-all; display: flex;
transform: scale(0.85); align-items: center;
transform-origin: left center; font-size: 16rpx;
&:last-child { line-height: 22rpx;
width: 70%; margin-bottom: 4rpx;
white-space: nowrap; white-space: nowrap;
// overflow: hidden;
word-break: break-all; word-break: break-all;
} transform: scale(0.85);
&-label { transform-origin: left center;
flex-shrik: 0;
color: $orange-color; &:last-child {
} width: 70%;
&-value { white-space: nowrap;
// overflow: hidden;
word-break: break-all;
}
&-label {
flex-shrik: 0;
color: $orange-color;
}
&-value {}
} }
} }
}
&-footer { &-footer {
margin-top: 10rpx; margin-top: 10rpx;
&-item {
width: 25%; &-item {
&:last-child { width: 25%;
width: 75%;
white-space: nowrap; &:last-child {
overflow: hidden; width: 75%;
word-break: break-all; white-space: nowrap;
overflow: hidden;
word-break: break-all;
}
} }
} }
}
&-table { &-table {
width: 650rpx; width: 650rpx;
font-size: 14rpx; font-size: 14rpx;
line-height: 22rpx; line-height: 22rpx;
text-align: center; text-align: center;
margin-top: 6rpx; margin-top: 6rpx;
// border: 2rpx solid $orange-color; // border: 2rpx solid $orange-color;
position: relative;
.seal-view {
position: absolute;
width: 188rpx;
height: 97rpx;
right: 16rpx;
bottom: 16rpx;
}
&-content {
padding: 0 !important;
border-width: 0 !important;
border-width: 0 !important;
}
&-tr {
width: 100%;
display: flex;
align-items: center;
// height: 34rpx;
border-top: 2rpx solid $orange-color;
line-height: 34rpx;
position: relative; position: relative;
}
&-th { .seal-view {
height: 100%; position: absolute;
color: $orange-color; width: 188rpx;
padding: 4rpx 4rpx; height: 97rpx;
line-height: 26rpx; right: 16rpx;
/* #ifdef APP-PLUS */ bottom: 16rpx;
line-height: 34rpx;
/* #endif */
border-right: 2rpx solid $orange-color;
// white-space: nowrap;
// overflow: hidden;
word-break: break-all;
&:last-child {
border-right: none;
}
}
&-td {
height: 100%;
padding: 4rpx 4rpx;
line-height: 26rpx;
/* #ifdef APP-PLUS */
line-height: 26rpx;
/* #endif */
border-right: 2rpx solid $orange-color;
// box-sizing: border-box;
// white-space: nowrap;
// overflow: hidden;
word-break: break-all;
&:last-child {
border-right: none;
} }
}
.remark-view {
overflow: hidden;
text-align: left;
}
.align-left {
text-align: left !important;
}
&-tbody {
position: relative;
width: 100%;
display: flex;
align-items: flex-start;
&-content { &-content {
.voucher-table-tr { padding: 0 !important;
.voucher-table-td { border-width: 0 !important;
&:last-child { border-width: 0 !important;
border-right: 2rpx solid $orange-color; }
}
} &-tr {
width: 100%;
display: flex;
align-items: center;
// height: 34rpx;
border-top: 2rpx solid $orange-color;
line-height: 34rpx;
position: relative;
}
&-th {
height: 100%;
color: $orange-color;
padding: 4rpx 4rpx;
line-height: 26rpx;
/* #ifdef APP-PLUS */
line-height: 34rpx;
/* #endif */
border-right: 2rpx solid $orange-color;
// white-space: nowrap;
// overflow: hidden;
word-break: break-all;
&:last-child {
border-right: none;
} }
} }
&-remark {
flex: 1; &-td {
height: 100%; height: 100%;
padding: 4rpx 4rpx; padding: 4rpx 4rpx;
border-top: 2rpx solid $orange-color; line-height: 26rpx;
text-align: left; /* #ifdef APP-PLUS */
line-height: 26rpx;
/* #endif */
border-right: 2rpx solid $orange-color;
// box-sizing: border-box;
// white-space: nowrap;
// overflow: hidden;
word-break: break-all; word-break: break-all;
-webkit-line-clamp: 7;
line-clamp: 7; &:last-child {
border-right: none;
}
}
.remark-view {
overflow: hidden; overflow: hidden;
text-align: left;
} }
}
.voucher-table-tfooter { .align-left {
position: relative; text-align: left !important;
height: 34rpx;
display: flex;
align-items: center;
// border-top: 2rpx solid $orange-color;
.voucher-table-td {
border-bottom: none;
} }
&-col {
&-tbody {
position: relative;
width: 100%;
display: flex;
align-items: flex-start;
&-content {
.voucher-table-tr {
.voucher-table-td {
&:last-child {
border-right: 2rpx solid $orange-color;
}
}
}
}
&-remark {
flex: 1;
height: 100%;
padding: 4rpx 4rpx;
border-top: 2rpx solid $orange-color;
text-align: left;
word-break: break-all;
-webkit-line-clamp: 7;
line-clamp: 7;
overflow: hidden;
}
}
.voucher-table-tfooter {
position: relative;
height: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
text-align: left;
height: 100%; // border-top: 2rpx solid $orange-color;
padding-left: 16rpx; .voucher-table-td {
line-height: 26rpx; border-bottom: none;
/* #ifdef APP-PLUS */
line-height: 28rpx;
/* #endif */
&-left {
width: 70%;
} }
&-right {
width: 30%; &-col {
display: flex;
align-items: center;
text-align: left;
height: 100%;
padding-left: 16rpx;
line-height: 26rpx;
/* #ifdef APP-PLUS */
line-height: 28rpx;
/* #endif */
&-left {
width: 70%;
}
&-right {
width: 30%;
}
}
&-col-label {
color: $orange-color;
} }
} }
&-col-label {
&-declare {
position: absolute;
right: -18rpx;
top: -48rpx;
width: 9rpx;
font-size: 16rpx;
line-height: 22rpx;
text-align: center;
color: $orange-color; color: $orange-color;
transform: scale(0.7);
&-text {}
} }
} }
&-declare {
position: absolute; &-preview {
right: -18rpx; margin-top: 28rpx;
top: -48rpx; font-size: 24rpx;
width: 9rpx; color: $default-color;
font-size: 16rpx; display: flex;
line-height: 22rpx; justify-content: center;
text-align: center; align-items: center;
color: $orange-color;
transform: scale(0.7); &-icon {
&-text { width: 32rpx;
height: 24rpx;
margin-right: 8rpx;
} }
} }
} }
&-preview { </style>
margin-top: 28rpx; \ No newline at end of file
font-size: 24rpx;
color: $default-color;
display: flex;
justify-content: center;
align-items: center;
&-icon {
width: 32rpx;
height: 24rpx;
margin-right: 8rpx;
}
}
}
</style>
<template>
<view class="debit-detail">
<view class="debit-detail-icon" v-if="detail.icon">
<image :src="detail.icon" mode=""></image>
</view>
<view class="content">
<view class="content-title">
<view class="content-title-text ellipsis">
<text>{{detail.name}}</text>
</view>
<view class="amount ellipsis" v-if="detail.amount">{{detail.amount}}</view>
</view>
<view class="content-item">
<text class="content-item-label">创建时间</text>
<text class="content-item-value">{{detail.createTime || ''}}</text>
</view>
<view class="content-item">
<text class="content-item-label">删除时间</text>
<text class="content-item-value">{{detail.deleteTime || ''}}</text>
</view>
</view>
<view class="debit-detail-right" hover-class="u-hover-class" @click="toRecyled">
恢复
</view>
</view>
</template>
<script>
export default {
props: {
detail: {
type: Object,
default: () => {}
},
current: {
type: Number,
default: 0
},
},
computed:{
showDebtAmount(){
let debtAmount=this.detail.debtAmount
if(!debtAmount){
return false
}
return parseFloat(debtAmount)>0
}
},
data() {
return {};
},
methods:{
toBill(){
this.$u.route({
url: '/pages/maintain-bill/index',
type: 'navigateTo',
params: {
customerId:this.detail.customerId,
onlyDebt:1,
}
});
},
toRecyled(){
this.$emit("handleClick",this.detail)
}
}
};
</script>
<style lang="scss" scoped>
.debit-detail {
// height: 152upx;
background: #FFFFFF;
border-radius: 16upx;
padding: 24upx;
padding-right: 0;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24upx;
.content {
flex: 1;
// width: 420upx;
position: relative;
overflow: hidden;
&-title{
font-size: 28upx;
// line-height: 40upx;
// min-height: 40upx;
margin-bottom: 12upx;
font-weight: bold;
&-text{
display: inline-block;
margin-right: 24rpx;
max-width: 422rpx;
}
.amount{
display: inline-block;
// max-width: 108rpx;
}
}
&-item {
font-size: 24upx;
line-height: 40upx;
min-height: 40upx;
&-label {
color: #8D8D8D;
}
&-value {
// font-weight: bold;
margin-left: 24rpx;
color: #8D8D8D;
}
}
}
&-icon{
width: 72rpx;
height: 72rpx;
margin-right: 24rpx;
}
&-right {
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
margin-left: 24rpx;
width: 100rpx;
height: 100%;
color: #3383FE;
}
}
</style>
<template>
<!-- 查欠账 -->
<view class="debit-note">
<!-- <view class="search-wrap">
<u-search v-model="form.keyword" height="80" bg-color="#ffffff" :show-action="false" placeholder="搜索客户姓名/手机"
@search="changeSearch"></u-search>
</view> -->
<view class="tabs-box">
<u-tabs-swiper ref="uTabs" bg-color="#f6f7fa" font-size="28" bar-width="32" bar-height="4" height="60"
inactive-color="#8D8D8D" active-color="#02A074" name="title" :list="tabs" :current="current"
@change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
</view>
<view class="swiper-box">
<swiper duration="200" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"
style="height:100%">
<swiper-item class="swiper-item" v-for="(listData, index) in list" :key="index">
<scroll-view scroll-y scroll-anchoring style="height: 100%;width: 100%;"
@scrolltolower="onreachBottom" @refresherrefresh="refresherrefresh"
@refresherrestore="onRestore" enable-back-to-top refresher-enabled
:refresher-triggered="getCurrentPage(index).triggered" :refresher-threshold="100">
<view class="scroll-view">
<NoData v-if="noData(index)" :text="noDataText" customStyle="margin-top: 0rpx;" />
<template v-else>
<view class="container"><debit-detail v-for="item in listData" :key="item.id"
:detail="item" :current="current" @handleClick="handleClick"></debit-detail>
</view>
<view class="loading-view"
v-if="!getCurrentPage(index).loaded && getCurrentPage(index).freshing"><u-loading
mode="flower"></u-loading></view>
<view
v-show="(getCurrentPage(index).pageNumber === 1 && getCurrentPage(index).loaded) || getCurrentPage(index).pageNumber > 1">
<u-loadmore :status="getCurrentPage(index).loadStatus" />
</view>
</template>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
<PopInput title="提醒" type="text" sureText="恢复" :content="popContent" :visible.sync="showConfirm"
@click="handleConfirm" />
</view>
</template>
<script>
import NoData from '@/components/no-data';
import PopInput from '@/components/pop-input-view';
import DebitDetail from './components/debit-detail.vue';
import {
billBaseUrl
} from '@/utils/config.js';
import {
debitNotePages
} from '@/utils/options/bill/index.js';
import {
tabsOptions
} from '@/utils/options/mine/recyled.js';
import {
getList,
deleteById
} from '@/api/mine/recyled.js';
export default {
components: {
NoData,
DebitDetail,
PopInput
},
data() {
return {
form: {
keyword: ''
},
// list: [[], [], []],
list: {
'0': [],
'1': [],
'2': []
},
current: 0, // tabs组件的current值,表示当前活动的tab选项
swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
tabs: tabsOptions,
pages: JSON.parse(JSON.stringify(debitNotePages)),
activeItemStyle: {
color: '#ff286d'
},
noDataText: '当前暂无账单信息',
currentItem: null,
showConfirm: false, // 删除弹框
};
},
computed: {
currentTab() {
return this.tabs[this.current];
},
currentPage() {
return this.pages[this.current];
},
popContent() {
return this.current === 2 ? "确定恢复此记录吗?" : "确定恢复此账单吗?"
}
},
onLoad(options) {
this.init();
uni.$on('debit-bill-list', res => {
this.init();
});
},
onUnload() {
uni.$off('debit-bill-list');
},
methods: {
handleClick(info) {
this.currentItem = info
this.showConfirm = true
},
handleConfirm() {
this.handleDelete();
},
async handleDelete() {
if (!this.currentItem.id) {
this.showToast(this.current === 2 ? "记录不存在" : "账单不存在");
return false;
}
try {
await deleteById({id:this.currentItem.id,type:this.currentItem.type.code});
this.showToast('删除成功', true);
this.onRefresh();
} catch (e) {
//TODO handle the exception
}
},
changeSearch() {
this.onRefresh();
},
noData(index) {
return this.list[index].length == 0 && this.getCurrentPage(index).loaded;
},
getCurrentPage(index) {
return this.pages[index];
},
init() {
this.onRefresh();
},
async getData() {
if (this.currentPage.pageNumber === 1) {
this.currentPage.loaded = false;
}
var postData = {
// keyword: this.form.keyword,
type: this.currentTab.name,
size: this.currentPage.size,
current: this.currentPage.pageNumber
};
try {
let res = await getList(postData);
let records = res.data;
if (this.currentPage.pageNumber === 1) {
// 下拉刷新或切换到新tab,清空对应数组
this.list[this.current] = [];
}
if (records && records.length) {
this.list[this.current].push(...records);
// 更新底部加载状态
}
// 更新底部加载状态
this.currentPage.loadStatus ='nomore';
} catch (e) {
console.log('error', e);
}
this.currentPage.loaded = true;
this.$nextTick(() => {
this.currentPage.triggered = false;
this.currentPage.freshing = false;
});
},
// tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
console.log('-------tabsChange------');
// this.getWalletRecord(); // 与swiper change重复,tab变化无需再次请求数据
},
// swiper-item左右移动,通知tabs的滑块跟随移动
transition(e) {
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
// swiper滑动结束,分别设置tabs和swiper的状态
animationfinish(e) {
let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
console.log('-------animationfinish------');
console.log(this.currentPage);
if (this.currentPage.pageNumber === 1) {
this.onRefresh();
}
},
onRefresh() {
if (this.currentPage.freshing) return;
this.currentPage.freshing = true;
this.currentPage.pageNumber = 1;
this.getData();
},
refresherrefresh() {
this.currentPage.triggered = true;
this.onRefresh()
},
onRestore() {
// this.currentPage.triggered = 'restore'; // 需要重置
},
onreachBottom(e) {
//上拉触底函数
if (this.currentPage.loadStatus === 'loadmore') {
//此处判断,上锁,防止重复请求
this.currentPage.loadStatus == 'loading';
this.currentPage.pageNumber += 1;
this.getData();
}
}
}
};
</script>
<style lang="scss" scoped>
.debit-note {
padding: 24upx;
height: 100vh;
display: flex;
flex-direction: column;
.search-wrap {
width: 100%;
}
.tabs-box {
margin: 32upx 0;
}
.swiper-box {
flex: 1;
width: 100%;
}
.swiper-item {
height: 100%;
}
.container {
padding: 20upx 0;
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
.scroll-view {
width: 100%;
height: 100%;
}
}
</style>
\ No newline at end of file
...@@ -93,7 +93,7 @@ export default { ...@@ -93,7 +93,7 @@ export default {
current: 1, current: 1,
size: 20, size: 20,
employees: [], employees: [],
// showMember: false, showMember: false,
platform: '', platform: '',
focus: false, focus: false,
currentPopInfo: {} currentPopInfo: {}
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<u-form-item label="项目名称" prop="projectId" required> <u-form-item label="项目名称" prop="projectId" required>
<view class="right-view"> <view class="right-view">
<view class="placeholder" @click="openSelect"> <view class="placeholder" @click="openSelect">
<text :class="{ 'value-text': !recordId }" v-if="form.projectName">{{ form.projectName }}</text> <text :class="{ 'value-text': !recordId }"
v-if="form.projectName">{{ form.projectName }}</text>
<text v-else>选择项目</text> <text v-else>选择项目</text>
<u-icon name="arrow-right" class="arrow" v-if="!recordId"></u-icon> <u-icon name="arrow-right" class="arrow" v-if="!recordId"></u-icon>
</view> </view>
...@@ -15,18 +16,25 @@ ...@@ -15,18 +16,25 @@
<u-form-item label="日期" v-if="!isDateRange" prop="happenTime" required> <u-form-item label="日期" v-if="!isDateRange" prop="happenTime" required>
<view class="right-view"> <view class="right-view">
<view class="date-view" hover-class="u-hover-class" @click="handleClickShowDateRange"> <view class="date-view" hover-class="u-hover-class" @click="handleClickShowDateRange">
<view class="date-text" v-if="form.happenTime">{{ resetHappenTime(form.happenTime) }}</view> <view class="date-text" v-if="form.happenTime">{{ resetHappenTime(form.happenTime) }}
</view>
<view class="placeholder" v-else>选择服务日期</view> <view class="placeholder" v-else>选择服务日期</view>
<view class="image-view"><image :src="dateImage"></image></view> <view class="image-view">
<image :src="dateImage"></image>
</view>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="日期(可多选)" v-else prop="dateRange" required> <u-form-item label="日期(可多选)" v-else prop="dateRange" required>
<view class="right-view"> <view class="right-view">
<view class="date-view" hover-class="u-hover-class" @click="handleClickShowDateRange"> <view class="date-view" hover-class="u-hover-class" @click="handleClickShowDateRange">
<view class="date-text" v-if="form.dateRange.length">{{ form.dateRange.length > 1 ? `已选${form.dateRange.length}天` : resetHappenTime(form.dateRange[0]) }}</view> <view class="date-text" v-if="form.dateRange.length">
{{ form.dateRange.length > 1 ? `已选${form.dateRange.length}天` : resetHappenTime(form.dateRange[0]) }}
</view>
<view class="placeholder" v-else>选择服务日期</view> <view class="placeholder" v-else>选择服务日期</view>
<view class="image-view"><image :src="dateImage"></image></view> <view class="image-view">
<image :src="dateImage"></image>
</view>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
...@@ -35,12 +43,14 @@ ...@@ -35,12 +43,14 @@
<text class="placeholder">{{ form.memberName }}</text> <text class="placeholder">{{ form.memberName }}</text>
</view> </view>
<view class="right-view" @click="checkAllUser" v-else> <view class="right-view" @click="checkAllUser" v-else>
<view class="checkbox-view" :class="{ checked: checkedAll }"><u-icon name="checkbox-mark" v-if="checkedAll"></u-icon></view> <view class="checkbox-view" :class="{ checked: checkedAll }"><u-icon name="checkbox-mark"
v-if="checkedAll"></u-icon></view>
<text>全选</text> <text>全选</text>
</view> </view>
</u-form-item> </u-form-item>
<view class="billing-category" v-if="!recordId"> <view class="billing-category" v-if="!recordId">
<billing-category ref="billing-category" :list="membersList" @handleClick="membersChange" @setting="toSetting"></billing-category> <billing-category ref="billing-category" :list="membersList" @handleClick="membersChange"
@setting="toSetting"></billing-category>
</view> </view>
</view> </view>
<view class="maintain-view"> <view class="maintain-view">
...@@ -50,32 +60,18 @@ ...@@ -50,32 +60,18 @@
<view class="work" v-if="tabCurrent === 1"> <view class="work" v-if="tabCurrent === 1">
<u-form-item label="本次借支" prop="loanAmount" required> <u-form-item label="本次借支" prop="loanAmount" required>
<view class="right-view"> <view class="right-view">
<u-input <u-input type="digit" v-model="form.loanAmount" placeholder="填写金额"
type="digit" :clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
v-model="form.loanAmount" :custom-style="customStyle" />
placeholder="填写金额"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
</view> </view>
</u-form-item> </u-form-item>
</view> </view>
<view class="overtime" v-else> <view class="overtime" v-else>
<u-form-item label="本次结算" prop="statementAmount" required> <u-form-item label="本次结算" prop="statementAmount" required>
<view class="right-view"> <view class="right-view">
<u-input <u-input type="digit" v-model="form.statementAmount" placeholder="填写金额"
type="digit" :clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
v-model="form.statementAmount" :custom-style="customStyle" />
placeholder="填写金额"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
</view> </view>
</u-form-item> </u-form-item>
</view> </view>
...@@ -83,20 +79,16 @@ ...@@ -83,20 +79,16 @@
<block v-else> <block v-else>
<view class="work" v-if="tabCurrent === 1"> <view class="work" v-if="tabCurrent === 1">
<u-form-item label="上班" prop="normalNumber" label-position="left" label-width="90" required> <u-form-item label="上班" prop="normalNumber" label-position="left" label-width="90"
required>
<view class="form-slot"> <view class="form-slot">
<view class="check-box"> <view class="check-box">
<checkbox-groups <checkbox-groups :checked="form.normalText"
:checked="form.normalText" :customStyle="checkboxCustomStyle" :options="workTypeOptions"
:customStyle="checkboxCustomStyle" @handleClick="workTypeChange"></checkbox-groups>
:options="workTypeOptions" <view class="custom-box placeholder"
@handleClick="workTypeChange"
></checkbox-groups>
<view
class="custom-box placeholder"
:class="{ 'custom-box-checked': form.normalText === 3 }" :class="{ 'custom-box-checked': form.normalText === 3 }"
@click="customNumberClick('normalCustomNumber')" @click="customNumberClick('normalCustomNumber')">
>
<text class="value-text" v-if="form.normalCustomNumber"> <text class="value-text" v-if="form.normalCustomNumber">
{{ form.normalCustomNumber }}{{ form.normalType === 'HOURS' ? '小时' : '个工' }} {{ form.normalCustomNumber }}{{ form.normalType === 'HOURS' ? '小时' : '个工' }}
</text> </text>
...@@ -109,17 +101,12 @@ ...@@ -109,17 +101,12 @@
<u-form-item label="加班" prop="overNumber" label-position="left" label-width="90"> <u-form-item label="加班" prop="overNumber" label-position="left" label-width="90">
<view class="form-slot"> <view class="form-slot">
<view class="check-box"> <view class="check-box">
<checkbox-groups <checkbox-groups :checked="form.overText" :customStyle="checkboxCustomStyle"
:checked="form.overText"
:customStyle="checkboxCustomStyle"
:options="overtimeTypeOptions" :options="overtimeTypeOptions"
@handleClick="overtimeTypeChange" @handleClick="overtimeTypeChange"></checkbox-groups>
></checkbox-groups> <view class="custom-box placeholder"
<view
class="custom-box placeholder"
:class="{ 'custom-box-checked': form.overText === 3 }" :class="{ 'custom-box-checked': form.overText === 3 }"
@click="customNumberClick('overCustomNumber')" @click="customNumberClick('overCustomNumber')">
>
<text class="value-text" v-if="form.overCustomNumber"> <text class="value-text" v-if="form.overCustomNumber">
{{ form.overCustomNumber }}{{ form.overType === 'HOURS' ? '小时' : '个工' }} {{ form.overCustomNumber }}{{ form.overType === 'HOURS' ? '小时' : '个工' }}
</text> </text>
...@@ -129,83 +116,52 @@ ...@@ -129,83 +116,52 @@
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="补扣" prop="rewardAmount" :border-bottom="false" :label-style="labelStyle" label-position="left" label-width="90"> <u-form-item label="补扣" prop="rewardAmount" :border-bottom="false"
:label-style="labelStyle" label-position="left" label-width="90">
<view class="form-slot"> <view class="form-slot">
<checkbox-groups <checkbox-groups :checked="form.deductText" :customStyle="checkboxCustomStyle"
:checked="form.deductText"
:customStyle="checkboxCustomStyle"
:options="deductTypeOptions" :options="deductTypeOptions"
@handleClick="deductTypeChange" @handleClick="deductTypeChange"></checkbox-groups>
></checkbox-groups>
</view> </view>
</u-form-item> </u-form-item>
<!-- 补扣 --> <!-- 补扣 -->
<view class="deduct"> <view class="deduct">
<view class="deduct-box" v-if="form.deductText !== 1"> <view class="deduct-box" v-if="form.deductText !== 1">
<text v-if="form.deductText !== 1" class="deduct-box-unit" :class="{ 'deduct-box-add': form.deductText === '+' }"> <text v-if="form.deductText !== 1" class="deduct-box-unit"
:class="{ 'deduct-box-add': form.deductText === '+' }">
{{ form.deductText }} {{ form.deductText }}
</text> </text>
<u-input <u-input type="digit" v-model="form.rewardAmount" placeholder="请输入金额"
type="digit" :clearable="false" :focus="rewardAmountFocus" input-align="right"
v-model="form.rewardAmount" height="56" maxlength="11" cursor-spacing="50" @blur="onBlurDeductNumber"
placeholder="请输入金额" :custom-style="deductCustomStyle" />
:clearable="false"
:focus="rewardAmountFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurDeductNumber"
:custom-style="deductCustomStyle"
/>
</view> </view>
</view> </view>
<!-- 当前工资 --> <!-- 当前工资 -->
<view class="wage" v-if="wageList.length"><wage-table :list="wageList"></wage-table></view> <view class="wage" v-if="wageList.length"><wage-table :list="wageList"></wage-table>
</view>
</view> </view>
<view class="overtime" v-else> <view class="overtime" v-else>
<u-form-item label="工程量" prop="number" required> <u-form-item label="工程量" prop="number" required>
<view class="value-view number-view"> <view class="value-view number-view">
<view class="form-input"> <view class="form-input">
<u-input <u-input type="digit" v-model="form.number" placeholder="施工量"
type="digit" :clearable="false" input-align="right" height="56" maxlength="11"
v-model="form.number" cursor-spacing="50" :custom-style="inputCustomStyle" />
placeholder="施工量"
:clearable="false"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
:custom-style="inputCustomStyle"
/>
</view> </view>
<view class="unit-view"> <view class="unit-view">
<u-input <u-input type="text" :clearable="false" :custom-style="unitCustomStyle"
type="text" :placeholder-style="placeholderStyle" height="56" input-align="right"
:clearable="false" v-model="form.unit" placeholder="单位" cursor-spacing="50" />
:custom-style="unitCustomStyle" <ab-button content="常用" :customStyle="customStyleUnit"
:placeholder-style="placeholderStyle" @click="chooseUnit"></ab-button>
height="56"
input-align="right"
v-model="form.unit"
placeholder="单位"
cursor-spacing="50"
/>
<ab-button content="常用" :customStyle="customStyleUnit" @click="chooseUnit"></ab-button>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="单价" prop="unitPrice" required> <u-form-item label="单价" prop="unitPrice" required>
<u-input <u-input type="digit" v-model="form.unitPrice" placeholder="请输入单价"
type="digit" :clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
v-model="form.unitPrice" :custom-style="customStyle" />
placeholder="请输入单价"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
</u-form-item> </u-form-item>
<u-form-item label="工钱" prop="totalPrice" required> <u-form-item label="工钱" prop="totalPrice" required>
<view class="right-view"> <view class="right-view">
...@@ -229,7 +185,8 @@ ...@@ -229,7 +185,8 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="images-view"> <view class="images-view">
<UploadImages max-count="4" :uploading.sync="uploading" :width="144" :height="144" :list="form.attach" @on-list-change="handleListChange" /> <UploadImages max-count="4" :uploading.sync="uploading" :width="144" :height="144"
:list="form.attach" @on-list-change="handleListChange" />
</view> </view>
</view> </view>
</view> </view>
...@@ -237,1242 +194,1371 @@ ...@@ -237,1242 +194,1371 @@
</u-form> </u-form>
</view> </view>
<view class="submit-button-box"> <view class="submit-button-box">
<bottom-buttons <bottom-buttons showCancel :loading="buttonLoading" :disabled="!canConfirm" :cancelText="cancelText"
showCancel :customCancel="customCancel" @cancel="handleClickAgain" @confirm="handleClickSure"></bottom-buttons>
:loading="buttonLoading"
:disabled="!canConfirm"
:cancelText="cancelText"
:customCancel="customCancel"
@cancel="handleClickAgain"
@confirm="handleClickSure"
></bottom-buttons>
</view> </view>
<view class="loading-view" v-if="loading"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="loading"><u-loading mode="flower"></u-loading></view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<!-- 日历 --> <!-- 日历 -->
<calendar-popup :type="dateType" :date="selectedDates" ref="calendar-popup" @confirm="calendarChange"></calendar-popup> <calendar-popup :type="dateType" :date="selectedDates" ref="calendar-popup"
@confirm="calendarChange"></calendar-popup>
<unit-popup ref="unit-popup" :options="unitOptions" :unit="form.unit" @change="handleChangeUnit"></unit-popup> <unit-popup ref="unit-popup" :options="unitOptions" :unit="form.unit" @change="handleChangeUnit"></unit-popup>
<u-select <u-select v-if="selectShow" v-model="selectShow" mode="single-column" cancel-color="#02A074"
v-if="selectShow" cancel-text="+ 新建项目" value-name="id" label-name="name" :default-value="defaultProject" :list="projectList"
v-model="selectShow" @cancel="toAddProject" @confirm="selectConfirm"></u-select>
mode="single-column" <PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showDeletePopup"
cancel-color="#02A074" @click="handleConfirmDelete" />
cancel-text="+ 新建项目" <PopInput :title="memberPopupTitle" type="text" sureText="确定" content="是否前往设置工价?"
value-name="id" :visible.sync="showMemberPopup" @click="handleConfirmMember" />
label-name="name" <pop-number-view ref="pop-number-view" :title="customPopupTitle" :valueKey="customNumberKey"
:default-value="defaultProject" :type="customNumberType" @confirm="handleConfirmCustom"></pop-number-view>
:list="projectList"
@cancel="toAddProject"
@confirm="selectConfirm"
></u-select>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showDeletePopup" @click="handleConfirmDelete" />
<PopInput :title="memberPopupTitle" type="text" sureText="确定" content="是否前往设置工价?" :visible.sync="showMemberPopup" @click="handleConfirmMember" />
<pop-number-view ref="pop-number-view" :title="customPopupTitle" :valueKey="customNumberKey" :type="customNumberType" @confirm="handleConfirmCustom"></pop-number-view>
</view> </view>
</template> </template>
<script> <script>
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue'; import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import AbButton from '@/components/common/ab-button.vue'; import AbButton from '@/components/common/ab-button.vue';
import BottomButtons from '@/components/common/bottom-buttons.vue'; import BottomButtons from '@/components/common/bottom-buttons.vue';
import UnitPopup from '@/components/unit-popup/unit-popup.vue'; import UnitPopup from '@/components/unit-popup/unit-popup.vue';
import UploadImages from '@/components/upload'; import UploadImages from '@/components/upload';
import PopInput from '@/components/pop-input-view'; import PopInput from '@/components/pop-input-view';
import PopNumberView from './components/pop-number-view'; import PopNumberView from './components/pop-number-view';
import PopRewardView from './components/pop-reward-view'; import PopRewardView from './components/pop-reward-view';
import SubmitButton from '@/components/submit-button/index.vue'; import SubmitButton from '@/components/submit-button/index.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue'; import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillTabs from '../components/bill-tabs.vue'; import BillTabs from '../components/bill-tabs.vue';
import BillingCategory from '../components/billing-category.vue'; import BillingCategory from '../components/billing-category.vue';
import WageTable from './components/wage-table.vue'; import WageTable from './components/wage-table.vue';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js'; import {
import { getMembers, getProject, getProjectList, update, recordCalculateDetail } from '@/api/workpoint/index.js'; checkOpenPermission,
import { getBillInfo, deleteBill } from '@/api/workpoint/project-bill.js'; checkOpenService
import { updateProject } from '@/api/project/index.js'; } from '@/utils/app-plus-auth.js';
import { formatCount } from '@/utils/common.js'; import {
import { baseUrl, billBaseUrl } from '@/utils/config.js'; getMembers,
import { getProject,
tabOptions, getProjectList,
loanTabOptions, update,
workTypeOptions, recordCalculateDetail
overtimeTypeOptions, } from '@/api/workpoint/index.js';
deductTypeOptions, import {
wageTableOptions, getBillInfo,
createFormRules, deleteBill
loanFormRules, } from '@/api/workpoint/project-bill.js';
defaultValidate, import {
timeValidate, updateProject
contractorValidate, } from '@/api/project/index.js';
unitOptions import {
} from '@/utils/options/workpoint/index.js'; formatCount
import { mapGetters } from 'vuex'; } from '@/utils/common.js';
import {
baseUrl,
billBaseUrl
} from '@/utils/config.js';
import {
tabOptions,
loanTabOptions,
workTypeOptions,
overtimeTypeOptions,
deductTypeOptions,
wageTableOptions,
createFormRules,
loanFormRules,
defaultValidate,
timeValidate,
contractorValidate,
unitOptions
} from '@/utils/options/workpoint/index.js';
import {
mapGetters
} from 'vuex';
export default { export default {
components: { components: {
CheckboxGroups, CheckboxGroups,
AbButton, AbButton,
BottomButtons, BottomButtons,
UnitPopup, UnitPopup,
UploadImages, UploadImages,
PopInput, PopInput,
PopNumberView, PopNumberView,
PopRewardView, PopRewardView,
SubmitButton, SubmitButton,
CalendarPopup, CalendarPopup,
BillingCategory, BillingCategory,
BillTabs, BillTabs,
WageTable WageTable
}, },
data() { data() {
return { return {
formatCount, formatCount,
workTypeOptions, workTypeOptions,
overtimeTypeOptions, overtimeTypeOptions,
deductTypeOptions, deductTypeOptions,
wageTableOptions, wageTableOptions,
defaultValidate, defaultValidate,
timeValidate, timeValidate,
contractorValidate, contractorValidate,
unitOptions, unitOptions,
dateImage: baseUrl + 'riqi@3x.png', dateImage: baseUrl + 'riqi@3x.png',
showDeletePopup: false, showDeletePopup: false,
showMemberPopup: false, showMemberPopup: false,
selectShow: false, selectShow: false,
loading: false, loading: false,
uploading: false, uploading: false,
projectList: [], projectList: [],
defaultProject: [], defaultProject: [],
wageList: [], wageList: [],
normal: '', normal: '',
over: '', over: '',
errorType: ['message'], errorType: ['message'],
form: { form: {
projectId: '',
projectName: '',
dateRange: [this.resetHappenTime(new Date())],
happenTime: this.resetHappenTime(new Date()),
memberId: [],
remark: '',
type: 'TIME', // 类型 TIME:记工-点工;CONTRACTOR:记工-包工;BORROWING:借支;SETTLE:结算
// 点工
// 上班
normalNumber: 1,
normalCustomNumber: '', // 自定义
normalText: 1,
normalType: 'UNIT',
// 加班
overNumber: '',
overCustomNumber: '', // 自定义
overText: 1,
overType: 'UNIT',
// 补扣
deductText: 1,
rewardAmount: '', // 最终补扣金额
// 包工
number: '',
unit: '',
unitPrice: '',
// 借支/结算
amount: '',
loanAmount: '',
statementAmount: ''
},
customNumberKey: '',
customNumberType: 'UNIT',
customNumberValue: '',
customInputShow: false,
customNumberFocus: false,
customPopupTitle: '填写记工工量',
rewardAmountFocus: false,
showDatePicker: false,
buttonLoading: false,
projectId: '', projectId: '',
projectName: '', recordId: '',
dateRange: [this.resetHappenTime(new Date())], placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;',
happenTime: this.resetHappenTime(new Date()), customStyle: {
memberId: [], fontSize: '28rpx',
remark: '', textAlign: 'right',
type: 'TIME', // 类型 TIME:记工-点工;CONTRACTOR:记工-包工;BORROWING:借支;SETTLE:结算 fontWeight: 'bold'
// 点工 },
// 上班 inputCustomStyle: {
normalNumber: 1, 'font-size': '28rpx',
normalCustomNumber: '', // 自定义 textAlign: 'right',
normalText: 1, width: '126rpx',
normalType: 'UNIT', padding: '0 24rpx',
// 加班 'background-color': '#f6f7fa',
overNumber: '', 'border-radius': '8rpx'
overCustomNumber: '', // 自定义 },
overText: 1, popupInputCustomStyle: {
overType: 'UNIT', textAlign: 'left',
// 补扣 'font-size': '28rpx',
deductText: 1, padding: '0 24rpx',
rewardAmount: '', // 最终补扣金额 'background-color': '#f6f7fa',
// 包工 'border-radius': '8rpx'
number: '', },
unit: '', deductCustomStyle: {
unitPrice: '', fontSize: '28rpx',
// 借支/结算 'text-align': 'left',
amount: '', fontWeight: 'bold',
loanAmount: '', 'line-height': '80rpx',
statementAmount: '' height: '80rpx'
}, },
customNumberKey: '', labelStyle: {
customNumberType: 'UNIT', // 'line-height': '80rpx',
customNumberValue: '', // 'align-items':'flex-start',
customInputShow: false, // height: '100%',
customNumberFocus: false, // display: 'flex',
customPopupTitle: '填写记工工量', },
rewardAmountFocus: false, unitCustomStyle: {
showDatePicker: false, 'font-size': '28rpx',
buttonLoading: false, textAlign: 'right',
projectId: '', width: '76rpx',
recordId: '', padding: '0 24rpx',
placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;', 'background-color': '#f6f7fa',
customStyle: { 'border-radius': '8rpx'
fontSize: '28rpx', },
textAlign: 'right', customAreaStyle: {
fontWeight: 'bold' fontSize: '28rpx',
}, fontWeight: 'bold',
inputCustomStyle: { 'background-color': '#F6F7FA',
'font-size': '28rpx', 'text-align': 'left',
textAlign: 'right', padding: '32rpx 24rpx',
width: '126rpx', 'border-radius': '16rpx',
padding: '0 24rpx', 'min-height': '240rpx'
'background-color': '#f6f7fa', },
'border-radius': '8rpx' checkboxCustomStyle: {
}, width: '136rpx',
popupInputCustomStyle: { height: '80rpx'
textAlign: 'left', },
'font-size': '28rpx', customConFirm: {
padding: '0 24rpx', height: '96rpx'
'background-color': '#f6f7fa', },
'border-radius': '8rpx' customStyleUnit: {
}, 'margin-left': '24rpx',
deductCustomStyle: { width: '72rpx',
fontSize: '28rpx', height: '40rpx',
'text-align': 'left', 'font-size': '24rpx',
fontWeight: 'bold', background: '#02A074',
'line-height': '80rpx', 'border-radius': '8rpx'
height: '80rpx' },
}, customStyleSubmit: {
labelStyle: { width: '240rpx',
// 'line-height': '80rpx', height: '96rpx',
// 'align-items':'flex-start', 'font-size': '32rpx'
// height: '100%', },
// display: 'flex',
},
unitCustomStyle: {
'font-size': '28rpx',
textAlign: 'right',
width: '76rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
customAreaStyle: {
fontSize: '28rpx',
fontWeight: 'bold',
'background-color': '#F6F7FA',
'text-align': 'left',
padding: '32rpx 24rpx',
'border-radius': '16rpx',
'min-height': '240rpx'
},
checkboxCustomStyle: {
width: '136rpx',
height: '80rpx'
},
customConFirm: {
height: '96rpx'
},
customStyleUnit: {
'margin-left': '24rpx',
width: '72rpx',
height: '40rpx',
'font-size': '24rpx',
background: '#02A074',
'border-radius': '8rpx'
},
customStyleSubmit: {
width: '240rpx',
height: '96rpx',
'font-size': '32rpx'
},
limit: 6, limit: 6,
membersList: [], membersList: [],
membersLength: 0, membersLength: 0,
defaultList: [ defaultList: [{
{
id: 'setting', id: 'setting',
name: '管理' name: '管理'
} }],
], tabCurrent: 1,
tabCurrent: 1, path: 'workpoint',
path: 'workpoint', notification: 'workpoint-create-remark',
notification: 'workpoint-create-remark', memberId: '',
memberId: '', memberPopupTitle: '未设置工价',
memberPopupTitle: '未设置工价', dateType: 'date'
dateType: 'date' };
};
},
computed: {
...mapGetters(['platform', 'prevProjectId']),
tabOptions() {
return this.path === 'loan' ? loanTabOptions : tabOptions;
},
rules() {
return this.path === 'loan' ? loanFormRules : createFormRules;
}, },
canConfirm() { computed: {
let flag = true; ...mapGetters(['platform', 'prevProjectId']),
this.defaultValidate.map(key => { tabOptions() {
if (!this.form[key]) { return this.path === 'loan' ? loanTabOptions : tabOptions;
flag = false; },
} rules() {
}); return this.path === 'loan' ? loanFormRules : createFormRules;
if (this.path === 'loan') { },
let key = this.form.type === 'BORROWING' ? 'loanAmount' : 'statementAmount'; canConfirm() {
if (!this.form[key]) { let flag = true;
flag = false; this.defaultValidate.map(key => {
} if (key === "happenTime") {
} else { if (this.isDateRange) {
if (this.form.type === 'TIME') { flag = this.form.dateRange.length !== 0
if (this.form.normalNumber <= 0 && this.form.overNumber <= 0&&this.form.rewardAmount<=0) { } else {
if (!this.form[key]) {
flag = false;
}
}
} else {
if (!this.form[key]) {
flag = false;
}
}
});
if (this.path === 'loan') {
let key = this.form.type === 'BORROWING' ? 'loanAmount' : 'statementAmount';
if (!this.form[key]) {
flag = false; flag = false;
} }
} else { } else {
this.contractorValidate.map(key => { if (this.form.type === 'TIME') {
if (!this.form[key]) { if (this.form.normalNumber <= 0 && this.form.overNumber <= 0 && this.form.rewardAmount <= 0) {
flag = false; flag = false;
} }
}); } else {
this.contractorValidate.map(key => {
if (!this.form[key]) {
flag = false;
}
});
}
} }
console.log(flag)
return flag;
},
totalPrice() {
var result = Number(this.form.number || 0) * Number(this.form.unitPrice || 0);
// return result ? this.formatCount(result) : '';
return result ? result : '';
},
checkedAll() {
return this.form.memberId.length === this.membersLength;
},
cancelText() {
return this.recordId ? '删除' : '保存并再记一笔';
},
customCancel() {
let againStyle = {
color: '#02A074',
background: '#ffffff',
height: '104rpx',
width: '332rpx'
};
let cancelStyle = {
color: '#FC524D',
background: '#ffffff',
height: '104rpx',
width: '200rpx'
};
return this.recordId ? cancelStyle : againStyle;
},
isDateRange() {
return this.dateType == 'daterange'
},
selectedDates() {
return this.isDateRange ? this.form.dateRange.join(',') : this.form.happenTime
} }
return flag;
},
totalPrice() {
var result = Number(this.form.number || 0) * Number(this.form.unitPrice || 0);
// return result ? this.formatCount(result) : '';
return result ? result : '';
},
checkedAll() {
return this.form.memberId.length === this.membersLength;
}, },
cancelText() { onLoad(options) {
return this.recordId ? '删除' : '保存并再记一笔'; console.log(options);
}, if (options && options.projectId) {
customCancel() { this.projectId = options.projectId;
let againStyle = { this.form.projectId = options.projectId;
color: '#02A074',
background: '#ffffff',
height: '104rpx',
width: '332rpx'
};
let cancelStyle = {
color: '#FC524D',
background: '#ffffff',
height: '104rpx',
width: '200rpx'
};
return this.recordId ? cancelStyle : againStyle;
},
isDateRange() {
return this.dateType == 'daterange'
},
selectedDates() {
return this.isDateRange ? this.form.dateRange.join(',') : this.form.happenTime
}
},
onLoad(options) {
console.log(options);
if (options && options.projectId) {
this.projectId = options.projectId;
this.form.projectId = options.projectId;
}
if (options && options.type) {
this.form.type = options.type;
}
if (options && options.path) {
this.path = options.path;
if (this.path === 'loan') {
this.form.type = 'BORROWING';
uni.setNavigationBarTitle({
title: '借支/结算'
});
} }
} if (options && options.type) {
console.log(options.path); this.form.type = options.type;
if (this.projectId) {
this.getProjectInfo();
}
if (options && options.recordId) {
this.recordId = options.recordId;
this.dateType = 'date'
this.getBillInfo();
} else {
this.dateType = this.form.type == 'TIME' ? 'daterange' : 'date'
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
onUnload() {
uni.$off(this.notification);
},
onShow() {
if (!this.recordId) {
console.log('------onShow-------');
this.initData();
}
},
methods: {
async initData(text) {
await this.getProjectList(text);
if (this.projectId) {
await this.getMembersOptions();
} }
}, if (options && options.path) {
async getBillInfo() { this.path = options.path;
try { if (this.path === 'loan') {
let { data } = await getBillInfo({ projectId: this.projectId, recordId: this.recordId }); this.form.type = 'BORROWING';
let { dateRange,happenTime, memberId, memberName, type, remark ,attach} = data; uni.setNavigationBarTitle({
let { normalNumber, normalText, normalType, overNumber, overText, overType, number, unit, unitPrice, amount, rewardAmount } = data.data; title: '借支/结算'
});
let form = {
...this.form,
dateRange,
happenTime,
memberName,
type: type.code,
remark,
// 点工
normalNumber: normalNumber ,
normalText: normalText || 1,
normalType: (normalType && normalType.code) || 'UNIT',
overNumber,
overText: overText || 1,
overType: (overType && overType.code) || 'UNIT',
// 包工
number,
unit,
unitPrice,
// 借支/结算
amount,
attach
};
if (type.code === 'BORROWING') {
form.loanAmount = amount;
} else if (type.code === 'SETTLE') {
form.statementAmount = amount;
}
if (type.code === 'CONTRACTOR' || type.code === 'SETTLE') {
this.tabCurrent = 2;
}
form.memberId = [
{
id: this.recordId,
memberId: memberId
}
];
if (normalText === 3) {
form.normalCustomNumber = normalNumber;
}
if (overText === 3) {
form.overCustomNumber = overNumber;
}
if (rewardAmount > 0) {
form.deductText = '+';
form.rewardAmount = rewardAmount;
} else if (rewardAmount < 0) {
form.deductText = '-';
form.rewardAmount = rewardAmount.replace('-', '');
} else {
form.deductText = 1;
} }
this.form = form;
console.log("form",form);
this.setWageList();
} catch (e) {
//TODO handle the exception
console.log(e);
} }
}, console.log(options.path);
async getProjectInfo() { if (this.projectId) {
try { this.getProjectInfo();
let { data } = await getProject({ id: this.projectId }); }
this.form.projectName = data.name; if (options && options.recordId) {
} catch (e) { this.recordId = options.recordId;
//TODO handle the exception this.dateType = 'date'
console.log(e); this.getBillInfo();
} else {
this.dateType = this.path === 'loan' ? 'date' : 'daterange'
} }
}, },
async getProjectList(text) { onReady() {
try { this.$refs.uForm.setRules(this.rules);
let { data } = await getProjectList(); },
this.projectList = [...data]; onUnload() {
if (!this.projectId) { uni.$off(this.notification);
if (this.prevProjectId) { },
this.projectId = this.prevProjectId; onShow() {
this.form.projectId = this.prevProjectId; if (!this.recordId) {
data.map(item => { console.log('------onShow-------');
if (item.id == this.prevProjectId) { this.initData();
this.form.projectName = item.name;
}
});
} else {
if (data[0]) {
this.projectId = data[0].id + '';
}
}
}
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.form.projectId = item.id + '';
this.form.projectName = item.name;
}
});
} catch (e) {
//TODO handle the exception
console.log(e);
} }
}, },
setWageList() { methods: {
let form = { async initData(text) {
...this.form await this.getProjectList(text);
}; if (this.projectId) {
if (this.path !== 'loan') { await this.getMembersOptions();
if (this.form.type === 'TIME') { }
let { normalNumber, normalCustomNumber, normalText, normalType, overNumber, overText, overType, deductText, rewardAmount } = this.form; },
form.data = { async getBillInfo() {
try {
let {
data
} = await getBillInfo({
projectId: this.projectId,
recordId: this.recordId
});
let {
dateRange,
happenTime,
memberId,
memberName,
type,
remark,
attach
} = data;
let {
normalNumber, normalNumber,
normalText, normalText,
normalType, normalType,
overNumber, overNumber,
overText, overText,
overType overType,
number,
unit,
unitPrice,
amount,
rewardAmount
} = data.data;
let form = {
...this.form,
dateRange,
happenTime,
memberName,
type: type.code,
remark,
// 点工
normalNumber: normalText? normalNumber:1,
normalText: normalText || 1,
normalType: (normalType && normalType.code) || 'UNIT',
overNumber,
overText: overText || 1,
overType: (overType && overType.code) || 'UNIT',
// 包工
number,
unit,
unitPrice,
// 借支/结算
amount,
attach
}; };
if (Number(normalNumber) <= 0) { if (type.code === 'BORROWING') {
// return false; form.loanAmount = amount;
form.data.normalNumber = 0; } else if (type.code === 'SETTLE') {
form.statementAmount = amount;
} }
// if(normalText===3&&Number(normalCustomNumber) <= 0){ if (type.code === 'CONTRACTOR' || type.code === 'SETTLE') {
// form.data.normalNumber = 0; this.tabCurrent = 2;
// }
if (overText == 1 || Number(overNumber) <= 0) {
delete form.data.overType;
delete form.data.overNumber;
delete form.data.overText;
// form.data.overNumber=''
} }
if (deductText === 1) { form.memberId = [{
form.data.rewardAmount = 0; id: this.recordId,
memberId: memberId
}];
if (normalText === 3) {
form.normalCustomNumber = normalNumber;
}
if (overText === 3) {
form.overCustomNumber = overNumber;
}
if (rewardAmount > 0) {
form.deductText = '+';
form.rewardAmount = rewardAmount;
} else if (rewardAmount < 0) {
form.deductText = '-';
form.rewardAmount = rewardAmount.replace('-', '');
} else { } else {
console.log(deductText); form.deductText = 1;
form.data.rewardAmount = rewardAmount && deductText === '-' ? deductText + rewardAmount : rewardAmount;
} }
this.getCalculateDetail(form); this.form = form;
console.log("form", form);
this.setWageList();
} catch (e) {
//TODO handle the exception
console.log(e);
} }
} },
}, async getProjectInfo() {
async getCalculateDetail(params) { try {
try { let {
let { code, data } = await recordCalculateDetail(params); data
if (code === 0) { } = await getProject({
this.wageList = data; id: this.projectId
console.log('wageList', this.wageList); });
this.form.projectName = data.name;
} catch (e) {
//TODO handle the exception
console.log(e);
} }
} catch (e) { },
//TODO handle the exception async getProjectList(text) {
} try {
}, let {
openSelect() { data
if (this.recordId) { } = await getProjectList();
return false; this.projectList = [...data];
} if (!this.projectId) {
this.projectList.map((item, index) => { if (this.prevProjectId) {
if (item.id == this.projectId) { this.projectId = this.prevProjectId;
this.defaultProject = [index]; this.form.projectId = this.prevProjectId;
data.map(item => {
if (item.id == this.prevProjectId) {
this.form.projectName = item.name;
}
});
} else {
if (data[0]) {
this.projectId = data[0].id + '';
}
}
}
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.form.projectId = item.id + '';
this.form.projectName = item.name;
}
});
} catch (e) {
//TODO handle the exception
console.log(e);
} }
}); },
this.selectShow = true; setWageList() {
}, let form = {
selectConfirm(e) { ...this.form
console.log(e); };
if (e && e[0]) { if (this.path !== 'loan') {
if (this.form.projectId != e[0].value) { if (this.form.type === 'TIME') {
this.form.memberId = []; let {
normalNumber,
normalCustomNumber,
normalText,
normalType,
overNumber,
overText,
overType,
deductText,
rewardAmount
} = this.form;
form.data = {
normalNumber,
normalText,
normalType,
overNumber,
overText,
overType
};
if (Number(normalNumber) <= 0) {
// return false;
form.data.normalNumber = 0;
}
// if(normalText===3&&Number(normalCustomNumber) <= 0){
// form.data.normalNumber = 0;
// }
if (overText == 1 || Number(overNumber) <= 0) {
delete form.data.overType;
delete form.data.overNumber;
delete form.data.overText;
// form.data.overNumber=''
}
if (deductText === 1) {
form.data.rewardAmount = 0;
} else {
console.log(deductText);
form.data.rewardAmount = rewardAmount && deductText === '-' ? deductText + rewardAmount :
rewardAmount;
}
this.getCalculateDetail(form);
}
}
},
async getCalculateDetail(params) {
try {
let {
code,
data
} = await recordCalculateDetail(params);
if (code === 0) {
this.wageList = data;
console.log('wageList', this.wageList);
}
} catch (e) {
//TODO handle the exception
}
},
openSelect() {
if (this.recordId) {
return false;
} }
this.form.projectId = e[0].value + '';
this.form.projectName = e[0].label;
this.projectId = e[0].value;
this.projectList.map((item, index) => { this.projectList.map((item, index) => {
if (item.id == this.projectId) { if (item.id == this.projectId) {
this.defaultProject = [index]; this.defaultProject = [index];
} }
}); });
this.getMembersOptions(); this.selectShow = true;
} },
this.$refs.uForm.validate(); selectConfirm(e) {
console.log('confirm====defaultProject', this.defaultProject); console.log(e);
}, if (e && e[0]) {
toAddProject() { if (this.form.projectId != e[0].value) {
this.$u.route({ this.form.memberId = [];
url: '/pages/mine/input/input', }
type: 'navigateTo', this.form.projectId = e[0].value + '';
params: { this.form.projectName = e[0].label;
type: 'project-create' this.projectId = e[0].value;
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
}
});
this.getMembersOptions();
} }
}); this.$refs.uForm.validate();
uni.$once('input-sure-project-create', res => { console.log('confirm====defaultProject', this.defaultProject);
this.updateProject({ },
name: res.content toAddProject() {
}); this.$u.route({
}); url: '/pages/mine/input/input',
}, type: 'navigateTo',
updateProject(params) { params: {
updateProject(params) type: 'project-create'
.then(res => {
let { data, code } = res;
if (code === 0 && data) {
this.$refs.uToast.show({
title: '项目创建成功',
type: 'success',
duration: 1500,
callback: () => {}
});
this.projectId = data;
this.initData();
} }
})
.catch(err => {
console.log(err);
}); });
}, uni.$once('input-sure-project-create', res => {
this.updateProject({
name: res.content
});
});
},
updateProject(params) {
updateProject(params)
.then(res => {
let {
data,
code
} = res;
if (code === 0 && data) {
this.$refs.uToast.show({
title: '项目创建成功',
type: 'success',
duration: 1500,
callback: () => {}
});
this.projectId = data;
this.initData();
}
})
.catch(err => {
console.log(err);
});
},
handleChangeUnit(e) { handleChangeUnit(e) {
this.form.unit = e; this.form.unit = e;
}, },
chooseUnit() { chooseUnit() {
this.$refs['unit-popup'].open(); this.$refs['unit-popup'].open();
}, },
workTypeChange(item) { workTypeChange(item) {
this.form.normalText = item.value; this.form.normalText = item.value;
if (item.number) { if (item.number) {
this.form.normalNumber = item.number; this.form.normalNumber = item.number;
this.form.normalType = 'UNIT'; this.form.normalType = 'UNIT';
} }
if (item.value !== 3) { if (item.value !== 3) {
this.form.normalCustomNumber = ''; this.form.normalCustomNumber = '';
this.setWageList(); this.setWageList();
} }
}, },
overtimeTypeChange(item) { overtimeTypeChange(item) {
this.form.overText = item.value; this.form.overText = item.value;
if (item.value === 1) { if (item.value === 1) {
this.form.overNumber = 0; this.form.overNumber = 0;
this.form.overCustomNumber = ''; this.form.overCustomNumber = '';
this.setWageList();
}
},
onBlurCustomNumber() {
this.customNumberFocus = false;
},
deductTypeChange(item) {
this.form.deductText = item.value;
if (item.value === 1) {
this.form.rewardAmount = '';
}
if (item.value !== 1) {
this.rewardAmountFocus = true;
}
this.setWageList(); this.setWageList();
} },
}, onBlurDeductNumber() {
onBlurCustomNumber() { this.rewardAmountFocus = false;
this.customNumberFocus = false; this.setWageList();
}, },
deductTypeChange(item) { tabChange(item) {
this.form.deductText = item.value; this.tabCurrent = item.value;
if (item.value === 1) { this.form.type = item.type;
this.form.rewardAmount = ''; this.errorType = ['none'];
} this.$nextTick(() => {
if (item.value !== 1) { this.$refs.uForm.validate(() => {
this.rewardAmountFocus = true; setTimeout(() => {
} this.errorType = ['message'];
this.setWageList(); });
},
onBlurDeductNumber() {
this.rewardAmountFocus = false;
this.setWageList();
},
tabChange(item) {
this.tabCurrent = item.value;
this.form.type = item.type;
this.errorType = ['none'];
this.$nextTick(() => {
this.$refs.uForm.validate(() => {
setTimeout(() => {
this.errorType = ['message'];
}); });
}); });
}); if (item.value === 2) {
if (item.value === 2) { this.wageList = [];
this.wageList = []; } else {
} else { // if(this.path !== 'loan'){
// if(this.recordId&&!this.form.normalNumber){
// this.form.normalNumber
// }
// }
this.setWageList();
}
},
checkAllUser() {
let flag = this.checkedAll ? false : true;
this.$refs['billing-category'].checkAll(flag);
},
membersChange(ids) {
this.form.memberId = ids;
this.setWageList(); this.setWageList();
} },
}, toSetting() {
checkAllUser() { uni.navigateTo({
let flag = this.checkedAll ? false : true; url: `/pages/workpoint/employees/index?projectId=${this.projectId}`
this.$refs['billing-category'].checkAll(flag);
},
membersChange(ids) {
this.form.memberId = ids;
this.setWageList();
},
toSetting() {
uni.navigateTo({
url: `/pages/workpoint/employees/index?projectId=${this.projectId}`
});
uni.$on(this.notification, res => {
this.getMembersOptions();
});
},
async getMembersOptions() {
try {
let { data } = await getMembers({ projectId: this.projectId });
let list = [];
data.map((item, index) => {
item.checked = false;
if (index === 0) {
item.checked = true;
}
}); });
this.membersLength = data.length; uni.$on(this.notification, res => {
let resData = [...this.defaultList, ...data]; this.getMembersOptions();
list = this.chunk(resData, this.limit); });
this.membersList = list; },
this.setCheckedList(); async getMembersOptions() {
} catch (e) { try {
//TODO handle the exception let {
console.log(e); data
} } = await getMembers({
}, projectId: this.projectId
setCheckedList() { });
if (this.form.memberId && this.form.memberId.length) { let list = [];
this.membersList.map(item => { data.map((item, index) => {
item.map(li => { item.checked = false;
this.form.memberId.map(el => { if (index === 0) {
if (li.id === el.memberId) { item.checked = true;
li.checked = true; }
} });
this.membersLength = data.length;
let resData = [...this.defaultList, ...data];
list = this.chunk(resData, this.limit);
this.membersList = list;
this.setCheckedList();
} catch (e) {
//TODO handle the exception
console.log(e);
}
},
setCheckedList() {
if (this.form.memberId && this.form.memberId.length) {
this.membersList.map(item => {
item.map(li => {
this.form.memberId.map(el => {
if (li.id === el.memberId) {
li.checked = true;
}
});
}); });
}); });
}); } else {
} else { this.form.memberId.push({
this.form.memberId.push({ memberId: this.membersList[0][1].id
memberId: this.membersList[0][1].id });
}); // this.membersList[0][1].checked = true;
// this.membersList[0][1].checked = true;
}
this.setWageList();
},
chunk(arr, num) {
let newArray = [];
for (let i = 0; i < arr.length; i += num) {
newArray.push(arr.slice(i, i + num));
}
return newArray;
},
editRemark() {
uni.$on(`input-sure-${this.notification}`, res => {
console.log(res);
this.form.remark = res.content;
});
this.$u.route({
url: '/pages/mine/input/input',
params: {
type: this.notification,
value: encodeURIComponent(this.form.remark)
} }
}); this.setWageList();
}, },
handleListChange(lists) { chunk(arr, num) {
this.form.attach = lists; let newArray = [];
}, for (let i = 0; i < arr.length; i += num) {
newArray.push(arr.slice(i, i + num));
handleClickSure(callback) { }
if (this.uploading) { return newArray;
this.$refs.uToast.show({ },
title: '图片上传中,请等待片刻', editRemark() {
type: 'warning', uni.$on(`input-sure-${this.notification}`, res => {
duration: 1500, console.log(res);
callback: () => { this.form.remark = res.content;
this.focus = true; });
this.$u.route({
url: '/pages/mine/input/input',
params: {
type: this.notification,
value: encodeURIComponent(this.form.remark)
} }
}); });
return; },
} handleListChange(lists) {
if (this.isDateRange) { this.form.attach = lists;
this.form.happenTime = '' },
handleClickSure(callback) {
if (this.uploading) {
this.$refs.uToast.show({
title: '图片上传中,请等待片刻',
type: 'warning',
duration: 1500,
callback: () => {
this.focus = true;
}
});
return;
}
let dataForm = JSON.parse(JSON.stringify(this.form))
if (this.isDateRange) {
dataForm.happenTime = ''
} else { } else {
this.form.dateRange = [] dataForm.dateRange = []
} }
this.$refs.uForm.validate(valid => { this.$refs.uForm.validate(valid => {
if (valid) { if (valid) {
console.log('验证通过'); console.log('验证通过');
let form = { let form = {
...this.form ...dataForm
}; };
if (this.path === 'loan') { if (this.path === 'loan') {
let { loanAmount, statementAmount } = this.form; let {
if (this.form.type === 'BORROWING') { loanAmount,
if (!Number(loanAmount)) { statementAmount
this.showToast('请输入借支金额'); } = dataForm;
return false; if (dataForm.type === 'BORROWING') {
if (!Number(loanAmount)) {
this.showToast('请输入借支金额');
return false;
}
form.data = {
amount: loanAmount
};
} else if (dataForm.type === 'SETTLE') {
if (!Number(statementAmount)) {
this.showToast('请输入结算金额');
return false;
}
form.data = {
amount: statementAmount
};
} }
form.data = { } else {
amount: loanAmount if (dataForm.type === 'TIME') {
}; let {
} else if (this.form.type === 'SETTLE') { normalNumber,
if (!Number(statementAmount)) { normalCustomNumber,
this.showToast('请输入结算金额'); normalText,
return false; normalType,
overNumber,
overCustomNumber,
overText,
overType,
deductText,
rewardAmount
} = dataForm;
form.data = {
normalNumber,
normalText,
normalType,
overNumber,
overText,
overType
};
if (form.data.overText == 1 || Number(form.data.overNumber) <= 0) {
delete form.data.overType;
delete form.data.overNumber;
delete form.data.overText;
// form.data.overNumber=''
}
if (deductText === 1) {
form.data.rewardAmount = 0;
} else {
form.data.rewardAmount = rewardAmount && deductText === '-' ? deductText +
rewardAmount : rewardAmount;
}
} else if (dataForm.type === 'CONTRACTOR') {
let {
number,
unit,
unitPrice
} = dataForm;
form.data = {
number,
unit,
unitPrice
};
} }
form.data = {
amount: statementAmount
};
} }
// console.log(form);
this.edit(form, callback);
} else { } else {
if (this.form.type === 'TIME') { console.log('验证失败');
let { }
normalNumber, });
normalCustomNumber, },
normalText, edit(form, callback) {
normalType, this.buttonLoading = true;
overNumber, update(form)
overCustomNumber, .then(res => {
overText, if (res.code == 0) {
overType, this.$store.dispatch('Save_project_id', this.form.projectId);
deductText, this.updateOtherPage();
rewardAmount if (callback && callback instanceof Function) {
} = this.form; callback();
form.data = {
normalNumber,
normalText,
normalType,
overNumber,
overText,
overType
};
if (form.data.overText == 1 || Number(form.data.overNumber) <= 0) {
delete form.data.overType;
delete form.data.overNumber;
delete form.data.overText;
// form.data.overNumber=''
}
if (deductText === 1) {
form.data.rewardAmount = 0;
} else { } else {
form.data.rewardAmount = rewardAmount && deductText === '-' ? deductText + rewardAmount : rewardAmount; this.toPage();
} }
} else if (this.form.type === 'CONTRACTOR') {
let { number, unit, unitPrice } = this.form;
form.data = {
number,
unit,
unitPrice
};
} }
} this.buttonLoading = false;
// console.log(form); })
this.edit(form, callback); .catch(res => {
} else { this.buttonLoading = false;
console.log('验证失败'); if (res.code == -5) {
} this.memberId = res.data;
}); this.memberPopupTitle = res.msg;
}, this.showMemberPopup = true;
edit(form, callback) {
this.buttonLoading = true;
update(form)
.then(res => {
if (res.code == 0) {
this.$store.dispatch('Save_project_id', this.form.projectId);
this.updateOtherPage();
if (callback && callback instanceof Function) {
callback();
} else {
this.toPage();
} }
});
},
updateOtherPage() {
var pages = getCurrentPages();
let path = 'pages/workpoint/project-bill/project-bill';
let path1 = 'pages/workpoint/project/project-edit';
let path2 = 'pages/workpoint/project/index';
pages.map(p => {
if (p.route.indexOf(path) != -1) {
uni.$emit('project-bill-list');
}
if (p.route.indexOf(path1) != -1) {
uni.$emit('project-detail');
} }
this.buttonLoading = false; if (p.route.indexOf(path2) != -1) {
}) uni.$emit('projects-changed');
.catch(res => {
this.buttonLoading = false;
if (res.code == -5) {
this.memberId = res.data;
this.memberPopupTitle = res.msg;
this.showMemberPopup = true;
} }
}); });
}, },
updateOtherPage() { toPage() {
var pages = getCurrentPages(); var pages = getCurrentPages();
let path = 'pages/workpoint/project-bill/project-bill'; var index = 0;
let path1 = 'pages/workpoint/project/project-edit'; let path = 'pages/workpoint/project-bill/project-bill';
let path2 = 'pages/workpoint/project/index'; for (var item of pages) {
pages.map(p => { if (item.route.indexOf(path) != -1) {
if (p.route.indexOf(path) != -1) { uni.navigateBack({
uni.$emit('project-bill-list'); delta: pages.length - index - 1
} });
if (p.route.indexOf(path1) != -1) { return;
uni.$emit('project-detail'); }
} index++;
if (p.route.indexOf(path2) != -1) {
uni.$emit('projects-changed');
} }
}); // 回首页
}, this.toDetailPage(path);
toPage() { },
var pages = getCurrentPages(); toDetailPage(path) {
var index = 0; this.$u.route({
let path = 'pages/workpoint/project-bill/project-bill'; url: path,
for (var item of pages) { type: 'redirectTo',
if (item.route.indexOf(path) != -1) { params: {
uni.navigateBack({ projectId: this.form.projectId
delta: pages.length - index - 1 }
});
},
handleClickAgain() {
if (this.recordId) {
this.showDeletePopup = true;
} else {
this.handleClickSure(() => {
this.$u.route({
url: 'pages/workpoint/workpoint-create/create',
type: 'redirectTo',
params: {
projectId: this.projectId,
path: this.path
}
});
}); });
return;
} }
index++; },
} async handleConfirmDelete() {
// 回首页 try {
this.toDetailPage(path); let {
}, code
toDetailPage(path) { } = await deleteBill({
this.$u.route({ id: this.recordId
url: path,
type: 'redirectTo',
params: {
projectId: this.form.projectId
}
});
},
handleClickAgain() {
if (this.recordId) {
this.showDeletePopup = true;
} else {
this.handleClickSure(() => {
this.$u.route({
url: 'pages/workpoint/workpoint-create/create',
type: 'redirectTo',
params: {
projectId: this.projectId,
path: this.path
}
}); });
if (code === 0) {
this.updateOtherPage();
this.$u.route({
type: 'back'
});
}
} catch (e) {
//TODO handle the exception
console.log(e);
}
},
handleConfirmMember() {
this.$u.route({
url: '/pages/workpoint/employees/employee-create',
type: 'navigateTo',
params: {
memberId: this.memberId, // 成员id
projectId: this.form.projectId // 项目ID
}
}); });
} },
}, handleClickFocus() {
async handleConfirmDelete() { if (Number(this.form.actualAmount) == 0) {
try { this.form.actualAmount = '';
let { code } = await deleteBill({ id: this.recordId });
if (code === 0) {
this.updateOtherPage();
this.$u.route({
type: 'back'
});
} }
} catch (e) { },
//TODO handle the exception handleClickBlur() {
console.log(e); if (!this.form.actualAmount) {
} this.form.actualAmount = '0';
},
handleConfirmMember() {
this.$u.route({
url: '/pages/workpoint/employees/employee-create',
type: 'navigateTo',
params: {
memberId: this.memberId, // 成员id
projectId: this.form.projectId // 项目ID
} }
}); },
}, handleClickSame() {
handleClickFocus() { if (this.form.receivableAmount) {
if (Number(this.form.actualAmount) == 0) { this.form.actualAmount = this.form.receivableAmount;
this.form.actualAmount = '';
}
},
handleClickBlur() {
if (!this.form.actualAmount) {
this.form.actualAmount = '0';
}
},
handleClickSame() {
if (this.form.receivableAmount) {
this.form.actualAmount = this.form.receivableAmount;
}
},
handleClickShowDateRange() {
this.$refs['calendar-popup'].open();
},
// 日历
calendarChange(e) {
if (this.isDateRange) {
this.form.dateRange = e
} else {
this.form.happenTime = e;
}
},
resetHappenTime(time) {
return this.parseTime(time, '{y}-{m}-{d}');
},
changeUnit() {
this.customNumberType = this.customNumberType === 'UNIT' ? 'HOURS' : 'UNIT';
},
customNumberClick(key) {
if (key === 'normalCustomNumber') {
if (this.form.normalText !== 3) {
this.form.normalNumber = '';
} }
this.form.normalText = 3; },
this.customPopupTitle = '填写记工工量'; handleClickShowDateRange() {
this.customNumberType = this.form.normalType; this.$refs['calendar-popup'].open();
} else if (key === 'overCustomNumber') { },
if (this.form.overText !== 3) { // 日历
this.form.overNumber = ''; calendarChange(e) {
if (this.isDateRange) {
this.form.dateRange = e
} else {
this.form.happenTime = e;
} }
this.form.overText = 3; },
this.customPopupTitle = '填写加班工量'; resetHappenTime(time) {
this.customNumberType = this.form.overType; return this.parseTime(time, '{y}-{m}-{d}');
} },
this.customNumberKey = key; changeUnit() {
this.customNumberValue = this.form[key]; this.customNumberType = this.customNumberType === 'UNIT' ? 'HOURS' : 'UNIT';
this.setWageList(); },
// this.customInputShow = true; customNumberClick(key) {
this.$refs['pop-number-view'].open(); if (key === 'normalCustomNumber') {
// setTimeout(() => { if (this.form.normalText !== 3) {
// this.customNumberFocus = true; this.form.normalNumber = '';
// }, 300); }
}, this.form.normalText = 3;
handleConfirmCustom(params) { this.customPopupTitle = '填写记工工量';
let { number, key, type } = params; this.customNumberType = this.form.normalType;
this.form[key] = number || '0'; } else if (key === 'overCustomNumber') {
if (key === 'normalCustomNumber') { if (this.form.overText !== 3) {
this.form.normalType = type; this.form.overNumber = '';
this.form.normalNumber = number || '0'; }
} else if (key === 'overCustomNumber') { this.form.overText = 3;
this.form.overType = type; this.customPopupTitle = '填写加班工量';
this.form.overNumber = number || '0'; this.customNumberType = this.form.overType;
}
this.customNumberKey = key;
this.customNumberValue = this.form[key];
this.setWageList();
// this.customInputShow = true;
this.$refs['pop-number-view'].open();
// setTimeout(() => {
// this.customNumberFocus = true;
// }, 300);
},
handleConfirmCustom(params) {
let {
number,
key,
type
} = params;
this.form[key] = number || '0';
if (key === 'normalCustomNumber') {
this.form.normalType = type;
this.form.normalNumber = number || '0';
} else if (key === 'overCustomNumber') {
this.form.overType = type;
this.form.overNumber = number || '0';
}
this.setWageList();
} }
this.setWageList();
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/deep/.u-border-bottom:after { /deep/.u-border-bottom:after {
border: 2 solid #f6f7fa !important; border: 2 solid #f6f7fa !important;
} }
/deep/.u-form-item__message {
text-align: right !important;
}
.workpoint-create { /deep/.u-form-item__message {
background-color: #f6f7fa; text-align: right !important;
color: #333333;
.submit-button-box {
width: 100%;
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
padding: 0 24rpx;
background-color: #f6f7fa;
} }
.content-view {
padding: 0 24rpx; .workpoint-create {
padding-bottom: 144rpx; background-color: #f6f7fa;
.placeholder { color: #333333;
font-weight: bold;
color: #cccccc; .submit-button-box {
}
.value-text {
color: #333333;
}
.arrow {
margin-left: 12rpx;
}
.work {
width: 100%; width: 100%;
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
padding: 0 24rpx;
background-color: #f6f7fa;
} }
.form-slot {
width: 100%; .content-view {
.check-box { padding: 0 24rpx;
padding-bottom: 144rpx;
.placeholder {
font-weight: bold;
color: #cccccc;
}
.value-text {
color: #333333;
}
.arrow {
margin-left: 12rpx;
}
.work {
width: 100%; width: 100%;
display: flex; }
align-items: center;
.custom-box { .form-slot {
margin-left: 24rpx; width: 100%;
.check-box {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
min-width: 136rpx; .custom-box {
max-width: 240rpx; margin-left: 24rpx;
height: 80rpx; display: flex;
border-radius: 8rpx; align-items: center;
font-size: 28rpx; justify-content: space-between;
border: 2rpx solid #dddddd; min-width: 136rpx;
padding: 0 24rpx; max-width: 240rpx;
overflow: hidden; height: 80rpx;
white-space: nowrap; border-radius: 8rpx;
overflow: hidden; font-size: 28rpx;
// word-break: break-all; border: 2rpx solid #dddddd;
&-icon { padding: 0 24rpx;
margin-top: 2rpx; overflow: hidden;
white-space: nowrap;
overflow: hidden;
// word-break: break-all;
&-icon {
margin-top: 2rpx;
}
}
.custom-box-checked {
border: 2rpx solid #02a074;
} }
} }
.custom-box-checked {
border: 2rpx solid #02a074;
}
}
}
.deduct {
width: 100%;
padding-bottom: 24rpx;
padding-left: 90rpx;
border-bottom: 2rpx solid #f6f7fa;
}
.deduct-box {
margin-top: 24rpx;
width: 456rpx;
height: 80rpx;
border-radius: 8rpx;
border: 2rpx solid #02a074;
padding: 0 24rpx;
display: flex;
align-items: center;
.deduct-box-unit {
font-size: 32rpx;
font-weight: bold;
margin-right: 6rpx;
color: #333333;
line-height: 80rpx;
margin-bottom: 8rpx;
}
.deduct-box-add {
font-size: 32rpx;
} }
}
.wage { .deduct {
width: 100%;
}
.part-view {
padding: 24rpx;
background-color: #ffffff;
border-radius: 16rpx;
margin-top: 24rpx;
padding-top: 0;
.right-view {
width: 100%; width: 100%;
padding-bottom: 24rpx;
padding-left: 90rpx;
border-bottom: 2rpx solid #f6f7fa;
}
.deduct-box {
margin-top: 24rpx;
width: 456rpx;
height: 80rpx;
border-radius: 8rpx;
border: 2rpx solid #02a074;
padding: 0 24rpx;
display: flex; display: flex;
justify-content: flex-end;
align-items: center; align-items: center;
.date-view {
.deduct-box-unit {
font-size: 32rpx;
font-weight: bold;
margin-right: 6rpx;
color: #333333;
line-height: 80rpx;
margin-bottom: 8rpx;
}
.deduct-box-add {
font-size: 32rpx;
}
}
.wage {
width: 100%;
}
.part-view {
padding: 24rpx;
background-color: #ffffff;
border-radius: 16rpx;
margin-top: 24rpx;
padding-top: 0;
.right-view {
width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
font-weight: bold;
.date-text { .date-view {
display: flex;
justify-content: flex-end;
align-items: center;
font-weight: bold;
.date-text {}
.image-view {
width: 32rpx;
height: 32rpx;
display: flex;
margin-left: 16rpx;
}
} }
.image-view { .checkbox-view {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
display: flex; display: flex;
margin-left: 16rpx; align-items: center;
justify-content: center;
border-radius: 50%;
border: 2rpx solid #cccccc;
margin-right: 12rpx;
font-size: 24rpx;
}
.checked {
background: $default-color;
border: 2rpx solid $default-color;
color: #ffffff;
} }
} }
.checkbox-view {
width: 32rpx; .value-view {
height: 32rpx; font-weight: bold;
color: #333333;
text-align: right;
width: 100%;
}
.number-view {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: flex-end;
border-radius: 50%;
border: 2rpx solid #cccccc;
margin-right: 12rpx;
font-size: 24rpx;
} }
.checked {
background: $default-color; .unit-view {
border: 2rpx solid $default-color; border-left: 2rpx solid #f6f7fa;
color: #ffffff; margin-left: 20rpx;
padding-left: 24rpx;
// width: 360rpx;
display: flex;
justify-content: flex-end;
align-items: center;
} }
}
.value-view {
font-weight: bold;
color: #333333;
text-align: right;
width: 100%;
}
.number-view {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.unit-view {
border-left: 2rpx solid #f6f7fa;
margin-left: 20rpx;
padding-left: 24rpx;
// width: 360rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.line-view { .line-view {
height: 2rpx; height: 2rpx;
background-color: #f6f7fa; background-color: #f6f7fa;
margin: 16rpx 0; margin: 16rpx 0;
} }
}
.maintain-view {
margin-top: 24rpx;
width: 100%;
background-color: #ffffff;
border-radius: 16rpx;
.part-view {
margin-top: 0;
}
.images-view {
padding: 24rpx 0;
} }
.remark-view {
.maintain-view {
margin-top: 24rpx; margin-top: 24rpx;
} width: 100%;
.area-view { background-color: #ffffff;
margin: 24rpx 0;
height: 240rpx;
padding: 24rpx;
background: #f6f7fa;
border-radius: 16rpx; border-radius: 16rpx;
.scroll-Y {
width: 100%; .part-view {
height: 100%; margin-top: 0;
.remark-text { }
text-align: left;
font-size: 28rpx; .images-view {
line-height: 36rpx; padding: 24rpx 0;
font-weight: bold; }
}
.placeholder-style { .remark-view {
color: #cccccc; margin-top: 24rpx;
}
.area-view {
margin: 24rpx 0;
height: 240rpx;
padding: 24rpx;
background: #f6f7fa;
border-radius: 16rpx;
.scroll-Y {
width: 100%;
height: 100%;
.remark-text {
text-align: left;
font-size: 28rpx;
line-height: 36rpx;
font-weight: bold;
}
.placeholder-style {
color: #cccccc;
}
} }
} }
} }
} }
}
.bottom-view { .bottom-view {
position: fixed; position: fixed;
margin: 16rpx 32rpx 36rpx 32rpx; margin: 16rpx 32rpx 36rpx 32rpx;
.confirm-view {
color: #ffffff; .confirm-view {
height: 96rpx; color: #ffffff;
line-height: 96rpx; height: 96rpx;
font-weight: bold; line-height: 96rpx;
font-size: 32rpx; font-weight: bold;
font-size: 32rpx;
}
} }
}
.loading-view { .loading-view {
width: 100%; width: 100%;
background-color: transparent; background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
.custom {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
&-label {
color: $default-color;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: center;
width: 180rpx; top: 50%;
&-icon { left: 0;
width: 28rpx; position: fixed;
height: 28rpx;
display: flex;
margin-left: 12rpx;
}
} }
&-value { .custom {
flex: 1; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
&-unit { justify-content: space-between;
margin-left: 12rpx; font-size: 28rpx;
&-label {
color: $default-color;
display: flex;
align-items: center;
justify-content: flex-end;
width: 180rpx;
&-icon {
width: 28rpx;
height: 28rpx;
display: flex;
margin-left: 12rpx;
}
}
&-value {
flex: 1;
display: flex;
align-items: center;
&-unit {
margin-left: 12rpx;
}
} }
} }
} }
} </style>
</style> \ No newline at end of file
...@@ -244,12 +244,12 @@ export const canvasTableCellOptions = [{ ...@@ -244,12 +244,12 @@ export const canvasTableCellOptions = [{
export const tableFooterOptions = [{ export const tableFooterOptions = [{
value: "upperCase", value: "upperCase",
label: "大写金额:", label: "大写金额:",
width: "70%", width: "140px",
}, },
{ {
value: "lowerCase", value: "lowerCase",
label: "(小写)", label: "(小写)",
width: "30%", width: "55px",
}, },
] ]
......
...@@ -49,6 +49,12 @@ export const packageOptions = [ ...@@ -49,6 +49,12 @@ export const packageOptions = [
icon: 'file-text', icon: 'file-text',
path: "/pages/mine/import-export/import-export" path: "/pages/mine/import-export/import-export"
}, },
{
id: 5,
title: '账单回收站',
icon: 'file-text',
path: "/pages/mine/recyled/recyled"
},
{ {
id: 1, id: 1,
title: '关于', title: '关于',
......
export const tabsOptions = [{
title: '日常记账',
name: "DAILY"
},
{
title: '收据记账',
name: "REPAIR"
},
{
title: '记工时',
name: 'PROJECT'
},
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment