Commit a8ea6fea by zhangzhen

功能优化

parent ed9fb6a1
...@@ -113,3 +113,9 @@ export const getProList = (params,pageData) => { ...@@ -113,3 +113,9 @@ export const getProList = (params,pageData) => {
} }
export const del = (data) => {
let url = `/service/S_XS_KK_04`
let d = setResultData(data);
return http.post(url, d)
}
...@@ -88,6 +88,34 @@ const setResultData = (data={}) => { ...@@ -88,6 +88,34 @@ const setResultData = (data={}) => {
return paramsData return paramsData
} }
const setResultDataForList = (list=[]) => {
let paramsData = {
"__version__": "2.0",
"__sys__": {},
"__blocks__": {
"result": {
"attr": {},
"meta": {
"columns": []
},
"rows": []
}
}
}
let keyList = Object.keys(list[0]);
keyList.forEach((item, index) => {
paramsData.__blocks__.result.meta.columns.push({
pos: index,
name: item
})
})
list.forEach(item => {
paramsData.__blocks__.result.rows.push(Object.values(item));
})
return paramsData
}
const setResultDataAndDetail = (data={},detail={}) => { const setResultDataAndDetail = (data={},detail={}) => {
let obj = {} let obj = {}
for (let i in data) { for (let i in data) {
...@@ -220,6 +248,13 @@ export const save = (data) => { ...@@ -220,6 +248,13 @@ export const save = (data) => {
} }
export const updateList = (data) => {
let url = `/service/S_CW_FK_06`
let d = setResultDataForList(data);
return http.post(url, d)
}
// 审核 // 审核
export const updateSubmitStatus = (data) => { export const updateSubmitStatus = (data) => {
let url = `/service/S_CW_FK_02` let url = `/service/S_CW_FK_02`
......
...@@ -21,7 +21,7 @@ const setParamsData = (data = {},pageData) => { ...@@ -21,7 +21,7 @@ const setParamsData = (data = {},pageData) => {
"result": { "result": {
"attr": { "attr": {
count: 0, count: 0,
limit: pageData && pageData.limit? pageData.limit : 10, limit: pageData && pageData.limit? pageData.limit : 100,
offset: pageData && pageData.offset? pageData.offset*pageData.limit : 0, offset: pageData && pageData.offset? pageData.offset*pageData.limit : 0,
orderBy: "", orderBy: "",
showCount: pageData && pageData.showCount? pageData.showCount : "true" showCount: pageData && pageData.showCount? pageData.showCount : "true"
...@@ -146,6 +146,17 @@ export const getList = (params,pageData) => { ...@@ -146,6 +146,17 @@ export const getList = (params,pageData) => {
return http.post(url, d) return http.post(url, d)
} }
export const getSubList = (data) => {
let url = `/service/S_XS_JS_03`
return http.post(url, data)
}
export const saveSubList = (data) => {
let url = `/service/S_XS_JS_04`
let d = setResultDataAndDetail({},data)
return http.post(url, d)
}
export const save = (data,Detail) => { export const save = (data,Detail) => {
let url = `/service/S_XS_JS_02` let url = `/service/S_XS_JS_02`
let d = setResultDataAndDetail(data,Detail); let d = setResultDataAndDetail(data,Detail);
...@@ -164,6 +175,12 @@ export const getProList = (params,pageData) => { ...@@ -164,6 +175,12 @@ export const getProList = (params,pageData) => {
return http.post(url, d) return http.post(url, d)
} }
export const getProList2 = (params,pageData) => {
let url = `/service/S_CW_HT_02`
let d = setParamsData(params,pageData)
return http.post(url, d)
}
export const getList1 = (params,pageData) => { export const getList1 = (params,pageData) => {
let url = `/service/S_CW_QZ_01` let url = `/service/S_CW_QZ_01`
let d = setParamsData(params,pageData) let d = setParamsData(params,pageData)
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
</view> </view>
<view class="text-blue"> <view class="text-blue">
<u-input v-model="orderInfo.totalContractPriceIncluding" color="#0081ff" inputAlign="right" <u-input v-model="orderInfo.totalContractPriceIncluding" color="#0081ff" inputAlign="right"
type="text" :border="border" placeholder="请输入扣款金额" /> type="number" :border="border" placeholder="请输入扣款金额" />
</view> </view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
content: "请确认是否进行新增扣款单?", content: "请确认是否进行新增扣款单?",
statusBarHeight: uni.getStorageSync("statusHeight") || 0, statusBarHeight: uni.getStorageSync("statusHeight") || 0,
orderInfo: { orderInfo: {
reviewStatus:'3', reviewStatus:'0',
signingDate: moment().format("YYYY-MM-DD") signingDate: moment().format("YYYY-MM-DD")
}, },
}; };
......
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
<view v-if="orderInfo.reviewStatus && orderInfo.reviewStatus!=3" class="footer-box"> <view v-if="orderInfo.reviewStatus && orderInfo.reviewStatus!=3" class="footer-box">
<button class="cu-btn block bg-blue" @tap="onSubmit(1)">提交</button> <button class="cu-btn block bg-blue" @tap="onSubmit(1)">提交</button>
<button class="cu-btn block bg-red" @tap="onSubmit(2)">删除</button>
</view> </view>
<u-calendar :show="show2" mode="single" :defaultDate="orderInfo.signingDate" :minDate="minDate" :monthNum='4' <u-calendar :show="show2" mode="single" :defaultDate="orderInfo.signingDate" :minDate="minDate" :monthNum='4'
@confirm="onConfirm" @close="onCancel"></u-calendar> @confirm="onConfirm" @close="onCancel"></u-calendar>
...@@ -138,7 +139,8 @@ ...@@ -138,7 +139,8 @@
} from "@/api/product-warehousing.js"; } from "@/api/product-warehousing.js";
import { import {
getList, getList,
updateSubmitStatus updateSubmitStatus,
del
} from "@/api/debit-note.js"; } from "@/api/debit-note.js";
export default { export default {
...@@ -171,6 +173,8 @@ ...@@ -171,6 +173,8 @@
}, },
methods: { methods: {
onSubmit(t) { onSubmit(t) {
this.submitType = t;
this.content = t==1? '请确认是否进行审核操作?':'请确认是否进行删除操作?'
this.show = true this.show = true
}, },
onOpenCalendar() { onOpenCalendar() {
...@@ -189,6 +193,7 @@ ...@@ -189,6 +193,7 @@
uni.showLoading({ uni.showLoading({
title: "加载中..." title: "加载中..."
}) })
if(this.submitType == 1){
updateSubmitStatus({ updateSubmitStatus({
...this.orderInfo, ...this.orderInfo,
reviewStatus:3 reviewStatus:3
...@@ -200,10 +205,25 @@ ...@@ -200,10 +205,25 @@
title: "提交成功" title: "提交成功"
}) })
setTimeout(() => { setTimeout(() => {
this.onGetList();
}, 1500)
}
})
}else{
del(this.orderInfo).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
uni.showToast({
icon: "success",
title: "提交成功"
})
setTimeout(() => {
this.onBack(); this.onBack();
}, 1500) }, 1500)
} }
}) })
}
}, },
onBack() { onBack() {
uni.redirectTo({ uni.redirectTo({
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<text class="text-white">选择项目</text> <text class="text-white">选择项目</text>
</block> </block>
<block slot="right"> <block slot="right">
<text class="text-green text-bold text-lg margin-right" @tap="onCheck">确 定</text> <text class="text-white text-bold text-lg margin-right" @tap="onCheck">确 定</text>
</block> </block>
</cu-custom> </cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}"> <view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
......
...@@ -323,7 +323,12 @@ ...@@ -323,7 +323,12 @@
url: `/pages/payment-order/index?checkedId=${checkedId}`, url: `/pages/payment-order/index?checkedId=${checkedId}`,
events: { events: {
acceptDataFromOpenedPage: (data) => { acceptDataFromOpenedPage: (data) => {
this.selectList = data.data; this.selectList = data.data.map(item => {
return {
...item,
thisAmount: Number(item.remainingAmount)
}
});
this.$forceUpdate(); this.$forceUpdate();
} }
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
</view> </view>
</block> </block>
<block slot="content"> <block slot="content">
<text class="text-white">结算单详情</text> <text class="text-white">付款单详情</text>
</block> </block>
<block slot="right"> <block slot="right">
<view v-if="subList && subList.length" class="right-btn" @tap="onEditOrSave"> <view v-if="orderInfo.reviewStatus == '0' && subList && subList.length" class="right-btn" @tap="onEditOrSave">
<text class="text-white">{{isEdit? '保存' : '编辑'}}</text> <text class="text-white">{{isEdit? '保存' : '编辑'}}</text>
</view> </view>
</block> </block>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<view class="flex-col content-part-1 content-part-2"> <view class="flex-col content-part-1 content-part-2">
<view class="flex-row header"> <view class="flex-row header">
<text class="text-lg text-bold text-black">清单明细</text> <text class="text-lg text-bold text-black">付款清单</text>
</view> </view>
<view class="form-content-box margin-bottom"> <view class="form-content-box margin-bottom">
<view v-for="(item,i) in subList" :key="i" class="sub-item-box"> <view v-for="(item,i) in subList" :key="i" class="sub-item-box">
...@@ -121,9 +121,19 @@ ...@@ -121,9 +121,19 @@
<text>{{item.contractNumber}}</text> <text>{{item.contractNumber}}</text>
</view> </view>
</view> </view>
<view v-if="item.remainingAmount" class="cu-form-group">
<view class="title">
<text>剩余金额:</text>
</view>
<view class="">
<text>{{Number(item.remainingAmount)}}</text>
</view>
</view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text>收款额:</text> <text>收款额:</text>
</view> </view>
<view v-if="isEdit && item.isEdit" class=""> <view v-if="isEdit && item.isEdit" class="">
<u-input v-model="item.totalContractPriceIncluding" <u-input v-model="item.totalContractPriceIncluding"
...@@ -134,6 +144,15 @@ ...@@ -134,6 +144,15 @@
<text>{{item.totalContractPriceIncluding}}</text> <text>{{item.totalContractPriceIncluding}}</text>
</view> </view>
</view> </view>
<view class="cu-form-group">
<view class="title">
<text>创建时间:</text>
</view>
<view class="">
<text>{{item.createdDate}}</text>
</view>
</view>
</form> </form>
...@@ -163,13 +182,14 @@ ...@@ -163,13 +182,14 @@
<script> <script>
import { getDict } from '@/api/index.js'; import { getDict } from '@/api/index.js';
import { import {
toJsonData toJsonData,
formatForLen14
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import moment from "@/common/moment.js"; import moment from "@/common/moment.js";
import { import {
getParamsData getParamsData
} from "@/api/product-warehousing.js"; } from "@/api/product-warehousing.js";
import { getList,getSubList,updateSubmitStatus,updateWriteoffStatus } from "@/api/payment-order.js"; import { getList,getSubList,updateSubmitStatus,updateWriteoffStatus,updateList,saveBySelect } from "@/api/payment-order.js";
export default { export default {
data() { data() {
...@@ -200,7 +220,6 @@ ...@@ -200,7 +220,6 @@
}, },
methods: { methods: {
onEditOrSave(){ onEditOrSave(){
if(this.isEdit){ if(this.isEdit){
this.submitType = 3; this.submitType = 3;
this.content = '请确认是否进行数据保存操作?' this.content = '请确认是否进行数据保存操作?'
...@@ -216,21 +235,45 @@ ...@@ -216,21 +235,45 @@
} }
}, },
onNavToSelect() { onNavToSelect() {
if(this.isEdit){
uni.showToast({
icon:"none",
title:"请将数据保存后操作"
})
return
}
let checkedId = ''; let checkedId = '';
if(this.selectList.length){ if(this.subList.length){
checkedId = this.selectList.map(item => item.id).join(); checkedId = this.subList.filter(item => item.isEdit)?.map(item => item.id).join();
} }
this.mainId = this.id;
uni.navigateTo({ uni.navigateTo({
url: `/pages/payment-order/index?checkedId=${checkedId}`, url: `/pages/payment-order/index?mainId=${this.id}&checkedId=${checkedId}`,
events: { events: {
acceptDataFromOpenedPage: (data) => { acceptDataFromOpenedPage: (data) => {
this.selectList = data.data; this.isEdit = true;
let list = data.data.map(item => {
return {
...item,
totalContractPriceIncluding: Number(item.remainingAmount),
isEdit: true
}
});
this.subList = [...list,...this.subList];
console.log(this.subList,99999)
this.$forceUpdate(); this.$forceUpdate();
} }
} }
}) })
}, },
onSubmit(t) { onSubmit(t) {
if(this.isEdit){
uni.showToast({
icon:"none",
title:"请将数据保存后提交"
})
return
}
this.submitType = t; this.submitType = t;
this.content = this.submitType ==1? '请确认是否进行审核通过操作?':"请确认是否进行核销通过操作?" this.content = this.submitType ==1? '请确认是否进行审核通过操作?':"请确认是否进行核销通过操作?"
this.show = true this.show = true
...@@ -279,6 +322,44 @@ ...@@ -279,6 +322,44 @@
}) })
} else if(this.submitType ==3){ } else if(this.submitType ==3){
this.isEdit = false; this.isEdit = false;
if(this.mainId){
let list = this.subList.filter(item => item.isEdit).map(item => {
return {
...item,
thisAmount: item.totalContractPriceIncluding
}
})
saveBySelect(list,{
hiddenConditions:'1',
billState: '1',
mainId: this.mainId
}).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
uni.showToast({
icon: "success",
title: "新增成功"
})
this.mainId = ""
setTimeout(() => {
this.onGetList();
}, 1500)
}
})
}else{
updateList(this.subList).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
uni.showToast({
icon: "success",
title: "操作成功"
})
}
setTimeout(() => {
this.onGetList();
}, 1500)
})
}
} }
}, },
onBack() { onBack() {
...@@ -344,9 +425,11 @@ ...@@ -344,9 +425,11 @@
.columns); .columns);
if (list && list.length) { if (list && list.length) {
this.subList = list.map(item => { this.subList = list.map(item => {
return { return {
...item, ...item,
totalContractPriceIncluding: Number(item.totalContractPriceIncluding) totalContractPriceIncluding: Number(item.totalContractPriceIncluding),
createdDate: formatForLen14(item.createdTime)
} }
}) })
} }
......
...@@ -149,15 +149,13 @@ ...@@ -149,15 +149,13 @@
return { return {
...this.projectDataList[val], ...this.projectDataList[val],
billId: this.projectDataList[val].id, billId: this.projectDataList[val].id,
mainId: this.mainId mainId: this.mainId,
contractNumber: this.projectDataList[val].billNumber
} }
}) })
this.eventChannel.emit('acceptDataFromOpenedPage', {data:list}); this.eventChannel.emit('acceptDataFromOpenedPage', {data:list});
} }
this.onBack(); this.onBack();
}, },
onSelect(k){ onSelect(k){
......
...@@ -109,11 +109,11 @@ ...@@ -109,11 +109,11 @@
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{item.finishQuantity}}</text> <text class="text-title">{{item.finishQuantity}}</text>
</view> </view>
<view class="flex-row"> <!-- <view class="flex-row">
<text class="text-gray part-1">完成状态</text> <text class="text-gray part-1">完成状态</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{Number(item.finishQuantity) >= Number(item.quantity)? '已完工':'未完工'}}</text> <text class="text-title">{{Number(item.finishQuantity) >= Number(item.quantity)? '已完工':'未完工'}}</text>
</view> </view> -->
</view> </view>
...@@ -184,11 +184,11 @@ ...@@ -184,11 +184,11 @@
}, },
{ {
name: '未完工', name: '未完工',
value: 0 value: '0'
}, },
{ {
name: '已完工', name: '已完工',
value: 1 value: '1'
} }
], ],
value: 0, value: 0,
......
...@@ -250,15 +250,14 @@ ...@@ -250,15 +250,14 @@
placeholder="请输入工程量" /> placeholder="请输入工程量" />
</view> </view>
</view> </view>
<!-- <view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text>累计结算工程量:</text> <text>累计结算工程量:</text>
</view> </view>
<view class=""> <view class="">
<u-input v-model="item.cumulativeEngineeringQuantity" :disabled="true" color="#0081ff" <text>{{item.cumulativeEngineeringQuantity}}</text>
inputAlign="right" type="number" :border="border" placeholder="请输入工程量" /> </view>
</view> </view>
</view> -->
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text>单位:</text> <text>单位:</text>
...@@ -285,7 +284,7 @@ ...@@ -285,7 +284,7 @@
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text class="text-xl text-red">*</text> <text class="text-xl text-red">*</text>
<text></text> <text></text>
</view> </view>
<view class="text-blue"> <view class="text-blue">
<text>{{item.totalPrice || 0 }}</text> <text>{{item.totalPrice || 0 }}</text>
...@@ -346,15 +345,6 @@ ...@@ -346,15 +345,6 @@
contractDate: moment().format("YYYY-MM-DD") contractDate: moment().format("YYYY-MM-DD")
}, },
formList: [], formList: [],
settlementCategoryList: [{
value: 1,
label: '过程结算'
},
{
value: 1,
label: '最终结算'
}
],
settlementCategoryIndex: -1, settlementCategoryIndex: -1,
priceTaxSeparationList:[], priceTaxSeparationList:[],
priceTaxSeparationIndex:-1, priceTaxSeparationIndex:-1,
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
<block slot="content"> <block slot="content">
<text class="text-white">结算单详情</text> <text class="text-white">结算单详情</text>
</block> </block>
<block slot="right">
<view v-if="orderInfo.reviewStatus == '2' && subList && subList.length" class="right-btn" @tap="onEditOrSave">
<text class="text-white">{{isEdit? '保存' : '编辑'}}</text>
</view>
</block>
</cu-custom> </cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}"> <view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
...@@ -72,15 +77,66 @@ ...@@ -72,15 +77,66 @@
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text v-if="isEdit" class="text-xl text-red">*</text>
<text>结算类别:</text> <text>结算类别:</text>
</view> </view>
<view class=""> <view v-if="isEdit" class="text-blue">
<picker @change="onTypeChange" :value="settlementTypeIndex"
:range="settlementTypeList" range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ settlementTypeIndex >=0 ? settlementTypeList[settlementTypeIndex].label:'请选择'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
<view v-else class="">
<text>{{settlementTypeEnum[orderInfo.settlementType]}}</text> <text>{{settlementTypeEnum[orderInfo.settlementType]}}</text>
</view> </view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text v-if="isEdit" class="text-xl text-red">*</text>
<text>税点:</text>
</view>
<view v-if="isEdit" class="text-blue">
<picker @change="onTaxChange" :value="taxPointsIndex"
:range="taxPointsList" range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ taxPointsIndex >=0 ? taxPointsList[taxPointsIndex].label:'请选择'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
<view v-else class="">
<text>{{orderInfo.taxPoints}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="isEdit" class="text-xl text-red">*</text>
<text>价税分离:</text>
</view>
<view v-if="isEdit" class="text-blue">
<picker @change="onPriceTaxChange" :value="priceTaxSeparationIndex"
:range="priceTaxSeparationList" range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ priceTaxSeparationIndex >=0 ? priceTaxSeparationList[priceTaxSeparationIndex].label:'请选择'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
<view v-else class="">
<text>{{priceTaxSeparationEnum[orderInfo.priceTaxSeparation]}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>结算金额:</text> <text>结算金额:</text>
</view> </view>
<view class=""> <view class="">
...@@ -109,17 +165,16 @@ ...@@ -109,17 +165,16 @@
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title"> <view class="title">
<text v-if="orderInfo.reviewStatus !=3" class="text-xl text-red">*</text> <text v-if="isEdit" class="text-xl text-red">*</text>
<text>结算日期:</text> <text>结算日期:</text>
</view> </view>
<view v-if="orderInfo.reviewStatus ==3" class=""> <view v-if="isEdit" class="text-blue" @tap="onOpenCalendar">
<text>{{orderInfo.contractDate}}</text>
</view>
<view v-else class="text-blue" @tap="onOpenCalendar">
<text>{{orderInfo.contractDate||"请选择日期"}}</text> <text>{{orderInfo.contractDate||"请选择日期"}}</text>
<text class="cuIcon-right"></text> <text class="cuIcon-right"></text>
</view> </view>
<view v-else class="">
<text>{{orderInfo.contractDate}}</text>
</view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
...@@ -134,8 +189,149 @@ ...@@ -134,8 +189,149 @@
</view> </view>
</view> </view>
<view class="flex-col content-part-1 content-part-2">
<view class="flex-row header">
<text class="text-lg text-bold text-black">结算清单</text>
</view>
<view class="form-content-box margin-bottom">
<view v-for="(item,k) in subList" :key="k" class="sub-item-box">
<form class="item-form">
<view class="cu-form-group">
<view class="title">
<text v-if="item.isEdit" class="text-xl text-red">*</text>
<text>结算依据:</text>
</view>
<view v-if="item.isEdit" class="">
<u-input v-model="item.settlementBasis" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入结算依据" />
</view>
<view v-else class="">
<text>{{item.settlementBasis}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="item.isEdit" class="text-xl text-red">*</text>
<text>任务名称:</text>
</view>
<view v-if="item.isEdit" class="">
<u-input v-model="item.taskName" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入任务名称" />
</view>
<view v-else class="">
<text>{{item.taskName}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="item.isEdit" class="text-xl text-red">*</text>
<text>工程内容:</text>
</view>
<view v-if="item.isEdit" class="">
<u-input v-model="item.engineeringContent" color="#0081ff" inputAlign="right"
type="text" :border="border" placeholder="请输入工程内容" />
</view>
<view v-else class="">
<text>{{item.engineeringContent}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="item.isEdit" class="text-xl text-red">*</text>
<text>结算工程量:</text>
</view>
<view v-if="item.isEdit" class="">
<u-input v-model="item.thisEngineeringQuantity" @change="onPriceChange($event,k)"
color="#0081ff" inputAlign="right" type="number" :border="border"
placeholder="请输入工程量" />
</view>
<view v-else class="">
<text>{{item.thisEngineeringQuantity}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>累计结算工程量:</text>
</view>
<view class="">
<text>{{item.cumulativeEngineeringQuantity}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>单位:</text>
</view>
<view v-if="item.isEdit" class="">
<u-input v-model="item.unit" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入单位" />
</view>
<view v-else class="">
<text>{{item.unit}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="item.isEdit" class="text-xl text-red">*</text>
<text>单价:</text>
</view>
<view v-if="item.isEdit" class="text-blue">
<u-input v-model="item.unitPrice" color="#0081ff" inputAlign="right"
@change="onPriceChange2($event,k)" type="number" :border="border"
placeholder="请输入单价" />
</view>
<view v-else class="">
<text>{{item.unitPrice}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>合计:</text>
</view>
<view class="">
<text>{{item.totalPrice || 0 }}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>备注:</text>
</view>
<view v-if="item.isEdit" class="text-blue">
<u-input v-model="item.remarks" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入备注" />
</view>
<view v-else class="">
<text>{{item.remarks}}</text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text>创建时间:</text>
</view>
<view class="">
<text>{{item.createdDate}}</text>
</view>
</view>
</form>
</view>
</view>
<view v-if="subList.length <= 0" class="empty-box">
<u-empty text="暂无数据" textColor='#C1C1C1' width="120">
</u-empty>
</view>
</view>
<view v-if="orderInfo.reviewStatus && orderInfo.reviewStatus!=3" class="footer-box"> <view v-if="orderInfo.reviewStatus && orderInfo.reviewStatus!=3" class="footer-box">
<button class="cu-btn block bg-blue" @tap="onSubmit(1)">提交</button> <button class="cu-btn block bg-blue" @tap="onSubmit(1)">提交</button>
<button class="cu-btn block bg-blue" @tap="onOpenCheck">选择</button>
</view> </view>
<u-calendar :show="show2" mode="single" :defaultDate="orderInfo.signingDate" :minDate="minDate" :monthNum='4' <u-calendar :show="show2" mode="single" :defaultDate="orderInfo.signingDate" :minDate="minDate" :monthNum='4'
@confirm="onConfirm" @close="onCancel"></u-calendar> @confirm="onConfirm" @close="onCancel"></u-calendar>
...@@ -146,13 +342,15 @@ ...@@ -146,13 +342,15 @@
<script> <script>
import { import {
toJsonData toJsonData,
formatForLen14
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import moment from "@/common/moment.js"; import moment from "@/common/moment.js";
import {getDict} from "@/api/index.js"
import { import {
getParamsData getParamsData
} from "@/api/product-warehousing.js"; } from "@/api/product-warehousing.js";
import { getList } from "@/api/settlement-doc.js"; import { getList,getSubList,saveSubList,save,getProList2 } from "@/api/settlement-doc.js";
export default { export default {
data() { data() {
...@@ -172,10 +370,16 @@ ...@@ -172,10 +370,16 @@
1:'已提交', 1:'已提交',
0:"待审核" 0:"待审核"
}, },
settlementTypeEnum:{ settlementTypeEnum:{},
1:'部分结算', priceTaxSeparationEnum:{},
2:'最终结算' subList:[],
} isEdit: false,
priceTaxSeparationList:[],
priceTaxSeparationIndex:-1,
taxPointsList:[],
taxPointsIndex:-1,
settlementTypeList:[],
settlementTypeIndex:-1
}; };
}, },
onLoad(option) { onLoad(option) {
...@@ -188,7 +392,92 @@ ...@@ -188,7 +392,92 @@
}, },
methods: { methods: {
onTypeChange(e) {
let index = Number(e.target.value);
if (this.settlementTypeIndex === index) return
this.settlementTypeIndex = index;
this.orderInfo.settlementType = this.settlementTypeList[this.settlementTypeIndex].value;
},
onTaxChange(e) {
let index = Number(e.target.value);
if (this.taxPointsIndex === index) return
this.taxPointsIndex = index;
this.orderInfo.taxPoints = this.taxPointsList[this.taxPointsIndex].value;
this.onCalculatePrice()
},
onPriceTaxChange(e) {
let index = Number(e.target.value);
if (this.priceTaxSeparationIndex === index) return
this.priceTaxSeparationIndex = index;
},
onPriceChange(e, i) {
this.subList[i].totalPrice =Number(this.subList[i].unitPrice)*e;
this.$forceUpdate();
this.onCalculatePrice()
},
onPriceChange2(e, i) {
this.subList[i].totalPrice =Number(this.subList[i].thisEngineeringQuantity)*e;
this.$forceUpdate();
this.onCalculatePrice()
},
onCalculatePrice(){
let num = 0
console.log(this.subList,"this.formList")
if(this.subList && this.subList.length){
this.subList.forEach(item=>{
if(item.totalPrice){
num += item.totalPrice
}
})
this.orderInfo.thisSettlementAmount = num;//结算金额
this.orderInfo.cumulativeSettlementAmount = num;//累计结算金额
if(Number(this.orderInfo.taxPoints) > 0){
this.orderInfo.thisPriceTax =(num*(1+Number(this.orderInfo.taxPoints)/100)).toFixed(2); //含税金额
this.orderInfo.cumulativePriceTax = this.orderInfo.thisPriceTax; // 累计含税金额
this.orderInfo.thisSettlementTax = this.orderInfo.thisPriceTax - num; // 税额
this.orderInfo.cumulativeSettlementTax = this.orderInfo.thisSettlementTax; // 累计税额
}
console.log(this.orderInfo.thisSettlementAmount)
this.$forceUpdate();
}
},
onEditOrSave(){
if(this.isEdit){
this.submitType = 3;
this.content = '请确认是否进行数据保存操作?'
this.show = true
}else{
this.isEdit = true;
if(this.orderInfo.taxPoints){
this.taxPointsIndex = this.taxPointsList.findIndex(item => item.value == this.orderInfo.taxPoints)
}
if(this.orderInfo.settlementType){
this.settlementTypeIndex = this.settlementTypeList.findIndex(item => item.value == this.orderInfo.settlementType)
}
if(this.orderInfo.priceTaxSeparation){
this.priceTaxSeparationIndex = this.priceTaxSeparationList.findIndex(item => item.value == this.orderInfo.priceTaxSeparation)
}
this.subList = this.subList.map(item => {
return {
...item,
isEdit: true
}
})
}
},
onSubmit(t) { onSubmit(t) {
if(this.isEdit){
uni.showToast({
icon:"none",
title:"请将数据保存后提交"
})
return
}
this.show = true this.show = true
}, },
onOpenCalendar() { onOpenCalendar() {
...@@ -207,6 +496,24 @@ ...@@ -207,6 +496,24 @@
uni.showLoading({ uni.showLoading({
title: "加载中..." title: "加载中..."
}) })
if(this.submitType ==3){
saveSubList(this.subList).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
save(this.orderInfo,this.subList).then(res2 => {
if (res2.data.__sys__.status === 0){
uni.showToast({
icon: "success",
title: "提交成功"
})
setTimeout(() => {
this.onGetList();
}, 1500)
}
})
}
})
} else {
updateSubmitStatus({ updateSubmitStatus({
...this.orderInfo, ...this.orderInfo,
reviewStatus:3, reviewStatus:3,
...@@ -223,6 +530,8 @@ ...@@ -223,6 +530,8 @@
}, 1500) }, 1500)
} }
}) })
}
}, },
onBack() { onBack() {
uni.redirectTo({ uni.redirectTo({
...@@ -230,6 +539,36 @@ ...@@ -230,6 +539,36 @@
}) })
}, },
onLoading() { onLoading() {
getDict({
codeset: 'hggp.cw.priceTaxSeparation'
}).then(res => {
if (res.data.list && res.data.list.length) {
this.priceTaxSeparationList = res.data.list
this.priceTaxSeparationList.forEach(item => {
this.priceTaxSeparationEnum[item.value] = item.label
})
}
})
getDict({
codeset: 'hggp.cw.taxPoints'
}).then(res => {
if (res.data.list && res.data.list.length) {
this.taxPointsList = res.data.list
}
})
getDict({
codeset: 'hggp.cw.settlementType'
}).then(res => {
if (res.data.list && res.data.list.length) {
this.settlementTypeList = res.data.list
this.settlementTypeList.forEach(item => {
this.settlementTypeEnum[item.value] = item.label
})
}
})
this.onGetList(); this.onGetList();
}, },
onGetList() { onGetList() {
...@@ -245,11 +584,78 @@ ...@@ -245,11 +584,78 @@
if (list && list.length) { if (list && list.length) {
this.orderInfo = { this.orderInfo = {
...list[0], ...list[0],
contractDate: moment(list[0].contractDate).format("YYYY-MM-DD"),
signingDate: moment(list[0].signingDate).format("YYYY-MM-DD") signingDate: moment(list[0].signingDate).format("YYYY-MM-DD")
} }
this.onGetSubList()
} }
}) })
},
onGetSubList(){
uni.showLoading({
title: "加载中"
})
getSubList({
id: this.id
}).then(res => {
uni.hideLoading()
let list = toJsonData(res.data.__blocks__.detail1.rows, res.data.__blocks__.detail1.meta.columns);
if(list && list.length){
this.subList = list.map(item => {
return {
...item,
thisEngineeringQuantity: Number(item.thisEngineeringQuantity),
unitPrice: Number(item.unitPrice),
cumulativeEngineeringQuantity: Number(item.cumulativeEngineeringQuantity),
totalPrice: Number(item.totalPrice),
createdDate: formatForLen14(item.createdTime)
}
});
}
})
},
onOpenCheck () {
if(this.isEdit){
uni.showToast({
icon:"none",
title:"请将数据保存后操作"
})
return
}
getProList2({
contractNumber: this.orderInfo.contractNumber
}).then(res => {
console.log(res,99999)
})
},
onNavToSelect() {
let checkedId = '';
if(this.subList.length){
checkedId = this.subList.filter(item => item.isEdit)?.map(item => item.id).join();
}
this.mainId = this.id;
uni.navigateTo({
url: `/pages/payment-order/index?mainId=${this.id}&checkedId=${checkedId}`,
events: {
acceptDataFromOpenedPage: (data) => {
this.isEdit = true;
let list = data.data.map(item => {
return {
...item,
totalContractPriceIncluding: Number(item.totalContractPriceIncluding),
isEdit: true
}
});
this.subList = [...list,...this.subList];
console.log(this.subList,99999)
this.$forceUpdate();
}
}
})
} }
} }
} }
...@@ -580,7 +986,11 @@ ...@@ -580,7 +986,11 @@
display: flex; display: flex;
background-color: transparent; background-color: transparent;
justify-content: center; justify-content: center;
.cu-form-group{
.title{
width: 280upx;
}
}
} }
} }
...@@ -606,4 +1016,10 @@ ...@@ -606,4 +1016,10 @@
.cu-form-group uni-picker::after { .cu-form-group uni-picker::after {
color: transparent; color: transparent;
} }
.right-btn{
display: flex;
justify-content: center;
align-items: center;
padding: 0 24upx;
}
</style> </style>
\ No newline at end of file
...@@ -173,3 +173,12 @@ export function getDictItem(dicts, dictType) { ...@@ -173,3 +173,12 @@ export function getDictItem(dicts, dictType) {
} }
return obj return obj
} }
// 将14位数的时间字符串转化为时间格式
export function formatForLen14 (dateStr) {
if(dateStr && dateStr.length===14){
let strList = dateStr.split('');
dateStr = `${strList[0]}${strList[1]}${strList[2]}${strList[3]}/${strList[4]}${strList[5]}/${strList[6]}${strList[7]} ${strList[8]}${strList[9]}:${strList[10]}${strList[11]}:${strList[12]}${strList[13]}`
}
return dateStr
}
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