From 9f11e4e2020be4c772535c1fb18393401ba1d002 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Mon, 29 Jan 2024 16:28:02 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=20=20=E4=BB=A5=E5=8F=8A=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=B0=83=E6=95=B4=E6=9F=A5=E8=AF=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 5 + src/pages/order/list/list.js | 222 ++++++++-- src/pages/order/list/list.less | 44 ++ src/pages/order/list/utils.js | 15 - src/pages/plan/add/add.js | 336 +++++++--------- src/pages/plan/add/edit.js | 579 +++++++++++++-------------- src/pages/plan/add/plan-copy.js | 48 +-- src/pages/plan/add/step1.js | 14 +- src/pages/plan/add/step2.js | 39 +- src/pages/plan/add/step3.js | 17 +- src/pages/plan/key/UseKeyAddEdit.jsx | 114 +++--- src/pages/plan/key/edit.js | 1 - src/pages/plan/key/list.js | 67 ++-- 13 files changed, 802 insertions(+), 699 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index ffa1f9e7..372cf02b 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -999,4 +999,9 @@ export const receiveRetry = (data) => { return req("post", baseurl + "/voucher/receiveRetry", data) } +/* 获取计划下的商品 */ +export const goodsListByPlanId = (id) => { + return req("get", baseurl + "/goods/goodsListByPlanId/" + id) +} + export { req } diff --git a/src/pages/order/list/list.js b/src/pages/order/list/list.js index e6cfde19..8563217e 100644 --- a/src/pages/order/list/list.js +++ b/src/pages/order/list/list.js @@ -7,7 +7,10 @@ import { putOrderSuccess, receiveRetry, refund, - resendCardCode + resendCardCode, + getPlanChoseOption, + getReSellerOption, + goodsListByPlanId } from "@/assets/api.js" import "@/assets/comm.css" import { nowDay, nowMonth } from "@/assets/comm.js" @@ -47,6 +50,9 @@ export default class orderList extends React.Component { status: null, pay_status: null, voucher_status: null, + planOptions: [], + resellerOptions: [], + productOptions: [], page: 1, limit: 10, key_word: "", @@ -58,11 +64,26 @@ export default class orderList extends React.Component { visible: false /* 手动退款提示款 */, model: { account: "" - } + }, + search: this.initSearch() } this.onChangeCombinedDate = this.onChangeCombinedDate.bind(this) } + initSearch() { + return { + plan_id: "", + reseller_id: "", + product_id: "" + } + } + + searchChange(key, va) { + const search = this.state.search + search[key] = va + this.setState({ search }) + } + //选中表格的选框 selection(selection) { this.setState({ selectiondata: selection }) @@ -79,6 +100,50 @@ export default class orderList extends React.Component { this.setState({ officialprice, contractprice, costprice, totalprice }) } + /* 获取营销计划/分销商 */ + getPlan() { + getPlanChoseOption().then((res) => + handelResponse( + res, + (req, msg) => { + const planOptions = req.map((item) => ({ + key: item.id, + text: item.title + })) + this.setState({ planOptions }) + }, + (err) => {} + ) + ) + + getReSellerOption().then((res) => { + handelResponse(res, (req, msg) => { + const resellerOptions = req.map((item) => ({ + key: item.id, + text: item.name + })) + this.setState({ resellerOptions }) + }) + }) + } + + /* 获取营销计划下的商品 */ + getProducts(id) { + goodsListByPlanId(id).then((res) => + handelResponse( + res, + (req, msg) => { + const productOptions = req.map((item) => ({ + key: item.goods_id, + text: item.goods_name + })) + this.setState({ productOptions }) + }, + (err) => {} + ) + ) + } + /* 手动退款 */ handlerRefundFunction() { if (this.refs.form.validator()) { @@ -299,13 +364,6 @@ export default class orderList extends React.Component { }) } - //敲回车查询 - sureFn() { - this.setState({ page: 1 }, () => { - this.getOrderFn() - }) - } - //!提取动态删除核销状态条件 dynamicVoucher() { if (this.state.menuList.length === 3) { @@ -336,9 +394,16 @@ export default class orderList extends React.Component { //!获取订单列表 getOrderFn(time = {}) { let _self = this - let { page, limit, status, option, key_word, orderType, pay_status, voucher_status } = + let { page, limit, status, option, key_word, orderType, pay_status, voucher_status, search } = _self.state - let data = { page, limit } + const { plan_id, product_id, reseller_id } = search + let data = { + page, + limit, + plan_id: plan_id ? plan_id.key : "", + product_id: product_id ? product_id.key : "", + reseller_id: reseller_id ? reseller_id.key : "" + } if (orderType) { //区分立减金和商品 data.type = orderType @@ -387,6 +452,7 @@ export default class orderList extends React.Component { componentWillMount() { let datetime = [tomonth + " " + "00:00:00", day + " " + "23:59:59"] this.getOrderFn(datetime) + this.getPlan() this.setState({ tableHeight: window.innerHeight - 430, combinedValue: datetime }) } @@ -529,6 +595,14 @@ export default class orderList extends React.Component { } } + /* 重置 */ + reset() { + this.setState( + { search: this.initSearch(), page: 1, limit: 10, key_word: "", placeholder: "", option: "" }, + () => this.getOrderFn() + ) + } + //过滤表格枚举状态 render() { const date = ( @@ -547,42 +621,102 @@ export default class orderList extends React.Component { return (
-
-

- -

-
- { + this.searchChange("plan_id", va) + if (va) { + this.getProducts(va.key) + } else { + this.setState({ productOptions: [] }) + this.searchChange("product_id", "") + } }} - wordSearch={this.sureFn.bind(this)} - onChange={(e) => this.setState({ key_word: e })} - value={this.state.key_word} - icon="search" - placeholder={this.state.placeholder} - countShow={false} - height={"36px"} - width={"260px"} - alignment={"left"} /> + + + { + this.searchChange("product_id", va) + }} + /> + + +