diff --git a/scripts/start.js b/scripts/start.js
index 99ffef0e..6464652e 100644
--- a/scripts/start.js
+++ b/scripts/start.js
@@ -1,13 +1,13 @@
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = "development"
process.env.NODE_ENV = "development"
-// process.env.BASE_URL = "http://test.marketapi.1688sup.com"
-// process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
-// process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
+process.env.BASE_URL = "http://test.marketapi.1688sup.com"
+process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
+process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
-process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
-process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
-process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
+// process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
+// process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
+// process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
diff --git a/scripts/test.js b/scripts/test.js
index 0c342bb3..e15e6af9 100644
--- a/scripts/test.js
+++ b/scripts/test.js
@@ -2,14 +2,14 @@
process.env.BABEL_ENV = "test"
process.env.NODE_ENV = "test"
// 测试
-// process.env.BASE_URL = "http://test.marketapi.1688sup.com"
-// process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
-// process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
+process.env.BASE_URL = "http://test.marketapi.1688sup.com"
+process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
+process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
// 镜像
-process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
-process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
-process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
+// process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
+// process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
+// process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js
index f2144cc7..d0f761fe 100644
--- a/src/pages/plan/add/step2.js
+++ b/src/pages/plan/add/step2.js
@@ -30,7 +30,8 @@ import {
Radio,
RadioButton,
RadioGroup,
- Switch
+ Switch,
+ DateRangePicker
} from "zent"
import "./add.less"
import "./step2.less"
@@ -86,7 +87,9 @@ export default class acclist extends React.Component {
draw_title: "",
batch_name: "",
key_official_price: "",
- key_cost_price: ""
+ key_cost_price: "",
+ expiration_type: "1",
+ expiration_value: ""
},
drawerVisible: false,
drawerVisible2: false,
@@ -280,6 +283,8 @@ export default class acclist extends React.Component {
data.mobile_repeat = this.state.mobile_repeat
data.key_official_price = this.state.model.key_official_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
}
} else {
@@ -297,6 +302,8 @@ export default class acclist extends React.Component {
data.coupon = param
data.mobile_excel = this.state.mobile_excel
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++) {
if (submitIsKm(param[i].product.legal) === false) {
@@ -708,7 +715,9 @@ export default class acclist extends React.Component {
code_batch: data.code_batch,
draw_title: data.draw_title,
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() {
let temp = this.state.exceldata.filter((o) => o.type == "success")
@@ -1332,6 +1345,7 @@ export default class acclist extends React.Component {
) : null}
+
+
+ {
+ let model2 = this.state.model
+ model2.expiration_value = ""
+ model2.expiration_type = e.target.value
+ this.setState({ model: model2 })
+ }}
+ >
+ 不设置
+ 固定时间段
+ 接口调取后有效期
+
+
+
+ {this.state.model.expiration_type === "2" ? (
+
+ {
+ let model2 = this.state.model
+ model2.expiration_value = e
+ this.setState({ model: model2 })
+ }}
+ disabledDate={this.onDisabledRange}
+ />
+
+ ) : null}
+
+ {this.state.model.expiration_type === "3" ? (
+
+ {
+ 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 + " 天")
+ }
+ }}
+ />
+
+ ) : null}
+
{this.props.keyType === 1 ? (
<>