Commit e2135daf authored by shangtx's avatar shangtx

feat: 完成订单

parent 1f93a039
...@@ -65,6 +65,15 @@ export function reDispatchWorker(data) { ...@@ -65,6 +65,15 @@ export function reDispatchWorker(data) {
}) })
} }
export function finishOrder(data) {
return axios({
url: `${BASE_URL}/finish`,
method: 'post',
useFullLoading: true,
data
})
}
// 订单状态 // 订单状态
export const STATUS = { export const STATUS = {
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
</template> </template>
<script> <script>
import ImageUpload from '@/components/image-upload/ImageUpload' import ImageUpload from '@/components/image-upload/ImageUpload'
import { getDetail, STATUS } from '@/api/order' import { getDetail, STATUS, finishOrder } from '@/api/order'
import SimpleLightbox from 'simple-lightbox' import SimpleLightbox from 'simple-lightbox'
import ChooseValuator from './ChooseValuator' import ChooseValuator from './ChooseValuator'
import SendPriceModal from './SendPriceModal' import SendPriceModal from './SendPriceModal'
...@@ -155,7 +155,6 @@ export default { ...@@ -155,7 +155,6 @@ export default {
}, },
methods: { methods: {
show(id) { show(id) {
console.info('id', id)
this.id = id this.id = id
this.visible = true this.visible = true
if (this.id) { if (this.id) {
...@@ -189,13 +188,28 @@ export default { ...@@ -189,13 +188,28 @@ export default {
fetchData() { fetchData() {
getDetail(this.id).then(({ data }) => { getDetail(this.id).then(({ data }) => {
this.order = data this.order = data
console.info('data', data) // 判断是否已过服务时间
this.past = dayjs().diff(data.expectArrivalTime, 'day') > 0
this.$nextTick(() => { this.$nextTick(() => {
this.lightbox = new SimpleLightbox({ elements: '#order-images a' }) this.lightbox = new SimpleLightbox({ elements: '#order-images a' })
}) })
}) })
}, },
finish() {} finish() {
const _this = this
this.$confirm({
title: '提示',
content: '是否结束此订单',
onOk() {
finishOrder({ id: _this.id }).then(({ code }) => {
if (code == 200) {
_this.$message.success('订单已完成')
_this.fetchData()
}
})
}
})
}
}, },
mounted() {} mounted() {}
} }
......
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