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

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

parent 91ad6dc5
......@@ -3,7 +3,7 @@ import request from "@/utils/request.js"
// 天气
export async function getWeather(data) {
return request({
url: `/rest/anno/weather/getWeather`,
url: `/rest/anno/weather/v2/getWeather`,
method: 'GET',
data,
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 @@
"name" : "扳手记账",
"appid" : "__UNI__EDB8C7C",
"description" : "",
"versionName" : "1.2.3",
"versionCode" : 123,
"versionName" : "1.2.4",
"versionCode" : 124,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......@@ -68,7 +68,7 @@
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"abiFilters" : [ "arm64-v8a" ],
"autoSdkPermissions" : false,
"permissionExternalStorage" : {
"request" : "none",
......
......@@ -377,7 +377,16 @@
}
}
]
,{
"path" : "recyled/recyled",
"style" :
{
"navigationBarTitleText": "账单回收站",
"enablePullDownRefresh": false
}
}
]
},
{
"root": "pages/maintain-bill",
......
......@@ -76,7 +76,7 @@ export default {
current: 0, // tabs组件的current值,表示当前活动的tab选项
swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
tabs: debitNoteTabs,
pages: debitNotePages,
pages: JSON.parse(JSON.stringify(debitNotePages)),
activeItemStyle: {
color: '#ff286d'
},
......@@ -171,6 +171,7 @@ export default {
this.swiperCurrent = current;
this.current = current;
console.log('-------animationfinish------');
console.log(this.currentPage);
if (this.currentPage.pageNumber === 1) {
this.onRefresh();
}
......
......@@ -19,15 +19,15 @@
<view class="title-view">扳手记账</view>
</view>
<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>{{ weather.city || '查天气' }}</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">
<image :src="weather.icon"></image>
</view> -->
<view class="weather-text">{{ weather.weather }}</view>
<view class="weather-text">{{ weather.text }}</view>
<view>{{ weather.temp }}℃</view>
</view>
</view>
......@@ -658,7 +658,7 @@ export default {
color: #333333;
display: flex;
align-items: center;
margin-left: 24rpx;
// margin-left: 24rpx;
.weather-icon-view {
margin-right: 8rpx;
width: 28rpx;
......
......@@ -7,7 +7,8 @@
</view>
</view>
<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">
<text>{{ item.label }}</text>
<text>:</text>
......@@ -22,20 +23,18 @@
<view class="table table-striped table-bordered table-hover view-userinfo">
<view class="tbody">
<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>
<view class="tr">
<view class="td voucher-table-content" id="table-left">
<view class="tr" v-for="(detailItem, detailIndex) in expenseArray" :key="detailIndex">
<!-- textAlign: index === 1 ? 'left' : 'center' -->
<view
class="td"
<view class="td"
:class="{ 'no-border-top': detailIndex === 0, 'align-left': index === 1 && detailItem[item.value] && detailItem[item.value].length > 9 }"
:style="{ width: item.width }"
v-for="(item, index) in tableCellOptions"
:key="index"
>
:style="{ width: item.width }" v-for="(item, index) in tableCellOptions"
:key="index">
<text :class="{scale:platform==='4'}">
<text>{{ (detailItem.id && item.currencySign) || '' }}</text>
<text v-if="index === 0">{{ detailIndex + 1 }}</text>
......@@ -44,7 +43,8 @@
</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>
</view>
</view>
......@@ -66,10 +66,13 @@
</view>
</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 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">
<text>{{ item.label }}</text>
<text>:</text>
......@@ -82,109 +85,132 @@
</view>
</view>
<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>
</view>
</view>
</template>
<script>
import { voucherHeadOptions, voucherFooterOptions, tableCellOptions, canvasTableCellOptions, tableFooterOptions } from '@/utils/options/maintain-bill/index.js';
import { refundFooterOptions, refundTableCellOptions, refundCanvasTableCellOptions } from '@/utils/options/maintain-bill/refund.js';
import { billBaseUrl, baseUrl } from '@/utils/config.js';
import { convertCurrency, keepTwoDecimalFull } from '@/utils/common.js';
import { mapGetters } from 'vuex';
export default {
props: {
detail: {
type: Object,
default: () => {
return {
expenseDetails: []
};
}
}
},
data() {
return {
keepTwoDecimalFull,
voucherHeadOptions,
tableFooterOptions,
previewIcon: billBaseUrl + 'yulanicon@3x.png',
poster: null,
tableLeftHeight: 0
};
},
computed: {
...mapGetters(['platform', 'isIOS']),
defaultColor() {
return this.detail.type === 'refund' ? '#875A38' : '#eb872f';
},
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;
import {
voucherHeadOptions,
voucherFooterOptions,
tableCellOptions,
canvasTableCellOptions,
tableFooterOptions
} from '@/utils/options/maintain-bill/index.js';
import {
refundFooterOptions,
refundTableCellOptions,
refundCanvasTableCellOptions
} from '@/utils/options/maintain-bill/refund.js';
import {
billBaseUrl,
baseUrl
} from '@/utils/config.js';
import {
convertCurrency,
keepTwoDecimalFull
} from '@/utils/common.js';
import {
mapGetters
} from 'vuex';
export default {
props: {
detail: {
type: Object,
default: () => {
return {
expenseDetails: []
};
}
}
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;
data() {
return {
keepTwoDecimalFull,
voucherHeadOptions,
tableFooterOptions,
previewIcon: billBaseUrl + 'yulanicon@3x.png',
poster: null,
tableLeftHeight: 0
};
},
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') {
computed: {
...mapGetters(['platform', 'isIOS']),
defaultColor() {
return this.detail.type === 'refund' ? '#875A38' : '#eb872f';
},
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() {
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) {
height += 40;
} else if (height < 500) {
......@@ -194,99 +220,97 @@ export default {
} else if (height >= 800) {
height += 100;
}
// }
console.log('zoom=====', zoom);
height = (zoom * height).toFixed(2) + 'px';
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();
// }
console.log('zoom=====', zoom);
height = (zoom * height).toFixed(2) + 'px';
return height;
}
this.$emit('preview', this.poster);
},
/* 初始化备注栏高度 */
initRemarkHeight() {
let view = uni
.createSelectorQuery()
.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();
mounted() {
setTimeout(() => {
this.initRemarkHeight();
}, 500);
},
saveVoucher() {
let scale = 1;
let orangeColor = this.defaultColor;
let orangeBorderCss = '1rpx solid ' + orangeColor;
let borderCss = `1px solid ${this.defaultColor}`;
let trCss = {
width: '100%',
// height: '18px',
// lineHeight: '18px',
'border-top': borderCss,
display: 'flex'
};
let thCss = {
// height: '100%',
color: orangeColor,
padding: '2px',
'border-right': borderCss,
// 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: [
{
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);
},
/* 初始化备注栏高度 */
initRemarkHeight() {
let view = uni
.createSelectorQuery()
.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() {
let scale = 1;
let orangeColor = this.defaultColor;
let orangeBorderCss = '1rpx solid ' + orangeColor;
let borderCss = `1px solid ${this.defaultColor}`;
let trCss = {
width: '100%',
// height: '18px',
// lineHeight: '18px',
'border-top': borderCss,
display: 'flex'
};
let thCss = {
// height: '100%',
color: orangeColor,
padding: '2px',
'border-right': borderCss,
// 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',
css: {
display: 'inline'
},
views: [
{
views: [{
type: 'text',
css: {
color: orangeColor
......@@ -298,304 +322,288 @@ export default {
css: {
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) {
// view.css.width = '70%';
// }
return view;
});
let tableTr = this.canvasTableCellOptions.map(item => {
let view = {
}]
};
// if (index === this.voucherHeadOptions.length - 1) {
// view.css.width = '70%';
// }
return view;
});
let tableTr = this.canvasTableCellOptions.map(item => {
let view = {
type: 'view',
css: {
...thCss,
width: item.width
},
views: [{
type: 'text',
css: {},
text: item.label
}]
};
return view;
});
tableTr.push({
type: 'view',
css: {
...thCss,
width: item.width
width: `${66 * scale}px`,
borderRight: 'none'
},
views: [
{
type: 'text',
css: {},
text: item.label
}
]
};
return view;
});
tableTr.push({
type: 'view',
css: {
...thCss,
width: `${66 * scale}px`,
borderRight: 'none'
},
views: [
{
views: [{
type: 'text',
text: '备注/说明'
}
]
});
let tableBodyLeft = this.expenseArray.map((el, i) => {
let views = this.canvasTableCellOptions.map((item, index) => {
let textAlign = 'center';
if (index === 1) {
if (el[item.value] && el[item.value].length > 9) {
textAlign = 'left';
}]
});
let tableBodyLeft = this.expenseArray.map((el, i) => {
let views = this.canvasTableCellOptions.map((item, index) => {
let textAlign = 'center';
if (index === 1) {
if (el[item.value] && el[item.value].length > 9) {
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 = {
type: 'view',
css: {
...tdCss,
textAlign: textAlign,
width: item.width,
display: 'inline-block'
...trCss
},
views: [
{
type: 'text',
text: (el.id && item.currencySign) || ''
},
{
type: 'text',
css: {
// lineClamp: 1
},
text: index === 0 ? i + 1 : el[item.value] || ''
}
]
views: views
};
if (index === this.canvasTableCellOptions.length) {
view.css['border-right'] = borderCss;
if (i === 0) {
view.css['border-top'] = 'none';
}
return view;
});
let view = {
type: 'view',
css: {
...trCss
},
views: views
};
if (i === 0) {
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
console.log('tableBodyLeft', tableBodyLeft);
let tableBody = [{
type: 'view',
css: {
width: `${260 * scale}px`,
display: 'inline-block'
},
views: tableBodyLeft
},
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: {},
type: 'text',
// 'line-clamp': 6,
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 view = {
type: 'view',
css: {
position: 'absolute',
width: '1px',
height: this.scaleInitialHeight,
left: left,
// top: '10px',
background: this.defaultColor
let tableFooterCell = []
this.tableFooterOptions.map((item, index) => {
let text = item.value === 'upperCase' ? this.upperCase : this.keepTwoDecimalFull(this
.expenseCount);
if (item.value === 'lowerCase' && text) {
text = '¥' + text;
}
};
return view;
});
let tableFooterCell = this.tableFooterOptions.map((item, index) => {
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
let label = {
type: 'text',
css: {
color: orangeColor,
},
{
type: 'text',
text: text
}
]
};
return view;
});
let tableFooter = [
{
type: 'view',
css: {
height: '100%',
display: 'inline-block',
'border-right': borderCss,
width: '21px',
textAlign: 'center',
lineHeight: '15px'
},
views: [
{
text: item.label
}
if(index===1){
label.css.marginLeft="35px"
}
let value = {
css: {
width: item.width,
color: orangeColor,
},
type: 'text',
text: text
}
tableFooterCell.push(label)
tableFooterCell.push(value)
});
let tableFooter = [{
type: 'view',
css: {
height: '100%',
display: 'inline-block',
'border-right': borderCss,
width: '21px',
textAlign: 'center',
lineHeight: '15px'
},
views: [{
type: 'text',
text: '合计'
}
]
},
{
type: 'view',
css: {
height: '100%',
display: 'inline-block',
width: '295px',
textAlign: 'left',
lineHeight: '15px',
'margin-left': '8px',
background: '#FFFFFF'
}]
},
views: tableFooterCell
}
];
let tableView = [
// 表头
{
type: 'view',
css: {
...trCss,
'border-top': 'none'
},
views: tableTr
},
// 表格tbody
{
type: 'view',
css: {
width: '100%',
'border-top': borderCss
// #ifdef APP-PLUS
// display:'flex'
// #endif
{
type: 'view',
css: {
height: '100%',
display: 'inline-block',
width: '295px',
textAlign: 'left',
lineHeight: '15px',
'margin-left': '8px',
background:'#ffffff'
},
views: tableFooterCell
}
];
let tableView = [
// 表头
{
type: 'view',
css: {
...trCss,
'border-top': 'none'
},
views: tableTr
},
views: [...tableBody, ...tableBorder]
},
// 表格合计
{
type: 'view',
css: {
width: '100%',
height: '16px',
display: 'flex',
'align-items': 'center',
'border-top': borderCss,
borderRight: 'none'
// 表格tbody
{
type: 'view',
css: {
width: '100%',
'border-top': borderCss
// #ifdef APP-PLUS
// display:'flex'
// #endif
},
views: [...tableBody, ...tableBorder]
},
views: tableFooter
},
// 表格右侧说明
{
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
// 表格合计
{
type: 'view',
css: {
width: '100%',
height: '16px',
display: 'flex',
'align-items': 'center',
'border-top': borderCss,
borderRight: 'none'
},
views: tableFooter
},
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',
text: '本收据为电子凭证,具有同等效力'
}
]
}
];
// 表格底部
let footerView = this.voucherFooterOptions.map((item, index) => {
let text = item.value === 'arearAmount' ? this.arearAmount : this.detail[item.value];
let view = {
type: 'view',
css: {
width: '25%',
display: 'inline-block',
fontSize: '7px',
lineHeight: '11px',
'margin-bottom': '2px'
},
views: [
{
}]
}
];
// 表格底部
let footerView = this.voucherFooterOptions.map((item, index) => {
let text = item.value === 'arearAmount' ? this.arearAmount : this.detail[item.value];
let view = {
type: 'view',
css: {
width: '25%',
display: 'inline-block',
fontSize: '7px',
lineHeight: '11px',
'margin-bottom': '2px'
},
views: [{
type: 'view',
css: {
display: 'inline'
},
views: [
{
views: [{
type: 'text',
css: {
color: orangeColor
......@@ -610,57 +618,54 @@ export default {
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;
});
// 印章
let sealView = {};
if (this.detail.showSeal) {
sealView = {
type: 'image',
src: this.sealImage,
console.log(tableView);
this.poster = {
css: {
position: 'fixed',
display: 'inline-block',
width: '112px',
height: '58px',
right: '36px',
bottom: '42px'
}
};
}
console.log(tableView);
this.poster = {
css: {
width: `${351 * scale}px`,
'background-color': '#FFFFFF',
padding: '12px 8px 0px 8px',
color: '#333333'
},
views: [
// 标题
{
type: 'view',
css: {
position: 'absolute',
top: '-10px',
width: '325px',
display: 'flex',
justifyContent: 'center'
},
views: [
{
width: `${351 * scale}px`,
'background-color': '#FFFFFF',
padding: '12px 8px 0px 8px',
color: '#333333'
},
views: [
// 标题
{
type: 'view',
css: {
position: 'absolute',
top: '-10px',
width: '325px',
display: 'flex',
justifyContent: 'center'
},
views: [{
type: 'view',
css: {
display: 'inline-block'
},
views: [
{
views: [{
type: 'text',
css: {
display: 'inline-block',
......@@ -688,291 +693,323 @@ export default {
text: this.detail.repairShopName
}
]
}
]
},
// 头部信息
{
type: 'view',
css: {
'margin-top': '30px',
// display: 'flex',
// 'flex-wrap': 'wrap',
overflow: 'hidden'
}]
},
views: headView
},
// 表格
{
type: 'view',
css: {
width: '325px',
fontSize: '7px',
lineHeight: '11px',
textAlign: 'left',
marginTop: '3px',
border: borderCss
// 头部信息
{
type: 'view',
css: {
'margin-top': '30px',
// display: 'flex',
// 'flex-wrap': 'wrap',
overflow: 'hidden'
},
views: headView
},
views: tableView
},
// 底部信息
{
type: 'view',
css: {
'padding-top': '5px',
'padding-bottom': '12px',
overflow: 'hidden',
background: '#FFFFFF'
// 表格
{
type: 'view',
css: {
width: '325px',
fontSize: '7px',
lineHeight: '11px',
textAlign: 'left',
marginTop: '3px',
border: borderCss
},
views: tableView
},
views: footerView
},
// 印章
{
...sealView
}
]
};
// 底部信息
{
type: 'view',
css: {
'padding-top': '5px',
'padding-bottom': '12px',
overflow: 'hidden',
background: '#FFFFFF'
},
views: footerView
},
// 印章
{
...sealView
}
]
};
}
}
}
};
};
</script>
<style lang="scss" scoped>
@import '@/static/styles/scss/table.scss';
// 橙色字体
$orange-color: var(--color);
.voucher {
padding: 24rpx 16rpx;
background-color: #ffffff;
border-radius: 16rpx;
color: #333333;
&-title {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
font-weight: bold;
color: $orange-color;
line-height: 52rpx;
&-text {
// display: flex;
display: inline-block;
position: relative;
&-underline {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 6rpx;
&::after {
content: '';
box-sizing: border-box; // 为了与原元素等大
@import '@/static/styles/scss/table.scss';
// 橙色字体
$orange-color: var(--color);
.voucher {
padding: 24rpx 16rpx;
background-color: #ffffff;
border-radius: 16rpx;
color: #333333;
&-title {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
font-weight: bold;
color: $orange-color;
line-height: 52rpx;
&-text {
// display: flex;
display: inline-block;
position: relative;
&-underline {
position: absolute;
bottom: 0;
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;
width: 100%;
height: 6rpx;
&::after {
content: '';
box-sizing: border-box; // 为了与原元素等大
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 {
margin-top: 16rpx;
display: flex;
flex-wrap: wrap;
overflow: hidden;
&-item {
width: 30%;
&-head {
margin-top: 16rpx;
display: flex;
align-items: center;
font-size: 16rpx;
line-height: 22rpx;
margin-bottom: 4rpx;
white-space: nowrap;
word-break: break-all;
transform: scale(0.85);
transform-origin: left center;
&:last-child {
width: 70%;
flex-wrap: wrap;
overflow: hidden;
&-item {
width: 30%;
display: flex;
align-items: center;
font-size: 16rpx;
line-height: 22rpx;
margin-bottom: 4rpx;
white-space: nowrap;
// overflow: hidden;
word-break: break-all;
}
&-label {
flex-shrik: 0;
color: $orange-color;
}
&-value {
transform: scale(0.85);
transform-origin: left center;
&:last-child {
width: 70%;
white-space: nowrap;
// overflow: hidden;
word-break: break-all;
}
&-label {
flex-shrik: 0;
color: $orange-color;
}
&-value {}
}
}
}
&-footer {
margin-top: 10rpx;
&-item {
width: 25%;
&:last-child {
width: 75%;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
&-footer {
margin-top: 10rpx;
&-item {
width: 25%;
&:last-child {
width: 75%;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
}
}
}
}
&-table {
width: 650rpx;
font-size: 14rpx;
line-height: 22rpx;
text-align: center;
margin-top: 6rpx;
// 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;
&-table {
width: 650rpx;
font-size: 14rpx;
line-height: 22rpx;
text-align: center;
margin-top: 6rpx;
// border: 2rpx solid $orange-color;
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;
}
}
&-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;
.seal-view {
position: absolute;
width: 188rpx;
height: 97rpx;
right: 16rpx;
bottom: 16rpx;
}
}
.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 {
.voucher-table-tr {
.voucher-table-td {
&:last-child {
border-right: 2rpx solid $orange-color;
}
}
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;
}
&-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%;
padding: 4rpx 4rpx;
border-top: 2rpx solid $orange-color;
text-align: left;
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;
-webkit-line-clamp: 7;
line-clamp: 7;
&:last-child {
border-right: none;
}
}
.remark-view {
overflow: hidden;
text-align: left;
}
}
.voucher-table-tfooter {
position: relative;
height: 34rpx;
display: flex;
align-items: center;
// border-top: 2rpx solid $orange-color;
.voucher-table-td {
border-bottom: none;
.align-left {
text-align: left !important;
}
&-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;
align-items: center;
text-align: left;
height: 100%;
padding-left: 16rpx;
line-height: 26rpx;
/* #ifdef APP-PLUS */
line-height: 28rpx;
/* #endif */
&-left {
width: 70%;
// border-top: 2rpx solid $orange-color;
.voucher-table-td {
border-bottom: none;
}
&-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;
transform: scale(0.7);
&-text {}
}
}
&-declare {
position: absolute;
right: -18rpx;
top: -48rpx;
width: 9rpx;
font-size: 16rpx;
line-height: 22rpx;
text-align: center;
color: $orange-color;
transform: scale(0.7);
&-text {
&-preview {
margin-top: 28rpx;
font-size: 24rpx;
color: $default-color;
display: flex;
justify-content: center;
align-items: center;
&-icon {
width: 32rpx;
height: 24rpx;
margin-right: 8rpx;
}
}
}
&-preview {
margin-top: 28rpx;
font-size: 24rpx;
color: $default-color;
display: flex;
justify-content: center;
align-items: center;
&-icon {
width: 32rpx;
height: 24rpx;
margin-right: 8rpx;
}
}
}
</style>
</style>
\ No newline at end of file
<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 {
current: 1,
size: 20,
employees: [],
// showMember: false,
showMember: false,
platform: '',
focus: false,
currentPopInfo: {}
......
......@@ -6,7 +6,8 @@
<u-form-item label="项目名称" prop="projectId" required>
<view class="right-view">
<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>
<u-icon name="arrow-right" class="arrow" v-if="!recordId"></u-icon>
</view>
......@@ -15,18 +16,25 @@
<u-form-item label="日期" v-if="!isDateRange" prop="happenTime" required>
<view class="right-view">
<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="image-view"><image :src="dateImage"></image></view>
<view class="image-view">
<image :src="dateImage"></image>
</view>
</view>
</view>
</u-form-item>
<u-form-item label="日期(可多选)" v-else prop="dateRange" required>
<view class="right-view">
<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="image-view"><image :src="dateImage"></image></view>
<view class="image-view">
<image :src="dateImage"></image>
</view>
</view>
</view>
</u-form-item>
......@@ -35,12 +43,14 @@
<text class="placeholder">{{ form.memberName }}</text>
</view>
<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>
</view>
</u-form-item>
<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 class="maintain-view">
......@@ -50,32 +60,18 @@
<view class="work" v-if="tabCurrent === 1">
<u-form-item label="本次借支" prop="loanAmount" required>
<view class="right-view">
<u-input
type="digit"
v-model="form.loanAmount"
placeholder="填写金额"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
<u-input type="digit" v-model="form.loanAmount" placeholder="填写金额"
:clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
:custom-style="customStyle" />
</view>
</u-form-item>
</view>
<view class="overtime" v-else>
<u-form-item label="本次结算" prop="statementAmount" required>
<view class="right-view">
<u-input
type="digit"
v-model="form.statementAmount"
placeholder="填写金额"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
<u-input type="digit" v-model="form.statementAmount" placeholder="填写金额"
:clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
:custom-style="customStyle" />
</view>
</u-form-item>
</view>
......@@ -83,20 +79,16 @@
<block v-else>
<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="check-box">
<checkbox-groups
:checked="form.normalText"
:customStyle="checkboxCustomStyle"
:options="workTypeOptions"
@handleClick="workTypeChange"
></checkbox-groups>
<view
class="custom-box placeholder"
<checkbox-groups :checked="form.normalText"
:customStyle="checkboxCustomStyle" :options="workTypeOptions"
@handleClick="workTypeChange"></checkbox-groups>
<view class="custom-box placeholder"
:class="{ 'custom-box-checked': form.normalText === 3 }"
@click="customNumberClick('normalCustomNumber')"
>
@click="customNumberClick('normalCustomNumber')">
<text class="value-text" v-if="form.normalCustomNumber">
{{ form.normalCustomNumber }}{{ form.normalType === 'HOURS' ? '小时' : '个工' }}
</text>
......@@ -109,17 +101,12 @@
<u-form-item label="加班" prop="overNumber" label-position="left" label-width="90">
<view class="form-slot">
<view class="check-box">
<checkbox-groups
:checked="form.overText"
:customStyle="checkboxCustomStyle"
<checkbox-groups :checked="form.overText" :customStyle="checkboxCustomStyle"
:options="overtimeTypeOptions"
@handleClick="overtimeTypeChange"
></checkbox-groups>
<view
class="custom-box placeholder"
@handleClick="overtimeTypeChange"></checkbox-groups>
<view class="custom-box placeholder"
:class="{ 'custom-box-checked': form.overText === 3 }"
@click="customNumberClick('overCustomNumber')"
>
@click="customNumberClick('overCustomNumber')">
<text class="value-text" v-if="form.overCustomNumber">
{{ form.overCustomNumber }}{{ form.overType === 'HOURS' ? '小时' : '个工' }}
</text>
......@@ -129,83 +116,52 @@
</view>
</view>
</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">
<checkbox-groups
:checked="form.deductText"
:customStyle="checkboxCustomStyle"
<checkbox-groups :checked="form.deductText" :customStyle="checkboxCustomStyle"
:options="deductTypeOptions"
@handleClick="deductTypeChange"
></checkbox-groups>
@handleClick="deductTypeChange"></checkbox-groups>
</view>
</u-form-item>
<!-- 补扣 -->
<view class="deduct">
<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 }}
</text>
<u-input
type="digit"
v-model="form.rewardAmount"
placeholder="请输入金额"
:clearable="false"
:focus="rewardAmountFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurDeductNumber"
:custom-style="deductCustomStyle"
/>
<u-input type="digit" v-model="form.rewardAmount" placeholder="请输入金额"
:clearable="false" :focus="rewardAmountFocus" input-align="right"
height="56" maxlength="11" cursor-spacing="50" @blur="onBlurDeductNumber"
:custom-style="deductCustomStyle" />
</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 class="overtime" v-else>
<u-form-item label="工程量" prop="number" required>
<view class="value-view number-view">
<view class="form-input">
<u-input
type="digit"
v-model="form.number"
placeholder="施工量"
:clearable="false"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
:custom-style="inputCustomStyle"
/>
<u-input type="digit" v-model="form.number" placeholder="施工量"
:clearable="false" input-align="right" height="56" maxlength="11"
cursor-spacing="50" :custom-style="inputCustomStyle" />
</view>
<view class="unit-view">
<u-input
type="text"
:clearable="false"
:custom-style="unitCustomStyle"
:placeholder-style="placeholderStyle"
height="56"
input-align="right"
v-model="form.unit"
placeholder="单位"
cursor-spacing="50"
/>
<ab-button content="常用" :customStyle="customStyleUnit" @click="chooseUnit"></ab-button>
<u-input type="text" :clearable="false" :custom-style="unitCustomStyle"
:placeholder-style="placeholderStyle" height="56" input-align="right"
v-model="form.unit" placeholder="单位" cursor-spacing="50" />
<ab-button content="常用" :customStyle="customStyleUnit"
@click="chooseUnit"></ab-button>
</view>
</view>
</u-form-item>
<u-form-item label="单价" prop="unitPrice" required>
<u-input
type="digit"
v-model="form.unitPrice"
placeholder="请输入单价"
:clearable="false"
input-align="right"
maxlength="11"
cursor-spacing="50"
:custom-style="customStyle"
/>
<u-input type="digit" v-model="form.unitPrice" placeholder="请输入单价"
:clearable="false" input-align="right" maxlength="11" cursor-spacing="50"
:custom-style="customStyle" />
</u-form-item>
<u-form-item label="工钱" prop="totalPrice" required>
<view class="right-view">
......@@ -229,7 +185,8 @@
</scroll-view>
</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>
......@@ -237,1242 +194,1371 @@
</u-form>
</view>
<view class="submit-button-box">
<bottom-buttons
showCancel
:loading="buttonLoading"
:disabled="!canConfirm"
:cancelText="cancelText"
:customCancel="customCancel"
@cancel="handleClickAgain"
@confirm="handleClickSure"
></bottom-buttons>
<bottom-buttons showCancel :loading="buttonLoading" :disabled="!canConfirm" :cancelText="cancelText"
:customCancel="customCancel" @cancel="handleClickAgain" @confirm="handleClickSure"></bottom-buttons>
</view>
<view class="loading-view" v-if="loading"><u-loading mode="flower"></u-loading></view>
<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>
<u-select
v-if="selectShow"
v-model="selectShow"
mode="single-column"
cancel-color="#02A074"
cancel-text="+ 新建项目"
value-name="id"
label-name="name"
:default-value="defaultProject"
: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>
<u-select v-if="selectShow" v-model="selectShow" mode="single-column" cancel-color="#02A074"
cancel-text="+ 新建项目" value-name="id" label-name="name" :default-value="defaultProject" :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>
</template>
<script>
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import AbButton from '@/components/common/ab-button.vue';
import BottomButtons from '@/components/common/bottom-buttons.vue';
import UnitPopup from '@/components/unit-popup/unit-popup.vue';
import UploadImages from '@/components/upload';
import PopInput from '@/components/pop-input-view';
import PopNumberView from './components/pop-number-view';
import PopRewardView from './components/pop-reward-view';
import SubmitButton from '@/components/submit-button/index.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillTabs from '../components/bill-tabs.vue';
import BillingCategory from '../components/billing-category.vue';
import WageTable from './components/wage-table.vue';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
import { getMembers, getProject, getProjectList, update, recordCalculateDetail } from '@/api/workpoint/index.js';
import { getBillInfo, deleteBill } from '@/api/workpoint/project-bill.js';
import { updateProject } from '@/api/project/index.js';
import { formatCount } 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';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import AbButton from '@/components/common/ab-button.vue';
import BottomButtons from '@/components/common/bottom-buttons.vue';
import UnitPopup from '@/components/unit-popup/unit-popup.vue';
import UploadImages from '@/components/upload';
import PopInput from '@/components/pop-input-view';
import PopNumberView from './components/pop-number-view';
import PopRewardView from './components/pop-reward-view';
import SubmitButton from '@/components/submit-button/index.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillTabs from '../components/bill-tabs.vue';
import BillingCategory from '../components/billing-category.vue';
import WageTable from './components/wage-table.vue';
import {
checkOpenPermission,
checkOpenService
} from '@/utils/app-plus-auth.js';
import {
getMembers,
getProject,
getProjectList,
update,
recordCalculateDetail
} from '@/api/workpoint/index.js';
import {
getBillInfo,
deleteBill
} from '@/api/workpoint/project-bill.js';
import {
updateProject
} from '@/api/project/index.js';
import {
formatCount
} 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 {
components: {
CheckboxGroups,
AbButton,
BottomButtons,
UnitPopup,
UploadImages,
PopInput,
PopNumberView,
PopRewardView,
SubmitButton,
CalendarPopup,
BillingCategory,
BillTabs,
WageTable
},
data() {
return {
formatCount,
workTypeOptions,
overtimeTypeOptions,
deductTypeOptions,
wageTableOptions,
defaultValidate,
timeValidate,
contractorValidate,
unitOptions,
dateImage: baseUrl + 'riqi@3x.png',
showDeletePopup: false,
showMemberPopup: false,
selectShow: false,
loading: false,
uploading: false,
projectList: [],
defaultProject: [],
wageList: [],
normal: '',
over: '',
errorType: ['message'],
form: {
export default {
components: {
CheckboxGroups,
AbButton,
BottomButtons,
UnitPopup,
UploadImages,
PopInput,
PopNumberView,
PopRewardView,
SubmitButton,
CalendarPopup,
BillingCategory,
BillTabs,
WageTable
},
data() {
return {
formatCount,
workTypeOptions,
overtimeTypeOptions,
deductTypeOptions,
wageTableOptions,
defaultValidate,
timeValidate,
contractorValidate,
unitOptions,
dateImage: baseUrl + 'riqi@3x.png',
showDeletePopup: false,
showMemberPopup: false,
selectShow: false,
loading: false,
uploading: false,
projectList: [],
defaultProject: [],
wageList: [],
normal: '',
over: '',
errorType: ['message'],
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: '',
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: '',
recordId: '',
placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;',
customStyle: {
fontSize: '28rpx',
textAlign: 'right',
fontWeight: 'bold'
},
inputCustomStyle: {
'font-size': '28rpx',
textAlign: 'right',
width: '126rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
popupInputCustomStyle: {
textAlign: 'left',
'font-size': '28rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
deductCustomStyle: {
fontSize: '28rpx',
'text-align': 'left',
fontWeight: 'bold',
'line-height': '80rpx',
height: '80rpx'
},
labelStyle: {
// 'line-height': '80rpx',
// 'align-items':'flex-start',
// 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'
},
recordId: '',
placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;',
customStyle: {
fontSize: '28rpx',
textAlign: 'right',
fontWeight: 'bold'
},
inputCustomStyle: {
'font-size': '28rpx',
textAlign: 'right',
width: '126rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
popupInputCustomStyle: {
textAlign: 'left',
'font-size': '28rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
deductCustomStyle: {
fontSize: '28rpx',
'text-align': 'left',
fontWeight: 'bold',
'line-height': '80rpx',
height: '80rpx'
},
labelStyle: {
// 'line-height': '80rpx',
// 'align-items':'flex-start',
// 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,
membersList: [],
membersLength: 0,
defaultList: [
{
limit: 6,
membersList: [],
membersLength: 0,
defaultList: [{
id: 'setting',
name: '管理'
}
],
tabCurrent: 1,
path: 'workpoint',
notification: 'workpoint-create-remark',
memberId: '',
memberPopupTitle: '未设置工价',
dateType: 'date'
};
},
computed: {
...mapGetters(['platform', 'prevProjectId']),
tabOptions() {
return this.path === 'loan' ? loanTabOptions : tabOptions;
},
rules() {
return this.path === 'loan' ? loanFormRules : createFormRules;
}],
tabCurrent: 1,
path: 'workpoint',
notification: 'workpoint-create-remark',
memberId: '',
memberPopupTitle: '未设置工价',
dateType: 'date'
};
},
canConfirm() {
let flag = true;
this.defaultValidate.map(key => {
if (!this.form[key]) {
flag = false;
}
});
if (this.path === 'loan') {
let key = this.form.type === 'BORROWING' ? 'loanAmount' : 'statementAmount';
if (!this.form[key]) {
flag = false;
}
} else {
if (this.form.type === 'TIME') {
if (this.form.normalNumber <= 0 && this.form.overNumber <= 0&&this.form.rewardAmount<=0) {
computed: {
...mapGetters(['platform', 'prevProjectId']),
tabOptions() {
return this.path === 'loan' ? loanTabOptions : tabOptions;
},
rules() {
return this.path === 'loan' ? loanFormRules : createFormRules;
},
canConfirm() {
let flag = true;
this.defaultValidate.map(key => {
if (key === "happenTime") {
if (this.isDateRange) {
flag = this.form.dateRange.length !== 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;
}
} else {
this.contractorValidate.map(key => {
if (!this.form[key]) {
if (this.form.type === 'TIME') {
if (this.form.normalNumber <= 0 && this.form.overNumber <= 0 && this.form.rewardAmount <= 0) {
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() {
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
}
},
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: '借支/结算'
});
onLoad(options) {
console.log(options);
if (options && options.projectId) {
this.projectId = options.projectId;
this.form.projectId = options.projectId;
}
}
console.log(options.path);
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.type) {
this.form.type = options.type;
}
},
async getBillInfo() {
try {
let { data } = await getBillInfo({ projectId: this.projectId, recordId: this.recordId });
let { dateRange,happenTime, memberId, memberName, type, remark ,attach} = data;
let { normalNumber, normalText, normalType, overNumber, overText, overType, number, unit, unitPrice, amount, rewardAmount } = data.data;
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;
if (options && options.path) {
this.path = options.path;
if (this.path === 'loan') {
this.form.type = 'BORROWING';
uni.setNavigationBarTitle({
title: '借支/结算'
});
}
this.form = form;
console.log("form",form);
this.setWageList();
} catch (e) {
//TODO handle the exception
console.log(e);
}
},
async getProjectInfo() {
try {
let { data } = await getProject({ id: this.projectId });
this.form.projectName = data.name;
} catch (e) {
//TODO handle the exception
console.log(e);
console.log(options.path);
if (this.projectId) {
this.getProjectInfo();
}
if (options && options.recordId) {
this.recordId = options.recordId;
this.dateType = 'date'
this.getBillInfo();
} else {
this.dateType = this.path === 'loan' ? 'date' : 'daterange'
}
},
async getProjectList(text) {
try {
let { data } = await getProjectList();
this.projectList = [...data];
if (!this.projectId) {
if (this.prevProjectId) {
this.projectId = this.prevProjectId;
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);
onReady() {
this.$refs.uForm.setRules(this.rules);
},
onUnload() {
uni.$off(this.notification);
},
onShow() {
if (!this.recordId) {
console.log('------onShow-------');
this.initData();
}
},
setWageList() {
let form = {
...this.form
};
if (this.path !== 'loan') {
if (this.form.type === 'TIME') {
let { normalNumber, normalCustomNumber, normalText, normalType, overNumber, overText, overType, deductText, rewardAmount } = this.form;
form.data = {
methods: {
async initData(text) {
await this.getProjectList(text);
if (this.projectId) {
await this.getMembersOptions();
}
},
async getBillInfo() {
try {
let {
data
} = await getBillInfo({
projectId: this.projectId,
recordId: this.recordId
});
let {
dateRange,
happenTime,
memberId,
memberName,
type,
remark,
attach
} = data;
let {
normalNumber,
normalText,
normalType,
overNumber,
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) {
// return false;
form.data.normalNumber = 0;
if (type.code === 'BORROWING') {
form.loanAmount = amount;
} else if (type.code === 'SETTLE') {
form.statementAmount = amount;
}
// 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 (type.code === 'CONTRACTOR' || type.code === 'SETTLE') {
this.tabCurrent = 2;
}
if (deductText === 1) {
form.data.rewardAmount = 0;
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 {
console.log(deductText);
form.data.rewardAmount = rewardAmount && deductText === '-' ? deductText + rewardAmount : rewardAmount;
form.deductText = 1;
}
this.getCalculateDetail(form);
this.form = form;
console.log("form", form);
this.setWageList();
} catch (e) {
//TODO handle the exception
console.log(e);
}
}
},
async getCalculateDetail(params) {
try {
let { code, data } = await recordCalculateDetail(params);
if (code === 0) {
this.wageList = data;
console.log('wageList', this.wageList);
},
async getProjectInfo() {
try {
let {
data
} = await getProject({
id: this.projectId
});
this.form.projectName = data.name;
} catch (e) {
//TODO handle the exception
console.log(e);
}
} catch (e) {
//TODO handle the exception
}
},
openSelect() {
if (this.recordId) {
return false;
}
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
},
async getProjectList(text) {
try {
let {
data
} = await getProjectList();
this.projectList = [...data];
if (!this.projectId) {
if (this.prevProjectId) {
this.projectId = this.prevProjectId;
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;
},
selectConfirm(e) {
console.log(e);
if (e && e[0]) {
if (this.form.projectId != e[0].value) {
this.form.memberId = [];
},
setWageList() {
let form = {
...this.form
};
if (this.path !== 'loan') {
if (this.form.type === 'TIME') {
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) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
}
});
this.getMembersOptions();
}
this.$refs.uForm.validate();
console.log('confirm====defaultProject', this.defaultProject);
},
toAddProject() {
this.$u.route({
url: '/pages/mine/input/input',
type: 'navigateTo',
params: {
type: 'project-create'
this.selectShow = true;
},
selectConfirm(e) {
console.log(e);
if (e && e[0]) {
if (this.form.projectId != e[0].value) {
this.form.memberId = [];
}
this.form.projectId = e[0].value + '';
this.form.projectName = e[0].label;
this.projectId = e[0].value;
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
}
});
this.getMembersOptions();
}
});
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();
this.$refs.uForm.validate();
console.log('confirm====defaultProject', this.defaultProject);
},
toAddProject() {
this.$u.route({
url: '/pages/mine/input/input',
type: 'navigateTo',
params: {
type: 'project-create'
}
})
.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) {
this.form.unit = e;
},
chooseUnit() {
this.$refs['unit-popup'].open();
},
handleChangeUnit(e) {
this.form.unit = e;
},
chooseUnit() {
this.$refs['unit-popup'].open();
},
workTypeChange(item) {
this.form.normalText = item.value;
if (item.number) {
this.form.normalNumber = item.number;
this.form.normalType = 'UNIT';
}
if (item.value !== 3) {
this.form.normalCustomNumber = '';
this.setWageList();
}
},
workTypeChange(item) {
this.form.normalText = item.value;
if (item.number) {
this.form.normalNumber = item.number;
this.form.normalType = 'UNIT';
}
if (item.value !== 3) {
this.form.normalCustomNumber = '';
this.setWageList();
}
},
overtimeTypeChange(item) {
this.form.overText = item.value;
if (item.value === 1) {
this.form.overNumber = 0;
this.form.overCustomNumber = '';
overtimeTypeChange(item) {
this.form.overText = item.value;
if (item.value === 1) {
this.form.overNumber = 0;
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();
}
},
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();
},
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'];
},
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) {
this.wageList = [];
} else {
if (item.value === 2) {
this.wageList = [];
} 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();
}
},
checkAllUser() {
let flag = this.checkedAll ? false : true;
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;
}
},
toSetting() {
uni.navigateTo({
url: `/pages/workpoint/employees/index?projectId=${this.projectId}`
});
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;
}
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;
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 {
this.form.memberId.push({
memberId: this.membersList[0][1].id
});
// 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)
} else {
this.form.memberId.push({
memberId: this.membersList[0][1].id
});
// this.membersList[0][1].checked = true;
}
});
},
handleListChange(lists) {
this.form.attach = lists;
},
handleClickSure(callback) {
if (this.uploading) {
this.$refs.uToast.show({
title: '图片上传中,请等待片刻',
type: 'warning',
duration: 1500,
callback: () => {
this.focus = 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)
}
});
return;
}
if (this.isDateRange) {
this.form.happenTime = ''
},
handleListChange(lists) {
this.form.attach = lists;
},
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 {
this.form.dateRange = []
dataForm.dateRange = []
}
this.$refs.uForm.validate(valid => {
if (valid) {
console.log('验证通过');
let form = {
...this.form
};
if (this.path === 'loan') {
let { loanAmount, statementAmount } = this.form;
if (this.form.type === 'BORROWING') {
if (!Number(loanAmount)) {
this.showToast('请输入借支金额');
return false;
this.$refs.uForm.validate(valid => {
if (valid) {
console.log('验证通过');
let form = {
...dataForm
};
if (this.path === 'loan') {
let {
loanAmount,
statementAmount
} = dataForm;
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 = {
amount: loanAmount
};
} else if (this.form.type === 'SETTLE') {
if (!Number(statementAmount)) {
this.showToast('请输入结算金额');
return false;
} else {
if (dataForm.type === 'TIME') {
let {
normalNumber,
normalCustomNumber,
normalText,
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 {
if (this.form.type === 'TIME') {
let {
normalNumber,
normalCustomNumber,
normalText,
normalType,
overNumber,
overCustomNumber,
overText,
overType,
deductText,
rewardAmount
} = this.form;
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;
console.log('验证失败');
}
});
},
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 {
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
};
}
}
// console.log(form);
this.edit(form, callback);
} else {
console.log('验证失败');
}
});
},
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();
this.buttonLoading = false;
})
.catch(res => {
this.buttonLoading = false;
if (res.code == -5) {
this.memberId = res.data;
this.memberPopupTitle = res.msg;
this.showMemberPopup = true;
}
});
},
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;
})
.catch(res => {
this.buttonLoading = false;
if (res.code == -5) {
this.memberId = res.data;
this.memberPopupTitle = res.msg;
this.showMemberPopup = true;
if (p.route.indexOf(path2) != -1) {
uni.$emit('projects-changed');
}
});
},
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');
}
if (p.route.indexOf(path2) != -1) {
uni.$emit('projects-changed');
},
toPage() {
var pages = getCurrentPages();
var index = 0;
let path = 'pages/workpoint/project-bill/project-bill';
for (var item of pages) {
if (item.route.indexOf(path) != -1) {
uni.navigateBack({
delta: pages.length - index - 1
});
return;
}
index++;
}
});
},
toPage() {
var pages = getCurrentPages();
var index = 0;
let path = 'pages/workpoint/project-bill/project-bill';
for (var item of pages) {
if (item.route.indexOf(path) != -1) {
uni.navigateBack({
delta: pages.length - index - 1
// 回首页
this.toDetailPage(path);
},
toDetailPage(path) {
this.$u.route({
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
}
});
});
return;
}
index++;
}
// 回首页
this.toDetailPage(path);
},
toDetailPage(path) {
this.$u.route({
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
}
},
async handleConfirmDelete() {
try {
let {
code
} = await deleteBill({
id: this.recordId
});
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
}
});
}
},
async handleConfirmDelete() {
try {
let { code } = await deleteBill({ id: this.recordId });
if (code === 0) {
this.updateOtherPage();
this.$u.route({
type: 'back'
});
},
handleClickFocus() {
if (Number(this.form.actualAmount) == 0) {
this.form.actualAmount = '';
}
} 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
},
handleClickBlur() {
if (!this.form.actualAmount) {
this.form.actualAmount = '0';
}
});
},
handleClickFocus() {
if (Number(this.form.actualAmount) == 0) {
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 = '';
},
handleClickSame() {
if (this.form.receivableAmount) {
this.form.actualAmount = this.form.receivableAmount;
}
this.form.normalText = 3;
this.customPopupTitle = '填写记工工量';
this.customNumberType = this.form.normalType;
} else if (key === 'overCustomNumber') {
if (this.form.overText !== 3) {
this.form.overNumber = '';
},
handleClickShowDateRange() {
this.$refs['calendar-popup'].open();
},
// 日历
calendarChange(e) {
if (this.isDateRange) {
this.form.dateRange = e
} else {
this.form.happenTime = e;
}
this.form.overText = 3;
this.customPopupTitle = '填写加班工量';
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';
},
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 = '填写记工工量';
this.customNumberType = this.form.normalType;
} else if (key === 'overCustomNumber') {
if (this.form.overText !== 3) {
this.form.overNumber = '';
}
this.form.overText = 3;
this.customPopupTitle = '填写加班工量';
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>
<style scoped lang="scss">
/deep/.u-border-bottom:after {
border: 2 solid #f6f7fa !important;
}
/deep/.u-form-item__message {
text-align: right !important;
}
/deep/.u-border-bottom:after {
border: 2 solid #f6f7fa !important;
}
.workpoint-create {
background-color: #f6f7fa;
color: #333333;
.submit-button-box {
width: 100%;
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
padding: 0 24rpx;
background-color: #f6f7fa;
/deep/.u-form-item__message {
text-align: right !important;
}
.content-view {
padding: 0 24rpx;
padding-bottom: 144rpx;
.placeholder {
font-weight: bold;
color: #cccccc;
}
.value-text {
color: #333333;
}
.arrow {
margin-left: 12rpx;
}
.work {
.workpoint-create {
background-color: #f6f7fa;
color: #333333;
.submit-button-box {
width: 100%;
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
padding: 0 24rpx;
background-color: #f6f7fa;
}
.form-slot {
width: 100%;
.check-box {
.content-view {
padding: 0 24rpx;
padding-bottom: 144rpx;
.placeholder {
font-weight: bold;
color: #cccccc;
}
.value-text {
color: #333333;
}
.arrow {
margin-left: 12rpx;
}
.work {
width: 100%;
display: flex;
align-items: center;
.custom-box {
margin-left: 24rpx;
}
.form-slot {
width: 100%;
.check-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
min-width: 136rpx;
max-width: 240rpx;
height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: 2rpx solid #dddddd;
padding: 0 24rpx;
overflow: hidden;
white-space: nowrap;
overflow: hidden;
// word-break: break-all;
&-icon {
margin-top: 2rpx;
.custom-box {
margin-left: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
min-width: 136rpx;
max-width: 240rpx;
height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: 2rpx solid #dddddd;
padding: 0 24rpx;
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 {
width: 100%;
}
.part-view {
padding: 24rpx;
background-color: #ffffff;
border-radius: 16rpx;
margin-top: 24rpx;
padding-top: 0;
.right-view {
.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;
justify-content: flex-end;
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;
justify-content: flex-end;
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;
height: 32rpx;
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;
height: 32rpx;
.value-view {
font-weight: bold;
color: #333333;
text-align: right;
width: 100%;
}
.number-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
border: 2rpx solid #cccccc;
margin-right: 12rpx;
font-size: 24rpx;
justify-content: flex-end;
}
.checked {
background: $default-color;
border: 2rpx solid $default-color;
color: #ffffff;
.unit-view {
border-left: 2rpx solid #f6f7fa;
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 {
height: 2rpx;
background-color: #f6f7fa;
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;
.line-view {
height: 2rpx;
background-color: #f6f7fa;
margin: 16rpx 0;
}
}
.remark-view {
.maintain-view {
margin-top: 24rpx;
}
.area-view {
margin: 24rpx 0;
height: 240rpx;
padding: 24rpx;
background: #f6f7fa;
width: 100%;
background-color: #ffffff;
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;
.part-view {
margin-top: 0;
}
.images-view {
padding: 24rpx 0;
}
.remark-view {
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 {
position: fixed;
margin: 16rpx 32rpx 36rpx 32rpx;
.confirm-view {
color: #ffffff;
height: 96rpx;
line-height: 96rpx;
font-weight: bold;
font-size: 32rpx;
.bottom-view {
position: fixed;
margin: 16rpx 32rpx 36rpx 32rpx;
.confirm-view {
color: #ffffff;
height: 96rpx;
line-height: 96rpx;
font-weight: bold;
font-size: 32rpx;
}
}
}
.loading-view {
width: 100%;
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;
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: flex-end;
width: 180rpx;
&-icon {
width: 28rpx;
height: 28rpx;
display: flex;
margin-left: 12rpx;
}
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
&-value {
flex: 1;
.custom {
width: 100%;
display: flex;
align-items: center;
&-unit {
margin-left: 12rpx;
justify-content: space-between;
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 = [{
export const tableFooterOptions = [{
value: "upperCase",
label: "大写金额:",
width: "70%",
width: "140px",
},
{
value: "lowerCase",
label: "(小写)",
width: "30%",
width: "55px",
},
]
......
......@@ -49,6 +49,12 @@ export const packageOptions = [
icon: 'file-text',
path: "/pages/mine/import-export/import-export"
},
{
id: 5,
title: '账单回收站',
icon: 'file-text',
path: "/pages/mine/recyled/recyled"
},
{
id: 1,
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