<template>
|
|
<view class="card order order-card__view" @click="onClick">
|
|
<view class="flex overview">
|
|
<text class="title">{{ data.itemId_dictText }}</text>
|
|
<text class="status">{{ statusCodeAndDescFieldsMapping[data.status] }}</text>
|
|
</view>
|
|
<view class="flex detail">
|
|
<image class="img" :src="data.massageItem.image"></image>
|
|
<view class="info">
|
|
<view class="flex flex-column desc">
|
|
<!-- todo: check -->
|
|
<view class="row">{{ `服务内容:${data.massageItem.title || '-'}` }}</view>
|
|
<view class="row">{{ `下单时间:${$dayjs(data.createTime).format('YYYY-MM-DD HH:mm:ss')}` }}</view>
|
|
<view class="row">{{ `订单号:${data.id || '-'}` }}</view>
|
|
</view>
|
|
<view class="price">
|
|
总价格:<text class="unit">¥</text><text class="count">{{ data.amount }}</text>
|
|
</view>
|
|
<view class="btns">
|
|
<!-- 待付款 -->
|
|
<template v-if="data.status == 0">
|
|
<button plain class="btn btn-plain" @click="onCancel">取消订单</button>
|
|
<button plain class="btn" @click="onPay">立即付款</button>
|
|
</template>
|
|
<!-- 待核销 -->
|
|
<template v-if="data.status == 1">
|
|
<button plain class="btn" @click="onVerify">去核销</button>
|
|
</template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import mixinsOrder from '@/mixins/order.js'
|
|
|
|
export default {
|
|
mixins: [mixinsOrder],
|
|
props: {
|
|
data: {
|
|
type: Object,
|
|
default() {
|
|
return {}
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
statusCodeAndDescFieldsMapping: {
|
|
0: '待付款',
|
|
1: '待核销',
|
|
2: '已完成',
|
|
3: '已取消',
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
// todo: check
|
|
if (this.data.status == 2) { // 已完成
|
|
this.$utils.navigateTo(`/pages_order/order/orderDetail?id=${this.data.id}`)
|
|
}
|
|
},
|
|
onCancel() {
|
|
// todo
|
|
uni.showModal({
|
|
title: '确认取消订单吗?',
|
|
success : e => {
|
|
if(e.confirm){
|
|
this.$api('cancelOrder', {
|
|
orderId : this.data.id,
|
|
}, res => {
|
|
this.$emit('done')
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
onPay() {
|
|
this.$store.commit('setPayOrderProduct', [
|
|
this.data.massageItem
|
|
])
|
|
|
|
this.$utils.navigateTo(`/pages_order/order/createOrder?id=${this.data.id}`)
|
|
|
|
return
|
|
// todo
|
|
this.$api('payOrder', {
|
|
orderId : this.data.id,
|
|
// todo: payType -> 支付方式(payType):0-微信支付 1-余额支付
|
|
}, res => {
|
|
if(res.code == 200){
|
|
uni.requestPaymentWxPay(res)
|
|
.then(res => {
|
|
uni.showToast({
|
|
title: '支付成功',
|
|
icon: 'none'
|
|
})
|
|
this.$emit('done')
|
|
}).catch(n => {
|
|
this.$emit('done')
|
|
})
|
|
}
|
|
})
|
|
},
|
|
onVerify() {
|
|
// uni.showModal({
|
|
// title: '确认核销订单吗?',
|
|
// success : e => {
|
|
// if(e.confirm){
|
|
// this.$api('overOrder', {
|
|
// orderId : this.data.id,
|
|
// }, res => {
|
|
// this.$emit('done')
|
|
|
|
// this.$utils.navigateTo(`/pages_order/order/verifyOrder?id=${this.data.id}`)
|
|
// })
|
|
|
|
|
|
// }
|
|
// }
|
|
// })
|
|
// todo
|
|
this.$utils.navigateTo(`/pages_order/order/verifyOrder?id=${this.data.id}`)
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.order {
|
|
background-color: $uni-fg-color;
|
|
padding: 15rpx 33rpx 0 30rpx;
|
|
|
|
& + & {
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
}
|
|
|
|
.overview {
|
|
justify-content: space-between;
|
|
font-size: 28rpx;
|
|
|
|
.title {
|
|
color: #000000;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.status {
|
|
color: $uni-color-light;
|
|
}
|
|
}
|
|
|
|
.detail {
|
|
margin-top: 9rpx;
|
|
align-items: flex-start;
|
|
|
|
.img {
|
|
width: 167rpx;
|
|
height: 167rpx;
|
|
margin-right: 15rpx;
|
|
margin-bottom: 29rpx;
|
|
}
|
|
}
|
|
|
|
.info {
|
|
flex: 1;
|
|
font-size: 22rpx;
|
|
|
|
.desc {
|
|
background-color: #F5F5F5;
|
|
border-radius: 5rpx;
|
|
padding: 13rpx 16rpx;
|
|
color: #999999;
|
|
|
|
min-height: 128rpx;
|
|
box-sizing: border-box;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.row + .row {
|
|
margin-top: 6rpx;
|
|
}
|
|
|
|
.price {
|
|
margin-top: 8rpx;
|
|
text-align: right;
|
|
color: #000000;
|
|
|
|
.count,
|
|
.unit {
|
|
color: #FF2A2A;
|
|
}
|
|
|
|
.unit {
|
|
font-size: 18rpx;
|
|
}
|
|
}
|
|
|
|
.btns {
|
|
text-align: right;
|
|
font-size: 0;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
margin-top: 16rpx;
|
|
margin-bottom: 9rpx;
|
|
display: inline-block;
|
|
width: auto;
|
|
min-width: 145rpx;
|
|
height: auto;
|
|
padding: 14rpx 28rpx;
|
|
box-sizing: border-box;
|
|
border: none;
|
|
border-radius: 29rpx;
|
|
// margin: 0;
|
|
font-size: 22rpx;
|
|
line-height: 1;
|
|
|
|
color: #FFFFFF;
|
|
background-image: linear-gradient(to right, #84A73F, #D8FF8F);
|
|
|
|
& + & {
|
|
margin-left: 39rpx;
|
|
}
|
|
|
|
&-plain {
|
|
padding: 12rpx 26rpx;
|
|
border: 2rpx solid #999999;
|
|
color: #999999;
|
|
background: none;
|
|
}
|
|
}
|
|
</style>
|