订单页剩余接口对接

This commit is contained in:
Double-_-Z 2025-08-03 01:01:22 +08:00
parent ca37ed420b
commit 2a9c5ee010
6 changed files with 143 additions and 47 deletions

View File

@ -7,10 +7,10 @@
:refresher-enabled="(isPilot&&current!==3)||(!isPilot&&current!==1)"
:refresher-triggered="triggered" @refresherpulling="onPulling" lower-threshold="60">
<!-- #ifdef MP-WEIXIN -->
<Order ref="pageRef" :topLevel="topLevel" v-if="current===0" />
<Order ref="pageRef" :isPilot="isPilot" v-if="current===0" />
<Equipment ref="pageRef" :topLevel="topLevel" v-if="isPilot&&current===1" />
<Route ref="pageRef" :topLevel="topLevel" v-else-if="isPilot&&current===2" />
<My ref="pageRef" :topLevel="topLevel" :isLogin="isLogin" @userLogOut="isLogin=''" v-else-if="isPilot&&current===3||current===1" />
<My ref="pageRef" :isPilot="isPilot" :isLogin="isLogin" @userLogOut="isLogin=''" v-else-if="isPilot&&current===3||current===1" />
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<component ref="pageRef" :topLevel="topLevel" :is="refs[current]"
@ -32,7 +32,7 @@
boxShadow: '0rpx 0rpx 12rpx rgba(202,202,182,0.5)',
filter: 'opacity(0.96)'}"></u-back-top>
</view>
<Movable v-if="current === 0" :iconName="ordFileUrl+addIcon" />
<Movable v-if="current === 0 && isPilot" :iconName="ordFileUrl+addIcon" />
</view>
</template>

View File

