订单管理调整
This commit is contained in:
parent
90fc339c12
commit
906ee0b02a
@ -43,7 +43,7 @@
|
|||||||
<u-input class="field-ninput" type="number" placeholder="请输入货物重量(最多保留两位小数)" v-model.number="form.cargoWeight" />
|
<u-input class="field-ninput" type="number" placeholder="请输入货物重量(最多保留两位小数)" v-model.number="form.cargoWeight" />
|
||||||
<view slot="right" class="field-input-right">KG</view>
|
<view slot="right" class="field-input-right">KG</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item prop="surchargeAmount" required label="附加费:" :border-bottom="false">
|
<u-form-item prop="surchargeAmount" label="附加费:" :border-bottom="false">
|
||||||
<u-input type="number" class="field-ninput" placeholder="请输入附加费(最多保留两位小数)" v-model.number="form.surchargeAmount" />
|
<u-input type="number" class="field-ninput" placeholder="请输入附加费(最多保留两位小数)" v-model.number="form.surchargeAmount" />
|
||||||
<view slot="right" class="field-input-right">元</view>
|
<view slot="right" class="field-input-right">元</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@ -141,7 +141,7 @@ export default {
|
|||||||
}],
|
}],
|
||||||
surchargeAmount: [{
|
surchargeAmount: [{
|
||||||
validator: (rule, value, callback) => {
|
validator: (rule, value, callback) => {
|
||||||
return value&&/^-?\d*\.?\d+$/.test(value);;
|
return value===''||/^-?\d*\.?\d+$/.test(value);
|
||||||
},
|
},
|
||||||
message: '附加费格式不正确',
|
message: '附加费格式不正确',
|
||||||
trigger: ['change','blur']
|
trigger: ['change','blur']
|
||||||
@ -373,14 +373,20 @@ export default {
|
|||||||
saveOrder(){
|
saveOrder(){
|
||||||
try{
|
try{
|
||||||
let that = this;
|
let that = this;
|
||||||
this.saveLoading = true;
|
|
||||||
this.$refs.uForm.validate(async(valid) => {
|
this.$refs.uForm.validate(async(valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
that.saveLoading = true;
|
||||||
const data = {...that.form,operatorIds:that.form.operatorIds.map(item=>item.id),
|
const data = {...that.form,operatorIds:that.form.operatorIds.map(item=>item.id),
|
||||||
routeIds:that.form.routeIds.map(item=>item.key),
|
routeIds:that.form.routeIds.map(item=>item.key),
|
||||||
|
surchargeAmount: that.form.surchargeAmount ? that.form.surchargeAmount : 0,
|
||||||
orderCreateTime:that.$u.timeFormat(new Date().getTime(),'yyyy-mm-dd hh:MM:ss')}
|
orderCreateTime:that.$u.timeFormat(new Date().getTime(),'yyyy-mm-dd hh:MM:ss')}
|
||||||
console.log('验证通过',that.form);
|
console.log('验证通过',that.form);
|
||||||
let res = that.form.orderId ? await that.$api.editOrder(data) : await that.$api.addOrder(data);
|
let res = that.form.orderId ? await that.$api.editOrder(data) : await that.$api.addOrder(data);
|
||||||
|
console.log('res:',res);
|
||||||
|
if(res === undefined){
|
||||||
|
that.$refs.uToast.show({type: 'error',title: "订单新增失败!"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
that.saveLoading = false;
|
that.saveLoading = false;
|
||||||
uni.navigateBack({complete() {
|
uni.navigateBack({complete() {
|
||||||
that.$u.toast(`订单${that.form.orderId?'编辑':'新增'}成功!`);
|
that.$u.toast(`订单${that.form.orderId?'编辑':'新增'}成功!`);
|
||||||
|
@ -99,11 +99,11 @@
|
|||||||
{{ item.orderItemStatus }}
|
{{ item.orderItemStatus }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btns" v-if="isPilot&&!['已完成','待确认','已取消'].includes(orderDetail.mainOrderStatus)">
|
<view class="action-btns" v-if="isPilot&&!['已完成','待确认','任务失败'].includes(orderDetail.mainOrderStatus)">
|
||||||
<u-button :custom-style="deleteCustomStyle" style="margin-left: auto;"
|
<u-button :custom-style="{...deleteCustomStyle,opacity: disabledDeleteAction(item)?0.7:1}" style="margin-left: auto;"
|
||||||
:hair-line="false" @click="handleDeleteAction(item)">删除</u-button>
|
:hair-line="false" @click="handleDeleteAction(item)" :disabled="disabledDeleteAction(item)">删除</u-button>
|
||||||
<u-button type="warning" :custom-style="customStyle" style="margin-left: 20rpx;margin-right: 30rpx;"
|
<u-button type="warning" :custom-style="{...customStyle,opacity: disabledChangeState(item)?0.7:1}" style="margin-left: 20rpx;margin-right: 30rpx;"
|
||||||
:hair-line="false" @click="handleChangeAction(item)">更改状态</u-button>
|
:hair-line="false" @click="handleChangeAction(item)" :disabled="disabledChangeState(item)">更改状态</u-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btns" v-else />
|
<view class="action-btns" v-else />
|
||||||
</view>
|
</view>
|
||||||
@ -115,8 +115,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="order-bottom" v-if="!['已完成','已取消'].includes(orderDetail.mainOrderStatus)">
|
<view class="order-bottom" v-if="!['已完成','任务失败'].includes(orderDetail.mainOrderStatus)">
|
||||||
<view class="add-action" @click="addAction" v-if="isPilot&&orderDetail.mainOrderStatus!=='待确认'">
|
<view class="add-action" @click="addAction" v-if="isPilot&&orderDetail.mainOrderStatus!=='待确认'"
|
||||||
|
:style="{opacity: canAddAction?1:0.7}">
|
||||||
新增任务
|
新增任务
|
||||||
</view>
|
</view>
|
||||||
<view class="add-action" v-else-if="!isPilot&&orderDetail.mainOrderStatus==='待确认'"
|
<view class="add-action" v-else-if="!isPilot&&orderDetail.mainOrderStatus==='待确认'"
|
||||||
@ -249,6 +250,11 @@ export default {
|
|||||||
// 获取状态选择器默认值
|
// 获取状态选择器默认值
|
||||||
getDefaultStateSelector(){
|
getDefaultStateSelector(){
|
||||||
return [this.stateList.findIndex(item=>item.key === this.stateForm.taskStatus)]||[0];
|
return [this.stateList.findIndex(item=>item.key === this.stateForm.taskStatus)]||[0];
|
||||||
|
},
|
||||||
|
canAddAction(){
|
||||||
|
return !this.orderDetail.orderTaskDetailList||!this.orderDetail.orderTaskDetailList.some(
|
||||||
|
item=>item.operatorId&&item.operatorId===this.userMessage.id&&
|
||||||
|
item.orderItemStatus === '未进行');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
@ -289,6 +295,7 @@ export default {
|
|||||||
// 状态表单
|
// 状态表单
|
||||||
stateForm: {
|
stateForm: {
|
||||||
orderTaskId: '',
|
orderTaskId: '',
|
||||||
|
oldStatus: '',
|
||||||
taskStatus: 0,
|
taskStatus: 0,
|
||||||
taskStatusName: '未进行'
|
taskStatusName: '未进行'
|
||||||
},
|
},
|
||||||
@ -352,8 +359,10 @@ export default {
|
|||||||
{ key: 0, value: '未进行' },
|
{ key: 0, value: '未进行' },
|
||||||
{ key: 1, value: '进行中' },
|
{ key: 1, value: '进行中' },
|
||||||
{ key: 2, value: '已完成' },
|
{ key: 2, value: '已完成' },
|
||||||
{ key: 3, value: '已取消' },
|
{ key: 3, value: '任务失败' },
|
||||||
],
|
],
|
||||||
|
// 用户信息
|
||||||
|
userMessage: this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message),
|
||||||
isPilot: this.$store.state.user_type == 1,
|
isPilot: this.$store.state.user_type == 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -387,6 +396,16 @@ export default {
|
|||||||
this.$refs.uToast.show({type: 'error',title: "景区设备获取失败!"});
|
this.$refs.uToast.show({type: 'error',title: "景区设备获取失败!"});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 禁用删除飞行任务
|
||||||
|
disabledDeleteAction(item){
|
||||||
|
return !item.operatorId||this.userMessage.id!==item.operatorId||
|
||||||
|
item.orderItemStatus !== '未进行';
|
||||||
|
},
|
||||||
|
// 禁止更改状态
|
||||||
|
disabledChangeState(item){
|
||||||
|
return !item.operatorId||this.userMessage.id!==item.operatorId||
|
||||||
|
['已完成', '任务失败'].includes(item.orderItemStatus);
|
||||||
|
},
|
||||||
// 预览
|
// 预览
|
||||||
preview(url){
|
preview(url){
|
||||||
this.$util.tools.methods.lookImage(0,[url]);
|
this.$util.tools.methods.lookImage(0,[url]);
|
||||||
@ -398,7 +417,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 打开新增任务弹窗
|
// 打开新增任务弹窗
|
||||||
addAction(){
|
addAction(){
|
||||||
this.showAddAction = true;
|
if(this.canAddAction)
|
||||||
|
this.showAddAction = true;
|
||||||
},
|
},
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
async getOrderDetail(id){
|
async getOrderDetail(id){
|
||||||
@ -477,17 +497,18 @@ export default {
|
|||||||
// 修改任务状态
|
// 修改任务状态
|
||||||
async handleChangeState(){
|
async handleChangeState(){
|
||||||
try {
|
try {
|
||||||
const { orderTaskId, taskStatus } = this.stateForm;
|
const { orderTaskId, taskStatus, oldStatus } = this.stateForm;
|
||||||
let res = await this.$api.editOrderStatus(orderTaskId, taskStatus);
|
let res = await this.$api.editOrderStatus(orderTaskId, taskStatus);
|
||||||
this.showChangeState = false;
|
this.showChangeState = false;
|
||||||
if(res === undefined){
|
if(res === undefined){
|
||||||
this.$refs.uToast.show({type: 'error',title: '无法更改该飞行任务状态!'});
|
this.$refs.uToast.show({type: 'error',title: `订单任务状态不能进行状态变更,当前状态为:${oldStatus}`});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs.uToast.show({type: 'success',title: `飞行任务状态更改成功!`});
|
this.$refs.uToast.show({type: 'success',title: `飞行任务状态更改成功!`});
|
||||||
await this.getOrderDetail(this.form.orderId);
|
await this.getOrderDetail(this.form.orderId);
|
||||||
this.stateForm = {
|
this.stateForm = {
|
||||||
orderTaskId: '',
|
orderTaskId: '',
|
||||||
|
oldStatus: '',
|
||||||
taskStatus: 0,
|
taskStatus: 0,
|
||||||
taskStatusName: '未进行'
|
taskStatusName: '未进行'
|
||||||
};
|
};
|
||||||
@ -524,7 +545,7 @@ export default {
|
|||||||
let res = await that.$api.deleteOrderTask(item.id);
|
let res = await that.$api.deleteOrderTask(item.id);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if(res === undefined){
|
if(res === undefined){
|
||||||
that.$refs.uToast.show({type: 'error',title: "飞行任务无法删除!"});
|
that.$refs.uToast.show({type: 'error',title: `订单飞行任务处于[${item.orderItemStatus}]状态,不能进行删除`});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
that.getOrderDetail(this.form.orderId);
|
that.getOrderDetail(this.form.orderId);
|
||||||
@ -541,6 +562,7 @@ export default {
|
|||||||
handleChangeAction({id, orderItemStatus}){
|
handleChangeAction({id, orderItemStatus}){
|
||||||
this.stateForm = {
|
this.stateForm = {
|
||||||
orderTaskId: id,
|
orderTaskId: id,
|
||||||
|
oldStatus: orderItemStatus,
|
||||||
taskStatusName: orderItemStatus,
|
taskStatusName: orderItemStatus,
|
||||||
taskStatus: this.stateList.find(item=>item.value===orderItemStatus).key
|
taskStatus: this.stateList.find(item=>item.value===orderItemStatus).key
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <view class="">
|
<view class="">
|
||||||
路线 -->
|
路线
|
||||||
<view class="aircraft-route" :style="{backgroundImage: `url(${fileUrl+bgIcon})`}">
|
<!-- <view class="aircraft-route" :style="{backgroundImage: `url(${fileUrl+bgIcon})`}">
|
||||||
<view class="route-content">
|
<view class="route-content">
|
||||||
<view class="top-abs" :style="{top: StatusBar+'px',height: CustomBar-StatusBar+'px'}">
|
<view class="top-abs" :style="{top: StatusBar+'px',height: CustomBar-StatusBar+'px'}">
|
||||||
路线
|
路线
|
||||||
@ -42,7 +42,7 @@
|
|||||||
margin-top="250"></u-empty>
|
margin-top="250"></u-empty>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-toast ref="uToast"></u-toast>
|
<u-toast ref="uToast"></u-toast> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user