Commit 8e263211 authored by 罗林杰's avatar 罗林杰

修改金币页面

parent fc4b10fc
......@@ -2,27 +2,36 @@
<div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="类型" prop="type">
<el-input
<el-select
v-model="queryParams.type"
placeholder="请输入类型"
placeholder="请选择类型"
clearable
:maxlength="1"
size="small"
style="width: 150px"
/>
>
<el-option
v-for="item in typeOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item
label="方式"
prop="actionType"
>
<el-input
<el-form-item label="方式" prop="actionType">
<el-select
v-model="queryParams.actionType"
placeholder="请输入方式"
placeholder="请选择方式"
clearable
:maxlength="2"
size="small"
style="width: 150px"
/>
>
<el-option
v-for="item in actionTypeOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="订单id" prop="orderId">
<el-input
......@@ -66,16 +75,12 @@
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="类型" prop="type" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.type || '-' }}
<span>{{ getTypeLabel(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column
label="方式"
prop="actionType"
:show-overflow-tooltip="true"
>
<el-table-column label="方式" prop="actionType" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.actionType || '-' }}
<span>{{ getActionTypeLabel(scope.row.actionType) }}</span>
</template>
</el-table-column>
<el-table-column label="金币数量" prop="count" :show-overflow-tooltip="true">
......@@ -127,61 +132,13 @@
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- 添加或修改金币流水表配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
<el-form-item label="类型" prop="type">
<el-input v-model.trim="form.type" show-word-limit :maxlength="1" placeholder="请输入1:充值 2:消费" />
</el-form-item>
<el-form-item
label="方式"
prop="actionType"
>
<el-input
v-model.trim="form.actionType"
show-word-limit
:maxlength="2"
placeholder="方式"
/>
</el-form-item>
<el-form-item label="金币数量" prop="count">
<el-input-number v-model.trim="form.count" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="交易后的余额" prop="endCount">
<el-input-number v-model.trim="form.endCount" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="订单id" prop="orderId">
<el-input v-model.trim="form.orderId" show-word-limit :maxlength="50" placeholder="请输入订单id" />
</el-form-item>
<el-form-item label="目标id,用户id" prop="targetId">
<el-input v-model.trim="form.targetId" show-word-limit :maxlength="50" placeholder="请输入目标id,用户id" />
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.flag">
<el-radio label="1">启用</el-radio>
<el-radio label="0">停用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model.trim="form.remarks" maxlength="200" show-word-limit type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="cancel">取 消</el-button>
<el-button class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listMemGoldCoinFlow,
getMemGoldCoinFlow,
delMemGoldCoinFlow,
addMemGoldCoinFlow,
updateMemGoldCoinFlow,
exportMemGoldCoinFlow } from '@/api/contentManagement/memGoldCoinFlow'
delMemGoldCoinFlow } from '@/api/contentManagement/memGoldCoinFlow'
import commonField from '@/utils/commonField'
export default {
name: 'MemGoldCoinFlow',
......@@ -208,6 +165,46 @@ export default {
dictValue: '0'
}
],
typeOptions: [
{
dictLabel: '充值',
dictValue: '1'
},
{
dictLabel: '消费',
dictValue: '2'
}
],
actionTypeOptions: [
{
dictLabel: '用户充值',
dictValue: '10'
},
{
dictLabel: '系统充值',
dictValue: '11'
},
{
dictLabel: '点赞',
dictValue: '20'
},
{
dictLabel: '发动态',
dictValue: '21'
},
{
dictLabel: '留言',
dictValue: '22'
},
{
dictLabel: '要微信联系方式',
dictValue: '23'
},
{
dictLabel: '接收微信请求',
dictValue: '24'
}
],
// 查询参数
queryParams: {
page: 1,
......@@ -287,60 +284,6 @@ export default {
}
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加金币流水表'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.businessId
getMemGoldCoinFlow(id).then(response => {
this.form = response.data
this.open = true
this.title = '修改金币流水表'
})
},
// 改变状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateMemGoldCoinFlow(row)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
updateMemGoldCoinFlow(this.form).then(response => {
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addMemGoldCoinFlow(this.form).then(response => {
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.businessId
......@@ -359,26 +302,13 @@ export default {
}).catch(function() {
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportMemGoldCoinFlow(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '金币流水表信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
})
getTypeLabel(value) {
const option = this.typeOptions.find(option => option.dictValue === value)
return option ? option.dictLabel : '-'
},
getActionTypeLabel(value) {
const option = this.actionTypeOptions.find(option => option.dictValue === value)
return option ? option.dictLabel : '-'
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment