123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="default-main ">
- <el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info"
- show-icon/>
- <el-row>
- <el-col :span="24">
-
- <TableHeader :buttons="['refresh', 'add', 'edit', 'delete', 'comSearch']"
- quick-search-placeholder="通过订单号模糊搜索"
- @action="baTable.onTableHeaderAction"/>
-
-
- <Table @action="baTable.onTableAction"/>
- </el-col>
- </el-row>
- <auditDialog ref="dialogRef" @close="baTable.onTableHeaderAction('refresh', {loading: true})"></auditDialog>
- </div>
- </template>
- <script setup lang="ts">
- import _ from 'lodash'
- import {ref, onMounted, provide} from 'vue'
- import {order, orderRefund} from '/@/api/controllerUrls'
- import Table from '/@/components/table/index.vue'
- import TableHeader from '/@/components/table/header/index.vue'
- import {useRouter} from 'vue-router'
- import {defaultOptButtons} from '/@/components/table'
- import {baTableApi} from '/@/api/common'
- import baTableClass from '/@/utils/baTable'
- import useCurrentInstance from '/@/utils/useCurrentInstance'
- import {auth} from "/@/utils/common";
- import auditDialog from './auditDialog.vue'
- const router = useRouter()
- let auditBtn: OptButton[] = [
- {
- render: 'tipButton',
- name: 'audit',
- title: '审核',
- text: '审核',
- type: 'warning',
- icon: '',
- class: 'table-row-edit',
- disabledTip: false,
- },
- ]
- function optButtons() {
- let newBtns = defaultOptButtons([])
- if (auth('audit') == true) {
- newBtns = _.concat(auditBtn, newBtns)
- }
- return newBtns
- }
- const tableRef = ref()
- const baTable = new baTableClass(
- new baTableApi(orderRefund),
- {
- dblClickNotEditColumn: [undefined, 'status'],
- column: [
- {label: '会员姓名', prop: 'memberName', align: 'center', width: 120, operator: false},
- {label: '订单编号', prop: 'orderNumber' ,"min-width":'180px', align: 'left', operator: 'LIKE'},
- {label: '退款原因', prop: 'refundReason',"min-width":'180px', align: 'left', operator: false},
- {label: '申请退款金额', prop: 'requestAmount', align: 'center', width: 120, operator: false},
- {
- label: '退款类型',
- prop: 'refundType',
- align: 'center',
- render: 'tag',
- operator: '=',
- width: 120,
- custom: {0: '', 1: '', 2: '', 3: 'success', 4: 'warning', 5: 'info', 6: 'info'},
- replaceValue: {0: '全额退款', 1: '部分退款',},
- },
- {
- label: '退款状态',
- prop: 'refundStatus',
- align: 'center',
- render: 'tag',
- operator: '=',
- width: 120,
- custom: {0: 'warning', 1: 'info'},
- replaceValue: {0: '待退款', 1: '已退款',},
- },
- {label: '退款金额', prop: 'auditAmount', align: 'center', width: 120, operator: false},
- {
- label: '审核状态',
- prop: 'auditStatus',
- align: 'center',
- render: 'tag',
- operator: '=',
- width: 120,
- custom: {0: 'warning', 1: 'success', 2: 'info'},
- replaceValue: {0: '待审核', 1: '审核通过', 2: '审核驳回',},
- },
- {label: '创建时间', prop: 'createTime', align: 'center', width: '170', operator: false},
- {
- label: '操作',
- align: 'center',
- width: 120,
- render: 'buttons',
- buttons: optButtons(),
- operator: false
- },
- ],
- },
- {
- defaultItems: {
- },
- },
- {
-
- requestEdit: () => {
- if (baTable.form.items && !baTable.form.items.icon) baTable.form.items.icon = 'el-icon-Minus'
- },
- }
- )
- provide('baTable', baTable)
- baTable.mount()
- baTable.getIndex()
- onMounted(() => {
- const {proxy} = useCurrentInstance()
-
- proxy.eventBus.on('onTableButtonClick', (data: { name: string; row: TableRow }) => {
- if (!baTable.activate) return
- if (data.name == 'audit') {
- buttonClick(data.row)
- }
- })
- })
- let dialogRef = ref()
- const buttonClick = (row: TableRow) => {
- if (!row) return
- let rowClone = _.cloneDeep(row)
- dialogRef.value.open(rowClone)
- }
- </script>
- <style scoped lang="scss"></style>
|