* 'couponV1.5' of https://codeup.aliyun.com/5f9118049cffa29cfdd3be1c/marketing/frontend:
  融合 兑换码编辑、新增、复制为一个页面 以及相关配置和代码优化
  配置新建兑换码路由以及新建兑换码相关文件
This commit is contained in:
Apple 2022-08-25 14:23:26 +08:00
commit c3adcf62f1
7 changed files with 1542 additions and 25 deletions

View File

@ -90,6 +90,7 @@ export default class topNav extends React.Component {
pathnamestr.includes('add') ||
pathnamestr.includes('aid') ||
pathnamestr.includes('exchangecode-copyCode') ||
pathnamestr.includes('exchangecode-exchangecodeAdd') ||
pathnamestr.includes('distributor-edit') ||
pathnamestr.includes('key-list') ||
pathnamestr.includes('key-detail') ||

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
#editcode {
padding-bottom: 30px;
.zent-select-v2 {
border-top: 0 !important;
border-left: 0 !important;
border-right: 0 !important;
border-radius: 0 !important;
&:hover,
.zent-select-v2-search:hover {
background-color: #F7F9FC;
}
}
.edit-btnList {
width: 90%;
margin: 0 auto;
button {
width: 100px;
}
.goods-boxs {
display: flex;
justify-content: flex-start;
}
}
.line {
width: 508px;
text-align: left;
height: 36px;
line-height: 36px;
padding-left: 12px;
border-bottom: 1px solid #e0e0e0;
}
}

View File

@ -0,0 +1,106 @@
//基本信息
export const codeInfo = {
code_name: [{ type: 'required', message: '请输入兑换码名称' }],
planName: [{ type: 'required', message: '请选择营销计划' }],
keyBatch: [{ type: 'required', message: '请选择key批次' }]
}
//基本规则
export const rulesInfo = {
date_time: [{ type: 'required', message: '请选择生效时间段' }]
}
export const Column2 = [
{
title: '商品ID',
name: 'product_id',
prop: 'product_id',
width: 'auto',
type: 'normal'
},
{
title: '商品名称',
width: 'auto',
prop: 'product_name',
name: 'product_name',
type: 'normal'
},
{
title: '立减金平台批次号',
width: '250px',
prop: 'channel_activity_id',
name: 'channel_activity_id',
type: 'normal'
},
{
title: '类型',
width: 'auto',
prop: 'type',
name: 'type',
type: 'slot'
},
{
title: '上游平台',
width: 'auto',
prop: 'upstream',
name: 'upstream',
type: 'normal'
},
{
title: '有效时间段',
width: '450px',
prop: 'effectDate',
name: 'effectDate',
type: 'normal'
},
{
title: '当前成本价格',
prop: 'cost_price',
name: 'cost_price',
width: 'auto',
type: 'slot'
},
{
title: '合同单价',
name: 'contract_price',
prop: 'contract_price',
type: 'normal',
width: 'auto'
},
{
title: '商品官方价',
type: 'normal',
prop: 'official_price',
width: 'auto'
},
{
title: '库存总数量',
prop: 'quantity',
name: 'quantity',
type: 'normal',
width: 'auto'
},
{
title: '剩余数量',
prop: 'stock',
name: 'stock',
type: 'normal',
width: 'auto'
},
{
title: '已使用数量',
prop: 'usage',
name: 'usage',
type: 'normal',
width: 'auto'
},
{
title: '操作',
prop: 'edit',
name: 'edit',
type: 'slot',
width: 'auto'
}
]

View File

