✨ feat: 新增卡密商品可选择发放方式
This commit is contained in:
parent
e013f5f131
commit
4f61181409
|
@ -997,4 +997,9 @@ export const keyBatchExport = (data) => {
|
||||||
return derives("post", baseurl + "/keybatch/export", data)
|
return derives("post", baseurl + "/keybatch/export", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 发送短信 */
|
||||||
|
export const resendCardCode = (data) => {
|
||||||
|
return req("post", baseurl + "/order/resendCardCode", data)
|
||||||
|
}
|
||||||
|
|
||||||
export { req }
|
export { req }
|
||||||
|
|
|
@ -25,7 +25,7 @@ const initArray = (targetNum) => {
|
||||||
|
|
||||||
//校验规则
|
//校验规则
|
||||||
const formRules = {
|
const formRules = {
|
||||||
product: [{ type: "required", message: "请选择映射商品" }],
|
product_id: [{ type: "required", message: "请选择映射商品" }],
|
||||||
quantity: [
|
quantity: [
|
||||||
{ type: "required", message: "请输入商品库存" },
|
{ type: "required", message: "请输入商品库存" },
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,8 @@ const formRules = {
|
||||||
reg: "^([0-9]{0,2}|100)$"
|
reg: "^([0-9]{0,2}|100)$"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
end_time: [{ type: "required", message: "请选择兑换结束时间" }]
|
end_time: [{ type: "required", message: "请选择兑换结束时间" }],
|
||||||
|
card_show: [{ type: "required", message: "请选择卡密发放类型" }]
|
||||||
}
|
}
|
||||||
|
|
||||||
const UseProductPop = forwardRef((props, ref) => {
|
const UseProductPop = forwardRef((props, ref) => {
|
||||||
|
@ -74,7 +75,7 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
loading: true
|
loading: true
|
||||||
})
|
})
|
||||||
const [model, setModel] = useSetState({
|
const [model, setModel] = useSetState({
|
||||||
cur_product: {},
|
cur_product: undefined,
|
||||||
code_batch_id: "",
|
code_batch_id: "",
|
||||||
product_type: Number(productType),
|
product_type: Number(productType),
|
||||||
cost_price: "",
|
cost_price: "",
|
||||||
|
@ -89,7 +90,8 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
product_id: "",
|
product_id: "",
|
||||||
account_type: "",
|
account_type: "",
|
||||||
map_product_name: "",
|
map_product_name: "",
|
||||||
end_time: ""
|
end_time: "",
|
||||||
|
card_show: 2
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -186,6 +188,7 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
account_type: productData.account_type,
|
account_type: productData.account_type,
|
||||||
map_product_name: productData.map_product_name,
|
map_product_name: productData.map_product_name,
|
||||||
product_type: model.product_type,
|
product_type: model.product_type,
|
||||||
|
card_show: Number(productData.card_show),
|
||||||
code_batch_id: productData.code_batch_id,
|
code_batch_id: productData.code_batch_id,
|
||||||
end_time: productData.end_time,
|
end_time: productData.end_time,
|
||||||
show_url: [
|
show_url: [
|
||||||
|
@ -225,7 +228,7 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
|
|
||||||
const clearForm = () => {
|
const clearForm = () => {
|
||||||
setModel({
|
setModel({
|
||||||
cur_product: {},
|
cur_product: undefined,
|
||||||
code_batch_id: "",
|
code_batch_id: "",
|
||||||
cost_price: "",
|
cost_price: "",
|
||||||
weight: "0",
|
weight: "0",
|
||||||
|
@ -240,7 +243,8 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
detail_url: [],
|
detail_url: [],
|
||||||
account_type: "",
|
account_type: "",
|
||||||
map_product_name: "",
|
map_product_name: "",
|
||||||
end_time: ""
|
end_time: "",
|
||||||
|
card_show: 2
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setState({ isUpdatePic: !state.isUpdatePic })
|
setState({ isUpdatePic: !state.isUpdatePic })
|
||||||
|
@ -263,7 +267,8 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
account_type: model.account_type,
|
account_type: model.account_type,
|
||||||
map_product_name: model.product_name,
|
map_product_name: model.product_name,
|
||||||
goods_id: model.goods_id,
|
goods_id: model.goods_id,
|
||||||
end_time: model.end_time
|
end_time: model.end_time,
|
||||||
|
card_show: model.card_show
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,19 +295,17 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
setModel({ cur_product: e })
|
setModel({ cur_product: e })
|
||||||
|
|
||||||
// 当前选中的商品数据
|
// 当前选中的商品数据
|
||||||
let cur_product = state.productDataAll.find((item) => {
|
let cur_product = e ? state.productDataAll.find((item) => item.id === e.key) : {}
|
||||||
return item.id === e.key
|
|
||||||
})
|
|
||||||
// 获取商品logo和图片
|
// 获取商品logo和图片
|
||||||
let picItem = window.goods.find((item) => {
|
let picItem = window.goods.find((item) => {
|
||||||
return Number(item.id) === Number(cur_product.product_category_id)
|
return Number(item.id) === Number(cur_product.product_category_id)
|
||||||
})
|
})
|
||||||
setModel({
|
setModel({
|
||||||
product_id: cur_product.id,
|
product_id: cur_product.id || "",
|
||||||
official_price: cur_product.official_price,
|
official_price: cur_product.official_price || "",
|
||||||
cost_price: cur_product.cost_price,
|
cost_price: cur_product.cost_price || "",
|
||||||
product_name: cur_product.title,
|
product_name: cur_product.title || "",
|
||||||
account_type: cur_product.account_type,
|
account_type: cur_product.account_type || "",
|
||||||
quantity: "",
|
quantity: "",
|
||||||
contract_price: ""
|
contract_price: ""
|
||||||
})
|
})
|
||||||
|
@ -346,6 +349,7 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
clearForm()
|
clearForm()
|
||||||
setModel({ product_type: e.target.value })
|
setModel({ product_type: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onUploadError = (type, data) => {
|
const onUploadError = (type, data) => {
|
||||||
if (type === "overMaxAmount") {
|
if (type === "overMaxAmount") {
|
||||||
Notify.error(`最多可上传 ${data.maxAmount} 张图片`)
|
Notify.error(`最多可上传 ${data.maxAmount} 张图片`)
|
||||||
|
@ -507,7 +511,22 @@ const UseProductPop = forwardRef((props, ref) => {
|
||||||
<RadioButton value={2}>卡密</RadioButton>
|
<RadioButton value={2}>卡密</RadioButton>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem labelname="映射商品" prop="product" id="product">
|
{model.product_type === 2 ? (
|
||||||
|
<FormItem labelname="发放类型" prop="card_show" id="type">
|
||||||
|
<RadioGroup
|
||||||
|
onChange={(e) => {
|
||||||
|
setModel({ card_show: e.target.value })
|
||||||
|
}}
|
||||||
|
value={model.card_show}
|
||||||
|
disabled={!!model.code_batch_id}
|
||||||
|
>
|
||||||
|
<RadioButton value={2}>平台查看</RadioButton>
|
||||||
|
<RadioButton value={1}>短信下发</RadioButton>
|
||||||
|
</RadioGroup>
|
||||||
|
</FormItem>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<FormItem labelname="映射商品" prop="product_id" id="product">
|
||||||
<Select
|
<Select
|
||||||
clearable
|
clearable
|
||||||
width={520}
|
width={520}
|
||||||
|
|
|
@ -19,7 +19,8 @@ import {
|
||||||
putOrderSuccess,
|
putOrderSuccess,
|
||||||
putOrderCancel,
|
putOrderCancel,
|
||||||
refund,
|
refund,
|
||||||
handlerRefund
|
handlerRefund,
|
||||||
|
resendCardCode
|
||||||
} from "@/assets/api.js"
|
} from "@/assets/api.js"
|
||||||
var moment = require("moment")
|
var moment = require("moment")
|
||||||
let day = moment(nowDay()).format("YYYY-MM-DD")
|
let day = moment(nowDay()).format("YYYY-MM-DD")
|
||||||
|
@ -493,6 +494,18 @@ export default class orderList extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 发送短信 */
|
||||||
|
sendSms({ order_number }) {
|
||||||
|
resendCardCode({ order_number }).then(({ code, message }) => {
|
||||||
|
Notify.clear()
|
||||||
|
if (code === 200) {
|
||||||
|
Notify.success(message)
|
||||||
|
} else {
|
||||||
|
Notify.error(message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 监听组件内部状态的变化:
|
// 监听组件内部状态的变化:
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
// 参数分别为改变之前的数据状态对象
|
// 参数分别为改变之前的数据状态对象
|
||||||
|
@ -759,6 +772,14 @@ export default class orderList extends React.Component {
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
{rowData.type == 1 &&
|
||||||
|
rowData.product_type == 2 &&
|
||||||
|
rowData.product.card_show == 1 &&
|
||||||
|
rowData.status == 2 && (
|
||||||
|
<span className="grid-link" onClick={(e) => this.sendSms(rowData)}>
|
||||||
|
发送卡密短信
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ export const Column = [
|
||||||
prop: "opearo",
|
prop: "opearo",
|
||||||
name: "opearo",
|
name: "opearo",
|
||||||
type: "slot",
|
type: "slot",
|
||||||
width: "160px"
|
width: "220px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "批次号",
|
title: "批次号",
|
||||||
|
|
Loading…
Reference in New Issue