kk_888
3 years ago
4 changed files with 373 additions and 1 deletions
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function add(data) { |
||||
return request({ |
||||
url: 'api/cyVipOrder', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export function del(ids) { |
||||
return request({ |
||||
url: 'api/cyVipOrder/', |
||||
method: 'delete', |
||||
data: ids |
||||
}) |
||||
} |
||||
|
||||
export function edit(data) { |
||||
return request({ |
||||
url: 'api/cyVipOrder', |
||||
method: 'put', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export function show(data) { |
||||
return request({ |
||||
url: 'api/cyVipOrder', |
||||
method: 'get', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export function Export(data) { |
||||
return request({ |
||||
url: '/api/cyVipOrder/download', |
||||
method: 'get', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export function back(data) { |
||||
return request({ |
||||
url: '/api/cyVipOrder/refundVip', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
export default { add, edit, del,show,back} |
@ -0,0 +1,317 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!--工具栏--> |
||||
<div class="head-container"> |
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
||||
<crudOperation :permission="permission" /> |
||||
|
||||
<!--表单组件--> |
||||
<el-dialog |
||||
:close-on-click-modal="false" |
||||
:before-close="handleClose" |
||||
:title="crud.status.title" |
||||
:visible.sync="dialogVisible" |
||||
width="500px" |
||||
> |
||||
<el-form |
||||
ref="form" |
||||
:model="form" |
||||
:rules="rules" |
||||
size="small" |
||||
label-width="80px" |
||||
> |
||||
<el-form-item label="id"> |
||||
<el-input v-model="form.id" style="width: 370px" /> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="订单编号" prop="orderId"> |
||||
<el-input v-model="form.orderId" style="width: 370px" /> |
||||
</el-form-item> |
||||
<el-form-item label="用户编号" prop="uid"> |
||||
<el-input v-model="form.uid" style="width: 370px" /> |
||||
</el-form-item> |
||||
<el-form-item label="年限" prop="num"> |
||||
<el-input v-model="form.num" style="width: 370px" /> |
||||
</el-form-item> |
||||
<el-form-item label="支付状态"> |
||||
<el-radio |
||||
v-for="item in dict.is_enable" |
||||
:key="item.id" |
||||
v-model="form.payState" |
||||
:label="item.value" |
||||
>{{ item.label }}</el-radio |
||||
> |
||||
</el-form-item> |
||||
<el-form-item label="订单创建时间"> |
||||
<el-date-picker |
||||
v-model="form.createTime" |
||||
type="datetime" |
||||
style="width: 370px" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="updateTime"> |
||||
<el-date-picker |
||||
v-model="form.updateTime" |
||||
type="datetime" |
||||
style="width: 370px" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="isDel"> |
||||
<el-input v-model="form.isDel" style="width: 370px" /> |
||||
</el-form-item> |
||||
<el-form-item label="支付时间"> |
||||
<el-input v-model="form.payTime" style="width: 370px" /> |
||||
</el-form-item> --> |
||||
<el-form-item label="金额"> |
||||
<el-input v-model="form.money" style="width: 370px" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="text" @click="dialogVisible = false">取消</el-button> |
||||
<el-button :loading="crud.cu === 2" type="primary" @click="submitCU" |
||||
>确认</el-button |
||||
> |
||||
</div> |
||||
</el-dialog> |
||||
<!--表格渲染--> |
||||
<el-table |
||||
ref="table" |
||||
:data="crud.data" |
||||
size="small" |
||||
style="width: 100%" |
||||
@selection-change="crud.selectionChangeHandler" |
||||
> |
||||
<el-table-column type="selection" width="55" /> |
||||
<el-table-column v-if="columns.visible('id')" prop="id" label="id" /> |
||||
<el-table-column |
||||
v-if="columns.visible('orderId')" |
||||
prop="orderId" |
||||
label="订单号" |
||||
/> |
||||
<el-table-column |
||||
v-if="columns.visible('uid')" |
||||
prop="uid" |
||||
label="用户姓名" |
||||
/> |
||||
<el-table-column |
||||
v-if="columns.visible('num')" |
||||
prop="num" |
||||
label="年限" |
||||
/> |
||||
<el-table-column |
||||
v-if="columns.visible('payState')" |
||||
prop="payState" |
||||
label="支付状态" |
||||
> |
||||
<template slot-scope="scope"> |
||||
{{ dict.label.is_enable[scope.row.payState] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
v-if="columns.visible('createTime')" |
||||
prop="createTime" |
||||
label="订单创建时间" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
v-if="columns.visible('updateTime')" |
||||
prop="updateTime" |
||||
label="更新时间" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.updateTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column |
||||
v-if="columns.visible('isDel')" |
||||
prop="isDel" |
||||
label="isDel" |
||||
/> --> |
||||
<el-table-column |
||||
v-if="columns.visible('payTime')" |
||||
prop="payTime" |
||||
label="支付时间" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.payTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
v-if="columns.visible('money')" |
||||
prop="money" |
||||
label="金额" |
||||
/> |
||||
<el-table-column |
||||
v-permission="['admin', 'cyVipOrder:edit', 'cyVipOrder:del']" |
||||
label="操作" |
||||
width="150px" |
||||
align="center" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<el-button |
||||
type="info" |
||||
class="filter-item" |
||||
size="mini" |
||||
:loading="crud.delAllLoading" |
||||
@click="moneyback(scope.row)" |
||||
> |
||||
退款 |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!--分页组件--> |
||||
|
||||
<pagination /> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import crudCyVipOrder from "@/api/cyVipOrder"; |
||||
import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
||||
import initData from "@/mixins/crud"; |
||||
import rrOperation from "@crud/RR.operation"; |
||||
import crudOperation from "@crud/CRUD.operation"; |
||||
import udOperation from "@crud/UD.operation"; |
||||
import pagination from "@crud/Pagination"; |
||||
import MaterialList from "@/components/material"; |
||||
|
||||
// crud交由presenter持有 |
||||
const defaultCrud = CRUD({ |
||||
title: "vipOrder", |
||||
url: "api/cyVipOrder", |
||||
sort: "id,desc", |
||||
crudMethod: { ...crudCyVipOrder }, |
||||
}); |
||||
const defaultForm = { |
||||
id: null, |
||||
orderId: null, |
||||
uid: null, |
||||
num: null, |
||||
payState: null, |
||||
createTime: null, |
||||
updateTime: null, |
||||
isDel: null, |
||||
payTime: null, |
||||
money: null, |
||||
}; |
||||
export default { |
||||
name: "CyVipOrder", |
||||
components: { |
||||
pagination, |
||||
crudOperation, |
||||
rrOperation, |
||||
udOperation, |
||||
MaterialList, |
||||
}, |
||||
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], |
||||
dicts: ["is_enable"], |
||||
data() { |
||||
return { |
||||
mixins: [initData], |
||||
permission: { |
||||
add: ["admin", "cyVipOrder:add"], |
||||
edit: ["admin", "cyVipOrder:edit"], |
||||
del: ["admin", "cyVipOrder:del"], |
||||
show: ["admin", "cyVipOrder:show"], |
||||
}, |
||||
rules: { |
||||
orderId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
uid: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
num: [ |
||||
{ |
||||
required: true, |
||||
message: "数量-年限-默认1不能为空", |
||||
trigger: "blur", |
||||
}, |
||||
], |
||||
}, |
||||
form: [], |
||||
tableData: [], |
||||
totalElements: 0, |
||||
dialogVisible: false, |
||||
}; |
||||
}, |
||||
watch: {}, |
||||
created() { |
||||
this.hide(); |
||||
}, |
||||
methods: { |
||||
show() { |
||||
crudCyVipOrder.show().then((res) => { |
||||
// console.log(res); |
||||
this.tableData = res.content; |
||||
this.totalElements = res.totalElements; |
||||
}); |
||||
}, |
||||
toDelete(datas) { |
||||
this.$confirm(`确认删除选中的${datas.length}条数据?`, "提示", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning", |
||||
}) |
||||
.then(() => { |
||||
this.crud.delAllLoading = true; |
||||
this.crud.doDelete(datas); |
||||
}) |
||||
.catch(() => {}); |
||||
}, |
||||
|
||||
moneyback(row) { |
||||
this.dialogVisible = true; |
||||
this.form = row; |
||||
}, |
||||
handleClose() { |
||||
this.dialogVisible = false; |
||||
}, |
||||
|
||||
submitCU() { |
||||
if (this.form.id != "" && this.form.money != "") { |
||||
let param = {}; |
||||
crudCyVipOrder |
||||
.back( |
||||
(param = { |
||||
id: this.form.id, |
||||
price: this.form.money, |
||||
}) |
||||
) |
||||
.then((res) => { |
||||
this.$message({ |
||||
message: "退款成功!", |
||||
type: "success", |
||||
}); |
||||
this.dialogVisible = false; |
||||
}); |
||||
} |
||||
}, |
||||
hide() { |
||||
this.crud.optShow.add = false; |
||||
this.crud.optShow.edit = false; |
||||
}, |
||||
// 获取数据前设置好接口地址 |
||||
[CRUD.HOOK.beforeRefresh]() { |
||||
return true; |
||||
}, // 新增与编辑前做的操作 |
||||
[CRUD.HOOK.afterToCU](crud, form) {}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.table-img { |
||||
display: inline-block; |
||||
text-align: center; |
||||
background: #ccc; |
||||
color: #fff; |
||||
white-space: nowrap; |
||||
position: relative; |
||||
overflow: hidden; |
||||
vertical-align: middle; |
||||
width: 32px; |
||||
height: 32px; |
||||
line-height: 32px; |
||||
} |
||||
</style> |
Loading…
Reference in new issue