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

144 lines
3.6 KiB

3 years ago
<!--
* @Author: ch
* @Date: 2022-04-15 17:46:10
* @LastEditors: ch
2 years ago
* @LastEditTime: 2022-04-18 17:41:55
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>
<!-- 已发货可以确认收货 -->
2 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">去支付</UiButton>
</template>
<u-popup class="cancel" :show="cancelShow" @close="closeCancel" round="16rpx" closeable>
3 years ago
<view class="cancel--title">取消订单原因</view>
<radio-group class="cancel--cell" @change="cancelChange">
<UiCell title="我不想买了">
<radio slot="right-icon" value="1" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="地址信息填写错误">
<radio slot="right-icon" value="2" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="商品降价">
<radio slot="right-icon" value="3" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="商品无货">
<radio slot="right-icon" value="4" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="其他">
<radio slot="right-icon" value="5" class="cancel--radio" color="#FF875B"/>
</UiCell>
</radio-group>
<view class="cancel--footer">
<UiButton @click="closeCancel"></UiButton>
<UiButton type="gradual" :disabed="cancelValue == 0">确认取消</UiButton>
</view>
</u-popup>
2 years ago
3 years ago
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
2 years ago
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order'
3 years ago
export default {
components: { UiButton, UiCell },
props : {
orderInfo : {
type : Object,
default : () => ({})
}
},
3 years ago
data(){
return {
// 取消订单弹窗
cancelShow : false,
cancelValue : 0
}
},
methods : {
closeCancel(){
this.cancelShow = false;
this.cancelValue = 0;
},
cancelChange(val){
this.cancelValue = val;
},
async cancelOrder(){
const {error, result} = await ApiPutCancelOrder({
cancelReasonType : this.cancelValue,
orderId : this.$Route.query.id
});
if(error){
uni.$u.totast(error.message);
return false;
}
// 取消成功,跳到订单关闭页
2 years ago
},
/**
* 确认收货
*/
async receive(){
const {error} = await ApiPutOrderReceive({
orderId : this.$Route.query.id
});
if(error){
uni.$toast(error.message);
return false;
}
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%);
}
}
2 years ago
.modal{
flex: 0;
}
3 years ago
</style>