新增用户管理,活动管理

This commit is contained in:
gyq 2024-05-17 18:33:37 +08:00
parent 1d674d15d3
commit d7dd3d3372
6 changed files with 286 additions and 2 deletions

View File

@ -1,9 +1,9 @@
ENV = 'development'
# 接口地址
# VUE_APP_BASE_API = 'http://192.168.2.128:8000'
VUE_APP_BASE_API = 'http://192.168.2.44:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.96:8000'
VUE_APP_WS_API = 'ws://192.168.2.128:8000'

View File

@ -404,3 +404,27 @@ export function geocode(params) {
params
});
}
/**
* 新增修改活动
* @returns
*/
export function modityActivate(data) {
return request({
url: `/shop/storage/modityActivate`,
method: "post",
data
});
}
/**
* 活动列表
* @returns
*/
export function findActivate(params) {
return request({
url: `/shop/storage/findActivate`,
method: "get",
params
});
}

View File

@ -0,0 +1,132 @@
<template>
<div class="app-container">
<!-- <div class="head-container">
<el-form :model="query" inline>
<el-form-item>
<el-input v-model="query.shopId" placeholder="请输入店铺ID"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
</div> -->
<div class="head-container">
<el-button type="primary" icon="el-icon-plus" @click="$refs.addActive.show()">
添加活动
</el-button>
</div>
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
<el-table-column label="店铺ID" prop="shopId"></el-table-column>
<el-table-column label="最小金额" prop="minNum"></el-table-column>
<el-table-column label="最大金额" prop="maxNum"></el-table-column>
<el-table-column label="赠送金额" prop="handselNum"></el-table-column>
<el-table-column label="赠送类型" prop="handselType">
<template v-slot="scope">
{{ scope.row.handselType | handselTypeFilter }}
</template>
</el-table-column>
<!-- <el-table-column label="排序" sortable prop="sort"></el-table-column> -->
<el-table-column label="是否启用" prop="isDel">
<template v-slot="scope">
<el-switch v-model="scope.row.isDel" active-value="0" inactive-value="1"
@change="statusChange($event, scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template v-slot="scope">
<el-button type="text" icon="el-icon-edit"
@click="$refs.addActive.show(scope.row)">编辑</el-button>
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
slot="reference">删除</el-button>
</el-popconfirm> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total"></el-pagination>
</div>
<addActive ref="addActive" @success="getTableData" />
</div>
</template>
<script>
import handselTypes from './handselTypes'
import addActive from './components/addActive'
import { findActivate, modityActivate } from '@/api/shop'
import dayjs from 'dayjs'
export default {
components: {
addActive
},
data() {
return {
query: {
shopId: ''
},
tableData: {
data: [],
page: 0,
size: 10,
loading: false,
total: 0
}
}
},
filters: {
handselTypeFilter(value) {
return handselTypes.find(item => item.value == value).label
},
timeFilter(s) {
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
}
},
mounted() {
this.getTableData()
},
methods: {
//
async statusChange(e, row) {
try {
this.tableData.loading = true
const data = { ...row }
data.status = e
await modityActivate(data)
this.getTableData()
} catch (error) {
console.log(error)
this.tableData.loading = false
}
},
//
resetHandle() {
this.query.name = ''
this.query.type = ''
this.getTableData()
},
//
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
//
async getTableData() {
this.tableData.loading = true
try {
const res = await findActivate({
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.data = res
this.tableData.total = res.length
} catch (error) {
console.log(error)
}
}
}
}
</script>

View File

@ -0,0 +1,115 @@
<template>
<div>
<el-dialog :title="form.id ? '编辑活动' : '添加活动'" :visible.sync="dialogVisible" @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="最小金额">
<el-input-number v-model="form.minNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="最大金额">
<el-input-number v-model="form.maxNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="赠送数量">
<el-input-number v-model="form.handselNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="赠送类型">
<el-select v-model="form.handselType">
<el-option :label="item.label" :value="item.value" v-for="item in handselTypes"
:key="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import handselTypes from '../handselTypes'
import { modityActivate } from '@/api/shop'
export default {
data() {
return {
dialogVisible: false,
loading: false,
handselTypes: handselTypes,
form: {
id: '',
shopId: '',
minNum: 1,
maxNum: 1,
handselNum: 1, //
handselType: 'GD',
isDel: '0'
},
resetForm: '',
rules: {
minNum: [
{
required: true,
message: ' ',
trigger: 'blur'
}
],
maxNum: [
{
required: true,
message: ' ',
trigger: 'blur'
}
]
}
}
},
mounted() {
this.resetForm = { ...this.form }
},
methods: {
//
classifySuccess(e) {
this.form.config.categoryList = e
},
onSubmitHandle() {
console.log(this.form)
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true
this.form.shopId = localStorage.getItem('shopId')
let res = await modityActivate(this.form)
this.$emit('success', res)
this.close()
this.$notify({
title: '成功',
message: `${this.form.id ? '编辑' : '添加'}成功`,
type: 'success'
});
this.loading = false
} catch (error) {
this.loading = false
console.log(error)
}
}
})
},
show(obj) {
this.dialogVisible = true
if (obj && obj.id) {
this.form = { ...obj }
}
},
close() {
this.dialogVisible = false
},
reset() {
this.form = { ...this.resetForm }
}
}
}
</script>

View File

@ -0,0 +1,10 @@
export default [
{
label: "固定金额",
value: "GD"
},
{
label: "比例",
value: "RATIO"
}
];

View File

@ -0,0 +1,3 @@
<template>
<div>用户列表</div>
</template>