feat: 工单详情调价

This commit is contained in:
Mrxtyyp 2024-03-18 18:16:55 +08:00
parent 813bd77675
commit 1343ec6ebc
6 changed files with 449 additions and 88 deletions

View File

@ -711,6 +711,14 @@ export default {
})
return res[1].data;
},
async editOrder(params = {}) {
let res = await uni.request({
url: '/order/detail/app/edit',
method: 'POST',
data: params
})
return res[1].data;
},
async editAfterServiceRecord(params = {}) {
let res = await uni.request({
url: '/worker/record/edit',

View File

@ -0,0 +1,296 @@
<template>
<view class="cu-modal" :class="show?'show':''">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end solid-bottom">
<view class="content">申请订单加价/预付款</view>
<view class="action" data-modal="applyExtraChargeModal" @click="hideModal">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="bg-white padding text-left">
<view class="text-lg padding-top flex justify-start align-center">
<text class="title-input">加价金额</text>
<input type="digit" class="radius-input inline-input" placeholder="请输入金额(订单完成或取消后原路退回此款)" v-model="moneyAmount"></input>
</view>
<view class="text-lg padding-top flex justify-start align-center">
<text class="title-input">加价原因</text>
<picker style="width: 75%;" @change="bindPickerChange" :value="chooseIndex" :range="array">
<view class="radius-input inline-input custom-input">{{array[chooseIndex]}}</view>
</picker>
</view>
<view class="text-lg padding-top flex justify-start align-center">
<text class="title-input">{{chooseIndex < 6 ? '配件费' : '施工费'}}</text>
<input type="digit" class="radius-input inline-input" placeholder="请输入该费用实际金额" v-model="extraAmount"></input>
</view>
<view>
<view class="padding-tb-sm">凭证上传</view>
<view class="grid col-3 grid-square">
<view class="bg-img" v-for="(item,index) in imgList" :key="index"
@tap="viewImage($event, imgList)" :data-url="item">
<image :src="item" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="delImg($event, imgList)" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="chooseImage" v-if="imgList.length < 1">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
<view>
<view class="padding-tb-sm">申请原因</view>
<view class="solid">
<textarea style="width: 100%; height: 200rpx;" fixed="true" class="radius text-left padding-sm"
v-model="remark" maxlength="-1"></textarea>
</view>
</view>
</view>
<view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="applyChargeModal"
@click="hideModal">取消</view>
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="applyChargeModal"
@click="submit">确认</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'applyCharge',
props: {
show: {
type: Boolean,
default: false
},
data: {
type: Object,
default: () => {}
}
},
data() {
return {
array: ['加单加价','加急费','拆机/拆换费','搬运费','清理费','远程费','施工费','垫付金','奖励金','质保金','客户押金','工具押金','物品押金'],
chooseIndex: 0,
imgList: [],
moneyAmount: '',
reason: '1',
extraAmount: '',
remark: ''
}
},
methods: {
bindPickerChange(e) {
this.chooseIndex = parseInt(e.detail.value)
},
hideModal(e) {
this.$emit('close', e);
},
chooseImage(e) {
uni.chooseMedia({
count: 1, //9
mediaType: ['image'],
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
let tempFilePaths = [];
res.tempFiles.forEach((fileObj) => {
tempFilePaths.push(fileObj.tempFilePath)
})
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(tempFilePaths)
} else {
this.imgList = tempFilePaths
}
}
});
},
viewImage(e, imgList) {
uni.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
});
},
delImg(e, imgList) {
uni.showModal({
title: '',
content: '确定要删除这张图片吗?',
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
imgList.splice(e.currentTarget.dataset.index, 1)
}
}
})
},
async resetPriceChangedInfo() {
let res = await this.$request.getChangeOrderPrice(this.data);
if (res && res.code === 0) {
return res.data
}
},
resetData() {
this.chooseIndex = 0
this.imgList = []
this.moneyAmount = ''
this.extraAmount = ''
this.remark = ''
},
async submit(e) {
if (!this.moneyAmount) {
uni.showToast({
title: '请输入本次加价总金额',
icon: 'none'
});
return;
}
if (!this.extraAmount) {
uni.showToast({
title: '请输入该费用实际金额',
icon: 'none'
});
return;
}
if(this.chooseIndex === 6 && this.imgList.length === 0) {
uni.showToast({
title: '请上传凭证,至少一张',
icon: 'none'
});
return;
}
const num_moneyAmount = parseInt(this.moneyAmount)
const num_extraAmount = parseInt(this.extraAmount)
if(num_extraAmount > num_moneyAmount) {
uni.showToast({
title: '费用实际金额不能大于本次加价总金额',
icon: 'none'
});
return;
}
if(this.chooseIndex < 6 && num_moneyAmount == num_extraAmount) {
//
console.log('调用详情接口',{
orderDetailId: this.data.orderDetailId,
attachMoney: this.moneyAmount,
type: '01'
});
//
let res = await this.$request.addOrderAttach({
orderDetailId: this.data.orderDetailId,
attachMoney: this.moneyAmount,
type: '01'
});
if (res.code === 0) {
uni.showToast({
title: '操作成功',
icon: 'success'
});
this.hideModal(e);
this.resetData()
}
} else if(this.chooseIndex >= 6 && num_moneyAmount == num_extraAmount) {
//
const res = await this.resetPriceChangedInfo()
if (res && res.type != 1) {
uni.showToast({
icon: 'none',
title: '你有加价未付款,请客户支付后再加或在原加价上增加金额!',
duration: 3500
})
return;
}
console.log('调用列表接口',{
orderDetailId: this.data.orderDetailId,
changeMoney: num_moneyAmount,
type: 1,
remark: this.remark
});
let res1 = await this.$request.changeOrderPrice({
orderDetailId: this.data.orderDetailId,
changeMoney: newPrice,
type: this.payAction,
remark: this.remark
});
if (res1 && res1.code === 0) {
uni.showToast({
icon: 'success',
title: '操作成功'
})
this.hideModal(e);
this.resetData()
}
} else if(num_moneyAmount > num_extraAmount) {
const res = await this.resetPriceChangedInfo()
if (res && res.type != 1) {
uni.showToast({
icon: 'none',
title: '你有加价未付款,请客户支付后再加或在原加价上增加金额!',
duration: 3500
})
return;
}
let type1_price, type2_price;
if(this.chooseIndex < 6) {
type1_price = num_extraAmount
type2_price = num_moneyAmount - num_extraAmount
} else {
type2_price = num_extraAmount
type1_price = num_moneyAmount - num_extraAmount
}
console.log('调用详情接口',{
orderDetailId: this.data.orderDetailId,
attachMoney: type1_price,
type: '01'
});
let res1 = await this.$request.addOrderAttach({
orderDetailId: this.data.orderDetailId,
attachMoney: type1_price,
type: '01'
});
if (res1.code != 0) return
console.log('调用列表接口',{
orderDetailId: this.data.orderDetailId,
changeMoney: type2_price,
type: 1,
remark: this.remark
});
let res2 = await this.$request.changeOrderPrice({
orderDetailId: this.data.orderDetailId,
changeMoney: type2_price,
type: this.payAction,
remark: this.remark
});
if (res2.code != 0) return
uni.showToast({
icon: 'success',
title: '操作成功'
})
this.hideModal(e);
this.resetData()
}
}
}
}
</script>
<style scoped>
.grid.col-3.grid-square>view {
padding-bottom: calc((100% - 40rpx)/3);
height: 0;
width: calc((100% - 40rpx)/3);
}
.inline-input {
flex-basis: 70%;
}
.title-input {
display: inline-block;
width: 165rpx;
}
.custom-input {
height: 1.4rem;
min-height: 1.4rem;
}
</style>

View File

@ -23,8 +23,9 @@
<text>加单总额</text>
<input class="radius-input inline-input" type="digit" v-model="newPriceForA1"></input>
<text class="margin-left-xs"></text>
<view class="cu-btn line-main-color sm margin-left" v-if="priceObj && priceObj.type == 1"
@click="changeOrderPrice(newPriceForA1)">修改报价</view>
<view class="cu-btn line-main-color sm margin-left"
v-if="priceObj && priceObj.type == 1" @click="changeOrderPrice(newPriceForA1)">修改报价
</view>
<view class="cu-btn line-main-color sm margin-left" v-else
@click="changeOrderPrice(newPriceForA1)">确认报价</view>
</view>
@ -38,8 +39,9 @@
<text>报价总额</text>
<input class="radius-input inline-input" type="digit" v-model="newPriceForA2"></input>
<text class="margin-left-xs"></text>
<view class="cu-btn line-main-color sm margin-left" v-if="priceObj && priceObj.type == 2"
@click="changeOrderPrice(newPriceForA2)">修改报价</view>
<view class="cu-btn line-main-color sm margin-left"
v-if="priceObj && priceObj.type == 2" @click="changeOrderPrice(newPriceForA2)">修改报价
</view>
<view class="cu-btn line-main-color sm margin-left" v-else
@click="changeOrderPrice(newPriceForA2)">确认报价</view>
</view>
@ -51,12 +53,16 @@
v-model="remark" maxlength="-1"
placeholder="报价额需符合双方约定并把关键内容附上。如保内维修XX含配件XXX等分别XX元。如约定下单方寄配件则订单内“申请配件发起”。"></textarea>
</view>
<view class="cu-btn line-main-color margin-top-sm long-btn" v-if="priceObj" @click="clearCurAddedPrice">清空加价</view>
<view class="cu-btn line-main-color margin-top-sm long-btn" v-if="priceObj" @click="clearCurAddedPrice">
清空加价</view>
</view>
<view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="showNewServPriceOfflineModal"
@click="hideModal">退出/再次上门</view>
<view class="action margin-0 flex-sub text-main-color solid-left" v-if="(priceObj && priceObj.payStatus === 0) || data.payStatus === 0"
<view class="action margin-0 flex-sub text-black" data-modal="showNewServPriceOfflineModal"
@click="directlyFinish" v-if="data.consultMode === '01'">直接完单</view>
<view class="action margin-0 flex-sub text-main-color solid-left"
v-if="(priceObj && priceObj.payStatus === 0) || data.payStatus === 0"
data-modal="showPayQrcodeModal" @tap="makePayQrcode($event)">请客户支付</view>
<view class="action margin-0 flex-sub text-main-color solid-left"
data-modal="showNewServPriceOfflineModal" @tap="hideModal" @click="goFinishOrder" v-else>去完单</view>
@ -81,7 +87,7 @@
},
data: {
type: Object,
default: {}
default: () => {}
}
},
data() {
@ -160,6 +166,19 @@
}, 1500);
}
},
async directlyFinish(e) {
let res = await this.$request.editOrder({
id: this.data.orderDetailId,
orderStatus: 5
});
if (res && res.code === 0) {
uni.showToast({
icon: 'success',
title: '操作成功'
})
this.hideModal(e)
}
},
async makePayQrcode(e) {
let res = await this.$request.priceAddedQrPay(this.data);
if (res && res.code === 0) {

View File

@ -56,6 +56,8 @@
<view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="showNewServPriceOnlineModal"
@click="hideModal">退出/再次上门</view>
<view class="action margin-0 flex-sub text-black" data-modal="showNewServPriceOfflineModal"
@click="directlyFinish" v-if="data.consultMode === '01'">直接完单</view>
<view class="action margin-0 flex-sub text-main-color solid-left" v-if="(priceObj && priceObj.payStatus === 0) || data.payStatus === 0"
data-modal="showPayQrcodeModal" @tap="makePayQrcode($event)">请客户支付</view>
<view class="action margin-0 flex-sub text-main-color solid-left"
@ -81,7 +83,7 @@
},
data: {
type: Object,
default: {}
default: () => {}
}
},
data() {
@ -134,6 +136,19 @@
changePayAction(payAction) {
this.payAction = payAction;
},
async directlyFinish(e) {
let res = await this.$request.editOrder({
id: this.data.orderDetailId,
orderStatus: 5
});
if (res && res.code === 0) {
uni.showToast({
icon: 'success',
title: '操作成功'
})
this.hideModal(e)
}
},
async changeOrderPrice(newPrice) {
if (this.priceObj && this.payAction != this.priceObj.type) {
uni.showToast({

View File

@ -251,6 +251,8 @@
</view>
<view v-if="order.orderStatus === 4 || order.orderStatus === 5">
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click="showServOrderDetail(order)">查看</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click = "changePrice($event, order)" data-ref="newServPriceOffline" data-modal="showNewServPriceOfflineModal" v-show="order.orderDetailId != null && order.clockInLocation && order.payType === 1 && order.consultMode === '01'">报价/完单</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click = "changePrice($event, order)" data-ref="newServPriceOnline" data-modal="showNewServPriceOnlineModal" v-show="order.orderDetailId != null && order.clockInLocation && order.payType === 0 && order.consultMode === '01'">报价/完单</button>
</view>
<!-- <view v-if="order.orderStatus === 'afterSaleService'">
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @tap="makePhoneCall(order.customerPhone)">联系客户</button>
@ -426,8 +428,8 @@
<reject-after-sale v-if="rejectAfterSale" :show="rejectAfterSale" :data="curOrder" @confirmFeedback="reloadMasterOrderPage" @close="rejectAfterSale = false"></reject-after-sale>
<time-arrange v-if="showTimeArrangeModal" :show="showTimeArrangeModal" :data="curOrder" :curDate="curDate" @showArrangeFailTime="showArrangeFailTime" @editServTime="editServTime" @close="showTimeArrangeModal = false"></time-arrange>
<time-arrange-fail v-if="showArrangeFailTimeModal" :show="showArrangeFailTimeModal" :data="curOrder" @close="showArrangeFailTimeModal = false"></time-arrange-fail>
<new-serv-price-online v-if="showNewServPriceOnlineModal" ref="newServPriceOnline" :show="showNewServPriceOnlineModal" :data="curOrder" @finishOrder="finishOrder" @close="showNewServPriceOnlineModal = false"></new-serv-price-online>
<new-serv-price-offline v-if="showNewServPriceOfflineModal" ref="newServPriceOffline" :show="showNewServPriceOfflineModal" :data="curOrder" @finishOrder="finishOrder" @close="showNewServPriceOfflineModal = false"></new-serv-price-offline>
<new-serv-price-online v-if="showNewServPriceOnlineModal" ref="newServPriceOnline" :show="showNewServPriceOnlineModal" :data="curOrder" @finishOrder="finishOrder" @close="showNewServPriceOnlineModal = false;reloadMasterOrderPage()"></new-serv-price-online>
<new-serv-price-offline v-if="showNewServPriceOfflineModal" ref="newServPriceOffline" :show="showNewServPriceOfflineModal" :data="curOrder" @finishOrder="finishOrder" @close="showNewServPriceOfflineModal = false;reloadMasterOrderPage()"></new-serv-price-offline>
<pay-qrcode v-if="showPayQrcodeModal" ref="payQrcode" :show="showPayQrcodeModal" :data="curOrder" @finishQrPay="finishQrPay"></pay-qrcode>
<edit-time-arrange v-if="showEditTimeArrangeModal" :show="showEditTimeArrangeModal" :data="curOrder" :curDate="curDate" @showArrangeFailTime="showArrangeFailTime" @editServTime="editServTime" :ifRollback2WS="true" @close="showEditTimeArrangeModal = false"></edit-time-arrange>
<urgent-msg v-if="sendUrgentMsgModal" :show="sendUrgentMsgModal" @hideModal="sendUrgentMsgModal = false"></urgent-msg>

View File

@ -605,9 +605,10 @@
</uni-popup>
<!-- 模态框 -->
<urgent-msg :show="sendUrgentMsgModal" @hideModal="hideModal"></urgent-msg>
<apply-extra-charge v-if="applyExtraChargeModal" :show="applyExtraChargeModal" :data="servDetail" @close="applyExtraChargeModal = false"></apply-extra-charge>
<apply-extra-charge v-if="applyExtraChargeModal" :show="applyExtraChargeModal" :data="servDetail" @close="applyExtraChargeClose"></apply-extra-charge>
<apply-charge v-if="applyChargeModal" :show="applyChargeModal" :data="servDetail" @close="applyChargeClose"></apply-charge>
<task-process-detail :show="taskProcessDetail" :arr="taskListArr" @hideModal="hideModal" @close="taskProcessDetail = false"></task-process-detail>
<task-process-detail :show="taskProcessDetail" :arr="taskListArr" @close="taskDetailClose"></task-process-detail>
</view>
</template>
@ -615,6 +616,7 @@
import productPicked from '@/components/goods-card/product-picked.vue';
import urgentMsg from '@/pages/order-manage/modal/urgent-msg.vue';
import applyExtraCharge from '@/pages/order-manage/modal/apply-extra-charge.vue';
import applyCharge from '@/pages/order-manage/modal/apply-charge.vue';
import taskProcessDetail from '@/pages/order-manage/modal/task_process_detail.vue'
export default {
@ -622,7 +624,8 @@
productPicked,
urgentMsg,
applyExtraCharge,
taskProcessDetail
taskProcessDetail,
applyCharge
},
data() {
return {
@ -645,6 +648,11 @@
action: 'applyExtraCharge',
modal: 'applyExtraChargeModal'
},
{
name: '申请费用',
action: 'applyCharge',
modal: 'applyChargeModal'
}
// {
// name: '',
// action: ''
@ -662,7 +670,8 @@
overtimeRecords: null,
applyExtraChargeModal: false,
taskProcessDetail: false,
taskListArr: []
taskListArr: [],
applyChargeModal: false
}
},
onLoad(options) {
@ -677,10 +686,13 @@
},
methods: {
//
async showTaskDetailMdl() {
showTaskDetailMdl() {
this.taskProcessDetail = true
},
taskDetailClose() {
console.log('close close');
this.taskProcessDetail = false
},
bindEvent() {
uni.$on(this.$globalFun.HIDE_MODAL, this.hideModal);
},
@ -733,6 +745,15 @@
console.log("申请charge")
this.applyExtraChargeModal = true;
},
applyExtraChargeClose() {
this.applyExtraChargeModal = false;
},
applyCharge() {
this.applyChargeModal = true;
},
applyChargeClose() {
this.applyChargeModal = false;
},
applyCancelOrder() {
let params = {
orderInfo: this.servDetail.mainServOrder