【类 型】:fix
【主 题】: 【描 述】:退款功能 [原因]:添加退款方法 [过程]:向后端退款接口请求 规矩回调 订阅 更新订单状态 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
06439ccb1b
commit
6ec5717fa0
@ -8,16 +8,10 @@
|
||||
export default {
|
||||
props: {
|
||||
startDate: {
|
||||
type: Number,
|
||||
default () {
|
||||
return Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
||||
}
|
||||
type: Number
|
||||
},
|
||||
endDate: {
|
||||
type: Number,
|
||||
default () {
|
||||
return Math.floor(new Date(new Date().setHours(23, 59, 59, 999)).getTime() / 1000)
|
||||
}
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -51,7 +51,8 @@
|
||||
</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">
|
||||
<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>
|
||||
<el-button @click="questAss(item.id, 'refund_status', '拒绝退')" type="warning" icon="iconfont icon-cuowu">
|
||||
@ -100,7 +101,7 @@
|
||||
|
||||
<script>
|
||||
import { parseTime } from '@/utils/index'
|
||||
import { questAss } from '@/utils/api/table'
|
||||
import { questAss, refund } from '@/utils/api/table'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -115,6 +116,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
questAss, // 修改订单
|
||||
refund, // 退款接口
|
||||
parseTime, // 时间戳格式化
|
||||
/**
|
||||
* @description: 通过蓝牙打印机并打印小票
|
||||
|
@ -40,6 +40,7 @@ export default {
|
||||
tempPath: tempPath,
|
||||
apiPlanePath: '/mpApi/Plane/',
|
||||
apiAdminPath: '/mpApi/Admin/',
|
||||
apiPayPath: '/mpApi/Pay/',
|
||||
apiLoginPath: '/mpApi/Login/',
|
||||
/**
|
||||
* @description: mqtt服务器
|
||||
|
@ -13,6 +13,7 @@ const {
|
||||
tempPath,
|
||||
apiPlanePath,
|
||||
apiAdminPath,
|
||||
apiPayPath,
|
||||
apiLoginPath,
|
||||
mqttHost,
|
||||
mqttPort,
|
||||
@ -33,6 +34,7 @@ const state = {
|
||||
tempPath: tempPath,
|
||||
apiPlanePath: apiPlanePath,
|
||||
apiAdminPath: apiAdminPath,
|
||||
apiPayPath: apiPayPath,
|
||||
apiLoginPath: apiLoginPath,
|
||||
mqttHost: mqttHost,
|
||||
mqttPort: mqttPort,
|
||||
|
@ -63,6 +63,9 @@ function init (prefix) {
|
||||
} else if (prefix === 'Admin') {
|
||||
axios.defaults.headers.common.Token = store.state.user.token
|
||||
path = store.state.settings.apiAdminPath
|
||||
} else if (prefix === 'Pay') {
|
||||
axios.defaults.headers.common.Token = store.state.user.token
|
||||
path = store.state.settings.apiPayPath
|
||||
} else if (prefix === 'Login') {
|
||||
axios.defaults.headers.common.Token = 'login'
|
||||
path = store.state.settings.apiLoginPath
|
||||
|
@ -39,3 +39,34 @@ export function questAss (id, state, val) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 退款函数
|
||||
* @param {*} orderSn 订单号
|
||||
* @param {*} shopId 商铺id
|
||||
* @param {*} refundPrice 退款金额 单位元
|
||||
* @param {*} refundType 退款类型
|
||||
*/
|
||||
export function refund (orderSn, shopId, refundPrice, refundType) {
|
||||
// 构建请求参数
|
||||
const params = new URLSearchParams()
|
||||
params.append('order_sn', orderSn)
|
||||
params.append('shop_id', shopId)
|
||||
params.append('refund_price', refundPrice)
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<SelectionShopId class="w-100" v-model="shop_id" :allSel="true" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<DatePickerOrder class="w-100" />
|
||||
<DatePickerOrder class="w-100" :startDate="startDate" :endDate="endDate" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<SearchOrder class="w-100" />
|
||||
@ -21,7 +21,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 订单列表 -->
|
||||
<el-table class="m-t-20 w-100" ref="myTable"
|
||||
<!-- <el-table class="m-t-20 w-100" ref="myTable"
|
||||
:data="orderListArr.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
|
||||
<el-table-column align="center" type="selection" width="40">
|
||||
</el-table-column>
|
||||
@ -35,9 +35,9 @@
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.addtime | parseTime('{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="controler" label="操作" width="380" min-width="380">
|
||||
<template slot-scope="scope">
|
||||
</el-table-column>
|
||||
<el-table-column prop="controler" label="操作" width="380" min-width="380">
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button type="warning" icon="el-icon-edit">同意退款</el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" @click="deleteAdmin([scope.row.id])">拒绝退款</el-button>
|
||||
@ -45,12 +45,12 @@
|
||||
@click="$router.replace(`/order/show/${scope.row.id}`)">查看</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination class="m-t-20" layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize"
|
||||
<!-- <el-pagination class="m-t-20" layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize"
|
||||
:total="orderListArr.length">
|
||||
</el-pagination>
|
||||
</el-pagination> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -80,66 +80,72 @@ export default {
|
||||
SearchOrder
|
||||
},
|
||||
computed: {
|
||||
// 获取订单列表
|
||||
orderList () {
|
||||
return this.$store.state.orderList
|
||||
startDate () {
|
||||
return Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
||||
},
|
||||
// 获取搜索条件 对象(从缓存拿 缓存没有从本地拿 也没有 给对象的所有搜索属性空值)
|
||||
orderSerch () {
|
||||
return this.$store.getters['app/getOrderSerch']
|
||||
},
|
||||
// 过滤订单列表组
|
||||
orderListArr () {
|
||||
if (this.orderList.length > 0) {
|
||||
let filteredList = this.orderList
|
||||
// 过滤shop_id
|
||||
if (this.shop_id !== '') {
|
||||
filteredList = filteredList.filter(order => order.shop_id === this.shop_id)
|
||||
}
|
||||
// 过滤时间
|
||||
if (this.orderSerch.start_time !== '' && this.orderSerch.end_time !== '') {
|
||||
const startTime = parseInt(this.orderSerch.start_time)
|
||||
const endTime = parseInt(this.orderSerch.end_time)
|
||||
filteredList = filteredList.filter(order => {
|
||||
const orderTime = parseInt(order.addtime)
|
||||
return startTime < orderTime && orderTime < endTime
|
||||
})
|
||||
}
|
||||
// 过滤订单状态
|
||||
if (this.orderSerch.status.length > 0) {
|
||||
filteredList = filteredList.filter(order => {
|
||||
// 检查订单状态是否在this.status数组中
|
||||
return this.orderSerch.status.includes(order.status)
|
||||
})
|
||||
}
|
||||
// 过滤订单状态
|
||||
if (this.orderSerch.back.length > 0) {
|
||||
filteredList = filteredList.filter(order => {
|
||||
// 检查订单状态是否在this.status数组中
|
||||
return this.orderSerch.back.includes(order.back)
|
||||
})
|
||||
}
|
||||
// 搜索条件过滤
|
||||
if (this.orderSerch.search[1] !== '') {
|
||||
filteredList = filteredList.filter(order => {
|
||||
if (this.orderSerch.search[0] === 'orderId') {
|
||||
return order.order_sn.indexOf(this.orderSerch.search[1]) >= 0
|
||||
} else if (this.orderSerch.search[0] === 'name') {
|
||||
return order.receiver.indexOf(this.orderSerch.search[1]) >= 0
|
||||
} else if (this.orderSerch.search[0] === 'tel') {
|
||||
return order.tel.indexOf(this.orderSerch.search[1]) >= 0
|
||||
} else if (this.orderSerch.search[0] === 'remark') {
|
||||
return order.remark.indexOf(this.orderSerch.search[1]) >= 0
|
||||
} else if (this.orderSerch.search[0] === 'desc') {
|
||||
return order.describe.indexOf(this.orderSerch.search[1]) >= 0
|
||||
}
|
||||
})
|
||||
}
|
||||
return filteredList
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
endDate () {
|
||||
return Math.floor(new Date(new Date().setHours(23, 59, 59, 999)).getTime() / 1000)
|
||||
}
|
||||
// 获取订单列表
|
||||
// orderList () {
|
||||
// return this.$store.state.orderList
|
||||
// },
|
||||
// // 获取搜索条件 对象(从缓存拿 缓存没有从本地拿 也没有 给对象的所有搜索属性空值)
|
||||
// orderSerch () {
|
||||
// return this.$store.getters['app/getOrderSerch']
|
||||
// },
|
||||
// // 过滤订单列表组
|
||||
// orderListArr () {
|
||||
// if (this.orderList.length > 0) {
|
||||
// let filteredList = this.orderList
|
||||
// // 过滤shop_id
|
||||
// if (this.shop_id !== '') {
|
||||
// filteredList = filteredList.filter(order => order.shop_id === this.shop_id)
|
||||
// }
|
||||
// // 过滤时间
|
||||
// if (this.orderSerch.start_time !== '' && this.orderSerch.end_time !== '') {
|
||||
// const startTime = parseInt(this.orderSerch.start_time)
|
||||
// const endTime = parseInt(this.orderSerch.end_time)
|
||||
// filteredList = filteredList.filter(order => {
|
||||
// const orderTime = parseInt(order.addtime)
|
||||
// return startTime < orderTime && orderTime < endTime
|
||||
// })
|
||||
// }
|
||||
// // 过滤订单状态
|
||||
// if (this.orderSerch.status.length > 0) {
|
||||
// filteredList = filteredList.filter(order => {
|
||||
// // 检查订单状态是否在this.status数组中
|
||||
// return this.orderSerch.status.includes(order.status)
|
||||
// })
|
||||
// }
|
||||
// // 过滤订单状态
|
||||
// if (this.orderSerch.back.length > 0) {
|
||||
// filteredList = filteredList.filter(order => {
|
||||
// // 检查订单状态是否在this.status数组中
|
||||
// return this.orderSerch.back.includes(order.back)
|
||||
// })
|
||||
// }
|
||||
// // 搜索条件过滤
|
||||
// if (this.orderSerch.search[1] !== '') {
|
||||
// filteredList = filteredList.filter(order => {
|
||||
// if (this.orderSerch.search[0] === 'orderId') {
|
||||
// return order.order_sn.indexOf(this.orderSerch.search[1]) >= 0
|
||||
// } else if (this.orderSerch.search[0] === 'name') {
|
||||
// return order.receiver.indexOf(this.orderSerch.search[1]) >= 0
|
||||
// } else if (this.orderSerch.search[0] === 'tel') {
|
||||
// return order.tel.indexOf(this.orderSerch.search[1]) >= 0
|
||||
// } else if (this.orderSerch.search[0] === 'remark') {
|
||||
// return order.remark.indexOf(this.orderSerch.search[1]) >= 0
|
||||
// } else if (this.orderSerch.search[0] === 'desc') {
|
||||
// return order.describe.indexOf(this.orderSerch.search[1]) >= 0
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// return filteredList
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
countSelIdArr
|
||||
|
Loading…
Reference in New Issue
Block a user