Commit f739b677 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理报价类订单没有支付信息问题,新增销售订单内部状态0完成订单,修改账户充值微信渠道为2,处理渠道商品切换角色数据清空问题,处理快捷修改价格阶梯价格校验问题

parent 28c0ace3
......@@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react'
import styles from './index.less'
export interface ImagePreviewProps {
src: string,
src: any, // 图片src数组
currentRef?: any
}
const ImagePreview:React.FC<ImagePreviewProps> = ({src, currentRef}) => {
const [state, setState] = useState(false)
const [index, setIndex] = useState(0)
useEffect(() => {
if (currentRef) {
......@@ -16,13 +17,16 @@ const ImagePreview:React.FC<ImagePreviewProps> = ({src, currentRef}) => {
}
}
}, [])
const toggle = () => {
const toggle = (index?:any) => { // 点击的索引
if(index){
setIndex(index)
}
setState(!state)
}
return state && (
<div className={styles.imgPreviewWrapper} onClick={toggle}>
<img src={src} className={styles.imgPreview}/>
<img src={src[index]} className={styles.imgPreview}/>
</div>
)
}
......
......@@ -881,6 +881,7 @@ export const PurchaseOrderTransformInsideWorkStateTexts = {
// 销售订单流转记录内部状态
export const SaleOrderTransformInsideWorkStateTexts = {
"-1": '取消订单',
0: '完成订单',
1: '审核通过',
2: '审核通过',
3: '审核通过',
......
......@@ -197,10 +197,6 @@ const SelectChannel:React.FC<IProps> = (props) => {
message.error('请先选择渠道商品!')
}
const clickDelete = (record: any) => { // 删除处理
}
const handleOkAddMember = () => {
setVisibleChannelMember(false)
console.log(memberRowCtl.selectRow, memberRowCtl.selectedRowKeys, '选中的项')
......@@ -223,6 +219,8 @@ const SelectChannel:React.FC<IProps> = (props) => {
setSelectedRole(option)
setMemberTableData([])
setSelectedMemberRowKeys([])
memberRowCtl.setSelectRow([])
memberRowCtl.setSelectedRowKeys([])
}
const clickSearchChannel = (value: string) => {
......
......@@ -223,12 +223,15 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
<Form.Item
name={attrItem.id}
label={attrItem.name}
rules={attrItem.isEmpty && [{
rules={attrItem.isEmpty ? [{
required: true,
message: '此项为必填项'
},{
validator: (r, v, c) => validatorByte(r, v, c, 60)
}]}
}] : [{
validator: (r, v, c) => validatorByte(r, v, c, 60)
}]
}
>
<TextArea
disabled={_isDisabled}
......
......@@ -30,17 +30,6 @@ interface Item {
status: string;
}
interface paramItem {
name: string;
code: string;
priceType: number;
min: number;
max: number;
brandId: number;
customerCategoryId: number;
status: number;
}
const FastModifyPrice: React.FC<{}> = () => {
const ref = useRef<any>({})
const [setForm] = Form.useForm()
......@@ -198,7 +187,6 @@ const FastModifyPrice: React.FC<{}> = () => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductCommodityGetCommodityDetailList({ ...filterParams, ...params, environment: 1 }).then(res => {
const { data } = res
resolve(data)
......@@ -278,7 +266,6 @@ const FastModifyPrice: React.FC<{}> = () => {
const handleOk = () => {
setForm.validateFields().then(v=>{
console.log(v, 'v')
const { ladderPrice, ladderRange } = v
let _priceRange = {}
if(ladderPrice){ // 判断阶梯价格
......@@ -288,8 +275,6 @@ const FastModifyPrice: React.FC<{}> = () => {
}else{
_priceRange['0-0'] = v.uniquePrice
}
console.log(_priceRange)
// @ts-ignore
PublicApi.postProductCommodityUpdateCommodityPrice({ id: currentRow.id, unitPrice: _priceRange }).then(res => {
if(res.code === 1000){
ref.current.reload()
......@@ -305,7 +290,9 @@ const FastModifyPrice: React.FC<{}> = () => {
const changeLadderPrice = (e: any) => {
setLadderPrice(e.target.checked)
setForm.setFields([{name: 'ladderPrice', value: e.target.checked}])
if(e.target.checked && currentRow.minOrder){
setForm.setFieldsValue({ladderRange: [{numberPrice: null, numberRange: {numberMin: currentRow.minOrder, numberMax: null}}]})
}
}
const handleHightSearch = (val?: string) => {
......@@ -330,8 +317,9 @@ const FastModifyPrice: React.FC<{}> = () => {
},
[]
)
let result = range.reduce((a, b) => { if(a<b) return b })
let result = range.map(Number).reduce((a, b) => { if(a<b) return b })
if(!result) throw new Error('请正确输入阶梯数量范围');
if(Number(range[0]) !== Number(currentRow.minOrder)) throw new Error('阶段的起始值必须为最小起订数');
callback()
}
} catch (err) {
......@@ -483,8 +471,9 @@ const FastModifyPrice: React.FC<{}> = () => {
priceType!==3 && <Form.Item
label=""
name="ladderPrice"
valuePropName="checked"
>
<Checkbox checked={ladderPrice} onChange={changeLadderPrice}>阶梯价格</Checkbox>
<Checkbox onChange={changeLadderPrice}>阶梯价格</Checkbox>
</Form.Item>
}
{
......@@ -502,7 +491,7 @@ const FastModifyPrice: React.FC<{}> = () => {
}
]}
>
<Form.List name="ladderRange" key={Math.random()}>
<Form.List name="ladderRange">
{(fields, { add, remove }) => {
if (!fields.length) {
add()
......@@ -512,84 +501,61 @@ const FastModifyPrice: React.FC<{}> = () => {
{fields.map(field => (
<Row key={field.key} gutter={[0, 10]}>
<Col span={20} style={{ display: 'flex' }}>
<Item
<Form.Item
{...field}
name={[field.name, 'numberRange', 'numberMin']}
fieldKey={[field.fieldKey, 'numberRange', 'numberMin']}
rules={[
{ required: true, message: '阶梯最小数量为必填项' },
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值仅限三位小数',
}
]}
>
<Input placeholder="最小数量" />
</Form.Item>
<Input
style={{
width: 30,
height: 32,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Form.Item
{...field}
name={[field.name, 'numberRange']}
fieldKey={[field.fieldKey, 'numberRange']}
key={'_' + field.fieldKey}
noStyle
name={[field.name, 'numberRange', 'numberMax']}
fieldKey={[field.fieldKey, 'numberRange', 'numberMax']}
rules={[
{ required: true, message: '阶梯最大数量为必填项' },
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值仅限三位小数',
}
]}
>
<Input.Group compact>
<Form.Item
name={[field.name, 'numberRange', 'numberMin']}
noStyle
rules={[
{
required: true,
message: '阶梯最小数量为必填项'
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值小数点后仅限三位',
}
]}
>
<Input style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
</Form.Item>
<InputNumber
style={{
width: 30,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<Form.Item
name={[field.name, 'numberRange', 'numberMax']}
noStyle
rules={[
{
required: true,
message: '阶梯最大数量为必填项'
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值小数点后仅限三位',
}
]}
>
<InputNumber
className={styles.siteInputRight}
style={{
width: 100,
textAlign: 'center',
}}
placeholder="最大数量"
/>
</Form.Item>
</Input.Group>
</Item>
<Item
<Input placeholder="最大数量" />
</Form.Item>
<Form.Item
{...field}
name={[field.name, 'numberPrice']}
fieldKey={[field.fieldKey, 'numberPrice']}
key={'__' + field.fieldKey}
noStyle
rules={[
{
required: true,
message: '阶梯单价为必填项'
},
{ required: true, message: '阶梯单价为必填项' },
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '阶梯单价小数点后仅限四位',
message: '阶梯单价仅限四位小数',
}
]}
style={{marginLeft: 20}}
>
<Input style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
</Item>
<Input placeholder="请输入单价" />
</Form.Item>
</Col>
<Col span={4}>
<Button size="small" onClick={() => add()} style={{ marginLeft: 20, marginRight: 8 }} icon={<PlusOutlined />} />
......
......@@ -369,7 +369,7 @@ const AccountDetail: React.FC<{}> = () => {
<img src={qrCode} alt=""/>
<div className={styles.scanTips}>
<ScanOutlined className={styles.scanIcon} />
<span>打开 {rechargeType === 1 ? '微信' : '支付宝'}App<br />扫码完成充值</span>
<span>打开 {rechargeType === 2 ? '微信' : '支付宝'}App<br />扫码完成充值</span>
</div>
</div>
</Modal>
......
......@@ -140,7 +140,7 @@ export const rechargeSchema: ISchema = {
"x-component-props": {
dataSource: [
// {id: 1, name: '支付宝', logoUrl: alipay},
{id: 1, name: '微信', logoUrl: wxpay}
{id: 2, name: '微信', logoUrl: wxpay}
],
type: 'radio' // CardCheckBox 单选模式
},
......
......@@ -245,12 +245,11 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const fetchMemberList = async (params) => {
const shopType = addSchemaAction.getFieldValue('shopType');
// 当商城类型为 渠道商城、渠道自由商城和渠道积分商城时,需要带上下面两个参数
const { channelMemberIdList, channelMemberRoleIdList } = productState;
const { members } = productState;
const data = {
...params,
shopType: shopType,
memberIds: channelMemberIdList,
roleIds: channelMemberRoleIdList
members: members
}
const res = await PublicApi.postMemberManageAllPageByshoptype(data, {ctlType: 'none'});
return res.data
......@@ -422,7 +421,7 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
},
},
properties: {
categoryId: {
customerCategoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
......
......@@ -63,12 +63,12 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
<List
itemLayout="horizontal"
dataSource={transData || []}
renderItem={(item: string) => (
<List.Item style={{fontSize: 12}} extra={<Button type='link' onClick={imgRef.current.toggle}>预览</Button>}>
renderItem={(item: string, index: number) => (
<List.Item style={{fontSize: 12}} extra={<Button type='link' onClick={() => imgRef.current.toggle(index)}>预览</Button>}>
<OverflowText style={{flex: '.9'}}>
{item}
</OverflowText>
<ImagePreview src={item} currentRef={imgRef}/>
<ImagePreview src={transData || []} currentRef={imgRef}/>
</List.Item>
)}
/>
......
import { productColumns } from './../../../../afterService/exchangeGoods/waitAddLogisticsOrder/opration/component/selectProductModal.tsx/index';
import { ISchemaFormActions, FormEffectHooks, IFieldState, ISchemaFormAsyncActions, createEffectHook } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
......@@ -87,6 +88,7 @@ export const useEditHideField = () => {
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
const { value } = state
console.log(value, 'vlaue')
const payInfoData = ctx.getFieldValue('paymentInformationResponses')
// 强制渲染一次, 用于触发金额总数
update()
......@@ -97,7 +99,8 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// 请求一次并复制给支付信息
const productItem = value[0]
fetchOrderApi.getPayInfoList({
productId: productItem.id,
// productId: productItem.id,
productId: productItem?.commodityId ? productItem.id : productItem.productId,
memberId: productItem.memberId
}).then(data => {
ctx.setFieldValue('paymentInformationResponses', data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment