From a222801f6776b0a6a010aacccb383de6ed7f2720 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 30 九月 2025 14:38:34 +0800
Subject: [PATCH] 规则
---
manager/src/api/prize-ruler.js | 17 ++
manager/src/views/activity-prize/prize-ruler.vue | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 349 insertions(+), 0 deletions(-)
diff --git a/manager/src/api/prize-ruler.js b/manager/src/api/prize-ruler.js
new file mode 100644
index 0000000..408a031
--- /dev/null
+++ b/manager/src/api/prize-ruler.js
@@ -0,0 +1,17 @@
+import service from "../libs/axios";
+
+export const getPage = (params) =>{
+ return service({
+ url: "/lmk/prizeRuler",
+ method: "GET",
+ params: params
+ })
+}
+
+export const updateById = (params) =>{
+ return service({
+ url: "/lmk/prizeRuler",
+ method: "PUT",
+ data: params
+ })
+}
diff --git a/manager/src/views/activity-prize/prize-ruler.vue b/manager/src/views/activity-prize/prize-ruler.vue
new file mode 100644
index 0000000..e19a1c9
--- /dev/null
+++ b/manager/src/views/activity-prize/prize-ruler.vue
@@ -0,0 +1,332 @@
+<template>
+ <div>
+ <Card>
+ <!-- 鎼滅储琛ㄥ崟 -->
+<!-- <Form-->
+<!-- ref="searchForm"-->
+<!-- @keydown.enter.native="handleSearch"-->
+<!-- :model="searchForm"-->
+<!-- inline-->
+<!-- :label-width="80"-->
+<!-- class="search-form"-->
+<!-- >-->
+<!-- <FormItem label="瑙勫垯鍚嶇О" prop="ruleName">-->
+<!-- <Input-->
+<!-- type="text"-->
+<!-- v-model="searchForm.ruleName"-->
+<!-- placeholder="璇疯緭鍏ヨ鍒欏悕绉�"-->
+<!-- clearable-->
+<!-- @on-clear="handleSearch"-->
+<!-- @on-change="handleSearch"-->
+<!-- style="width: 180px"-->
+<!-- />-->
+<!-- </FormItem>-->
+<!-- <FormItem label="瑙勫垯缂栫爜" prop="ruleCode">-->
+<!-- <Input-->
+<!-- type="text"-->
+<!-- v-model="searchForm.ruleCode"-->
+<!-- placeholder="璇疯緭鍏ヨ鍒欑紪鐮�"-->
+<!-- clearable-->
+<!-- @on-clear="handleSearch"-->
+<!-- @on-change="handleSearch"-->
+<!-- style="width: 180px"-->
+<!-- />-->
+<!-- </FormItem>-->
+
+<!-- <Button-->
+<!-- @click="handleSearch"-->
+<!-- type="primary"-->
+<!-- icon="ios-search"-->
+<!-- class="search-btn"-->
+<!-- >鎼滅储</Button>-->
+<!-- <Button-->
+<!-- @click="resetSearch"-->
+<!-- icon="md-refresh"-->
+<!-- style="margin-left: 8px"-->
+<!-- >閲嶇疆</Button>-->
+<!-- </Form>-->
+
+ <!-- 濂栧搧琛ㄦ牸 -->
+ <Table
+ :loading="loading"
+ border
+ :columns="columns"
+ :data="list"
+ ref="table"
+ class="table"
+ >
+ <!-- 鎿嶄綔鎸夐挳鎻掓Ы -->
+ <template slot-scope="{ row }" slot="action">
+ <div class="action-btns">
+ <Button
+ type="info"
+ size="small"
+ @click="openEdit(row)"
+ >缂栬緫</Button>
+ </div>
+ </template>
+ </Table>
+
+ <!-- 鍒嗛〉 -->
+ <Row type="flex" justify="end" class="page-footer">
+ <Page
+ :current="searchForm.pageNumber"
+ :total="total"
+ :page-size="searchForm.pageSize"
+ @on-change="changePage"
+ @on-page-size-change="changePageSize"
+ :page-size-opts="[10, 20, 50]"
+ size="small"
+ show-total
+ show-elevator
+ show-sizer
+ ></Page>
+ </Row>
+
+ <!-- 濂栧搧缂栬緫/鏂板妯℃�佹 -->
+ <Modal
+ v-model="modelShow"
+ :title="modelTitle"
+ @on-cancel="modelClose"
+ width="1200"
+ :mask-closable="false"
+ >
+ <Form ref="form" :model="form" :label-width="100">
+ <Row :gutter="16">
+ <Col span="24" v-if="showRuleValue">
+ <FormItem label="瑙勫垯鍊�" prop="ruleValue">
+ <InputNumber
+ v-model="form.ruleValue"
+ placeholder="璇疯緭鍏ヨ鍒欏��"
+ clearable
+ style="width: 180px"
+ :min="0"
+ />
+ </FormItem>
+ </Col>
+ <Col span="24">
+ <FormItem label="澧炲姞娆℃暟" prop="addNum" :label-width="100">
+ <InputNumber
+ v-model="form.addNum"
+ placeholder="璇疯緭鍏ュ鍔犳鏁�"
+ clearable
+ style="width: 180px"
+ :min="0"
+ />
+ </FormItem>
+ </Col>
+
+ </Row>
+ </Form>
+
+ <div slot="footer">
+ <Button @click="modelClose">鍙栨秷</Button>
+ <Button type="primary" :loading="submitLoading" @click="update">鎻愪氦</Button>
+ </div>
+ </Modal>
+ </Card>
+ </div>
+</template>
+
+<script>
+import { getPage,updateById } from "@/api/prize-ruler.js";
+export default {
+ name: "prize-euler",
+ data() {
+ return {
+ loading:false,
+ columns:[
+ {
+ title: '瑙勫垯鍚嶇О',
+ key: 'ruleName',
+ align: 'center',
+ minWidth: 200,
+ },
+ {
+ title: '瑙勫垯缂栫爜',
+ key: 'ruleCode',
+ minWidth: 100,
+ },
+ {
+ title: '瑙勫垯鍊�',
+ key: 'ruleValue',
+ minWidth: 100,
+ },
+ {
+ title: '澧炲姞娆℃暟',
+ key: 'addNum',
+ minWidth: 100,
+ },
+ {
+ title:'鎿嶄綔',
+ slot: 'action',
+ width: 200,
+ align:'center',
+ fixed:'right'
+ }
+ ],
+ total:0,
+ list:[],
+ submitLoading:false,
+ modelShow:false,
+ modelTitle:'',
+ showRuleValue:false,
+ form:{
+ id:'',
+ ruleName:'',
+ ruleCode:'',
+ ruleValue:0,
+ addNum:0,
+ },
+ searchForm:{
+ ruleName:'',
+ ruleCode:'',
+ pageSize:10,
+ pageNumber:1,
+ },
+
+ }
+ },
+
+ mounted() {
+ this.init();
+ },
+ methods: {
+ resetSearch(){
+ this.$refs.searchForm.resetFields()
+ this.searchForm.pageNumber = 1
+ this.getPage()
+ },
+
+ update(){
+ //璋冪敤淇敼
+ let state = false;
+ if ("USER_BUY_SUM_PRICE" === this.form.ruleCode || "USER_STAY_TIME" === this.form.ruleCode){
+ state = true;
+ if (this.form.ruleValue === null || this.form.ruleValue === 0){
+ this.$Message.error("璇疯緭鍏ヨ鍒欏�间笖澶т簬0")
+ return
+ }
+ }
+ if (this.form.addNum === 0){
+ this.$Message.error("璇疯緭鍏ュ鍔犳鏁颁笖澶т簬0")
+ return;
+ }
+ if (!state){
+ this.form.ruleValue = null
+ }
+ console.log(this.form)
+ updateById(this.form).then(res =>{
+ if (res.code === 200){
+ this.$Message.success(res.msg)
+ }else {
+ this.$Message.error(res.msg)
+ }
+ this.getPage();
+ this.modelShow = false;
+ })
+
+ },
+ modelClose(){
+ this.modelShow = false
+ this.submitLoading = false
+
+ },
+ getPage(){
+ this.loading = true;
+ getPage(this.searchForm).then(res =>{
+ this.loading = false;
+ if (res.code === 200){
+ this.list = res.data;
+ this.total = res.total
+ }else {
+ this.$Message.error(res.msg)
+ }
+ })
+ },
+ detail(row){
+ this.infoModalShow = true;
+ this.detailData = {...row};
+ },
+ openEdit(row){
+ this.showRuleValue = false;
+
+ this.$refs.form.resetFields();
+ this.modelTitle = "淇敼瑙勫垯鍊�";
+
+ let form = {...row};
+ form.ruleValue =Number(form.ruleValue);
+ this.form = {...form};
+ if ("USER_BUY_SUM_PRICE" === row.ruleCode){
+ this.showRuleValue = true;
+ }else if ("USER_STAY_TIME" === row.ruleCode){
+ this.showRuleValue = true;
+ }
+
+ this.modelShow = true;
+ },
+
+ handleSearch(){
+ this.getPage()
+ },
+ // 鍒濆鍖栨暟鎹�
+ init() {
+ this.getPage()
+ },
+ changePage(){
+ this.searchForm.pageNumber = 1
+ this.searchForm.pageSize = pageSize
+ this.getPage()
+ },
+ changePageSize(){
+ this.searchForm.pageNumber = page
+ this.getPage()
+ },
+ },
+}
+</script>
+
+<style lang="scss" scoped>
+.search-form {
+ padding: 16px;
+ background: #f8f8f9;
+ border-radius: 4px;
+ margin-bottom: 16px;
+
+ .ivu-form-item {
+ margin-bottom: 16px;
+ margin-right: 16px;
+ }
+
+ .search-btn {
+ margin-left: 8px;
+ }
+}
+.table {
+ .thumbnail {
+ max-width: 100%;
+ max-height: 100px;
+ object-fit: contain;
+ cursor: pointer;
+ transition: all 0.3s;
+
+ &:hover {
+ transform: scale(1.05);
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
+ }
+ }
+
+ .action-btns {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+
+ .ivu-btn {
+ margin: 4px;
+ font-size: 12px;
+ padding: 2px 6px;
+ min-width: 60px;
+ }
+ }
+}
+</style>
--
Gitblit v1.8.0