@@ -45,6 +45,7 @@ | |||
<view class="action-box b-t" v-if="item.state != 9"> | |||
<button class="action-btn" v-if="item.state == 1" @click.stop="button('cancel',item)">取消订单</button> | |||
<button class="action-btn recom" v-if="item.have_paid == 0" @click.stop="button('pay',item)">立即支付</button> | |||
<button class="action-btn recom" v-if="item.state == 2" @click.stop="button('refunded',item)">退款</button> | |||
<!-- <button class="action-btn" v-if="item.have_paid != 0 && item.have_delivered == 0">提醒发货</button> --> | |||
<!-- <button class="action-btn" v-if="item.have_paid != 0" @click.stop="button('delivery',item)">查看物流</button> --> | |||
<!-- <button class="action-btn" v-if="item.have_paid != 0 && item.have_received == 0" @click.stop="button('recerved',item)">确认收货</button> --> | |||
@@ -236,7 +237,7 @@ | |||
that.navList[0].orderList[position] = item; | |||
} | |||
//取消订单后删除待付款中该项 | |||
//退款后删除待付款中该项 | |||
let list = that.navList[1].orderList; | |||
let index = list.findIndex(val => val.order_id === item.order_id); | |||
index !== -1 && list.splice(index, 1); | |||
@@ -246,6 +247,44 @@ | |||
//this.$api.msg('取消失败'); | |||
return false; | |||
}, | |||
//退款 | |||
async refunded(item) { | |||
let that = this; | |||
let [error, res] = await uni.showModal({ | |||
title: '确认退款', | |||
content: '退款之后不可恢复', | |||
}); | |||
if (res.confirm) { | |||
let result = await that.$api.request('/order/doRefund', 'POST', { | |||
order_id: item.order_id | |||
}); | |||
console.log(result) | |||
if (result) { | |||
let { | |||
stateTip, | |||
stateTipColor | |||
} = that.orderStateExp(9); | |||
item = Object.assign(item, { | |||
state: 9, | |||
stateTip, | |||
stateTipColor | |||
}); | |||
// 更新全部订单里面的状态 | |||
let position = that.navList[0].orderList.findIndex(val => val.order_id === item.order_id); | |||
if (position !== -1) { | |||
that.navList[0].orderList[position] = item; | |||
} | |||
//取消订单后删除待付款中该项 | |||
let list = that.navList[2].orderList; | |||
let index = list.findIndex(val => val.order_id === item.order_id); | |||
index !== -1 && list.splice(index, 1); | |||
} | |||
return true; | |||
} | |||
//this.$api.msg('取消失败'); | |||
return false; | |||
}, | |||
// 收货 | |||
async receivedOrder(item) { | |||
let that = this; | |||
@@ -305,7 +344,7 @@ | |||
stateTip = '待收货'; | |||
break; | |||
case 4: | |||
stateTip = '待评价'; | |||
stateTip = '已完成'; | |||
break; | |||
case 5: | |||
stateTip = '已取消'; | |||
@@ -357,6 +396,9 @@ | |||
case 'refund': | |||
this.$api.navTo('/pages/order/refund?order_id=' + item.order_id); | |||
break; | |||
case 'refunded': | |||
this.refunded(item); | |||
break; | |||
} | |||
}, | |||
pullDownRefresh() { | |||
@@ -57,8 +57,9 @@ | |||
<view class="bottom" v-if="order.state != 9"> | |||
<button class="action-btn" v-if="order.state == 1" @click.stop="button('cancel')">取消订单</button> | |||
<button class="action-btn recom" v-if="order.have_paid == 0" @click.stop="button('pay')">立即支付</button> | |||
<button class="action-btn recom" v-if="order.state == 2" @click.stop="button('refunded',item)">退款</button> | |||
<!-- <button class="action-btn" v-if="order.have_paid != 0" @click.stop="button('delivery')">查看物流</button> --> | |||
<button class="action-btn" v-if="order.have_paid != 0 && order.have_received == 0" @click.stop="button('recerved')">确认收货</button> | |||
<!-- <button class="action-btn" v-if="order.have_paid != 0 && order.have_received == 0" @click.stop="button('recerved')">确认收货</button> --> | |||
<!-- <button class="action-btn" v-if="order.have_paid != 0" @click.stop="button('refund')">申请售后</button> --> | |||
</view> | |||
<!-- <view class="bottom" v-if="order.state == 9 && order.status == -1"> | |||
@@ -154,6 +155,11 @@ | |||
case 'refund': | |||
this.$api.navTo('/pages/order/refund?order_id=' + this.order_id); | |||
break; | |||
case 'refunded': | |||
detail = await this.$api.prePage().refunded({ | |||
order_id: this.order_id | |||
}); | |||
break; | |||
} | |||
if (detail) { | |||
this.detail(this.order_id); | |||
@@ -135,11 +135,11 @@ | |||
<text class="yticon icon-fangzi"></text> | |||
<text>首页</text> | |||
</navigator> | |||
<navigator url="/pages/cart/cart" open-type="switchTab" class="p-b-btn"> | |||
<!-- <navigator url="/pages/cart/cart" open-type="switchTab" class="p-b-btn"> | |||
<text class="yticon icon-gouwuche"></text> | |||
<text>购物车</text> | |||
<text class="cart-count" v-if="product.cart_num">{{product.cart_num}}</text> | |||
</navigator> | |||
</navigator> --> | |||
<view class="p-b-btn" :class="{active: favorite}" @click="toFavorite" v-if="!flash"> | |||
<text class="yticon icon-shoucang"></text> | |||
<text>收藏</text> | |||
@@ -151,7 +151,7 @@ | |||
<view class="action-btn-group"> | |||
<button :class="{'only': flash}" type="primary" class=" action-btn no-border buy-now-btn" @click="buy">立即购买</button> | |||
<button v-if="!flash" type="primary" class=" action-btn no-border add-cart-btn" @click="addCart">加入购物车</button> | |||
<!-- <button v-if="!flash" type="primary" class=" action-btn no-border add-cart-btn" @click="addCart">加入购物车</button> --> | |||
</view> | |||
</view> | |||