【类 型】:feat
【主 题】:任务栏 退款模块 【描 述】: [原因]:添加退款功能 :主动退款;买家申请退款 [过程]:调用退款 接口 配合腾讯支付的回调 ,实现退款功能 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
6ec5717fa0
commit
915beab7db
@ -76,8 +76,8 @@
|
||||
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||
<font class="m-l-5">提交任务</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState & 2" key="wirteBut" type="info"
|
||||
icon="f-s-14 iconfont el-icon-loading" disabled>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState & 2" key="wirteBut" type="info" :loading="true"
|
||||
disabled>
|
||||
<font class="m-l-5">航点写入中···</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState & 4 && !(planeState & 16)" type="warning"
|
||||
|
@ -1,5 +1,24 @@
|
||||
<template>
|
||||
<div class="p-15">
|
||||
<!-- 退款设置弹出框 -->
|
||||
<el-dialog :title="'设置退款金额'" :visible.sync="dialogVisible" :append-to-body="true" width="30%">
|
||||
<el-form label-position="left">
|
||||
<el-form-item label="退款金额" label-width="90px">
|
||||
<el-input placeholder="输入金额,不可超过订单总金额" v-model="refundPrice">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
<div class="fc-w">{{ refundType === 'buyer' ? `买家申请退款金额${refundApply_price}元,此订单总额为${refundTotal_price}元` :
|
||||
`此订单总额为${refundTotal_price}元`
|
||||
}}</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button size="medium" type="danger"
|
||||
@click="refund(refundOrder_sn, refundShop_id, refundPrice, refundType)">确认退款</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 任务tab -->
|
||||
<el-collapse v-model="activeNames" accordion>
|
||||
<template v-if="list.length != 0">
|
||||
<el-collapse-item class="mainFontColor" v-for="(item, index) in list" :key="index" :name="item.id">
|
||||
@ -51,32 +70,37 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="操作" span="3">
|
||||
<el-button-group v-if="item.refund_status == '申请中'">
|
||||
<el-button type="danger" icon="iconfont icon-zhengque"
|
||||
@click="refund(item.order_sn, item.shop_id, item.total_price, '已同意')">
|
||||
<font class="m-l-5">同意退款</font>
|
||||
<el-button @click="setRefundItem(item, index, 'buyer'); dialogVisible = true"
|
||||
:loading="refundIndex === index" :disabled="refundIndex === index" type="danger"
|
||||
icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">{{ refundIndex === index ? '退款中...' : '同意退款' }}</font>
|
||||
</el-button>
|
||||
<el-button @click="questAss(item.id, 'refund_status', '拒绝退')" type="warning" icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">拒绝退款</font>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button-group v-else-if="item.refund_status !== '申请中' && item.shipment_status == '未接单'">
|
||||
<el-button @click="setRefundItem(item, index, 'seller'); dialogVisible = true"
|
||||
:loading="refundIndex === index" :disabled="refundIndex === index" type="danger"
|
||||
icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">{{ refundIndex === index ? '退款中...' : '取消订单' }}</font>
|
||||
</el-button>
|
||||
<el-button @click="orderPrint(index)" type="info" icon="iconfont icon-dayin">
|
||||
<font class="m-l-5">打印小票</font>
|
||||
</el-button>
|
||||
<el-button @click="questAss(item.id, 'shipment_status', '已接单')" type="primary"
|
||||
icon="iconfont icon-chengjie">
|
||||
<font class="m-l-5">确认接单</font>
|
||||
</el-button>
|
||||
<el-button type="danger" icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">取消订单</font>
|
||||
</el-button>
|
||||
<el-button type="info" icon="iconfont icon-dayin">
|
||||
<font class="m-l-5" @click="orderPrint(index)">打印小票</font>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button-group v-else-if="item.refund_status !== '申请中' && item.shipment_status == '已接单'">
|
||||
<el-button type="danger" icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">取消订单</font>
|
||||
<el-button @click="setRefundItem(item, index, 'seller'); dialogVisible = true"
|
||||
:loading="refundIndex === index" :disabled="refundIndex === index" type="danger"
|
||||
icon="iconfont icon-cuowu">
|
||||
<font class="m-l-5">{{ refundIndex === index ? '退款中...' : '取消订单' }}</font>
|
||||
</el-button>
|
||||
<el-button type="info" icon="iconfont icon-dayin">
|
||||
<font class="m-l-5" @click="orderPrint(index)">打印小票</font>
|
||||
<el-button @click="orderPrint(index)" type="info" icon="iconfont icon-dayin">
|
||||
<font class="m-l-5">打印小票</font>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button-group v-else-if="item.refund_status !== '申请中' && item.shipment_status == '已发货'">
|
||||
@ -106,7 +130,16 @@ import { questAss, refund } from '@/utils/api/table'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
activeNames: []
|
||||
activeNames: [],
|
||||
dialogVisible: false, // 弹出窗口 显隐
|
||||
refundIndex: null, // 标记 索引 操作对应索引的按钮ui样式等
|
||||
tempRefundIndex: null,
|
||||
refundTotal_price: null, // 退款订单的总额
|
||||
refundApply_price: null, // 客户申请退款 的金额
|
||||
refundPrice: null, // 退款额 ps:传订单总价 为退款的默认值
|
||||
refundOrder_sn: null, // 退款订单号
|
||||
refundShop_id: null, // 退款商铺id
|
||||
refundType: null// 退款类型
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -116,8 +149,29 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
questAss, // 修改订单
|
||||
refund, // 退款接口
|
||||
refund (refundOrderSn, refundShopId, refundPrice, refundType) {
|
||||
refund(refundOrderSn, refundShopId, refundPrice, refundType).then(res => {
|
||||
if (res.data.status === 1) {
|
||||
this.dialogVisible = false
|
||||
this.refundIndex = this.tempRefundIndex
|
||||
}
|
||||
})
|
||||
}, // 退款接口
|
||||
parseTime, // 时间戳格式化
|
||||
setRefundItem (item, index, refundType) {
|
||||
console.log(item)
|
||||
this.tempRefundIndex = index
|
||||
this.refundTotal_price = item.total_price
|
||||
this.refundApply_price = item.apply_price
|
||||
if (refundType === 'buyer') { // 如果买家申请 默认退款表单显示买家申请值
|
||||
this.refundPrice = item.apply_price
|
||||
} else { // 否则 主动退 默认退款表单 显示为退款额上限 即订单总价
|
||||
this.refundPrice = item.total_price
|
||||
}
|
||||
this.refundOrder_sn = item.order_sn
|
||||
this.refundShop_id = item.shop_id
|
||||
this.refundType = refundType
|
||||
},
|
||||
/**
|
||||
* @description: 通过蓝牙打印机并打印小票
|
||||
* @param {number} index 订单列表下标索引
|
||||
@ -194,6 +248,10 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
list () {
|
||||
this.refundIndex = null
|
||||
this.tempRefundIndex = null
|
||||
}
|
||||
},
|
||||
created () {
|
||||
}
|
||||
|
@ -77,6 +77,10 @@ label {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
//mapboxgl
|
||||
.mapboxgl-ctrl-bottom-left a {
|
||||
display: none !important;
|
||||
|
@ -17,6 +17,7 @@ export async function apiCrosFrequency (params) {
|
||||
} else {
|
||||
Message.error(res.data.msg)
|
||||
}
|
||||
return res
|
||||
}
|
||||
/**
|
||||
* @description: 向改变订单承接任务api 提交数据 () ,并更新订单列表
|
||||
@ -44,10 +45,10 @@ export function questAss (id, state, val) {
|
||||
* @description: 退款函数
|
||||
* @param {*} orderSn 订单号
|
||||
* @param {*} shopId 商铺id
|
||||
* @param {*} refundPrice 退款金额 单位元
|
||||
* @param {*} refundType 退款类型
|
||||
* @param {*} refundPrice 退款金额 单位元
|
||||
* @param {*} refundType 退款类型 'buyer'买家申请 'seller'卖家主动
|
||||
*/
|
||||
export function refund (orderSn, shopId, refundPrice, refundType) {
|
||||
export async function refund (orderSn, shopId, refundPrice, refundType) {
|
||||
// 构建请求参数
|
||||
const params = new URLSearchParams()
|
||||
params.append('order_sn', orderSn)
|
||||
@ -56,17 +57,13 @@ export function refund (orderSn, shopId, refundPrice, refundType) {
|
||||
params.append('refund_type', refundType)
|
||||
|
||||
// 发送退款请求
|
||||
api.post('refund', params, 'Pay')
|
||||
.then(res => {
|
||||
if (res.data.status === 1) {
|
||||
Message.success('退款申请成功')
|
||||
console.log('退款成功', res.data.msg)
|
||||
} else {
|
||||
Message.error('退款申请失败')
|
||||
console.error('退款失败:', res.data.msg)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('退款请求错误:', error)
|
||||
})
|
||||
const res = await api.post('refund', params, 'Pay')
|
||||
if (res.data.status === 1) {
|
||||
Message.success('退款申请中...')
|
||||
console.log('退款成功', res.data.msg)
|
||||
} else {
|
||||
Message.error(res.data.msg)
|
||||
console.error('退款失败:', res.data.msg)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user