fix: 增加key批次结束时间

This commit is contained in:
zhangds 2024-03-23 14:50:09 +08:00
parent 22765d178d
commit 7e27d61cd6
3 changed files with 103 additions and 15 deletions

View File

@ -1,13 +1,13 @@
// Do this as the first thing so that any code reading it knows the right env. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = "development" process.env.BABEL_ENV = "development"
process.env.NODE_ENV = "development" process.env.NODE_ENV = "development"
// process.env.BASE_URL = "http://test.marketapi.1688sup.com" process.env.BASE_URL = "http://test.marketapi.1688sup.com"
// process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1" process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
// process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login" process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
process.env.BASE_URL = "http://pre.marketapi.1688sup.com" // process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1" // process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login" // process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
// Makes the script crash on unhandled rejections instead of silently // Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will // ignoring them. In the future, promise rejections that are not handled will

View File

@ -2,14 +2,14 @@
process.env.BABEL_ENV = "test" process.env.BABEL_ENV = "test"
process.env.NODE_ENV = "test" process.env.NODE_ENV = "test"
// 测试 // 测试
// process.env.BASE_URL = "http://test.marketapi.1688sup.com" process.env.BASE_URL = "http://test.marketapi.1688sup.com"
// process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1" process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
// process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login" process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
// 镜像 // 镜像
process.env.BASE_URL = "http://pre.marketapi.1688sup.com" // process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1" // process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login" // process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
// Makes the script crash on unhandled rejections instead of silently // Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will // ignoring them. In the future, promise rejections that are not handled will

View File

@ -30,7 +30,8 @@ import {
Radio, Radio,
RadioButton, RadioButton,
RadioGroup, RadioGroup,
Switch Switch,
DateRangePicker
} from "zent" } from "zent"
import "./add.less" import "./add.less"
import "./step2.less" import "./step2.less"
@ -86,7 +87,9 @@ export default class acclist extends React.Component {
draw_title: "", draw_title: "",
batch_name: "", batch_name: "",
key_official_price: "", key_official_price: "",
key_cost_price: "" key_cost_price: "",
expiration_type: "1",
expiration_value: ""
}, },
drawerVisible: false, drawerVisible: false,
drawerVisible2: false, drawerVisible2: false,
@ -280,6 +283,8 @@ export default class acclist extends React.Component {
data.mobile_repeat = this.state.mobile_repeat data.mobile_repeat = this.state.mobile_repeat
data.key_official_price = this.state.model.key_official_price data.key_official_price = this.state.model.key_official_price
data.key_cost_price = this.state.model.key_cost_price data.key_cost_price = this.state.model.key_cost_price
data.expiration_type = this.state.model.expiration_type
data.expiration_value = this.state.model.expiration_value
return data return data
} }
} else { } else {
@ -297,6 +302,8 @@ export default class acclist extends React.Component {
data.coupon = param data.coupon = param
data.mobile_excel = this.state.mobile_excel data.mobile_excel = this.state.mobile_excel
data.mobile_repeat = this.state.mobile_repeat data.mobile_repeat = this.state.mobile_repeat
data.expiration_type = this.state.model.expiration_type
data.expiration_value = this.state.model.expiration_value
// 校验 卡密时间判断 // 校验 卡密时间判断
for (let i = 0; i < param.length; i++) { for (let i = 0; i < param.length; i++) {
if (submitIsKm(param[i].product.legal) === false) { if (submitIsKm(param[i].product.legal) === false) {
@ -708,7 +715,9 @@ export default class acclist extends React.Component {
code_batch: data.code_batch, code_batch: data.code_batch,
draw_title: data.draw_title, draw_title: data.draw_title,
key_official_price: data.key_official_price, key_official_price: data.key_official_price,
key_cost_price: data.key_cost_price key_cost_price: data.key_cost_price,
expiration_type: data.expiration_type,
expiration_value: data.expiration_value
} }
// 是否是包码 // 是否是包码
@ -914,6 +923,10 @@ export default class acclist extends React.Component {
}) })
} }
isPositiveInteger(value) {
return /^[1-9]\d*$/.test(value)
}
importConfirmClick() { importConfirmClick() {
let temp = this.state.exceldata.filter((o) => o.type == "success") let temp = this.state.exceldata.filter((o) => o.type == "success")
@ -1332,6 +1345,7 @@ export default class acclist extends React.Component {
</div> </div>
</FormItem> </FormItem>
) : null} ) : null}
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object"> <FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
<Radio.Group <Radio.Group
value={this.props.keyType} value={this.props.keyType}
@ -1348,6 +1362,80 @@ export default class acclist extends React.Component {
</Radio.Group> </Radio.Group>
</FormItem> </FormItem>
<FormItem labelname="过期时间" prop="expiration_type" id="expiration_type">
<Radio.Group
value={this.state.model.expiration_type}
onChange={(e) => {
let model2 = this.state.model
model2.expiration_value = ""
model2.expiration_type = e.target.value
this.setState({ model: model2 })
}}
>
<Radio value={"1"}>不设置</Radio>
<Radio value={"2"}>固定时间段</Radio>
<Radio value={"3"}>接口调取后有效期</Radio>
</Radio.Group>
</FormItem>
{this.state.model.expiration_type === "2" ? (
<FormItem labelname="固定时间段">
<DateRangePicker
className="zent-datepicker-plan"
showTime={{
format: "HH:mm:ss",
defaultTime: [moment().format("HH:mm:ss"), "23:59:59"]
}}
format="YYYY-MM-DD HH:mm:ss"
value={this.state.model.expiration_value}
onChange={(e) => {
let model2 = this.state.model
model2.expiration_value = e
this.setState({ model: model2 })
}}
disabledDate={this.onDisabledRange}
/>
</FormItem>
) : null}
{this.state.model.expiration_type === "3" ? (
<FormItem labelname="接口调取后有效期">
<Input
placeholder="请输入天数"
value={this.state.model.expiration_value}
width={120}
maxLength={5}
onChange={(e) => {
let time = sessionStorage.getItem("knockGold_effectDate")
if (time) {
time = JSON.parse(time)
// 开始时间和结束时间
let begin_time = new Date(time.begin_time)
let end_time = new Date(time.end_time)
// 计算毫秒数差异
let timeDiff = end_time.getTime() - begin_time.getTime()
// 将毫秒数差异转换为天数
let daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24))
// 输入的天数必须小于等于天数
if (daysDiff >= Number(e.target.value)) {
let model2 = this.state.model
model2.expiration_value = e.target.value
this.setState({ model: model2 })
} else {
Notify.error(`输入的天数必须小于等于计划天数`)
return
}
console.log("日期间的天数差异为:" + daysDiff + " 天")
}
}}
/>
</FormItem>
) : null}
<FormItem labelname="" prop="btn" required={false}> <FormItem labelname="" prop="btn" required={false}>
{this.props.keyType === 1 ? ( {this.props.keyType === 1 ? (
<> <>