From dbd76ee9b8701d620cdd024c2b2c443b201f7a60 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Thu, 11 Jan 2024 12:00:03 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=85=91=E6=8D=A2=E7=A0=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9E=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/list/list.js | 153 ++++++++++++++++++++------ src/pages/exchangecode/list/list.less | 54 +++++++++ src/pages/order/more/more.js | 2 +- 3 files changed, 175 insertions(+), 34 deletions(-) diff --git a/src/pages/exchangecode/list/list.js b/src/pages/exchangecode/list/list.js index b0df93e9..ad375f3b 100644 --- a/src/pages/exchangecode/list/list.js +++ b/src/pages/exchangecode/list/list.js @@ -5,18 +5,22 @@ import { getCodesList, handelResponse, putCodeStatus, - terminateApprovals + terminateApprovals, + getPlanChoseOption } from "@/assets/api.js" import "@/assets/comm.css" import menu from "@/assets/enum.js" import Grid from "@/components/gird/main.js" import Ipt from "@/components/input/main" +import Form from "@/components/form/main" +import FormItem from "@/components/form-item/main" import TabPage from "@/components/tabPage/main.js" import { commonSearchOrder } from "@/tools/apiTools.js" // 公用接口函数 import React from "react" -import { Button, CombinedDateRangePicker, Notify, Sweetalert, Switch } from "zent" +import { Button, CombinedDateRangePicker, Notify, Sweetalert, Switch, Select } from "zent" import "./list.less" import { Column, tabList } from "./util" +import { cloneDeep } from "lodash-es" export default class acclist extends React.Component { constructor(props) { @@ -29,10 +33,11 @@ export default class acclist extends React.Component { tabList: [...tabList], combinedValue: [], DateTime: "", //数据更新时间 - key_word: "", + search: this.initSearch(), status: 0, tableHeight: 600, - tabIndex: 0 + tabIndex: 0, + planOptions: [] } } @@ -104,6 +109,38 @@ export default class acclist extends React.Component { window.open("#/home/exchange-addcommodity") } + initSearch() { + return { + plan_title: "", + key_batch_id: "", + code_batch_id: "", + code_batch_name: "" + } + } + + searchChange(key, va) { + const search = this.state.search + search[key] = va + this.setState({ search }) + } + + /* 获取营销计划 */ + getPlan() { + getPlanChoseOption().then((res) => + handelResponse( + res, + (req, msg) => { + const planOptions = req.map((item) => ({ + key: item.id, + text: item.title + })) + this.setState({ planOptions }) + }, + (err) => {} + ) + ) + } + /* 处理可复制数据逻辑 */ copyElementFunction(params) { let element = "" @@ -170,7 +207,7 @@ export default class acclist extends React.Component { } tabFn(index) { - this.setState({ tabIndex: index, key_word: "", page: 1, limit: 10 }) + this.setState({ tabIndex: index, search: this.initSearch(), page: 1, limit: 10 }) setTimeout(() => { this.getCodeListFn({}, index) }, 10) @@ -292,8 +329,9 @@ export default class acclist extends React.Component { //获取兑换码列表 getCodeListFn(time = {}, menu = this.state.tabIndex) { let _self = this - let { page, limit, key_word } = _self.state - let data = { page, limit } + let { page, limit, search } = cloneDeep(_self.state) + search.plan_title = search.plan_title?.text || "" + let data = { page, limit, ...search } if (this.state.combinedValue && this.state.combinedValue[0]) { data.begin_time = this.state.combinedValue[0] @@ -317,10 +355,6 @@ export default class acclist extends React.Component { data.status = null } } - - if (key_word) { - data.key_word = key_word - } getCodesList(data) .then((res) => { let response = JSON.parse(res) @@ -336,14 +370,7 @@ export default class acclist extends React.Component { componentWillMount() { this.setState({ tableHeight: window.innerHeight - 390 }) - } - - // 监听组件内部状态的变化: - componentDidUpdate(prevProps, prevState) { - // 参数分别为改变之前的数据状态对象 - if (prevState.key_word != this.state.key_word && !this.state.key_word) { - this.getCodeListFn() - } + this.getPlan() } onReCall(e, rowData) { @@ -418,20 +445,80 @@ export default class acclist extends React.Component { - { - this.setState({ key_word: "" }) - }} - wordSearch={this.sureFn.bind(this)} - onChange={(e) => this.setState({ key_word: e })} - value={this.state.key_word} - icon="search" - placeholder={"请输入关键字进行匹配查询"} - countShow={false} - height={"36px"} - width={"260px"} - alignment={"left"} - /> +
+
+ +