diff --git a/src/assets/api.js b/src/assets/api.js index ffa1f9e7..c202e889 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 getSettlementType = () => { + return req("get", baseurl + "/plan/settlementType") +} + export { req } diff --git a/src/pages/plan/add/step1.js b/src/pages/plan/add/step1.js index 48e825a6..6ddea8c1 100644 --- a/src/pages/plan/add/step1.js +++ b/src/pages/plan/add/step1.js @@ -7,7 +7,13 @@ import FormItem from "@/components/form-item/main" import Bus from "@/assets/eventBus.js" import { map } from "lodash-es" import moment from "moment" -import { addPlanStep, handelResponse, getReSellerOption, putPlanStep } from "@/assets/api.js" +import { + addPlanStep, + handelResponse, + getReSellerOption, + putPlanStep, + getSettlementType +} from "@/assets/api.js" export default class accList extends React.Component { constructor(props) { @@ -19,8 +25,10 @@ export default class accList extends React.Component { type: 2, reseller: null, return_id: "1", - date_time: ["", ""] + date_time: ["", ""], + settlement_type: null }, + settlementOptions: [], reseller_option: [], lodshow: false } @@ -31,13 +39,15 @@ export default class accList extends React.Component { model.title = data.title model.type = parseInt(data.type) model.return_id = data.return_type + model.settlement_type = this.state.settlementOptions.filter( + (item) => item.key == data.settlement_type + )[0] model.reseller = { key: data.reseller_id, text: data.reseller_name } model.date_time = [data.begin_time, data.end_time] - // sessionStorage.setItem('datetime', JSON.stringify(model.date_time)) const date = { begin_time: model.date_time[0], end_time: model.date_time[1] @@ -66,6 +76,26 @@ export default class accList extends React.Component { } ) }) + + /* 获取结算方式 */ + getSettlementType().then((res) => { + handelResponse( + res, + (req, msg) => { + let arr = map(req, (o) => { + let obj = {} + obj.key = o.settlement_type + obj.text = o.settlement_text + obj.direct_reseller_id = o.direct_reseller_id + return obj + }) + this.setState({ settlementOptions: arr }) + }, + (err) => { + Notify.error(err) + } + ) + }) } async submit(id) { @@ -83,12 +113,14 @@ export default class accList extends React.Component { data.reseller_name = this.state.model.reseller.text data.begin_time = this.state.model.date_time[0] data.end_time = this.state.model.date_time[1] + data.settlement_type = this.state.model.settlement_type.key if (id) { let form = { title: data.title, begin_time: data.begin_time, - end_time: data.end_time + end_time: data.end_time, + settlement_type: data.settlement_type } await putPlanStep(id, form).then((res) => { @@ -159,7 +191,6 @@ export default class accList extends React.Component { onTypeChange(e) { let model = this.state.model - model.type = e.target.value this.setState({ model: model }) } @@ -267,6 +298,25 @@ export default class accList extends React.Component { }} /> + +