Merge branch 'dev' of http://git.online.zzfzyc.com/mp/EShop into dev
This commit is contained in:
@@ -2,13 +2,23 @@
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
// margin-top: 30px;
|
||||
.scroll{
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
.list_scroll{
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.btns_item{
|
||||
width: 152px;
|
||||
height: 72px;
|
||||
padding: 0 10px;
|
||||
height: 60px;
|
||||
border: 2px solid #dddddd;
|
||||
border-radius: 38px;
|
||||
text-align: center;
|
||||
line-height: 72px;
|
||||
line-height: 60px;
|
||||
font-size: $font_size;
|
||||
color: $color_font_three;
|
||||
&:nth-child(n+2) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { CancelOrderApi } from "@/api/order"
|
||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||
import { alert } from "@/common/common"
|
||||
import { ORDER_STATUS } from "@/common/enum"
|
||||
import { View } from "@tarojs/components"
|
||||
import { ScrollView, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { useCallback, useRef, memo } from "react"
|
||||
import { useCallback, useRef, memo, useState, useEffect } from "react"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type Param = {
|
||||
@@ -24,7 +24,6 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
SaleOrderStatusArranged,
|
||||
SaleOrderStatusWaitingDelivery,
|
||||
SaleOrderStatusComplete,
|
||||
SaleOrderStatusCancel,
|
||||
SaleOrderStatusRefund,
|
||||
SaleOrderStatusWaitingPayment,
|
||||
SaleOrderStatusWaitingReceipt,
|
||||
@@ -73,23 +72,27 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
if(orderInfo) {
|
||||
if(item.id == 1) {
|
||||
//取消订单按钮
|
||||
return( orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) //在代发货之前没有付过款
|
||||
return( orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) //在待发货之前没有付过款
|
||||
} else if (item.id == 2) {
|
||||
//去付款按钮
|
||||
return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示
|
||||
} else if(item.id == 3) {
|
||||
//申请退款
|
||||
return (orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //在代发货之前付过款
|
||||
return (orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //在待发货之前付过款
|
||||
} else {
|
||||
//其他按钮
|
||||
return item.value.includes(orderInfo.status)
|
||||
}
|
||||
}
|
||||
},[orderInfo])
|
||||
|
||||
//点击按钮操作
|
||||
const submitBtns = (val) => {
|
||||
const submitBtns = (val, index) => {
|
||||
clickEvent(val, index);
|
||||
(val == 1)&&cancelOrder(); //取消订单按钮
|
||||
(val == 2)&&onClick?.(val); //去付款按钮
|
||||
(val == 2)&&onClick?.(2); //去付款按钮
|
||||
(val == 6)&&receiveOrder(); //确认收货
|
||||
|
||||
}
|
||||
|
||||
//取消订单
|
||||
@@ -113,11 +116,53 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
})
|
||||
}
|
||||
|
||||
//确认订单
|
||||
const {fetchData: receiveOrderFetchData} = ReceiveOrderApi()
|
||||
const receiveOrder = async () => {
|
||||
console.log('123456')
|
||||
Taro.showModal({
|
||||
title: '确定收货?',
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
let res = await receiveOrderFetchData({sale_order_id: orderInfo?.orderId})
|
||||
if(res.success){
|
||||
onClick?.(6)
|
||||
alert.success('收货成功')
|
||||
} else {
|
||||
alert.error('收货失败')
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
//按钮点击滚动
|
||||
const [selectInfo, setSelectInfo] = useState({
|
||||
selected: -1, //当前选中的id
|
||||
tabId: '', //需要滚动到的id
|
||||
})
|
||||
const clickEvent = (id, index) => {
|
||||
console.log(id, index)
|
||||
const num = index > 0?( index - 1) : 0
|
||||
console.log('num::',orderBtnsList.current[num].id)
|
||||
setSelectInfo((e) => ({...e, tabId:orderBtnsList.current[num].id.toString(), selected: id}))
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.btns_list}>
|
||||
{orderBtnsList.current.map((item) =>
|
||||
orderBtnsShow(item)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id)}>{item.label}</View>
|
||||
)}
|
||||
<ScrollView scrollX scrollIntoView={`orderBtns_${selectInfo.tabId}`} scrollWithAnimation={true} className={styles.scroll}>
|
||||
<View className={styles.list_scroll}>
|
||||
{orderBtnsList.current.map((item, index) =>
|
||||
orderBtnsShow(item)&&<View key={item.id} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
// <View key={item.id} id={`orderBtns_${item.id}`} className={styles.btns_item} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
||||
)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
</View>
|
||||
)
|
||||
})
|
||||
@@ -62,7 +62,7 @@ export default memo((
|
||||
</View>}
|
||||
|
||||
<View className={style.drawer_container_context}>
|
||||
{children}
|
||||
{show&&children}
|
||||
</View>
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View>
|
||||
|
||||
@@ -71,12 +71,12 @@ export default memo(forwardRef(({
|
||||
<View className={styles.search_main} >
|
||||
<View className={styles.search_con}>
|
||||
{showIcon&&<View className={classnames('iconfont', 'icon-sousuo', styles.icon_a_sousuo1_self, placeIcon=='inner'?styles.icon_inner:styles.icon_out)}></View>}
|
||||
<Input placeholderStyle='color:#ABABAB; font-size:26rpx' className={classnames(placeIcon=='out'&&styles.input_out)} disabled={disabled} value={inputCon} placeholder={placeholder} onInput={(e) => onInputEven(e)}></Input>
|
||||
<Input placeholderStyle='color:#ABABAB; font-size:26rpx' onConfirm={onSearch} className={classnames(placeIcon=='out'&&styles.input_out)} disabled={disabled} value={inputCon} placeholder={placeholder} onInput={(e) => onInputEven(e)}></Input>
|
||||
{!!inputCon&&<View className={styles.search_closeBtn}>
|
||||
<CloseBtn onClose={() => clearInput()} styleObj={{width: '20rpx', height:'20rpx', backgroundColor:'#fff', border:'0'}}/>
|
||||
</View>}
|
||||
</View>
|
||||
{showBtn&&<View style={btnStyle} className={styles.btn} onClick = {() => onSearch()}>{btnTitle}</View>}
|
||||
{showBtn&&<View style={btnStyle} className={styles.btn} onClick = {onSearch}>{btnTitle}</View>}
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -117,8 +117,6 @@ export default ({show = false, onClose}: param) => {
|
||||
if(item.select) select_count++
|
||||
}
|
||||
})
|
||||
console.log('list_count::',list_count)
|
||||
console.log('select_count::',select_count)
|
||||
setSelectStatus(select_count == list_count)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user