订单售后v3
This commit is contained in:
parent
cc7bcfe83c
commit
b6f58aabbc
@ -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;
|
||||
|
@ -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) => {
|
||||
|
||||
<View className={styles.list_scroll}>
|
||||
{orderBtnsShowList.map((item, index) =>
|
||||
(index < 3)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -22,7 +22,7 @@ export default ({desStatus = true, productList = []}:Params) => {
|
||||
<View className={styles.title}><text>{formatHashTag(item.code, '')} </text>{item.name}</View>
|
||||
<View className={styles.tag_list}>
|
||||
<View className={styles.tag}>{item.width}</View>
|
||||
<View className={styles.tag}>{item.weight_density}</View>
|
||||
<View className={styles.tag_g}>{item.weight_density}</View>
|
||||
</View>
|
||||
<View className={styles.introduce}>{item.component}</View>
|
||||
{desStatus&&<View className={styles.des}>{item.describe}</View>}
|
||||
|
@ -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)
|
||||
|
@ -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{
|
||||
|
@ -104,7 +104,6 @@ export default memo(({list = [],
|
||||
)
|
||||
})
|
||||
}
|
||||
<View className="common_safe_area_y"></View>
|
||||
</ScrollView>
|
||||
<View className={styles.sideBar_con}>
|
||||
<InfiniteScroll statusMore={statusMore} hasMore={hasMore} selfonScrollToLower={() => selfOnScrolltolower?.()} refresherTriggered={refresherTriggered} refresherEnabled={true} selfOnRefresherRefresh={() => selfOnRefresherRefresh?.()}>
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 (
|
||||
<View className={styles.order_main}>
|
||||
<ShipmentMode onSelect={selectShipmentMode}/>
|
||||
<AddressInfo onSelect={(e) => getAddress(e)} defaultValue={defaultAddress}/>
|
||||
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1}/>
|
||||
<KindList order={formatPreViewOrderMemo} comfirm={true}/>
|
||||
<View className={styles.order_desc} onClick={() => setShowDesc(true)}>
|
||||
<View className={styles.order_desc_con}>订单备注</View>
|
||||
@ -176,7 +173,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn";
|
||||
<View className={styles.submit_order}>
|
||||
<View className={styles.submit_order_number}>
|
||||
<SubmitOrderBtn style={{color:'#007AFF'}} number={formatPriceDiv(preViewOrder?.sale_mode == 1?formatPreViewOrder?.total_should_collect_money:formatPreViewOrder?.estimate_amount)} priceTitle={preViewOrder?.sale_mode == 1?'合计金额':'预估金额'}/>
|
||||
<View className={styles.order_number_desc}>{`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`}</View>
|
||||
<View className={styles.order_number_desc}>{numText}</View>
|
||||
</View>
|
||||
<View className={classnames(styles.order_btn, btnStatus&&styles.ok_order_btn)} onClick={() => submitOrderEven()}>提交订单</View>
|
||||
</View>
|
||||
|
163
src/pages/order/components/addressInfoDetail/index copy.tsx
Normal file
163
src/pages/order/components/addressInfoDetail/index copy.tsx
Normal file
@ -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<any>()
|
||||
|
||||
//地址格式
|
||||
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 (
|
||||
<View>
|
||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
||||
<View className={styles.order_address_text_con}>
|
||||
<View className={styles.order_address_text_title}>
|
||||
<Text className={styles.address_text}>{formatAddress}</Text>
|
||||
{(receivingStatus == 2 && !logisticsShow)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
||||
</View>
|
||||
<View className={styles.order_address_text_name}>
|
||||
<Text>{userInfo?.name}</Text>
|
||||
<Text>{userInfo?.phone}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{!logisticsShow&&<View className={styles.updateBtn}>
|
||||
<View className={styles.updateBtn_list}>
|
||||
<View className={classnames(styles.updateBtn_item, receivingStatus==1&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1,e)}>自提</View>
|
||||
<View className={classnames(styles.updateBtn_item, receivingStatus==2&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(2,e)}>物流</View>
|
||||
</View>
|
||||
<View style={{transform: receivingStatus==1?'translateX(0)':'translateX(100%)'}} className={classnames(styles.updateBtn_select)}></View>
|
||||
</View>||
|
||||
<View className={styles.logisticsBtn}>
|
||||
查看物流
|
||||
</View>}
|
||||
</View>
|
||||
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
||||
<View className={styles.order_address_list}>
|
||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
||||
<View className={styles.addressList_con}>
|
||||
<AddressList onSelect={getAddress} id={addressId}/>
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
}))
|
@ -33,6 +33,11 @@
|
||||
}
|
||||
.address_text{
|
||||
word-break:break-all;
|
||||
|
||||
}
|
||||
.address_text_no{
|
||||
font-weight: 700;
|
||||
padding-left: 20px;
|
||||
}
|
||||
}
|
||||
.order_address_text_name{
|
||||
|
@ -23,45 +23,51 @@ 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<any>()
|
||||
useEffect(() => {
|
||||
setUserInfo(() => defaultValue)
|
||||
}, [defaultValue])
|
||||
|
||||
const [userInfo, setUserInfo] = useState<any>()
|
||||
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, () => ({
|
||||
changeShow
|
||||
}))
|
||||
|
||||
//收货方法,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 =
|
||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
||||
<View className={styles.order_address_text_con}>
|
||||
<View className={styles.order_address_text_title}>
|
||||
<Text className={styles.address_text}>{formatAddress}</Text>
|
||||
<Text className={classnames(styles.address_text, styles.address_text_no)}>{formatAddress||'请选择收货地址及信息'}</Text>
|
||||
{(receivingStatus == 2 && !logisticsShow)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
||||
</View>
|
||||
<View className={styles.order_address_text_name}>
|
||||
<Text>{userInfo?.name}</Text>
|
||||
<Text>{userInfo?.phone}</Text>
|
||||
<Text>{addressInfo?.name}</Text>
|
||||
<Text>{addressInfo?.phone}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{!logisticsShow&&<View className={styles.updateBtn}>
|
||||
|
190
src/pages/order/components/kindList/index copy.tsx
Normal file
190
src/pages/order/components/kindList/index copy.tsx
Normal file
@ -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 <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
||||
}
|
||||
|
||||
if(order?.status == SaleOrderStatusCancel.value) {
|
||||
//订单状态为取消订单时
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item, order?.the_previous_status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
} else {
|
||||
//其他订单状态
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item, order?.status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
}, [order])
|
||||
|
||||
//金额展示剪板
|
||||
const cutPriceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
return <EstimatedAmount number={formatPriceDiv(order.total_should_collect_money)} title="合计金额" />
|
||||
}, [order])
|
||||
|
||||
const showPriceAll = useMemo(() => {
|
||||
if(order?.sale_mode == 1) {
|
||||
return cutPriceConDom //剪板
|
||||
} else {
|
||||
return priceConDom //大货
|
||||
}
|
||||
}, [order])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className={styles.orders_list_title}>{numText}</View>
|
||||
<View className={styles.orders_list_con}>
|
||||
{
|
||||
order?.list?.map(item => {
|
||||
return <View key={item.product_code} className={styles.order_list}>
|
||||
<View className={styles.order_list_title}>
|
||||
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||
<View className={styles.num}>共{item?.product_colors.length}种</View>
|
||||
</View>
|
||||
<View className={styles.order_list_scroll}>
|
||||
{item?.product_colors?.map(colorItem => {
|
||||
return <View key={colorItem.id} className={styles.order_list_item}>
|
||||
<View className={styles.order_list_item_img}>
|
||||
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
|
||||
</View>
|
||||
<View className={styles.order_list_item_con}>
|
||||
<View className={styles.order_list_item_des}>
|
||||
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
|
||||
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
|
||||
</View>
|
||||
<View className={styles.order_list_item_count}>
|
||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
}
|
||||
<View className={styles.order_estimated_amount}>
|
||||
{showPriceAll}
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
@ -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,57 +95,29 @@ 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 <EstimatedAmount number={formatPriceDiv(order.estimate_amount)} title="预估金额" />
|
||||
} else if(order?.status == SaleOrderStatusCancel.value) {
|
||||
//订单状态为取消订单时
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item, order?.the_previous_status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
} else {
|
||||
//其他订单状态
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item, order?.status)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{
|
||||
priceList.map(item => {
|
||||
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
|
||||
})
|
||||
}
|
||||
</>
|
||||
)
|
||||
}, [order])
|
||||
|
||||
//金额展示剪板
|
||||
const cutPriceConDom = useMemo(() => {
|
||||
if(!order) return
|
||||
return <EstimatedAmount number={formatPriceDiv(order.total_should_collect_money)} title="合计金额" />
|
||||
}, [order])
|
||||
|
||||
const showPriceAll = useMemo(() => {
|
||||
if(order?.sale_mode == 1) {
|
||||
return cutPriceConDom //剪板
|
||||
} else {
|
||||
return priceConDom //大货
|
||||
}
|
||||
|
||||
}, [order])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className={styles.orders_list_title}>{numText}</View>
|
||||
@ -181,7 +153,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
})
|
||||
}
|
||||
<View className={styles.order_estimated_amount}>
|
||||
{showPriceAll}
|
||||
{priceConDom}
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
|
@ -63,7 +63,7 @@ export default memo(({orderInfo = {logistics_details: [],payment_method: 0, stat
|
||||
<View className={classnames(styles.order_status_time, (index == 0)&&styles.order_status_select)}>{formatDateTime(item.time)}</View>
|
||||
</View>
|
||||
<Text className={classnames(styles.order_status_des, (index == 0)&&styles.order_status_des_select)}>{item.desc}</Text>
|
||||
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<CountDown endTime={endTime}/>}
|
||||
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<CountDown onFinish={onRefresh} endTime={endTime}/>}
|
||||
</View>)}
|
||||
</View>
|
||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => 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 (
|
||||
<>
|
||||
<View className={styles.pay_time}>
|
||||
剩<Text>{showTime||'00:00:00'}</Text>支付关闭,订单自动取消
|
||||
剩<Text>{showTime||'--:--:--'}</Text>支付关闭,订单自动取消
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,7 @@ export default memo(({style, number = 0, priceTitle = ''}:Param) => {
|
||||
<>
|
||||
<View className={styles.order_price}>
|
||||
<View className={classnames(styles.order_price_text, styles.emphasis)}>
|
||||
<Text>{priceTitle}</Text>
|
||||
<View className={styles.iconfont_msg}>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-tuikuanshouhou')}></Text>
|
||||
{/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
|
||||
</View>
|
||||
<Text>{priceTitle}:</Text>
|
||||
</View>
|
||||
<View className={classnames(styles.order_price_num, styles.emphasis_num)} style={style}>
|
||||
{priceDom()}
|
||||
|
@ -39,6 +39,7 @@ import styles from './index.module.scss'
|
||||
setOrderRemark(res.data.remark)
|
||||
}
|
||||
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 (
|
||||
<View className={styles.order_main}>
|
||||
<OrderState orderInfo={{logistics_details:orderDetail?.logistics_details, payment_method: orderDetail?.payment_method, status:orderDetail?.status}}/>
|
||||
<OrderState orderInfo={orderDetail} onRefresh={refresh}/>
|
||||
<View >
|
||||
<AddressInfoDetail orderInfo={addressInfoDetailData} onSelect={getAddress} onChangeShipmentMode={getShipmentMode} ref={addressRef} defaultValue={defaultAddress} />
|
||||
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={getShipmentMode} ref={addressRef} />
|
||||
</View>
|
||||
<KindList order={formatPreViewOrderMemo}/>
|
||||
<View className={styles.order_info} >
|
||||
|
Loading…
x
Reference in New Issue
Block a user