@ -4,7 +4,7 @@
<u-image width="100%" :src="fileUrl+topBg" mode="widthFix" />
<view class="my-identity">
<u-image class="my-avatar" width="120rpx" height="120rpx"
src="/static/header.png" />
:src="ordFileUrl+(isPilot||!customer.gender?pilotIcon:(customer.gender === '男' ? boyIcon : girlIcon))" />
<view class="my-self">
<text>{{ userMessage.nickName || userMessage.username || '用户' }}</text>
<text>欢迎来到爱尚云愿您有个美好体验</text>
@ -36,9 +36,9 @@ export default {
},
// #endif
props: {
topLevel:{
type: Number,
default: 0
isPilot: {
type: Boolean,
default: true
},
isLogin: {
type: String,
@ -49,11 +49,20 @@ export default {
return{
//
fileUrl: configService.fileUrl + 'aerocraft/my/',
ordFileUrl: configService.fileUrl + 'aerocraft/order/',//
//
topBg: 'top-bg-a.png',
//
girlIcon: 'girl.png',
//
boyIcon: 'boy.png',
//
pilotIcon: 'pilot-avatar.png',
//
// userMessage:{}
userMessage: this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message),
//
customer: {},
//
functions: [{
name: '历史订单',
@ -68,18 +77,17 @@ export default {
icon: 'password.png',
url: '/aircraft/server/my/child_pages/reset-password'
}],
isPilot: this.$store.state.user_type == 1,
}
},
computed:{
},
methods:{
//
init(){
if(this.isLogin !== ''){
this.userMessage = JSON.parse(this.$store.state.user_message);
}else{
this.userMessage = {};
async init(){
this.userMessage = this.isLogin === '' ? {} : JSON.parse(this.$store.state.user_message);
if(this.userMessage.id){
let res = await this.$api.bSelfDetail(this.userMessage.id);
this.customer = res === undefined ? {} : res;
}
},
//

View File

@ -56,17 +56,18 @@
<u-form-item v-if="form.orderId" label="下单时间:" :border-bottom="false">
<u-input disabled class="field-ninput" placeholder="下单时间" v-model="form.orderCreateTime" />
</u-form-item>
<u-form-item v-if="form.orderId" :label="`订单确认人${form.confirmStatus?
(form.confirmStatus===1?'(待确认)':'(已确认)'):''}`" :border-bottom="false">
<u-form-item v-if="form.orderId" :label="`订单确认人${ ['未进行','已取消'].includes(form.mainOrderStatus)
?'':(form.mainOrderStatus==='已完成'?'(已确认)':'(待确认)')}`" :border-bottom="false">
<u-input disabled class="field-ninput" placeholder="订单确认人" v-model="form.customerName" />
</u-form-item>
<view class="field-btns" v-if="isPilot&&(!form.confirmStatus||form.confirmStatus===0)
&&(!form.orderId||form.orderInitiatorId==userMessage.id)">
<view class="field-btns" v-if="form.orderInitiatorId===userMessage.id&&
(!form.mainOrderStatus||form.mainOrderStatus!=='已完成'||form.mainOrderStatus!=='已取消')">
<u-button type="warning" :custom-style="customStyle" style="width: 100%;" v-if="!isDisable"
:hair-line="false" @click="saveOrder" :loading="saveLoading">保存</u-button>
<u-button :style="{marginLeft: isDisable?'0rpx':'30rpx',width: '100%'}" type="warning"
v-if="form.orderId" :custom-style="customStyle"
:hair-line="false" @click="finishOrder">完成订单</u-button>
v-if="canFinish" :custom-style="customStyle" :hair-line="false" @click="finishOrder">
完成订单
</u-button>
</view>
</u-form>
</view>
@ -139,8 +140,9 @@ export default {
trigger: ['change','blur'],
}],
surchargeAmount: [{
required: true,
type: 'float',
validator: (rule, value, callback) => {
return value&&/^-?\d*\.?\d+$/.test(value);;
},
message: '附加费格式不正确',
trigger: ['change','blur']
}],
@ -192,7 +194,7 @@ export default {
// /
scenOrCusType: '',
//
orderStatus: ['进行中','已完成','已取消'],
orderStatus: ['进行中','已完成','已取消','待确认'],
}
},
onReady() {
@ -206,15 +208,32 @@ export default {
const index = this.form[isScen?'attractionId':'customerId'];
return index?[arr.findIndex(item=>item.id === index)]:[0];
},
//
canFinish(){
/*
1.编辑
2.订单状态不处于已完成已取消未进行飞行员-待确认
3.飞行员-订单发起人||客户-确认人
4.不存在飞行任务为未进行或进行中的状态
*/
const { orderId, mainOrderStatus, orderTaskDetailList, orderInitiatorId, customerId } = this.form;
return orderId&&(!mainOrderStatus||mainOrderStatus!=='未进行')&&
(this.isPilot&&orderInitiatorId==this.userMessage.id&&mainOrderStatus!=='待确认'||
!this.isPilot&&customerId==userMessage.id)&&(!orderTaskDetailList||
orderTaskDetailList.some(item=>item.orderItemStatus!=='未进行'||item.orderItemStatus!=='进行中'));
},
//
canDelete(){
const { orderId, orderInitiatorId, confirmStatus, orderTaskDetailList } = this.form;
const { orderId, orderInitiatorId, mainOrderStatus, orderTaskDetailList } = this.form;
return orderId&&this.isPilot&&orderInitiatorId==this.userMessage.id
&&(!confirmStatus||confirmStatus===0)&&(!orderTaskDetailList||orderTaskDetailList.some(
item=>!this.orderStatus.includes(item.orderItemStatus)));
&&(!mainOrderStatus||mainOrderStatus==='未进行')&&(!orderTaskDetailList||orderTaskDetailList.length===0);
},
//
isDisable(){
/*
1.订单状态不处于已完成已取消
2.存在飞行任务为进行中已完成已取消待确认状态
*/
const { orderTaskDetailList } = this.form;
return orderTaskDetailList&&orderTaskDetailList.length>0;
}
@ -248,13 +267,21 @@ export default {
}
//
if(this.form.orderId) this.getOrderDetail();
else {
const userId = this.userMessage.id;
const op = this.operators.find(item=>item.id===userId);
if(op){
this.form.operatorIds.push(op);
this.operators = this.operators.filter(item=>item.id!==userId);
}
}
},
//
async getOrderDetail(){
let res = await this.$api.orderDetail(this.form.orderId);
if(res){
const { id, customerName, phone, scenicName, surchargeAmount, cargoWeight,
orderNo, orderCreateTime, orderInitiator, confirmStatus, orderInitiatorId,
orderNo, orderCreateTime, orderInitiator, orderInitiatorId, mainOrderStatus,
customerId, attractionId, routeIds, operatorIds, orderTaskDetailList } = res;
this.form = {
orderId: id,
@ -272,15 +299,16 @@ export default {
routeIds: [],
orderInitiator: orderInitiator,
orderCreateTime: orderCreateTime,
confirmStatus: confirmStatus,
orderInitiatorId: orderInitiatorId,
orderTaskDetailList: orderTaskDetailList,
mainOrderStatus: mainOrderStatus
}
let resp = await this.$api.allRoutesByScenicId(attractionId);
if(resp){
this.routes = resp || [];
this.form.routeIds = resp.filter(item=> routeIds.includes(item.key));
this.form.operatorIds = this.operators.filter(item=> operatorIds.includes(item.id));
this.operators = this.operators.filter(item=>item.id!==orderInitiatorId);
} else {
this.$refs.uToast.show({type: 'error',title: "景区路线获取失败!"});
}
@ -330,6 +358,7 @@ export default {
let res = await this.$api.allRoutesByScenicId(val.id);
if(res){
this.routes = res || [];
this.form.routeIds = res.length>0?[res[0]]:[];
}else{
this.$refs.uToast.show({type: 'error',title: "景区路线获取失败!"});
}
@ -380,6 +409,10 @@ export default {
if (res.confirm) {
try {
let res = await that.$api.completeOrder(that.form.orderId);
if(res === undefined){
that.$refs.uToast.show({type: 'error',title: "订单完成操作失败!"});
return;
}
that.$refs.uToast.show({type: 'success', title: `订单完成操作成功!`});
that.init();
} catch (error) {

View File

@ -7,7 +7,8 @@
<u-image width="100%" :src="myFileUrl+topBg" mode="widthFix" />
<view class="top-abs" :style="{top: CustomBar+'px'}">
<view class="order-status">{{ orderDetail.mainOrderStatus }}</view>
<view class="order-tips">{{ orderDetail.mainOrderStatus === '已完成' ? '已完成飞行任务' : '请尽快执行任务'}}</view>
<view class="order-tips">{{ orderDetail.mainOrderStatus === '已完成' ? '已完成飞行任务' :
orderDetail.mainOrderStatus === '待确认'?'请尽快确认完成订单':'请尽快执行任务'}}</view>
</view>
</view>
<view class="order-content">
@ -47,17 +48,21 @@
:src="fileUrl+textBg" />
</view>
<view class="message-content">
<view class="mc-lam" v-if="!isPilot">
<text class="lam-title">订单号</text>
<text class="lam-value">{{ orderDetail.orderNo }}</text>
</view>
<view class="mc-lam">
<text class="lam-title">发起人</text>
<text class="lam-value">{{ orderDetail.orderInitiator }}</text>
</view>
<view class="mc-lam">
<view class="mc-lam" v-if="isPilot">
<text class="lam-title">客户名称</text>
<text class="lam-value">{{ orderDetail.customerName }}</text>
</view>
<view class="mc-lam">
<text class="lam-title">手机号</text>
<text class="lam-value">{{ orderDetail.phone }}</text>
<text class="lam-value">{{ isPilot?orderDetail.phone:orderDetail.initiatorPhone }}</text>
</view>
<view class="mc-lam">
<text class="lam-title">操作员</text>
@ -67,6 +72,10 @@
<text class="lam-title">下单时间</text>
<text class="lam-value">{{ orderDetail.orderCreateTime }}</text>
</view>
<view class="mc-lam" v-if="!isPilot">
<text class="lam-title">订单确认人</text>
<text class="lam-value">{{ orderDetail.customerName }}</text>
</view>
</view>
</view>
<view class="fly-message">
@ -88,7 +97,7 @@
{{ item.orderItemStatus }}
</view>
</view>
<view class="action-btns" v-if="orderDetail.mainOrderStatus!=='已完成'">
<view class="action-btns" v-if="isPilot&&!['已完成','待确认','已取消'].includes(orderDetail.mainOrderStatus)">
<u-button :custom-style="deleteCustomStyle" style="margin-left: auto;"
:hair-line="false" @click="handleDeleteAction(item)">删除</u-button>
<u-button type="warning" :custom-style="customStyle" style="margin-left: 20rpx;margin-right: 30rpx;"
@ -104,10 +113,14 @@
</view>
</view>
</view>
<view class="order-bottom" v-if="orderDetail.mainOrderStatus !== '已完成'">
<view class="add-action" @click="showAddAction=true">
<view class="order-bottom" v-if="!['已完成','已取消'].includes(orderDetail.mainOrderStatus)">
<view class="add-action" @click="addAction" v-if="isPilot&&orderDetail.mainOrderStatus!=='待确认'">
新增任务
</view>
<view class="add-action" v-else-if="!isPilot&&orderDetail.mainOrderStatus==='待确认'"
@click="finishOrder">
完成订单
</view>
</view>
<u-popup v-model="showAddAction" mode="bottom" border-radius="40" @close="closeAddAction">
<view class="action-popup">
@ -139,7 +152,7 @@
<view class="action-lamx">
<view class="lam-title">货物图片</view>
<view class="lam-upload">
<u-upload :action="uploadApi" max-count="1" :file-list="fileList"
<u-upload :action="uploadApi" max-count="1" :file-list="fileList" ref="uploadRef"
width="200" height="200" custom-btn :multiple="false" :header="uploadFileHeader"
@on-success="uploadFile" @on-remove="removeFile" name="file">
<view slot="addBtn" class="lam-upload-btn">
@ -339,6 +352,7 @@ export default {
{ key: 2, value: '已完成' },
{ key: 3, value: '已取消' },
],
isPilot: this.$store.state.user_type == 1,
}
},
onPageScroll(e) {
@ -376,6 +390,10 @@ export default {
this.clearForm();
this.showAddAction = false;
},
//
addAction(){
this.showAddAction = true;
},
//
async getOrderDetail(id){
let res = await this.$api.orderDetail(id);
@ -433,7 +451,8 @@ export default {
this.dotLoading = true;
let res = await this.$api.addOrderTask(data);
if(res === undefined){
this.$refs.uToast.show({type: 'error',title: '飞行任务新增失败(新增订单飞行任务: 同一个订单同一个飞行员,只能存在一个任务状态处于[未进行或进行中])'});
this.dotLoading = false;
this.$refs.uToast.show({type: 'error',title: '当前无法新增飞行任务!'});
return;
}
await this.clearForm();
@ -443,7 +462,7 @@ export default {
this.$refs.uToast.show({type: 'success',title: `飞行任务新增成功!`});
} catch (error) {
this.dotLoading = false;
this.$refs.uToast.show({type: 'error',title: '飞行任务新增失败'});
this.$refs.uToast.show({type: 'error',title: '当前无法新增飞行任务!'});
}
return;
}
@ -456,7 +475,7 @@ export default {
let res = await this.$api.editOrderStatus(orderTaskId, taskStatus);
this.showChangeState = false;
if(res === undefined){
this.$refs.uToast.show({type: 'error',title: '飞行任务状态更改失败'});
this.$refs.uToast.show({type: 'error',title: '无法更改该飞行任务状态!'});
return;
}
this.$refs.uToast.show({type: 'success',title: `飞行任务状态更改成功!`});
@ -468,13 +487,14 @@ export default {
};
} catch (error) {
this.showChangeState = false;
this.$refs.uToast.show({type: 'error',title: '飞行任务状态更改失败'});
this.$refs.uToast.show({type: 'error',title: '无法更改该飞行任务状态!'});
}
},
//
clearForm(){
this.current = 0;
this.fileList = [];
this.$refs['uploadRef'].lists = [];
this.form = {
orderId: this.form.orderId,
deviceName: '',
@ -498,14 +518,14 @@ export default {
let res = await that.$api.deleteOrderTask(item.id);
console.log(res);
if(res === undefined){
that.$refs.uToast.show({type: 'error',title: "您没有权限删除此订单任务!"});
that.$refs.uToast.show({type: 'error',title: "飞行任务无法删除!"});
return;
}
that.getOrderDetail(this.form.orderId);
that.clearForm();
that.$refs.uToast.show({type: 'success',title: "飞行任务删除成功!"});
} catch (error) {
that.$refs.uToast.show({type: 'error',title: "飞行任务删除失败!"});
that.$refs.uToast.show({type: 'error',title: "飞行任务无法删除!"});
}
}
}
@ -519,7 +539,31 @@ export default {
taskStatus: this.stateList.find(item=>item.value===orderItemStatus).key
};
this.showChangeState = true;
}
},
//
async finishOrder(){
let that = this;
uni.showModal({
title: '订单完成',
content: '是否确认完成该订单?',
confirmColor: '#f7c04d',
success: async(res) => {
if (res.confirm) {
try {
let res = await that.$api.completeOrder(that.orderDetail.id);
if(res === undefined){
that.$refs.uToast.show({type: 'error',title: "订单完成操作失败!"});
return;
}
that.getOrderDetail(that.form.orderId);
that.$refs.uToast.show({type: 'success', title: `订单完成操作成功!`});
} catch (error) {
that.$refs.uToast.show({type: 'error', title: `订单完成操作失败!`});
}
}
}
})
},
}
}
</script>

View File

@ -18,7 +18,7 @@
<view class="item-third">
<view class="item-identity">
<u-image class="item-avatar" width="80rpx" height="80rpx"
:src="fileUrl+(customers[item.customerId].gender === '男' ? boyIcon : girlIcon)" />
:src="fileUrl+(!isPilot?pilotIcon:(customers[item.customerId].gender === '男' ? boyIcon : girlIcon))" />
<view class="item-self">
<text class="item-name">{{ customers[item.customerId].name }}</text>
<text class="item-phone">{{ item.customerPhone }}</text>
@ -26,7 +26,7 @@
</view>
<view class="item-active">
<u-button type="warning" :custom-style="customStyle"
:hair-line="false" @click.stop="handleDoAction(item)">执行任务</u-button>
:hair-line="false" @click.stop="handleDoAction(item)">{{isPilot?'执行任务':'查看详情'}}</u-button>
</view>
</view>
</view>
@ -49,6 +49,12 @@ export default {
styleIsolation: 'shared'
},
// #endif
props: {
isPilot:{
type: Boolean,
default: true
},
},
data(){
return {
fileUrl: configService.fileUrl + 'aerocraft/order/',//
@ -58,12 +64,15 @@ export default {
girlIcon: 'girl.png',
//
boyIcon: 'boy.png',
//
pilotIcon: 'pilot-avatar.png',
//
orderStatus: {
0:'未进行',
1:'进行中',
2:'已完成',
3:'已取消'
3:'已取消',
4:'待确认',
},
//
orderTypes: {
@ -92,7 +101,7 @@ export default {
size: 10,
// loadmoreloadingnomore
isFinish: 'nomore',
mainOrderStatusList: '0,1,3',
mainOrderStatusList: '0,1',
},
//
customers: {},
@ -103,11 +112,11 @@ export default {
methods:{
//
async init(){
this.form = {size: 10,current: 1,isFinish: 'nomore',mainOrderStatusList: '0,1,3'};
this.form = {size: 10,current: 1,isFinish: 'nomore',mainOrderStatusList: this.isPilot?'0,1':'0,1,4'};
//
await this.getOrderList();
//
let cusRes = await this.$api.allCustomers();
let cusRes = this.isPilot ? await this.$api.allCustomers() : await this.$api.allEmployees();
if(!cusRes){
this.$refs.uToast.show({type: 'error',title: "客户获取失败!"});
}else this.customers = await cusRes.reduce((obj, item) => ({...obj,[item.id]: item}), {})||{};
@ -145,6 +154,7 @@ export default {
},
//
showDetail(item){
if(this.isPilot)
uni.navigateTo({
url: `/aircraft/server/order/add?id=${item.id}`
})

View File

@ -11,6 +11,7 @@ const install = (Vue, vm) => {
vm.$api.aUpdatePass = async (params = {}) => await vm.$u.post(`/api/emEmployees/updatePass`,params);// 修改飞行员密码
vm.$api.bUpdatePass = async (params = {}) => await vm.$u.post(`/cnCustomer/updatePass`,params);// 修改客户密码
vm.$api.allEmployees = async (params = {}) => await vm.$u.get('/api/emEmployees/all',params);// 条件查询全部飞行员
vm.$api.bSelfDetail = async (id) => await vm.$u.get(`/cnCustomer/${id}`);// 查询客户信息
// 区域/景区管理
vm.$api.allAreas = async () => await vm.$u.get('/emArea/all');// 获取全部区域