<template>
|
<view class="bussiness-order-detail">
|
<view class="name" v-if="type==='travel'&&dto.items&&dto.items.length==1">{{dto.items[0].name || '-'}}</view>
|
<view class="name">{{dto.orderNo || dto.tripName || '-'}}</view>
|
<view class="price" >{{dto.statusStr=='CLOSED'&&'已关闭' || dto.statusStr ||'已支付'}}<span v-if="type!=='travel'">: <span class="dot">¥
|
</span>{{dto.paymentAmount ||'0.0'}}</span></view>
|
<view class="price">总金额: <span class="dot">¥ </span>{{dto.totalAmount || dto.price ||'0.0'}}</view>
|
|
<view class="time m-t-12">
|
下单时间: {{ dto.createdDate || '-'}}
|
</view>
|
<!-- <view class="time">
|
支付时间: {{ dto.paymentTime || '-'}}
|
</view> -->
|
<view class="info-user info" v-if="type!=='travel'">
|
<view class="flex">
|
<view class="line"></view>
|
<view class="title">下单商品</view>
|
</view>
|
<view class="flex scroll-canteen m-t-12">
|
<scroll-view class="flex scroll-view" :scroll-x="true" style="max-width: 640rpx;" v-if="dto.items">
|
<view class="flex">
|
<view v-for="each of dto.items" class="item-each">
|
<image :src="each.cover" class="cover"></image>
|
<view class="cover-name word-e">{{each.name}}({{each.num || 0}}件)</view>
|
</view>
|
</view>
|
</scroll-view>
|
<view v-if="!dto.items">
|
暂无
|
</view>
|
</view>
|
</view>
|
<view class="info-user info">
|
<view class="flex">
|
<view class="line"></view>
|
<view class="title">用户信息</view>
|
</view>
|
<view class="user">
|
<view class="">
|
姓名: {{dto.nickName || dto.customer ||'暂无'}}
|
</view>
|
<view class="">
|
手机: {{dto.tel || dto.customerTel ||'暂无'}}
|
</view>
|
<view class="" v-if="type!=='travel'">
|
地址: {{dto.customerAddress || dto.customerAddress ||'暂无'}}
|
</view>
|
</view>
|
</view>
|
<view class="info-wuliu info">
|
<view class="flex">
|
<view class="line"></view>
|
<view class="title">行程详情</view>
|
<view class="button-green-text m-l-a m-r-0 " @click="toKbDetail"
|
v-if="type==='good'&&dto.deliveryNo&&dto.deliveryName">
|
查看物流详情
|
</view>
|
</view>
|
<view class="status-list">
|
<uni-section v-if="list2.length>0">
|
<uni-steps :options="list2" active-icon="checkbox" active-color="#04BA97" :active="active"
|
direction="column" />
|
</uni-section>
|
<view v-if="list2.length==0">
|
暂无
|
</view>
|
</view>
|
</view>
|
|
<view class="info-user info" v-if="type!=='travel'&¤tInfo.id&&!currentInfo.openId&&dto.status!=='REFUND'&&dto.checkStatus!=='COMPLETED'">
|
<view class="flex">
|
<view class="line"></view>
|
<view class="title">送达凭证</view>
|
<view class="button-green-text m-l-a m-r-0" v-if="dto.status!=='COMPLETED'" @click="uploadFile">上传
|
</view>
|
|
</view>
|
<view class="m-t-12">
|
<view v-if="uploadFiles&&uploadFiles.length>0" class="flex ">
|
<view v-for="(url) of uploadFiles" class="file-text m-r-10 m-b-5" :key="url">
|
<image :src="url" @click="deletePic(index)"
|
style="width: 180rpx ;height: 180rpx;border: 1px solid #333;"></image>
|
</view>
|
</view>
|
</view>
|
|
</view>
|
<view style="min-height: 100rpx;">
|
|
</view>
|
<view class="button-green" @click="oporder"
|
v-if="(type=='travel'&&dto.status=='P' || type!=='travel')&&dto.checkStatus!=='COMPLETED'&&dto.status!=='REFUND'&¤tInfo.id&&!currentInfo.openId"
|
style="position: fixed;left: 30rpx;right: 30rpx;bottom: 40rpx;width: auto;">
|
{{ type=='travel'&&'扫码核销'
|
|| type=='canteen'&&'确认送达'
|
|| type=='good'&&'确认送达'
|
|| type=='shop'&&'确认送达' || '-'}}
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
methods: {
|
toKbDetail() {
|
if (this.dto.deliveryNo && this.dto.deliveryName && this.dto.deliveryNo.trim() && this.dto.deliveryName
|
.trim()) {
|
uni.navigateTo({
|
url: `plugin://kdPlugin/index?num=${this.dto.deliveryNo.trim()}&appName=${this.dto.deliveryName.trim()}`,
|
})
|
} else {
|
this.$message.showToast('尚未设置物流信息')
|
}
|
|
},
|
async oporder() {
|
if (this.type == 'travel') {
|
await this.$message.confirm('确定核销吗?')
|
//扫二维码确认
|
let that = this
|
uni.scanCode({
|
success: async function(res) {
|
console.log('条码内容:' + res.result);
|
var dto = undefined
|
try {
|
dto = JSON.parse(res.result)
|
if (!!dto['tripId']) {
|
//请求核销
|
if (dto['tripId'] !== that.id) {
|
that.$message.showToast('非此活动二维码')
|
} else {
|
|
that.$message.showLoading()
|
const {
|
code
|
} = await that.$http.request('get',
|
'/api/trip/employee/check/user/trip', {
|
params: {
|
userId: that.userId,
|
tripId: that.id,
|
}
|
})
|
that.$message.hideLoading()
|
if (code == 0) {
|
that.$message.showToast('核销成功')
|
that.dto.status = 'G'
|
}
|
}
|
|
} else {
|
that.$message.showToast('二维码格式不正确扫码失败')
|
}
|
} catch (e) {
|
that.$message.showToast('二维码格式不正确扫码失败')
|
}
|
},
|
fail() {
|
that.$message.showToast('扫码失败')
|
|
}
|
});
|
|
|
|
} else {
|
//都要凭证:employeeArriveImage
|
if (this.uploadFiles.length == 0) {
|
this.$message.showToast('请至少上传一张送达凭证')
|
return
|
}
|
await this.$message.confirm('确定送达吗?')
|
|
var checkurl = ''
|
if (this.type == 'canteen') {
|
checkurl = '/api/canteen/employee/order/set/arrive'
|
}
|
if (this.type == 'shop') {
|
checkurl = '/api/buy/employee/order/set/arrive'
|
}
|
if (this.type == 'good') {
|
checkurl = '/api/wabao/employee/order/set/arrive'
|
}
|
var dto = {
|
id: this.id,
|
employeeArriveImage: JSON.stringify(this.uploadFiles)
|
}
|
this.$message.showLoading()
|
const {
|
code
|
} = await this.$http.request('post', checkurl, {
|
data: dto
|
})
|
this.$message.hideLoading()
|
if (code == 0) {
|
this.$message.showToast('操作成功')
|
//刷新状态
|
setTimeout(() => {
|
this.getDetail()
|
}, 500)
|
}
|
|
}
|
|
},
|
async deletePic(index) {
|
await this.$message.confirm('删除此凭证吗?')
|
this.uploadFiles.splice(index, 1)
|
},
|
async uploadFile() {
|
//选择图片or相册
|
if (this.uploadFiles.length >= 6) {
|
this.$message.showToast('至多上传6张送达凭证')
|
return
|
}
|
const that = this
|
uni.chooseImage({
|
count: 6, // 最多可以选择的图片张数,默认9
|
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
sourceType: ['album',
|
'camera'
|
], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项
|
success: function({
|
errMsg,
|
tempFiles
|
}) {
|
if (errMsg === 'chooseImage:ok') {
|
that.$message.showLoading()
|
for (var file of tempFiles) {
|
that.$http.upload(file.path).then(res => {
|
var url = res.data && res.data.length > 0 && res.data[0].url
|
that.uploadFiles.push(url)
|
})
|
}
|
that.$message.hideLoading()
|
|
}
|
|
},
|
error: function() {}
|
})
|
},
|
async getDetail() {
|
this.$message.showLoading()
|
|
{
|
const {
|
data
|
} = await this.$http.request('get', this.api, {
|
params: {}
|
})
|
this.dto = {
|
...data
|
}
|
}
|
if (this.type !== 'travel' || this.dto.orderId) {
|
const {
|
data
|
} = await this.$http.request('get', '/api/order/get/' + (this.type == 'travel' ? this.dto.orderId :
|
this.id), {
|
params: {}
|
})
|
if (data) {
|
this.dto = {
|
...this.dto,
|
...data
|
}
|
}
|
|
}
|
if (this.type !== 'travel') {
|
//设置物流
|
this.list2 = []
|
this.list2.push({
|
title: '买家下单',
|
desc: this.dto.createdDate || '待下单'
|
})
|
if (this.dto.createdDate) {
|
this.active = 1
|
}
|
this.list2.push({
|
title: '买家支付',
|
desc: this.dto.paymentTime || '待支付'
|
})
|
if (this.dto.paymentTime) {
|
this.active = 2
|
}
|
this.list2.push({
|
title: !this.dto.employeeArriveTime && '骑手配送中' || '骑手已核销',
|
desc: this.dto.employeeArriveTime || '-'
|
})
|
if (this.dto.employeeArriveTime) {
|
this.active = 3
|
}
|
|
if(this.type=='good'){
|
this.list2.push({
|
title: !this.dto.deliverySignTime && '待签收' || '快递送达',
|
desc: this.dto.deliverySignTime || '-'
|
})
|
if (this.dto.deliverySignTime) {
|
this.active = 3
|
}
|
if (this.dto.refundTime) {
|
this.list2.push({
|
title: '退款',
|
desc: this.dto.refundTime || '待退款'
|
})
|
this.active = 4
|
}
|
}else{
|
if (this.dto.refundTime) {
|
this.list2.push({
|
title: '退款',
|
desc: this.dto.refundTime || '待退款'
|
})
|
this.active = 4
|
}
|
}
|
|
|
|
|
|
|
} else {
|
//出去玩的页面
|
this.list2 = []
|
this.active = 1
|
this.list2.push({
|
title: !(this.dto.createdDate || this.dto.time) && '待下单' || '已下单',
|
desc: this.dto.createdDate || this.dto.time || '-'
|
})
|
|
this.list2.push({
|
title: !this.dto.getOnTime && '待上车' || '已上车',
|
desc: this.dto.getOnTime || '-'
|
})
|
this.list2.push({
|
title: !this.dto.overTime && '活动进行中' || '活动结束',
|
desc: this.dto.overTime || '-'
|
})
|
if (this.dto.getOnTime) {
|
this.active = 2
|
}
|
if (this.dto.overTime) {
|
this.active = 3
|
}
|
}
|
this.$message.hideLoading()
|
console.log('order-detail', this.dto)
|
|
}
|
},
|
|
data() {
|
return {
|
tabs: [{
|
name: '团购',
|
id: 'shop',
|
api: '/api/buy/employee/order/get/',
|
// apiuser:'/api/buy/customer/group/get/'
|
},
|
{
|
name: '粗去玩',
|
id: 'travel',
|
api: '/api/trip/employee/get/user/check?id='
|
// api: '/api/order/get/'
|
},
|
{
|
name: '每日维C',
|
id: 'canteen',
|
api: '/api/canteen/employee/order/get/'
|
|
},
|
{
|
name: '挖宝商品',
|
id: 'good',
|
api: '/api/wabao/employee/order/get/'
|
|
},
|
],
|
api: '',
|
type: '',
|
userId: '',
|
id: '',
|
dto: {
|
|
},
|
order: {
|
|
},
|
active: 0,
|
list2: [],
|
uploadFiles: [],
|
}
|
},
|
onLoad(options) {
|
this.type = options.type || ''
|
this.id = options.id || ''
|
this.userId = options.userId || ''
|
for (var item of this.tabs) {
|
if (item.id == this.type) {
|
//出去玩比较特殊处理一下,是针对活动里的某个人,而非整体,其他都是整体
|
if(this.currentInfo.id&&!this.currentInfo.openId){
|
//商家
|
if (this.type == 'travel') {
|
// this.api += '&userId=' + this.userId
|
this.api = item.api + this.userId
|
} else {
|
// if(this.currentInfo.id&&!this.currentInfo.openId){
|
// //普通用户
|
// if(item.apiuser){
|
// this.api = item.apiuser + this.id
|
// }else{
|
// this.api = item.api + this.id
|
|
// }
|
// }else{
|
this.api = item.api + this.id
|
// }
|
}
|
}else{
|
//学生
|
this.api = '/api/order/get/' + this.id
|
}
|
|
break
|
}
|
}
|
this.getDetail()
|
|
|
},
|
|
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import './bussiness-order-detail.scss'
|
</style>
|