Compare commits
10 Commits
94c986a215
...
2510e7ac93
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2510e7ac93 | ||
| 0aa47cb0e5 | |||
|
|
5c8c164904 | ||
|
|
488fc66481 | ||
|
|
fab0652997 | ||
|
|
7afb11bc74 | ||
|
|
ef0a52f658 | ||
|
|
af3aa008e4 | ||
|
|
e56f538244 | ||
|
|
7f82f6f2e4 |
@ -32,6 +32,7 @@
|
|||||||
"disableUseStrict": false,
|
"disableUseStrict": false,
|
||||||
"useCompilerPlugins": false,
|
"useCompilerPlugins": false,
|
||||||
"minifyWXML": true,
|
"minifyWXML": true,
|
||||||
|
"condition": false,
|
||||||
"ignoreUploadUnusedFiles": true
|
"ignoreUploadUnusedFiles": true
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
|
|||||||
@ -4,7 +4,6 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
NODE_ENV: '"pre"',
|
NODE_ENV: '"pre"',
|
||||||
},
|
},
|
||||||
outputRoot: 'dist',
|
|
||||||
defineConstants: {
|
defineConstants: {
|
||||||
CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
|
CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
|
||||||
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://pre.zzfzyc.com"',
|
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://pre.zzfzyc.com"',
|
||||||
|
|||||||
@ -4,7 +4,6 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
NODE_ENV: '"production"',
|
NODE_ENV: '"production"',
|
||||||
},
|
},
|
||||||
outputRoot: 'build',
|
|
||||||
defineConstants: {
|
defineConstants: {
|
||||||
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
|
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
|
||||||
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://www.zzfzyc.com"',
|
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://www.zzfzyc.com"',
|
||||||
|
|||||||
@ -31,7 +31,8 @@
|
|||||||
},
|
},
|
||||||
"disableUseStrict": false,
|
"disableUseStrict": false,
|
||||||
"useCompilerPlugins": false,
|
"useCompilerPlugins": false,
|
||||||
"minifyWXML": true
|
"minifyWXML": true,
|
||||||
|
"condition": false
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.24.5",
|
"libVersion": "2.24.5",
|
||||||
|
|||||||
@ -128,6 +128,27 @@
|
|||||||
"query": "id=34311",
|
"query": "id=34311",
|
||||||
"launchMode": "default",
|
"launchMode": "default",
|
||||||
"scene": null
|
"scene": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"pathName": "pages/submitOrder/index",
|
||||||
|
"query": "purchaser_id=1873&sale_mode=0&shopping_cart_product_color_list=%5B75484%2C75485%5D&purchaser_name=%E5%AD%9C%E7%84%B6%E7%83%A4%E9%B1%BF%E9%B1%BC",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"pathName": "pages/getColorCard/index",
|
||||||
|
"query": "",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"pathName": "pages/submitOrder/index",
|
||||||
|
"query": "purchaser_id=1861&sale_mode=0&shopping_cart_product_color_list=%5B75615%5D&purchaser_name=%E5%93%88%E5%96%BD",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -248,3 +248,19 @@ export const RefuseAdjustPriceAudit = () => {
|
|||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 立即下单(预览)
|
||||||
|
export const SaleOrderPreViewBuyNow = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: '/v2/mp/saleOrder/preView/atOnce',
|
||||||
|
method: 'put',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即下单(提交订单)
|
||||||
|
export const SaleOrderSubmitBuyNow = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: '/v2/mp/saleOrder/atOnce',
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -1,21 +1,14 @@
|
|||||||
export const BASE_URL = CURRENT_BASE_URL
|
// export const BASE_URL = CURRENT_BASE_URL
|
||||||
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
||||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
|
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
|
|
||||||
// export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境
|
// export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境
|
||||||
// export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布
|
export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布
|
||||||
// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发
|
|
||||||
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
|
|
||||||
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
|
||||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||||
// export const BASE_URL = 'https://www.zzfzyc.com/lymarket' // 正式环境
|
// export const BASE_URL = 'https://www.zzfzyc.com/lymarket' // 正式环境
|
||||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
|
||||||
// export const BASE_URL = 'http://192.168.1.7:50002/lymarket' // 添
|
// export const BASE_URL = 'http://192.168.1.7:50002/lymarket' // 添
|
||||||
// export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰
|
// export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰
|
||||||
// export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华
|
|
||||||
// export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷
|
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
.bottomBox {
|
|
||||||
width: 100%;
|
|
||||||
height: 132px;
|
|
||||||
background: #FFFFFF;
|
|
||||||
box-shadow: 0px -5px 20px -8px rgba(0, 0, 0, 0.06);
|
|
||||||
display: flex;
|
|
||||||
padding-top: 16px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.leftBottom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 12px;
|
|
||||||
|
|
||||||
.nowFont {
|
|
||||||
font-size: 28px;
|
|
||||||
font-family: PingFangSC-Regular, PingFang SC;
|
|
||||||
font-weight: 400;
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selctFont {
|
|
||||||
font-size: 28px;
|
|
||||||
font-family: PingFangSC-Regular, PingFang SC;
|
|
||||||
font-weight: 400;
|
|
||||||
color: #236AFF;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
margin-right: 50px;
|
|
||||||
width: 256px;
|
|
||||||
height: 80px;
|
|
||||||
background: #4581FF;
|
|
||||||
border-radius: 40px;
|
|
||||||
font-size: 32px;
|
|
||||||
font-family: PingFangSC-Medium, PingFang SC;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #FFFFFF;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.activeButton {
|
|
||||||
margin-right: 50px;
|
|
||||||
width: 256px;
|
|
||||||
height: 80px;
|
|
||||||
background: #68b4ff;
|
|
||||||
border-radius: 40px;
|
|
||||||
font-size: 32px;
|
|
||||||
font-family: PingFangSC-Medium, PingFang SC;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 80px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import { Button, View } from '@tarojs/components'
|
|
||||||
import Taro from '@tarojs/taro'
|
|
||||||
import { memo } from 'react'
|
|
||||||
import classnames from 'classnames'
|
|
||||||
import styles from './index.module.scss'
|
|
||||||
|
|
||||||
interface prosObj {
|
|
||||||
isDisabled: boolean
|
|
||||||
handSure?: () => void
|
|
||||||
clientId?: Number
|
|
||||||
clientName?: string
|
|
||||||
}
|
|
||||||
const BottomCustomer = (props: prosObj) => {
|
|
||||||
const {
|
|
||||||
isDisabled = true,
|
|
||||||
handSure,
|
|
||||||
clientName = '',
|
|
||||||
} = props
|
|
||||||
const navTo = () => {
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: `/pages/customerPage/index?clientId=${props?.clientId}`,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View className={styles.bottomBox}>
|
|
||||||
<View className={styles.leftBottom} onClick={() => { navTo() }}>
|
|
||||||
<View className={styles.nowFont}>当前客户:</View>
|
|
||||||
<View className={styles.selctFont}>{clientName === '' ? '请选择客户 >' : `${clientName} >`}</View>
|
|
||||||
</View>
|
|
||||||
<Button className={classnames(isDisabled ? styles.activeButton : styles.button)} disabled={isDisabled} onClick={() => { handSure?.() }}> 加入购物车</Button >
|
|
||||||
</View >
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export default memo(BottomCustomer)
|
|
||||||
@ -1,14 +1,14 @@
|
|||||||
|
import type { InputProps } from '@tarojs/components'
|
||||||
import { CustomWrapper, Input, View } from '@tarojs/components'
|
import { CustomWrapper, Input, View } from '@tarojs/components'
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
// 解决 input 组件输入过快会出现闪烁的问题
|
// 解决 input 组件输入过快会出现闪烁的问题
|
||||||
// https://github.com/NervJS/taro/issues/9664
|
// https://github.com/NervJS/taro/issues/9664
|
||||||
interface PropsType {
|
interface PropsType extends InputProps {
|
||||||
customClassName?: string
|
customClassName?: string
|
||||||
customStyle?: React.CSSProperties
|
customStyle?: React.CSSProperties
|
||||||
customInputStyle?: React.CSSProperties
|
customInputStyle?: React.CSSProperties
|
||||||
customInputClassName?: string
|
customInputClassName?: string
|
||||||
[Property: string]: any
|
|
||||||
}
|
}
|
||||||
const InputX: FC<PropsType> = (props) => {
|
const InputX: FC<PropsType> = (props) => {
|
||||||
const { customClassName, customStyle, customInputStyle, customInputClassName, ...inputProps } = props
|
const { customClassName, customStyle, customInputStyle, customInputClassName, ...inputProps } = props
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
import { Image, Input, ScrollView, View } from '@tarojs/components'
|
import { Image, Input, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import LabAndImg from '@/components/LabAndImg'
|
import LabAndImg from '@/components/LabAndImg'
|
||||||
import { formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
|
import { EnumSaleMode } from '@/common/Enumerate'
|
||||||
|
|
||||||
interface props {
|
interface props {
|
||||||
clickAdd: (any) => void
|
clickAdd: (any) => void
|
||||||
@ -87,15 +88,19 @@ const GoodsItem = (props: props) => {
|
|||||||
<View className={styles.title}>{valueInfo?.code} {valueInfo?.name}</View>
|
<View className={styles.title}>{valueInfo?.code} {valueInfo?.name}</View>
|
||||||
<View className={styles.productNums}>剩:{valueInfo?.roll}件</View>
|
<View className={styles.productNums}>剩:{valueInfo?.roll}件</View>
|
||||||
{
|
{
|
||||||
modeFont === 0 && <View className={styles.productName}>空差:{formatWeightDiv(valueInfo?.weight_error) || 0}Kg</View>
|
modeFont === EnumSaleMode.Bulk && <View className={styles.productName}>空差:{formatWeightDiv(valueInfo?.weight_error) || 0}Kg</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.rightFontsbox}>
|
<View className={styles.rightFontsbox}>
|
||||||
<View className={styles.moneyFlex}>
|
<View className={styles.moneyFlex}>
|
||||||
{
|
{
|
||||||
modeFont === 0 && valueInfo?.last_bulk_price !== valueInfo?.bulk_price && <View className={styles.lastBox}>¥{modeFont === 0 ? formatPriceDiv(valueInfo?.last_bulk_price) : modeFont === 1 ? formatPriceDiv(valueInfo?.last_length_cut_price) : formatPriceDiv(valueInfo?.last_weight_cut_price)} {modeFont as any != 1 ? '/Kg' : '/m'}</View>
|
(modeFont === EnumSaleMode.Bulk) && (valueInfo?.last_bulk_price !== valueInfo?.bulk_price)
|
||||||
|
? <View className={styles.lastBox}>
|
||||||
|
¥{formatPriceDiv(valueInfo?.last_bulk_price)} /Kg
|
||||||
|
</View>
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
<View className={styles.money}>¥{modeFont === 0 ? formatPriceDiv(valueInfo?.bulk_price) : modeFont === 1 ? formatPriceDiv(valueInfo?.length_cut_price) : formatPriceDiv(valueInfo?.weight_cut_price)}{modeFont != 1 ? '/Kg' : '/m'}</View>
|
<View className={styles.money}>¥{modeFont === EnumSaleMode.Bulk ? formatPriceDiv(valueInfo?.bulk_price) : modeFont === EnumSaleMode.Plate ? formatPriceDiv(valueInfo?.length_cut_price) : formatPriceDiv(valueInfo?.weight_cut_price)}{modeFont !== EnumSaleMode.Plate ? '/Kg' : '/m'}</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
valueInfo.showInput
|
valueInfo.showInput
|
||||||
|
|||||||
@ -2,7 +2,12 @@ import { View } from '@tarojs/components'
|
|||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
import style from './index.module.scss'
|
import style from './index.module.scss'
|
||||||
|
|
||||||
const Loading = ({ width = 60, color = '#6190e8' }: { width?: number; color?: string }) => {
|
interface LoadingProps {
|
||||||
|
width?: number
|
||||||
|
color?: string
|
||||||
|
}
|
||||||
|
const Loading = (props: LoadingProps) => {
|
||||||
|
const { width = 60, color = '#6190e8' } = props
|
||||||
const styleObj = useMemo(() => {
|
const styleObj = useMemo(() => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
||||||
|
|||||||
@ -76,12 +76,9 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
color: currentColor;
|
color: currentColor;
|
||||||
.loading {
|
.loading {
|
||||||
position: absolute;
|
display: inline-block;
|
||||||
|
margin-right: 20px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
left: -40px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// active 伪类
|
// active 伪类
|
||||||
|
|||||||
@ -49,6 +49,13 @@ const NormalButton: FC<NormalButtonPropsType> = (props) => {
|
|||||||
return classObject
|
return classObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadingColor = type === 'primary' ? '#fff' : ''
|
||||||
|
let loadingComponent: JSX.Element | null = null
|
||||||
|
if (loading) {
|
||||||
|
loadingComponent = <View className={styles.loading}>
|
||||||
|
<Loading width={30} color={loadingColor} />
|
||||||
|
</View>
|
||||||
|
}
|
||||||
const handleClick = (event) => {
|
const handleClick = (event) => {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return
|
return
|
||||||
@ -59,7 +66,7 @@ const NormalButton: FC<NormalButtonPropsType> = (props) => {
|
|||||||
return (
|
return (
|
||||||
<View className={classnames(styles.button, getClassName(), customClassName)} style={customStyles} onClick={handleClick}>
|
<View className={classnames(styles.button, getClassName(), customClassName)} style={customStyles} onClick={handleClick}>
|
||||||
<View className={classnames(styles['button--text'], customTextClassName)}>
|
<View className={classnames(styles['button--text'], customTextClassName)}>
|
||||||
<View className={styles.loading}>{loading && <Loading width={30} />}</View>
|
{loadingComponent}
|
||||||
{children}</View>
|
{children}</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -95,7 +95,7 @@ const Search = (
|
|||||||
customStyle={{ width: '100%' }}
|
customStyle={{ width: '100%' }}
|
||||||
/>
|
/>
|
||||||
<View className={styles.search_closeBtn}>
|
<View className={styles.search_closeBtn}>
|
||||||
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
|
{!!inputCon && <CloseBtn onClose={clearInput} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
|
||||||
</View>
|
</View>
|
||||||
{showScan && (
|
{showScan && (
|
||||||
<View
|
<View
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
margin-top: 24px;
|
padding-top: 24px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,19 +97,15 @@
|
|||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scrollviewBig {
|
.virtualList {
|
||||||
.scrollview {
|
.kongBox {
|
||||||
// height: 300px;
|
height: 181px;
|
||||||
|
width: 100%;
|
||||||
.kongBox {
|
|
||||||
height: 181px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.kongOne {
|
.kongOne {
|
||||||
height: 200px;
|
height: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading_more {
|
.loading_more {
|
||||||
@ -132,12 +128,63 @@
|
|||||||
|
|
||||||
.noBottom {
|
.noBottom {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
|
||||||
z-index: 999;
|
|
||||||
bottom: env(safe-area-inset-bottom);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.scrllStyle {
|
.popupHeight {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column nowrap;
|
||||||
height: 75vh;
|
height: 75vh;
|
||||||
|
.shopcartBox {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
.virtualListContainer {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 底部按钮
|
||||||
|
.bottomBox {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20px 20px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0px -5px 20px -8px rgba(0, 0, 0, 0.06);
|
||||||
|
display: flex;
|
||||||
|
padding-top: 16px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.leftBottom {
|
||||||
|
width: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.nowFont {
|
||||||
|
font-size: 28px;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selctFont {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
@include common_ellipsis();
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #236aff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightBottom {
|
||||||
|
width: 50%;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
import { ScrollView, View } from '@tarojs/components'
|
import { Button, ScrollView, View } from '@tarojs/components'
|
||||||
import { useDidShow } from '@tarojs/taro'
|
import Taro, { nextTick, useDidShow } from '@tarojs/taro'
|
||||||
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import VirtualList from '@tarojs/components/virtual-list'
|
import VirtualList from '@tarojs/components/virtual-list'
|
||||||
import Divider from '../divider'
|
import Divider from '../divider'
|
||||||
|
import NormalButton from '../normalButton'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import Goods from '@/components/goodsItem'
|
import Goods from '@/components/goodsItem'
|
||||||
import BottomCustomer from '@/components/BottomCustomer'
|
|
||||||
import DotLoading from '@/components/dotLoading'
|
import DotLoading from '@/components/dotLoading'
|
||||||
import { formatDateTime, formatHashTag, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatHashTag, formatMeterMul, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
||||||
|
import { goLink } from '@/common/common'
|
||||||
|
import { EnumSaleMode } from '@/common/Enumerate'
|
||||||
|
|
||||||
interface prosObj {
|
interface prosObj {
|
||||||
showPopup?: false | true
|
showPopup?: false | true
|
||||||
@ -29,7 +31,7 @@ interface prosObj {
|
|||||||
name?: string
|
name?: string
|
||||||
|
|
||||||
}
|
}
|
||||||
modeFont: Number | string
|
modeFont: EnumSaleMode
|
||||||
clientName: string
|
clientName: string
|
||||||
clientId: Number
|
clientId: Number
|
||||||
hasBottom?: true | false // 默认不占位底部
|
hasBottom?: true | false // 默认不占位底部
|
||||||
@ -48,7 +50,7 @@ const ShoppingCart = (props: prosObj, ref) => {
|
|||||||
getSearchData,
|
getSearchData,
|
||||||
handPlus,
|
handPlus,
|
||||||
obj = {},
|
obj = {},
|
||||||
modeFont = 0,
|
modeFont = EnumSaleMode.Bulk,
|
||||||
clientName = '',
|
clientName = '',
|
||||||
clientId = -1,
|
clientId = -1,
|
||||||
handSure,
|
handSure,
|
||||||
@ -125,18 +127,81 @@ const ShoppingCart = (props: prosObj, ref) => {
|
|||||||
}
|
}
|
||||||
const Rows = memo(rows)
|
const Rows = memo(rows)
|
||||||
|
|
||||||
|
const isDisabled = useMemo(() => {
|
||||||
|
return !(selectTotal > 0 && clientName !== '')
|
||||||
|
}, [selectTotal, clientName])
|
||||||
|
|
||||||
|
const navTo = () => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/customerPage/index?clientId=${clientId}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handBuyNow = () => {
|
||||||
|
console.log('goodList', goodList, modeFont)
|
||||||
|
const checkedGoodsKind = goodList.filter(item => item.showInput).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
length: modeFont !== EnumSaleMode.Bulk ? formatMeterMul(item?.nums) : 0,
|
||||||
|
roll: modeFont === EnumSaleMode.Bulk ? item.nums : 0,
|
||||||
|
sale_price: formatPriceDiv(item?.sale_price),
|
||||||
|
}))
|
||||||
|
goLink('/pages/submitOrder/index', {
|
||||||
|
purchaser_id: clientId,
|
||||||
|
sale_mode: modeFont,
|
||||||
|
sale_order_product_color_list: JSON.stringify(checkedGoodsKind),
|
||||||
|
purchaser_name: clientName,
|
||||||
|
isBuyNew: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const [virtualListHeight, setVirtualListHeight] = useState(400)
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
console.log('useEffect')
|
||||||
|
if (showPopup && goodList.length !== 0) {
|
||||||
|
getVirtualListHeight()
|
||||||
|
}
|
||||||
|
}, [showPopup, goodList])
|
||||||
|
|
||||||
|
const getVirtualListHeight = () => {
|
||||||
|
nextTick(() => {
|
||||||
|
const query = Taro.createSelectorQuery()
|
||||||
|
query.select('#virtualListContainer').boundingClientRect((res) => {
|
||||||
|
console.log(res)
|
||||||
|
const virtualListHeight = res.height
|
||||||
|
console.log('setVirtualListHeight res', res)
|
||||||
|
setVirtualListHeight(virtualListHeight)
|
||||||
|
})
|
||||||
|
query.exec()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// useLayoutEffect(() => {
|
||||||
|
// console.log('useLayoutEffect')
|
||||||
|
// if (showPopup) {
|
||||||
|
// const query = Taro.createSelectorQuery()
|
||||||
|
// query.select('#shopCartBox').boundingClientRect()
|
||||||
|
// query.select('#virtualList').boundingClientRect()
|
||||||
|
// query.exec((res) => {
|
||||||
|
// console.log(res)
|
||||||
|
// const shopCartBoxHeight = res[0].height
|
||||||
|
// const virtualListTop = res[1].top
|
||||||
|
// console.log('setVirtualListHeight res', res)
|
||||||
|
// setVirtualListHeight(shopCartBoxHeight - virtualListTop)
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }, [showPopup])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
|
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
|
||||||
<ScrollView className={styles.scrllStyle} scrollY>
|
<View className={styles.popupHeight}>
|
||||||
<View className={styles.shopcartBox}>
|
<View className={styles.shopcartBox} id="shopCartBox">
|
||||||
<View className={styles.topTitle}>
|
<View className={styles.topTitle}>
|
||||||
{formatHashTag(obj?.code, obj?.name)}
|
{formatHashTag(obj?.code, obj?.name)}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.selectFont}>
|
<View className={styles.selectFont}>
|
||||||
已选 1 种面料,{selectTotal} 个颜色,共 {selectNums} {showModefont}
|
已选 1 种面料,{selectTotal} 个颜色,共 {selectNums} {showModefont}
|
||||||
</View>
|
</View>
|
||||||
<Divider direction="horizontal" customStyles={{ margin: '12px 0' }}></Divider>
|
|
||||||
<View className={styles.typeFont}>布料类型</View>
|
|
||||||
<View className={styles.flexType}>
|
<View className={styles.flexType}>
|
||||||
{typeList.map((item, index) => {
|
{typeList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
@ -171,12 +236,12 @@ const ShoppingCart = (props: prosObj, ref) => {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{goodList.length > 0 && (
|
<View id="virtualListContainer" className={styles.virtualListContainer}>
|
||||||
<>
|
{goodList.length > 0 && (
|
||||||
<View className={styles.scrollviewBig}>
|
<>
|
||||||
<VirtualList
|
<VirtualList
|
||||||
className={styles.scrollview}
|
className={styles.virtualList}
|
||||||
height={300} /* 列表的高度 */
|
height={virtualListHeight} /* 列表的高度 */
|
||||||
width="100%" /* 列表的宽度 */
|
width="100%" /* 列表的宽度 */
|
||||||
itemData={goodList} /* 渲染列表的数据 */
|
itemData={goodList} /* 渲染列表的数据 */
|
||||||
itemCount={goodList.length + 0} /* 渲染列表的长度 */
|
itemCount={goodList.length + 0} /* 渲染列表的长度 */
|
||||||
@ -185,31 +250,32 @@ const ShoppingCart = (props: prosObj, ref) => {
|
|||||||
>
|
>
|
||||||
{Rows}
|
{Rows}
|
||||||
</VirtualList>
|
</VirtualList>
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className={styles.kongOne}></View>
|
{/* <View className={styles.kongOne}></View> */}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
</View>
|
||||||
{goodList.length === 0 && (
|
{goodList.length === 0 && (
|
||||||
<View className={styles.loading_more}>
|
<View className={styles.loading_more}>
|
||||||
暂无更多
|
暂无更多
|
||||||
{/* <DotLoading /> */}
|
{/* <DotLoading /> */}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{!hasBottom && <View style={{ height: '100rpx' }}></View>}
|
{/* {!hasBottom && <View style={{ height: '100rpx' }}></View>} */}
|
||||||
{/* <View className={classnames(hasBottom === true ? styles.posBox : styles.noBottom)}> */}
|
|
||||||
<View className={styles.noBottom}>
|
|
||||||
<BottomCustomer
|
|
||||||
clientName={clientName}
|
|
||||||
clientId={clientId}
|
|
||||||
isDisabled={!(selectTotal > 0 && clientName !== '')}
|
|
||||||
handSure={() => {
|
|
||||||
handSure()
|
|
||||||
}}
|
|
||||||
></BottomCustomer>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
<View className={styles.noBottom}>
|
||||||
|
<View className={styles.bottomBox}>
|
||||||
|
<View className={styles.leftBottom} onClick={navTo}>
|
||||||
|
<View className={styles.nowFont}>当前客户:</View>
|
||||||
|
<View className={styles.selctFont}>{clientName === '' ? '请选择客户 >' : `${clientName} >`}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.rightBottom}>
|
||||||
|
<NormalButton round type="primary" disabled={isDisabled} onClick={handBuyNow}>立即购买</NormalButton>
|
||||||
|
<NormalButton round type="primary" disabled={isDisabled} onClick={handSure}>加入购物车</NormalButton>
|
||||||
|
</View>
|
||||||
|
</View >
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Button, Input, Textarea, View } from '@tarojs/components'
|
|||||||
import Taro, { useDidShow } from '@tarojs/taro'
|
import Taro, { useDidShow } from '@tarojs/taro'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import Big from 'big.js'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Form from './components/form'
|
import Form from './components/form'
|
||||||
import {
|
import {
|
||||||
@ -128,7 +129,7 @@ const AddCollection = () => {
|
|||||||
const query = {
|
const query = {
|
||||||
payment_credential_url: picUrl.current,
|
payment_credential_url: picUrl.current,
|
||||||
purchaser_id: Query.purchaser_id,
|
purchaser_id: Query.purchaser_id,
|
||||||
receipt_amount: Number(Query.money) * 100,
|
receipt_amount: parseFloat(new Big(Query.money).times(100)),
|
||||||
receiving_account_id: Query.bankId,
|
receiving_account_id: Query.bankId,
|
||||||
remark: TextareaValue,
|
remark: TextareaValue,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import styles from './index.module.scss'
|
|||||||
import Divider from '@/components/divider'
|
import Divider from '@/components/divider'
|
||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import BottomCustomer from '@/components/BottomCustomer'
|
|
||||||
import DotLoading from '@/components/dotLoading'
|
import DotLoading from '@/components/dotLoading'
|
||||||
import { formatDateTime, formatHashTag, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatHashTag, formatPriceDiv, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '
|
|||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import Remark from '../orderDetails/components/remark'
|
import Remark from '../orderDetails/components/remark'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Form from './components/form'
|
import Form from './components/Form'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import { debounce } from '@/common/util'
|
import { debounce } from '@/common/util'
|
||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
@ -370,7 +370,9 @@ const CustomerEditor = () => {
|
|||||||
<View className={classnames(remarkDesc === '' ? styles.remarkFontactive : styles.remarkFont)}>{remarkDesc === '' ? '尚未备注信息' : remarkDesc}</View>
|
<View className={classnames(remarkDesc === '' ? styles.remarkFontactive : styles.remarkFont)}>{remarkDesc === '' ? '尚未备注信息' : remarkDesc}</View>
|
||||||
</DefaultBoxWithMemo>
|
</DefaultBoxWithMemo>
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} showInput={!!showDesc} />
|
{
|
||||||
|
showDesc && <Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} />
|
||||||
|
}
|
||||||
</Popup>
|
</Popup>
|
||||||
<Address addressOnChange={val => handleSetSite(val)} defaultValue={addressArr} addressOnClose={() => onClose()} show={showSiteModal} />
|
<Address addressOnChange={val => handleSetSite(val)} defaultValue={addressArr} addressOnClose={() => onClose()} show={showSiteModal} />
|
||||||
<View className={styles.safeBox}></View>
|
<View className={styles.safeBox}></View>
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import Remark from '@/pages/orderDetails/components/remark'
|
|||||||
import { SubmitColorCardOrder } from '@/api/colorCard'
|
import { SubmitColorCardOrder } from '@/api/colorCard'
|
||||||
import NavBar from '@/pages/order/components/NavBar'
|
import NavBar from '@/pages/order/components/NavBar'
|
||||||
import { MpPurchaserAddressList } from '@/api/addressList'
|
import { MpPurchaserAddressList } from '@/api/addressList'
|
||||||
|
import { debounce } from '@/common/util'
|
||||||
|
|
||||||
const AddColorCard = () => {
|
const AddColorCard = () => {
|
||||||
// 获取选择的客户
|
// 获取选择的客户
|
||||||
@ -92,9 +93,9 @@ const AddColorCard = () => {
|
|||||||
// Taro.setStorageSync('colorCardCache', JSON.stringify(order))
|
// Taro.setStorageSync('colorCardCache', JSON.stringify(order))
|
||||||
}
|
}
|
||||||
|
|
||||||
const { fetchData } = SubmitColorCardOrder()
|
const { fetchData, state } = SubmitColorCardOrder()
|
||||||
// 提交订单
|
// 提交订单
|
||||||
const handleSubmitOrder = async() => {
|
const handleSubmitOrder = debounce(async() => {
|
||||||
if (!addressInfo.address_id) {
|
if (!addressInfo.address_id) {
|
||||||
return alert.none('请选择地址')
|
return alert.none('请选择地址')
|
||||||
}
|
}
|
||||||
@ -102,6 +103,7 @@ const AddColorCard = () => {
|
|||||||
return alert.none('请选择客户')
|
return alert.none('请选择客户')
|
||||||
}
|
}
|
||||||
if (order.length === 0) { return alert.none('请选择色卡') }
|
if (order.length === 0) { return alert.none('请选择色卡') }
|
||||||
|
|
||||||
// 请求数据
|
// 请求数据
|
||||||
const res = await fetchData({
|
const res = await fetchData({
|
||||||
address_id: addressInfo.address_id,
|
address_id: addressInfo.address_id,
|
||||||
@ -116,11 +118,9 @@ const AddColorCard = () => {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
Taro.removeStorageSync('colorCardCache')
|
Taro.removeStorageSync('colorCardCache')
|
||||||
setTimeout(() => {
|
goLink('/pages/getColorCard/colorCardDetail/index', { id: res.data.id }, 'redirectTo')
|
||||||
goLink('/pages/getColorCard/colorCardDetail/index', { id: res.data.id }, 'redirectTo')
|
|
||||||
}, 2000)
|
|
||||||
}
|
}
|
||||||
}
|
}, 300)
|
||||||
|
|
||||||
const deleteColorCard = (id) => {
|
const deleteColorCard = (id) => {
|
||||||
setOrder((prev) => {
|
setOrder((prev) => {
|
||||||
@ -372,7 +372,9 @@ const AddColorCard = () => {
|
|||||||
<NormalButton
|
<NormalButton
|
||||||
customClassName={styles.bottomBar__button}
|
customClassName={styles.bottomBar__button}
|
||||||
type="primary"
|
type="primary"
|
||||||
|
disabled={state.loading! || state.success!}
|
||||||
round
|
round
|
||||||
|
loading={state.loading!}
|
||||||
onClick={handleSubmitOrder}
|
onClick={handleSubmitOrder}
|
||||||
>
|
>
|
||||||
提交订单
|
提交订单
|
||||||
@ -380,7 +382,9 @@ const AddColorCard = () => {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={getRemark} defaultValue={remark} showInput={!!showDesc} />
|
{
|
||||||
|
showDesc && <Remark onSave={getRemark} defaultValue={remark} />
|
||||||
|
}
|
||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ const BottomApply = (props: prosObj) => {
|
|||||||
|| (obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 2 && goodsObj?.av_return_product?.length)
|
|| (obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 2 && goodsObj?.av_return_product?.length)
|
||||||
|| (obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 3 && goodsObj?.av_return_product?.length)
|
|| (obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 3 && goodsObj?.av_return_product?.length)
|
||||||
|| (obj.sale_mode === 0 && obj.status == 11 && (obj.collect_status == 1 || obj.collect_status == 2) && goodsObj?.av_return_product?.length)
|
|| (obj.sale_mode === 0 && obj.status == 11 && (obj.collect_status == 1 || obj.collect_status == 2) && goodsObj?.av_return_product?.length)
|
||||||
|| (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 0 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
// || (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 0 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
||||||
|| (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 2 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
|| (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 2 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
||||||
|| (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 1 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
|| (obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 1 && goodsObj?.av_return_product?.length && !obj.is_shipper_picks_up)
|
||||||
|| (obj.sale_mode === 1 && obj.status == 0 && goodsObj?.av_return_product?.length)
|
|| (obj.sale_mode === 1 && obj.status == 0 && goodsObj?.av_return_product?.length)
|
||||||
@ -129,7 +129,8 @@ const BottomApply = (props: prosObj) => {
|
|||||||
|| (obj.sale_mode === 2 && obj.status === 0 && obj.collect_status == 0)
|
|| (obj.sale_mode === 2 && obj.status === 0 && obj.collect_status == 0)
|
||||||
|| (obj.sale_mode === 1 && obj.status === 10)
|
|| (obj.sale_mode === 1 && obj.status === 10)
|
||||||
|| (obj.sale_mode === 2 && obj.status === 10)
|
|| (obj.sale_mode === 2 && obj.status === 10)
|
||||||
|| (obj.sale_mode === 0 && obj.status === 13)
|
|| (obj.sale_mode === 0 && obj.status === 13)
|
||||||
|
|| (obj.collect_status == 0)
|
||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,48 +1,62 @@
|
|||||||
.order_popup{
|
.order_popup {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
.order_popup_title{
|
.order_popup_title {
|
||||||
color: $font_size_big;
|
color: $font_size_big;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
.order_popup_input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 25px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 43px;
|
||||||
|
position: relative;
|
||||||
|
.descDataNum {
|
||||||
|
position: absolute;
|
||||||
|
right: 40px;
|
||||||
|
bottom: 10px;
|
||||||
|
height: 39px;
|
||||||
|
font-size: $font_size_medium;
|
||||||
|
color: $color_font_two;
|
||||||
}
|
}
|
||||||
.order_popup_input{
|
|
||||||
width: 100%;
|
textarea {
|
||||||
padding: 0 25px;
|
background-color: #f3f3f3;
|
||||||
box-sizing: border-box;
|
border-radius: 10px;
|
||||||
margin-top: 43px;
|
width: 100%;
|
||||||
position: relative;
|
height: 313px;
|
||||||
.descDataNum{
|
padding: 20px;
|
||||||
position: absolute;
|
padding-bottom: 50px;
|
||||||
right: 40px;
|
box-sizing: border-box;
|
||||||
bottom: 10px;
|
font-size: $font_size;
|
||||||
height: 39px;
|
border: 2px solid #e6e6e6;
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
textarea{
|
|
||||||
background-color: #f3f3f3;
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 100%;
|
|
||||||
height: 313px;
|
|
||||||
padding: 20px;
|
|
||||||
padding-bottom: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $font_size;
|
|
||||||
border: 2px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.order_save_address{
|
}
|
||||||
height: 82px;
|
.recommend_remark {
|
||||||
background: #007aff;
|
margin: 10px 28px;
|
||||||
border-radius: 40px;
|
color: #808080;
|
||||||
width: 668px;
|
font-size: 28px;
|
||||||
text-align: center;
|
}
|
||||||
line-height: 82px;
|
.recommend_remark_content {
|
||||||
color: #fff;
|
margin: 0 20px;
|
||||||
margin-top: 60px;
|
.tag {
|
||||||
|
height: 50px;
|
||||||
|
margin: 0 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.order_save_address {
|
||||||
|
height: 82px;
|
||||||
|
background: #007aff;
|
||||||
|
border-radius: 40px;
|
||||||
|
width: 668px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 82px;
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 60px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -2,14 +2,57 @@ import { Textarea, View } from '@tarojs/components'
|
|||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
|
import Tag from '@/components/tag'
|
||||||
|
|
||||||
interface Param {
|
interface Param {
|
||||||
onBlur?: (val: any) => void
|
onBlur?: (val: any) => void
|
||||||
onSave?: (val: string) => void
|
onSave?: (val: string) => void
|
||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
showInput: boolean
|
|
||||||
}
|
}
|
||||||
const Remark = ({ onBlur, onSave, defaultValue = '', showInput = false }: Param) => {
|
const recommendReport = [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
value: '拿色片',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
value: '顺丰',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
value: '客户自提',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
value: '加急一下',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
value: '物流到',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
value: '中台秀银',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
value: '中台晓茵',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
value: '中台淑婷',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 9,
|
||||||
|
value: '中台结慧',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 10,
|
||||||
|
value: '辛苦了',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const Remark = ({ onBlur, onSave, defaultValue = '' }: Param) => {
|
||||||
const [descData, setDescData] = useState({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
@ -30,16 +73,31 @@ const Remark = ({ onBlur, onSave, defaultValue = '', showInput = false }: Param)
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDesc(defaultValue)
|
getDesc(defaultValue)
|
||||||
}, [defaultValue])
|
}, [defaultValue])
|
||||||
|
|
||||||
|
const onClickTag = (item) => {
|
||||||
|
setDescData(prev => ({
|
||||||
|
...prev,
|
||||||
|
value: prev.value + item.value,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.order_popup}>
|
<View className={styles.order_popup}>
|
||||||
<View className={styles.order_popup_title}>编辑备注</View>
|
<View className={styles.order_popup_title}>编辑备注</View>
|
||||||
{
|
<View className={styles.order_popup_input}>
|
||||||
showInput && <View className={styles.order_popup_input}>
|
<Textarea placeholder="请添加备注" value={descData?.value} maxlength={descData.count} cursorSpacing={100} onInput={e => getDesc(e.detail.value)} onBlur={e => onBlur?.(e)}></Textarea>
|
||||||
<Textarea placeholder="请添加备注" value={descData?.value} maxlength={descData.count} cursorSpacing={100} onInput={e => getDesc(e.detail.value)} onBlur={e => onBlur?.(e)}></Textarea>
|
<View className={styles.descDataNum}>{descData.number}/{descData.count}</View>
|
||||||
<View className={styles.descDataNum}>{descData.number}/{descData.count}</View>
|
</View>
|
||||||
|
<View>
|
||||||
|
<View className={styles.recommend_remark}>推荐备注</View>
|
||||||
|
<View className={styles.recommend_remark_content}>
|
||||||
|
{
|
||||||
|
recommendReport.map((item) => {
|
||||||
|
return <Tag type="info" plain onClick={() => onClickTag(item)} circle customClassName={styles.tag} key={item.id}>{item.value}</Tag>
|
||||||
|
})
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
}
|
</View>
|
||||||
|
|
||||||
<View className={styles.order_save_address} onClick={() => setSave()}>保存</View>
|
<View className={styles.order_save_address} onClick={() => setSave()}>保存</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { formatRemoveHashTag } from '@/common/format'
|
|||||||
import { SubmitCutSampleOrder } from '@/api/sampleCutting'
|
import { SubmitCutSampleOrder } from '@/api/sampleCutting'
|
||||||
import NavBar from '@/pages/order/components/NavBar'
|
import NavBar from '@/pages/order/components/NavBar'
|
||||||
import { MpPurchaserAddressList } from '@/api/addressList'
|
import { MpPurchaserAddressList } from '@/api/addressList'
|
||||||
|
import { debounce } from '@/common/util'
|
||||||
|
|
||||||
const AddColorCard = () => {
|
const AddColorCard = () => {
|
||||||
// 获取选择的客户
|
// 获取选择的客户
|
||||||
@ -87,9 +88,9 @@ const AddColorCard = () => {
|
|||||||
goLink('/pages/sampleCutting/sampleCuttingList/index', { isGoBack: true, isAddSampleCutIdList: order.map(item => item.product_id) })
|
goLink('/pages/sampleCutting/sampleCuttingList/index', { isGoBack: true, isAddSampleCutIdList: order.map(item => item.product_id) })
|
||||||
}
|
}
|
||||||
|
|
||||||
const { fetchData } = SubmitCutSampleOrder()
|
const { fetchData, state } = SubmitCutSampleOrder()
|
||||||
// 提交订单
|
// 提交订单
|
||||||
const handleSubmitOrder = async() => {
|
const handleSubmitOrder = debounce(async() => {
|
||||||
if (!addressInfo.address_id) {
|
if (!addressInfo.address_id) {
|
||||||
return alert.none('请选择地址')
|
return alert.none('请选择地址')
|
||||||
}
|
}
|
||||||
@ -120,11 +121,9 @@ const AddColorCard = () => {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
Taro.removeStorageSync('sampleCuttingCache')
|
Taro.removeStorageSync('sampleCuttingCache')
|
||||||
setTimeout(() => {
|
goLink('/pages/sampleCutting/sampleCuttingDetail/index', { id: res.data.id }, 'redirectTo')
|
||||||
goLink('/pages/sampleCutting/sampleCuttingDetail/index', { id: res.data.id }, 'redirectTo')
|
|
||||||
}, 2000)
|
|
||||||
}
|
}
|
||||||
}
|
}, 300)
|
||||||
|
|
||||||
const labAndImgObj = useCallback((item) => {
|
const labAndImgObj = useCallback((item) => {
|
||||||
return { lab: item?.lab, rgb: item?.rgb, texture_url: item?.texture_url }
|
return { lab: item?.lab, rgb: item?.rgb, texture_url: item?.texture_url }
|
||||||
@ -441,7 +440,9 @@ const AddColorCard = () => {
|
|||||||
<NormalButton
|
<NormalButton
|
||||||
customClassName={styles.bottomBar__button}
|
customClassName={styles.bottomBar__button}
|
||||||
type="primary"
|
type="primary"
|
||||||
|
disabled={state.loading! || state.success!}
|
||||||
round
|
round
|
||||||
|
loading={state.loading!}
|
||||||
onClick={handleSubmitOrder}
|
onClick={handleSubmitOrder}
|
||||||
>
|
>
|
||||||
提交订单
|
提交订单
|
||||||
@ -449,7 +450,9 @@ const AddColorCard = () => {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={getRemark} defaultValue={remark} showInput={!!showDesc} />
|
{
|
||||||
|
showDesc && <Remark onSave={getRemark} defaultValue={remark} />
|
||||||
|
}
|
||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ page {
|
|||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
margin-left: 32px;
|
margin-left: 32px;
|
||||||
margin-right: 32px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
|
|||||||
@ -302,21 +302,19 @@ const SearchPage = () => {
|
|||||||
|
|
||||||
// 输入了搜索关键字
|
// 输入了搜索关键字
|
||||||
const getSearchData = useCallback((e) => {
|
const getSearchData = useCallback((e) => {
|
||||||
if (e) {
|
if (!e) {
|
||||||
setHasFonts(true)
|
|
||||||
getProduct(e)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setHasFonts(false)
|
setHasFonts(false)
|
||||||
setSearchList([])
|
setSearchList([])
|
||||||
}
|
}
|
||||||
|
setdefaultvalue(e)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// 返回
|
// 搜索
|
||||||
const back = () => {
|
const onSearch = () => {
|
||||||
Taro.navigateBack({
|
if (defaultvalue) {
|
||||||
delta: 1,
|
setHasFonts(true)
|
||||||
})
|
getProduct(defaultvalue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 判断是否整数类型
|
// 判断是否整数类型
|
||||||
function isInteger(obj) {
|
function isInteger(obj) {
|
||||||
@ -419,8 +417,7 @@ const SearchPage = () => {
|
|||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
<View className={styles.topBox}>
|
<View className={styles.topBox}>
|
||||||
<Search placeholder="请输入搜索布料" defaultValue={defaultvalue} showBtn={false} changeOnSearch={getSearchData} >
|
<Search placeholder="请输入搜索布料" defaultValue={defaultvalue} showBtn clickOnSearch={onSearch} changeOnSearch={getSearchData} >
|
||||||
<View className={styles.cancelFont} onClick={() => back()}>取消</View>
|
|
||||||
</Search>
|
</Search>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.line}></View>
|
<View className={styles.line}></View>
|
||||||
|
|||||||
@ -167,7 +167,7 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
|||||||
console.log('rerender component ShoppingCartItem', props, props.itemData?.purchaser_name)
|
console.log('rerender component ShoppingCartItem', props, props.itemData?.purchaser_name)
|
||||||
|
|
||||||
const currentItemData = useRef<ShoppingCartData | undefined>(props.itemData)
|
const currentItemData = useRef<ShoppingCartData | undefined>(props.itemData)
|
||||||
// 即使更新 useRef 的数据 不然拿到的还是旧数据
|
// 及时更新 useRef 的数据 不然拿到的还是旧数据
|
||||||
currentItemData.current = props.itemData
|
currentItemData.current = props.itemData
|
||||||
|
|
||||||
const [itemData, setItemData] = usePropsValue({
|
const [itemData, setItemData] = usePropsValue({
|
||||||
@ -254,43 +254,47 @@ const ShoppingCartItem: FC<PropsType> = (props) => {
|
|||||||
|
|
||||||
// 更新当前客户的多选项
|
// 更新当前客户的多选项
|
||||||
const updatePurchaserMultipleSelection = (purchaserId: number, payload: Goods, operationType: OperationType, goodsId: number) => {
|
const updatePurchaserMultipleSelection = (purchaserId: number, payload: Goods, operationType: OperationType, goodsId: number) => {
|
||||||
console.log('delete', colorStore, purchaserId)
|
if (itemData?.purchaser_id === purchaserId) {
|
||||||
if (operationType === 'add') {
|
console.log('updatePurchaserMultipleSelection', colorStore, purchaserId)
|
||||||
const multipleSelection = {
|
if (operationType === 'add') {
|
||||||
...colorStore?.[purchaserId]?.multipleSelection,
|
const multipleSelection = {
|
||||||
[goodsId]: payload,
|
...colorStore?.[purchaserId]?.multipleSelection,
|
||||||
|
[goodsId]: payload,
|
||||||
|
}
|
||||||
|
dispatch({
|
||||||
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
|
data: {
|
||||||
|
purchaserId,
|
||||||
|
multipleSelection,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// 全选标识
|
||||||
|
if (itemData?.[BackEndSaleModeListFieldMap[selected]].length === Object.keys(multipleSelection).length) {
|
||||||
|
dispatch({ type: ShoppingDispatchType.UPDATE_MULTIPLE_SELECTION_STATUS, data: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dispatch({
|
else if (operationType === 'delete') {
|
||||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
const temp = { ...colorStore?.[purchaserId]?.multipleSelection }
|
||||||
data: {
|
delete temp?.[goodsId]
|
||||||
purchaserId,
|
dispatch({
|
||||||
multipleSelection,
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
},
|
data: {
|
||||||
})
|
purchaserId,
|
||||||
// 全选标识
|
multipleSelection: temp,
|
||||||
if (currentItemData.current?.purchaser_id === purchaserId && currentItemData.current?.[BackEndSaleModeListFieldMap[selected]].length === Object.keys(multipleSelection).length) {
|
},
|
||||||
dispatch({ type: ShoppingDispatchType.UPDATE_MULTIPLE_SELECTION_STATUS, data: true })
|
})
|
||||||
|
dispatch({ type: ShoppingDispatchType.UPDATE_MULTIPLE_SELECTION_STATUS, data: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (operationType === 'delete') {
|
|
||||||
const temp = { ...colorStore?.[purchaserId]?.multipleSelection }
|
|
||||||
delete temp?.[goodsId]
|
|
||||||
dispatch({
|
|
||||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
|
||||||
data: {
|
|
||||||
purchaserId,
|
|
||||||
multipleSelection: temp,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
dispatch({ type: ShoppingDispatchType.UPDATE_MULTIPLE_SELECTION_STATUS, data: false })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOtherHighLight = (purchaserId: number) => {
|
const handleOtherHighLight = (purchaserId: number, deletedItemData: any) => {
|
||||||
console.log('handleOtherHighLight', purchaserId, currentCheckedPurchaserId)
|
if (purchaserId === itemData?.purchaser_id) {
|
||||||
if (purchaserId === currentCheckedPurchaserId) {
|
// 当前订单类型还有数据,跳过
|
||||||
|
if (deletedItemData?.[BackEndSaleModeListFieldMap[selected]].length !== 0) { return }
|
||||||
|
// 当前订单类型没有数据,高亮其他订单类型
|
||||||
for (let i = 0; i < BackEndSaleModeListField.length; i++) {
|
for (let i = 0; i < BackEndSaleModeListField.length; i++) {
|
||||||
if (itemData?.[BackEndSaleModeListFieldMap[i]].length !== 0) {
|
if (deletedItemData?.[BackEndSaleModeListFieldMap[i]].length !== 0) {
|
||||||
// 控制高亮
|
// 控制高亮
|
||||||
onSelectOrderType(i)
|
onSelectOrderType(i)
|
||||||
return
|
return
|
||||||
@ -469,17 +473,7 @@ const withStateSlice = (comp, slice: (state: ShoppingStateContextValue, props: P
|
|||||||
console.log('itemData 有变化')
|
console.log('itemData 有变化')
|
||||||
needMemo = false
|
needMemo = false
|
||||||
}
|
}
|
||||||
if (prevProps.itemData.purchaser_name === '皮特织业') {
|
|
||||||
console.log('------withStateSlice props-------')
|
|
||||||
console.log('withStateSlice props prevProps', prevProps)
|
|
||||||
console.log('withStateSlice props prevProps comparison itemData', prevProps.itemData === nextProps.itemData)
|
|
||||||
console.log('withStateSlice props nextProps', nextProps)
|
|
||||||
console.log('withStateSlice props prevProps comparison multipleSelection', prevProps.state.multipleSelection === nextProps.state.multipleSelection)
|
|
||||||
console.log('withStateSlice props prevProps comparison currentCheckedPurchaserId', prevProps.state.currentCheckedPurchaserId === nextProps.state.currentCheckedPurchaserId)
|
|
||||||
console.log('withStateSlice props prevProps comparison Observer', prevProps.state.Observer === nextProps.state.Observer)
|
|
||||||
console.log('withStateSlice props prevProps comparison state', prevProps.state === nextProps.state)
|
|
||||||
console.log('------withStateSlice props-------')
|
|
||||||
}
|
|
||||||
if (prevProps.state.Observer !== nextProps.state.Observer) {
|
if (prevProps.state.Observer !== nextProps.state.Observer) {
|
||||||
console.log('Observer 有变化')
|
console.log('Observer 有变化')
|
||||||
needMemo = false
|
needMemo = false
|
||||||
@ -492,6 +486,18 @@ const withStateSlice = (comp, slice: (state: ShoppingStateContextValue, props: P
|
|||||||
console.log('currentCheckedPurchaserId 有变化')
|
console.log('currentCheckedPurchaserId 有变化')
|
||||||
needMemo = false
|
needMemo = false
|
||||||
}
|
}
|
||||||
|
if (prevProps.itemData.purchaser_name === '孜然烤鱿鱼') {
|
||||||
|
console.log('更新 孜然烤鱿鱼', !needMemo)
|
||||||
|
console.log('------withStateSlice props-------')
|
||||||
|
console.log('withStateSlice props prevProps', prevProps)
|
||||||
|
console.log('withStateSlice props prevProps comparison itemData', prevProps.itemData === nextProps.itemData)
|
||||||
|
console.log('withStateSlice props nextProps', nextProps)
|
||||||
|
console.log('withStateSlice props prevProps comparison multipleSelection', prevProps.state.multipleSelection === nextProps.state.multipleSelection)
|
||||||
|
console.log('withStateSlice props prevProps comparison currentCheckedPurchaserId', prevProps.state.currentCheckedPurchaserId === nextProps.state.currentCheckedPurchaserId)
|
||||||
|
console.log('withStateSlice props prevProps comparison Observer', prevProps.state.Observer === nextProps.state.Observer)
|
||||||
|
console.log('withStateSlice props prevProps comparison state', prevProps.state === nextProps.state)
|
||||||
|
console.log('------withStateSlice props-------')
|
||||||
|
}
|
||||||
return needMemo
|
return needMemo
|
||||||
})
|
})
|
||||||
const Wrapper = (props: PropsType, ref) => {
|
const Wrapper = (props: PropsType, ref) => {
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export interface ShoppingDispatchContextValue {
|
|||||||
[ShoppingDispatchType.UPDATE_CURRENT_CHECKED_SALEMODE]: (saleMode: ShoppingStateContextValue['currentCheckedSaleMode']) => void
|
[ShoppingDispatchType.UPDATE_CURRENT_CHECKED_SALEMODE]: (saleMode: ShoppingStateContextValue['currentCheckedSaleMode']) => void
|
||||||
[ShoppingDispatchType.UPDATE_COLOR_STORE]: (colorStore: React.SetStateAction<ColorStore>) => void
|
[ShoppingDispatchType.UPDATE_COLOR_STORE]: (colorStore: React.SetStateAction<ColorStore>) => void
|
||||||
[ShoppingDispatchType.UPDATE_SELECTED_AMOUNT]: (amount: React.SetStateAction<ShoppingStateContextValue['selectedAmount']>) => void
|
[ShoppingDispatchType.UPDATE_SELECTED_AMOUNT]: (amount: React.SetStateAction<ShoppingStateContextValue['selectedAmount']>) => void
|
||||||
[ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX]: (amount: React.SetStateAction<ShoppingStateContextValue['selectedAmount']>) => void
|
[ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX]: (amount: React.SetStateAction<GoodsMeta>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShoppingAction {
|
export interface ShoppingAction {
|
||||||
|
|||||||
@ -13,11 +13,12 @@ import { ShoppingDispatchType, useShoppingDispatch, useShoppingState } from './c
|
|||||||
import { events } from './context/shoppingStore'
|
import { events } from './context/shoppingStore'
|
||||||
import { dataLoadingStatus, debounce, getFilterData } from '@/common/util'
|
import { dataLoadingStatus, debounce, getFilterData } from '@/common/util'
|
||||||
import { ShoppingCartDeleteApi, ShoppingCartListApi } from '@/api/index'
|
import { ShoppingCartDeleteApi, ShoppingCartListApi } from '@/api/index'
|
||||||
import { formatPriceDiv } from '@/common/format'
|
import { formatMeterDiv, formatPriceDiv } from '@/common/format'
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import IconText from '@/components/iconText'
|
import IconText from '@/components/iconText'
|
||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import { alert, goLink, isEmptyObject } from '@/common/common'
|
import { alert, goLink, isEmptyObject } from '@/common/common'
|
||||||
|
import { EnumSaleMode } from '@/common/Enumerate'
|
||||||
|
|
||||||
interface SearchOptions {
|
interface SearchOptions {
|
||||||
short_name_or_phone?: string
|
short_name_or_phone?: string
|
||||||
@ -39,26 +40,75 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const listHeightRef = useRef('auto')
|
const listHeightRef = useRef('auto')
|
||||||
// 强制刷新
|
|
||||||
const [, setForceUpdate] = useState({})
|
|
||||||
|
|
||||||
const { fetchData, state } = ShoppingCartListApi()
|
const { fetchData, state } = ShoppingCartListApi()
|
||||||
|
|
||||||
const [searchOptions, setSearchOptions] = useState<SearchOptions>({})
|
const [searchOptions, setSearchOptions] = useState<SearchOptions>({})
|
||||||
|
const clearMultiSelection = () => {
|
||||||
|
console.log('clearMultiSelection', shoppingCartData?.list)
|
||||||
|
const target = shoppingCartData?.list?.find(item => item.purchaser_id === currentCheckedPurchaserId)
|
||||||
|
console.log('BackEndSaleModeListFieldMap', BackEndSaleModeListFieldMap[currentCheckedSaleMode], target)
|
||||||
|
const newGoodsKind = Object.fromEntries(
|
||||||
|
target?.[BackEndSaleModeListFieldMap[currentCheckedSaleMode]].map(item => [
|
||||||
|
item?.id,
|
||||||
|
{
|
||||||
|
id: item?.id,
|
||||||
|
estimate_amount: item.estimate_amount,
|
||||||
|
product_code: item.product_code,
|
||||||
|
product_color_code: item.product_color_code,
|
||||||
|
sale_mode: item.sale_mode,
|
||||||
|
count: currentCheckedSaleMode === EnumSaleMode.Bulk ? item.roll : Number(formatMeterDiv(item.length)),
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
const prevMultipleSelection = colorStore?.[currentCheckedPurchaserId]?.multipleSelection
|
||||||
|
console.log('clearMultiSelection', prevMultipleSelection)
|
||||||
|
const nextMultipleSelection = prevMultipleSelection
|
||||||
|
? Object.fromEntries(
|
||||||
|
Object.values(prevMultipleSelection).filter(value => !Object.keys(newGoodsKind).includes(String(value.id)))
|
||||||
|
.map(value => [
|
||||||
|
value.id,
|
||||||
|
{
|
||||||
|
id: value.id,
|
||||||
|
estimate_amount: value.estimate_amount,
|
||||||
|
product_code: value.product_code,
|
||||||
|
product_color_code: value.product_color_code,
|
||||||
|
sale_mode: value.sale_mode,
|
||||||
|
count: value.count,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
))
|
||||||
|
: {}
|
||||||
|
console.log('nextMultipleSelection', nextMultipleSelection)
|
||||||
|
// 清空多选
|
||||||
|
dispatch({
|
||||||
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
|
data: {
|
||||||
|
purchaserId: currentCheckedPurchaserId,
|
||||||
|
goodsKind: newGoodsKind,
|
||||||
|
multipleSelection: nextMultipleSelection,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
useDidShow(() => {
|
const getData = async() => {
|
||||||
|
await fetchData(getFilterData(searchOptions))
|
||||||
|
clearMultiSelection()
|
||||||
|
}
|
||||||
|
|
||||||
|
useDidShow(async() => {
|
||||||
// 第二次进入该页面时触发
|
// 第二次进入该页面时触发
|
||||||
if (!isFirst.current) {
|
if (!isFirst.current) {
|
||||||
|
console.log('重新刷新')
|
||||||
// 重新刷新
|
// 重新刷新
|
||||||
// setShoppingCartData({ list: [], total: 0 })
|
getData()
|
||||||
fetchData(getFilterData(searchOptions))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('useEffect fetchData', getFilterData(searchOptions))
|
console.log('useEffect fetchData', getFilterData(searchOptions))
|
||||||
if (!isFirst.current) {
|
if (!isFirst.current) {
|
||||||
fetchData(getFilterData(searchOptions))
|
getData()
|
||||||
}
|
}
|
||||||
}, [searchOptions])
|
}, [searchOptions])
|
||||||
|
|
||||||
@ -91,21 +141,6 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
console.log('useLayoutEffect')
|
console.log('useLayoutEffect')
|
||||||
await fetchData(getFilterData(searchOptions))
|
await fetchData(getFilterData(searchOptions))
|
||||||
isFirst.current = false
|
isFirst.current = false
|
||||||
// const query = Taro.createSelectorQuery()
|
|
||||||
// console.log('query', query)
|
|
||||||
// query.select('#shoppingContainer').boundingClientRect()
|
|
||||||
// query.select('#topBar').boundingClientRect()
|
|
||||||
// query.select('#bottomBar').boundingClientRect()
|
|
||||||
// query.exec((res) => {
|
|
||||||
// console.log('res==>', res)
|
|
||||||
// const containerHeight = res[0].height
|
|
||||||
// const topBarHeight = res[1].height
|
|
||||||
// const bottomBarHeight = res[2].height
|
|
||||||
// const listHeight = containerHeight - topBarHeight - bottomBarHeight
|
|
||||||
// listHeightRef.current = `${listHeight}px`
|
|
||||||
// // 强制刷新
|
|
||||||
// setForceUpdate({})
|
|
||||||
// })
|
|
||||||
})()
|
})()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -129,6 +164,7 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
sale_mode: currentCheckedSaleMode,
|
sale_mode: currentCheckedSaleMode,
|
||||||
shopping_cart_product_color_list: JSON.stringify(checkedGoodsKind),
|
shopping_cart_product_color_list: JSON.stringify(checkedGoodsKind),
|
||||||
purchaser_name: shoppingCartData?.list.find(item => item.purchaser_id === currentCheckedPurchaserId)?.purchaser_name,
|
purchaser_name: shoppingCartData?.list.find(item => item.purchaser_id === currentCheckedPurchaserId)?.purchaser_name,
|
||||||
|
isBuyNew: false,
|
||||||
})
|
})
|
||||||
}, 400)
|
}, 400)
|
||||||
|
|
||||||
@ -147,23 +183,44 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
async success(res) {
|
async success(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
alert.showLoading('删除中')
|
alert.showLoading('删除中')
|
||||||
|
const checkedIds = checked.map(item => item.id)
|
||||||
const res = await deleteApi({
|
const res = await deleteApi({
|
||||||
ids: checked.map(item => item.id).join(','),
|
ids: checkedIds.join(','),
|
||||||
})
|
})
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
alert.hideLoading()
|
alert.hideLoading()
|
||||||
alert.success('删除成功')
|
alert.success('删除成功')
|
||||||
|
console.log('colorStore?.[currentCheckedPurchaserId]', colorStore?.[currentCheckedPurchaserId])
|
||||||
|
let goodsKind = colorStore?.[currentCheckedPurchaserId].goodsKind
|
||||||
|
if (goodsKind) {
|
||||||
|
goodsKind = Object.fromEntries(
|
||||||
|
Object.values(goodsKind).filter(value => !checkedIds.includes(value.id))
|
||||||
|
.map(value => [
|
||||||
|
value.id,
|
||||||
|
{
|
||||||
|
id: value.id,
|
||||||
|
estimate_amount: value.estimate_amount,
|
||||||
|
product_code: value.product_code,
|
||||||
|
product_color_code: value.product_color_code,
|
||||||
|
sale_mode: value.sale_mode,
|
||||||
|
count: value.count,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
))
|
||||||
|
}
|
||||||
|
console.log('goodsKind', goodsKind)
|
||||||
// 清空多选
|
// 清空多选
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
data: {
|
data: {
|
||||||
purchaserId: currentCheckedPurchaserId,
|
purchaserId: currentCheckedPurchaserId,
|
||||||
goodsKind: colorStore?.[currentCheckedPurchaserId].goodsKind,
|
goodsKind,
|
||||||
multipleSelection: {},
|
multipleSelection: {},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
fetchData(searchOptions)
|
const deleted = await fetchData(searchOptions)
|
||||||
events.trigger('handleOtherHighLight', currentCheckedPurchaserId)
|
|
||||||
|
events.trigger('handleOtherHighLight', currentCheckedPurchaserId, deleted.data.list.find(item => item.purchaser_id === currentCheckedPurchaserId))
|
||||||
// Observer.notify(currentCheckedPurchaserId)
|
// Observer.notify(currentCheckedPurchaserId)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -176,10 +233,24 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
}
|
}
|
||||||
// 全选
|
// 全选
|
||||||
const handleSelectAllCheckbox = (isSelectAll: boolean) => {
|
const handleSelectAllCheckbox = (isSelectAll: boolean) => {
|
||||||
const targetGoodsKind = colorStore?.[currentCheckedPurchaserId].goodsKind
|
if (!currentCheckedPurchaserId) { return alert.error('请先选择客户') }
|
||||||
if (!targetGoodsKind) { return alert.error('请先选择客户') }
|
|
||||||
|
|
||||||
const tempObject = { ...targetGoodsKind }
|
const targetGoodsKind = shoppingCartData.list.find(item => item.purchaser_id === currentCheckedPurchaserId)?.[BackEndSaleModeListFieldMap[currentCheckedSaleMode]]
|
||||||
|
|
||||||
|
const tempObject: Record<Goods['id'], Goods> = Object.fromEntries(
|
||||||
|
targetGoodsKind.map(item => [
|
||||||
|
item?.id,
|
||||||
|
{
|
||||||
|
id: item?.id,
|
||||||
|
estimate_amount: item.estimate_amount,
|
||||||
|
product_code: item.product_code,
|
||||||
|
product_color_code: item.product_color_code,
|
||||||
|
sale_mode: item.sale_mode,
|
||||||
|
count: currentCheckedSaleMode === EnumSaleMode.Bulk ? item.roll : Number(formatMeterDiv(item.length)),
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
console.log('handleSelectAllCheckbox', tempObject)
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
type: ShoppingDispatchType.UPDATE_CHANGED_CHECKBOX,
|
||||||
data: {
|
data: {
|
||||||
@ -197,6 +268,7 @@ const ShoppingCartContainer: FC = () => {
|
|||||||
setRefreshStatus(true)
|
setRefreshStatus(true)
|
||||||
const res = await fetchData(getFilterData(searchOptions))
|
const res = await fetchData(getFilterData(searchOptions))
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
clearMultiSelection()
|
||||||
setRefreshStatus(false)
|
setRefreshStatus(false)
|
||||||
alert.success('刷新成功')
|
alert.success('刷新成功')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
|
import type { CommonEvent } from '@tarojs/components'
|
||||||
import { Input, Text, View } from '@tarojs/components'
|
import { Input, Text, View } from '@tarojs/components'
|
||||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
|
import Taro, { useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
|
||||||
|
import Big from 'big.js'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
@ -12,6 +14,8 @@ import { UseSubscriptionMessage } from '@/use/useCommon'
|
|||||||
import {
|
import {
|
||||||
MpSaleOrderPost,
|
MpSaleOrderPost,
|
||||||
MpSaleOrderPreview,
|
MpSaleOrderPreview,
|
||||||
|
SaleOrderPreViewBuyNow,
|
||||||
|
SaleOrderSubmitBuyNow,
|
||||||
} from '@/api/order'
|
} from '@/api/order'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import { formatDateTime, formatMeterDiv, formatPriceDiv, formatPriceMul, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatMeterDiv, formatPriceDiv, formatPriceMul, formatRemoveHashTag, formatWeightDiv } from '@/common/format'
|
||||||
@ -24,6 +28,13 @@ import LayoutBlock from '@/components/layoutBlock'
|
|||||||
import IconText from '@/components/iconText'
|
import IconText from '@/components/iconText'
|
||||||
import Dialog from '@/components/Dialog'
|
import Dialog from '@/components/Dialog'
|
||||||
import InputX from '@/components/InputX'
|
import InputX from '@/components/InputX'
|
||||||
|
|
||||||
|
interface ExtendEvent {
|
||||||
|
target: {
|
||||||
|
value: string | number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 卡片盒子元素
|
// 卡片盒子元素
|
||||||
interface Obs {
|
interface Obs {
|
||||||
title?: string
|
title?: string
|
||||||
@ -63,10 +74,10 @@ interface PropGoods {
|
|||||||
obj: {
|
obj: {
|
||||||
sale_mode?: number | string
|
sale_mode?: number | string
|
||||||
}
|
}
|
||||||
updateList: (list: any[]) => void
|
updateData: (data: Record<string, any>) => void
|
||||||
}
|
}
|
||||||
const GoodsItem = (props: PropGoods) => {
|
const GoodsItem = (props: PropGoods) => {
|
||||||
const { list = [], obj = {}, updateList } = props
|
const { list = [], obj = {}, updateData } = props
|
||||||
|
|
||||||
const [goodsList, setGoodsList] = useState(list)
|
const [goodsList, setGoodsList] = useState(list)
|
||||||
|
|
||||||
@ -114,6 +125,19 @@ const GoodsItem = (props: PropGoods) => {
|
|||||||
item.product_colors = item.product_colors.map((it) => {
|
item.product_colors = item.product_colors.map((it) => {
|
||||||
if (it.id === editPayload.current[0]) {
|
if (it.id === editPayload.current[0]) {
|
||||||
it.sale_price = it.origin_price + formatPriceMul(value)
|
it.sale_price = it.origin_price + formatPriceMul(value)
|
||||||
|
if (obj?.sale_mode === EnumSaleMode.Bulk) {
|
||||||
|
// 计算金额
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatWeightDiv(it.estimate_weight) * it.roll)
|
||||||
|
}
|
||||||
|
else if (obj?.sale_mode === EnumSaleMode.Plate) {
|
||||||
|
// 剪板
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatMeterDiv(it.length))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 散剪
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatMeterDiv(it.length) / formatMeterDiv(it.length_to_weight_rate)).toFixed(0)
|
||||||
|
console.log('estimate_amount', it.estimate_amount, formatPriceDiv(it.estimate_amount, 100, true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return it
|
return it
|
||||||
})
|
})
|
||||||
@ -122,7 +146,11 @@ const GoodsItem = (props: PropGoods) => {
|
|||||||
})
|
})
|
||||||
setGoodsList(res)
|
setGoodsList(res)
|
||||||
handleCancel()
|
handleCancel()
|
||||||
updateList(res)
|
updateData({
|
||||||
|
product_list: res,
|
||||||
|
// 计算总金额
|
||||||
|
estimate_amount: res.reduce((acc, cur) => acc + cur.product_colors.reduce((a, c) => a + c.estimate_amount, 0), 0),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量调整点击确认
|
// 批量调整点击确认
|
||||||
@ -132,6 +160,18 @@ const GoodsItem = (props: PropGoods) => {
|
|||||||
if (item.id === editPayload.current[0]) {
|
if (item.id === editPayload.current[0]) {
|
||||||
item.product_colors = item.product_colors.map((it) => {
|
item.product_colors = item.product_colors.map((it) => {
|
||||||
it.sale_price = it.origin_price + formatPriceMul(value)
|
it.sale_price = it.origin_price + formatPriceMul(value)
|
||||||
|
if (obj?.sale_mode === EnumSaleMode.Bulk) {
|
||||||
|
// 计算金额
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatWeightDiv(it.estimate_weight) * it.roll)
|
||||||
|
}
|
||||||
|
else if (obj?.sale_mode === EnumSaleMode.Plate) {
|
||||||
|
// 剪板
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatMeterDiv(it.length))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 散剪
|
||||||
|
it.estimate_amount = formatPriceMul(Number(formatPriceDiv(it.sale_price)) * formatMeterDiv(it.length) / formatMeterDiv(it.length_to_weight_rate))
|
||||||
|
}
|
||||||
return it
|
return it
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -139,20 +179,30 @@ const GoodsItem = (props: PropGoods) => {
|
|||||||
})
|
})
|
||||||
setGoodsList(res)
|
setGoodsList(res)
|
||||||
handleCancel()
|
handleCancel()
|
||||||
updateList(res)
|
updateData({
|
||||||
|
product_list: res,
|
||||||
|
// 计算总金额
|
||||||
|
estimate_amount: res.reduce((acc, cur) => acc + cur.product_colors.reduce((a, c) => a + c.estimate_amount, 0), 0),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// 批量调整
|
// 批量调整
|
||||||
|
const defaultValue = '-1.5'
|
||||||
// 单价调整
|
// 单价调整
|
||||||
const [value, setValue] = useState('-1.5')
|
const [value, setValue] = useState(defaultValue)
|
||||||
|
|
||||||
const handleInput = (e) => {
|
const handleInput = (e: CommonEvent & ExtendEvent) => {
|
||||||
const res = e.detail.value
|
const res = e.detail.value
|
||||||
setValue(res)
|
setValue(res)
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorMsg = useMemo(() => {
|
const errorMsg = useMemo(() => {
|
||||||
let msg = ''
|
let msg = ''
|
||||||
if (Number(value) < -3) {
|
console.log('errorMsg', value)
|
||||||
|
if (/[a-zA-Z]/.test(value) || Number.isNaN(Number(value))) {
|
||||||
|
msg = '请填写数字'
|
||||||
|
}
|
||||||
|
else if (Number(value) < -3) {
|
||||||
msg = '不能小于-3'
|
msg = '不能小于-3'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -185,13 +235,31 @@ const GoodsItem = (props: PropGoods) => {
|
|||||||
<View>
|
<View>
|
||||||
<View className={styles.item_right_top}>
|
<View className={styles.item_right_top}>
|
||||||
<View className={styles.itemName}>{formatRemoveHashTag(it.code)}# {it.name}</View>
|
<View className={styles.itemName}>{formatRemoveHashTag(it.code)}# {it.name}</View>
|
||||||
<View className={styles.itemNums}>x{obj?.sale_mode === EnumSaleMode.Bulk ? it.roll : formatMeterDiv(it.length)}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
<View className={styles.itemNums}>x{obj?.sale_mode === EnumSaleMode.Bulk ? it.roll : formatMeterDiv(it.length)}{obj?.sale_mode === 0 ? '条' : '米'}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.item_right_Bottom}>
|
<View className={styles.item_right_Bottom}>
|
||||||
<View className={styles.flexBox}>
|
<View className={styles.flexBox}>
|
||||||
<View className={styles.itemMoney}>¥{formatPriceDiv(it.sale_price)}/{obj?.sale_mode === EnumSaleMode.Plate ? 'm' : 'kg'}</View>
|
<View className={styles.itemMoney}>¥{formatPriceDiv(it.sale_price, 100, true)}/{obj?.sale_mode === EnumSaleMode.Plate ? 'm' : 'kg'}</View>
|
||||||
{
|
{
|
||||||
(obj?.sale_mode === EnumSaleMode.Bulk && it?.sale_price !== it?.standard_price) ? <View className={styles.lastBox}>¥{formatPriceDiv(it?.standard_price)}/kg</View> : null
|
(obj?.sale_mode === EnumSaleMode.Bulk && it?.sale_price !== it?.standard_price)
|
||||||
|
? <View className={styles.lastBox}>
|
||||||
|
¥{formatPriceDiv(it?.standard_price, 100, true)}/kg
|
||||||
|
</View>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(obj?.sale_mode === EnumSaleMode.Plate && it?.sale_price !== it?.standard_price)
|
||||||
|
? <View className={styles.lastBox}>
|
||||||
|
¥{formatPriceDiv(it?.standard_price, 100, true)}/m
|
||||||
|
</View>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(obj?.sale_mode === EnumSaleMode.BulkCut && it?.sale_price !== it?.standard_price)
|
||||||
|
? <View className={styles.lastBox}>
|
||||||
|
¥{formatPriceDiv(it?.standard_price, 100, true)}/kg
|
||||||
|
</View>
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
<View onClick={() => handleEdit(it.id, item.id)}>
|
<View onClick={() => handleEdit(it.id, item.id)}>
|
||||||
<IconFont name="icon-bianji1" color="#3d85ff"></IconFont>
|
<IconFont name="icon-bianji1" color="#3d85ff"></IconFont>
|
||||||
@ -261,6 +329,8 @@ const SubmitOrder = () => {
|
|||||||
const [infoObj, setInfoObj] = useState<any>({})
|
const [infoObj, setInfoObj] = useState<any>({})
|
||||||
let selectId = -1
|
let selectId = -1
|
||||||
|
|
||||||
|
const isBuyNew = useRef(false)
|
||||||
|
|
||||||
// 收货方法,1:自提,2物流
|
// 收货方法,1:自提,2物流
|
||||||
const [receivingStatus, setReceivingStatus] = useState<any>(null)
|
const [receivingStatus, setReceivingStatus] = useState<any>(null)
|
||||||
// 切换自提或者物流
|
// 切换自提或者物流
|
||||||
@ -300,7 +370,7 @@ const SubmitOrder = () => {
|
|||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
const getDetail = async() => {
|
const getDetail = async() => {
|
||||||
let arr: any[] = []
|
let arr: any[] = []
|
||||||
setPusername(decodeURIComponent(router.params.purchaser_name))
|
console.log('purchaser_name', router.params.purchaser_name)
|
||||||
arr = JSON.parse(decodeURIComponent(router.params.shopping_cart_product_color_list))
|
arr = JSON.parse(decodeURIComponent(router.params.shopping_cart_product_color_list))
|
||||||
const list: any[] = []
|
const list: any[] = []
|
||||||
arr?.forEach((item) => {
|
arr?.forEach((item) => {
|
||||||
@ -328,6 +398,40 @@ const SubmitOrder = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { fetchData } = SaleOrderPreViewBuyNow()
|
||||||
|
// 立即购买
|
||||||
|
const getOnceDetail = async() => {
|
||||||
|
const sale_order_product_color_list = JSON.parse(router?.params?.sale_order_product_color_list as string) || []
|
||||||
|
if (sale_order_product_color_list?.length > 0) {
|
||||||
|
const arr: any[] = []
|
||||||
|
const sale_mode = Number(router?.params.sale_mode)
|
||||||
|
sale_order_product_color_list.forEach((item) => {
|
||||||
|
arr.push({
|
||||||
|
length: item?.length || 0,
|
||||||
|
roll: item.roll,
|
||||||
|
product_color_id: item.id,
|
||||||
|
sale_price: sale_mode === EnumSaleMode.Bulk ? item.bulk_price : sale_mode === EnumSaleMode.Plate ? item.length_cut_price : item.weight_cut_price,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const res = await fetchData({
|
||||||
|
sale_mode,
|
||||||
|
sale_order_product_color_list: arr,
|
||||||
|
purchaser_id: Number(router?.params.purchaser_id),
|
||||||
|
})
|
||||||
|
setInfoObj({
|
||||||
|
...res.data,
|
||||||
|
product_list: res.data.product_list?.map((item) => {
|
||||||
|
item.product_colors = item.product_colors.map((it) => {
|
||||||
|
// 用于存储原始价格,(单价/批量)调整价格
|
||||||
|
it.origin_price = it.sale_price
|
||||||
|
return it
|
||||||
|
})
|
||||||
|
return item
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 备注操作
|
// 备注操作
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
const getRemark = useCallback(async(e) => {
|
const getRemark = useCallback(async(e) => {
|
||||||
@ -345,19 +449,34 @@ const SubmitOrder = () => {
|
|||||||
|
|
||||||
// 提交订单
|
// 提交订单
|
||||||
const { fetchData: postFetch } = MpSaleOrderPost()
|
const { fetchData: postFetch } = MpSaleOrderPost()
|
||||||
|
const { fetchData: postOnceFetch } = SaleOrderSubmitBuyNow()
|
||||||
const handSure = () => {
|
const handSure = () => {
|
||||||
if (receivingStatus == 2 && !infoObj.address_id) {
|
if (receivingStatus == 2 && !infoObj.address_id) {
|
||||||
return alert.error('请选择地址')
|
return alert.error('请选择地址')
|
||||||
}
|
}
|
||||||
const list: any[] = []
|
const list: any[] = []
|
||||||
infoObj.product_list.forEach((item) => {
|
if (!isBuyNew.current) {
|
||||||
item.product_colors.forEach((it) => {
|
infoObj.product_list.forEach((item) => {
|
||||||
list.push({
|
item.product_colors.forEach((it) => {
|
||||||
sale_price: it.sale_price,
|
list.push({
|
||||||
shopping_cart_product_color_id: Number(it.id),
|
sale_price: it.sale_price,
|
||||||
|
shopping_cart_product_color_id: Number(it.id),
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
else {
|
||||||
|
infoObj.product_list.forEach((item) => {
|
||||||
|
item.product_colors.forEach((it) => {
|
||||||
|
list.push({
|
||||||
|
length: it.length,
|
||||||
|
roll: it.roll,
|
||||||
|
sale_price: it.sale_price,
|
||||||
|
product_color_id: Number(it.id),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
const query = {
|
const query = {
|
||||||
address_id: Number(infoObj.address_id) ? Number(infoObj.address_id) : 0,
|
address_id: Number(infoObj.address_id) ? Number(infoObj.address_id) : 0,
|
||||||
list,
|
list,
|
||||||
@ -378,7 +497,13 @@ const SubmitOrder = () => {
|
|||||||
title: '请稍等...',
|
title: '请稍等...',
|
||||||
mask: true,
|
mask: true,
|
||||||
})
|
})
|
||||||
const res = await postFetch(query)
|
let res
|
||||||
|
if (isBuyNew.current) {
|
||||||
|
res = await postOnceFetch(query)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res = await postFetch(query)
|
||||||
|
}
|
||||||
if (res?.msg === 'success') {
|
if (res?.msg === 'success') {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '成功',
|
title: '成功',
|
||||||
@ -448,13 +573,22 @@ const SubmitOrder = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getAddress()
|
getAddress()
|
||||||
getDetail()
|
console.log('isBuyNew', router.params.isBuyNew)
|
||||||
|
setPusername(decodeURIComponent(router.params.purchaser_name))
|
||||||
|
isBuyNew.current = JSON.parse(router.params.isBuyNew)
|
||||||
|
// 判断立即购买
|
||||||
|
if (isBuyNew.current) {
|
||||||
|
getOnceDetail()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getDetail()
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const updateList = (list: any[]) => {
|
const updateData = (data: Record<string, any>) => {
|
||||||
setInfoObj(val => ({
|
setInfoObj(val => ({
|
||||||
...val,
|
...val,
|
||||||
product_list: list,
|
...data,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +612,7 @@ const SubmitOrder = () => {
|
|||||||
</View>
|
</View>
|
||||||
</DefaultBoxWithMemo>
|
</DefaultBoxWithMemo>
|
||||||
<View className={styles.productBox}>
|
<View className={styles.productBox}>
|
||||||
<GoodsItemWithMemo list={infoObj?.product_list} obj={infoObj} updateList={updateList}></GoodsItemWithMemo>
|
<GoodsItemWithMemo list={infoObj?.product_list} obj={infoObj} updateData={updateData} ></GoodsItemWithMemo>
|
||||||
<View className={styles.flexMoney}>
|
<View className={styles.flexMoney}>
|
||||||
<View className={styles.flexTotalBox}>
|
<View className={styles.flexTotalBox}>
|
||||||
<View className={styles.totalFont}>合计金额</View>
|
<View className={styles.totalFont}>合计金额</View>
|
||||||
@ -499,11 +633,13 @@ const SubmitOrder = () => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.bottomFlex}>{infoObj.product_list?.length} 种面料,{infoObj.total_colors} 种颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View>
|
<View className={styles.bottomFlex}>{infoObj.product_list?.length} 种面料,{infoObj.total_colors} 种颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.rightBottom} onClick={() => handSure()}>提交订单</View>
|
<View className={styles.rightBottom} onClick={handSure}>提交订单</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={e => getRemark(e)} defaultValue={infoObj.remark} showInput={!!showDesc} />
|
{
|
||||||
|
showDesc && <Remark onSave={e => getRemark(e)} defaultValue={infoObj.remark} />
|
||||||
|
}
|
||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,48 +1,48 @@
|
|||||||
.order_popup{
|
.order_popup {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
.order_popup_title{
|
.order_popup_title {
|
||||||
color: $font_size_big;
|
color: $font_size_big;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
.order_popup_input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 25px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 43px;
|
||||||
|
position: relative;
|
||||||
|
.descDataNum {
|
||||||
|
position: absolute;
|
||||||
|
right: 40px;
|
||||||
|
bottom: 10px;
|
||||||
|
height: 39px;
|
||||||
|
font-size: $font_size_medium;
|
||||||
|
color: $color_font_two;
|
||||||
}
|
}
|
||||||
.order_popup_input{
|
textarea {
|
||||||
width: 100%;
|
background-color: white;
|
||||||
padding: 0 25px;
|
border-radius: 10px;
|
||||||
box-sizing: border-box;
|
width: 100%;
|
||||||
margin-top: 43px;
|
height: 313px;
|
||||||
position: relative;
|
padding: 20px;
|
||||||
.descDataNum{
|
padding-bottom: 50px;
|
||||||
position: absolute;
|
box-sizing: border-box;
|
||||||
right: 40px;
|
font-size: $font_size;
|
||||||
bottom: 10px;
|
border: 2px solid #e6e6e6;
|
||||||
height: 39px;
|
|
||||||
font-size: $font_size_medium;
|
|
||||||
color: $color_font_two;
|
|
||||||
}
|
|
||||||
textarea{
|
|
||||||
background-color: #f3f3f3;
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 100%;
|
|
||||||
height: 313px;
|
|
||||||
padding: 20px;
|
|
||||||
padding-bottom: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $font_size;
|
|
||||||
border: 2px solid #e6e6e6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.order_save_address{
|
|
||||||
height: 82px;
|
|
||||||
background: #007aff;
|
|
||||||
border-radius: 40px;
|
|
||||||
width: 668px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 82px;
|
|
||||||
color: #fff;
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.order_save_address {
|
||||||
|
height: 82px;
|
||||||
|
background: #007aff;
|
||||||
|
border-radius: 40px;
|
||||||
|
width: 668px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 82px;
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 60px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user