hupeng
5 years ago
40 changed files with 528 additions and 20 deletions
@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function add(data) { |
||||
return request({ |
||||
url: 'api/yxExpress', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export function del(id) { |
||||
return request({ |
||||
url: 'api/yxExpress/' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
export function edit(data) { |
||||
return request({ |
||||
url: 'api/yxExpress', |
||||
method: 'put', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
|
Before Width: | Height: | Size: 600 B After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,103 @@
|
||||
<template> |
||||
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px"> |
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px"> |
||||
<el-form-item label="快递公司编号" prop="code"> |
||||
<el-input v-model="form.code" style="width: 300px;"/> |
||||
</el-form-item> |
||||
<el-form-item label="快递公司名称" > |
||||
<el-input v-model="form.name" style="width: 300px;"/> |
||||
</el-form-item> |
||||
<el-form-item label="排序" > |
||||
<el-input v-model="form.sort" style="width: 300px;"/> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="text" @click="cancel">取消</el-button> |
||||
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { add, edit } from '@/api/yxExpress' |
||||
export default { |
||||
props: { |
||||
isAdd: { |
||||
type: Boolean, |
||||
required: true |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
loading: false, dialog: false, |
||||
form: { |
||||
id: '', |
||||
code: '', |
||||
name: '', |
||||
sort: 0 |
||||
}, |
||||
rules: { |
||||
code: [ |
||||
{ required: true, message: 'please enter', trigger: 'blur' } |
||||
], |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
cancel() { |
||||
this.resetForm() |
||||
}, |
||||
doSubmit() { |
||||
this.loading = true |
||||
if (this.isAdd) { |
||||
this.doAdd() |
||||
} else this.doEdit() |
||||
}, |
||||
doAdd() { |
||||
add(this.form).then(res => { |
||||
this.resetForm() |
||||
this.$notify({ |
||||
title: '添加成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
this.loading = false |
||||
this.$parent.init() |
||||
}).catch(err => { |
||||
this.loading = false |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
doEdit() { |
||||
edit(this.form).then(res => { |
||||
this.resetForm() |
||||
this.$notify({ |
||||
title: '修改成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
this.loading = false |
||||
this.$parent.init() |
||||
}).catch(err => { |
||||
this.loading = false |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
resetForm() { |
||||
this.dialog = false |
||||
this.$refs['form'].resetFields() |
||||
this.form = { |
||||
id: '', |
||||
code: '', |
||||
name: '', |
||||
sort: '', |
||||
isShow: '' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,118 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!--工具栏--> |
||||
<div class="head-container"> |
||||
<!-- 新增 --> |
||||
<div style="display: inline-block;margin: 0px 2px;"> |
||||
<el-button |
||||
v-permission="['ADMIN','YXEXPRESS_ALL','YXEXPRESS_CREATE']" |
||||
class="filter-item" |
||||
size="mini" |
||||
type="primary" |
||||
icon="el-icon-plus" |
||||
@click="add">新增</el-button> |
||||
</div> |
||||
</div> |
||||
<!--表单组件--> |
||||
<eForm ref="form" :is-add="isAdd"/> |
||||
<!--表格渲染--> |
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> |
||||
<el-table-column prop="code" label="快递公司编号"/> |
||||
<el-table-column prop="name" label="快递公司名称"/> |
||||
<el-table-column prop="sort" label="排序"/> |
||||
<el-table-column v-if="checkPermission(['ADMIN','YXEXPRESS_ALL','YXEXPRESS_EDIT','YXEXPRESS_DELETE'])" label="操作" width="150px" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-permission="['ADMIN','YXEXPRESS_ALL','YXEXPRESS_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/> |
||||
<el-popover |
||||
v-permission="['ADMIN','YXEXPRESS_ALL','YXEXPRESS_DELETE']" |
||||
:ref="scope.row.id" |
||||
placement="top" |
||||
width="180"> |
||||
<p>确定删除本条数据吗?</p> |
||||
<div style="text-align: right; margin: 0"> |
||||
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button> |
||||
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button> |
||||
</div> |
||||
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/> |
||||
</el-popover> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!--分页组件--> |
||||
<el-pagination |
||||
:total="total" |
||||
:current-page="page + 1" |
||||
style="margin-top: 8px;" |
||||
layout="total, prev, pager, next, sizes" |
||||
@size-change="sizeChange" |
||||
@current-change="pageChange"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import checkPermission from '@/utils/permission' |
||||
import initData from '@/mixins/initData' |
||||
import { del } from '@/api/yxExpress' |
||||
import eForm from './form' |
||||
export default { |
||||
components: { eForm }, |
||||
mixins: [initData], |
||||
data() { |
||||
return { |
||||
delLoading: false, |
||||
} |
||||
}, |
||||
created() { |
||||
this.$nextTick(() => { |
||||
this.init() |
||||
}) |
||||
}, |
||||
methods: { |
||||
checkPermission, |
||||
beforeInit() { |
||||
this.url = 'api/yxExpress' |
||||
const sort = 'id,desc' |
||||
this.params = { page: this.page, size: this.size, sort: sort } |
||||
return true |
||||
}, |
||||
subDelete(id) { |
||||
this.delLoading = true |
||||
del(id).then(res => { |
||||
this.delLoading = false |
||||
this.$refs[id].doClose() |
||||
this.dleChangePage() |
||||
this.init() |
||||
this.$notify({ |
||||
title: '删除成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
}).catch(err => { |
||||
this.delLoading = false |
||||
this.$refs[id].doClose() |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
add() { |
||||
this.isAdd = true |
||||
this.$refs.form.dialog = true |
||||
}, |
||||
edit(data) { |
||||
this.isAdd = false |
||||
const _this = this.$refs.form |
||||
_this.form = { |
||||
id: data.id, |
||||
code: data.code, |
||||
name: data.name, |
||||
sort: data.sort, |
||||
isShow: data.isShow |
||||
} |
||||
_this.dialog = true |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,213 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!--工具栏--> |
||||
<div class="head-container"> |
||||
<!-- 搜索 --> |
||||
<el-input v-model="nickname" clearable placeholder="输入用户昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/> |
||||
<el-select v-model="category" clearable placeholder="明细种类" class="filter-item" style="width: 130px"> |
||||
<el-option |
||||
v-for="item in categoryOptions" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value"> |
||||
</el-option> |
||||
</el-select> |
||||
<el-select v-model="type" clearable placeholder="明细类型" class="filter-item" style="width: 130px"> |
||||
<el-option |
||||
v-for="item in typeOptions" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value"> |
||||
</el-option> |
||||
</el-select> |
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button> |
||||
<!-- 新增 --> |
||||
</div> |
||||
<!--表单组件--> |
||||
<eForm ref="form" :is-add="isAdd"/> |
||||
<pForm ref="formp" :is-add="isAdd"/> |
||||
<!--表格渲染--> |
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> |
||||
<el-table-column prop="nickname" label="用户昵称"/> |
||||
<el-table-column prop="title" label="账单标题"/> |
||||
<el-table-column prop="category" label="明细种类"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.category == 'now_money'">余额</span> |
||||
<span v-else-if="scope.row.category == 'integral'">积分</span> |
||||
<span v-else>未知</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="number" label="明细数字"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.pm == 1">+</span> |
||||
<span v-else>-</span> |
||||
<span>{{ scope.row.number }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column :show-overflow-tooltip="true" prop="addTime" label="创建日期"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ formatTime(scope.row.addTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!--分页组件--> |
||||
<el-pagination |
||||
:total="total" |
||||
:current-page="page + 1" |
||||
style="margin-top: 8px;" |
||||
layout="total, prev, pager, next, sizes" |
||||
@size-change="sizeChange" |
||||
@current-change="pageChange"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import checkPermission from '@/utils/permission' |
||||
import initData from '@/mixins/initData' |
||||
import { del, onStatus } from '@/api/yxUser' |
||||
import eForm from './form' |
||||
import pForm from './formp' |
||||
import { formatTime } from '@/utils/index' |
||||
export default { |
||||
components: { eForm, pForm }, |
||||
mixins: [initData], |
||||
data() { |
||||
return { |
||||
delLoading: false, nickname: '', category: '', type: '', |
||||
queryTypeOptions: [ |
||||
{ key: 'nickname', display_name: '用户昵称' }, |
||||
{ key: 'phone', display_name: '手机号码' } |
||||
], |
||||
categoryOptions: [ |
||||
{ value: 'now_money', label: '余额' }, |
||||
{ value: 'integral', label: '积分' } |
||||
], |
||||
typeOptions: [ |
||||
{ value: 'brokerage', label: '佣金' }, |
||||
{ value: 'sign', label: '签到' } |
||||
] |
||||
} |
||||
}, |
||||
created() { |
||||
this.$nextTick(() => { |
||||
this.init() |
||||
}) |
||||
}, |
||||
methods: { |
||||
formatTime, |
||||
checkPermission, |
||||
onStatus(id, status) { |
||||
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}) |
||||
.then(() => { |
||||
onStatus(id, { status: status }).then(({ data }) => { |
||||
this.$message({ |
||||
message: '操作成功', |
||||
type: 'success', |
||||
duration: 1000, |
||||
onClose: () => { |
||||
this.init() |
||||
} |
||||
}) |
||||
}) |
||||
}) |
||||
.catch(() => { }) |
||||
}, |
||||
beforeInit() { |
||||
this.url = 'api/yxUserBill' |
||||
const sort = 'id,desc' |
||||
this.params = { |
||||
page: this.page, |
||||
size: this.size, |
||||
nickname: this.nickname, |
||||
category: this.category, |
||||
type: this.type |
||||
} |
||||
const query = this.query |
||||
const type = query.type |
||||
const value = query.value |
||||
if (type && value) { this.params[type] = value } |
||||
return true |
||||
}, |
||||
subDelete(uid) { |
||||
this.delLoading = true |
||||
del(uid).then(res => { |
||||
this.delLoading = false |
||||
this.$refs[uid].doClose() |
||||
this.dleChangePage() |
||||
this.init() |
||||
this.$notify({ |
||||
title: '删除成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
}).catch(err => { |
||||
this.delLoading = false |
||||
this.$refs[uid].doClose() |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
add() { |
||||
this.isAdd = true |
||||
this.$refs.form.dialog = true |
||||
}, |
||||
edit(data) { |
||||
this.isAdd = false |
||||
const _this = this.$refs.form |
||||
_this.form = { |
||||
uid: data.uid, |
||||
account: data.account, |
||||
pwd: data.pwd, |
||||
realName: data.realName, |
||||
birthday: data.birthday, |
||||
cardId: data.cardId, |
||||
mark: data.mark, |
||||
partnerId: data.partnerId, |
||||
groupId: data.groupId, |
||||
nickname: data.nickname, |
||||
avatar: data.avatar, |
||||
phone: data.phone, |
||||
addTime: data.addTime, |
||||
addIp: data.addIp, |
||||
lastTime: data.lastTime, |
||||
lastIp: data.lastIp, |
||||
nowMoney: data.nowMoney, |
||||
brokeragePrice: data.brokeragePrice, |
||||
integral: data.integral, |
||||
signNum: data.signNum, |
||||
status: data.status, |
||||
level: data.level, |
||||
spreadUid: data.spreadUid, |
||||
spreadTime: data.spreadTime, |
||||
userType: data.userType, |
||||
isPromoter: data.isPromoter, |
||||
payCount: data.payCount, |
||||
spreadCount: data.spreadCount, |
||||
cleanTime: data.cleanTime, |
||||
addres: data.addres, |
||||
adminid: data.adminid, |
||||
loginType: data.loginType |
||||
} |
||||
_this.dialog = true |
||||
}, |
||||
editP(data) { |
||||
this.isAdd = false |
||||
const _this = this.$refs.formp |
||||
_this.form = { |
||||
uid: data.uid, |
||||
nickname: data.nickname, |
||||
ptype: 1, |
||||
money: 0 |
||||
} |
||||
_this.dialog = true |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue