diff --git a/src/api/cutSample.ts b/src/api/cutSample.ts index 000cdc1..d307efa 100644 --- a/src/api/cutSample.ts +++ b/src/api/cutSample.ts @@ -29,7 +29,7 @@ export const GetCutSampleOrderStatusApi = () => { export const CutSampleOrderCancelApi = () => { return request({ url: '/v1/mall/cutSampleOrder/cancel', - method: 'post', + method: 'put', }) } @@ -43,3 +43,25 @@ export const GetSampleOrderProductApi = () => { method: 'get', }) } + +/** + * 获取剪样订单详情 + * @returns + */ +export const GetCutSampleOrderDetailApi = () => { + return request({ + url: '/v1/mall/cutSampleOrder/detail', + method: 'get', + }) +} + +/** + * 提交订单 + * @returns + */ +export const submitCutSampleOrderApi = () => { + return request({ + url: '/v1/mall/cutSampleOrder/submit', + method: 'post', + }) +} diff --git a/src/common/constant.ts b/src/common/constant.ts index ee58dd1..8bf8ccd 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -5,7 +5,7 @@ // 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://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` // 发 @@ -13,7 +13,7 @@ // 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.28:50001/lymarket' // 婷 +// export const BASE_URL = 'http://192.168.1.28:50001/lymarket' // 婷 // export const BASE_URL = 'http://192.168.1.42:50002/lymarket' // 杰 // CDN diff --git a/src/components/counter/index.tsx b/src/components/counter/index.tsx index 7a758a1..647b015 100644 --- a/src/components/counter/index.tsx +++ b/src/components/counter/index.tsx @@ -70,6 +70,7 @@ const CounterDisplayName = (props: params) => { if (!isInteger(num_res)) { num_res = Math.trunc(num_res) } + if (num_res > maxNum) { onMax?.() } num_res = num_res >= maxNum ? maxNum : num_res setValue({ ...value, count: num_res }) onChange?.(parseFloat(num_res)) diff --git a/src/components/infiniteScroll/index.tsx b/src/components/infiniteScroll/index.tsx index b432d5c..f119bcf 100644 --- a/src/components/infiniteScroll/index.tsx +++ b/src/components/infiniteScroll/index.tsx @@ -5,7 +5,7 @@ import LoadingCard from '../loadingCard' import style from './index.module.scss' import DotLoading from '@/components/dotLoading' import Empty from '@/components/empty' -import { SEARCH_EMPTY_IMAGE } from '@/common/constant' +import { IMG_CND_Prefix, SEARCH_EMPTY_IMAGE } from '@/common/constant' export type StatusParam = 0 | 1 | 2 | 3 @@ -32,6 +32,8 @@ interface Params { moreText?: string loadingText?: string noMoreText?: string + defaultUrl?: string + defaultText?: string } const InfiniteScroll = ({ styleObj, @@ -53,6 +55,8 @@ const InfiniteScroll = ({ statusMore = 0, enableBackToTop = true, emptySlot, + defaultUrl = '', + defaultText = '', }: Params) => { const scrollToLower = () => { selfonScrollToLower?.() @@ -113,7 +117,7 @@ const InfiniteScroll = ({ )} {statusMore == 0 && } - {statusMore == 1 && (emptySlot || )} + {statusMore == 1 && (emptySlot || )} ) } diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx index e5dc9f6..21e18fe 100644 --- a/src/components/moveBtn/index.tsx +++ b/src/components/moveBtn/index.tsx @@ -126,7 +126,7 @@ const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], m x="630rpx" y={`${screenHeight.customer}rpx`} > - + } {showCode && } diff --git a/src/components/popupSelectColor/index.tsx b/src/components/popupSelectColor/index.tsx index 0f98c08..16e9418 100644 --- a/src/components/popupSelectColor/index.tsx +++ b/src/components/popupSelectColor/index.tsx @@ -93,8 +93,6 @@ export default memo((props: Param) => { if (item.status) { data.push({ ...item, count: 1 }) } }) onSelected?.(data) - // Taro.setStorageSync('cutSample', JSON.stringify(data)) - // goLink('/pages/cutSampleListOrder/index') } return @@ -125,7 +123,6 @@ interface ColorItemCom { } const ColorSelectItem = memo((props: ColorItemCom) => { const { item, onSelect } = props - console.log('abcedef', item) return onSelect?.(item)}> { const [searchData, setSearchData] = useState<{ status?: number; page: number; size: number }>({ @@ -99,10 +98,6 @@ export default () => { {statusList.map(item => changeStatus(item.id)} className={classNames(styles.btn_item, searchData.status === item.id && styles.select_ed)}>{item.name})} - {false && - - 还没有领取过色卡 - } { selfonScrollToLower={getScrolltolower} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh} + defaultUrl="/color_card/colorCardList_empty.png" + defaultText="还没领取过色卡" > {orderData.list?.map((item) => { return ( diff --git a/src/pages/colorCardClipping/components/cutProductItem/index.module.scss b/src/pages/colorCardClipping/components/cutProductItem/index.module.scss index 3fee18a..6f68caf 100644 --- a/src/pages/colorCardClipping/components/cutProductItem/index.module.scss +++ b/src/pages/colorCardClipping/components/cutProductItem/index.module.scss @@ -31,7 +31,7 @@ height: 134px; } .item_con_desc { - width: 100%; + flex: 1; display: flex; flex-direction: column; justify-content: space-between; diff --git a/src/pages/colorCardClipping/components/cutProductItem/index.tsx b/src/pages/colorCardClipping/components/cutProductItem/index.tsx index dd37b9e..71c7f54 100644 --- a/src/pages/colorCardClipping/components/cutProductItem/index.tsx +++ b/src/pages/colorCardClipping/components/cutProductItem/index.tsx @@ -51,14 +51,22 @@ export default (props: Param) => { e.stopPropagation() onCancel?.(id) } - return goLink('/pages/colorCardOrderDetail/index', { id: value.order_id })} > + + const labAndImgObj = useMemo( + () => { + const res = value.cut_sample_order_product_list[0] + return { lab: res.lab, rgb: res.rgb, texture_url: res.texture_url } + }, + [value], + ) + return goLink('/pages/cutSampleListOrderDetail/index', { id: value.order_id })} > 单号:{value.order_no} {value.mp_cut_sample_audit_status_name} - + diff --git a/src/pages/colorCardClipping/components/cutSampleList/index.tsx b/src/pages/colorCardClipping/components/cutSampleList/index.tsx index 4fd8f5c..6c68ec9 100644 --- a/src/pages/colorCardClipping/components/cutSampleList/index.tsx +++ b/src/pages/colorCardClipping/components/cutSampleList/index.tsx @@ -8,7 +8,6 @@ import styles from './index.module.scss' import InfiniteScroll from '@/components/infiniteScroll' import { alert, goLink } from '@/common/common' import { dataLoadingStatus, getFilterData } from '@/common/util' -import kong from '@/styles/image/kong.png' import { CutSampleOrderCancelApi, GetCutSampleOrderListApi, GetCutSampleOrderStatusApi } from '@/api/cutSample' export default () => { @@ -99,10 +98,6 @@ export default () => { {statusList.map(item => changeStatus(item.id)} className={classNames(styles.btn_item, searchData.mp_cut_sample_audit_status === item.id && styles.select_ed)}>{item.name})} - {false && - - 还没有领取过色卡 - } { selfonScrollToLower={getScrolltolower} refresherTriggered={refresherTriggeredStatus} selfOnRefresherRefresh={getRefresherRefresh} + defaultUrl="/color_card/colorCardList_empty.png" + defaultText="还没领取过剪样" + > {orderData.list?.map((item) => { return ( diff --git a/src/pages/colorCardClipping/components/productItem/index.module.scss b/src/pages/colorCardClipping/components/productItem/index.module.scss index a751877..ea6474c 100644 --- a/src/pages/colorCardClipping/components/productItem/index.module.scss +++ b/src/pages/colorCardClipping/components/productItem/index.module.scss @@ -31,7 +31,7 @@ height: 134px; } .item_con_desc { - width: 100%; + flex: 1; display: flex; flex-direction: column; justify-content: space-between; diff --git a/src/pages/colorCardClipping/components/productItem/index.tsx b/src/pages/colorCardClipping/components/productItem/index.tsx index d35680e..aba3b83 100644 --- a/src/pages/colorCardClipping/components/productItem/index.tsx +++ b/src/pages/colorCardClipping/components/productItem/index.tsx @@ -39,6 +39,14 @@ export default (props: Param) => { e.stopPropagation() onCancel?.(id) } + const labAndImgObj = useMemo( + () => { + const res = value.color_card_info[0] + return { lab: res.lab, rgb: res.rgb, texture_url: res.texture_url } + }, + [value], + ) + return goLink('/pages/colorCardOrderDetail/index', { id: value.order_id })} > 单号:{value.order_no} @@ -46,7 +54,7 @@ export default (props: Param) => { - + diff --git a/src/pages/colorCardClipping/index copy.tsx b/src/pages/colorCardClipping/index copy.tsx index ea1ebcd..a1329da 100644 --- a/src/pages/colorCardClipping/index copy.tsx +++ b/src/pages/colorCardClipping/index copy.tsx @@ -6,7 +6,6 @@ import styles from './index.module.scss' import type { ParamItem } from './components/productItem' import ProductItem from './components/productItem' import SelectList from '@/components/selectList' -import kong from '@/styles/image/kong.png' import InfiniteScroll from '@/components/infiniteScroll' import { alert, goLink } from '@/common/common' import { ColorCardOrderCancelApi, GetColorCardOrderApi, GetColorCardOrderStatusApi } from '@/api/colorCard' @@ -107,10 +106,6 @@ export default () => { {statusList.map(item => changeStatus(item.id)} className={classNames(styles.btn_item, searchData.status === item.id && styles.select_ed)}>{item.name})} - {false && - - 还没有领取过色卡 - } { const [selectIndex, setSelectIndex] = useState(1) diff --git a/src/pages/colorCardList/components/productItem/index.module.scss b/src/pages/colorCardList/components/productItem/index.module.scss index f536c0f..f663fb2 100644 --- a/src/pages/colorCardList/components/productItem/index.module.scss +++ b/src/pages/colorCardList/components/productItem/index.module.scss @@ -5,6 +5,21 @@ .image { width: 144px; height: 144px; + position: relative; + text { + height: 38px; + background: rgba(0, 0, 0, 0.55); + border-radius: 0px 0px 10px 10px; + font-size: 24px; + display: inline-block; + position: absolute; + color: #fff; + bottom: 0; + left: 0; + text-align: center; + width: 100%; + line-height: 38px; + } } .card_info { margin-left: 24px; diff --git a/src/pages/colorCardList/components/productItem/index.tsx b/src/pages/colorCardList/components/productItem/index.tsx index d003b89..d115b61 100644 --- a/src/pages/colorCardList/components/productItem/index.tsx +++ b/src/pages/colorCardList/components/productItem/index.tsx @@ -1,5 +1,5 @@ import { Text, View } from '@tarojs/components' -import { memo, useState } from 'react' +import { memo, useCallback, useMemo, useState } from 'react' import styles from './index.module.scss' import LabAndImg from '@/components/LabAndImg' import Checkbox from '@/components/checkbox' @@ -36,9 +36,16 @@ export default memo((props: ParamType) => { props.onSelect?.(props, false) setCheckStatus(false) } + const labAndImgObj = useMemo( + () => { + return { lab: props.lab, rgb: props.rgb, texture_url: props.texture_url } + }, + [props], + ) return - + + {affiliation_product.length > 1 && 多面料共用} {color_card_name} diff --git a/src/pages/colorCardList/index.tsx b/src/pages/colorCardList/index.tsx index bfb102a..9ac17b8 100644 --- a/src/pages/colorCardList/index.tsx +++ b/src/pages/colorCardList/index.tsx @@ -9,6 +9,7 @@ import InfiniteScroll from '@/components/infiniteScroll' import Search from '@/components/search' import { GetColorCardApi } from '@/api/colorCard' import { dataLoadingStatus, getFilterData } from '@/common/util' +import { alert } from '@/common/common' export default () => { const { fetchData, state: cardState } = GetColorCardApi() @@ -81,6 +82,7 @@ export default () => { } const onSubmit = () => { + if (selectList.length <= 0) { return alert.none('请选择色卡') } selectList?.map((item) => { item.count = 1 }) diff --git a/src/pages/colorCardOrder/components/address/index.module.scss b/src/pages/colorCardOrder/components/address/index.module.scss index ed1e78e..e34fc98 100644 --- a/src/pages/colorCardOrder/components/address/index.module.scss +++ b/src/pages/colorCardOrder/components/address/index.module.scss @@ -7,6 +7,7 @@ display: flex; flex-direction: column; width: 100%; + flex: 1; margin-left: 24px; .info_address { font-size: 28px; diff --git a/src/pages/colorCardOrder/components/address/index.tsx b/src/pages/colorCardOrder/components/address/index.tsx index 26c560e..59e5e34 100644 --- a/src/pages/colorCardOrder/components/address/index.tsx +++ b/src/pages/colorCardOrder/components/address/index.tsx @@ -52,7 +52,7 @@ export default (props: Param) => { } return <> setShowList(true)}> - + {data.address_title || '请选择收货地址'} diff --git a/src/pages/colorCardOrder/components/productCard/index.module.scss b/src/pages/colorCardOrder/components/productCard/index.module.scss index 3d975ba..9b4f2b3 100644 --- a/src/pages/colorCardOrder/components/productCard/index.module.scss +++ b/src/pages/colorCardOrder/components/productCard/index.module.scss @@ -14,14 +14,32 @@ flex: 1; font-size: 28px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); + display: flex; + .card_info_label { + display: grid; + grid-template-columns: repeat(3, 100px); + grid-gap: 10px 10px; + margin-top: 10px; + text { + font-size: 24px; + color: #4581ff; + height: 34px; + text-align: center; + line-height: 34px; + background-color: rgba(69, 129, 255, 0.15); + border-radius: 8px; + } + } .btns { width: 100%; display: flex; justify-content: flex-end; } .count_btn { - margin-top: 27px; + padding-bottom: 10px; width: 170px; + display: flex; + align-items: flex-end; } } } diff --git a/src/pages/colorCardOrder/components/productCard/index.tsx b/src/pages/colorCardOrder/components/productCard/index.tsx index b3e97a7..941b6e6 100644 --- a/src/pages/colorCardOrder/components/productCard/index.tsx +++ b/src/pages/colorCardOrder/components/productCard/index.tsx @@ -4,6 +4,7 @@ import { memo, useCallback, useEffect, useState } from 'react' import styles from './index.module.scss' import Counter from '@/components/counter' import LabAndImg from '@/components/LabAndImg' +import { alert } from '@/common/common' interface ProductItemParamType { code: string @@ -35,7 +36,9 @@ export default memo((props: Param) => { const ProductItem = memo((props: Param) => { const { value } = props const labAndImgObj = useCallback( + (item) => { + console.log('item:::', item) return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } }, [value], @@ -43,7 +46,6 @@ const ProductItem = memo((props: Param) => { const onChangeNum = (num) => { props.onChangeNum?.({ id: value.id, count: num }) } - console.log('测试:::', value) const onMin = () => { Taro.showModal({ title: '确认删除所选色卡?', @@ -57,11 +59,22 @@ const ProductItem = memo((props: Param) => { }, }) } + const onMax = () => { + alert.none('最多领取2份') + } return <> - + + + - {value.color_card_name} + + {value.color_card_name} + + {value.affiliation_product?.map(item => {item.code})} + + + { onBlue={onChangeNum} unit="件" onMin={onMin} + onMax={onMax} /> diff --git a/src/pages/colorCardOrder/index.tsx b/src/pages/colorCardOrder/index.tsx index 244cbfc..a098ab1 100644 --- a/src/pages/colorCardOrder/index.tsx +++ b/src/pages/colorCardOrder/index.tsx @@ -12,6 +12,7 @@ import { SubmitColorCardApi } from '@/api/colorCard' import { getFilterData } from '@/common/util' import { UseSubscriptionMessage } from '@/use/useCommon' import { SUBSCRIPTION_MESSAGE_SCENE } from '@/common/enum' +import { addressListApi } from '@/api/addressManager' export interface submitData { address_id: number @@ -36,9 +37,15 @@ export default () => { const info = Taro.getStorageSync('colorCardOther') ? JSON.parse(Taro.getStorageSync('colorCardOther')) : {} setList(() => list) computeCount(list) - setAddressInfo(info.address) + if (info.address) { + setAddressInfo(info.address) + submitData.current.address_id = info?.address?.id || 0 + } + else { + getAddressDefault() + } setRemarkData(info.remark) - submitData.current.address_id = info?.address?.id || 0 + Taro.removeStorageSync('colorCard') Taro.removeStorageSync('colorCardOther') }) @@ -106,6 +113,23 @@ export default () => { setRemarkData(e) } + // 获取默认地址 + const { fetchData: addressListFetchData, state } = addressListApi() + const getAddressDefault = async() => { + const res = await addressListFetchData() + let defaultInfo: AddressItem|null = null + res?.data.list?.map((item) => { + defaultInfo = { + id: item.id, + address_title: item.province_name + item.city_name + item.district_name + item.address_detail, + address_name: item.name, + address_phone: item.phone, + } + }) + submitData.current.address_id = defaultInfo!.id + setAddressInfo(defaultInfo!) + } + return
添加色卡 diff --git a/src/pages/cutSampleList/components/productItem/index.tsx b/src/pages/cutSampleList/components/productItem/index.tsx index d41b8bf..5719ee8 100644 --- a/src/pages/cutSampleList/components/productItem/index.tsx +++ b/src/pages/cutSampleList/components/productItem/index.tsx @@ -1,5 +1,5 @@ import { Text, View } from '@tarojs/components' -import { memo, useState } from 'react' +import { memo, useMemo, useState } from 'react' import PopupSelectColor from '../popupSelectColor' import styles from './index.module.scss' import LabAndImg from '@/components/LabAndImg' @@ -53,10 +53,15 @@ export default memo((props: ParamType) => { props.onSelect?.(productItem) setCheckStatus(true) } - + const labAndImgObj = useMemo( + () => { + return { lab: productItem?.lab, rgb: productItem?.rgb, texture_url: productItem?.texture_url } + }, + [productItem], + ) return - + {productItem?.product_color_count}色 diff --git a/src/pages/cutSampleList/index.tsx b/src/pages/cutSampleList/index.tsx index b7c0135..7bfe012 100644 --- a/src/pages/cutSampleList/index.tsx +++ b/src/pages/cutSampleList/index.tsx @@ -11,7 +11,7 @@ import InfiniteScroll from '@/components/infiniteScroll' import Search from '@/components/search' import { dataLoadingStatus, getFilterData } from '@/common/util' import { GetSampleOrderProductApi } from '@/api/cutSample' -import { goLink } from '@/common/common' +import { alert, goLink } from '@/common/common' export default () => { const { fetchData, state: cardState } = GetSampleOrderProductApi() @@ -19,36 +19,39 @@ export default () => { list: [], total: 0, }) - const [searchData, setSearchData] = useState<{ color_card_ids?: number[]; product_code_and_name?: string; page: number; size: number }>({ + const [searchData, setSearchData] = useState<{ product_ids?: string; product_code_and_name?: string; page: number; size: number }>({ page: 1, size: 10, }) const shopColorCardData = useRef([]) - // 获取已加入购物车的数据id - const getShopId = () => { - if (shopColorCardData.current.length <= 0) { return null } - return shopColorCardData.current?.map((item) => { - return item.id - }) - } - // 获取数据 const getGetColorCard = async() => { - const { data } = await fetchData(getFilterData({ ...searchData, color_card_ids: getShopId() })) + const { data } = await fetchData(getFilterData({ ...searchData })) setOrderData(() => ({ list: data.list, total: data.total })) setRefresherTriggeredStatus(() => false) } useEffect(() => { - if (Taro.getStorageSync('cutSample') && shopColorCardData.current.length <= 0) { - shopColorCardData.current = Taro.getStorageSync('cutSample') ? JSON.parse(Taro.getStorageSync('cutSample')) : [] - // Taro.removeStorageSync('cutSample') - } getGetColorCard() }, [searchData]) + useEffect(() => { + if (Taro.getStorageSync('cutSample')) { + const res = Taro.getStorageSync('cutSample') ? JSON.parse(Taro.getStorageSync('cutSample')) : [] + const selectProsuctIds: number[] = [] + res.map((item) => { + selectProsuctIds.push(item.id) + }) + setSelectProsuctIds(selectProsuctIds) + setSelectProcutColors(res) + if (selectProsuctIds.length > 0) { + setSearchData(e => ({ ...e, product_ids: selectProsuctIds.join(',') })) + } + } + }, []) + const getSearch = (con) => { setSearchData(e => ({ ...e, product_code_and_name: con })) } @@ -56,9 +59,6 @@ export default () => { setSearchData(e => ({ ...e, product_code_and_name: '' })) } - // 选择的数据 - const [selectList, setSelectList] = useState([]) - // 数据加载状态 const statusMore = useMemo(() => { return dataLoadingStatus({ list: orderData.list, total: cardState.total, status: cardState.loading }) @@ -83,7 +83,8 @@ export default () => { } const onSubmit = () => { - Taro.setStorageSync('cutSample', JSON.stringify([...selectProcutColors, ...shopColorCardData.current])) + if (selectProcutColors.length <= 0) { return alert.none('请选择剪样') } + Taro.setStorageSync('cutSample', JSON.stringify([...selectProcutColors])) Taro.redirectTo({ url: '/pages/cutSampleListOrder/index', }) @@ -114,11 +115,11 @@ export default () => { const [selectColorIds, setSelectColorIds] = useState([]) const onSelected = (val: ColorItem[]) => { val.map((item) => { - item.count = 1 + if (!item.count) { item.count = 1 } }) const pIndex = selectProcutColors?.findIndex(item => item.id === selectItem?.id) if (pIndex === -1) { - const data: ParamItem&{ colors: ColorItem[] } = { ...selectItem } + const data: any = { ...selectItem } data.colors = val selectProcutColors.push(data) } @@ -135,7 +136,7 @@ export default () => { return - + 取消 @@ -145,6 +146,7 @@ export default () => { statusMore={statusMore} refresherEnabled selfOnRefresherRefresh={getRefresherRefresh} + > {orderData.list?.map((item) => { return ( diff --git a/src/pages/cutSampleListOrder/components/address/index.module.scss b/src/pages/cutSampleListOrder/components/address/index.module.scss index ed1e78e..97c83af 100644 --- a/src/pages/cutSampleListOrder/components/address/index.module.scss +++ b/src/pages/cutSampleListOrder/components/address/index.module.scss @@ -6,7 +6,7 @@ .message { display: flex; flex-direction: column; - width: 100%; + flex: 1; margin-left: 24px; .info_address { font-size: 28px; diff --git a/src/pages/cutSampleListOrder/components/address/index.tsx b/src/pages/cutSampleListOrder/components/address/index.tsx index 26c560e..59e5e34 100644 --- a/src/pages/cutSampleListOrder/components/address/index.tsx +++ b/src/pages/cutSampleListOrder/components/address/index.tsx @@ -52,7 +52,7 @@ export default (props: Param) => { } return <> setShowList(true)}> - + {data.address_title || '请选择收货地址'} diff --git a/src/pages/cutSampleListOrder/components/productCard/index.tsx b/src/pages/cutSampleListOrder/components/productCard/index.tsx index 2ece5e7..add70f3 100644 --- a/src/pages/cutSampleListOrder/components/productCard/index.tsx +++ b/src/pages/cutSampleListOrder/components/productCard/index.tsx @@ -5,6 +5,7 @@ import styles from './index.module.scss' import Counter from '@/components/counter' import LabAndImg from '@/components/LabAndImg' import { formatHashTag } from '@/common/fotmat' +import { alert } from '@/common/common' interface ProductItemParamType { code: string @@ -65,9 +66,12 @@ const ProductItem = memo((props: Param) => { }, }) } + const onMax = () => { + alert.none('最多领取2份') + } return <> - + {formatHashTag(value.code, value.name)} @@ -80,6 +84,7 @@ const ProductItem = memo((props: Param) => { onBlue={onChangeNum} unit="件" onMin={onMin} + onMax={onMax} /> diff --git a/src/pages/cutSampleListOrder/components/remark/index.module.scss b/src/pages/cutSampleListOrder/components/remark/index.module.scss index 2d34c54..b46782c 100644 --- a/src/pages/cutSampleListOrder/components/remark/index.module.scss +++ b/src/pages/cutSampleListOrder/components/remark/index.module.scss @@ -22,4 +22,7 @@ line-height: 82px; color: rgba(0, 0, 0, 0.4); } + .valuable { + color: rgba(0, 0, 0, 0.8); + } } diff --git a/src/pages/cutSampleListOrder/components/remark/index.tsx b/src/pages/cutSampleListOrder/components/remark/index.tsx index 9bce054..41c9e56 100644 --- a/src/pages/cutSampleListOrder/components/remark/index.tsx +++ b/src/pages/cutSampleListOrder/components/remark/index.tsx @@ -1,5 +1,6 @@ import { Text, View } from '@tarojs/components' import { useEffect, useState } from 'react' +import classNames from 'classnames' import styles from './index.module.scss' import Remark from '@/components/remark' @@ -25,7 +26,7 @@ export default (props: Param) => { 填写/修改备注 - {data || '尚未备注信息'} + {data || '尚未备注信息'} setShowRemark(false)} /> diff --git a/src/pages/cutSampleListOrder/index.module.scss b/src/pages/cutSampleListOrder/index.module.scss index 8df6368..7911afd 100644 --- a/src/pages/cutSampleListOrder/index.module.scss +++ b/src/pages/cutSampleListOrder/index.module.scss @@ -56,6 +56,9 @@ justify-content: space-between; width: 100%; height: 100px; + .numText { + color: #000; + } } text { font-size: 24px; diff --git a/src/pages/cutSampleListOrder/index.tsx b/src/pages/cutSampleListOrder/index.tsx index 5de99ef..90aa81a 100644 --- a/src/pages/cutSampleListOrder/index.tsx +++ b/src/pages/cutSampleListOrder/index.tsx @@ -13,11 +13,14 @@ import { getFilterData } from '@/common/util' import { UseSubscriptionMessage } from '@/use/useCommon' import { SUBSCRIPTION_MESSAGE_SCENE } from '@/common/enum' import { formatHashTag } from '@/common/fotmat' +import { submitCutSampleOrderApi } from '@/api/cutSample' +import { addressListApi } from '@/api/addressManager' export interface submitData { address_id: number - color_card_infos: { count: number; id: number }[] + cut_sample_order_product_color_list: { color_num: number; product_color_id: number }[] remark: string + shipment_mode: number } export interface ParamItem { @@ -47,8 +50,9 @@ export interface ParamItem { export default () => { const submitData = useRef({ address_id: 0, - color_card_infos: [], + cut_sample_order_product_color_list: [], remark: '', + shipment_mode: 2, }) const [addressInfo, setAddressInfo] = useState() @@ -59,39 +63,54 @@ export default () => { const [list, setList] = useState([]) useDidShow(() => { const list = Taro.getStorageSync('cutSample') ? JSON.parse(Taro.getStorageSync('cutSample')) : [] - const info = Taro.getStorageSync('colorCardOther') ? JSON.parse(Taro.getStorageSync('colorCardOther')) : {} + const info = Taro.getStorageSync('cutSampleOther') ? JSON.parse(Taro.getStorageSync('cutSampleOther')) : {} setList(() => list) computeCount(list) - setAddressInfo(info.address) + if (info.address) { + setAddressInfo(info.address) + submitData.current.address_id = info?.address?.id || 0 + } + else { + getAddressDefault() + } setRemarkData(info.remark) - submitData.current.address_id = info?.address?.id || 0 - // Taro.removeStorageSync('colorCard') - // Taro.removeStorageSync('colorCardOther') + + Taro.removeStorageSync('cutSample') + Taro.removeStorageSync('cutSampleOther') }) const onAddCard = () => { Taro.setStorageSync('cutSample', JSON.stringify(list)) - Taro.setStorageSync('colorCardOther', JSON.stringify({ address: addressInfo || {}, remark: submitData.current.remark })) + Taro.setStorageSync('cutSampleOther', JSON.stringify({ address: addressInfo || {}, remark: submitData.current.remark })) Taro.navigateTo({ - url: '/pages/colorCardList/index', + url: '/pages/cutSampleList/index', }) } const onDelData = useCallback((val: ParamItem) => { return (id: number) => { - console.log('lista:', list) const res = val.colors?.filter((citem) => { return citem.id != id }) - list?.map((item, index) => { - if (item.id === val.id) { - list[index] = { ...item, colors: [...res] } + if (res.length <= 0 && list.length === 1) { + return alert.none('不能删除最后一个剪样') + } + else { + if (res.length > 0) { + list?.map((item, index) => { + if (item.id === val.id) { + list[index] = { ...item, colors: [...res] } + } + }) + computeCount(list) + setList(() => [...list]) } - }) - // // // if (list.length === 1) { return alert.none('不能删除最后一个色卡') } - // console.log('listb:', list) - computeCount(list) - setList(() => [...list]) + else { + const data = list?.filter(item => item.id != val.id) + computeCount(data) + setList(() => [...data]) + } + } } }, [list]) @@ -128,13 +147,15 @@ export default () => { const { ColorCard } = SUBSCRIPTION_MESSAGE_SCENE const { openSubscriptionMessage } = UseSubscriptionMessage() - const { fetchData: submitFetchData } = SubmitColorCardApi() + const { fetchData: submitFetchData } = submitCutSampleOrderApi() const onSubmitData = async() => { - submitData.current.color_card_infos = [] + submitData.current.cut_sample_order_product_color_list = [] list?.map((item) => { - submitData.current.color_card_infos.push({ - count: item.count || 0, - id: item.id, + item.colors?.map((citem) => { + submitData.current.cut_sample_order_product_color_list.push({ + color_num: citem.count || 0, + product_color_id: citem.id, + }) }) }) if (!submitData.current.address_id) { return alert.none('请选择收货地址') } @@ -142,7 +163,7 @@ export default () => { const res = await submitFetchData(getFilterData(submitData.current)) if (res.success) { alert.success('提交成功') - goLink('/pages/colorCardOrderDetail/index', { id: res.data.id }) + goLink('/pages/cutSampleListOrderDetail/index', { id: res.data.id }, 'redirectTo') } } @@ -152,6 +173,23 @@ export default () => { setRemarkData(e) } + // 获取默认地址 + const { fetchData: addressListFetchData, state } = addressListApi() + const getAddressDefault = async() => { + const res = await addressListFetchData() + let defaultInfo: AddressItem|null = null + res?.data.list?.map((item) => { + defaultInfo = { + id: item.id, + address_title: item.province_name + item.city_name + item.district_name + item.address_detail, + address_name: item.name, + address_phone: item.phone, + } + }) + submitData.current.address_id = defaultInfo!.id || 0 + setAddressInfo(defaultInfo!) + } + return
添加剪样 diff --git a/src/pages/cutSampleListOrderDetail/components/productCard/index.tsx b/src/pages/cutSampleListOrderDetail/components/productCard/index.tsx index 862e8d5..b9b3f02 100644 --- a/src/pages/cutSampleListOrderDetail/components/productCard/index.tsx +++ b/src/pages/cutSampleListOrderDetail/components/productCard/index.tsx @@ -3,18 +3,30 @@ import { useCallback } from 'react' import styles from './index.module.scss' import Counter from '@/components/counter' import LabAndImg from '@/components/LabAndImg' +import { formatHashTag } from '@/common/fotmat' -export interface orderParam { - affiliation_product: any - count: number +export interface ProductParam { + code: string lab: { l: number; a: number; b: number } name: string + product_colors: ColorParam[] + product_id: number + rgb: { r: number; g: number; b: number } + texture_url: string +} + +export interface ColorParam { + code: string + color_num: number + lab: { l: number; a: number; b: number } + name: string + product_color_id: number rgb: { r: number; g: number; b: number } texture_url: string } interface Param { - value: orderParam[] + value: ProductParam[] } export default (props: Param) => { @@ -25,21 +37,25 @@ export default (props: Param) => { }, [value], ) - return - 色卡信息 - - <> - {value?.map((item, index) => { - return - - - {item.name} - x{item.count}本 - - - })} - 快递到付 - - - + return <> + {value?.map((pitem) => { + return + {formatHashTag(pitem.code, pitem.name)} + + <> + {pitem.product_colors?.map((citem, index) => { + return + + + {formatHashTag(citem.code, citem.name)} + x{citem.color_num}份 + + + })} + 快递到付 + + + + })} + } diff --git a/src/pages/cutSampleListOrderDetail/index.config.ts b/src/pages/cutSampleListOrderDetail/index.config.ts index 3447f0a..90f7fe6 100644 --- a/src/pages/cutSampleListOrderDetail/index.config.ts +++ b/src/pages/cutSampleListOrderDetail/index.config.ts @@ -1,4 +1,4 @@ export default { - navigationBarTitleText: '色卡订单详情', + navigationBarTitleText: '剪样订单详情', enableShareAppMessage: true, } diff --git a/src/pages/cutSampleListOrderDetail/index.tsx b/src/pages/cutSampleListOrderDetail/index.tsx index 8a150ff..f222f22 100644 --- a/src/pages/cutSampleListOrderDetail/index.tsx +++ b/src/pages/cutSampleListOrderDetail/index.tsx @@ -1,49 +1,48 @@ -import { Text, View } from '@tarojs/components' +import { View } from '@tarojs/components' import Taro, { useDidShow, useRouter } from '@tarojs/taro' import { useMemo, useState } from 'react' import styles from './index.module.scss' import Address from './components/address' -import type { orderParam } from './components/productCard' +import type { ProductParam } from './components/productCard' import ProductCard from './components/productCard' import Remark from './components/remark' import OrderInfo from './components/orderInfo' import type { orderStateItem } from './components/orderState' import OrderState from './components/orderState' -import { alert, goLink } from '@/common/common' -import SearchInput from '@/components/searchInput' +import { alert } from '@/common/common' import { ColorCardOrderCancelApi, GetColorCardOrderDetailApi } from '@/api/colorCard' +import { CutSampleOrderCancelApi, GetCutSampleOrderDetailApi } from '@/api/cutSample' interface Param { - address: string - color_card_info: orderParam[] + address_detail: string + city_id: number + city_name: string create_time: string - create_user_name: string - creator_id: number - id: number + cut_sample_order_product_list: ProductParam[] + district_id: number + district_name: string + order_form: orderStateItem[] + order_id: number order_no: string - order_progress: orderStateItem[] - order_status: number - order_status_name: string + order_remark: string + phone: string + province_id: number + province_name: string purchaser_id: number purchaser_name: string - purchaser_phone: string - remark: string sale_user_id: number sale_user_name: string shipment_mode: number shipment_mode_name: string target_user_name: string target_user_phone: string - update_time: string - update_user_name: string - updater_id: number } export default () => { const router = useRouter() const [orderData, setOrderData] = useState() - const { fetchData: fetchDataDtail } = GetColorCardOrderDetailApi() + const { fetchData: fetchDataDtail } = GetCutSampleOrderDetailApi() const getColorCardOrderDetail = async() => { const res = await fetchDataDtail({ id: router.params.id }) setOrderData(() => res.data) @@ -55,21 +54,21 @@ export default () => { const addressData = useMemo(() => { return { - address_title: orderData?.address || '', + address_title: `${orderData?.province_name}${orderData?.city_name}${orderData?.district_name}`, address_name: orderData?.purchaser_name || '', - address_phone: orderData?.purchaser_phone || '', + address_phone: orderData?.target_user_phone || '', address_mode: orderData?.shipment_mode_name || '', } }, [orderData]) // 取消订单 - const { fetchData: fetchDataCancel } = ColorCardOrderCancelApi() + const { fetchData: fetchDataCancel } = CutSampleOrderCancelApi() const onCancel = async() => { Taro.showModal({ title: '确定取消订单?', async success(res) { if (res.confirm) { - const res = await fetchDataCancel({ id: orderData?.id }) + const res = await fetchDataCancel({ id: orderData?.order_id }) if (res.success) { alert.success('取消成功') getColorCardOrderDetail() @@ -82,12 +81,12 @@ export default () => { }) } return - +
- + - - {orderData?.order_status === 1 && + + {orderData?.order_form?.length === 1 && 取消订单 diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 07689d8..8a8ec41 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -252,6 +252,18 @@ const Details = (props: Params) => { setShowColorSelect(true) } + const onCutSampleList = (val) => { + const data = { ...productInfo } + val.map((item) => { + item.count = 1 + }) + data.colors = val + Taro.setStorageSync('cutSample', JSON.stringify([data])) + Taro.redirectTo({ + url: '/pages/cutSampleListOrder/index', + }) + } + return ( @@ -423,7 +435,7 @@ const Details = (props: Params) => { - setShowColorSelect(false)} /> + setShowColorSelect(false)} /> diff --git a/src/styles/image/kong.png b/src/styles/image/kong.png deleted file mode 100644 index 4a9f41f..0000000 Binary files a/src/styles/image/kong.png and /dev/null differ