feat: 新增包结算方式

This commit is contained in:
wangsongsole 2024-01-31 14:48:13 +08:00
parent 5a53adbcad
commit 89ce9e8c87
2 changed files with 60 additions and 5 deletions

View File

@ -999,4 +999,9 @@ export const receiveRetry = (data) => {
return req("post", baseurl + "/voucher/receiveRetry", data) return req("post", baseurl + "/voucher/receiveRetry", data)
} }
/* 包码结算方式 */
export const getSettlementType = () => {
return req("get", baseurl + "/plan/settlementType")
}
export { req } export { req }

View File

@ -7,7 +7,13 @@ import FormItem from "@/components/form-item/main"
import Bus from "@/assets/eventBus.js" import Bus from "@/assets/eventBus.js"
import { map } from "lodash-es" import { map } from "lodash-es"
import moment from "moment" 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 { export default class accList extends React.Component {
constructor(props) { constructor(props) {
@ -19,8 +25,10 @@ export default class accList extends React.Component {
type: 2, type: 2,
reseller: null, reseller: null,
return_id: "1", return_id: "1",
date_time: ["", ""] date_time: ["", ""],
settlement_type: null
}, },
settlementOptions: [],
reseller_option: [], reseller_option: [],
lodshow: false lodshow: false
} }
@ -31,13 +39,15 @@ export default class accList extends React.Component {
model.title = data.title model.title = data.title
model.type = parseInt(data.type) model.type = parseInt(data.type)
model.return_id = data.return_type model.return_id = data.return_type
model.settlement_type = this.state.settlementOptions.filter(
(item) => item.key == data.settlement_type
)[0]
model.reseller = { model.reseller = {
key: data.reseller_id, key: data.reseller_id,
text: data.reseller_name text: data.reseller_name
} }
model.date_time = [data.begin_time, data.end_time] model.date_time = [data.begin_time, data.end_time]
// sessionStorage.setItem('datetime', JSON.stringify(model.date_time))
const date = { const date = {
begin_time: model.date_time[0], begin_time: model.date_time[0],
end_time: model.date_time[1] 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) { async submit(id) {
@ -83,12 +113,14 @@ export default class accList extends React.Component {
data.reseller_name = this.state.model.reseller.text data.reseller_name = this.state.model.reseller.text
data.begin_time = this.state.model.date_time[0] data.begin_time = this.state.model.date_time[0]
data.end_time = this.state.model.date_time[1] data.end_time = this.state.model.date_time[1]
data.settlement_type = this.state.model.settlement_type.key
if (id) { if (id) {
let form = { let form = {
title: data.title, title: data.title,
begin_time: data.begin_time, 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) => { await putPlanStep(id, form).then((res) => {
@ -159,7 +191,6 @@ export default class accList extends React.Component {
onTypeChange(e) { onTypeChange(e) {
let model = this.state.model let model = this.state.model
model.type = e.target.value model.type = e.target.value
this.setState({ model: model }) this.setState({ model: model })
} }
@ -267,6 +298,25 @@ export default class accList extends React.Component {
}} }}
/> />
</FormItem> </FormItem>
<FormItem
labelname="包码结算方式"
prop="settlement_type"
required=""
id="settlement_type"
>
<Select
options={this.state.settlementOptions}
placeholder="选择一项"
disabled={this.props.disabled}
width={515}
value={this.state.model.settlement_type}
onChange={(e) => {
let model = this.state.model
model.settlement_type = e
this.setState({ model })
}}
/>
</FormItem>
<FormItem labelname="开始~结束时间" prop="date_time" id="date_time"> <FormItem labelname="开始~结束时间" prop="date_time" id="date_time">
<DateRangePicker <DateRangePicker
className="zent-datepicker-plan" className="zent-datepicker-plan"