You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/pages/order/detail/components/Operation.vue

155 lines
4.2 KiB

3 years ago
<!--
* @Author: ch
* @Date: 2022-04-15 17:46:10
* @LastEditors: ch
3 years ago
* @LastEditTime: 2022-04-22 22:23:35
3 years ago
* @Description: file content
-->
<template>
<view class="footer">
<!-- 支付过后都可查看物流 -->
<UiButton class="footer--btn" v-if="orderInfo.orderStatus >= 4" @click="$Router.push(`/logisitcsInfo?orderId=${orderInfo.orderId}`)"></UiButton>
<!-- 交易关闭可以联系客服 -->
<UiButton class="footer--btn" v-if="orderInfo.orderStatus === 2"></UiButton>
<!-- 已发货可以确认收货 -->
3 years ago
<UiButton class="footer--btn" v-if="orderInfo.orderStatus === 4" type="gradual" @click="receive"></UiButton>
<!-- 待支付可以取消支付订单 -->
<template v-if="orderInfo.orderStatus === 1">
<UiButton class="footer--btn" @click="cancelShow = true">取消订单</UiButton>
<UiButton class="footer--btn" type="gradual" @click="payShow = true">去支付</UiButton>
</template>
<u-popup class="cancel" :show="cancelShow" @close="closeCancel" round="16rpx" closeable>
3 years ago
<view class="cancel--title">取消订单原因</view>
3 years ago
<radio-group class="cancel--cell">
<UiCell title="我不想买了" @click="cancelChange(1)">
<radio slot="right-icon" :checked="cancelValue == 1" class="cancel--radio" color="#FF875B"/>
3 years ago
</UiCell>
3 years ago
<UiCell title="地址信息填写错误" @click="cancelChange(2)">
<radio slot="right-icon" :checked="cancelValue == 2" class="cancel--radio" color="#FF875B"/>
3 years ago
</UiCell>
3 years ago
<UiCell title="商品降价" @click="cancelChange(3)">
<radio slot="right-icon" :checked="cancelValue == 3" class="cancel--radio" color="#FF875B"/>
3 years ago
</UiCell>
3 years ago
<UiCell title="商品无货" @click="cancelChange(4)">
<radio slot="right-icon" :checked="cancelValue == 4" class="cancel--radio" color="#FF875B"/>
3 years ago
</UiCell>
3 years ago
<UiCell title="其他" @click="cancelChange(5)">
<radio slot="right-icon" :checked="cancelValue == 5" class="cancel--radio" color="#FF875B"/>
3 years ago
</UiCell>
</radio-group>
<view class="cancel--footer">
<UiButton @click="closeCancel"></UiButton>
3 years ago
<UiButton type="gradual" :disabed="cancelValue == 0" @click="cancelOrder"></UiButton>
3 years ago
</view>
</u-popup>
<BsPay class="modal" :show.sync="payShow" :order="orderInfo"></BsPay>
3 years ago
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
3 years ago
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order'
import BsPay from '../../../../components/BsPay.vue'
3 years ago
export default {
components: { UiButton, UiCell, BsPay },
props : {
orderInfo : {
type : Object,
default : () => ({})
}
},
3 years ago
data(){
return {
// 取消订单弹窗
cancelShow : false,
cancelValue : 0,
// 支付
payShow : false
3 years ago
}
},
methods : {
closeCancel(){
this.cancelShow = false;
this.cancelValue = 0;
},
cancelChange(val){
this.cancelValue = val;
},
async cancelOrder(){
3 years ago
const ooderId = this.$Route.query.id;
3 years ago
const {error, result} = await ApiPutCancelOrder({
cancelReasonType : this.cancelValue,
3 years ago
orderId : ooderId
3 years ago
});
if(error){
uni.$u.toast(error.message);
3 years ago
return false;
}
3 years ago
this.$Router.replace(`/orderDetail?id=${ooderId}`);
3 years ago
// 取消成功,跳到订单关闭页
3 years ago
},
/**
* 确认收货
*/
async receive(){
this.$msb.confirm({
content : '确认已经收到货了吗?',
confirm : async ()=>{
const {error} = await ApiPutOrderReceive({
orderId : this.$Route.query.id
});
if(error){
uni.$toast(error.message);
return false;
}
3 years ago
this.$Router.push('/orderSuccess');
}
})
3 years ago
}
}
}
</script>
<style lang="scss" scoped>
.footer{
height: 138rpx;
padding: 0 30rpx;
background: $color-grey0;
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: flex-end;
align-items: center;
&--btn{
display: inline-block;
3 years ago
margin: 0 0 0 30rpx;
}
}
.cancel{
flex: 0;
3 years ago
&--title{
text-align: center;
font-size: 34rpx;
margin: 40rpx 0 30rpx;
}
&--cell{
padding: 0 40rpx;
}
&--footer{
padding: 68rpx 40rpx;
display: flex;
justify-content: space-between;
}
&--radio{
transform: scale(60%);
}
}
3 years ago
.modal{
flex: 0;
}
3 years ago
</style>