diff --git a/src/assets/api.js b/src/assets/api.js
index 50407311..92b0eedf 100644
--- a/src/assets/api.js
+++ b/src/assets/api.js
@@ -974,4 +974,24 @@ export const setResellMerchant = (data) => {
return req("post", baseurl + "/reseller/resellMerchant/set", data)
}
+/* 设置分销商通知地址 */
+export const setResellerConf = (data) => {
+ return req("post", baseurl + "/voucher/setResellerConf", data)
+}
+
+/* 设置key批次通知地址 */
+export const setKeyBatchConf = (data) => {
+ return req("post", baseurl + "/voucher/setKeyBatchConf", data)
+}
+
+/* 设置计划通知地址 */
+export const setPlanConf = (data) => {
+ return req("post", baseurl + "/voucher/setPlanConf", data)
+}
+
+/* 查询通知地址 */
+export const queryConfig = (data) => {
+ return req("get", baseurl + "/voucher/queryConfig", data)
+}
+
export { req }
diff --git a/src/components/subnav/main.js b/src/components/subnav/main.js
index 0781ff4c..be0b735a 100644
--- a/src/components/subnav/main.js
+++ b/src/components/subnav/main.js
@@ -99,6 +99,7 @@ export default class topNav extends React.Component {
pathnamestr.includes("plan-edit") ||
pathnamestr.includes("product-edit") ||
pathnamestr.includes("distributor-merchant") ||
+ pathnamestr.includes("callback-message") ||
pathnamestr.includes("coupon-commodity")
let sedcbreakflag = pathnamestr.includes("plan-create")
let planbreakflag = pathnamestr.includes("mytempMould")
diff --git a/src/pages/callbackMessage/index.jsx b/src/pages/callbackMessage/index.jsx
new file mode 100644
index 00000000..91e40801
--- /dev/null
+++ b/src/pages/callbackMessage/index.jsx
@@ -0,0 +1,167 @@
+import { setResellerConf, setKeyBatchConf, setPlanConf, queryConfig } from "@/assets/api"
+import FormItem from "@/components/form-item/main"
+import Form from "@/components/form/main"
+import Ipt from "@/components/input/main"
+import { omit } from "lodash-es"
+import { useEffect, useRef, useState } from "react"
+import { Button, Card, Notify } from "zent"
+import "./index"
+export default function Merchant() {
+ const fromRef = useRef()
+ const [state, setState] = useState({
+ voucher_status_notify: "",
+ voucher_receive_notify: "",
+ loading: false
+ })
+
+ /* 通译字段:
+ * callBackId:分销商id 计划id key批次id
+ * callBackType: 分销商->1 计划->2 key批次->3
+ */
+ const callBackId = sessionStorage.getItem("callBackId")
+ const callBackType = Number(sessionStorage.getItem("callBackType"))
+
+ useEffect(() => {
+ query()
+ }, [])
+
+ /* 查询详情 */
+ function query() {
+ const data = {
+ reseller_id: "",
+ plan_id: "",
+ key_batch_id: ""
+ }
+ switch (callBackType) {
+ case 1:
+ data["reseller_id"] = callBackId
+ break
+ case 2:
+ data["plan_id"] = callBackId
+ break
+ case 3:
+ data["key_batch_id"] = callBackId
+ break
+ }
+ queryConfig(data).then((res) => {
+ const { voucher_notify_url, voucher_receive_url } = res.data
+ setState({
+ ...state,
+ voucher_status_notify: voucher_notify_url,
+ voucher_receive_notify: voucher_receive_url
+ })
+ })
+ }
+
+ /* 提交 */
+ function submit() {
+ const http = /(https?|ftp|file):\/\/[-A-Za-z0-9+&@#\/%?=~_|!:,.;]+[-A-Za-z0-9+&@#\/%=~_|]/
+ const { voucher_status_notify, voucher_receive_notify } = state
+
+ if (voucher_status_notify && !http.test(voucher_status_notify)) {
+ return Notify.warn("请入合法的券状态通知地址!")
+ }
+
+ if (voucher_receive_notify && !http.test(voucher_receive_notify)) {
+ return Notify.warn("请入合法的券领取通知地址!")
+ }
+
+ setState({ loading: true })
+ const data = omit(state, ["loading"])
+ switch (callBackType) {
+ case 1:
+ data["reseller_id"] = callBackId
+ setResellerConf(data).then(({ code, message }) => {
+ if (code === 200) {
+ Notify.success(message)
+ let clr = null
+ clr = setTimeout(() => {
+ window.history.go(-1)
+ clearTimeout(clr)
+ }, 1000)
+ } else {
+ Notify.error(message)
+ }
+ setState({ loading: false })
+ })
+ break
+ case 2:
+ data["plan_id"] = callBackId
+ setPlanConf(data).then(({ code, message }) => {
+ if (code === 200) {
+ Notify.success(message)
+ let clr = null
+ clr = setTimeout(() => {
+ window.history.go(-1)
+ clearTimeout(clr)
+ }, 1000)
+ } else {
+ Notify.error(message)
+ }
+ setState({ loading: false })
+ })
+ break
+ case 3:
+ data["key_batch_id"] = callBackId
+ setKeyBatchConf(data).then(({ code, message }) => {
+ if (code === 200) {
+ Notify.success(message)
+ let clr = null
+ clr = setTimeout(() => {
+ window.history.go(-1)
+ clearTimeout(clr)
+ }, 1000)
+ } else {
+ Notify.error(message)
+ }
+ setState({ loading: false })
+ })
+ break
+ }
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/pages/callbackMessage/index.less b/src/pages/callbackMessage/index.less
new file mode 100644
index 00000000..75d515e6
--- /dev/null
+++ b/src/pages/callbackMessage/index.less
@@ -0,0 +1,30 @@
+.zent-form-horizontal[data-zv="9.11.0"] .zent-form-label {
+ flex-basis: 118px !important;
+ justify-content: flex-start !important;
+}
+
+.zent-form-horizontal[data-zv="9.11.0"] .zent-form-control-content {
+ margin-left: 0;
+}
+
+.adddistributor .iptfillself .label {
+ margin-right: 66px;
+}
+
+// .zent-select-v2-popup{
+// width: 250px !important;
+// }
+.zent-btn-info[data-zv="9.11.0"] {
+ width: 120px;
+ color: #296bef !important;
+ border: none !important;
+}
+
+.zent-dialog-r-anchor .zent-dialog-r[data-zv="9.11.0"] {
+ margin-top: -180px;
+}
+
+.tip-reseller {
+ color: red;
+ font-size: 12px;
+}
\ No newline at end of file
diff --git a/src/pages/distributor/list/list.js b/src/pages/distributor/list/list.js
index 76801b63..7e381264 100644
--- a/src/pages/distributor/list/list.js
+++ b/src/pages/distributor/list/list.js
@@ -250,6 +250,31 @@ export default class acclist extends React.Component {
this.props.history.push("/home/distributor-merchant")
}
+ /* 设置回调地址 */
+ callBack(row) {
+ sessionStorage.setItem("callBackId", JSON.stringify(row.id))
+ sessionStorage.setItem("callBackType", JSON.stringify(1))
+ sessionStorage.setItem("pathname2", "callback-message")
+ let activeRou = [
+ {
+ pagetitle: "回调地址",
+ items: [
+ {
+ path: "distributor-list",
+ name: "分销商一" + row.name
+ },
+ {
+ path: "callback-message",
+ name: "设置回调通知地址"
+ }
+ ]
+ }
+ ]
+ sessionStorage.setItem("breaknav", JSON.stringify(activeRou))
+ sessionStorage.setItem("linkshowname", "分销商管理")
+ this.props.history.push("/home/callback-message")
+ }
+
onSwitchChange(status, row) {
let _self = this
Sweetalert.confirm({
@@ -469,6 +494,15 @@ export default class acclist extends React.Component {
>
开放信息
*/}
+
+ {
+ this.callBack(rowData)
+ }}
+ >
+ 设置回调
+
diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js
index c2e182ca..b46b0134 100644
--- a/src/pages/plan/key/list.js
+++ b/src/pages/plan/key/list.js
@@ -73,7 +73,7 @@ const Column = [
name: "plan",
type: "slot",
prop: "edit",
- width: "250px"
+ width: "260px"
},
{
title: "状态",
@@ -677,6 +677,34 @@ export default class acclist extends React.Component {
console.log("pages/plan/key/list.js =>", err)
}
}
+ if (key == 6) {
+ this.callBack(row)
+ }
+ }
+
+ /* 设置回调地址 */
+ callBack(row) {
+ sessionStorage.setItem("callBackId", JSON.stringify(row.id))
+ sessionStorage.setItem("callBackType", JSON.stringify(3))
+ sessionStorage.setItem("pathname2", "callback-message")
+ let activeRou = [
+ {
+ pagetitle: "回调地址",
+ items: [
+ {
+ path: "distributor-list",
+ name: "key批次一" + row.batch_name
+ },
+ {
+ path: "callback-message",
+ name: "设置回调通知地址"
+ }
+ ]
+ }
+ ]
+ sessionStorage.setItem("breaknav", JSON.stringify(activeRou))
+ sessionStorage.setItem("linkshowname", "key批次")
+ this.props.history.push("/home/callback-message")
}
//limit
@@ -868,13 +896,14 @@ export default class acclist extends React.Component {
onVisibleChange={(v) => this.setState({ visible: v })}
>
-
+
更多