🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,193 +1,193 @@
|
||||
|
||||
import { ScrollView, View, Image } from '@tarojs/components'
|
||||
import { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
import BottomBtns from '@/components/BottomBtns'
|
||||
import { formatPriceDiv, formatImgUrl } from '@/common/format'
|
||||
import { Image, ScrollView, View } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import BottomBtns from '@/components/BottomBtns'
|
||||
import { formatImgUrl, formatPriceDiv } from '@/common/format'
|
||||
import Popup from '@/components/popup'
|
||||
import useCheckAuthorize from '@/use/useCheckAuthorize'
|
||||
import { alert } from '@/common/common'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
interface Props {
|
||||
showPopup: true | false,
|
||||
popupClose?: () => void,
|
||||
obj: {
|
||||
wait_pay_amount?: number | string,
|
||||
actual_amount?: number | string,
|
||||
total_sale_price?: number | string,
|
||||
should_collect_order_id?: number | string,
|
||||
pre_collect_order_id?: number | string,
|
||||
status?: number | string,
|
||||
},
|
||||
showSide?: boolean,
|
||||
list?: any[],
|
||||
clickItem?: (any) => void,
|
||||
handsurePay?: (any) => void,
|
||||
title: string,
|
||||
picUrl?: string
|
||||
showPopup: true | false
|
||||
popupClose?: () => void
|
||||
obj: {
|
||||
wait_pay_amount?: number | string
|
||||
actual_amount?: number | string
|
||||
total_sale_price?: number | string
|
||||
should_collect_order_id?: number | string
|
||||
pre_collect_order_id?: number | string
|
||||
status?: number | string
|
||||
}
|
||||
showSide?: boolean
|
||||
list?: any[]
|
||||
clickItem?: (any) => void
|
||||
handsurePay?: (any) => void
|
||||
title: string
|
||||
picUrl?: string
|
||||
}
|
||||
|
||||
export default memo((props: Props) => {
|
||||
const {
|
||||
showSide = true,
|
||||
showPopup = false,
|
||||
popupClose,
|
||||
obj = {
|
||||
wait_pay_amount: '',
|
||||
actual_amount: '',
|
||||
total_sale_price: ''
|
||||
},
|
||||
clickItem,
|
||||
handsurePay,
|
||||
list = [],
|
||||
title = '待支付款项',
|
||||
picUrl = ''
|
||||
} = props
|
||||
const {
|
||||
showSide = true,
|
||||
showPopup = false,
|
||||
popupClose,
|
||||
obj = {
|
||||
wait_pay_amount: '',
|
||||
actual_amount: '',
|
||||
total_sale_price: '',
|
||||
},
|
||||
clickItem,
|
||||
handsurePay,
|
||||
list = [],
|
||||
title = '待支付款项',
|
||||
picUrl = '',
|
||||
} = props
|
||||
|
||||
const fileData = useRef({
|
||||
filePath: '',
|
||||
base64: '',
|
||||
const fileData = useRef({
|
||||
filePath: '',
|
||||
base64: '',
|
||||
})
|
||||
|
||||
// 预览图片
|
||||
const showImage = () => {
|
||||
const time = new Date().valueOf()
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || []
|
||||
const filePath = `${Taro.env.USER_DATA_PATH}/img${time}.${format}`
|
||||
fileData.current.filePath = filePath
|
||||
fileData.current.base64 = bodyData
|
||||
const save = Taro.getFileSystemManager()
|
||||
save.writeFile({
|
||||
filePath: fileData.current.filePath,
|
||||
data: fileData.current.base64,
|
||||
encoding: 'base64',
|
||||
})
|
||||
Taro.previewImage({
|
||||
current: fileData.current.filePath, // 当前显示
|
||||
urls: [fileData.current.filePath], // 需要预览的图片http链接列表
|
||||
})
|
||||
}
|
||||
|
||||
//预览图片
|
||||
const showImage = () => {
|
||||
const time = new Date().valueOf()
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || []
|
||||
let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format
|
||||
fileData.current.filePath = filePath
|
||||
fileData.current.base64 = bodyData
|
||||
const save = Taro.getFileSystemManager()
|
||||
save.writeFile({
|
||||
filePath: fileData.current.filePath,
|
||||
data: fileData.current.base64,
|
||||
encoding: 'base64',
|
||||
})
|
||||
Taro.previewImage({
|
||||
current: fileData.current.filePath, // 当前显示
|
||||
urls: [fileData.current.filePath], // 需要预览的图片http链接列表
|
||||
})
|
||||
}
|
||||
// 检查是否开启保存图片权限
|
||||
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||
const saveImageCheck = async() => {
|
||||
const res = await check()
|
||||
res && saveImage()
|
||||
}
|
||||
|
||||
// 保存图片
|
||||
const saveImage = () => {
|
||||
const time = new Date().valueOf()
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || []
|
||||
const filePath = `${Taro.env.USER_DATA_PATH}/img${time}.${format}`
|
||||
fileData.current.filePath = filePath
|
||||
fileData.current.base64 = bodyData
|
||||
const save = Taro.getFileSystemManager()
|
||||
save.writeFile({
|
||||
filePath: fileData.current.filePath,
|
||||
data: fileData.current.base64,
|
||||
encoding: 'base64',
|
||||
})
|
||||
alert.loading('正在保存图片')
|
||||
Taro.saveImageToPhotosAlbum({
|
||||
filePath: fileData.current.filePath,
|
||||
success() {
|
||||
alert.success('图片保存成功')
|
||||
},
|
||||
fail(err) {
|
||||
console.log('err::', err)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//检查是否开启保存图片权限
|
||||
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||
const saveImageCheck = async () => {
|
||||
const res = await check()
|
||||
res && saveImage()
|
||||
}
|
||||
|
||||
//保存图片
|
||||
const saveImage = () => {
|
||||
const time = new Date().valueOf()
|
||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || []
|
||||
let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format
|
||||
fileData.current.filePath = filePath
|
||||
fileData.current.base64 = bodyData
|
||||
const save = Taro.getFileSystemManager()
|
||||
save.writeFile({
|
||||
filePath: fileData.current.filePath,
|
||||
data: fileData.current.base64,
|
||||
encoding: 'base64',
|
||||
})
|
||||
alert.loading('正在保存图片')
|
||||
Taro.saveImageToPhotosAlbum({
|
||||
filePath: fileData.current.filePath,
|
||||
success: function () {
|
||||
alert.success('图片保存成功')
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log('err::', err)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.popupBox}>
|
||||
<Popup show={showPopup} title={title} onClose={() => popupClose?.()}>
|
||||
<ScrollView enhanced scrollY className={styles.scrollStyle} >
|
||||
{
|
||||
showSide &&
|
||||
<View className={styles.contBox}>
|
||||
<View className={styles.topMoney}>
|
||||
return (
|
||||
<View className={styles.popupBox}>
|
||||
<Popup show={showPopup} title={title} onClose={() => popupClose?.()}>
|
||||
<ScrollView enhanced scrollY className={styles.scrollStyle} >
|
||||
{
|
||||
showSide
|
||||
&& <View className={styles.contBox}>
|
||||
<View className={styles.topMoney}>
|
||||
¥{formatPriceDiv(obj.wait_pay_amount)}
|
||||
</View>
|
||||
<View className={styles.itemMoney}>
|
||||
<View className={styles.leftFont}>
|
||||
</View>
|
||||
<View className={styles.itemMoney}>
|
||||
<View className={styles.leftFont}>
|
||||
订单金额
|
||||
</View>
|
||||
<View className={styles.rightFont}>
|
||||
</View>
|
||||
<View className={styles.rightFont}>
|
||||
¥{formatPriceDiv(obj.wait_pay_amount)}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.itemMoney}>
|
||||
<View className={styles.leftFont}>
|
||||
</View>
|
||||
<View className={styles.itemMoney}>
|
||||
<View className={styles.leftFont}>
|
||||
已付金额
|
||||
</View>
|
||||
<View className={styles.rightFont}>
|
||||
¥{formatPriceDiv(obj.actual_amount)}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.itemBox} key={index} onClick={() => clickItem?.(item)}>
|
||||
<View className={styles.leftItem}>
|
||||
<View className={styles.leftCrile}
|
||||
style={{ backgroundColor: `${item.name == '线下汇款' ? '#fca846' : '#4a7fff'}` }}
|
||||
>
|
||||
<IconFont name={item.iconfont} size={35} color={item.color}></IconFont>
|
||||
{/* <View className={classnames('iconfont', item.iconfont, styles.lujing)}></View> */}
|
||||
<View className={styles.rightFont}>
|
||||
¥{formatPriceDiv(obj.actual_amount)}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.itemBox} key={index} onClick={() => clickItem?.(item)}>
|
||||
<View className={styles.leftItem}>
|
||||
<View className={styles.leftCrile}
|
||||
style={{ backgroundColor: `${item.name == '线下汇款' ? '#fca846' : '#4a7fff'}` }}
|
||||
>
|
||||
<IconFont name={item.iconfont} size={35} color={item.color}></IconFont>
|
||||
{/* <View className={classnames('iconfont', item.iconfont, styles.lujing)}></View> */}
|
||||
</View>
|
||||
<View className={styles.rightLeft}>
|
||||
<View className={styles.title}>{item.name}</View>
|
||||
{
|
||||
item.fonts && <View className={styles.nums}>{item.fonts}{
|
||||
item.money !== '' ? '¥' : ''
|
||||
}{item.money}</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
{
|
||||
item.name !== '扫码支付' && item.name !== '线下汇款'
|
||||
&& <View className={item.checked ? styles.activeChecked : styles.checkYuan}>
|
||||
{/* <View className={classnames('iconfont', 'icon-lujing', styles.gou)}></View> */}
|
||||
<IconFont name="icon-lujing" size={20} color="#ffffff"></IconFont>
|
||||
</View>
|
||||
<View className={styles.rightLeft}>
|
||||
<View className={styles.title}>{item.name}</View>
|
||||
{
|
||||
item.fonts && <View className={styles.nums}>{item.fonts}{
|
||||
item.money !== "" ? "¥" : ""
|
||||
}{item.money}</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
{
|
||||
item.name !== '扫码支付' && item.name !== '线下汇款' &&
|
||||
<View className={item.checked ? styles.activeChecked : styles.checkYuan}>
|
||||
{/* <View className={classnames('iconfont', 'icon-lujing', styles.gou)}></View> */}
|
||||
<IconFont name={'icon-lujing'} size={20} color={'#ffffff'}></IconFont>
|
||||
</View>
|
||||
}
|
||||
{
|
||||
(item.name === '扫码支付' || item.name === '线下汇款') &&
|
||||
<IconFont name={'icon-chakanquanbukehu'} size={50} color={'#000000'} customClassName={styles['chakanquanbukehu']}></IconFont>
|
||||
}
|
||||
{
|
||||
(item.name === '扫码支付' || item.name === '线下汇款')
|
||||
&& <IconFont name="icon-chakanquanbukehu" size={50} color="#000000" customClassName={styles.chakanquanbukehu}></IconFont>
|
||||
// <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.chakanquanbukehu)}></View>
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</View>
|
||||
|
||||
}
|
||||
{
|
||||
showSide && <View className={styles.sure} onClick={() => handsurePay?.(props?.obj)}>确认交易</View>
|
||||
}
|
||||
{
|
||||
!showSide &&
|
||||
<ScrollView enhanced scrollY className={styles.scroStyle}>
|
||||
<View className={styles.pic}>
|
||||
<Image lazyLoad mode='widthFix' style={{ width: '100%', height: '100%' }} src={picUrl} onClick={() => showImage()}></Image>
|
||||
</View>
|
||||
}
|
||||
{
|
||||
showSide && <View className={styles.sure} onClick={() => handsurePay?.(props?.obj)}>确认交易</View>
|
||||
}
|
||||
{
|
||||
!showSide
|
||||
&& <ScrollView enhanced scrollY className={styles.scroStyle}>
|
||||
<View className={styles.pic}>
|
||||
<Image lazyLoad mode="widthFix" style={{ width: '100%', height: '100%' }} src={picUrl} onClick={() => showImage()}></Image>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
}
|
||||
{
|
||||
!showSide && <View className={styles.sure} onClick={() => saveImageCheck()}>保存图片</View>
|
||||
}
|
||||
<View className={styles.safeBox}></View>
|
||||
</ScrollView>
|
||||
</Popup >
|
||||
</View >
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
!showSide && <View className={styles.sure} onClick={() => saveImageCheck()}>保存图片</View>
|
||||
}
|
||||
<View className={styles.safeBox}></View>
|
||||
</ScrollView>
|
||||
</Popup >
|
||||
</View >
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,107 +1,108 @@
|
||||
import { ScrollView, View } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import BottomBtns from '@/components/BottomBtns'
|
||||
import { formatPriceDiv } from '@/common/format'
|
||||
import Taro from '@tarojs/taro'
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import LabAndImg from '@/components/LabAndImg'
|
||||
|
||||
interface propsObj {
|
||||
obj: any,
|
||||
cancle?: (arg: any, obj: any) => void,
|
||||
nextBuy?: (arg: any, obj: any) => void,
|
||||
toPay?: (arg: any, obj: any) => void
|
||||
obj: any
|
||||
cancle?: (arg: any, obj: any) => void
|
||||
nextBuy?: (arg: any, obj: any) => void
|
||||
toPay?: (arg: any, obj: any) => void
|
||||
}
|
||||
|
||||
|
||||
export default memo((props: propsObj) => {
|
||||
const navTo = (e) => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/orderDetails/index?id=' + props?.obj?.id
|
||||
})
|
||||
const navTo = (e) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/orderDetails/index?id=${props?.obj?.id}`,
|
||||
})
|
||||
}
|
||||
|
||||
const totalMoney = useMemo(() => {
|
||||
if (props?.obj.status == 0 || props?.obj.status == 1 || props?.obj.status == 2) {
|
||||
return props?.obj?.estimate_amount
|
||||
}
|
||||
else {
|
||||
return props?.obj?.bill_total_sale_price
|
||||
}
|
||||
}, [props?.obj])
|
||||
|
||||
const totalMoney = useMemo(() => {
|
||||
if (props?.obj.status == 0 || props?.obj.status == 1 || props?.obj.status == 2) {
|
||||
return props?.obj?.estimate_amount
|
||||
} else {
|
||||
return props?.obj?.bill_total_sale_price
|
||||
}
|
||||
}, [props?.obj])
|
||||
// 待接单、配布中、已配布状态时,叫预估金额,其他状态叫合计金额。
|
||||
const monyFont = useMemo(() => {
|
||||
if (props?.obj?.status === 0 || props?.obj?.status === 1) {
|
||||
return '预估金额'
|
||||
}
|
||||
else {
|
||||
return '合计金额'
|
||||
}
|
||||
}, [props?.obj])
|
||||
|
||||
//待接单、配布中、已配布状态时,叫预估金额,其他状态叫合计金额。
|
||||
const monyFont = useMemo(() => {
|
||||
if (props?.obj?.status === 0 || props?.obj?.status === 1) {
|
||||
return "预估金额"
|
||||
} else {
|
||||
return "合计金额"
|
||||
}
|
||||
}, [props?.obj])
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<View className={styles.itemBox} onClick={e => navTo(e)}>
|
||||
<View className={styles.topItem}>
|
||||
<View className={styles.orderNo}>单号:{props?.obj?.order_no}</View>
|
||||
<View className={styles.status}>{props?.obj?.status_name}</View>
|
||||
</View>
|
||||
<View className={styles.pussName}>{props?.obj?.purchaser_name}</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.contBox}>
|
||||
<View style={{ minWidth: '24%' }}>
|
||||
<View className={styles.leftCont}>
|
||||
<LabAndImg value={labAndImgObj(props?.obj?.product_list?.[0])} />
|
||||
<View className={styles.leftContNums}>颜色 ({props?.obj?.total_colors})</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
return (
|
||||
<View className={styles.itemBox} onClick={(e) => navTo(e)}>
|
||||
<View className={styles.topItem}>
|
||||
<View className={styles.orderNo}>单号:{props?.obj?.order_no}</View>
|
||||
<View className={styles.status}>{props?.obj?.status_name}</View>
|
||||
<View className={styles.rightCont}>
|
||||
<View className={styles.rightTop}>
|
||||
<View className={styles.productBox}>
|
||||
<View className={styles.productName}>{props?.obj?.product_list[0]?.code} {props?.obj?.product_list[0]?.name}</View>
|
||||
<View className={styles.productMode}>{props?.obj?.sale_mode === 0 ? '大货' : props?.obj?.sale_mode === 1 ? '剪版' : '散剪'}</View>
|
||||
</View>
|
||||
<View className={styles.pussName}>{props?.obj?.purchaser_name}</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.contBox}>
|
||||
<View style={{ minWidth: '24%' }}>
|
||||
<View className={styles.leftCont}>
|
||||
<LabAndImg value={labAndImgObj(props?.obj?.product_list?.[0])} />
|
||||
<View className={styles.leftContNums}>颜色 ({props?.obj?.total_colors})</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className={styles.rightCont}>
|
||||
<View className={styles.rightTop}>
|
||||
<View className={styles.productBox}>
|
||||
<View className={styles.productName}>{props?.obj?.product_list[0]?.code} {props?.obj?.product_list[0]?.name}</View>
|
||||
<View className={styles.productMode}>{props?.obj?.sale_mode === 0 ? '大货' : props?.obj?.sale_mode === 1 ? '剪版' : '散剪'}</View>
|
||||
</View>
|
||||
<View className={styles.shipMode}>{props?.obj?.shipment_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.colorsBox}>
|
||||
<View className={styles.colorNameOne}>{props?.obj?.product_list[0]?.product_colors[0]?.code} {props?.obj?.product_list[0]?.product_colors[0]?.name}</View>
|
||||
<View className={styles.colorName}>x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[0]?.roll : props?.obj?.product_list[0]?.product_colors[0]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.colorNameTwo}>¥ {props?.obj?.product_list[0]?.product_colors[0]?.sale_price / 100}/{props?.obj?.sale_mode == 1 ? 'm' : 'kg'}</View>
|
||||
</View>
|
||||
{
|
||||
props?.obj?.product_list[0]?.product_colors?.length > 1 && <>
|
||||
<View className={styles.colorsBox}>
|
||||
<View className={styles.colorNameOne}>{props?.obj?.product_list[0]?.product_colors[1]?.code} {props?.obj?.product_list[0]?.product_colors[1]?.name}</View>
|
||||
<View className={styles.colorName}>x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[1]?.roll : props?.obj?.product_list[0]?.product_colors[1]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.colorNameTwo}>¥ {props?.obj?.product_list[0]?.product_colors[1]?.sale_price / 100}/{props?.obj?.sale_mode == 1 ? 'm' : 'kg'}</View>
|
||||
</View>
|
||||
</>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.lineOne}></View>
|
||||
<View className={styles.bottomMsg}>
|
||||
<View className={styles.msgLeft}>布料信息:</View>
|
||||
<View className={styles.msgRight}>{props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共 {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
{
|
||||
props?.obj.status != 5 && <View className={styles.bottomMsg}>
|
||||
<View className={styles.msgLeft}>{monyFont}</View>
|
||||
<View className={styles.msgRightOne}>¥{formatPriceDiv(totalMoney)}</View>
|
||||
</View>
|
||||
}
|
||||
<View className={styles.bottomBox}>
|
||||
<BottomBtns
|
||||
obj={props?.obj}
|
||||
cancle={(e) => props?.cancle?.(e, props?.obj)}
|
||||
nextBuy={(e) => props?.nextBuy?.(e, props?.obj)}
|
||||
toPay={(e) => props?.toPay?.(e, props?.obj)}
|
||||
></BottomBtns>
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
<View className={styles.shipMode}>{props?.obj?.shipment_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.colorsBox}>
|
||||
<View className={styles.colorNameOne}>{props?.obj?.product_list[0]?.product_colors[0]?.code} {props?.obj?.product_list[0]?.product_colors[0]?.name}</View>
|
||||
<View className={styles.colorName}>x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[0]?.roll : props?.obj?.product_list[0]?.product_colors[0]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.colorNameTwo}>¥ {props?.obj?.product_list[0]?.product_colors[0]?.sale_price / 100}/{props?.obj?.sale_mode == 1 ? 'm' : 'kg'}</View>
|
||||
</View>
|
||||
{
|
||||
props?.obj?.product_list[0]?.product_colors?.length > 1 && <>
|
||||
<View className={styles.colorsBox}>
|
||||
<View className={styles.colorNameOne}>{props?.obj?.product_list[0]?.product_colors[1]?.code} {props?.obj?.product_list[0]?.product_colors[1]?.name}</View>
|
||||
<View className={styles.colorName}>x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[1]?.roll : props?.obj?.product_list[0]?.product_colors[1]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
<View className={styles.colorNameTwo}>¥ {props?.obj?.product_list[0]?.product_colors[1]?.sale_price / 100}/{props?.obj?.sale_mode == 1 ? 'm' : 'kg'}</View>
|
||||
</View>
|
||||
</>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.lineOne}></View>
|
||||
<View className={styles.bottomMsg}>
|
||||
<View className={styles.msgLeft}>布料信息:</View>
|
||||
<View className={styles.msgRight}>{props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共 {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||
</View>
|
||||
{
|
||||
props?.obj.status != 5 && <View className={styles.bottomMsg}>
|
||||
<View className={styles.msgLeft}>{monyFont}</View>
|
||||
<View className={styles.msgRightOne}>¥{formatPriceDiv(totalMoney)}</View>
|
||||
</View>
|
||||
}
|
||||
<View className={styles.bottomBox}>
|
||||
<BottomBtns
|
||||
obj={props?.obj}
|
||||
cancle={e => props?.cancle?.(e, props?.obj)}
|
||||
nextBuy={e => props?.nextBuy?.(e, props?.obj)}
|
||||
toPay={e => props?.toPay?.(e, props?.obj)}
|
||||
></BottomBtns>
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,100 +1,101 @@
|
||||
import { Text, View } from "@tarojs/components";
|
||||
import { memo } from "react";
|
||||
import AmountShow from "../amountShow";
|
||||
import classnames from "classnames";
|
||||
import { Text, View } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { memo } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import AmountShow from '../amountShow'
|
||||
import styles from './index.module.scss'
|
||||
import MCheckbox from '@/components/checkbox'
|
||||
import Popup from '@/components/popup'
|
||||
import SearchInput from '@/components/searchInput'
|
||||
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import Popup from "@/components/popup";
|
||||
import SearchInput from "@/components/searchInput";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
type Param = {
|
||||
show?: true | false,
|
||||
onClose?: () => void,
|
||||
offlineInfo?: {
|
||||
account_name: string,
|
||||
bank_of_deposit: string,
|
||||
transfer_remittance_account: string
|
||||
},
|
||||
showKong?: true | false,
|
||||
interface Param {
|
||||
show?: true | false
|
||||
onClose?: () => void
|
||||
offlineInfo?: {
|
||||
account_name: string
|
||||
bank_of_deposit: string
|
||||
transfer_remittance_account: string
|
||||
}
|
||||
showKong?: true | false
|
||||
}
|
||||
export default memo(({ show = true, onClose, offlineInfo, showKong = true }: Param) => {
|
||||
//复制功能
|
||||
const clipboardData = () => {
|
||||
Taro.setClipboardData({
|
||||
data: `开户名称:${offlineInfo?.account_name};\n\r 开户银行:${offlineInfo?.bank_of_deposit};\n\r 转账汇款账号:${offlineInfo?.transfer_remittance_account};`,
|
||||
success: function (res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
// 复制功能
|
||||
const clipboardData = () => {
|
||||
Taro.setClipboardData({
|
||||
data: `开户名称:${offlineInfo?.account_name};\n\r 开户银行:${offlineInfo?.bank_of_deposit};\n\r 转账汇款账号:${offlineInfo?.transfer_remittance_account};`,
|
||||
success(res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
// //复制功能
|
||||
const copy = (index) => {
|
||||
let res: any = ''
|
||||
if (index === 1) {
|
||||
res = offlineInfo?.account_name
|
||||
}
|
||||
// //复制功能
|
||||
const copy = (index) => {
|
||||
let res: any = ''
|
||||
if (index === 1) {
|
||||
res = offlineInfo?.account_name
|
||||
} else if (index === 2) {
|
||||
res = offlineInfo?.bank_of_deposit
|
||||
} else if (index === 3) {
|
||||
res = offlineInfo?.transfer_remittance_account
|
||||
}
|
||||
Taro.setClipboardData({
|
||||
data: res || '',
|
||||
success: function (res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功',
|
||||
})
|
||||
},
|
||||
else if (index === 2) {
|
||||
res = offlineInfo?.bank_of_deposit
|
||||
}
|
||||
else if (index === 3) {
|
||||
res = offlineInfo?.transfer_remittance_account
|
||||
}
|
||||
Taro.setClipboardData({
|
||||
data: res || '',
|
||||
success(res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功',
|
||||
})
|
||||
}
|
||||
return (
|
||||
<View className={styles.offlinePay_main}>
|
||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||
<View className={styles.offlinePay_con}>
|
||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
||||
<View className={styles.title}>线下汇款</View>
|
||||
<View className={styles.offlinePay_list}>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>开户名称</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.account_name}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(1) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>开户银行</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.bank_of_deposit}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(2) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>转账汇款账号</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.transfer_remittance_account}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(3) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
{/* <SearchInput showBorder={false} title='开户银行' titleStyle={{ fontSize: '23rpx' }}>
|
||||
},
|
||||
})
|
||||
}
|
||||
return (
|
||||
<View className={styles.offlinePay_main}>
|
||||
<Popup show={show} showTitle={false} onClose={onClose} >
|
||||
<View className={styles.offlinePay_con}>
|
||||
<View className={classnames('iconfont icon-a-moreback', styles.miconfont_title)} onClick={onClose}></View>
|
||||
<View className={styles.title}>线下汇款</View>
|
||||
<View className={styles.offlinePay_list}>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>开户名称</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.account_name}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(1) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>开户银行</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.bank_of_deposit}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(2) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.flexBox}>
|
||||
<View className={styles.title}>转账汇款账号</View>
|
||||
<View className={styles.leftFlex}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.transfer_remittance_account}</Text>
|
||||
<View className={styles.btn} onClick={() => { copy(3) }}>复制</View>
|
||||
</View>
|
||||
</View>
|
||||
{/* <SearchInput showBorder={false} title='开户银行' titleStyle={{ fontSize: '23rpx' }}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.bank_of_deposit}</Text>
|
||||
</SearchInput>
|
||||
<SearchInput showBorder={false} title='转账汇款账号' titleStyle={{ fontSize: '23rpx' }}>
|
||||
<Text className={styles.offlinePay_con_text}>{offlineInfo?.transfer_remittance_account}</Text>
|
||||
</SearchInput> */}
|
||||
</View>
|
||||
<View className={styles.btns} onClick={clipboardData}>复制信息</View>
|
||||
</View>
|
||||
{
|
||||
showKong && <View className={styles.kongBox}></View>
|
||||
}
|
||||
|
||||
</Popup>
|
||||
</View>
|
||||
<View className={styles.btns} onClick={clipboardData}>复制信息</View>
|
||||
</View>
|
||||
{
|
||||
showKong && <View className={styles.kongBox}></View>
|
||||
}
|
||||
|
||||
)
|
||||
})
|
||||
</Popup>
|
||||
</View>
|
||||
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { ScrollView, View } from '@tarojs/components'
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type Param = {
|
||||
interface Param {
|
||||
list: { id: number; name: string }[]
|
||||
defaultId?: number | null
|
||||
onSelect?: (val: number) => void
|
||||
}
|
||||
export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
const [selectInfo, setSelectInfo] = useState({
|
||||
selected: -1, //当前选中的id
|
||||
tabId: '', //需要滚动到的id
|
||||
selected: -1, // 当前选中的id
|
||||
tabId: '', // 需要滚动到的id
|
||||
})
|
||||
useEffect(() => {
|
||||
if (typeof defaultId === 'number' && defaultId >= 0) {
|
||||
@@ -21,20 +21,20 @@ export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
})
|
||||
if (index !== -1) {
|
||||
const num = index > 0 ? index - 1 : 0
|
||||
setSelectInfo((e) => ({ ...e, tabId: list[num].id.toString() }))
|
||||
setSelectInfo(e => ({ ...e, tabId: list[num].id.toString() }))
|
||||
}
|
||||
}
|
||||
setSelectInfo((e) => ({ ...e, selected: defaultId || -1 }))
|
||||
setSelectInfo(e => ({ ...e, selected: defaultId || -1 }))
|
||||
}, [defaultId])
|
||||
const clickEvent = ({ item, index }: { item: any; index: number }) => {
|
||||
const num = index > 0 ? index - 1 : 0
|
||||
setSelectInfo((e) => ({ ...e, tabId: list[num].id.toString(), selected: item.id }))
|
||||
setSelectInfo(e => ({ ...e, tabId: list[num].id.toString(), selected: item.id }))
|
||||
onSelect?.(item.id)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.order_status_list}>
|
||||
<ScrollView scrollX scrollIntoView={`tabs_${selectInfo.tabId}`} scrollWithAnimation={true}>
|
||||
<ScrollView scrollX scrollIntoView={`tabs_${selectInfo.tabId}`} scrollWithAnimation>
|
||||
<View className={styles.order_list_scroll}>
|
||||
{list.map((item, index) => {
|
||||
return (
|
||||
@@ -42,7 +42,8 @@ export default memo(({ list = [], defaultId = null, onSelect }: Param) => {
|
||||
key={item.id}
|
||||
id={`tabs_${item.id}`}
|
||||
onClick={() => clickEvent({ item, index })}
|
||||
className={classnames(styles.order_status_item, selectInfo.selected == item.id && styles.selected)}>
|
||||
className={classnames(styles.order_status_item, selectInfo.selected == item.id && styles.selected)}
|
||||
>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: '订单',
|
||||
navigationBarTitleText: '订单',
|
||||
}
|
||||
|
||||
+216
-211
@@ -1,41 +1,42 @@
|
||||
import { View, Input, Button } from '@tarojs/components'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react'
|
||||
import { mpenumsaleorderstatus, OrderListApi } from '@/api/order'
|
||||
import OrderStatusList from './components/orderStatusList'
|
||||
import Search from '@/components/search'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
import styles from "./index.module.scss"
|
||||
import classnames from "classnames";
|
||||
import Popup from '@/components/popup'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { Button, Input, View } from '@tarojs/components'
|
||||
import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import OrderStatusList from './components/orderStatusList'
|
||||
import styles from './index.module.scss'
|
||||
import ItemList from './components/itemList'
|
||||
import OfflinePay from './components/offlinePay'
|
||||
import PayPopup from './components/PayPopup'
|
||||
import {
|
||||
GetPayCode, OrderListApi,
|
||||
mpenumsaleorderstatus,
|
||||
mpsaleOrdercancel,
|
||||
mpshoppingCartproductColorlist,
|
||||
orderPaymentorderPaymentMethodInfo,
|
||||
orderPaymentpreCollectOrderorderPaymentMethodInfo,
|
||||
orderPaymentorderPaymentSubmission,
|
||||
orderPaymentpreCollectOrderorderPaymentMethodInfo,
|
||||
orderPaymentpreCollectOrderorderPaymentSubmission,
|
||||
GetPayCode
|
||||
} from '@/api/order'
|
||||
import PayPopup from './components/PayPopup'
|
||||
import Search from '@/components/search'
|
||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||
import Popup from '@/components/popup'
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
interface filterObj {
|
||||
purchaser_id?: string | number,
|
||||
clientName?: string,
|
||||
sale_user_id?: string | number,
|
||||
saleuserName?: string,
|
||||
order_no?: string | undefined,
|
||||
sale_mode?: Number | undefined,
|
||||
shipment_mode?: Number | undefined
|
||||
}
|
||||
import { PAY_H5_CODE_URL } from '@/common/constant'
|
||||
|
||||
interface filterObj {
|
||||
purchaser_id?: string | number
|
||||
clientName?: string
|
||||
sale_user_id?: string | number
|
||||
saleuserName?: string
|
||||
order_no?: string | undefined
|
||||
sale_mode?: Number | undefined
|
||||
shipment_mode?: Number | undefined
|
||||
}
|
||||
|
||||
export default () => {
|
||||
//页码和页数
|
||||
// 页码和页数
|
||||
const [searchField, setSearchField] = useState<{ status: number | unknown; page: number; size: number; order_no: string }>({
|
||||
status: -1,
|
||||
page: 1,
|
||||
@@ -43,36 +44,33 @@ export default () => {
|
||||
order_no: '',
|
||||
})
|
||||
|
||||
//获取订单列表
|
||||
// 获取订单列表
|
||||
const { fetchData: listFetchData, state: orderState } = OrderListApi()
|
||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||
const getOrderList = async () => {
|
||||
let res = await listFetchData({
|
||||
const getOrderList = async() => {
|
||||
const res = await listFetchData({
|
||||
...getFilterData(searchField),
|
||||
...getFilterData(searchObj)
|
||||
...getFilterData(searchObj),
|
||||
})
|
||||
setOrderData((e) => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
setOrderData(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||
setshowPopup(false)
|
||||
setRefresherTriggeredStatus(() => false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//列表下拉刷新
|
||||
// 列表下拉刷新
|
||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||
const getRefresherRefresh = async () => {
|
||||
const getRefresherRefresh = async() => {
|
||||
pageNum.current.size = 1
|
||||
setRefresherTriggeredStatus(true)
|
||||
setSearchField((val) => ({ ...val, size: 10 }))
|
||||
setSearchField(val => ({ ...val, size: 10 }))
|
||||
}
|
||||
//数据加载状态
|
||||
// 数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
console.log({ list: orderData.list, total: orderData.total, status: orderState.loading }, '{ list: orderData.list, total: orderData.total, status: orderState.loading }')
|
||||
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading })
|
||||
}, [orderData, orderState])
|
||||
|
||||
//上拉加载数据
|
||||
// 上拉加载数据
|
||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||
const getScrolltolower = useCallback(() => {
|
||||
if (orderData.list.length < orderData.total) {
|
||||
@@ -85,48 +83,46 @@ export default () => {
|
||||
// //获取订单状态
|
||||
const { fetchData: orderStatusListFetchData } = mpenumsaleorderstatus()
|
||||
const [statusList, setStatusList] = useState<any[]>([{ id: -1, name: '全部' }])
|
||||
const getOrderStatusList = async () => {
|
||||
let res = await orderStatusListFetchData()
|
||||
setStatusList((e) => [...e, ...res.data.list])
|
||||
const getOrderStatusList = async() => {
|
||||
const res = await orderStatusListFetchData()
|
||||
setStatusList(e => [...e, ...res.data.list])
|
||||
}
|
||||
|
||||
//监听筛选条件变化
|
||||
// 监听筛选条件变化
|
||||
useEffect(() => {
|
||||
if (searchField.status != null) getOrderList()
|
||||
if (searchField.status != null) { getOrderList() }
|
||||
}, [searchField])
|
||||
|
||||
// //状态改变
|
||||
const changeStatus = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setSearchField((value) => ({ ...value, status: e, size: 10 }))
|
||||
setSearchField(value => ({ ...value, status: e, size: 10 }))
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
}, [])
|
||||
|
||||
//输入了搜索关键字
|
||||
// 输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
setSearchField((val) => ({ ...val, order_no: e, size: 10 }))
|
||||
setSearchField(val => ({ ...val, order_no: e, size: 10 }))
|
||||
}, [])
|
||||
//筛选内容展示
|
||||
// 筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
const showSelctPopup = () => {
|
||||
setshowPopup(true)
|
||||
}
|
||||
//关闭筛选内容展示
|
||||
// 关闭筛选内容展示
|
||||
const closePopup = () => {
|
||||
setshowPopup(false)
|
||||
}
|
||||
|
||||
|
||||
useDidShow(() => {
|
||||
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
// 获取选择的客户
|
||||
const pages = Taro.getCurrentPages()
|
||||
const currPage = pages[pages.length - 1] // 获取当前页面
|
||||
console.log(currPage.data, '8888')
|
||||
|
||||
setsearchObj((e) => ({
|
||||
setsearchObj(e => ({
|
||||
...e,
|
||||
purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : '',
|
||||
clientName: currPage.data?.clientName ? currPage.data?.clientName : '',
|
||||
@@ -135,76 +131,77 @@ export default () => {
|
||||
}))
|
||||
})
|
||||
|
||||
|
||||
|
||||
//筛选参数
|
||||
// 筛选参数
|
||||
const [searchObj, setsearchObj] = useState<filterObj>({
|
||||
purchaser_id: '',
|
||||
clientName: '',
|
||||
sale_user_id: '',
|
||||
saleuserName: '',
|
||||
sale_mode: undefined,
|
||||
shipment_mode: undefined
|
||||
shipment_mode: undefined,
|
||||
})
|
||||
// 跳转选择客户
|
||||
const navTo = (index) => {
|
||||
if (index === 1) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/customerPage/index?clientId=' + searchObj?.purchaser_id
|
||||
url: `/pages/customerPage/index?clientId=${searchObj?.purchaser_id}`,
|
||||
})
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/saleuserPage/index?saleuserId=' + searchObj?.sale_user_id
|
||||
url: `/pages/saleuserPage/index?saleuserId=${searchObj?.sale_user_id}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//订单类型
|
||||
// 订单类型
|
||||
const [modeList, setModeList] = useState<any[]>([{ id: -1, name: '不限' }, { id: 0, name: '大货' }, { id: 1, name: '剪版' }, { id: 2, name: '散剪' }])
|
||||
//选择订单类型
|
||||
// 选择订单类型
|
||||
const handCheckMode = (item) => {
|
||||
modeList.map(it => {
|
||||
modeList.map((it) => {
|
||||
if (it.id === item.id) {
|
||||
it.checked = true
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
it.checked = false
|
||||
}
|
||||
return it
|
||||
})
|
||||
setModeList([...modeList])
|
||||
setsearchObj((e) => ({ ...e, sale_mode: item.id }))
|
||||
setsearchObj(e => ({ ...e, sale_mode: item.id }))
|
||||
}
|
||||
|
||||
///发货方式类型
|
||||
/// 发货方式类型
|
||||
const [deliveryList, setdeliveryList] = useState<any[]>([{ id: -1, name: '不限' }, { id: 1, name: '自提' }, { id: 2, name: '物流' }])
|
||||
//选择发货方式类型
|
||||
// 选择发货方式类型
|
||||
const handCheckDelivery = (item) => {
|
||||
deliveryList.map(it => {
|
||||
deliveryList.map((it) => {
|
||||
if (it.id === item.id) {
|
||||
it.checked = true
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
it.checked = false
|
||||
}
|
||||
return it
|
||||
})
|
||||
setdeliveryList([...deliveryList])
|
||||
setsearchObj((e) => ({ ...e, shipment_mode: item.id }))
|
||||
setsearchObj(e => ({ ...e, shipment_mode: item.id }))
|
||||
}
|
||||
//是否不允许确认筛选
|
||||
// 是否不允许确认筛选
|
||||
const isDisabled = useMemo(() => {
|
||||
if (searchObj.clientName !== '' ||
|
||||
searchObj.saleuserName !== '' ||
|
||||
searchObj.sale_mode !== undefined ||
|
||||
searchObj.shipment_mode !== undefined
|
||||
if (searchObj.clientName !== ''
|
||||
|| searchObj.saleuserName !== ''
|
||||
|| searchObj.sale_mode !== undefined
|
||||
|| searchObj.shipment_mode !== undefined
|
||||
) {
|
||||
return false
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
}, [searchObj])
|
||||
|
||||
//重置
|
||||
// 重置
|
||||
const handReset = () => {
|
||||
pageNum.current.page = 1
|
||||
setsearchObj({
|
||||
@@ -222,29 +219,28 @@ export default () => {
|
||||
setdeliveryList([...arrTwo])
|
||||
}
|
||||
|
||||
|
||||
//数组重置
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map(it => {
|
||||
arr.map((it) => {
|
||||
it.checked = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
//确认筛选
|
||||
const handSure = async () => {
|
||||
// 确认筛选
|
||||
const handSure = async() => {
|
||||
getOrderList()
|
||||
}
|
||||
//扫描
|
||||
// 扫描
|
||||
const handScan = () => {
|
||||
Taro.scanCode({
|
||||
success(res) {
|
||||
setSearchField((val) => ({ ...val, order_no: res.result }))
|
||||
setSearchField(val => ({ ...val, order_no: res.result }))
|
||||
},
|
||||
fail(res) {
|
||||
console.log(res);
|
||||
console.log(res)
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -252,192 +248,195 @@ export default () => {
|
||||
}, [])
|
||||
|
||||
const { fetchData: cancelFetch } = mpsaleOrdercancel()
|
||||
//取消订单
|
||||
const cancle = async (e, item) => {
|
||||
e.stopPropagation();
|
||||
// 取消订单
|
||||
const cancle = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
Taro.showModal({
|
||||
content: "确定要取消吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
content: '确定要取消吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
mask: true,
|
||||
})
|
||||
const res = await cancelFetch({ id: item.id })
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '取消成功'
|
||||
title: '取消成功',
|
||||
})
|
||||
Taro.hideLoading()
|
||||
getOrderList()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
//再次购买
|
||||
// 再次购买
|
||||
const { fetchData: buyFetch } = mpshoppingCartproductColorlist()
|
||||
const nextBuy = async (e, item) => {
|
||||
e.stopPropagation();
|
||||
const nextBuy = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
mask: true,
|
||||
})
|
||||
let arr: any = []
|
||||
item.product_list.forEach(item => {
|
||||
item.product_colors.forEach(it => {
|
||||
const arr: any = []
|
||||
item.product_list.forEach((item) => {
|
||||
item.product_colors.forEach((it) => {
|
||||
arr.push({
|
||||
length: it.length,
|
||||
roll: it.roll,
|
||||
product_color_id: it.id
|
||||
product_color_id: it.id,
|
||||
})
|
||||
})
|
||||
})
|
||||
let query = {
|
||||
const query = {
|
||||
purchaser_id: item.purchaser_id,
|
||||
sale_mode: item.sale_mode,
|
||||
color_list: arr
|
||||
color_list: arr,
|
||||
}
|
||||
const res = await buyFetch(query)
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '加入购物车成功!'
|
||||
title: '加入购物车成功!',
|
||||
})
|
||||
Taro.hideLoading()
|
||||
getOrderList()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
//去支付逻辑
|
||||
// 去支付逻辑
|
||||
const { fetchData: infoOneFetch } = orderPaymentorderPaymentMethodInfo()
|
||||
const { fetchData: infoTwoFetch } = orderPaymentpreCollectOrderorderPaymentMethodInfo()
|
||||
const [itemObj, setItemObj] = useState<any>({})
|
||||
const [payList, setPayList] = useState<any[]>([
|
||||
{
|
||||
id: 2,
|
||||
iconfont: "icon-yufukuan1",
|
||||
name: "预存款",
|
||||
fonts: "可用额度 ",
|
||||
money: "",
|
||||
iconfont: 'icon-yufukuan1',
|
||||
name: '预存款',
|
||||
fonts: '可用额度 ',
|
||||
money: '',
|
||||
isCheck: false,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
iconfont: "icon-xianxiahuizong",
|
||||
name: "货到付款",
|
||||
fonts: "发货后3天内付款",
|
||||
iconfont: 'icon-xianxiahuizong',
|
||||
name: '货到付款',
|
||||
fonts: '发货后3天内付款',
|
||||
isCheck: false,
|
||||
money: "",
|
||||
color: '#ffffff'
|
||||
money: '',
|
||||
color: '#ffffff',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
iconfont: "icon-xianxiahuizong",
|
||||
name: "x天账期",
|
||||
fonts: "可用额度 ",
|
||||
money: "",
|
||||
iconfont: 'icon-xianxiahuizong',
|
||||
name: 'x天账期',
|
||||
fonts: '可用额度 ',
|
||||
money: '',
|
||||
isCheck: false,
|
||||
color: '#ffffff'
|
||||
color: '#ffffff',
|
||||
},
|
||||
{
|
||||
iconfont: "icon-yue",
|
||||
name: "线下汇款",
|
||||
iconfont: 'icon-yue',
|
||||
name: '线下汇款',
|
||||
},
|
||||
{
|
||||
iconfont: "icon-saomiao",
|
||||
name: "扫码支付",
|
||||
color: '#ffffff'
|
||||
iconfont: 'icon-saomiao',
|
||||
name: '扫码支付',
|
||||
color: '#ffffff',
|
||||
},
|
||||
])
|
||||
const toPay = async (e, item) => {
|
||||
e.stopPropagation();
|
||||
const toPay = async(e, item) => {
|
||||
e.stopPropagation()
|
||||
|
||||
setItemObj(item)
|
||||
if (item.status !== 10) {
|
||||
let res = await infoOneFetch({ id: item.should_collect_order_id })
|
||||
const res = await infoOneFetch({ id: item.should_collect_order_id })
|
||||
payList.map((item) => {
|
||||
if (item.id === 3) {
|
||||
item.name = `${res.data.account_period}天账期`;
|
||||
item.name = `${res.data.account_period}天账期`
|
||||
item.fonts = `可用额度${formatPriceDiv(
|
||||
res.data.account_period_credit_available_line
|
||||
).toLocaleString()}`;
|
||||
res.data.account_period_credit_available_line,
|
||||
).toLocaleString()}`
|
||||
}
|
||||
if (item.id === 2) {
|
||||
item.fonts = `可用额度${formatPriceDiv(
|
||||
res.data.advance_deposit_balance
|
||||
).toLocaleString()}`;
|
||||
res.data.advance_deposit_balance,
|
||||
).toLocaleString()}`
|
||||
}
|
||||
return item;
|
||||
});
|
||||
return item
|
||||
})
|
||||
setPayList([...payList])
|
||||
if (item.is_shipper_picks_up) {
|
||||
const obj = payList.filter((item) => {
|
||||
return item.id === 6;
|
||||
});
|
||||
console.log(obj, "456456");
|
||||
return item.id === 6
|
||||
})
|
||||
console.log(obj, '456456')
|
||||
if (obj.length === 0) {
|
||||
payList.unshift({
|
||||
id: 6,
|
||||
iconfont: "icon-xianxiahuizong",
|
||||
iconfont: 'icon-xianxiahuizong',
|
||||
color: '#ffffff',
|
||||
name: "货主自提",
|
||||
fonts: "",
|
||||
money: "",
|
||||
name: '货主自提',
|
||||
fonts: '',
|
||||
money: '',
|
||||
isCheck: false,
|
||||
});
|
||||
})
|
||||
setPayList([...payList])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let res = await infoTwoFetch({ id: item.pre_collect_order_id })
|
||||
const arr: any = [];
|
||||
}
|
||||
else {
|
||||
const res = await infoTwoFetch({ id: item.pre_collect_order_id })
|
||||
const arr: any = []
|
||||
arr.push(
|
||||
{
|
||||
id: 2,
|
||||
iconfont: "icon-yufukuan1",
|
||||
name: "预存款",
|
||||
iconfont: 'icon-yufukuan1',
|
||||
name: '预存款',
|
||||
fonts: `可用额度${formatPriceDiv(
|
||||
res.data.advance_deposit_balance
|
||||
res.data.advance_deposit_balance,
|
||||
).toLocaleString()}`,
|
||||
money: "",
|
||||
money: '',
|
||||
isCheck: false,
|
||||
},
|
||||
{
|
||||
iconfont: "icon-yue",
|
||||
name: "线下汇款",
|
||||
iconfont: 'icon-yue',
|
||||
name: '线下汇款',
|
||||
},
|
||||
{
|
||||
iconfont: "icon-saomiao",
|
||||
name: "扫码支付",
|
||||
color: '#ffffff'
|
||||
iconfont: 'icon-saomiao',
|
||||
name: '扫码支付',
|
||||
color: '#ffffff',
|
||||
},
|
||||
|
||||
);
|
||||
)
|
||||
if (item.is_shipper_picks_up) {
|
||||
const obj = arr.filter((item) => {
|
||||
return item.id === 6;
|
||||
});
|
||||
return item.id === 6
|
||||
})
|
||||
if (obj.length === 0) {
|
||||
arr.unshift({
|
||||
id: 6,
|
||||
iconfont: "icon-xianxiahuizong",
|
||||
name: "货主自提",
|
||||
iconfont: 'icon-xianxiahuizong',
|
||||
name: '货主自提',
|
||||
color: '#ffffff',
|
||||
fonts: "",
|
||||
money: "",
|
||||
fonts: '',
|
||||
money: '',
|
||||
isCheck: false,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
setPayList([...arr])
|
||||
@@ -447,14 +446,15 @@ export default () => {
|
||||
setShowPay(true)
|
||||
}
|
||||
|
||||
//选择支付方式
|
||||
// 选择支付方式
|
||||
const clickItem = (item) => {
|
||||
if (item.name === '扫码支付') { handScanpay() }
|
||||
if (item.name === '线下汇款') { setShowOffine(true) }
|
||||
payList.map(it => {
|
||||
payList.map((it) => {
|
||||
if (item.id === it.id) {
|
||||
it.checked = true
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
it.checked = false
|
||||
}
|
||||
return it
|
||||
@@ -462,14 +462,13 @@ export default () => {
|
||||
setPayList([...payList])
|
||||
}
|
||||
|
||||
|
||||
//扫码支付
|
||||
// 扫码支付
|
||||
const [showSide, setShowSide] = useState(true)
|
||||
const [title, setTitle] = useState('')
|
||||
const [picUrl, setPicUrl] = useState('')
|
||||
const { fetchData: payFetch } = GetPayCode()
|
||||
const handScanpay = async () => {
|
||||
const list: any = [];
|
||||
const handScanpay = async() => {
|
||||
const list: any = []
|
||||
itemObj.product_list.forEach((item) => {
|
||||
item.product_colors.forEach((it) => {
|
||||
list.push({
|
||||
@@ -486,12 +485,12 @@ export default () => {
|
||||
: (it.estimate_amount / 100).toString(),
|
||||
length: (it.length / 100).toString(),
|
||||
weight_error: formatWeightDiv(it.weight_error).toString(),
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
const query = {
|
||||
list: list,
|
||||
title: "面料销售电子确认单",
|
||||
list,
|
||||
title: '面料销售电子确认单',
|
||||
show_qrcode: true,
|
||||
show_barcode: true,
|
||||
show_wait_pay_amount: true,
|
||||
@@ -529,7 +528,7 @@ export default () => {
|
||||
order_total_weight_error: (
|
||||
itemObj.total_weight_error / 1000
|
||||
).toString(),
|
||||
};
|
||||
}
|
||||
const res = await payFetch(query)
|
||||
if (res.data) {
|
||||
console.log(res.data.base64)
|
||||
@@ -539,67 +538,66 @@ export default () => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//确认交易
|
||||
// 确认交易
|
||||
const { fetchData: payOneFetch } = orderPaymentorderPaymentSubmission()
|
||||
const { fetchData: payTwoFetch } = orderPaymentpreCollectOrderorderPaymentSubmission()
|
||||
const handsurePay = (obj) => {
|
||||
let arr: any = []
|
||||
// if (obj.status !== 10) {
|
||||
arr = payList.filter(item => {
|
||||
arr = payList.filter((item) => {
|
||||
return item.checked
|
||||
})
|
||||
if (!arr.length) {
|
||||
Taro.showToast({
|
||||
title: '请选择后再提交',
|
||||
icon: 'error'
|
||||
icon: 'error',
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
Taro.showModal({
|
||||
content: "确定交易吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
content: '确定交易吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
mask: true,
|
||||
})
|
||||
const restult = await (obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }))
|
||||
if (restult?.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '交易成功'
|
||||
title: '交易成功',
|
||||
})
|
||||
Taro.hideLoading()
|
||||
setShowPay(false)
|
||||
getOrderList()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Taro.showToast({
|
||||
title: restult?.msg,
|
||||
icon: 'error'
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
//显示支付
|
||||
// 显示支付
|
||||
const [showPay, setShowPay] = useState(false)
|
||||
|
||||
//显示线下汇款
|
||||
// 显示线下汇款
|
||||
const [showOffline, setShowOffine] = useState(false)
|
||||
return (
|
||||
<View>
|
||||
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
|
||||
<Search handScan={() => handScan()} defaultValue={searchField.order_no} showScan placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300}>
|
||||
<Search handScan={() => handScan()} defaultValue={searchField.order_no} showScan placeholder="搜索商品/名称/颜色/订单号" showBtn={false} changeOnSearch={getSearchData} debounceTime={300}>
|
||||
<View className={styles.flexBox} onClick={() => showSelctPopup()}>
|
||||
<IconFont name='icon-shaixuan' size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles['activeshaixuan']} />
|
||||
<IconFont name="icon-shaixuan" size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles.activeshaixuan} />
|
||||
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
|
||||
<View className={classnames(isDisabled ? styles.shaixuan : styles.activeshai)}>筛选</View>
|
||||
</View>
|
||||
@@ -612,9 +610,10 @@ export default () => {
|
||||
<InfiniteScroll
|
||||
statusMore={statusMore}
|
||||
selfonScrollToLower={getScrolltolower}
|
||||
refresherEnabled={true}
|
||||
refresherEnabled
|
||||
refresherTriggered={refresherTriggeredStatus}
|
||||
selfOnRefresherRefresh={getRefresherRefresh}>
|
||||
selfOnRefresherRefresh={getRefresherRefresh}
|
||||
>
|
||||
{orderData?.list?.map((item, index) => {
|
||||
return (
|
||||
<View key={item.id} className={styles.order_item_con}>
|
||||
@@ -623,14 +622,15 @@ export default () => {
|
||||
key={index}
|
||||
cancle={(e, item) => cancle(e, item)}
|
||||
nextBuy={(e, item) => nextBuy(e, item)}
|
||||
toPay={(e, item) => toPay(e, item)}></ItemList>
|
||||
toPay={(e, item) => toPay(e, item)}
|
||||
></ItemList>
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
</InfiniteScroll>
|
||||
{/* <View className={styles.kongboxTwo}></View> */}
|
||||
</View>
|
||||
<Popup title={'筛选订单'} show={showPopup} onClose={() => closePopup()}>
|
||||
<Popup title="筛选订单" show={showPopup} onClose={() => closePopup()}>
|
||||
<View className={styles.popupBox}>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.leftTop} onClick={() => navTo(1)}>
|
||||
@@ -658,7 +658,8 @@ export default () => {
|
||||
handCheckMode(item)
|
||||
}}
|
||||
className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)}
|
||||
key={index}>
|
||||
key={index}
|
||||
>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
@@ -675,7 +676,8 @@ export default () => {
|
||||
handCheckDelivery(item)
|
||||
}}
|
||||
className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)}
|
||||
key={index}>
|
||||
key={index}
|
||||
>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
@@ -690,7 +692,8 @@ export default () => {
|
||||
className={styles.resetBox}
|
||||
onClick={() => {
|
||||
handReset()
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
{' '}
|
||||
重置
|
||||
</Button>
|
||||
@@ -699,7 +702,8 @@ export default () => {
|
||||
disabled={isDisabled}
|
||||
onClick={() => {
|
||||
handSure?.()
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
{' '}
|
||||
确认
|
||||
</Button>
|
||||
@@ -712,11 +716,12 @@ export default () => {
|
||||
obj={itemObj}
|
||||
showPopup={showPay}
|
||||
popupClose={() => setShowPay(false)}
|
||||
clickItem={(item) => clickItem(item)}
|
||||
handsurePay={(obj) => handsurePay(obj)}
|
||||
clickItem={item => clickItem(item)}
|
||||
handsurePay={obj => handsurePay(obj)}
|
||||
showSide={showSide}
|
||||
title={title}
|
||||
picUrl={picUrl}></PayPopup>
|
||||
picUrl={picUrl}
|
||||
></PayPopup>
|
||||
<OfflinePay show={showOffline} onClose={() => setShowOffine(false)} offlineInfo={itemObj}></OfflinePay>
|
||||
</View>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user