完善师傅接单

This commit is contained in:
TOP糯米 2023-03-16 19:17:54 +08:00
parent f7abec5e77
commit 8b0a19c458
5 changed files with 81 additions and 22 deletions

View File

@ -1,17 +1,19 @@
<template> <template>
<view class="component-order-action"> <view class="component-order-action">
<view class="btn"> <block v-if="order.listType == 't1' || order.listType == 't2'">
<text>立即抢单</text> <block v-if="order.state == 1">
</view> <view class="btn normal">待用户支付</view>
<view class="btn" @click.stop="confirmPrice"> </block>
<text>尾款确认</text> <block v-if="order.state == 2">
</view> <view class="btn active" @click.stop="confirmPrice">
<view v-if="false" class="btn"> <text>尾款确认</text>
<text>取消报价</text> </view>
</view> </block>
<view v-if="false" class="btn normal"> <block v-if="order.state == 4">
<text>已完成</text> <view class="btn normal">待用户支付尾款</view>
</view> </block>
</block>
<block v-if="order.listType == 't3'"> </block>
</view> </view>
</template> </template>
@ -23,12 +25,6 @@ export default {
models: this.$models, models: this.$models,
}; };
}, },
props: {
date: {
type: Object,
default: () => {},
},
},
props: { props: {
order: { order: {
type: Object, type: Object,
@ -37,9 +33,14 @@ export default {
}, },
components: {}, components: {},
created() {}, created() {},
mounted() {}, mounted() {
console.log(this.order);
},
destroyed() {}, destroyed() {},
methods: { methods: {
/**
* 确认价格
*/
confirmPrice() { confirmPrice() {
this.$emit("confirmPrice"); this.$emit("confirmPrice");
}, },
@ -73,6 +74,7 @@ export default {
color: #999999; color: #999999;
background-color: unset; background-color: unset;
padding: 0; padding: 0;
border: 0;
} }
} }
</style> </style>

View File

@ -56,8 +56,10 @@ export default {
this.$emit("close"); this.$emit("close");
}, },
confirmPrice() { confirmPrice() {
console.log("当前id" + this.confirmId + ",价格:" + this.price); this.$emit("confirm", {
this.$emit("confirm"); id: this.confirmId,
price: this.price,
});
}, },
}, },
}; };

View File

@ -114,6 +114,23 @@ const apis = {
auth: true, auth: true,
}, },
}, },
finish: {
t1: {
url: "/user/workerorderb/orderok",
showLoading: true,
auth: true,
},
t2: {
url: "/user/workerorderc/orderok",
showLoading: true,
auth: true,
},
t3: {
url: "",
showLoading: true,
auth: true,
}
}
}, },
} }

View File

@ -54,5 +54,18 @@ export default {
return reject(response.msg); return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
}); });
},
/**
* 完成订单
*/
finishOrder(options) {
return new Promise((resolve, reject) => {
prototype.$request(options.request).then(response => {
if (response.code == 1) {
return resolve(response.data);
}
return reject(response.msg);
}).catch(e => { });
});
} }
} }

View File

@ -47,7 +47,7 @@
</swiper> </swiper>
</view> </view>
</view> </view>
<order-confirm-price v-show="showConfirmModal" @close="showConfirmModal = false" @confirm="showConfirmModal = false" /> <order-confirm-price v-show="showConfirmModal" @close="showConfirmModal = false" @confirm="finishOrder" />
</app-layout> </app-layout>
</template> </template>
@ -134,6 +134,31 @@ export default {
this.$store.commit("order/setConfirmId", id); this.$store.commit("order/setConfirmId", id);
this.showConfirmModal = true; this.showConfirmModal = true;
}, },
/**
* 确认订单
*/
finishOrder(e) {
this.showConfirmModal = false;
let currentTab = this.tabList[this.tabIndex];
this.$models.order
.finishOrder({
request: {
api: "order.finish." + currentTab.listType,
data: {
id: e.id,
money: e.price,
},
},
})
.then((response) => {
this.$utils.toast(response.msg).then(() => {
this.switchTab(this.tabIndex);
});
})
.catch((e) => {
this.$utils.toast(e);
});
},
/** /**
* 加载数据 * 加载数据
*/ */