|
|
@@ -0,0 +1,255 @@
|
|
|
+<script setup>
|
|
|
+import {InputNumber, InputGroup, message, Select, SelectOption, RangePicker, DescriptionsItem, Row, Space, Col} from "ant-design-vue";
|
|
|
+
|
|
|
+import {useVbenForm} from "#/adapter/form.js";
|
|
|
+import {$t} from "@vben/locales";
|
|
|
+import {h, reactive, ref, toRaw, toRefs} from "vue";
|
|
|
+import {Page, useVbenModal, confirm} from "@vben/common-ui";
|
|
|
+import {updateFeedUserInfo} from "#/api/game_control/feed_user_list.js";
|
|
|
+import dayjs from "dayjs";
|
|
|
+import {updateFeedUserGlobalInfo, updateFeedUserGlobalStatus} from "#/api/game_control/feed_user_global.js";
|
|
|
+const title = ref('查看');
|
|
|
+
|
|
|
+let netIncomeList = [10, 20, 30, 50, 70, 100, 200, 500, 1000, 1500, 2000, 3000, 5000, 10000, 50000, 100000, 500000, 1000000];
|
|
|
+let turnoverMultipleList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 50, 100, 500, 1000, 5000];
|
|
|
+let evaluationPeriodList = [
|
|
|
+ {'label':'每日','value':1},
|
|
|
+ {'label':'每周','value':2},
|
|
|
+ {'label':'每月','value':3},
|
|
|
+ {'label':'终生','value':4},
|
|
|
+ {'label':'自选时间段','value':5},
|
|
|
+];
|
|
|
+
|
|
|
+let effectiveCountList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 50, 100, 1000];
|
|
|
+let triggerIntervalRoundsList = [5, 10, 15, 20, 30, 40, 50, 60, 80, 100, 150, 200, 300];
|
|
|
+
|
|
|
+// 添加或更新 {"uname":"115","net_income":100,"turnover_multiple":5,"evaluation_period":4,"effective_count":6,"trigger_interval_rounds":300}
|
|
|
+
|
|
|
+let form = reactive({
|
|
|
+ 'net_income': 100,
|
|
|
+ 'turnover_multiple': 5,
|
|
|
+ 'evaluation_period': 4,
|
|
|
+ 'effective_count': 1,
|
|
|
+ 'trigger_interval_rounds': 300,
|
|
|
+ 'day_time': [],
|
|
|
+ 'day_time_error': false,
|
|
|
+ 'custom_time_start':"",
|
|
|
+ 'custom_time_end':"",
|
|
|
+})
|
|
|
+let is_view = ref(false);
|
|
|
+const [Modal, modalApi] = useVbenModal({
|
|
|
+ draggable: true,
|
|
|
+ async onOpenChange(isOpen) {
|
|
|
+ if (isOpen) {
|
|
|
+ form = reactive({
|
|
|
+ 'net_income': 100,
|
|
|
+ 'turnover_multiple': 5,
|
|
|
+ 'evaluation_period': 4,
|
|
|
+ 'effective_count': 1,
|
|
|
+ 'trigger_interval_rounds': 300,
|
|
|
+ 'day_time': [],
|
|
|
+ 'day_time_error' : false,
|
|
|
+ })
|
|
|
+ let data = await modalApi.getData();
|
|
|
+
|
|
|
+ if(data.data) {
|
|
|
+ let _data = data.data;
|
|
|
+ form.net_income = _data.net_income;
|
|
|
+ form.turnover_multiple = _data.turnover_multiple;
|
|
|
+ form.evaluation_period = _data.evaluation_period;
|
|
|
+ form.effective_count = _data.effective_count;
|
|
|
+ form.trigger_interval_rounds = _data.trigger_interval_rounds;
|
|
|
+ if(form.evaluation_period == 5) {
|
|
|
+ form.day_time = [dayjs(data.custom_time_start), dayjs(data.custom_time_end)];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(data.is_edit) {
|
|
|
+ is_view.value = false
|
|
|
+ title.value = "新增点控";
|
|
|
+ modalApi.setState({
|
|
|
+ footer:true
|
|
|
+ })
|
|
|
+
|
|
|
+ }else {
|
|
|
+ is_view.value = true;
|
|
|
+ title.value = "查看";
|
|
|
+ modalApi.setState({
|
|
|
+ footer:false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onConfirm:async function () {
|
|
|
+ const status = await formApi.validate();
|
|
|
+ if(!status.valid) {
|
|
|
+ // 验证不通过
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const _form = await formApi.getValues();
|
|
|
+ form.day_time_error = false;
|
|
|
+ form.custom_time_start = "";
|
|
|
+ form.custom_time_end = "";
|
|
|
+ if(form.evaluation_period == 5) {
|
|
|
+ if(form.day_time.length == 0) {
|
|
|
+ form.day_time_error = true;
|
|
|
+ }else {
|
|
|
+ form.custom_time_start = form.day_time[0].format('YYYY-MM-DD');
|
|
|
+ form.custom_time_end = form.day_time[1].format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ modalApi.lock();
|
|
|
+ const res = await updateFeedUserGlobalInfo(toRaw(form));
|
|
|
+ modalApi.unlock();
|
|
|
+ if(res.state) {
|
|
|
+ modalApi.setData({
|
|
|
+ 'is_reload': true
|
|
|
+ });
|
|
|
+ message.success(res.message);
|
|
|
+ await modalApi.close();
|
|
|
+ }else {
|
|
|
+ message.error(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+});
|
|
|
+const [Form, formApi] = useVbenForm({
|
|
|
+ // 所有表单项共用,可单独在表单内覆盖
|
|
|
+ commonConfig: {
|
|
|
+ // 所有表单项
|
|
|
+ componentProps: {
|
|
|
+ class: 'w-full',
|
|
|
+ },
|
|
|
+ labelWidth: 130,
|
|
|
+ colon: true,
|
|
|
+ },
|
|
|
+ submitButtonOptions: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ resetButtonOptions: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ // 提交函数
|
|
|
+ // handleSubmit: onSubmit,
|
|
|
+ // 垂直布局,label和input在不同行,值为vertical
|
|
|
+ // 水平布局,label和input在同一行
|
|
|
+ scrollToFirstError: true,
|
|
|
+ layout: 'horizontal',
|
|
|
+ schema: [
|
|
|
+ {
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: undefined,
|
|
|
+ fieldName: 'net_income',
|
|
|
+ hideLabel: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ wrapperClass: 'grid-cols-1',
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <Modal :title="title">
|
|
|
+ <Form>
|
|
|
+ <template #net_income>
|
|
|
+ <Space class="border w-full" style="display:block;border-bottom:0;">
|
|
|
+ <Row class="border-b h-[60px]" align="middle">
|
|
|
+ <Col :span="7" class="required label"><label>设定玩家在游戏内盈利值达到后关闭功能</label></Col>
|
|
|
+ <Col :span="5" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <Select class="w-full" v-model:value="form.net_income" name="net_income" :disabled="is_view">
|
|
|
+ <SelectOption v-for="value in netIncomeList" :value="value">{{value}}</SelectOption>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ <Col :span="1" class="label warning"><label>或</label></Col>
|
|
|
+ <Col :span="6" class="required label"><label>达到设定流水倍数关闭提升状态</label></Col>
|
|
|
+ <Col :span="5" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <Select class="w-full" v-model:value="form.turnover_multiple" name="turnover_multiple" :disabled="is_view">
|
|
|
+ <SelectOption v-for="value in turnoverMultipleList" :value="value">{{value}}倍</SelectOption>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row class="border-b h-[60px]" align="middle">
|
|
|
+ <Col :span="24">
|
|
|
+ <div style="text-align:center;">(设定玩家自动取消系统控制的条件,以上条件 <span style="color:red;">其二达到任一即取消</span> 系统控制,并消耗一次控制次数)</div>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row class="border-b h-[60px]" align="middle">
|
|
|
+ <Col :span="7" class="required label"><label>系统控制的触发周期选择</label></Col>
|
|
|
+ <Col :span="5" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <Select class="w-full" v-model:value="form.evaluation_period" name="evaluation_period" :disabled="is_view">
|
|
|
+ <SelectOption v-for="item in evaluationPeriodList" :value="item.value">{{item.label}}</SelectOption>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ <Col :span="7" class="required label"><label>周期内可被系统控制的次数</label></Col>
|
|
|
+ <Col :span="5" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <Select class="w-full" v-model:value="form.effective_count" name="effective_count" :disabled="is_view">
|
|
|
+ <SelectOption v-for="value in effectiveCountList" :value="value">{{value}}次</SelectOption>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row class="border-b h-[60px]" align="middle">
|
|
|
+ <Col :span="24">
|
|
|
+ <div style="text-align:center;">(设定玩家被系统控制的周期及控制次数, <span style="color:red;">控制次数消耗完,在此周期内玩家不再被控制。</span> 自选时间段为自由选择日期区间)</div>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
+ <Row class="border-b h-[60px]" align="middle" v-if="form.evaluation_period == 5">
|
|
|
+ <Col :span="7" class="required label"><label>自选周期时间段</label></Col>
|
|
|
+ <Col :span="17" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <RangePicker class="w-full" v-model:value="form.day_time" name="day_time" show-time :status="form.day_time_error ? 'error' : ''" :disabled="is_view" />
|
|
|
+ <p class="text-destructive text-[0.8rem] bottom-1" v-if="form.day_time_error">请选择时间段</p>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
+ <Row class="border-b h-[60px]" align="middle">
|
|
|
+ <Col :span="7" class="required label"><label>每次系统控制间隔局数</label></Col>
|
|
|
+ <Col :span="5" class="content">
|
|
|
+ <div class="mb-0 w-full pl-4 pr-4">
|
|
|
+ <Select class="w-full" v-model:value="form.trigger_interval_rounds" name="trigger_interval_rounds" :disabled="is_view">
|
|
|
+ <SelectOption v-for="value in triggerIntervalRoundsList" :value="value">每{{value}}局</SelectOption>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ <Col :span="12" class="flex-start">周期内可被系统控制的次数</Col>
|
|
|
+ </Row>
|
|
|
+ </Space>
|
|
|
+ </template>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.label.required {
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.label.required:before {
|
|
|
+ color: var(--vxe-ui-status-danger-color);
|
|
|
+ content: "*";
|
|
|
+}
|
|
|
+.label {
|
|
|
+ align-items: center;
|
|
|
+ background-color: hsl(var(--border));
|
|
|
+ box-shadow: 0 0 2px 0 var(--vxe-ui-layout-background-color);
|
|
|
+ display: flex;
|
|
|
+ font-weight: 550;
|
|
|
+ height: 60px;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.content {
|
|
|
+ align-items: center;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.label.warning {
|
|
|
+ background-color: hsl(var(--warning));
|
|
|
+}
|
|
|
+</style>
|