diff --git a/src/components/orderBtns/index.module.scss b/src/components/orderBtns/index.module.scss index d6e9810..252b22e 100644 --- a/src/components/orderBtns/index.module.scss +++ b/src/components/orderBtns/index.module.scss @@ -74,6 +74,11 @@ &:nth-child(n+2) { margin-left: 32px; } + &:nth-last-child(1) { + border: 2px solid $color_main; + color: $color_main; + } + } .end_btn{ border: 2px solid $color_main; diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 3296d83..90fe9be 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -1,9 +1,10 @@ import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert } from "@/common/common" import { ORDER_STATUS, SALE_MODE } from "@/common/enum" -import { ScrollView, Text, View } from "@tarojs/components" +import {Text, View } from "@tarojs/components" import Taro from "@tarojs/taro" -import { useCallback, useRef, memo, useState, useEffect, useMemo } from "react" +import {useRef, memo, useState, useMemo } from "react" +import classnames from "classnames"; import styles from './index.module.scss' type Param = { @@ -194,7 +195,7 @@ export default memo(({orderInfo, onClick}:Param) => { {orderBtnsShowList.map((item, index) => - (index < 3)&& submitBtns(item.id, index)}>{item.label} + (index < 3)&& submitBtns(item.id, index)}>{item.label} )} diff --git a/src/components/product/index.module.scss b/src/components/product/index.module.scss index 6543b25..35f7693 100644 --- a/src/components/product/index.module.scss +++ b/src/components/product/index.module.scss @@ -25,7 +25,7 @@ border-radius: 10px; } .num{ - padding: 5px 10px; + padding: 5px 10px 5px 20px; font-size: $font_size_min; position: absolute; right:0; @@ -51,7 +51,7 @@ .tag_list{ display: flex; margin-top: 16px; - .tag{ + .tag, .tag_g{ padding: 3px 10px; background-color: #CDE5FF; font-size: $font_size_min; @@ -61,6 +61,10 @@ margin-left: 10px; } } + .tag_g{ + background-color: #FFE6CE; + color: #EE7500; + } } .introduce{ font-size: $font_size_medium; diff --git a/src/components/product/index.tsx b/src/components/product/index.tsx index 0e849f8..c6b900d 100644 --- a/src/components/product/index.tsx +++ b/src/components/product/index.tsx @@ -22,7 +22,7 @@ export default ({desStatus = true, productList = []}:Params) => { {formatHashTag(item.code, '')} {item.name} {item.width} - {item.weight_density} + {item.weight_density} {item.component} {desStatus&&{item.describe}} diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 2470ef1..504abbd 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -56,6 +56,7 @@ export default ({show = false, onClose}: param) => { setLoading(true) const {data} = await fetchData() let color_list = data.color_list||[] + color_list.reverse() initList(color_list) setList(color_list) setLoading(false) diff --git a/src/components/sideBar/index.module.scss b/src/components/sideBar/index.module.scss index c6bdb76..7329301 100644 --- a/src/components/sideBar/index.module.scss +++ b/src/components/sideBar/index.module.scss @@ -29,8 +29,9 @@ } .sideBar_select_title_select{ - background-color: $color_bg_one; - color: $color_font_one; + background-color: #007AFF; + color: #fff; + border-radius: 0px 14px 14px 0px; } } .sideBar_con{ diff --git a/src/components/sideBar/index.tsx b/src/components/sideBar/index.tsx index 78ceec0..d601151 100644 --- a/src/components/sideBar/index.tsx +++ b/src/components/sideBar/index.tsx @@ -104,7 +104,6 @@ export default memo(({list = [], ) }) } - selfOnScrolltolower?.()} refresherTriggered={refresherTriggered} refresherEnabled={true} selfOnRefresherRefresh={() => selfOnRefresherRefresh?.()}> diff --git a/src/pages/details/components/counter/index.module.scss b/src/pages/details/components/counter/index.module.scss index fe96cca..a472f0e 100644 --- a/src/pages/details/components/counter/index.module.scss +++ b/src/pages/details/components/counter/index.module.scss @@ -9,9 +9,8 @@ color: $color_main; width: 46px; height: 46px; - display: flex; - align-items: center; - justify-content:center; + text-align: center; + line-height: 43px; font-size: 50px; background-color: $color_main; color: #fff; @@ -25,10 +24,13 @@ box-sizing: border-box; width: 106px; border-radius: 10px; + input{ + font-size: $font_size_medium; + text-align: right; + padding-right: 10px; + } } - input{ - font-size: $font_size_medium; - } + .unit{ font-size: $font_size_min; color: $color_font_two; diff --git a/src/pages/order/comfirm.module.scss b/src/pages/order/comfirm.module.scss index 2858dec..a33eb0c 100644 --- a/src/pages/order/comfirm.module.scss +++ b/src/pages/order/comfirm.module.scss @@ -80,6 +80,9 @@ box-sizing: border-box; padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); + .submit_order_number{ + padding: 20px 0; + } .order_btn { width: 250px; height: 90px; diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 7113d8f..4078471 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -1,15 +1,12 @@ import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order"; import { formatPriceDiv } from "@/common/fotmat"; import Popup from "@/components/popup"; -import SearchInput from "@/components/searchInput"; -import { Text, Textarea, View } from "@tarojs/components" -import Taro, { useDidShow, useRouter } from "@tarojs/taro"; +import { View } from "@tarojs/components" +import Taro, { useDidShow} from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import AddressInfo,{AddressInfoParam} from "./components/addressInfo"; -import EstimatedAmount from "./components/estimatedAmount"; +import AddressInfo from "./components/addressInfo"; import KindList from "./components/kindList"; -import OrderState from "./components/orderState"; import Remark from "./components/remark"; import styles from './comfirm.module.scss' import { getParam } from "@/common/system"; @@ -17,9 +14,9 @@ import useLogin from "@/use/useLogin"; import { alert, goLink } from "@/common/common"; import ShipmentMode from "../editOrder/components/shipmentMode"; import SubmitOrderBtn from "./components/submitOrderBtn"; +import AddressInfoDetail from "./components/addressInfoDetail"; export default () => { - const {checkLogin} = useLogin() const [showDesc, setShowDesc] = useState(false) //下单信息 @@ -57,8 +54,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; if(preViewOrder) { formatData() getDataList() - //当有默认地址时设置默认地址id - preViewOrder.default_address&&setSubmitOrderData((val) => ({...val, address_id:preViewOrder.default_address.id})) + setSubmitOrderData((val) => ({...val, address_id:preViewOrder.default_address.id, shipment_mode:preViewOrder.shipment_mode||2})) } }, [preViewOrder]) @@ -84,18 +80,16 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; //格式化初始地址 const defaultAddress = useMemo(() => { const address = preViewOrder?.default_address - if(address) { - return { - province_name: address.province_name, - city_name: address.city_name, - district_name: address.district_name, - address_detail: address.address_detail, - id: address.id, - name: address.name, - phone: address.phone - } + return { + province_name: address?.province_name, + city_name: address?.city_name, + district_name: address?.district_name, + address_detail: address?.address_detail, + id: address?.id, + name: address?.name, + phone: address?.phone, + shipment_mode: address?.shipment_mode } - return null }, [preViewOrder]) //获取提交格式数据列表 @@ -126,13 +120,17 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; //提交按钮是否可用 const btnStatus = useMemo(() => { - if( submitOrderData?.list?.length == 0 || !submitOrderData?.shipment_mode || (submitOrderData?.shipment_mode == 2 && !submitOrderData?.address_id)) { - return false - } else { - return true - } + return submitOrderData?.shipment_mode == 1 || (submitOrderData?.shipment_mode == 2 && submitOrderData?.address_id) }, [submitOrderData]) + //数量格式 + const numText = useMemo(() => { + if(formatPreViewOrder) { + let total_number = formatPreViewOrder?.sale_mode == 0?formatPreViewOrder?.total_number:(formatPreViewOrder?.total_number/100) + return `${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${total_number}${formatPreViewOrder?.unit}` + } + }, [formatPreViewOrder]) + //提交订单 const {fetchData: saleOrderFetchData} = SaleOrderApi() const submitOrderEven = () => { @@ -162,8 +160,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; } return ( - - getAddress(e)} defaultValue={defaultAddress}/> + setShowDesc(true)}> 订单备注 @@ -176,7 +173,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; - {`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`} + {numText} submitOrderEven()}>提交订单 diff --git a/src/pages/order/components/addressInfoDetail/index copy.tsx b/src/pages/order/components/addressInfoDetail/index copy.tsx new file mode 100644 index 0000000..1fffafe --- /dev/null +++ b/src/pages/order/components/addressInfoDetail/index copy.tsx @@ -0,0 +1,163 @@ +import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order"; +import { alert } from "@/common/common"; +import { ORDER_STATUS } from "@/common/enum"; +import { debounce } from "@/common/util"; +import AddressList from "@/components/AddressList"; +import Popup from "@/components/popup"; +import { Text, View } from "@tarojs/components" +import classnames from "classnames"; +import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useState } from "react"; +import styles from './index.module.scss' + +export type AddressInfoParam = { + province_name: string, + city_name: string, + district_name: string, + address_detail: string, + id?: number, + name: string, + phone: string, +} +type Param = { + onSelect?: (val:any) => void, //选择地址 + defaultValue?: AddressInfoParam|null, //默认值 + disabled?: false|true, //true禁用后只用于展示 + onChangeShipmentMode?: (val: number) => void, //返回收货方式 + status?: 1|2, //1确认订单时使用, 2订单流程 + orderInfo?: { + orderId: number //订单id + shipment_mode: 1|2, //1自提 2物流 + status: number //订单状态 + } +} + +export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderInfo, status = 2}: Param, ref) => { + const [showAddressList, setShowAddressList] = useState(false) + + useEffect(() => { + setUserInfo(() => defaultValue) + }, [defaultValue]) + + const [userInfo, setUserInfo] = useState() + + //地址格式 + const formatAddress = useMemo(() => { + if(userInfo) + return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail + }, [userInfo]) + + const changeShow = () => { + if(receivingStatus == 2 && !logisticsShow) + setShowAddressList(() => true) + } + + useEffect(() => { + if(orderInfo) + setReceivingStatus(() => orderInfo.shipment_mode||2) + }, [orderInfo]) + + //把内部方法提供给外部 + useImperativeHandle(ref, () => ({ + changeShow + })) + + //收货方法,1:自提,2物流 + const [receivingStatus, setReceivingStatus] = useState(2) + const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() + const onReceivingStatus = (value, e) => { + e.stopPropagation() + changeReceivingStatus(value) + } + const changeReceivingStatus = debounce(async (value) => { + if(!orderInfo) return false + if(status == 1) { + onChangeShipmentMode?.(value) + setReceivingStatus(value) + return false + } + alert.loading('正在修改') + const res = await shipmentModeFetchData({id: orderInfo.orderId, shipment_mode:value}) + if(res.success) { + alert.success('收货方式修改成功') + onChangeShipmentMode?.(value) + setReceivingStatus(value) + } else { + alert.none(res.msg) + } + }, 10) + + //修改地址 + const [addressId, setAddressId] = useState(0) + const {fetchData: addressFetchData} = EditSaleOrderAddressApi() + const getAddress = async (value) => { + if(!orderInfo) return false + if(status == 1) { + setShowAddressList(() => false) + setAddressId(value.id) + setUserInfo(() => value) + return false + } + alert.loading('正在修改') + const res = await addressFetchData({id: orderInfo.orderId, address_id: value.id}) + if(res.success) { + alert.success('地址修改成功') + onSelect?.(value) + setShowAddressList(() => false) + setAddressId(value.id) + setUserInfo(() => value) + } else { + alert.none(res.msg) + } + } + + //订单状态 + const { + SaleOrderStatusWaitingReceipt, + SaleOrderStatusAlreadyReceipt, + SaleOrderStatusComplete, + SaleOrderStatusRefund, + SaleOrderStatusCancel + } = ORDER_STATUS + + //根据订单状态判断是否显示物流 + const logisticsShowList = [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value] + const logisticsShow = useMemo(() => { + return logisticsShowList.includes(orderInfo?.status as number) + }, [orderInfo]) + + return ( + + changeShow()}> + + + + {formatAddress} + {(receivingStatus == 2 && !logisticsShow)&&} + + + {userInfo?.name} + {userInfo?.phone} + + + {!logisticsShow&& + + onReceivingStatus(1,e)}>自提 + onReceivingStatus(2,e)}>物流 + + + || + + 查看物流 + } + + setShowAddressList(false)}> + + 请选择收货地址 + + + + + + + ) +})) \ No newline at end of file diff --git a/src/pages/order/components/addressInfoDetail/index.module.scss b/src/pages/order/components/addressInfoDetail/index.module.scss index 42dd5d1..cf039ce 100644 --- a/src/pages/order/components/addressInfoDetail/index.module.scss +++ b/src/pages/order/components/addressInfoDetail/index.module.scss @@ -33,6 +33,11 @@ } .address_text{ word-break:break-all; + + } + .address_text_no{ + font-weight: 700; + padding-left: 20px; } } .order_address_text_name{ diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index c2a7fa0..70c42d9 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -23,37 +23,43 @@ type Param = { defaultValue?: AddressInfoParam|null, //默认值 disabled?: false|true, //true禁用后只用于展示 onChangeShipmentMode?: (val: number) => void, //返回收货方式 + status?: 1|2, //1确认订单时使用, 2订单流程 orderInfo?: { - orderId: number //订单id - shipment_mode: 1|2, //1自提 2物流 - status: number //订单状态 + id?: number //订单id + shipment_mode?: 1|2, //1自提 2物流 + status?: number //订单状态 + province_name: string, + city_name: string, + district_name: string, + address_detail: string } } -export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderInfo}: Param, ref) => { - const [showAddressList, setShowAddressList] = useState(false) +export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2}: Param, ref) => { + + const [addressInfo, setAddressInfo] = useState() useEffect(() => { - setUserInfo(() => defaultValue) - }, [defaultValue]) - - const [userInfo, setUserInfo] = useState() + setAddressInfo(() => orderInfo) + if(orderInfo) + setReceivingStatus(() => orderInfo.shipment_mode||2) + }, [orderInfo]) //地址格式 const formatAddress = useMemo(() => { - if(userInfo) - return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail - }, [userInfo]) + if(addressInfo?.province_name) { + return addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail + } else { + return '' + } + }, [addressInfo]) + //打开地址列表 + const [showAddressList, setShowAddressList] = useState(false) const changeShow = () => { if(receivingStatus == 2 && !logisticsShow) setShowAddressList(() => true) } - - useEffect(() => { - if(orderInfo) - setReceivingStatus(() => orderInfo.shipment_mode) - }, [orderInfo]) //把内部方法提供给外部 useImperativeHandle(ref, () => ({ @@ -61,7 +67,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = })) //收货方法,1:自提,2物流 - const [receivingStatus, setReceivingStatus] = useState(1) + const [receivingStatus, setReceivingStatus] = useState(2) const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() const onReceivingStatus = (value, e) => { e.stopPropagation() @@ -69,8 +75,13 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = } const changeReceivingStatus = debounce(async (value) => { if(!orderInfo) return false + if(status == 1) { + onChangeShipmentMode?.(value) + setReceivingStatus(value) + return false + } alert.loading('正在修改') - const res = await shipmentModeFetchData({id: orderInfo.orderId, shipment_mode:value}) + const res = await shipmentModeFetchData({id: orderInfo.id, shipment_mode:value}) if(res.success) { alert.success('收货方式修改成功') onChangeShipmentMode?.(value) @@ -85,14 +96,21 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = const {fetchData: addressFetchData} = EditSaleOrderAddressApi() const getAddress = async (value) => { if(!orderInfo) return false + if(status == 1) { + setShowAddressList(() => false) + setAddressId(value.id) + setAddressInfo(() => value) + onSelect?.(value) + return false + } alert.loading('正在修改') - const res = await addressFetchData({id: orderInfo.orderId, address_id: value.id}) + const res = await addressFetchData({id: orderInfo.id, address_id: value.id}) if(res.success) { alert.success('地址修改成功') onSelect?.(value) setShowAddressList(() => false) setAddressId(value.id) - setUserInfo(() => value) + setAddressInfo(() => value) } else { alert.none(res.msg) } @@ -119,12 +137,12 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = - {formatAddress} + {formatAddress||'请选择收货地址及信息'} {(receivingStatus == 2 && !logisticsShow)&&} - {userInfo?.name} - {userInfo?.phone} + {addressInfo?.name} + {addressInfo?.phone} {!logisticsShow&& diff --git a/src/pages/order/components/kindList/index copy.tsx b/src/pages/order/components/kindList/index copy.tsx new file mode 100644 index 0000000..8247927 --- /dev/null +++ b/src/pages/order/components/kindList/index copy.tsx @@ -0,0 +1,190 @@ +import { ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + status: number, //订单状态 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) { + let total_number = order?.sale_mode == 0?order?.total_number:(order?.total_number/100) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${total_number}${order?.unit}` + } + }, [order]) + + const { + SaleOrderStatusBooking, // 待接单 + SaleOrderStatusArranging, // 配布中 + SaleOrderStatusArranged, // 已配布 + SaleOrderStatusWaitingPayment, // 待付款 + SaleOrderStatusWaitingDelivery, // 待发货 + SaleOrderStatusWaitingReceipt, // 待收货 + SaleOrderStatusAlreadyReceipt, // 已收货 + SaleOrderStatusComplete, // 已完成 + SaleOrderStatusRefund, // 已退款 + SaleOrderStatusCancel, // 已取消 + SaleorderstatusWaitingPrePayment // 预付款 + } = ORDER_STATUS + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value, ], + label:'预估金额', + field: 'estimate_amount' + }, + { + id:2, + value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'合计金额', + field: 'total_sale_price' + }, + { + id:3, + value:[SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'空差优惠', + field: 'total_weight_error_discount' + }, + { + id:4, + value:[ SaleOrderStatusWaitingPayment.value], + label:'应付金额', + field: 'total_should_collect_money' + }, + { + id:5, + value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'实付金额', + field: 'actual_amount' + } + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo, status) => { + return priceInfo.value.includes(status) + }, [order]) + + //金额展示大货 + const priceConDom = useMemo(() => { + if(!order) return + if(comfirm == true) { + //确认订单时 + return + } + + if(order?.status == SaleOrderStatusCancel.value) { + //订单状态为取消订单时 + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item, order?.the_previous_status)&&} + }) + } + + ) + } else { + //其他订单状态 + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item, order?.status)&&} + }) + } + + ) + } + }, [order]) + + //金额展示剪板 + const cutPriceConDom = useMemo(() => { + if(!order) return + return + }, [order]) + + const showPriceAll = useMemo(() => { + if(order?.sale_mode == 1) { + return cutPriceConDom //剪板 + } else { + return priceConDom //大货 + } + }, [order]) + + + return ( + <> + {numText} + + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + ¥{standardPrice(colorItem.sale_price)} + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + + {showPriceAll} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index aba9f02..61bd404 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -64,13 +64,13 @@ export default memo(({order, comfirm = false}:Param) => { const priceList = [ { id:1, - value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value], + value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value], label:'预估金额', field: 'estimate_amount' }, { id:2, - value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], label:'合计金额', field: 'total_sale_price' }, @@ -95,56 +95,28 @@ export default memo(({order, comfirm = false}:Param) => { ] //是否显示价格 - const showPrice = useCallback((priceInfo, status) => { - return priceInfo.value.includes(status) - }, [order]) + const showPrice = (item) => { + if (item.id == 2) { + //合计金额 (剪板特殊请情况) + return (item.value.includes(order.status)|| order.sale_mode == 1) + } else { + return (item.value.includes(order.status) && order.sale_mode != 1 ) + } + } - //金额展示大货 + //金额展示 const priceConDom = useMemo(() => { if(!order) return - if(comfirm == true) { - //确认订单时 - return - } else if(order?.status == SaleOrderStatusCancel.value) { - //订单状态为取消订单时 - return ( - <> - { - priceList.map(item => { - return <>{showPrice(item, order?.the_previous_status)&&} - }) - } - - ) - } else { - //其他订单状态 - return ( - <> - { - priceList.map(item => { - return <>{showPrice(item, order?.status)&&} - }) - } - - ) - } + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) }, [order]) - - //金额展示剪板 - const cutPriceConDom = useMemo(() => { - if(!order) return - return - }, [order]) - - const showPriceAll = useMemo(() => { - if(order?.sale_mode == 1) { - return cutPriceConDom //剪板 - } else { - return priceConDom //大货 - } - - }, [order]) - return ( <> @@ -181,7 +153,7 @@ export default memo(({order, comfirm = false}:Param) => { }) } - {showPriceAll} + {priceConDom} diff --git a/src/pages/order/components/orderState/index.tsx b/src/pages/order/components/orderState/index.tsx index 9cc4ca4..b08861d 100644 --- a/src/pages/order/components/orderState/index.tsx +++ b/src/pages/order/components/orderState/index.tsx @@ -63,7 +63,7 @@ export default memo(({orderInfo = {logistics_details: [],payment_method: 0, stat {formatDateTime(item.time)} {item.desc} - {(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&} + {(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&} )} {(dataList.length > 2) && changeMore()}> @@ -84,7 +84,7 @@ export default memo(({orderInfo = {logistics_details: [],payment_method: 0, stat }) //倒计时 -const CountDown = ({endTime = ''}:{endTime:string}) => { +const CountDown = ({endTime = '', onFinish}:{endTime:string, onFinish?:() => void}) => { const [showTime, setShowTime] = useState('') const timeObj:any = useRef() useEffect(() => { @@ -101,7 +101,12 @@ const CountDown = ({endTime = ''}:{endTime:string}) => { const count_down = () => { var startData = dayjs(); var endDate = dayjs(endTime); - if(startData >= endDate) clearInterval(timeObj.current) + if(startData >= endDate) { + clearInterval(timeObj.current) + onFinish?.() + setShowTime(() => '00:00:00') + return false + } var _dd = endDate.diff(startData,'day'); var _hh = endDate.diff(startData,'hour'); var _mm = endDate.diff(startData,'minute'); @@ -120,7 +125,7 @@ const CountDown = ({endTime = ''}:{endTime:string}) => { return ( <> - 剩{showTime||'00:00:00'}支付关闭,订单自动取消 + 剩{showTime||'--:--:--'}支付关闭,订单自动取消 ) diff --git a/src/pages/order/components/submitOrderBtn/index.module.scss b/src/pages/order/components/submitOrderBtn/index.module.scss index c5ac9ed..7330951 100644 --- a/src/pages/order/components/submitOrderBtn/index.module.scss +++ b/src/pages/order/components/submitOrderBtn/index.module.scss @@ -1,11 +1,9 @@ .order_price{ display: flex; align-items: center; - justify-content: space-between; + // justify-content: space-between; width: 100%; - &:nth-last-child(n+2) { - margin-bottom: 30px; - } + .order_price_text{ font-size: $font_size_medium; // margin-right: 10px; @@ -41,7 +39,7 @@ } } .emphasis{ - font-weight: 700; + // font-weight: 700; } .order_price_num{ color: $color_main; @@ -51,7 +49,7 @@ font-size: $font_size_min; } &:nth-child(2) { - font-size: 26px; + font-size: 44px; } &:nth-child(3) { font-size: $font_size_medium; @@ -61,7 +59,7 @@ .emphasis_num{ text{ &:nth-child(2) { - font-size: $font_size_big; + font-size: 44px; } } } diff --git a/src/pages/order/components/submitOrderBtn/index.tsx b/src/pages/order/components/submitOrderBtn/index.tsx index d84e61e..5e083c3 100644 --- a/src/pages/order/components/submitOrderBtn/index.tsx +++ b/src/pages/order/components/submitOrderBtn/index.tsx @@ -26,11 +26,7 @@ export default memo(({style, number = 0, priceTitle = ''}:Param) => { <> - {priceTitle} - - - {/* 123123123121212312312312312 */} - + {priceTitle}: {priceDom()} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 00b52ec..244c9d1 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -38,7 +38,8 @@ import styles from './index.module.scss' setOrderDetail(res.data) setOrderRemark(res.data.remark) } - Taro.stopPullDownRefresh() + Taro.stopPullDownRefresh() + Taro.hideToast() } //监听获取到的数据 @@ -85,7 +86,7 @@ import styles from './index.module.scss' }) } - //格式化初始地址 + //初始地址数据 const defaultAddress = useMemo(() => { return { province_name: orderDetail?.province_name, @@ -114,12 +115,6 @@ import styles from './index.module.scss' setShowDesc(() => false) }, []) - //支付所需数据 - // const payOrderInfo = useMemo(() => { - // if(orderDetail) - // return {should_collect_order_id: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method, pre_collect_order_id:orderDetail.pre_collect_order_id} - // }, [orderDetail]) - //去付款 const [payMentShow, setPayMentShow] = useState(false) const toPay = () => { @@ -186,13 +181,17 @@ import styles from './index.module.scss' //订单状态枚举 const {SaleOrderStatusCancel} = ORDER_STATUS - + //刷新页面 + const refresh = useCallback(() => { + alert.loading('刷新中') + getSaleOrderPreView() + }, [orderDetail]) return ( - + - +