Commit b3db596f authored by 刘文虎's avatar 刘文虎

当前工资

parent 73ac4ccc
;(function() {
let NODE_ENV = 'prod' // dev:开发环境 | test:测试环境 | prod:生产环境
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null
let VERSION = 'v1.0.15'
if (process.env.NODE_ENV === 'development') {
......
......@@ -31,7 +31,8 @@ export function get(data) {
return request({
url: `/rest/bookRecord/detail`,
method: 'GET',
data
data,
noLoading: true
})
}
......@@ -51,3 +52,12 @@ export function deleteByIds(data) {
})
}
// 自动计算当前工资明细
export function recordCalculateDetail(data) {
return request({
url: `/rest/project/record/pre`,
method: 'POST',
data,
noLoading: true
})
}
\ No newline at end of file
......@@ -3,12 +3,12 @@
<view class="mask-view">
<view class="apply-refuse" :style="style">
<view class="title" :style="'color:' + titleColor">{{ title }}</view>
<view class="content-view">
<view class="content-view" :style="{'min-height':$slots.content?0:''}">
<view :class="['content-text-view', { 'has-input': isInput }]" v-if="content">{{ content }}</view>
<view v-if="$slots.content" class="slot-view"><slot name="content" /></view>
<view v-if="isInput&&visible">
<u-input
type="number"
type="digit"
adjust-position
v-model="text"
:focus="focus"
......@@ -112,7 +112,7 @@ export default {
watch: {
visible(val) {
if (!val) {
this.input = '';
// this.input = '';
this.text = '';
this.focus = false;
// wx.offKeyboardHeightChange((res) => {
......@@ -121,6 +121,7 @@ export default {
} else {
console.log('-------watch -----');
if (!this.isInput) return;
this.text=this.input
// const { screenHeight } = wx.getSystemInfoSync()
// this.updatePosition(0)
......
......@@ -40,8 +40,8 @@ export default {
height: 72upx;
display: flex;
align-items: center;
background: #cbede4;
color: #ffffff;
background: #EEEEEE;
color: #8D8D8D;
font-size: 28rpx;
font-weight: bold;
overflow: hidden;
......@@ -68,9 +68,9 @@ export default {
}
}
.left {
background: linear-gradient(70deg, #ffffff 50%, #cbede4 0);
background: linear-gradient(70deg, #ffffff 50%, #EEEEEE 0);
}
.right {
background: linear-gradient(110deg, #cbede4 50%, #ffffff 0);
background: linear-gradient(110deg, #EEEEEE 50%, #ffffff 0);
}
</style>
......@@ -25,7 +25,6 @@
<script>
import NavbarRight from '@/components/navbar-right';
import NoData from '@/components/no-data';
import PopInput from '@/components/pop-input-view';
import SubmitButton from '@/components/submit-button/index.vue';
import { billBaseUrl } from '@/utils/config.js';
import { getList, deleteById, enable, close } from '@/api/mine/timed.js';
......@@ -33,7 +32,6 @@ import { getOfferPriceList,updateOfferPrice } from '@/api/bill/quoted-price.js'
export default {
components: {
NoData,
PopInput,
SubmitButton,
NavbarRight
},
......
......@@ -37,8 +37,8 @@ export default {
height: 72upx;
display: flex;
align-items: center;
background: #cbede4;
color: #ffffff;
background: #EEEEEE;
color: #8D8D8D;
font-size: 28rpx;
font-weight: bold;
overflow: hidden;
......@@ -65,9 +65,9 @@ export default {
}
}
.left {
background: linear-gradient(70deg, #ffffff 50%, #cbede4 0);
background: linear-gradient(70deg, #ffffff 50%, #EEEEEE 0);
}
.right {
background: linear-gradient(110deg, #cbede4 50%, #ffffff 0);
background: linear-gradient(110deg, #EEEEEE 50%, #ffffff 0);
}
</style>
<template>
<view class="wage" v-if="list.length">
<view class="wage-title">当前工资(自动计算)</view>
<view class="wage-table">
<view class="table">
<view class="table-tr table-th">
<view
class="table-td"
:class="{ 'table-td-left': key === 0, 'table-td-right': key === wageTableOptions.length - 1 }"
v-for="(item, key) in wageTableOptions"
:key="key"
>
<text>{{ item.label }}</text>
</view>
</view>
<block v-for="(item, index) in list" :key="index">
<view class="table-tr table-border" v-if="index <= 4 || loadmore">
<view
class="table-td"
:class="{ 'table-td-left': key === 0, 'table-td-right': key === wageTableOptions.length - 1 }"
v-for="(tdItem, key) in wageTableOptions"
:key="key"
>
<view v-if="tdItem.value === 'rewardAmount'">
<text :class="{ deduct: item[tdItem.value]<0 }" v-if="item.rewardText !== 1">
<text>{{ item[tdItem.value] || 0 }}</text>
</text>
</view>
<text v-else>{{ item[tdItem.value] || 0 }}</text>
</view>
</view>
</block>
</view>
</view>
<view class="load-more" @click="change" v-if="list.length > 5">
<u-icon :name="loadmore ? 'arrow-up' : 'arrow-down'" class="load-more-icon"></u-icon>
<text>{{ loadmore ? '收起' : '查看更多' }}</text>
</view>
</view>
</template>
<script>
import { wageTableOptions } from '@/utils/options/workpoint/index.js';
export default {
props: {
list: {
type: Array,
default: () => []
}
},
data() {
return {
wageTableOptions,
loadmore: false
};
},
methods: {
change() {
this.loadmore = !this.loadmore;
}
}
};
</script>
<style lang="scss" scoped>
.wage {
margin-bottom: 24rpx;
.wage-title {
margin: 40rpx 0;
font-size: 28rpx;
color: #333333;
}
.load-more {
margin-top: 12rpx;
padding: 6rpx 0;
font-size: 26rpx;
text-align: center;
color: $default-color;
.load-more-icon {
// margin-top: 2rpx;
margin-right: 12rpx;
}
}
}
.wage-table {
.table {
.table-tr {
width: 100%;
color: #333333;
display: flex;
align-items: center;
}
.table-th {
color: #8d8d8d;
font-weight: bold;
background: #f6f7fa;
}
.table-td {
width: 25%;
padding: 24rpx 6rpx;
font-size: 28rpx;
line-height: 36rpx;
text-align: center;
}
.table-td-left {
text-align: left;
}
.table-td-right {
text-align: right;
}
.deduct {
color: #fc524d;
}
.table-border{
border-bottom: 2rpx solid #F6F7FA;
}
}
}
</style>
<template>
<view class="workpoint-create">
<view class="content-view">
<u-form :model="form" ref="uForm" :error-type="errorType" label-width="180">
<view class="part-view">
<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 v-else>选择项目</text>
<u-icon name="arrow-right" class="arrow" v-if="!recordId"></u-icon>
</view>
</view>
</u-form-item>
<u-form-item label="日期" 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="placeholder" v-else>选择服务日期</view>
<view class="image-view"><image :src="dateImage"></image></view>
</view>
</view>
</u-form-item>
<u-form-item label="成员" :border-bottom="false" prop="memberId" required>
<view class="right-view" v-if="recordId">
<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>
<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>
</view>
</view>
<view class="maintain-view">
<bill-tabs :list="tabOptions" :current="tabCurrent" @change="tabChange"></bill-tabs>
<view class="part-view">
<block v-if="path === 'loan'">
<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"
/>
</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"
/>
</view>
</u-form-item>
</view>
</block>
<block v-else>
<view class="work" v-if="tabCurrent === 1">
<u-form-item label="上班" prop="normalNumber" label-position="top" required>
<view class="form-slot">
<checkbox-groups
:checked="form.normalText"
:customStyle="checkboxCustomStyle"
:options="workTypeOptions"
@handleClick="workTypeChange"
></checkbox-groups>
<view class="custom" v-if="form.normalText === 3">
<view class="custom-label" @click="changeUnit('normalType')">
<text>{{ form.normalType === 'HOURS' ? '按小时' : '按工量' }}</text>
<view class="custom-label-icon"><image :src="customSwitchIcon" mode=""></image></view>
</view>
<view class="custom-value">
<u-input
type="digit"
v-model="form.normalNumber"
placeholder="填写数量"
:clearable="false"
:focus="normalNumberFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurNormalNumber"
:custom-style="inputCustomStyle"
/>
<text class="custom-value-unit">{{ form.normalType === 'HOURS' ? '小时' : '个工' }}</text>
</view>
</view>
</view>
</u-form-item>
<u-form-item label="加班" prop="overNumber" label-position="top">
<view class="form-slot">
<checkbox-groups
:checked="form.overText"
:customStyle="checkboxCustomStyle"
:options="overtimeTypeOptions"
@handleClick="overtimeTypeChange"
></checkbox-groups>
<view class="custom" v-if="form.overText === 3">
<view class="custom-label" @click="changeUnit('overType')">
<text>{{ form.overType === 'HOURS' ? '按小时' : '按工量' }}</text>
<view class="custom-label-icon"><image :src="customSwitchIcon" mode=""></image></view>
</view>
<view class="custom-value">
<u-input
type="digit"
v-model="form.overNumber"
placeholder="填写数量"
:clearable="false"
:focus="overNumberFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurOverNumber"
:custom-style="inputCustomStyle"
/>
<text class="custom-value-unit">{{ form.overType === 'HOURS' ? '小时' : '个工' }}</text>
</view>
</view>
</view>
</u-form-item>
</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"
/>
</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>
</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-form-item>
<u-form-item label="工钱" prop="totalPrice" required>
<view class="right-view">
<view class="placeholder">
<text class="value-text" v-if="totalPrice">{{ totalPrice }}</text>
<text v-else>填写或自动计算</text>
</view>
</view>
</u-form-item>
</view>
</block>
<view class="remark-view" style="display: block">
<view class="lable-view"><text>备注信息</text></view>
<view class="value-view area-view" @click="editRemark">
<scroll-view scroll-y class="scroll-Y">
<view class="remark-text" :class="{ 'placeholder-style': !form.remark }">
<text v-text="form.remark" v-if="form.remark"></text>
<text v-else>填写备注,不超过100字</text>
</view>
</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" />
</view>
</view>
</view>
</view>
</u-form>
</view>
<view class="submit-button-box">
<!-- :disabled="!canConfirm" -->
<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 :date="form.happenTime" 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" />
</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 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 { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
import { getMembers, getProject, getProjectList, update } 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,
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,
SubmitButton,
CalendarPopup,
BillingCategory,
BillTabs
},
data() {
return {
formatCount,
workTypeOptions,
overtimeTypeOptions,
defaultValidate,
timeValidate,
contractorValidate,
unitOptions,
dateImage: baseUrl + 'riqi@3x.png',
customSwitchIcon: billBaseUrl + 'qiehuangongliang@3x.png',
showDeletePopup: false,
showMemberPopup: false,
selectShow: false,
loading: false,
uploading: false,
projectList: [],
defaultProject: [],
normal: '',
over: '',
errorType:['message'],
form: {
projectId: '',
projectName: '',
happenTime: this.resetHappenTime(new Date()),
memberId: [],
remark: '',
type: 'TIME', // 类型 TIME:记工-点工;CONTRACTOR:记工-包工;BORROWING:借支;SETTLE:结算
// 点工
normalNumber: 1,
normalText: 1,
normalType: 'UNIT',
overNumber: '',
overText: 1,
overType: 'UNIT',
// 包工
number: '',
unit: '',
unitPrice: '',
// 借支/结算
amount: '',
loanAmount: '',
statementAmount: ''
},
normalNumberFocus: false,
overNumberFocus: 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'
},
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: '202rpx',
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: [
{
id: 'setting',
name: '管理'
}
],
tabCurrent: 1,
path: 'workpoint',
notification: 'workpoint-create-remark',
memberId: '',
memberPopupTitle: '未设置工价'
};
},
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 (!this.form[key]) {
flag = false;
}
});
if (this.path === 'loan') {
let key = this.form.type === 'BORROWING' ? 'loanAmount' : 'statementAmount';
if (!this.form[key]) {
flag = false;
}
} else {
let validate = this.form.type === 'TIME' ? this.timeValidate : this.contractorValidate;
validate.map(key => {
if (!this.form[key]) {
flag = false;
}
});
}
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;
}
},
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: '借支/结算'
});
}
}
console.log(options.path);
if (this.projectId) {
this.getProjectInfo();
}
if (options && options.recordId) {
this.recordId = options.recordId;
this.getBillInfo();
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
onUnload() {
uni.$off('maintain-bill-detail');
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();
}
},
async getBillInfo() {
try {
let { data } = await getBillInfo({ projectId: this.projectId, recordId: this.recordId });
let { happenTime, memberId, memberName, type, remark } = data;
let { normalNumber, normalText, normalType, overNumber, overText, overType, number, unit, unitPrice, amount } = data.data;
let form = {
...this.form,
happenTime,
memberName,
type: type.code,
remark,
// 点工
normalNumber: normalNumber || 1,
normalText: normalText || 1,
normalType: (normalType && normalType.code) || 'UNIT',
overNumber,
overText: overText || 1,
overType: (overType && overType.code) || 'UNIT',
// 包工
number,
unit,
unitPrice,
// 借支/结算
amount
};
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
}
];
this.form = form;
console.log(form);
} 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);
}
},
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);
}
},
openSelect() {
if (this.recordId) {
return false;
}
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
}
});
this.selectShow = true;
},
selectConfirm(e) {
console.log(e);
if (e && e[0]) {
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'
}
});
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();
},
changeUnit(type) {
this.form[type] = this.form[type] && this.form[type] === 'UNIT' ? 'HOURS' : 'UNIT';
},
workTypeChange(item) {
this.form.normalText = item.value;
if (item.number) {
this.form.normalNumber = item.number;
this.form.normalType = 'UNIT';
}
if (item.value === 3) {
this.normalNumberFocus = true;
} else {
this.normalNumberFocus = false;
}
},
onBlurNormalNumber() {
this.normalNumberFocus = false;
},
overtimeTypeChange(item) {
this.form.overText = item.value;
if (item.value === 1) {
this.form.overNumber = 0;
}
if (item.value === 3) {
this.overNumberFocus = true;
} else {
this.overNumberFocus = false;
}
},
onBlurOverNumber() {
this.overNumberFocus = false;
},
tabChange(item) {
this.tabCurrent = item.value;
this.form.type = item.type;
this.errorType=['none']
this.$nextTick(()=>{
this.$refs.uForm.validate(()=>{
setTimeout(()=>{
this.errorType=['message']
})
})
})
},
checkAllUser() {
let flag = this.checkedAll ? false : true;
this.$refs['billing-category'].checkAll(flag);
},
membersChange(ids) {
this.form.memberId = ids;
},
toSetting() {
uni.navigateTo({
url: `/pages/workpoint/employees/index?projectId=${this.projectId}`
});
uni.$on(this.notification, res => {
this.getMembersOptions();
});
},
async getMembersOptions() {
try {
let { data } = await getMembers({ projectId: this.projectId });
let list = [];
data.map((item, index) => {
item.checked = false;
if (index === 0) {
item.checked = true;
}
});
this.membersLength = data.length;
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;
}
},
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)
}
});
},
repairDetail() {
this.loading = true;
repairDetail({
id: this.projectId
})
.then(res => {
if (res.data) {
this.setForm(res.data);
}
this.loading = false;
})
.catch(res => {
this.loading = false;
});
},
setForm(data) {
this.form = {
id: data.id,
templateName: data.customer.name,
customerPhone: data.customer.phone,
receivableAmount: data.receivableAmount,
actualAmount: data.actualAmount,
repairTime: data.repairTime,
address: data.address,
latitude: data.latitude,
longitude: data.longitude,
remark: data.remark,
attach: data.attach,
type: data.type, // 收据样式
// 编辑情况下,下一页的数据
expenseDetails: data.expenseDetails,
faultRecord: data.faultRecord
};
},
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;
}
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;
}
form.data = {
amount: loanAmount
};
} else if (this.form.type === 'SETTLE') {
if (!Number(statementAmount)) {
this.showToast('请输入结算金额');
return false;
}
form.data = {
amount: statementAmount
};
}
} else {
if (this.form.type === 'TIME') {
let { normalNumber, normalText, normalType, overNumber, overText, overType } = 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;
}
} else if (this.form.type === 'CONTRACTOR') {
let { number, unit, unitPrice } = this.form;
form.data = {
number,
unit,
unitPrice
};
}
}
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');
}
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++;
}
// 回首页
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
}
});
},
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) {
this.form.happenTime = e;
},
resetHappenTime(time) {
return this.parseTime(time, '{y}-{m}-{d}');
}
}
};
</script>
<style scoped lang="scss">
/deep/.u-border-bottom:after {
border: 2 solid #f6f7fa !important;
}
/deep/.u-form-item__message {
text-align: right !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;
}
.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%;
}
.form-slot{
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;
.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;
}
}
.checkbox-view {
width: 32rpx;
height: 32rpx;
display: flex;
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;
}
}
.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;
}
.custom {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
margin-top: 8rpx;
&-label {
color: $default-color;
display: flex;
align-items: center;
width: 180rpx;
&-icon {
width: 28rpx;
height: 28rpx;
display: flex;
margin-left: 12rpx;
}
}
&-value {
display: flex;
align-items: center;
justify-content: flex-end;
&-unit {
margin-left: 12rpx;
}
}
}
}
.maintain-view {
margin-top: 24rpx;
width: 100%;
background-color: #ffffff;
border-radius: 16rpx;
.part-view {
margin-top: 0;
}
.images-view {
padding: 24rpx 0;
}
.remark-view {
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;
}
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
}
</style>
<template>
<view class="workpoint-create">
<view class="content-view">
<u-form :model="form" ref="uForm" label-width="180">
<u-form :model="form" ref="uForm" :error-type="errorType" label-width="180">
<view class="part-view">
<u-form-item label="项目名称" prop="projectId" required>
<view class="right-view">
......@@ -75,70 +75,82 @@
<block v-else>
<view class="work" v-if="tabCurrent === 1">
<u-form-item label="上班" prop="normalNumber" label-position="top" required>
<view class="">
<checkbox-groups
:checked="form.normalText"
:customStyle="checkboxCustomStyle"
:options="workTypeOptions"
@handleClick="workTypeChange"
></checkbox-groups>
<view class="custom" v-if="form.normalText === 3">
<view class="custom-label" @click="changeUnit('normalType')">
<text>{{ form.normalType === 'HOURS' ? '按小时' : '按工量' }}</text>
<view class="custom-label-icon"><image :src="customSwitchIcon" mode=""></image></view>
<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"
:class="{ 'custom-box-checked': form.normalText === 3 }"
@click="customNumberClick('normalCustomNumber')"
>
<text class="value-text" v-if="form.normalCustomNumber">
{{ form.normalCustomNumber }}{{ form.normalType === 'HOURS' ? '小时' : '个工' }}
</text>
<text v-else>自定义填写</text>
<u-icon name="edit-pen" class="custom-box-icon"></u-icon>
</view>
<view class="custom-value">
<u-input
type="digit"
v-model="form.normalNumber"
placeholder="填写数量"
:clearable="false"
:focus="normalNumberFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurNormalNumber"
:custom-style="inputCustomStyle"
/>
<text class="custom-value-unit">{{ form.normalType === 'HOURS' ? '小时' : '个工' }}</text>
</view>
</view>
</u-form-item>
<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"
:options="overtimeTypeOptions"
@handleClick="overtimeTypeChange"
></checkbox-groups>
<view
class="custom-box placeholder"
:class="{ 'custom-box-checked': form.overText === 3 }"
@click="customNumberClick('overCustomNumber')"
>
<text class="value-text" v-if="form.overCustomNumber">
{{ form.overCustomNumber }}{{ form.overType === 'HOURS' ? '小时' : '个工' }}
</text>
<text v-else>自定义填写</text>
<u-icon name="edit-pen" class="custom-box-icon"></u-icon>
</view>
</view>
</view>
</u-form-item>
<u-form-item label="加班" prop="overNumber" label-position="top">
<view class="">
<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.overText"
:checked="form.deductText"
:customStyle="checkboxCustomStyle"
:options="overtimeTypeOptions"
@handleClick="overtimeTypeChange"
:options="deductTypeOptions"
@handleClick="deductTypeChange"
></checkbox-groups>
<view class="custom" v-if="form.overText === 3">
<view class="custom-label" @click="changeUnit('overType')">
<text>{{ form.overType === 'HOURS' ? '按小时' : '按工量' }}</text>
<view class="custom-label-icon"><image :src="customSwitchIcon" mode=""></image></view>
</view>
<view class="custom-value">
<u-input
type="digit"
v-model="form.overNumber"
placeholder="填写数量"
:clearable="false"
:focus="overNumberFocus"
input-align="right"
height="56"
maxlength="11"
cursor-spacing="50"
@blur="onBlurOverNumber"
:custom-style="inputCustomStyle"
/>
<text class="custom-value-unit">{{ form.overType === 'HOURS' ? '小时' : '个工' }}</text>
</view>
</view>
</view>
</u-form-item>
<!-- 补扣 -->
<view class="deduct">
<view class="deduct-box" v-if="form.deductText !== 1">
<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>
<view class="overtime" v-else>
<u-form-item label="工程量" prop="number" required>
......@@ -214,7 +226,6 @@
</u-form>
</view>
<view class="submit-button-box">
<!-- :disabled="!canConfirm" -->
<bottom-buttons
showCancel
:loading="buttonLoading"
......@@ -245,6 +256,30 @@
></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" />
<PopInput :title="customPopupTitle" type="text" sureText="确定" placeholder="请输入工量" :visible.sync="customInputShow" @click="handleConfirmCustom">
<view class="custom" slot="content">
<view class="custom-value">
<u-input
type="digit"
v-model="customNumberValue"
placeholder="填写数量"
:clearable="false"
:focus="customNumberFocus"
input-align="right"
height="56"
maxlength="6"
cursor-spacing="50"
@blur="onBlurCustomNumber"
:custom-style="popupInputCustomStyle"
/>
<!-- <text class="custom-value-unit">{{ customNumberType === 'HOURS' ? '小时' : '个工' }}</text> -->
</view>
<view class="custom-label" @click="changeUnit">
<text>{{ customNumberType === 'HOURS' ? '按小时' : '按工量' }}</text>
<view class="custom-label-icon"><image :src="customSwitchIcon" mode=""></image></view>
</view>
</view>
</PopInput>
</view>
</template>
......@@ -259,8 +294,9 @@ 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 } from '@/api/workpoint/index.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';
......@@ -270,6 +306,8 @@ import {
loanTabOptions,
workTypeOptions,
overtimeTypeOptions,
deductTypeOptions,
wageTableOptions,
createFormRules,
loanFormRules,
defaultValidate,
......@@ -290,13 +328,16 @@ export default {
SubmitButton,
CalendarPopup,
BillingCategory,
BillTabs
BillTabs,
WageTable
},
data() {
return {
formatCount,
workTypeOptions,
overtimeTypeOptions,
deductTypeOptions,
wageTableOptions,
defaultValidate,
timeValidate,
contractorValidate,
......@@ -310,8 +351,10 @@ export default {
uploading: false,
projectList: [],
defaultProject: [],
wageList: [],
normal: '',
over: '',
errorType: ['message'],
form: {
projectId: '',
projectName: '',
......@@ -320,12 +363,19 @@ export default {
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: '',
......@@ -335,9 +385,13 @@ export default {
loanAmount: '',
statementAmount: ''
},
normalNumberFocus: false,
overNumberFocus: false,
customNumberKey: '',
customNumberType: 'UNIT',
customNumberValue: '',
customInputShow: false,
customNumberFocus: false,
customPopupTitle: '填写记工工量',
rewardAmountFocus: false,
showDatePicker: false,
buttonLoading: false,
projectId: '',
......@@ -356,6 +410,26 @@ export default {
'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',
......@@ -374,7 +448,7 @@ export default {
'min-height': '240rpx'
},
checkboxCustomStyle: {
width: '202rpx',
width: '136rpx',
height: '80rpx'
},
customConFirm: {
......@@ -519,7 +593,7 @@ export default {
try {
let { data } = await getBillInfo({ projectId: this.projectId, recordId: this.recordId });
let { happenTime, memberId, memberName, type, remark } = data;
let { normalNumber, normalText, normalType, overNumber, overText, overType, number, unit, unitPrice, amount } = data.data;
let { normalNumber, normalText, normalType, overNumber, overText, overType, number, unit, unitPrice, amount, rewardAmount } = data.data;
let form = {
...this.form,
......@@ -555,6 +629,21 @@ export default {
memberId: memberId
}
];
if (normalText === 3) {
form.normalCustomNumber = normalNumber;
}
if (overText === 3) {
form.overCustomNumber = overNumber;
}
if (rewardAmount > 0) {
form.deductText = '+';
form.rewardAmount=rewardAmount
} else if (rewardAmount < 0) {
form.deductText = '-';
form.rewardAmount=rewardAmount.replace('-','')
} else {
form.deductText = 1;
}
this.form = form;
console.log(form);
} catch (e) {
......@@ -601,6 +690,51 @@ export default {
console.log(e);
}
},
setWageList() {
let form = {
...this.form
};
if (this.path !== 'loan') {
if (this.form.type === 'TIME') {
let { normalNumber, normalText, normalType, overNumber, overText, overType, deductText, rewardAmount } = this.form;
form.data = {
normalNumber,
normalText,
normalType,
overNumber,
overText,
overType
};
if (Number(normalNumber) <= 0) {
return false;
}
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;
......@@ -615,6 +749,9 @@ export default {
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;
......@@ -651,8 +788,7 @@ export default {
title: '项目创建成功',
type: 'success',
duration: 1500,
callback: () => {
}
callback: () => {}
});
this.projectId = data;
this.initData();
......@@ -669,41 +805,60 @@ export default {
chooseUnit() {
this.$refs['unit-popup'].open();
},
changeUnit(type) {
this.form[type] = this.form[type] && this.form[type] === 'UNIT' ? 'HOURS' : 'UNIT';
},
workTypeChange(item) {
this.form.normalText = item.value;
if (item.number) {
this.form.normalNumber = item.number;
this.form.normalType = 'UNIT';
}
if (item.value === 3) {
this.normalNumberFocus = true;
} else {
this.normalNumberFocus = false;
if (item.value !== 3) {
this.form.normalCustomNumber = '';
this.setWageList();
}
},
onBlurNormalNumber() {
this.normalNumberFocus = false;
},
overtimeTypeChange(item) {
this.form.overText = item.value;
if (item.value === 1) {
this.form.overNumber = 0;
this.form.overCustomNumber = '';
this.setWageList();
}
if (item.value === 3) {
this.overNumberFocus = true;
} else {
this.overNumberFocus = false;
},
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();
},
onBlurOverNumber() {
this.overNumberFocus = false;
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 {
this.setWageList();
}
},
checkAllUser() {
let flag = this.checkedAll ? false : true;
......@@ -711,6 +866,7 @@ export default {
},
membersChange(ids) {
this.form.memberId = ids;
this.setWageList();
},
toSetting() {
uni.navigateTo({
......@@ -757,6 +913,7 @@ export default {
});
// this.membersList[0][1].checked = true;
}
this.setWageList();
},
chunk(arr, num) {
let newArray = [];
......@@ -856,7 +1013,18 @@ export default {
}
} else {
if (this.form.type === 'TIME') {
let { normalNumber, normalText, normalType, overNumber, overText, overType } = this.form;
let {
normalNumber,
normalCustomNumber,
normalText,
normalType,
overNumber,
overCustomNumber,
overText,
overType,
deductText,
rewardAmount
} = this.form;
form.data = {
normalNumber,
normalText,
......@@ -869,6 +1037,12 @@ export default {
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 (this.form.type === 'CONTRACTOR') {
let { number, unit, unitPrice } = this.form;
......@@ -879,7 +1053,7 @@ export default {
};
}
}
// console.log(form);
this.edit(form, callback);
} else {
console.log('验证失败');
......@@ -1016,6 +1190,39 @@ export default {
},
resetHappenTime(time) {
return this.parseTime(time, '{y}-{m}-{d}');
},
changeUnit() {
this.customNumberType = this.customNumberType === 'UNIT' ? 'HOURS' : 'UNIT';
},
customNumberClick(key) {
if (key === 'normalCustomNumber') {
this.form.normalText = 3;
this.form.normalNumber = '';
this.customPopupTitle = '填写记工工量';
this.customNumberType = this.form.normalType;
} else if (key === 'overCustomNumber') {
this.form.overText = 3;
this.form.overNumber = '';
this.customPopupTitle = '填写加班工量';
this.customNumberType = this.form.overType;
}
this.customNumberKey = key;
this.customNumberValue = this.form[key];
this.customInputShow = true;
setTimeout(() => {
this.customNumberFocus = true;
}, 300);
},
handleConfirmCustom() {
this.form[this.customNumberKey] = this.customNumberValue;
if (this.customNumberKey === 'normalCustomNumber') {
this.form.normalType = this.customNumberType;
this.form.normalNumber = this.customNumberValue;
} else if (this.customNumberKey === 'overCustomNumber') {
this.form.overType = this.customNumberType;
this.form.overNumber = this.customNumberValue;
}
this.setWageList();
}
}
};
......@@ -1053,7 +1260,51 @@ export default {
.arrow {
margin-left: 12rpx;
}
.work{
.work {
width: 100%;
}
.form-slot {
width: 100%;
.check-box {
width: 100%;
display: flex;
align-items: center;
.custom-box {
margin-left: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
width: 240rpx;
height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: 2rpx solid #dddddd;
padding: 0 24rpx;
overflow: hidden;
&-icon {
margin-top: 2rpx;
}
}
.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;
}
.wage {
width: 100%;
}
.part-view {
......@@ -1103,8 +1354,10 @@ export default {
font-weight: bold;
color: #333333;
text-align: right;
width: 100%;
}
.number-view {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
......@@ -1124,35 +1377,6 @@ export default {
background-color: #f6f7fa;
margin: 16rpx 0;
}
.custom {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
margin-top: 8rpx;
&-label {
color: $default-color;
display: flex;
align-items: center;
width: 180rpx;
&-icon {
width: 28rpx;
height: 28rpx;
display: flex;
margin-left: 12rpx;
}
}
&-value {
display: flex;
align-items: center;
justify-content: flex-end;
&-unit {
margin-left: 12rpx;
}
}
}
}
.maintain-view {
margin-top: 24rpx;
......@@ -1211,5 +1435,34 @@ export default {
left: 0;
position: fixed;
}
.custom {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
&-label {
color: $default-color;
display: flex;
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>
......@@ -32,19 +32,53 @@ export const workTypeOptions = [{
number: 0.5,
label: "半个工"
},
{
value: 3,
label: "自定义"
},
]
export const overtimeTypeOptions = [{
value: 1,
label: "无"
},
]
export const deductTypeOptions = [{
value: 1,
label: "无"
},
{
value: '+',
label: "加+"
},
{
value: '-',
label: "减-"
},
]
export const wageTableOptions = [{
value: 'memberName',
label: "姓名",
width:'28%'
},
{
value: 'normalAmount',
label: "上班",
width:'18%'
},
{
value: 'overAmount',
label: "加班",
width:'18%'
},
{
value: 'rewardAmount',
label: "补扣",
width:'18%'
},
{
value: 3,
label: "自定义"
value: 'amount',
label: "合计",
width:'18%'
},
]
......
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