Merge branch 'xw-callback-message'

This commit is contained in:
wangsongsole 2023-11-17 13:53:01 +08:00
commit addecb5c98
8 changed files with 317 additions and 3 deletions

View File

@ -974,4 +974,24 @@ export const setResellMerchant = (data) => {
return req("post", baseurl + "/reseller/resellMerchant/set", 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 } export { req }

View File

@ -99,6 +99,7 @@ export default class topNav extends React.Component {
pathnamestr.includes("plan-edit") || pathnamestr.includes("plan-edit") ||
pathnamestr.includes("product-edit") || pathnamestr.includes("product-edit") ||
pathnamestr.includes("distributor-merchant") || pathnamestr.includes("distributor-merchant") ||
pathnamestr.includes("callback-message") ||
pathnamestr.includes("coupon-commodity") pathnamestr.includes("coupon-commodity")
let sedcbreakflag = pathnamestr.includes("plan-create") let sedcbreakflag = pathnamestr.includes("plan-create")
let planbreakflag = pathnamestr.includes("mytempMould") let planbreakflag = pathnamestr.includes("mytempMould")

View File

@ -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 (
<div className="maincenter">
<Card style={{ width: "100%" }} title={"设置回调域名"}>
<div className="adddistributor merchantForm">
<Form model={state} ref={fromRef}>
<FormItem labelname="券状态通知地址" prop="voucher_status_notify" required="">
<Ipt
onChange={(value) => setState({ ...state, voucher_status_notify: value })}
onClearItem={() => setState({ ...state, voucher_status_notify: "" })}
countShow={false}
value={state.voucher_status_notify}
placeholder={"请输入券状态通知地址"}
labelWidth={"0px"}
height={"36px"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
<FormItem labelname="券领取通知地址" prop="voucher_receive_notify" required="">
<Ipt
onChange={(value) => setState({ ...state, voucher_receive_notify: value })}
onClearItem={() => setState({ ...state, voucher_receive_notify: "" })}
countShow={false}
value={state.voucher_receive_notify}
placeholder={"请输入券领取通知地址"}
labelWidth={"0px"}
height={"36px"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
</Form>
</div>
</Card>
<div className="distributorbtn">
<Button type="primary" onClick={submit} loading={state.loading}>
提交
</Button>
<Button type="normal" onClick={() => window.history.back()}>
取消
</Button>
</div>
</div>
)
}

View File

@ -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;
}

View File

@ -250,6 +250,31 @@ export default class acclist extends React.Component {
this.props.history.push("/home/distributor-merchant") 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) { onSwitchChange(status, row) {
let _self = this let _self = this
Sweetalert.confirm({ Sweetalert.confirm({
@ -469,6 +494,15 @@ export default class acclist extends React.Component {
> >
开放信息 开放信息
</a> */} </a> */}
<a
className="grid-link"
onClick={(e) => {
this.callBack(rowData)
}}
>
设置回调
</a>
<Dropdown position={DropdownPosition.RightTop}> <Dropdown position={DropdownPosition.RightTop}>
<DropdownClickTrigger> <DropdownClickTrigger>
<div className="linkmore"> <div className="linkmore">

View File

@ -73,7 +73,7 @@ const Column = [
name: "plan", name: "plan",
type: "slot", type: "slot",
prop: "edit", prop: "edit",
width: "250px" width: "260px"
}, },
{ {
title: "状态", title: "状态",
@ -677,6 +677,34 @@ export default class acclist extends React.Component {
console.log("pages/plan/key/list.js =>", err) 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 //limit
@ -868,13 +896,14 @@ export default class acclist extends React.Component {
onVisibleChange={(v) => this.setState({ visible: v })} onVisibleChange={(v) => this.setState({ visible: v })}
> >
<DropdownClickTrigger> <DropdownClickTrigger>
<div className="linkmore"> <div className="linkmore grid-link">
更多 <Icon type={"down"} /> 更多 <Icon type={"down"} />
</div> </div>
</DropdownClickTrigger> </DropdownClickTrigger>
<DropdownContent> <DropdownContent>
<Menu onClick={(e, key) => this.menuItemClick(key, rowData)}> <Menu onClick={(e, key) => this.menuItemClick(key, rowData)}>
<MenuItem key="1">发送密码及压缩包</MenuItem> <MenuItem key="1">发送密码及压缩包</MenuItem>
<MenuItem key="6">设置回调</MenuItem>
<MenuItem key="2" disabled> <MenuItem key="2" disabled>
日志 日志
</MenuItem> </MenuItem>

View File

@ -465,7 +465,6 @@ export default class acclist extends React.Component {
menuItemClick(key, row) { menuItemClick(key, row) {
this.setState({ plan_id: row.id }) this.setState({ plan_id: row.id })
if (row.status == 6) { if (row.status == 6) {
Notify.clear() Notify.clear()
Notify.error("该状态下的数据不允许编辑") Notify.error("该状态下的数据不允许编辑")
@ -558,6 +557,9 @@ export default class acclist extends React.Component {
parentComponent: this parentComponent: this
}) })
} }
if (key == 6) {
this.callBack(row)
}
} }
//清空 //清空
@ -566,6 +568,31 @@ export default class acclist extends React.Component {
this.setState({ selectiondata: [] }) this.setState({ selectiondata: [] })
} }
/* 设置回调地址 */
callBack(row) {
sessionStorage.setItem("callBackId", JSON.stringify(row.id))
sessionStorage.setItem("callBackType", JSON.stringify(2))
sessionStorage.setItem("pathname2", "callback-message")
let activeRou = [
{
pagetitle: "回调地址",
items: [
{
path: "distributor-list",
name: "营销计划一" + row.title
},
{
path: "callback-message",
name: "设置回调通知地址"
}
]
}
]
sessionStorage.setItem("breaknav", JSON.stringify(activeRou))
sessionStorage.setItem("linkshowname", "营销计划")
this.props.history.push("/home/callback-message")
}
//选中表格的选框 //选中表格的选框
selection(selection) { selection(selection) {
this.setState({ selectiondata: selection }) this.setState({ selectiondata: selection })
@ -794,6 +821,7 @@ export default class acclist extends React.Component {
<DropdownContent> <DropdownContent>
<Menu onClick={(e, key) => this.menuItemClick(key, rowData)}> <Menu onClick={(e, key) => this.menuItemClick(key, rowData)}>
<MenuItem key="1">发送密码及压缩包</MenuItem> <MenuItem key="1">发送密码及压缩包</MenuItem>
<MenuItem key="6">设置回调</MenuItem>
<MenuItem key="2" disabled> <MenuItem key="2" disabled>
日志 日志
</MenuItem> </MenuItem>

View File

@ -13,6 +13,7 @@
// src\pages\plan\keyorder\keyorder.js // src\pages\plan\keyorder\keyorder.js
// src\pages\exchangecode\addinfoform\addinfoform.js // src\pages\exchangecode\addinfoform\addinfoform.js
// src\pages\exchangecode\addruleform\addruleform.js // src\pages\exchangecode\addruleform\addruleform.js
import CallbackMessage from "@/pages/callbackMessage"
import CouponAddEdit from "@/pages/coupon/addEdit" import CouponAddEdit from "@/pages/coupon/addEdit"
import UseCouponCommodity from "@/pages/coupon/commodity" import UseCouponCommodity from "@/pages/coupon/commodity"
import CouponList from "@/pages/coupon/list" import CouponList from "@/pages/coupon/list"
@ -231,6 +232,10 @@ const router = [
{ {
path: "/home/coupon-commodity", path: "/home/coupon-commodity",
component: UseCouponCommodity component: UseCouponCommodity
},
{
path: "/home/callback-message",
component: CallbackMessage
} }
] ]