diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx index d03ea61..87eb683 100644 --- a/src/components/LabAndImg/index.tsx +++ b/src/components/LabAndImg/index.tsx @@ -1,9 +1,10 @@ -import { formatImgUrl } from "@/common/fotmat"; +import { formatImgUrl, formatRemoveHashTag } from "@/common/fotmat"; import Preview from "@/pages/details/components/preview"; import { Image, View } from "@tarojs/components"; -import { memo, useMemo, useState } from "react"; +import { memo, useCallback, useEffect, useMemo, useState } from "react"; import styles from './index.module.scss' import Taro from "@tarojs/taro"; +import LabAndImgShow from "../LabAndImgShow"; //该组件宽高为100%需调整外层元素宽高 type Param = { @@ -11,10 +12,14 @@ type Param = { texture_url?: string, //纹理图路径 lab?: {l:number, a:number, b:number}, //lab rgb?: {r:number, g:number, b:number} //rgb + title?: string }, - checkStatus: false|true + showStatus?: true|false, + onClick?: (val: Param['value']) => void } -export default memo(({value, checkStatus = false}:Param) => { +export default memo(({value, onClick, showStatus = false}:Param) => { + const [imgs, setImgs] = useState([]) + //lab是否都是0 const rgbStyle = useMemo(() => { if(value?.lab&&(value.lab.l||value.lab.a||value.lab.b)) { @@ -24,27 +29,32 @@ export default memo(({value, checkStatus = false}:Param) => { } }, [value]) - const [showPreview, setShowPreview] = useState(false) - const onClickShow = () => { - setShowPreview(() => true) - } + useEffect(() => { + if(value?.texture_url) { + let res = value.texture_url.split(',').map(item => { + return formatImgUrl(item) + }) + setImgs(() => res) + } + }, [value]) - const onShowImage = () => { - if(!checkStatus) return false - Taro.previewImage({ - current: formatImgUrl(value?.texture_url, '!w800'), // 当前显示 - urls: [formatImgUrl(value?.texture_url, '!w800')] // 需要预览的图片http链接列表 - }) + const [labAndImgShow, setLabAndImgShow] = useState(false) + const closeLabAndImgShow = useCallback(() => { + setLabAndImgShow(false) + }, []) + const onShowLabAndImg = () => { + if(!showStatus) return false + setLabAndImgShow(true) } return ( <> - - {value?.texture_url&& onShowImage()} src={formatImgUrl(value?.texture_url)}>} - {(!value?.texture_url&&rgbStyle)&& onClickShow()} style={{...rgbStyle}}>} - {(!value?.texture_url&&!rgbStyle)&&} + onShowLabAndImg()}> + {imgs?.length > 0&&} + {(!imgs?.length&&rgbStyle)&&} + {(!imgs?.length&&!rgbStyle)&&} - setShowPreview(false)}/> + ) }) \ No newline at end of file diff --git a/src/components/LabAndImgShow/index.module.scss b/src/components/LabAndImgShow/index.module.scss new file mode 100644 index 0000000..267aa4c --- /dev/null +++ b/src/components/LabAndImgShow/index.module.scss @@ -0,0 +1,45 @@ +.main{ + position: fixed; + width: 100vw; + height: 100vh; + top: 0; + left: 0; + background-color: rgba(0,0,0, 0.8); + display: flex; + justify-content: center; + align-items: flex-start; + z-index: 9999; + .con{ + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 100%; + height: 60vh; + margin-top: 100px; + padding: 20px; + box-sizing: border-box; + .rgb{ + width: 600px; + height: 600px; + border-radius: 20px; + } + image{ + width:100%; + border-radius: 10px; + } + .name { + width: 488px; + height: 72px; + color: #fff; + text-align: center; + font-size: 26px; + border-radius: 20px; + line-height: 72px; + margin-top: 10px; + background-color: rgba(0,0,0, 0.5); + padding: 0 10px; + @include common_ellipsis(1); + } + } +} \ No newline at end of file diff --git a/src/components/LabAndImgShow/index.tsx b/src/components/LabAndImgShow/index.tsx new file mode 100644 index 0000000..bf1a9f1 --- /dev/null +++ b/src/components/LabAndImgShow/index.tsx @@ -0,0 +1,65 @@ +import { formatImgUrl } from "@/common/fotmat" +import { View } from "@tarojs/components" +import { useEffect, useMemo, useState } from "react" +import styles from './index.module.scss' +import Taro from '@tarojs/taro' + + +export type colorParams = { + value?: { + texture_url?: string, //纹理图路径 + lab?: {l:number, a:number, b:number}, //lab + rgb?: {r:number, g:number, b:number} //rgb + title?: string //标题 + }, + show?: false|true + onClose?: () => void, + showNumber?: number, //图片显示张数,0不限制 +} +export default ({value, show = false, onClose, showNumber = 1}: colorParams) => { + + useEffect(() => { + if(show&&rgbStyle) setLabShow(() => true) + if(show&&value?.texture_url) onShowImage() + if(!show) setLabShow(() => false) + }, [show]) + + //显示颜色 + const [labShow, setLabShow] = useState(false) + //lab是否都是0 + const rgbStyle = useMemo(() => { + if(value?.lab&&(value.lab.l||value.lab.a||value.lab.b)) { + return {'backgroundColor':`rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})`} + } else { + return null + } + }, [value]) + + + //显示图片 + const onShowImage = () => { + onClose?.() + let res: string[] = [] + if(value?.texture_url) { + res = value?.texture_url?.split(',').map(item => { + return formatImgUrl(item) + }) + } + let n_res = showNumber == 0? res : res?.splice(0, showNumber) + Taro.previewImage({ + current: n_res[0], + urls: n_res + }) + } + + return ( + <> + {labShow&& onClose?.()}> + + + {value?.title} + + } + + ) +} \ No newline at end of file diff --git a/src/components/address/index.module.scss b/src/components/address/index.module.scss index 767d401..854206d 100644 --- a/src/components/address/index.module.scss +++ b/src/components/address/index.module.scss @@ -4,7 +4,6 @@ .address_title{ display: flex; justify-content: space-between; - color:$color_font_two; font-size: $font_size; padding: 20px; padding-bottom: 0; diff --git a/src/components/address/index.tsx b/src/components/address/index.tsx index 491ac06..1e00455 100644 --- a/src/components/address/index.tsx +++ b/src/components/address/index.tsx @@ -12,6 +12,7 @@ type DefaultValueParm = {name: string, id:string|number, level?: number|string} type Params = { addressOnSelect?: (val:DefaultValueParm[]) => void, + addressOnChange?: (val:DefaultValueParm[]) => void, addressOnClose?: () => void, show?: true|false, defaultValue?:DefaultValueParm[] @@ -31,6 +32,7 @@ type AddresParam = { export default memo(({ addressOnSelect, + addressOnChange, addressOnClose, show = false, defaultValue = [], @@ -84,7 +86,14 @@ export default memo(({ setSelectArr([selectArr[0], selectArr[1], {name:item.name, id:item.id, level:item.level}]) getDomDes('#address_tab_2') } + } + + //地址数据 + useEffect(() => { + if(selectArr && selectArr.length > 0) + addressOnChange?.(selectArr) + }, [selectArr]) //选中标题 const onSelectIndex = (index) => { @@ -148,20 +157,8 @@ export default memo(({ //确定按钮 const submitSelect = () => { - if(selectStatus) { - if(confirmBtnStatus || selectArr.length == 3) { - addressOnClose?.() - addressOnSelect?.(selectArr) - } else { - alert.error("请选择完整地址"); - } - } else { - addressOnClose?.() - addressOnSelect?.(selectArr) - } - - - + addressOnClose?.() + addressOnSelect?.(selectArr) } //获取省市区宽度 @@ -188,7 +185,7 @@ export default memo(({ return ( <> - addressOnClose?.()}> + addressOnClose?.()}>取消 diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 4e75a6f..19f2c5e 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -65,6 +65,13 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { return false } }, + { + id: 5, + label: '上传物流', + validatarFunc: (orderInfo) => { + return orderInfo?.stage == ReturnStageWaitCheck.value + } + }, { id: 6, label: '取消退款', diff --git a/src/components/product/index.tsx b/src/components/product/index.tsx index b1387e3..c08b492 100644 --- a/src/components/product/index.tsx +++ b/src/components/product/index.tsx @@ -13,8 +13,7 @@ type Params = { export default ({desStatus = true, productList = []}:Params) => { const labAndImgObj = useCallback((item) => { - const img = item?item.texture_url.split(',')[0]:'' - return {lab:item.lab,rgb:item.rgb,texture_url:img} + return {lab:item.lab,rgb:item.rgb,texture_url:item.texture_url} }, [productList]) return ( diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 0d55be8..e5c1f0f 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -16,6 +16,8 @@ import Counter from "../counter"; import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user"; import useCommonData from "@/use/useCommonData"; import BindSalesmanPopup from "../bindSalesmanPopup"; +import LabAndImgShow from "../LabAndImgShow"; +import LabAndImg from "../LabAndImg"; type param = { show?: true|false, @@ -298,7 +300,7 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { selectCallBack(item)} onClose={() => colseCallBack(item)}/> - + diff --git a/src/pages/addressAdd/index.tsx b/src/pages/addressAdd/index.tsx index a9a106a..50c8955 100644 --- a/src/pages/addressAdd/index.tsx +++ b/src/pages/addressAdd/index.tsx @@ -107,7 +107,7 @@ export default ()=>{ },[formData]) // 设置选择地址 const handleSetSite = (ev:any)=>{ - if(ev.length>=3){ + if(ev.length > 0){ setFormData({ ...formData, siteArray: ev, @@ -115,7 +115,7 @@ export default ()=>{ district_id: ev[ev.length-1]?.id }) }else{ - alert.error("请选择完整地址"); + alert.error("请选择地址"); } } @@ -138,7 +138,7 @@ export default ()=>{ -
setShowSiteModal(false)} show={showSiteModal}/> +
setShowSiteModal(false)} show={showSiteModal}/> ) } diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index f149806..dd26c17 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -13,11 +13,12 @@ import {GetColorList} from "@/api/materialColor" import {AddShoppingCartApi} from "@/api/shopCart" import Taro, { useRouter } from "@tarojs/taro"; import UseLogin from "@/use/useLogin" -import { formatHashTag, formatPriceDiv } from "@/common/fotmat"; +import { formatHashTag, formatPriceDiv, formatRemoveHashTag } from "@/common/fotmat"; import { debounce, getFilterData } from "@/common/util"; import LabAndImg from "@/components/LabAndImg"; import VirtualList from '@tarojs/components/virtual-list' import useCommonData from "@/use/useCommonData"; +import LabAndImgShow from "@/components/LabAndImgShow"; @@ -200,12 +201,11 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) //虚拟滚动 const Rows = useCallback(({id, index, style, data}:any) => { let item = data[index] - console.log('123456') return ( <> {item&& - + {formatHashTag(item.code, item.name)} diff --git a/src/pages/details/components/preview/index.module.scss b/src/pages/details/components/preview/index.module.scss index fc59d0b..aaf98b0 100644 --- a/src/pages/details/components/preview/index.module.scss +++ b/src/pages/details/components/preview/index.module.scss @@ -8,6 +8,7 @@ display: flex; justify-content: center; align-items: flex-start; + z-index: 999; .con{ display: flex; justify-content: center; diff --git a/src/pages/details/components/swiper/index.tsx b/src/pages/details/components/swiper/index.tsx index 501566b..431b6e0 100644 --- a/src/pages/details/components/swiper/index.tsx +++ b/src/pages/details/components/swiper/index.tsx @@ -1,6 +1,7 @@ import { formatImgUrl } from "@/common/fotmat" import { Image, Swiper, SwiperItem, View } from "@tarojs/components" import { useMemo, useRef, useState } from "react" +import Taro from '@tarojs/taro' import styles from './index.module.scss' type item = {title:string, img:string, url:string, id:number} @@ -16,21 +17,32 @@ export default ({list = []}: params) => { return list.length },[list]) + const formatImages = useMemo(() => { + return list?.map(item => formatImgUrl(item, '!w800')) + }, [list]) + const swiperChange = (e) => { setPageIndex(e.detail.current + 1) } + + const onShowImage = () => { + Taro.previewImage({ + current: formatImages[0], + urls: formatImages + }) + } return ( - swiperChange(e)}> - {list?.map((item) => { - return - - - - - })} - + {list.length > 0 && swiperChange(e)}> + {list?.map((item) => { + return + + + + + })} + } {(list.length > 0)&&{pageIndex+'/'+pageCount}} ) diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 66ef5bf..b4d42c8 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -5,7 +5,6 @@ import classnames from "classnames"; import DesSwiper from './components/swiper'; import OrderCount from './components/orderCount'; import ShopCart from '@/components/shopCart'; -import Preview,{colorItem} from './components/preview'; import styles from './index.module.scss' import { useCallback, useEffect, useMemo, useState } from 'react'; import {formatHashTag} from '@/common/fotmat' @@ -20,6 +19,7 @@ import AddCollection from '@/components/addCollection'; import { AddFavoriteApi, DelFavoriteProductApi } from '@/api/favorite'; import useCommonData from '@/use/useCommonData'; import { IMG_CND_Prefix } from '@/common/constant'; +import LabAndImgShow from '@/components/LabAndImgShow'; type item = {title:string, img:string, url:string, id:number} @@ -95,19 +95,6 @@ export default (props:Params) => { // ` const html = `` - //弹窗提示 - const [colorInfo, setColorInfo] = useState() - const [showPreview, setShowPreview] = useState(false) - const getColorItem = (item) => { - setColorInfo({ - title: item.code, - texture_url: item.texture_url, - lab: item.lab, - rgb: item.rgb - }) - setShowPreview(true) - } - const {setSortCode, userInfo : userObj } = useUserInfo() //详情页获取分享短码 const {ShareDetail} = SHARE_SCENE @@ -209,9 +196,9 @@ export default (props:Params) => { 色号 ({productInfo?.product_color_list?.length}) {productInfo?.product_color_list?.map(item => { - return getColorItem(item)}> + return - + {item.code} diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index c846492..2ff6d0c 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -151,7 +151,8 @@ import { throttle } from "@/common/util"; return false } let showModalRes = await Taro.showModal({ - content: '确定提交订单?', + title: '确定提交订单?', + content: `发货方式为${submitOrderData?.shipment_mode == 1?'自提':'物流'}`, confirmText: '确定', cancelText: '取消', }) diff --git a/src/pages/order/components/returnRecord/index.module.scss b/src/pages/order/components/returnRecord/index.module.scss index 8fe0d57..632ac3e 100644 --- a/src/pages/order/components/returnRecord/index.module.scss +++ b/src/pages/order/components/returnRecord/index.module.scss @@ -1,10 +1,7 @@ .returnRecord_main{ height: 70vh; .returnRecord_con{ - padding: 0 20px; - } - .returnRecord_con{ - padding-top: 20px; + padding: 20px; } .order_item{ background-color: #fff; @@ -12,6 +9,7 @@ padding: 20px; box-sizing: border-box; box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.16); + margin-bottom: 20px;; .header{ display: flex; align-items: center; diff --git a/src/pages/order/components/returnRecord/index.tsx b/src/pages/order/components/returnRecord/index.tsx index 6c23990..f7eecca 100644 --- a/src/pages/order/components/returnRecord/index.tsx +++ b/src/pages/order/components/returnRecord/index.tsx @@ -36,11 +36,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { const userInfo = useSelector(state => state.userInfo) - //获取订单列表 + //获取售后订单列表 const {fetchData: listFetchData, state:orderState} = ReturnRecordApi() const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0}) const getOrderList = async () => { - console.log('ida::', id) let res = await listFetchData(getFilterData(searchField.current)) setOrderData({list: res.data.list, total: res.data.total}) } @@ -134,19 +133,19 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { {item?.product_list?.[0].product_colors?.map((itemColor, index) => { return ( - (index <= 1)&& + (index <= 1)&& {formatHashTag(itemColor.code, itemColor.name)} {standardPrice(itemColor.sale_price, item.sale_mode)} - ×{formatCount(itemColor, itemColor.sale_mode)} + ×{formatCount(itemColor, item.sale_mode)} ) }) } - + {(item?.product_list?.[0].product_colors.length > 2) && …… …… …… - + } {numText(item)} diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx index 4b78bcf..d8d92d9 100644 --- a/src/pages/order/components/scanPay/index.tsx +++ b/src/pages/order/components/scanPay/index.tsx @@ -74,7 +74,8 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { order_total_num: (orderInfo.total_number) + '', qrcode:"", //跳转链接 order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 - list: lists + list: lists , + show_qrcode: true //是否显示码单 })) } }, [orderInfo]) @@ -171,7 +172,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { {(state.loading)&&|| - + } 保存电子确认单 diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 17aa283..18c0de0 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -17,6 +17,7 @@ type Param = { sale_mode: number, sale_mode_name: string, status_name: string, + shipment_mode: number, shipment_mode_name: string, product_list: any[], total_fabrics: number, @@ -55,7 +56,7 @@ export default memo(({value, onClickBtn}: Param) => { onClickBtn?.({status, orderInfo:value}) }, [value]) - let {SaleOrderStatusTaking} = ORDER_STATUS + let {SaleOrderStatusTaking, SaleOrderStatusWaitingReceipt} = ORDER_STATUS //订单状态 // const orderStatus = useCallback((item) => { @@ -76,6 +77,14 @@ export default memo(({value, onClickBtn}: Param) => { return `${value?.total_fabrics} 种面料,${value?.total_colors} 种颜色,共 ${total_number_new}${value?.sale_mode == 0? ' 条':' 米'}` }, [value]) + //订单状态 + const orderStatus = useMemo(() => { + if(value.status == SaleOrderStatusWaitingReceipt.value && value.shipment_mode == 1) { + return '待提货' + } else { + return value?.status_name + } + }, [value]) return ( @@ -90,7 +99,7 @@ export default memo(({value, onClickBtn}: Param) => { 订单号:{value?.order_no} - {value?.status_name} + {orderStatus} diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 9029b07..6f6e868 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -86,6 +86,8 @@ import styles from './index.module.scss' } else if(val == 8) { //申请记录 setApplyRecord(true) + } else if (val == 5) { + onShowLogistics(1) } }, [orderDetail]) @@ -94,7 +96,6 @@ import styles from './index.module.scss' getSaleOrderPreView() }) - //按钮所需数据 const orderInfo = useMemo(() => { return { diff --git a/src/pages/salesAfterList/components/order/index.module.scss b/src/pages/salesAfterList/components/order/index.module.scss index 7864802..0116a3c 100644 --- a/src/pages/salesAfterList/components/order/index.module.scss +++ b/src/pages/salesAfterList/components/order/index.module.scss @@ -131,6 +131,17 @@ border-radius: 10px; padding: 10px 22px; margin-top: 20px; + display: flex; + justify-content: space-between; + .refund_amount{ + font-size: 30rpx; + color: #007AFF; + text{ + &:nth-child(1) { + font-size: 23px; + } + } + } } .order_number{ display: flex; diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 3232e6c..119ccc8 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -30,6 +30,7 @@ type Param = { texturl_url: string, type: number //2 退货 1 预收退款 3 销售 return_apply_order_id: number //退款申请单 + refund_amount: number // 退款金额 }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -75,7 +76,7 @@ export default memo(({value, onClickBtn}: Param) => { }, [value]) //售后单状态 - const {ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund} = AFTER_ORDER_STATUS + const {ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund, ReturnStageReturned} = AFTER_ORDER_STATUS const stage_name = useMemo(() => { return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value].includes(value?.stage)?'待退款':value?.stage_name }, [value]) @@ -126,7 +127,10 @@ export default memo(({value, onClickBtn}: Param) => { } - {numText} + + {numText} + {ReturnStageReturned.value == value?.stage && ¥{formatPriceDiv(value?.refund_amount, 100, true)}} + {value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'} 订单号:{value?.order_no}