💊 fix: 修复bug

This commit is contained in:
wangsongsole 2023-06-27 18:21:52 +08:00
parent d718d199d6
commit bbc1aeee73
3 changed files with 168 additions and 160 deletions

View File

@ -59,6 +59,13 @@ const tableColumn = [
name: "effectDate", name: "effectDate",
type: "normal" type: "normal"
}, },
{
title: "总预算",
prop: "all_budget",
name: "all_budget",
width: "auto",
type: "normal"
},
{ {
title: "当前成本价格", title: "当前成本价格",
prop: "cost_price", prop: "cost_price",

View File

@ -1,129 +1,135 @@
import { divNum } from '@/tools/number'; import { divNum } from "@/tools/number"
//基本信息 //基本信息
export const codeInfo = { export const codeInfo = {
code_name: [{ type: 'required', message: '请输入兑换码名称' }], code_name: [{ type: "required", message: "请输入兑换码名称" }],
planSelect: [{ type: 'required', message: '请选择归属计划' }], planSelect: [{ type: "required", message: "请选择归属计划" }],
keyBatchSelect: [{ type: 'required', message: '请选择归属Key' }], keyBatchSelect: [{ type: "required", message: "请选择归属Key" }],
issued: [{ type: 'required', message: '请输入发放总量' }], issued: [{ type: "required", message: "请输入发放总量" }],
restrict: [ restrict: [
{ type: 'required', message: '请输入绑定数量' }, { type: "required", message: "请输入绑定数量" },
{ {
type: 'regExp', type: "regExp",
message: '请输入大于0的正整数', message: "请输入大于0的正整数",
reg: '^[0-9]*[1-9][0-9]*$' reg: "^[0-9]*[1-9][0-9]*$"
} }
] ]
}; }
//基本规则 //基本规则
export const rulesInfo = { export const rulesInfo = {
date_time: [{ type: 'required', message: '请选择生效时间段' }] date_time: [{ type: "required", message: "请选择生效时间段" }]
}; }
/* 商品范围列表 */ /* 商品范围列表 */
export const Column2 = [ export const Column2 = [
{ {
title: '商品ID', title: "商品ID",
name: 'product_id', name: "product_id",
prop: 'product_id', prop: "product_id",
width: 'auto', width: "auto",
type: 'normal' type: "normal"
}, },
{ {
title: '商品名称', title: "商品名称",
width: 'auto', width: "auto",
prop: 'product_name', prop: "product_name",
name: 'product_name', name: "product_name",
type: 'normal' type: "normal"
}, },
{ {
title: '总预算', title: "总预算",
name: 'all_budget', name: "all_budget",
prop: 'all_budget', prop: "all_budget",
type: 'normal', type: "normal",
width: 'auto' width: "auto"
}, },
{ {
title: '合同单价', title: "合同单价",
name: 'contract_price', name: "contract_price",
prop: 'contract_price', prop: "contract_price",
type: 'normal', type: "normal",
width: 'auto' width: "auto"
}, },
{ {
title: '商品官方价', title: "商品官方价",
type: 'normal', type: "normal",
prop: 'official_price', prop: "official_price",
width: 'auto' width: "auto"
}, },
{ {
title: '类型', title: "类型",
width: 'auto', width: "auto",
prop: 'type', prop: "type",
name: 'type', name: "type",
type: 'slot' type: "slot"
}, },
{ {
title: '上游平台', title: "上游平台",
width: 'auto', width: "auto",
prop: 'upstream', prop: "upstream",
name: 'upstream', name: "upstream",
type: 'normal' type: "normal"
}, },
{ {
title: '批次号', title: "批次号",
width: 'auto', width: "auto",
prop: 'channel_activity_id', prop: "channel_activity_id",
name: 'channel_activity_id', name: "channel_activity_id",
type: 'normal' type: "normal"
}, },
{ {
title: '有效时间段', title: "有效时间段",
width: 'auto', width: "auto",
prop: 'effectDate', prop: "effectDate",
name: 'effectDate', name: "effectDate",
type: 'normal' type: "normal"
},
{
title: "总预算",
prop: "all_budget",
name: "all_budget",
width: "auto",
type: "normal"
},
{
title: "当前成本价格",
prop: "cost_price",
name: "cost_price",
width: "auto",
type: "slot"
}, },
{ {
title: '当前成本价格', title: "库存总数量",
prop: 'cost_price', prop: "quantity",
name: 'cost_price', name: "quantity",
width: 'auto', type: "normal",
type: 'slot' width: "auto"
},
{
title: '库存总数量',
prop: 'quantity',
name: 'quantity',
type: 'normal',
width: 'auto'
}, },
{ {
title: '剩余数量', title: "剩余数量",
prop: 'stock', prop: "stock",
name: 'stock', name: "stock",
type: 'normal', type: "normal",
width: 'auto' width: "auto"
}, },
{ {
title: '已使用数量', title: "已使用数量",
prop: 'usage', prop: "usage",
name: 'usage', name: "usage",
type: 'normal', type: "normal",
width: 'auto' width: "auto"
}, },
{ {
title: '操作', title: "操作",
prop: 'edit', prop: "edit",
name: 'edit', name: "edit",
type: 'slot', type: "slot",
width: 'auto' width: "auto"
} }
]; ]
/* 初始化数据 */ /* 初始化数据 */
export const init = () => { export const init = () => {
@ -131,29 +137,29 @@ export const init = () => {
uploading: false, //上传中 uploading: false, //上传中
model: { model: {
//数据模型不可少 //数据模型不可少
product_id: '', product_id: "",
product_type: '1', product_type: "1",
contract_price: '', contract_price: "",
official_price: '', official_price: "",
cost_price: '', cost_price: "",
quantity: '', quantity: "",
product_name: '', product_name: "",
show_url: '', show_url: "",
describe_url: '', describe_url: "",
detail_url: '', detail_url: "",
weight: '0' weight: "0"
}, },
codeInfo: { codeInfo: {
//数据模型不可少 //数据模型不可少
code_name: '', code_name: "",
issued: '', //发放总量 issued: "", //发放总量
describe: '', describe: "",
date_time: '', date_time: "",
range: '', range: "",
stock: '', stock: "",
planSelect: '' /* 归属计划 */, planSelect: "" /* 归属计划 */,
keyBatchSelect: '' /* 归属key */, keyBatchSelect: "" /* 归属key */,
restrict: '' /* 绑定数 */ restrict: "" /* 绑定数 */
}, },
isload: false, isload: false,
tempdata: [], tempdata: [],
@ -169,78 +175,73 @@ export const init = () => {
timer: 3, timer: 3,
payType: 3, payType: 3,
reseller: null, reseller: null,
payment_direction: ['对私账户', '对公账户', '预付款扣除'], payment_direction: ["对私账户", "对公账户", "预付款扣除"],
isAudit: false, isAudit: false,
approvalsStatus: false, approvalsStatus: false,
oldTable: [], oldTable: [],
product_title: '新建商品', product_title: "新建商品",
plan_time: '', plan_time: "",
direct_reseller_id: 0, direct_reseller_id: 0,
newGoodsBtnLoading: false, newGoodsBtnLoading: false,
tableLoading: false, tableLoading: false,
addIsType: '', addIsType: "",
isState: 0 /* 0:新增 1:复制 2:编辑 */, isState: 0 /* 0:新增 1:复制 2:编辑 */,
planSelectData: [] /* 归属计划数据 */, planSelectData: [] /* 归属计划数据 */,
keyBatchSelectData: [] /* 归属key数据 */, keyBatchSelectData: [] /* 归属key数据 */,
codeStatus: '' /* 兑换码状态 */ codeStatus: "" /* 兑换码状态 */
}; }
}; }
/* 转换红包数据 */ /* 转换红包数据 */
export function redPacketsDataFn(params) { export function redPacketsDataFn(params) {
const newObj = {}; const newObj = {}
const price = const price =
params.cash_amount_type === '1' params.cash_amount_type === "1"
? params.denomination ? params.denomination
: params.total_contract_price / params.num; : `${params.min_denomination}~${params.max_denomination}`
newObj.product_name = params.batch_goods_name; //名字 newObj.product_name = params.batch_goods_name //名字
newObj.channel_activity_id = params.cash_activity_id; //批次号 newObj.channel_activity_id = params.cash_activity_id //批次号
newObj.cash_activity_id = params.cash_activity_id; //批次号 newObj.cash_activity_id = params.cash_activity_id //批次号
newObj.only = params.cash_activity_id; //批次号 newObj.only = params.cash_activity_id //批次号
newObj.type = 3; //类型 newObj.type = 3 //类型
newObj.checked = params?.checked; newObj.checked = params?.checked
newObj.upstream = params.channel === 1 ? '支付宝' : '微信'; //上游 newObj.upstream = params.channel === 1 ? "支付宝" : "微信" //上游
newObj.edit = 'edit'; newObj.edit = "edit"
newObj.all_budget = params.all_budget; newObj.all_budget = params.all_budget
newObj.effectDate = params.begin_time + ' 至 ' + params.end_time; //有效时间 newObj.effectDate = params.begin_time + " 至 " + params.end_time //有效时间
newObj.contract_price = price; //单价 newObj.contract_price = params.total_contract_price / params.num //合同单价
newObj.cost_price = '-'; //单价 newObj.cost_price = "-" //单价
newObj.official_price = price; //官方价 newObj.official_price = price //官方价
newObj.quantity = params.total_stock || params.num; //总库 newObj.quantity = params.total_stock || params.num //总库
newObj.stock = params.stock || params.num; //剩余 newObj.stock = params.stock || params.num //剩余
newObj.usage = params.usage || 0; //已使用 newObj.usage = params.usage || 0 //已使用
newObj.id = params.goods_id || params.id; newObj.id = params.goods_id || params.id
newObj.product_id = params.goods_id || '-'; newObj.product_id = params.goods_id || "-"
newObj.origin = params; newObj.origin = params
return newObj; return newObj
} }
/* 转换立减金数据 */ /* 转换立减金数据 */
export function reductionFn(params) { export function reductionFn(params) {
const newObj = {}; const newObj = {}
newObj.product_name = params.batch_goods_name || params.product_name; //名字 newObj.product_name = params.batch_goods_name || params.product_name //名字
newObj.channel_activity_id = params.channel_activity_id; //批次号 newObj.channel_activity_id = params.channel_activity_id //批次号
newObj.only = params.channel_activity_id; //批次号 newObj.only = params.channel_activity_id //批次号
newObj.type = 2; //类型 newObj.type = 2 //类型
newObj.checked = params?.checked; newObj.checked = params?.checked
newObj.upstream = String(params.channel) === '1' ? '支付宝' : '微信'; //上游 newObj.upstream = String(params.channel) === "1" ? "支付宝" : "微信" //上游
newObj.edit = 'edit'; newObj.edit = "edit"
newObj.all_budget = params.all_budget; newObj.all_budget = params.all_budget
newObj.effectDate = newObj.effectDate =
params.effectDate || params.effectDate ||
params.time_limit?.effect_time.start_time + params.time_limit?.effect_time.start_time + " 至 " + params.time_limit?.effect_time.end_time //有效时间
' 至 ' + newObj.contract_price = params.contract_price || params.price //单价
params.time_limit?.effect_time.end_time; //有效时间 newObj.official_price = params.official_price || params.reduce_amount //官方价
newObj.contract_price = params.contract_price || params.price; //单价 newObj.quantity = params.quantity || parseInt(divNum(params.all_budget, params.reduce_amount)) //总库
newObj.official_price = params.official_price || params.reduce_amount; //官方价 newObj.stock = params.stock || parseInt(divNum(params.all_budget, params.reduce_amount)) //剩余
newObj.quantity = newObj.usage = params.usage || 0 //已使用
params.quantity || newObj.origin = params
parseInt(divNum(params.all_budget, params.reduce_amount)); //总库 newObj.id = params.goods_id || params.id
newObj.stock = newObj.product_id = params.goods_id || "-"
params.stock || parseInt(divNum(params.all_budget, params.reduce_amount)); //剩余 return newObj
newObj.usage = params.usage || 0; //已使用
newObj.origin = params;
newObj.id = params.goods_id || params.id;
newObj.product_id = params.goods_id || '-';
return newObj;
} }

View File

@ -46,7 +46,7 @@ export const redPacketsFun = (item) => {
table_obj.only = item // 存储就数据 编辑好用 table_obj.only = item // 存储就数据 编辑好用
table_obj.product_id = item.goods_id || item.id || item.cash_activity_id // 商品编号 table_obj.product_id = item.goods_id || item.id || item.cash_activity_id // 商品编号
table_obj.product_name = item.batch_goods_name // 商品名 table_obj.product_name = item.batch_goods_name // 商品名
table_obj.official_price = price // 官方价 table_obj.official_price = item.total_contract_price / item.num // 官方价
table_obj.contract_price = price // 合同价格 table_obj.contract_price = price // 合同价格
table_obj.cost_price = "-" //单价 table_obj.cost_price = "-" //单价
table_obj.quantity = item.num // 库存数量 table_obj.quantity = item.num // 库存数量