@ -1,5 +1,11 @@
import React from 'react'
import { Sweetalert, CombinedDateRangePicker, Notify, Switch } from 'zent'
import {
Sweetalert,
CombinedDateRangePicker,
Notify,
Switch,
Button
} from 'zent'
import './list.less'
import _ from 'lodash'
import '../../../assets/comm.css'
@ -14,7 +20,6 @@ import {
putCodeStatus,
terminateApprovals
} from '../../../assets/api.js'
var moment = require('moment')
const Column = [
{
title: '兑换码-批次ID',
@ -142,28 +147,49 @@ export default class acclist extends React.Component {
tabIndex: 0
}
}
clickFn() {
this.props.history.push('/home/exchangecode-add')
sessionStorage.setItem('pathname2', '/home/exchangecode-add')
/* 新建/复制/编辑/兑换码 */
addCodeFunction(type, param) {
let activerou = [
{
pagetitle: '新建',
pagetitle: '新建兑换码',
items: [
{
path: '/home/exchangecode-list',
name: '兑换码管理'
},
{
path: '/home/exchangecode-add',
path: '/home/exchangecode-exchangecodeAdd',
name: '新建兑换码'
}
]
}
]
/* 1复制 2编辑 */
if (type === 1) {
activerou[0].pagetitle = '复制'
activerou[0].items[1].name = '复制:' + param.title
sessionStorage.setItem(
'knockGold_effectDate',
JSON.stringify(param.keyBatch.plan)
)
sessionStorage.setItem('keybatch_id', param.key_batch_id)
sessionStorage.setItem('copy_code_id', param.id)
sessionStorage.setItem('key_reseller_id', param.keyBatch.plan.reseller_id)
sessionStorage.setItem('approval_id', param.keyBatch.approval_id)
sessionStorage.setItem('isState', type)
} else if (type === 2) {
activerou[0].pagetitle = '编辑'
activerou[0].items[1].name = param.title + '兑换码的商品范围列表'
sessionStorage.setItem('code_id', param.id)
sessionStorage.setItem('isState', type)
}
sessionStorage.setItem('breaknav', JSON.stringify(activerou))
sessionStorage.setItem('pathname2', '/home/exchangecode-exchangecodeAdd')
this.props.history.push('/home/exchangecode-exchangecodeAdd')
}
aboutFn(e, row) {
// this.props.history.push('/home/exchange-addcommodity');
sessionStorage.setItem('pathname2', '/home/exchange-addcommodity')
let activerou = [
{
@ -186,24 +212,24 @@ export default class acclist extends React.Component {
}
/* 处理可复制数据逻辑 */
copyElementFunction({ key_batch_id, status, keyBatch, id, title }) {
copyElementFunction(params) {
let element = ''
/*
条件一 如果兑换码状态为1进行中2暂停中3未开始可直接复制
条件二 如果兑换码状态为4已完结5已作废则判断key批次是否是 生效中暂停中审核驳回状态且营销计划是待生效进行中暂停中
*/
const isCopy =
[1, 2, 3].includes(status) ||
([4, 5].includes(status) &&
[4, 5, 8].includes(keyBatch.status) &&
[3, 5, 4].includes(keyBatch.plan.status))
[1, 2, 3].includes(params.status) ||
([4, 5].includes(params.status) &&
[4, 5, 8].includes(params.keyBatch.status) &&
[3, 5, 4].includes(params.keyBatch.plan.status))
if (isCopy) {
element = (
<span
className='grid-link'
style={{}}
onClick={(e) => this.copyFunction(key_batch_id, id, keyBatch, title)}>
onClick={(e) => this.addCodeFunction(1, params)}>
复制
</span>
)
@ -486,7 +512,6 @@ export default class acclist extends React.Component {
}}
/>
)
const { current, pageSize } = this.state
return (
<div id='exchangecodelist'>
<TabPage
@ -494,9 +519,13 @@ export default class acclist extends React.Component {
tabs={this.state.tabList}
tabChange={this.tabFn.bind(this)}
width={130}>
<div className='codetable dflexajce'>
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}>新建兑换码</Button> */}
{/* <Button type="info">批量操作</Button> */}
<div className='codetable '>
<Button
type='primary'
icon='plus'
onClick={() => this.addCodeFunction()}>
新建兑换码
</Button>
<Ipt
onClearItem={(e) => {
this.setState({ key_word: '' })
@ -583,7 +612,7 @@ export default class acclist extends React.Component {
rowData.status != -1 ? (
<span
className='grid-link'
onClick={(e) => this.editinfo(e, rowData)}>
onClick={(e) => this.addCodeFunction(2, rowData)}>
编辑
</span>
) : (

View File

@ -1,18 +1,24 @@
#exchangecodelist{
#exchangecodelist {
width: 98%;
margin: 0 auto;
.codetable{
.codetable {
padding: 24px;
display: flex;
justify-content: space-between;
}
.code-table{
.code-table {
border-top: 1px solid #e0e0e0;
padding-bottom: 24px;
}
.grid-link{
.grid-link {
color: #2B66F2;
cursor: pointer;
}
.zent-datepicker-trigger{
background: #f5f6f7!important;
.zent-datepicker-trigger {
background: #f5f6f7 !important;
}
}

View File

@ -38,6 +38,7 @@ import DistriButorEdit from '@/pages/distributor/add/add'
import MyTempMouldAdd from '@/pages/exchangepage/template/main.js'
import MyExChangeTemplate from '@/pages/exchangepage/mytemplate/main.js'
import CopyCode from '@/pages/exchangecode/copyCode/index'
import ExchangeCodeAdds from '@/pages/exchangecode/exchangecodeAdd'
/* 基础路由 */
const router = [
@ -240,6 +241,11 @@ const router = [
path: '/home/system/account-list',
component: AccountList,
meta: { exact: true }
},
{
path: '/home/exchangecode-exchangecodeAdd',
component: ExchangeCodeAdds,
meta: { exact: true }
}
]