电子商城测试版v4

This commit is contained in:
2022-07-05 20:32:37 +08:00
parent 29090350ef
commit 7a2dc0006f
19 changed files with 649 additions and 168 deletions
@@ -20,7 +20,7 @@
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 20px 0 20px;
padding: 20px 30px 0 30px;
font-size: 26px;
color: #707070;
.operation_check{
@@ -35,9 +35,12 @@
}
}
.operation_check_right{
Text{
color: #CCCCCC;
margin-right: 20px;
.operation_check_move{
color: #707070;
margin-right: 30px;
}
.operation_check_cancel{
color: #007AFF;
}
}
.class_list{
+45 -23
View File
@@ -11,6 +11,7 @@ import CreatePopup from "../components/createPopup";
import UpdatePopup from "../components/updatePopup";
import styles from './index.module.scss'
import MCheckbox from "@/components/checkbox";
import AddCollection from "@/components/addCollection";
export default () => {
@@ -20,7 +21,7 @@ export default () => {
const getFavoriteInfo = () => {
let arr:any[] = []
new Array(10).fill("").map((item, index) => {
arr.push({code: index})
arr.push({id:index, code: index})
})
setList(arr)
}
@@ -34,32 +35,53 @@ export default () => {
getFavoriteInfo()
}, [searchData])
//获取选中的id
const [ids, setIds] = useState<number[]>([])
const getSelectIds = useCallback((val) => {
setIds(() => val)
}, [])
//全选反选
const [selectStatus, setSelectStatus] = useState(false)
const selectCallBack = useCallback(() => {
setSelectStatus(() => true)
}, [])
const colseCallBack = useCallback(() => {
setSelectStatus(() => false)
}, [])
// useEffect(() => {
// if(list.length)
// setSelectStatus(ids.length == list.length)
// }, [ids, list])
const [collectionShow, setCollectionShow] = useState(false)
const closeCollection = useCallback(() => {
setCollectionShow(false)
}, [])
return (
<View className={styles.collection_main}>
<View className={styles.search}>
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
</View>
<View className={styles.operation}>
<View className={styles.operation_check}>
<MCheckbox onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
<Text>全选</Text>
</View>
<View className={styles.operation_check_right}>
<Text>移动到</Text>
<Text>取消收藏</Text>
</View>
</View>
<View className={styles.class_list}>
<Product productList={list}/>
</View>
const onAdd = () => {
}
return (
<View className={styles.collection_main}>
<View className={styles.search}>
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={onSearch} placeholder="请输入面料关键词" />
</View>
)
<View className={styles.operation}>
<View className={styles.operation_check}>
<MCheckbox status={selectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
<Text>全选</Text>
</View>
<View className={styles.operation_check_right}>
<Text className={styles.operation_check_move} onClick={() => setCollectionShow(true)}>移动到</Text>
<Text className={styles.operation_check_cancel}>取消收藏</Text>
</View>
</View>
<View className={styles.class_list}>
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus}/>
</View>
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
</View>
)
}
@@ -5,54 +5,77 @@ import styles from './index.module.scss'
import { formatHashTag, formatImgUrl } from "@/common/fotmat"
import LabAndImg from "@/components/LabAndImg"
import MCheckbox from "@/components/checkbox";
import { useCallback, useEffect, useState } from "react"
import { useCallback, useEffect, useRef, useState } from "react"
type Params = {
desStatus?: true|false,
productList?: any[]
productList?: any[],
onSelectIds?: (val: number[]) => void
selectStatus?: false|true
}
export default ({desStatus = true, productList = []}:Params) => {
export default ({productList = [], onSelectIds, selectStatus = false}:Params) => {
const [list, setList] = useState<any[]>([])
useEffect(() => {
console.log('productList::', productList)
setList(() => [...productList])
},[productList])
useEffect(() => {
if(list.length) {
list.map(item => {
item.check = selectStatus
})
}
setList(() => [...list])
}, [selectStatus])
const onSelect = (item, e) => {
console.log('e:::', e)
const onChangeSelect = (item) => {
if(item.check) {
onClose(item)
} else {
onSelect(item)
}
}
//选中和取消选中
const onSelect = (item) => {
item.check = true
setList(() => ([...list]))
}
const onClose = (item, e) => {
const onClose = (item) => {
item.check = false
setList(() => ([...list]))
}
//监听数据变化
useEffect(() => {
let ids: number[] = []
list.map(item => {
if(item.check) ids.push(item.id)
})
onSelectIds?.(ids)
}, [list])
return (
<View className={styles.products_list}>
{list?.map(item => {
return <View className={styles.products_item} onClick={() => goLink(`/pages/details/index?id=${item.id}`)}>
<View className={styles.checkbox}>
<MCheckbox status={item.check} onSelect={() => onSelect(item, e)} onClose={() => onClose(item, e)}/>
return <View className={styles.products_item} onClick={() => onChangeSelect(item)}>
<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)}/>
</View>
<View className={styles.item_img}>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
<View className={styles.num}>{item.product_color_count}色</View>
</View>
<View className={styles.item_con}>
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
<View className={styles.tag_list}>
<View className={styles.tag}>{item.width}</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>}
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
<View className={styles.tag_list}>
<View className={styles.tag}>{item.width}</View>
<View className={styles.tag_g}>{item.weight_density}</View>
</View>
<View className={styles.introduce}>{item.component}</View>
</View>
</View>
})}
<View className="common_safe_area_y"></View>
</View>
)
}
+1 -1
View File
@@ -143,7 +143,7 @@ export default () => {
<View className={styles.more} onClick={(e) => moreUpdate(item,e)}>更多</View>
</View>
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
<Product productList={item.product_color_list}/>
<Product productList={item.product_color_list||[]}/>
</View>
</View>)}
</View>
+1
View File
@@ -53,6 +53,7 @@ import styles from './index.module.scss'
let res = await getOrderFetchData({id: orderId.current})
setOrderDetail(res.data)
setOrderRemark(res.data.remark)
if(res.data.status == SaleorderstatusWaitingPrePayment.value) toPay()
}
Taro.stopPullDownRefresh()
Taro.hideToast()
@@ -78,9 +78,9 @@
width:152px;
font-size: 28px;
height: 60px;
color: $color_font_two;
color:#007AFF;
z-index: 999;
border: 2px solid #dddddd;
border: 2px solid #007AFF;
border-radius: 36px;
text-align: center;
line-height: 60px;
@@ -1,4 +1,4 @@
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS } from "@/common/enum"
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
import LabAndImg from "@/components/LabAndImg"
import { Text, View } from "@tarojs/components"
@@ -17,6 +17,7 @@ type OrderParam = {
total_number: number,
stage: number, //订单状态
type: 1|2, //1退货, 2退款
refund_type: number, //退款状态
total_sale_price: number, //销售金额
total_should_collect_money: number, //应收金额
total_weight_error_discount: number, //空差优惠
@@ -57,76 +58,80 @@ export default memo(({order, comfirm = false}:Param) => {
ReturnStageRejected, // 已拒绝
} = AFTER_ORDER_STATUS
//退款状态枚举
const {
ShouldCollectOrderRefundTypeUnknown,
ShouldCollectOrderRefundTypeAdvanceReceiptRefund,
ShouldCollectOrderRefundTypeReturnForRefund,
ShouldCollectOrderRefundTypeSalesRefund,
} = REFUND_STATUS
//金额列表枚举
const priceList = [
{
id:5,
big_value:[
ReturnStageQualityCheckPendingRefund.value,
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value,
],
cut_value: [ReturnStageRejected.value,
ReturnStageApplying.value,
ReturnStageWaitCheck.value,
ReturnStageChecked.value,
ReturnStageQualityCheckPendingRefund.value,
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value,
ReturnStageCancel.value
],
model_value: [
ReturnStageApplying.value,
ReturnStageWaitCheck.value,
ReturnStageChecked.value,
ReturnStageQualityCheckPendingRefund.value,
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value,
ReturnStageCancel.value
],
label:'合计金额',
field: 'total_refund_amount'
},
{
id:1,
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
model_value: [],
label:'扣款金额',
field: 'total_sale_price'
},
{
id:2,
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
cut_value: [],
model_value: [],
label:'其他扣款',
field: 'total_weight_error_discount'
field: 'other_deduction_amount'
},
{
id:3,
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
cut_value: [ReturnStageServiceOrderPendingRefund.value],
model_value: [
ReturnStageQualityCheckPendingRefund.value,
ReturnStageServiceOrderPendingRefund.value
],
label:'应退金额',
field: 'total_should_collect_money'
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageReturned.value],
model_value: [ReturnStageReturned.value],
label:'退款金额',
field: 'refund_amount'
},
{
id:4,
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageReturned.value],
model_value: [ReturnStageReturned.value],
label:'退款金额',
field: 'total_should_collect_money'
},
{
id:5,
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageReturned.value],
model_value: [ReturnStageReturned.value],
label:'退款去向',
field: 'actual_amount'
},
{
id:6,
big_value:[ReturnStageQualityCheckPendingRefund.value],
cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
model_value: [ReturnStageApplying.value],
label:'合计金额',
field: 'actual_amount'
},
]
]
//是否显示价格
const showPrice = useCallback((priceInfo) => {
let key = ['big_value', 'model_value', 'cut_value']
return priceInfo[key[order?.sale_mode]].includes(order?.stage)
if(priceInfo.id == 5) {
return priceInfo[key[order?.sale_mode]].includes(order?.stage)||(order.refund_type == ShouldCollectOrderRefundTypeSalesRefund.value)
} else {
return priceInfo[key[order?.sale_mode]].includes(order?.stage)
}
}, [order])
const priceConDom = useMemo(() => {
@@ -175,7 +180,7 @@ export default memo(({order, comfirm = false}:Param) => {
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
<View className={styles.order_list_item_price}>
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
{(order?.stage == ReturnStageReturned.value)&&<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>}
</View>
</View>
<View className={styles.order_list_item_count}>
+8 -5
View File
@@ -60,6 +60,11 @@ import styles from './index.module.scss'
total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠
actual_amount: orderDetail.actual_amount, //实付金额
the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态
other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额
total_refund_amount: orderDetail.total_refund_amount, //合计金额
refund_amount: orderDetail.refund_amount, //退款金额
refund_type: orderDetail.refund_type //退款状态
})
}
const formatPreViewOrderMemo = useMemo(() => {
@@ -104,7 +109,7 @@ import styles from './index.module.scss'
if(val == 1) {
setLogisticsShow(true)
} else {
const list = orderDetail?.fabric_piece_accessory_url.map(item => {
const list = orderDetail?.accessory_url.map(item => {
return formatImgUrl(item)
})
Taro.previewImage({
@@ -132,9 +137,7 @@ import styles from './index.module.scss'
<AddressInfoDetail return_address={orderDetail?.return_user_name} return_phone={orderDetail?.return_user_phone} stage={orderDetail?.stage} onLogistics={onShowLogistics}/>
<KindList order={formatPreViewOrderMemo}/>
<OrderDes orderInfo={orderDetail}/>
<View className={styles.submit_order}>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick} />
</View>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
<AfterSalePricture urls={orderDetail?.fabric_piece_accessory_url}/>
<ReturnLogistics images={orderDetail?.accessory_url} descValue={orderDetail?.take_goods_remark} show={logisticsShow} id={orderDetail?.return_apply_order_id} onClose={onCloseLogistics} onSubmit={logisticsSuccess}/>
<ApplyRecord show={applyRecord} id={orderDetail?.id} onClose={() => setApplyRecord(false)}/>
@@ -194,7 +197,7 @@ import styles from './index.module.scss'
const showList = useMemo(() => {
let res = urls.map(item => {
return formatImgUrl(item)
return formatImgUrl(item, "!w800")
})
return res
}, [urls])
@@ -27,6 +27,7 @@ type Param = {
rgb: {r:number, g:number, b:number},
texturl_url: string,
type: number //1 退货 2退款
return_apply_order_id: number //退款申请单
},
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
}
@@ -52,7 +53,8 @@ export default memo(({value, onClickBtn}: Param) => {
stage: value?.stage, //订单状态
orderId: value?.id,
sale_mode: value?.sale_mode, //订单类型
type: value?.type //退货or退款
type: value?.type, //退货or退款
return_apply_order_id: value?.return_apply_order_id //退款申请单
}
}, [value])
@@ -109,7 +111,7 @@ export default memo(({value, onClickBtn}: Param) => {
<Text>订单号:{value?.order_no}</Text>
</View>
</View>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} />
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} fixedBottom={false}/>
</View>
)
})