feat(预览码单对接):

This commit is contained in:
czm 2023-01-03 14:42:14 +08:00
parent 65462bd077
commit af03e5fdd3
12 changed files with 105 additions and 22 deletions

View File

@ -4,7 +4,7 @@
// 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.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 = `http://192.168.1.9:40001/lymarket` // 发
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
@ -14,7 +14,7 @@ export const BASE_URL = 'https://test.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.28:50002/lymarket' // 婷
// export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰
export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰
// CDN
// 生成密钥
@ -28,8 +28,8 @@ export const SEARCH_EMPTY_IMAGE = `${IMG_CND_Prefix}/search_empty.png`
export const COLLECTION_EMPTY_IMAGE = `${IMG_CND_Prefix}/mall/collection_empty.png`
// 在线支付图片baseUrl
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL
// export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081'
// export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL
export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081'
// 获取CND资源
export const getCDNSource = (suffix: string) => {
return IMG_CND_Prefix + suffix

View File

@ -133,6 +133,8 @@ Readonly<AtCalendarBodyState>
true,
)
console.log('nowList:::', selectedDate)
const nextList: Calendar.ListInfo<Calendar.Item> = this.generateFunc(
dayjsDate.add(1, 'month').valueOf(),
selectedDate,
@ -259,7 +261,6 @@ Readonly<AtCalendarBodyState>
public render(): JSX.Element {
const { isSwiper } = this.props
const { isAnimate, offsetSize, listGroup } = this.state
if (!isSwiper) {
return (
<View

View File

@ -159,6 +159,7 @@ Readonly<AtCalendarState>
end = start
}
console.log('generateDateValue:::', generateDateValue)
return {
generateDate: generateDateValue,
selectedDate: this.getSelectedDate(start, end),

View File

@ -34,7 +34,6 @@ export default class AtCalendarList extends React.Component<Props> {
public render(): JSX.Element | null {
const { list } = this.props
if (!list || list.length === 0) { return null }
return (
<View className="at-calendar__list flex">
{list.map((item: Calendar.Item) => (

View File

@ -1,5 +1,5 @@
import { View } from '@tarojs/components'
import { memo, useState } from 'react'
import { memo, useMemo, useState } from 'react'
import dayjs from 'dayjs'
import NormalButton from '../normalButton'
import styles from './index.module.scss'
@ -34,6 +34,9 @@ const TimePicker = (props: Props) => {
console.log('e===>', e)
setTime(e)
}
const currentDate = useMemo(() => {
return (!start && !end) ? null : { start, end }
}, [props])
// 由于小程序的bug部分ios和安卓显示时间的时候会有问题原因是格式化时有`-`这个横杠
return (
<>
@ -41,10 +44,7 @@ const TimePicker = (props: Props) => {
<AtCalendar
isMultiSelect
format="YYYY-MM-DD 00:00:00"
currentDate={{
start,
end,
}}
currentDate={currentDate}
onSelectDate={e => handTime(e)}
/>
</View>

View File

@ -23,6 +23,7 @@ export default (props: Props) => {
// 手机号
const userPhone = (addressInfo) => {
if (addressInfo.purchaser_phone) { return addressInfo.purchaser_phone }
return addressInfo?.shipment_mode == 2 ? props.orderObj.target_user_phone : props.orderObj.take_goods_phone
}
@ -41,6 +42,11 @@ export default (props: Props) => {
return addressInfo?.shipment_mode == 2 ? props?.orderObj.target_user_name : ''
}
// 显示隐藏
const showStatus = (state: boolean) => {
return (state !== false && state !== true) ? true : state
}
// 预览图片
const showImage = (e) => {
e.stopPropagation()
@ -92,6 +98,7 @@ export default (props: Props) => {
client: props.orderObj.purchaser_name, // 客户名称
phone: userPhone(props.orderObj), // 收货手机号码
order_total_length: (props.orderObj.total_number / 100).toString(), // 订单布匹长度
order_total_num: `${props.orderObj.total_number}`,
order_total_price: formatPriceDiv(props.orderObj.bill_total_sale_price).toString(), // 订单价格
qrcode: `${PAY_H5_CODE_URL}?key=${props.orderObj.md5_key}`, // 跳转链接
order_total_weight: formatWeightDiv(props.orderObj.total_weight || props.orderObj.total_estimate_weight).toString(), // 订单布匹重量
@ -104,8 +111,12 @@ export default (props: Props) => {
show_deduction_amount: false,
show_sale_price: props.orderObj.is_display_price,
show_barcode: true, // 条形码
show_qrcode: true,
show_barcode: showStatus(props.orderObj.show_barcode), // 条形码
show_qrcode: showStatus(props.orderObj.show_qrcode),
show_pay_type: showStatus(props.orderObj.show_pay_type), // 是否显示结算方式
show_order_no: showStatus(props.orderObj.show_order_no), // 是否显示订单号
show_shipment_mode: showStatus(props.orderObj.show_shipment_mode), // 是否显示发货方式
}
const res = await fetchData(query)
if (res.data) {

View File

@ -8,7 +8,11 @@ import SelectList from '@/components/selectList'
import Search from '@/components/search'
import { GetCustomCodeLApi } from '@/api/codeManage'
export default () => {
interface ParamType {
onClickData: () => void
}
export default (props: ParamType) => {
const { onClickData } = props
const [formData, setFormData] = useState<{ sale_start_time?: string; sale_end_time?: string; any_query?: string }|null>(null)
// 获取码单列表
const [list, setList] = useState<any[]>([])
@ -33,7 +37,7 @@ export default () => {
return <View>
<View className={styles.code_list_search}>
<View className={styles['code_list_search--code']}><Search placeholder="请输入单据抬头/客户/单号" changeOnSearch={onSearch} debounceTime={300} /></View>
<View className={styles['code_list_search--data']}>
<View className={styles['code_list_search--data']} onClick={onClickData}>
<IconFont name="icon-riqi" size={43} />
<Text></Text>
</View>

View File

@ -14,9 +14,9 @@ export default () => {
]
const [selectIndex, setSelectIndex] = useState(1)
return <View className={styles.code_list__main}>
{selectIndex == 1 && <SelectList list={selectList} defaultIndex={selectIndex} onSelect={index => setSelectIndex(index)} />}
<SelectList list={selectList} defaultIndex={selectIndex} onSelect={index => setSelectIndex(index)} />
{selectIndex == 1 && <CodeModel />}
{selectIndex == 2 && <CompanyModel />}
<TimePickerPopup showTime />
{/* <TimePickerPopup showTime={showTime} closePopup={handClose} onSelectDate={onSelectDate} /> */}
</View>
}

View File

@ -4,6 +4,9 @@
padding-bottom: 200px;
min-height: 100vh;
box-sizing: border-box;
.loading_card {
height: 70vh;
}
.bottom_btn {
display: flex;
justify-content: space-between;

View File

@ -1,9 +1,10 @@
import { Text, View } from '@tarojs/components'
import Taro, { getCurrentPages, useDidHide } from '@tarojs/taro'
import { useEffect } from 'react'
import { useEffect, useState, useTransition } from 'react'
import ColorItemSetting from '../../../components/colorItemSetting'
import styles from './index.module.scss'
import { useCurrenCode } from '@/context/ContextCodeSetting'
import LoadingCard from '@/components/loadingCard'
export default () => {
const { dispatch, productData } = useCurrenCode()
@ -16,13 +17,21 @@ export default () => {
dispatch({ type: 'updateData', data: { ...productData.data }, update_status: 1 })
Taro.navigateBack()
}
const [colorData, setColorData] = useState([])
const [isPending, startTransition] = useTransition()
useEffect(() => {
startTransition(() => {
setColorData(productData.color_item_data)
})
return () => {
dispatch({ type: 'updateColorData', data: null })
}
}, [])
return <View className={styles.main}>
<ColorItemSetting />
{isPending || colorData.length == 0
? <View className={styles.loading_card}><LoadingCard /></View>
: <ColorItemSetting productInfo={colorData} />}
<View >
<View className={styles.bottom_btn}>
<Text onClick={cancel}></Text>

View File

@ -8,10 +8,11 @@ import PopupModal from '@/components/popupModal'
interface IndexParam {
productInfo: any
onChangeName: (val: string) => void
onChangeName?: (val: string) => void
}
export default memo(() => {
export default memo((props: IndexParam) => {
const { productInfo } = props
const { dispatch, productData } = useCurrenCode()
const getNewName = useCallback((name) => {
productData.color_item_data = {
@ -19,7 +20,7 @@ export default memo(() => {
product_name: name,
}
dispatch({ type: 'updateColorData', data: { ...productData.color_item_data }, update_status: 2 })
}, [productData.color_item_data])
}, [productInfo])
return <>
<Index productInfo={productData.color_item_data} onChangeName={getNewName} />

View File

@ -15,7 +15,26 @@ import { formatPriceDiv, formatWeightDiv } from '@/common/fotmat'
import { useCurrenCode } from '@/context/ContextCodeSetting'
import { alert } from '@/common/common'
import LoadingCard from '@/components/loadingCard'
import ViewCodeList from '@/components/viewCodeList'
interface previewParam {
dyelot_number_list: any[]
total_number: number
title: string
sale_mode_name: string
purchaser_name: string
purchaser_phone: string
create_time: string
bill_total_sale_price: number
total_weight: number
total_settle_weight: number
total_weight_error: number
show_pay_type: boolean
show_order_no: boolean
show_shipment_mode: boolean
show_barcode: boolean
show_qrcode: boolean
}
export default () => {
const { productData, dispatch } = useCurrenCode()
const { custom_print_id, sale_order_id } = useRouter().params
@ -90,6 +109,24 @@ export default () => {
total_sale_weight: codeData.total_sale_weight,
total_amount: codeData.total_amount,
}))
setPreviewData({
dyelot_number_list: codeData.dyelot_number_list,
total_number: codeData.roll,
title: codeData.purchaser_name,
sale_mode_name: codeData.sale_mode_name,
purchaser_name: codeData.purchaser_name,
purchaser_phone: codeData.purchaser_phone,
create_time: codeData.create_time,
bill_total_sale_price: codeData.total_amount,
total_weight: codeData.total_sale_weight,
total_settle_weight: codeData.total_settlement_weight,
total_weight_error: codeData.total_weight_error,
show_pay_type: false,
show_order_no: false,
show_shipment_mode: false,
show_barcode: false,
show_qrcode: false,
})
}
}, [codeData])
@ -128,6 +165,9 @@ export default () => {
else if (type === 'del') {
deleteCode()
}
else if (type === 'preview') {
setshowPopup(true)
}
})()
}
@ -155,6 +195,14 @@ export default () => {
total_sale_weight: res?.data?.total_sale_weight,
total_amount: res?.data?.total_amount,
}))
setPreviewData(e => ({
...e,
bill_total_sale_price: res?.data?.total_amount,
total_weight: res?.data?.total_sale_weight,
total_settle_weight: res?.data?.total_settlement_weight,
total_weight_error: res?.data?.total_weight_error,
dyelot_number_list: res?.data?.dyelot_number_list,
}))
}
}
@ -178,6 +226,11 @@ export default () => {
})
}
// 获取预览码单数据
const [previewData, setPreviewData] = useState<previewParam|{}>({})
const [showPopup, setshowPopup] = useState(false)
return <View className={styles.code_list__main}>
<View className={styles.code_list__head}>
<PayeeHead defaultValue={company} onSelect={getCompany} />
@ -227,6 +280,7 @@ export default () => {
</View>
</View>}
<BottomBtn delStatus={!!productData.custom_print_id} onClick={onBottomClick} />
<ViewCodeList orderObj={previewData} showPopup={showPopup} handClose={() => setshowPopup(false)}></ViewCodeList>
<View className="common_safe_area_y"></View>
</View>
}