电子商城测试版v4
This commit is contained in:
parent
bbc485ee3f
commit
f05389ced7
@ -1,5 +1,4 @@
|
||||
import { useRequest } from "@/use/useHttp"
|
||||
|
||||
/**
|
||||
* 解密用户微信信息
|
||||
*/
|
||||
|
@ -6,12 +6,13 @@
|
||||
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
|
||||
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
|
||||
// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发
|
||||
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
|
||||
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
||||
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||
export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
|
||||
export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||
// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
|
||||
|
||||
// CDN
|
||||
// 生成密钥
|
||||
|
@ -29,13 +29,13 @@ export const AFTER_ORDER_STATUS = {
|
||||
|
||||
//支付方式
|
||||
export const PAYMENT_METHOD = {
|
||||
PaymentMethodPreDeposit: {value:1, label:'预存款'},
|
||||
PaymentMethodAccountPeriod : {value:2, label:'账期'},
|
||||
PaymentMethodofflineRemittance: {value:0, label:'线下汇款'},
|
||||
PaymentMethodScanCodeToPay: {value:3, label:'扫码支付'},
|
||||
PaymentMethodCashOnDelivery: {value:4, label:'货到付款'},
|
||||
PaymentMethodPreDeposit: {value:2, label:'预存款'},
|
||||
PaymentMethodAccountPeriod : {value:3, label:'账期'},
|
||||
PaymentMethodofflineRemittance: {value:1, label:'线下汇款'},
|
||||
PaymentMethodScanCodeToPay: {value:4, label:'扫码支付'},
|
||||
PaymentMethodCashOnDelivery: {value:5, label:'货到付款'},
|
||||
}
|
||||
export type PAYMENT_METHOD_PARAM = 0|1|2|3|4
|
||||
export type PAYMENT_METHOD_PARAM = 1|2|3|4|5
|
||||
|
||||
|
||||
//订单类型
|
||||
@ -58,10 +58,17 @@ export const SUBSCRIPTION_MESSAGE_SCENE = {
|
||||
ApplyGoods: {value:3, label: '申请退款'}
|
||||
}
|
||||
|
||||
//退款状态枚举
|
||||
//应收单退款状态枚举
|
||||
export const REFUND_STATUS = {
|
||||
ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'},
|
||||
ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'},
|
||||
ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'},
|
||||
ShouldCollectOrderRefundTypeSalesRefund: {value:3, label:'销售退款'},
|
||||
}
|
||||
|
||||
//申请单退款状态枚举
|
||||
export const REFUND_STATUS_ORDER = {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund: {value:2, label:'退货退款'}, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund: {value:3, label:'销售退款'}, // 销售退款
|
||||
}
|
@ -24,7 +24,6 @@ export const throttle = (fn, delay) => {
|
||||
let pre = 0;
|
||||
return (...params) => {
|
||||
let now = new Date().getTime();
|
||||
console.log('相差:',now-pre)
|
||||
if (now - pre > delay) {
|
||||
fn(...params);
|
||||
pre = now;
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
|
||||
import { alert } from "@/common/common"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, SALE_MODE } from "@/common/enum"
|
||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum"
|
||||
import {Text, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import {useRef, memo, useState, useMemo } from "react"
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
|
||||
import { throttle } from "@/common/util"
|
||||
|
||||
type Param = {
|
||||
orderInfo: {
|
||||
@ -31,6 +32,12 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
ReturnStageServiceOrderPendingRefund,
|
||||
} = AFTER_ORDER_STATUS
|
||||
|
||||
const {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
|
||||
//订单类型
|
||||
// const {
|
||||
// SaLeModeBulk,
|
||||
@ -50,7 +57,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
{
|
||||
id: 1,
|
||||
big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
|
||||
cut_value: [],
|
||||
cut_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value, ],
|
||||
model_value: [],
|
||||
label: '取消退货'
|
||||
},
|
||||
@ -77,13 +84,17 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
let key = ['big_value', 'model_value', 'cut_value']
|
||||
if(item.id == 1) {
|
||||
//取消退货
|
||||
return (orderInfo.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
return (orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
} else if (item.id == 6) {
|
||||
//取消退款
|
||||
return (orderInfo.type == 2)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
if(orderInfo?.sale_mode == 0) {
|
||||
return (orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
} else {
|
||||
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
}
|
||||
} else if (item.id == 4) {
|
||||
//质检结果
|
||||
return (orderInfo?.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
|
||||
return (orderInfo?.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
|
||||
} else {
|
||||
return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
|
||||
}
|
||||
@ -99,19 +110,19 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
|
||||
|
||||
//点击按钮操作
|
||||
const submitBtns = (val, index) => {
|
||||
const submitBtns = throttle((val, index) => {
|
||||
if (val == 1) {
|
||||
cancelOrder({title:'要取消退货吗?'})
|
||||
cancelOrder({title:'要取消退货吗?', val})
|
||||
} else if (val == 6) {
|
||||
cancelOrder({title:'要取消退款吗?'})
|
||||
cancelOrder({title:'要取消退款吗?', val})
|
||||
} else {
|
||||
onClick?.(val)
|
||||
}
|
||||
}
|
||||
}, 600)
|
||||
|
||||
//取消退货/退款
|
||||
const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
|
||||
const cancelOrder = ({title = ''}) => {
|
||||
const cancelOrder = ({title = '', val}) => {
|
||||
Taro.showModal({
|
||||
title,
|
||||
success: async function (res) {
|
||||
@ -119,7 +130,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
||||
let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
|
||||
if(res.success) {
|
||||
alert.success('取消成功')
|
||||
onClick?.(1)
|
||||
onClick?.(val)
|
||||
} else {
|
||||
alert.none(res.msg)
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import styles from './index.module.scss'
|
||||
import { AddShoppingCartApi } from "@/api/shopCart"
|
||||
import { ApplyRefundApi } from "@/api/salesAfterOrder"
|
||||
import { UseSubscriptionMessage } from "@/use/useCommonData"
|
||||
import { throttle } from "@/common/util"
|
||||
|
||||
type Param = {
|
||||
orderInfo: {
|
||||
@ -132,7 +133,7 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
const {openSubscriptionMessage} = UseSubscriptionMessage()
|
||||
|
||||
//点击按钮操作
|
||||
const submitBtns = async (val, index) => {
|
||||
const submitBtns = throttle(async (val, index) => {
|
||||
if (val == 1) {
|
||||
cancelOrder()
|
||||
} else if (val == 6) {
|
||||
@ -142,14 +143,27 @@ export default memo(({orderInfo, onClick}:Param) => {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
|
||||
} else if (val == 3) {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
onClick?.(val)
|
||||
bigApplyRefurn()
|
||||
} else if(val == 8) {
|
||||
applyRefund()
|
||||
} else {
|
||||
onClick?.(val)
|
||||
}
|
||||
}, 600)
|
||||
|
||||
//大货申请退款
|
||||
const bigApplyRefurn = () => {
|
||||
Taro.showModal({
|
||||
title: '要申请退款吗?',
|
||||
success: async function (res) {
|
||||
if(res.confirm) {
|
||||
await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
|
||||
onClick?.(3)
|
||||
} else {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//取消订单
|
||||
|
@ -1,352 +0,0 @@
|
||||
import {Image, ScrollView, View } from "@tarojs/components"
|
||||
import Popup from "@/components/popup"
|
||||
import classnames from "classnames";
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
import InfiniteScroll from "@/components/infiniteScroll";
|
||||
import styles from "./index.module.scss"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import {GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi} from "@/api/shopCart"
|
||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import { setParam } from "@/common/system";
|
||||
import { debounce } from "@/common/util";
|
||||
import Counter from "../counter";
|
||||
import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user";
|
||||
|
||||
type param = {
|
||||
show?: true|false,
|
||||
onClose?: () => void
|
||||
}
|
||||
export default ({show = false, onClose}: param) => {
|
||||
const selectList = [
|
||||
{value:0, title:'大货', unit:'条', eunit:'kg', step:1, digits:0, minNum:1, maxNum:100000, defaultNum:1},
|
||||
{value:1,title:'剪板', unit:'米', eunit:'m', step:1, digits:2, minNum:0.5, maxNum:9.99, defaultNum:1},
|
||||
{value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10},
|
||||
]
|
||||
|
||||
const [selectIndex, setSelectIndex] = useState(0)
|
||||
const selectProduct = (index:number) => {
|
||||
setSelectIndex(index)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
resetList()
|
||||
setSelectStatus(true)
|
||||
}, [selectIndex])
|
||||
|
||||
|
||||
|
||||
//重置勾选数据
|
||||
const resetList = () => {
|
||||
list?.map(item => {
|
||||
if(selectIndex == item.sale_mode || selectIndex == -1) {
|
||||
item.select = true
|
||||
} else {
|
||||
item.select = false
|
||||
}
|
||||
})
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//获取数据
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const {fetchData} = GetShoppingCartApi()
|
||||
const getShoppingCart = async () => {
|
||||
const {data} = await fetchData()
|
||||
let color_list = data.color_list||[]
|
||||
initList(color_list)
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
//初始化勾选数据
|
||||
const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([])
|
||||
const initSelectData = (data:{id:number}[] = []) => {
|
||||
let res = data?.map(item => {
|
||||
return {id: item.id, checked: true}
|
||||
})
|
||||
setSelectData(() => res)
|
||||
}
|
||||
|
||||
//初始化全部数据
|
||||
const initList = (color_list) => {
|
||||
color_list?.map(item => {
|
||||
if(selectIndex == item.sale_mode) item.select = true
|
||||
item.count = formatCount(item)
|
||||
})
|
||||
setList(color_list)
|
||||
}
|
||||
|
||||
//显示是展示数据
|
||||
useEffect(() => {
|
||||
if(!show) {
|
||||
setList([])
|
||||
setSelectIndex(0)
|
||||
} else {
|
||||
setLoading(true)
|
||||
getShoppingCart()
|
||||
}
|
||||
}, [show])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
setList([])
|
||||
}
|
||||
}, [])
|
||||
|
||||
const [showPopup, setShowPopup] = useState(false)
|
||||
useEffect(() => {
|
||||
setShowPopup(show)
|
||||
}, [show])
|
||||
|
||||
//全选反选
|
||||
const [selectStatus, setSelectStatus] = useState(false)
|
||||
const selectAll = () => {
|
||||
list.map(item => {
|
||||
if(selectIndex == item.sale_mode || selectIndex == -1)
|
||||
item.select = !selectStatus
|
||||
})
|
||||
setSelectStatus(!selectStatus)
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//checkbox选中回调
|
||||
const selectCallBack = (item) => {
|
||||
item.select = true
|
||||
checkSelect()
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
||||
const checkSelect = () => {
|
||||
let list_count = 0
|
||||
let select_count = 0
|
||||
list?.map(item => {
|
||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||
list_count ++
|
||||
if(item.select) select_count++
|
||||
}
|
||||
})
|
||||
setSelectStatus(select_count == list_count)
|
||||
}
|
||||
|
||||
//checkbox关闭回调
|
||||
const colseCallBack = (item) => {
|
||||
item.select = false
|
||||
checkSelect()
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//popup关闭
|
||||
const closePopup = () => {
|
||||
onClose?.()
|
||||
setShowPopup(false)
|
||||
}
|
||||
|
||||
//删除购物车内容
|
||||
const {fetchData:delShopFetchData} = DelShoppingCartApi()
|
||||
const delSelect = () => {
|
||||
getSelectId()
|
||||
if(selectIds.current.length <= 0) return alert.none('请选择要删除的面料!')
|
||||
Taro.showModal({
|
||||
content: '删除所选商品?',
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
|
||||
const res = await delShopFetchData({id:selectIds.current})
|
||||
if(res.success) {
|
||||
getShoppingCart()
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success',
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//获取面料选中的id
|
||||
const selectIds = useRef<number[]>([])
|
||||
const getSelectId = () => {
|
||||
selectIds.current = []
|
||||
list?.map(item => {
|
||||
if(selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||
item.select&&selectIds.current.push(item.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//格式化金额
|
||||
const formatPirce = useCallback((price) => {
|
||||
return Number(formatPriceDiv(price))
|
||||
}, [])
|
||||
|
||||
//格式化数量
|
||||
const formatCount = useCallback((item) => {
|
||||
console.log('item:::',item)
|
||||
return item.sale_mode == 0? item.roll : (item.length/100)
|
||||
}, [])
|
||||
|
||||
//格式化单位
|
||||
const formatUnit = useCallback((item) => {
|
||||
return item.sale_mode == 0? '条':'米'
|
||||
}, [])
|
||||
|
||||
//预估金额和总条数
|
||||
const estimatePrice = useMemo(() => {
|
||||
let estimate_amount = 0
|
||||
let product_list = new Set() //面料
|
||||
let color_count = 0 //颜色数量
|
||||
let all_count = 0 //总数量
|
||||
list.map(item => {
|
||||
if(item.select) {
|
||||
estimate_amount += item.estimate_amount
|
||||
product_list.add(item.product_id)
|
||||
color_count++
|
||||
all_count += item.sale_mode == 0?item.roll: (item.length)
|
||||
}
|
||||
})
|
||||
let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米'
|
||||
return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count}
|
||||
},[list])
|
||||
|
||||
|
||||
//去结算
|
||||
const {fetchData: useFetchData} = GetAdminUserInfoApi()
|
||||
const {fetchData: applyOrderAccessFetchData} = ApplyOrderAccessApi()
|
||||
const orderDetail = debounce( async () => {
|
||||
let res = await useFetchData()
|
||||
if(res.data.order_access_status !== 3) {
|
||||
if(res.data.order_access_status == 1) applyOrderAccessFetchData()
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。',
|
||||
cancelText: '联系客服',
|
||||
confirmText: '我知道',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
}
|
||||
getSelectId()
|
||||
if(selectIds.current.length == 0) {
|
||||
alert.error('请选择面料')
|
||||
} else {
|
||||
let ids = selectIds.current.join('-')
|
||||
setParam({ids, sale_mode:selectIndex}) //临时存储
|
||||
closePopup()
|
||||
goLink('/pages/order/comfirm')
|
||||
}
|
||||
}, 500)
|
||||
|
||||
|
||||
//计数组件-当后端修改完成才修改前端显示
|
||||
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
|
||||
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
|
||||
const getInputValue = debounce(async (num, item) => {
|
||||
let roll = item.sale_mode == 0?parseFloat(num):0
|
||||
let length = item.sale_mode != 0?(parseFloat(num)*100):0
|
||||
setUpdateShoppingCartLoading(() => true)
|
||||
let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length})
|
||||
setUpdateShoppingCartLoading(() => false)
|
||||
if(res.success) {
|
||||
getShoppingCart()
|
||||
}
|
||||
}, 300)
|
||||
|
||||
return (
|
||||
<View className={styles.shop_cart_main}>
|
||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()} >
|
||||
<View className={styles.popup_con}>
|
||||
<View className={styles.header}>
|
||||
<View onClick={selectAll}>{!selectStatus?'全选':'反选'}</View>
|
||||
<View onClick={delSelect}>
|
||||
<text className={classnames('iconfont', 'icon-shanchu', styles.miconfont)}></text>
|
||||
删除所选
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.count_all}>{estimatePrice.countText}</View>
|
||||
<View className={styles.search}>
|
||||
{selectList.map((item) => {
|
||||
return <View key={item.value} onClick={() => selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title}</View>
|
||||
})}
|
||||
</View>
|
||||
<View className={styles.con}>
|
||||
{loading&&<LoadingCard/>}
|
||||
{!loading&&list?.length > 0&&<InfiniteScroll moreStatus={false} >
|
||||
<View className={styles.product_list}>
|
||||
{list?.map((item, index) => {
|
||||
return <View key={index} className={classnames(styles.product_item, (selectIndex!=-1&&selectIndex!= item.sale_mode)&&styles.no_product_item_select)}>
|
||||
<View className={styles.checkbox}>
|
||||
<MCheckbox disabled={selectIndex!=-1&&selectIndex!=item.sale_mode} status={item.select} onSelect={() => selectCallBack(item)} onClose={() => colseCallBack(item)}/>
|
||||
</View>
|
||||
<View className={styles.img}>
|
||||
<Image mode="aspectFill" src={formatImgUrl(item.texture_url)}/>
|
||||
</View>
|
||||
<View className={styles.des}>
|
||||
<View className={styles.title}>{formatHashTag(item.product_code, item.product_name)}</View>
|
||||
<View className={styles.subtitle}>{item.product_color_code +' ' + item.product_color_name}</View>
|
||||
<View className={styles.tag}>{item.sale_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.count}>
|
||||
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[selectIndex].eunit}</text></View>
|
||||
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||
<View className={styles.btn_count}>
|
||||
<Counter
|
||||
onBlue={(e) => getInputValue(e, item)}
|
||||
defaultNum={item.count}
|
||||
step={selectList[selectIndex].step}
|
||||
digits={selectList[selectIndex].digits}
|
||||
onClickBtn={(e) => getInputValue(e, item)}
|
||||
unit={formatUnit(item)}
|
||||
minNum={selectList[selectIndex].minNum}
|
||||
maxNum={selectList[selectIndex].maxNum}
|
||||
disable={UpdateShoppingCartLoading}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
</InfiniteScroll>}
|
||||
{!loading&&list?.length == 0 &&<View className={styles.empty}>
|
||||
<View className={styles.title}>暂未选择商品</View>
|
||||
<View className={styles.btn}>去选购</View>
|
||||
</View>}
|
||||
|
||||
</View>
|
||||
<View className={styles.buy_btn}>
|
||||
<View className={styles.buy_con}>
|
||||
<View className={styles.icon}>
|
||||
<View className={classnames('iconfont', 'icon-gouwuche', styles.miconfont)}></View>
|
||||
</View>
|
||||
<View className={styles.price_con}>
|
||||
<View className={styles.price_real}><text>¥</text>{estimatePrice.price}</View>
|
||||
<View className={styles.price_forecast}>预估金额</View>
|
||||
</View>
|
||||
<View className={styles.goPay} onClick={() => orderDetail()}>
|
||||
去结算({estimatePrice.color_count})
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ export default ({show = false, onClose}: param) => {
|
||||
<View className={styles.tag}>{item.sale_mode_name}</View>
|
||||
</View>
|
||||
<View className={styles.count}>
|
||||
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[selectIndex].eunit}</text></View>
|
||||
<View className={styles.price}><text>¥</text>{formatPirce(item.sale_price)}<text>/{selectList[item.sale_mode].eunit}</text></View>
|
||||
{/* <View className={styles.long}>×{formatCount(item)}{selectList[selectIndex].unit}</View> */}
|
||||
<View className={styles.btn_count}>
|
||||
<Counter
|
||||
|
@ -8,9 +8,10 @@ type Param = {
|
||||
title?: string,
|
||||
onChange?: (val: string) => void,
|
||||
placeholder?: string,
|
||||
defaultValue?: string
|
||||
defaultValue?: string,
|
||||
onlyRead?: false|true
|
||||
}
|
||||
export default memo(({onChange, title = '', placeholder = '请输入', defaultValue}:Param) => {
|
||||
export default memo(({onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false}:Param) => {
|
||||
const [descData, setDescData] = useState({
|
||||
number: 0,
|
||||
value: '',
|
||||
@ -37,7 +38,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
|
||||
<View className={styles.other_desc}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
<View className={styles.textarea}>
|
||||
{descData.show&&<Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={(e) => getDesc(e.detail.value)}></Textarea>||
|
||||
{(descData.show && !onlyRead)&&<Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={(e) => getDesc(e.detail.value)}></Textarea>||
|
||||
<View className={classnames(styles.textarea_con_pretend, descData.value&&styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value||placeholder}</View>
|
||||
}
|
||||
<View className={styles.descDataNum}>{descData.number +'/'+ descData.count}</View>
|
||||
|
@ -9,9 +9,10 @@ import styles from './index.module.scss'
|
||||
//图片列表
|
||||
type ImageParam = {
|
||||
onChange?:(val: string[]) => void,
|
||||
defaultList?: string[]
|
||||
defaultList?: string[],
|
||||
onlyRead?: false|true
|
||||
}
|
||||
const PictureItem:FC<ImageParam> = memo(({onChange, defaultList}) => {
|
||||
const PictureItem:FC<ImageParam> = memo(({onChange, defaultList, onlyRead = false}) => {
|
||||
const {getWxPhoto} = useUploadCDNImg()
|
||||
const [imageList, setImageLise] = useState<string[]>([])
|
||||
|
||||
@ -54,12 +55,12 @@ const PictureItem:FC<ImageParam> = memo(({onChange, defaultList}) => {
|
||||
{imageList.map((item, index) =>
|
||||
<View className={styles.ImgItem}>
|
||||
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
|
||||
<View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>
|
||||
{!onlyRead && <View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>}
|
||||
</View>)}
|
||||
<View className={styles.uploadImg } onClick={uploadImage}>
|
||||
{!onlyRead && <View className={styles.uploadImg } onClick={uploadImage}>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
||||
<Text className={styles.uploadText}>上传照片</Text>
|
||||
</View>
|
||||
</View>}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
@ -7,8 +7,10 @@ import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import "./index.scss"
|
||||
import {addressAddApi, addressDetailApi,addressEditApi} from "@/api/addressManager"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const {type,id} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
|
@ -1,12 +1,13 @@
|
||||
|
||||
import AddressList from "@/components/AddressList"
|
||||
import useLogin from "@/use/useLogin"
|
||||
import { Button, ScrollView, Text, View } from "@tarojs/components"
|
||||
import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro"
|
||||
import { useState } from "react"
|
||||
import "./index.scss"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
return (
|
||||
<View className="address-manager">
|
||||
<AddressList refresherEnabled={true}/>
|
||||
|
@ -11,6 +11,7 @@ import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReas
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import UploadImage from "@/components/uploadImage"
|
||||
import TextareaEnhance from "@/components/textareaEnhance";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
enum returnStatus {
|
||||
return_reason = 1, //原因
|
||||
@ -19,7 +20,7 @@ enum returnStatus {
|
||||
|
||||
}
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
useDidShow(() => {
|
||||
getSaleOrderPreView()
|
||||
})
|
||||
|
@ -12,8 +12,10 @@ import {GetProductListApi} from '@/api/material'
|
||||
import { useRouter } from "@tarojs/taro";
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
const [showPopup, setShowPopup] = useState(false)
|
||||
|
||||
const router = useRouter()
|
||||
|
@ -4,7 +4,7 @@ import { getFilterData } from "@/common/util";
|
||||
import Product from "../components/product";
|
||||
import Search from "@/components/search"
|
||||
import { Text, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro";
|
||||
import Taro, { useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import CreatePopup from "../components/createPopup";
|
||||
@ -16,6 +16,8 @@ import AddCollection from "@/components/addCollection";
|
||||
|
||||
export default () => {
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
//获取收藏夹面料
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const getFavoriteInfo = () => {
|
||||
@ -43,17 +45,33 @@ export default () => {
|
||||
}, [])
|
||||
|
||||
//全选反选
|
||||
const [selectStatus, setSelectStatus] = useState(false)
|
||||
const [allSelectStatus, setAllSelectStatus] = useState(false)
|
||||
const selectCallBack = useCallback(() => {
|
||||
setSelectStatus(() => true)
|
||||
setAllSelectStatus(() => true)
|
||||
setSelectStatus(1)
|
||||
}, [])
|
||||
const colseCallBack = useCallback(() => {
|
||||
setSelectStatus(() => false)
|
||||
setAllSelectStatus(() => false)
|
||||
setSelectStatus(3)
|
||||
}, [])
|
||||
// useEffect(() => {
|
||||
// if(list.length)
|
||||
// setSelectStatus(ids.length == list.length)
|
||||
// }, [ids, list])
|
||||
|
||||
const [selectStatus, setSelectStatus] = useState<1|2|3>(3)
|
||||
useEffect(() => {
|
||||
if(list.length) {
|
||||
if(ids.length == list.length) {
|
||||
setSelectStatus(1)
|
||||
setAllSelectStatus(true)
|
||||
} else if ( 0 < ids.length && ids.length < list.length){
|
||||
setSelectStatus(2)
|
||||
setAllSelectStatus(false)
|
||||
} else {
|
||||
setSelectStatus(3)
|
||||
setAllSelectStatus(false)
|
||||
}
|
||||
}
|
||||
}, [ids, list])
|
||||
|
||||
|
||||
const [collectionShow, setCollectionShow] = useState(false)
|
||||
const closeCollection = useCallback(() => {
|
||||
setCollectionShow(false)
|
||||
@ -70,7 +88,7 @@ export default () => {
|
||||
</View>
|
||||
<View className={styles.operation}>
|
||||
<View className={styles.operation_check}>
|
||||
<MCheckbox status={selectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
||||
<MCheckbox status={allSelectStatus} onSelect={() => selectCallBack()} onClose={() => colseCallBack()}/>
|
||||
<Text>全选</Text>
|
||||
</View>
|
||||
<View className={styles.operation_check_right}>
|
||||
@ -79,7 +97,7 @@ export default () => {
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.class_list}>
|
||||
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus}/>
|
||||
<Product productList={list} onSelectIds={getSelectIds} selectStatus={selectStatus} openCheckBox={true}/>
|
||||
</View>
|
||||
<AddCollection show={collectionShow} onAdd={onAdd} onClose={closeCollection}/>
|
||||
</View>
|
||||
|
@ -9,22 +9,24 @@ import { useCallback, useEffect, useRef, useState } from "react"
|
||||
|
||||
type Params = {
|
||||
productList?: any[],
|
||||
onSelectIds?: (val: number[]) => void
|
||||
selectStatus?: false|true
|
||||
onSelectIds?: (val: number[]) => void,
|
||||
selectStatus?: 1|2|3, //1全选,2不做处理,3全清空
|
||||
openCheckBox?: true|false //是否开启选择
|
||||
}
|
||||
export default ({productList = [], onSelectIds, selectStatus = false}:Params) => {
|
||||
export default ({productList = [], onSelectIds, selectStatus = 2, openCheckBox = false}:Params) => {
|
||||
const [list, setList] = useState<any[]>([])
|
||||
useEffect(() => {
|
||||
setList(() => [...productList])
|
||||
},[productList])
|
||||
|
||||
useEffect(() => {
|
||||
if(list.length) {
|
||||
if(list.length && selectStatus != 2) {
|
||||
list.map(item => {
|
||||
item.check = selectStatus
|
||||
item.check = (selectStatus == 1)
|
||||
})
|
||||
setList(() => [...list])
|
||||
}
|
||||
setList(() => [...list])
|
||||
|
||||
}, [selectStatus])
|
||||
|
||||
const onChangeSelect = (item) => {
|
||||
@ -57,13 +59,13 @@ export default ({productList = [], onSelectIds, selectStatus = false}:Params) =>
|
||||
return (
|
||||
<View className={styles.products_list}>
|
||||
{list?.map(item => {
|
||||
return <View className={styles.products_item} onClick={() => onChangeSelect(item)}>
|
||||
<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
||||
return <View className={styles.products_item} onClick={() => openCheckBox?onChangeSelect(item):goLink(`/pages/details/index?id=${item.product_id}`)}>
|
||||
{openCheckBox&&<View className={styles.checkbox} onClick={(e) => e.stopPropagation()}>
|
||||
<MCheckbox status={item.check} onSelect={() => onSelect(item)} onClose={() => onClose(item)}/>
|
||||
</View>
|
||||
</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 className={styles.num}>{item.enable_product_color_count}色</View>
|
||||
</View>
|
||||
<View className={styles.item_con}>
|
||||
<View className={styles.title}><text>{formatHashTag(item.product_code, '')} </text>{item.product_name}</View>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
|
||||
import { alert } from "@/common/common";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import { getFilterData } from "@/common/util";
|
||||
import Product from "./components/product";
|
||||
import Search from "@/components/search"
|
||||
@ -10,8 +10,9 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import CreatePopup from "./components/createPopup";
|
||||
import UpdatePopup from "./components/updatePopup";
|
||||
import styles from './index.module.scss'
|
||||
import useLogin from "@/use/useLogin";
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
const changeOpenCon = (item) => {
|
||||
item.openStatus = !item.openStatus
|
||||
setList((e) => [...e])
|
||||
@ -117,6 +118,10 @@ export default () => {
|
||||
}
|
||||
}
|
||||
|
||||
const onBatchManagement = useCallback(() => {
|
||||
// goLink('pages/collection/collectionClass/index', {id: })
|
||||
}, [])
|
||||
|
||||
//操作文件夹
|
||||
const onCreatSuccess = (submitData) => {
|
||||
if (!initData.id) {
|
||||
@ -147,7 +152,7 @@ export default () => {
|
||||
</View>
|
||||
</View>)}
|
||||
</View>
|
||||
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdateShow}/>
|
||||
<UpdatePopup show={updateShow} onClose={closeUpdate} onDelete={onDeleteCollect} onUpdate={onUpdateShow} onBatchManagement={onBatchManagement}/>
|
||||
<CreatePopup defaultValue={initData} show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||
</View>
|
||||
)
|
||||
|
@ -7,8 +7,10 @@ import { useEffect, useState } from "react"
|
||||
import { alert, retrieval } from "@/common/common";
|
||||
import { companyDetailApi, companyUpdateApi } from "@/api/company"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const [showSiteModal, setShowSiteModal] = useState(false);
|
||||
const handleSelectSite = ()=>{
|
||||
setShowSiteModal(true);
|
||||
|
@ -8,9 +8,10 @@ import "./index.scss"
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||
import Message from "@/components/Message"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
const userInfo = useSelector(state => state.userInfo);
|
||||
useEffect(()=>{
|
||||
getData()
|
||||
|
@ -6,8 +6,10 @@ import {creditListApi} from "@/api/creditLine"
|
||||
import "./index.scss"
|
||||
import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat"
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = creditListApi();
|
||||
// 渲染(数据)
|
||||
const [data, setData] = useState({
|
||||
|
@ -7,8 +7,10 @@ import { useEffect } from "react";
|
||||
import { formatPriceDiv, toDecimal2 } from "@/common/fotmat";
|
||||
import { setClipboardData } from "@tarojs/taro";
|
||||
import Message from "@/components/Message";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = depositInfoApi();
|
||||
const getData = async ()=>{
|
||||
fetchData();
|
||||
|
@ -6,9 +6,10 @@ import Taro, { useReady } from "@tarojs/taro"
|
||||
import { useEffect, useState } from "react"
|
||||
import {creditListApi} from "@/api/creditLine"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
|
||||
useLogin()
|
||||
return (
|
||||
<View className="deposit-detail">
|
||||
<View className="deposit-detail-tips">
|
||||
|
@ -7,8 +7,10 @@ import { useCallback, useEffect, useState } from "react"
|
||||
import { depositListApi } from "@/api/deposit"
|
||||
import "./index.scss"
|
||||
import { formatDateTime, formatPriceDiv } from "@/common/fotmat"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {fetchData, state} = depositListApi();
|
||||
// 渲染(数据)
|
||||
const [data, setData] = useState({
|
||||
|
@ -14,7 +14,10 @@
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
margin-top: 200px;
|
||||
height: 60vh;
|
||||
margin-top: 100px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
image{
|
||||
width:100%;
|
||||
border-radius: 10px;
|
||||
|
@ -1,9 +1,12 @@
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { Image, View } from "@tarojs/components"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export type colorItem = {
|
||||
title: string,
|
||||
img: string
|
||||
lab: {l:number, a:number, b:number},
|
||||
rgb: {r:number, g:number, b:number},
|
||||
texture_url: string
|
||||
}
|
||||
export type colorParams = {
|
||||
value?: colorItem,
|
||||
@ -15,7 +18,7 @@ export default ({value, show = false, onClose}: colorParams) => {
|
||||
<>
|
||||
{show&&<View className={styles.main} catch-move="true" onClick={() => onClose?.()}>
|
||||
<View className={styles.con}>
|
||||
<Image mode="aspectFill" src={value?.img as string}/>
|
||||
<LabAndImg value={{lab:value?.lab,rgb:value?.rgb,texture_url:value?.texture_url}}/>
|
||||
<View className={styles.name}>{value?.title}</View>
|
||||
</View>
|
||||
</View>}
|
||||
|
@ -125,16 +125,33 @@
|
||||
background-color: #fff;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
|
||||
.buy_cart{
|
||||
width: 150px;
|
||||
color: $color_font_three;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
.text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
.miconfont{
|
||||
font-size: 36px;
|
||||
}
|
||||
.product_num{
|
||||
position: absolute;
|
||||
font-size: 23px;
|
||||
background-color: red;
|
||||
color: #fff;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
padding: 0 6px;
|
||||
border-radius: 72px;
|
||||
min-width: 25px;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
right: 20px;
|
||||
}
|
||||
}
|
||||
.buy_btn{
|
||||
display: flex;
|
||||
|
@ -18,6 +18,7 @@ import LabAndImg from '@/components/LabAndImg';
|
||||
import { alert } from '@/common/common';
|
||||
import AddCollection from '@/components/addCollection';
|
||||
import { AddFavoriteApi } from '@/api/favorite';
|
||||
import { GetShoppingCartApi } from '@/api/shopCart';
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
@ -27,7 +28,7 @@ type Params = {
|
||||
style?: Object
|
||||
}
|
||||
export default (props:Params) => {
|
||||
const {checkLogin, getPhoneNumber, userInfo} = useLogin()
|
||||
const {getPhoneNumber, userInfo} = useLogin()
|
||||
|
||||
//获取参数(有两种参数:1.商品id, 2.页面分享)
|
||||
const router = useRouter()
|
||||
@ -50,9 +51,9 @@ export default (props:Params) => {
|
||||
}
|
||||
|
||||
useDidShow(() => {
|
||||
checkLogin()
|
||||
judgeParam()
|
||||
setShowCart(false)
|
||||
getShoppingCart()
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
@ -96,7 +97,9 @@ export default (props:Params) => {
|
||||
const getColorItem = (item) => {
|
||||
setColorInfo({
|
||||
title: item.code,
|
||||
img: item.texture_url,
|
||||
texture_url: item.texture_url,
|
||||
lab: item.lab,
|
||||
rgb: item.rgb
|
||||
})
|
||||
setShowPreview(true)
|
||||
}
|
||||
@ -149,7 +152,14 @@ export default (props:Params) => {
|
||||
setCollectionShow(false)
|
||||
}, [])
|
||||
|
||||
|
||||
//获取购物车数据数量
|
||||
const [shopCount, setShopCount] = useState<number>(0)
|
||||
const {fetchData: fetchDataShopCount} = GetShoppingCartApi()
|
||||
const getShoppingCart = async () => {
|
||||
const {data} = await fetchDataShopCount()
|
||||
let color_list = data.color_list||[]
|
||||
setShopCount(color_list.length)
|
||||
}
|
||||
|
||||
|
||||
//页面下拉刷新
|
||||
@ -163,7 +173,7 @@ export default (props:Params) => {
|
||||
<DesSwiper list={productInfo.texture_url||[]}/>
|
||||
<View className={styles.product_header}>
|
||||
<View className={styles.title}>
|
||||
<View className={styles.name}>{productName}</View>
|
||||
{productInfo.code&&<View className={styles.name}>{productName}</View>}
|
||||
<View className={styles.des}>{productInfo.describe}</View>
|
||||
</View>
|
||||
<View className={styles.share}>
|
||||
@ -205,6 +215,7 @@ export default (props:Params) => {
|
||||
<View className={styles.buy_cart} onClick={() => setShowCart(true)}>
|
||||
<View className={classnames('iconfont icon-gouwuche', styles.miconfont)}></View>
|
||||
<View className={styles.text}>购物车</View>
|
||||
{(shopCount > 0)&&<View className={styles.product_num}>{shopCount > 99?'99+':shopCount}</View>}
|
||||
</View>
|
||||
{
|
||||
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
|
||||
|
@ -8,9 +8,10 @@ import { alert, goLink } from "@/common/common";
|
||||
import { getParam } from "@/common/system";
|
||||
import {EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi} from "@/api/order";
|
||||
import Taro from "@tarojs/taro";
|
||||
import useLogin from "@/use/useLogin";
|
||||
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
//获取临时传递的数据
|
||||
const params = getParam()
|
||||
const [paramsData, setParamsData] = useState<any>(params)
|
||||
|
@ -15,11 +15,7 @@ import { dataLoadingStatus } from '@/common/util'
|
||||
|
||||
export default () => {
|
||||
|
||||
const { checkLogin } = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
|
||||
useLogin()
|
||||
useEffect(() => {
|
||||
categoryList()
|
||||
}, [])
|
||||
@ -87,21 +83,12 @@ export default () => {
|
||||
setRefresherTriggeredStatus(true)
|
||||
}
|
||||
|
||||
|
||||
//页面下拉刷新
|
||||
// const res = useManualPullDownRefresh()
|
||||
// usePullDownRefresh(() => {
|
||||
// console.log('123')
|
||||
// })
|
||||
|
||||
//数据加载状态
|
||||
const statusMore = useMemo(() => {
|
||||
return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading })
|
||||
}, [productData, productState.loading])
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
||||
<View className={styles.main}>
|
||||
|
@ -37,6 +37,20 @@ type Param = {
|
||||
}
|
||||
}
|
||||
|
||||
//订单状态
|
||||
const {
|
||||
SaleorderstatusWaitingPrePayment,
|
||||
SaleOrderStatusBooking,
|
||||
SaleOrderStatusArranging,
|
||||
SaleOrderStatusArranged,
|
||||
SaleOrderStatusWaitingPayment,
|
||||
SaleOrderStatusWaitingReceipt,
|
||||
SaleOrderStatusAlreadyReceipt,
|
||||
SaleOrderStatusComplete,
|
||||
SaleOrderStatusRefund,
|
||||
SaleOrderStatusCancel,
|
||||
} = ORDER_STATUS
|
||||
|
||||
export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics}: Param, ref) => {
|
||||
|
||||
const [addressInfo, setAddressInfo] = useState<any>()
|
||||
@ -53,7 +67,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
//打开地址列表
|
||||
const [showAddressList, setShowAddressList] = useState(false)
|
||||
const changeShow = () => {
|
||||
if(receivingStatus == 2 && !logisticsShow)
|
||||
if(receivingStatus == 2 && !logisticsShow && limitEdit())
|
||||
setShowAddressList(() => true)
|
||||
}
|
||||
|
||||
@ -67,7 +81,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
||||
const onReceivingStatus = (value, e) => {
|
||||
e.stopPropagation()
|
||||
changeReceivingStatus(value)
|
||||
if(limitEdit()) changeReceivingStatus(value)
|
||||
|
||||
}
|
||||
const changeReceivingStatus = debounce(async (value) => {
|
||||
if(!orderInfo) return false
|
||||
@ -112,14 +127,18 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
||||
}
|
||||
}
|
||||
|
||||
//订单状态
|
||||
const {
|
||||
SaleOrderStatusWaitingReceipt,
|
||||
SaleOrderStatusAlreadyReceipt,
|
||||
SaleOrderStatusComplete,
|
||||
SaleOrderStatusRefund,
|
||||
SaleOrderStatusCancel,
|
||||
} = ORDER_STATUS
|
||||
//根据订单状态判断是否可用修改
|
||||
const limitEdit = () => {
|
||||
let res = [
|
||||
SaleorderstatusWaitingPrePayment.value,
|
||||
SaleOrderStatusBooking.value,
|
||||
SaleOrderStatusArranging.value,
|
||||
SaleOrderStatusArranged.value,
|
||||
SaleOrderStatusWaitingPayment.value,
|
||||
].includes(orderInfo?.status as number)
|
||||
if(!res && status != 1) alert.none('该订单状态不能修改地址!')
|
||||
return status == 1? true : res
|
||||
}
|
||||
|
||||
|
||||
//根据订单状态判断是否显示物流
|
||||
|
@ -13,6 +13,7 @@ import OrderBtns from "@/components/orderBtns";
|
||||
import Popup from "@/components/popup";
|
||||
import SearchInput from "@/components/searchInput";
|
||||
import ShopCart from "@/components/shopCart";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
@ -28,6 +29,7 @@ import Remark from "./components/remark";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
const router = useRouter()
|
||||
const orderId = useRef<number>(Number(router.params.id))
|
||||
@ -37,6 +39,8 @@ import styles from './index.module.scss'
|
||||
|
||||
//订单状态枚举
|
||||
const {
|
||||
SaleOrderStatusTaking,
|
||||
SaleOrderStatusWaitingDelivery,
|
||||
SaleOrderStatusWaitingReceipt, // 待收货
|
||||
SaleOrderStatusAlreadyReceipt, // 已收货
|
||||
SaleOrderStatusComplete, // 已完成
|
||||
@ -46,6 +50,7 @@ import styles from './index.module.scss'
|
||||
} = ORDER_STATUS
|
||||
|
||||
//获取订单详情
|
||||
const firstOpen = useRef(true)
|
||||
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
||||
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
||||
const getSaleOrderPreView = async () => {
|
||||
@ -53,7 +58,10 @@ 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()
|
||||
if(firstOpen.current) {
|
||||
firstOpen.current = false
|
||||
toPay()
|
||||
}
|
||||
}
|
||||
Taro.stopPullDownRefresh()
|
||||
Taro.hideToast()
|
||||
@ -115,7 +123,9 @@ import styles from './index.module.scss'
|
||||
shipment_mode: orderDetail?.shipment_mode,
|
||||
id: orderDetail?.id,
|
||||
sale_mode: orderDetail?.sale_mode,
|
||||
status: orderDetail?.status
|
||||
status: orderDetail?.status,
|
||||
take_goods_address: orderDetail?.take_goods_address,
|
||||
take_goods_phone: orderDetail?.take_goods_phone
|
||||
}
|
||||
|
||||
}, [orderDetail])
|
||||
@ -135,6 +145,8 @@ import styles from './index.module.scss'
|
||||
setShowDesc(() => false)
|
||||
}, [])
|
||||
const noCanOpenDescList = useRef([
|
||||
SaleOrderStatusTaking.value, //提货中
|
||||
SaleOrderStatusWaitingDelivery.value, //待发货
|
||||
SaleOrderStatusWaitingReceipt.value, // 待收货
|
||||
SaleOrderStatusAlreadyReceipt.value, // 已收货
|
||||
SaleOrderStatusComplete.value, // 已完成
|
||||
@ -142,7 +154,7 @@ import styles from './index.module.scss'
|
||||
SaleOrderStatusCancel.value, // 已取消
|
||||
])
|
||||
const descOpen = () => {
|
||||
if(noCanOpenDescList.current.includes(orderDetail?.status)) return false
|
||||
if(noCanOpenDescList.current.includes(orderDetail?.status)) return alert.none('该订单状态不能修改备注')
|
||||
setShowDesc(() => true)
|
||||
}
|
||||
|
||||
@ -167,7 +179,6 @@ import styles from './index.module.scss'
|
||||
|
||||
//获取底部按钮点击, 获取按钮状态
|
||||
const orderStateClick = useCallback((val) => {
|
||||
console.log('123456789',val)
|
||||
if(val == 1 || val == 6) {
|
||||
//取消订单
|
||||
getSaleOrderPreView()
|
||||
|
@ -7,7 +7,7 @@ import styles from './index.module.scss'
|
||||
type Param = {
|
||||
return_address?:string,
|
||||
return_phone?: string,
|
||||
onLogistics?: (val: number) => void,
|
||||
onLogistics?: (val: 1|2) => void, //1 上传物流 2 查看物流
|
||||
stage?: number,
|
||||
}
|
||||
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
|
||||
|
@ -118,7 +118,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
||||
cut_value: [ReturnStageReturned.value],
|
||||
model_value: [ReturnStageReturned.value],
|
||||
label:'退款去向',
|
||||
field: 'actual_amount'
|
||||
field: 'refund_flow_name'
|
||||
},
|
||||
|
||||
]
|
||||
|
@ -14,8 +14,9 @@ type Param = {
|
||||
id?: number, //订单id
|
||||
images: string[], //图片列表
|
||||
descValue?: string, //描述
|
||||
onlyRead?: false|true //true 只读
|
||||
}
|
||||
export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = ''}: Param) => {
|
||||
export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = '', onlyRead = false}: Param) => {
|
||||
//需要提交的数据
|
||||
const submitData = useRef({
|
||||
accessory_url: [],
|
||||
@ -52,20 +53,20 @@ export default memo(({show = false, onClose, onSubmit, id = 0, images = [], desc
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popup show={show} title="上传物流" onClose={onClose}>
|
||||
<Popup show={show} title={onlyRead?'查看物流':"上传物流"} onClose={onClose}>
|
||||
<View className={styles.logistics_main}>
|
||||
<View className={styles.logistics_image}>
|
||||
<Text className={styles.title_desc}>上传附件:</Text>
|
||||
<View className={styles.upload_image}>
|
||||
<UploadImage onChange={getImageList} defaultList={images}/>
|
||||
<UploadImage onChange={getImageList} defaultList={images} onlyRead={onlyRead}/>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.logistics_desc}>
|
||||
<TextareaEnhance defaultValue={descValue} onChange={getOtherReason} title="备注:" placeholder="请输入备注信息"/>
|
||||
<TextareaEnhance defaultValue={descValue} onChange={getOtherReason} title="备注:" onlyRead={onlyRead} placeholder="请输入备注信息"/>
|
||||
</View>
|
||||
<View className={styles.btns_two}>
|
||||
{!onlyRead&&<View className={styles.btns_two}>
|
||||
<View className={styles.verify_btn } onClick={() => onSubmitEven()}>保存</View>
|
||||
</View >
|
||||
</View >}
|
||||
</View>
|
||||
</Popup>
|
||||
</>
|
||||
|
@ -4,6 +4,7 @@ import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum";
|
||||
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||
import SearchInput from "@/components/searchInput";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
@ -17,7 +18,7 @@ import ReturnLogistics from "./components/returnLogistics";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
export default () => {
|
||||
|
||||
useLogin()
|
||||
const router = useRouter()
|
||||
const orderId = useRef<number>(Number(router.params.id))
|
||||
useDidShow(() => {
|
||||
@ -63,7 +64,8 @@ import styles from './index.module.scss'
|
||||
other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额
|
||||
total_refund_amount: orderDetail.total_refund_amount, //合计金额
|
||||
refund_amount: orderDetail.refund_amount, //退款金额
|
||||
refund_type: orderDetail.refund_type //退款状态
|
||||
refund_type: orderDetail.refund_type, //退款状态
|
||||
refund_flow_name: orderDetail.refund_flow_name //退款去向
|
||||
|
||||
})
|
||||
}
|
||||
@ -74,7 +76,9 @@ import styles from './index.module.scss'
|
||||
|
||||
//获取底部按钮点击, 获取按钮状态
|
||||
const orderStateClick = useCallback((val) => {
|
||||
if(val == 8) {
|
||||
if(val == 1 || val == 6) {
|
||||
getSaleOrderPreView()
|
||||
} else if(val == 8) {
|
||||
//申请记录
|
||||
setApplyRecord(true)
|
||||
}
|
||||
@ -105,19 +109,22 @@ import styles from './index.module.scss'
|
||||
|
||||
//物流显示
|
||||
const [logisticsShow, setLogisticsShow] = useState(false)
|
||||
const [logistics, setLogistics] = useState(false)
|
||||
const onShowLogistics = useCallback((val) => {
|
||||
if(val == 1) {
|
||||
setLogisticsShow(true)
|
||||
} else {
|
||||
const list = orderDetail?.accessory_url.map(item => {
|
||||
return formatImgUrl(item)
|
||||
})
|
||||
Taro.previewImage({
|
||||
current: list[0], // 当前显示
|
||||
urls: list // 需要预览的图片http链接列表
|
||||
})
|
||||
}
|
||||
}, [orderDetail])
|
||||
setLogisticsShow(true)
|
||||
if(val != 1) setLogistics(true)
|
||||
// if(val == 1) {
|
||||
// setLogisticsShow(true)
|
||||
// } else {
|
||||
// const list = orderDetail?.accessory_url.map(item => {
|
||||
// return formatImgUrl(item)
|
||||
// })
|
||||
// Taro.previewImage({
|
||||
// current: list[0], // 当前显示
|
||||
// urls: list // 需要预览的图片http链接列表
|
||||
// })
|
||||
// }
|
||||
}, [])
|
||||
const onCloseLogistics = useCallback(() => {
|
||||
setLogisticsShow(false)
|
||||
}, [])
|
||||
@ -139,7 +146,7 @@ import styles from './index.module.scss'
|
||||
<OrderDes orderInfo={orderDetail}/>
|
||||
<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}/>
|
||||
<ReturnLogistics onlyRead={logistics} 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)}/>
|
||||
<View className="common_safe_area_y"></View>
|
||||
</View>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { goLink } from "@/common/common";
|
||||
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||
import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
|
||||
import AfterOrderBtns from "@/components/afterOrderBtns";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
@ -26,7 +27,7 @@ type Param = {
|
||||
lab: {l:number, a:number, b:number},
|
||||
rgb: {r:number, g:number, b:number},
|
||||
texturl_url: string,
|
||||
type: number //1 退货 2退款
|
||||
type: number //2 退货 1 预收退款 3 销售
|
||||
return_apply_order_id: number //退款申请单
|
||||
},
|
||||
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
|
||||
@ -63,6 +64,10 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
return {lab:{...value?.lab}, rgb:{...value?.rgb}, texturl_url: value?.texturl_url}
|
||||
}, [value])
|
||||
|
||||
const {
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
|
||||
return (
|
||||
<View className={styles.order_item}>
|
||||
<View className={styles.header} onClick={() => goLink('/pages/salesAfter/index', {id: value?.id})}>
|
||||
@ -71,8 +76,8 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
<Text className={styles.name}>{userInfo?.adminUserInfo?.user_name}</Text>
|
||||
</View>
|
||||
<View className={styles.order_num}>
|
||||
<Text>售后单号:{value?.return_order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
<Text>售后单号:{value?.return_order_no}</Text>
|
||||
<Text className={classnames(styles.miconfont, 'iconfont, icon-a-moreback')}></Text>
|
||||
</View>
|
||||
<OrderStatusTag status={value?.type}/>
|
||||
</View>
|
||||
@ -107,7 +112,7 @@ export default memo(({value, onClickBtn}: Param) => {
|
||||
</View>
|
||||
<View className={styles.color_count_num}>{`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`}</View>
|
||||
<View className={styles.order_number}>
|
||||
<Text>{value?.type == 1?'已申请退货':'已申请退款'}</Text>
|
||||
<Text>{value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'}</Text>
|
||||
<Text>订单号:{value?.order_no}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -2,17 +2,23 @@ import { Text, View } from "@tarojs/components"
|
||||
import { memo } from "react"
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { REFUND_STATUS_ORDER } from "@/common/enum";
|
||||
|
||||
|
||||
type Param = {
|
||||
status?: number //0默认不处理, 1退货,2退款
|
||||
status?: number
|
||||
}
|
||||
export default memo(({status = 0}:Param) => {
|
||||
const {
|
||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||
ReturnApplyOrderTypeSalesRefund // 销售退款
|
||||
} = REFUND_STATUS_ORDER
|
||||
return (
|
||||
<>
|
||||
{(status !== 0)&&<View className={classnames(styles.tag, status == 2?styles.refund_tag :styles.saleReturn_tag)}>
|
||||
{(status !== 0)&&<View className={classnames(styles.tag, status != ReturnApplyOrderTypeReturnForRefund.value?styles.refund_tag :styles.saleReturn_tag)}>
|
||||
<View className={classnames(styles.miconfont, 'iconfont icon-yucunkuan')}></View>
|
||||
<Text>{ status == 1?'退货':'退款'}</Text>
|
||||
<Text>{ status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'}</Text>
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
|
@ -14,9 +14,9 @@ import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder
|
||||
import ReturnLogistics from "./components/returnLogistics"
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
useLogin()
|
||||
useDidShow(() => {
|
||||
getOrderList()
|
||||
})
|
||||
|
||||
//搜索参数
|
||||
@ -94,9 +94,8 @@ export default () => {
|
||||
|
||||
//监听点击的按钮
|
||||
const clickOrderBtn = useCallback(({status, orderInfo}) => {
|
||||
if(status == 2) {
|
||||
//退货物流
|
||||
|
||||
if(status == 1 || status == 6) {
|
||||
getOrderList()
|
||||
}
|
||||
}, [orderData])
|
||||
|
||||
|
@ -5,8 +5,10 @@ import { goLink } from '@/common/common';
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
import { useEffect } from 'react';
|
||||
import useLogin from '@/use/useLogin';
|
||||
|
||||
export default () => {
|
||||
useLogin()
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.search}>
|
||||
|
@ -20,10 +20,7 @@ import SelectData, {ListProps} from "./components/selectData";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [showFilter, setShowFilter] = useState(false)
|
||||
|
||||
|
@ -12,10 +12,7 @@ import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
type searchDataParam = {'search_key':''}
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [searchData, setSearchData] = useState<{hotField: searchDataParam[], historyField: searchDataParam[]}>({
|
||||
hotField: [],
|
||||
|
@ -16,10 +16,7 @@ import useLogin from "@/use/useLogin";
|
||||
import LabAndImg from "@/components/LabAndImg";
|
||||
|
||||
export default () => {
|
||||
const {checkLogin} = useLogin()
|
||||
useDidShow(async () => {
|
||||
await checkLogin()
|
||||
})
|
||||
useLogin()
|
||||
|
||||
const [showFilter, setShowFilter] = useState(false)
|
||||
const router = useRouter()
|
||||
|
@ -10,7 +10,17 @@ import Taro from "@tarojs/taro";
|
||||
import { userassets, userorderStatistics } from "@/api/mine"
|
||||
import { formatPriceDiv } from "@/common/fotmat"
|
||||
import { useDidShow, } from '@tarojs/taro'
|
||||
import { GetAdminUserInfoApi } from "@/api/user";
|
||||
export default () => {
|
||||
//重新获取用户信息
|
||||
const {fetchData: useFetchData} = GetAdminUserInfoApi()
|
||||
const [userDataAgain, setUserDataAgain] = useState<any>({})
|
||||
const getUserData = async () => {
|
||||
let res = await useFetchData()
|
||||
setUserDataAgain(res.data)
|
||||
}
|
||||
|
||||
|
||||
// 用户信息
|
||||
const { getSelfUserInfo } = useLogin();
|
||||
const { adminUserInfo } = useSelector(state => state.userInfo);
|
||||
@ -31,6 +41,7 @@ export default () => {
|
||||
}, [])
|
||||
useDidShow(() => {
|
||||
ApigetTotal()
|
||||
getUserData()
|
||||
})
|
||||
const checkGo = () => {
|
||||
if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) {
|
||||
@ -55,13 +66,13 @@ export default () => {
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Header data={adminUserInfo} MenuData={stateData} />
|
||||
<Assets data={state} checkShow={() => checkGo()} />
|
||||
<Header data={userDataAgain} MenuData={stateData} />
|
||||
<Assets data={state} checkShow={() => checkGo()} userInfo={userDataAgain}/>
|
||||
<Main />
|
||||
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
||||
{/* 测试暂时添加 */}
|
||||
<View style={{ fontSize: '26rpx', textAlign: 'center' }}>{BASE_URL}</View>
|
||||
{!adminUserInfo.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||
{!userDataAgain?.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -143,7 +154,7 @@ const Header = memo((props: any) => {
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles['auth']}>
|
||||
{(data?.authentication_status == 0 || data?.authentication_status == 1) &&
|
||||
{((data?.authentication_status == 0 || data?.authentication_status == 1) && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tag']}>
|
||||
@ -156,7 +167,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{(data?.authentication_status == 3) &&
|
||||
{(data?.authentication_status == 3 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagthree']}>
|
||||
@ -169,7 +180,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{data?.authentication_status == 2 &&
|
||||
{(data?.authentication_status == 2 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagone']}>
|
||||
@ -182,7 +193,7 @@ const Header = memo((props: any) => {
|
||||
<Text className="iconfont icon-a-moreback"></Text>
|
||||
</View>
|
||||
}
|
||||
{data?.authentication_status == 4 &&
|
||||
{(data?.authentication_status == 4 && data?.order_access_status == 3) &&
|
||||
<View className={styles['auth-box']} onClick={() => navTo()}>
|
||||
<View className={styles['auth-left-box']}>
|
||||
<View className={styles['auth-tagtwo']}>
|
||||
@ -274,34 +285,36 @@ const Header = memo((props: any) => {
|
||||
// 我的资产
|
||||
const Assets = (props: any) => {
|
||||
return (
|
||||
<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
||||
<View className={`${styles['assets-title']}`}>我的资产</View>
|
||||
<View className={`${styles['assets-content']}`}>
|
||||
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
||||
</Navigator>
|
||||
{/* <View>
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
||||
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
||||
</View> */}
|
||||
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
||||
<View className={`${styles['assets-content-item-top']}`} >
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>
|
||||
<>
|
||||
{(props.userInfo.order_access_status == 3) &&<View className={`${styles.assets} ${styles.crad} ${styles['main-card']}`}>
|
||||
<View className={`${styles['assets-title']}`}>我的资产</View>
|
||||
<View className={`${styles['assets-content']}`}>
|
||||
<Navigator hoverClass="none" url="/pages/depositBeforehand/index">
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.wallet_money || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>{props.wallet_money || 0}</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>预存款</Text>
|
||||
</Navigator>
|
||||
{/* <View>
|
||||
<View className={`${styles['assets-content-item-top']}`}>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{props.data.data.coupon_count || 0}</Text>
|
||||
<Text className={`${styles['assets-content-item-top-after']}`}>张</Text>
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>优惠券</Text>
|
||||
</View> */}
|
||||
<Navigator hoverClass="none" onClick={() => props.checkShow()}>
|
||||
<View className={`${styles['assets-content-item-top']}`} >
|
||||
<Text className={`${styles['assets-content-item-top-before']}`}>¥</Text>
|
||||
<Text className={`${styles['assets-content-item-top-content']}`}>{formatPriceDiv(props.data.data.credit_line || 0)}</Text>
|
||||
{/* <Text className={`${styles['assets-content-item-top-after']}`}>.-00</Text> */}
|
||||
</View>
|
||||
<Text className={`${styles['assets-content-item-tips']}`}>授信额度</Text>
|
||||
</Navigator>
|
||||
</View>
|
||||
</View>||<View className={styles['main-card']}></View>}
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,9 @@ import {weightListApi,weightDeleteApi} from "@/api/weightList"
|
||||
import "./index.scss"
|
||||
import Taro, { showModal } from "@tarojs/taro"
|
||||
import { alert } from "@/common/common"
|
||||
import useLogin from "@/use/useLogin"
|
||||
const weightListManager = ()=>{
|
||||
useLogin()
|
||||
return(
|
||||
<View className="weight-list-manager">
|
||||
<WeightList />
|
||||
|
@ -6,8 +6,10 @@ import {weightAddApi, weightDetailApi,weightEditApi} from "@/api/weightList"
|
||||
import { useEffect, useState } from "react"
|
||||
import { alert, retrieval } from "@/common/common"
|
||||
import "./index.scss"
|
||||
import useLogin from "@/use/useLogin"
|
||||
|
||||
export default ()=>{
|
||||
useLogin()
|
||||
const {type,id} = useRouter().params;
|
||||
useEffect(()=>{
|
||||
if(type=="add"){
|
||||
|
@ -122,14 +122,12 @@ export const useRequest = (options:option = {
|
||||
|
||||
const stateRef = useRef({...params})
|
||||
const [state, setState] = useState({...stateRef.current})
|
||||
const {removeToken, removeSessionKey} = useUserInfo()
|
||||
const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo()
|
||||
const {login} = useLoginRequest()
|
||||
|
||||
useEffect(() => {
|
||||
console.log('变化1::', state.loading)
|
||||
}, [state.loading])
|
||||
// 请求函数
|
||||
const fetchData = async (sub_options?:any) => {
|
||||
|
||||
stateRef.current.loading = true
|
||||
setState((e) => ({...e, loading:true}))
|
||||
stateRef.current.query = {
|
||||
@ -179,9 +177,11 @@ export const useRequest = (options:option = {
|
||||
console.log('错误::',msg)
|
||||
}
|
||||
}else{
|
||||
|
||||
if (statusCode === 401) {
|
||||
removeToken()
|
||||
removeSessionKey()
|
||||
removeUserInfo()
|
||||
login()
|
||||
//todo 登录数据刷新次数问题
|
||||
} else {
|
||||
|
@ -1,19 +1,22 @@
|
||||
import useUserInfo from "./useUserInfo"
|
||||
import Taro, { useRouter } from "@tarojs/taro"
|
||||
import Taro, { useDidShow, useRouter } from "@tarojs/taro"
|
||||
import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user"
|
||||
import useLoginRequest from "./useLoginRequest"
|
||||
import { SHARE_SCENE } from "@/common/enum"
|
||||
import { GetShortCodeApi } from "@/api/share"
|
||||
import { alert } from "@/common/common"
|
||||
import { LoginApi } from "@/api/login"
|
||||
|
||||
export default () => {
|
||||
const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo()
|
||||
|
||||
//登录请求 (调用这个就不能再useHttp中使用,当前这个hook, 否则会死循环内存溢出)
|
||||
// const {fetchData} = LoginApi()
|
||||
useDidShow(() => {
|
||||
checkLogin()
|
||||
})
|
||||
|
||||
//登录请求
|
||||
const {login} = useLoginRequest()
|
||||
// const {fetchData:login} = LoginApi()
|
||||
const wxLogin = async () => {
|
||||
try {
|
||||
await login()
|
||||
|
@ -3,11 +3,15 @@ import Taro, { useRouter } from "@tarojs/taro"
|
||||
import { useRef, useState } from "react"
|
||||
import qs from 'qs'
|
||||
import useUserInfo from "./useUserInfo"
|
||||
import useLogin from "./useLogin"
|
||||
|
||||
//开这个hook 主要是为了让useHttp 能够调用
|
||||
|
||||
type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true}
|
||||
let loginStatus = false //登录状态,true登录中
|
||||
console.log('你不要过来啊')
|
||||
export default () => {
|
||||
|
||||
let initData = {
|
||||
success: false,
|
||||
data: null,
|
||||
@ -19,7 +23,7 @@ export default () => {
|
||||
const {setToken, setSessionKey} = useUserInfo()
|
||||
const router = useRouter()
|
||||
//微信登录请求v2
|
||||
const fetchData = async (login_code) => {
|
||||
const fetchDataLogin = async (login_code) => {
|
||||
const q = {
|
||||
url: BASE_URL + '/v1/mall/login',
|
||||
header: {
|
||||
@ -57,11 +61,13 @@ export default () => {
|
||||
|
||||
//微信登录
|
||||
const login = () => {
|
||||
if(loginStatus) return false
|
||||
loginStatus = true
|
||||
return new Promise((reslove, reject) => {
|
||||
Taro.login({
|
||||
success: async (res) => {
|
||||
if (res.code) {
|
||||
const {data, success, msg} = await fetchData(res.code)
|
||||
const {data, success, msg} = await fetchDataLogin(res.code)
|
||||
if(success) {
|
||||
setToken(data.token)
|
||||
setSessionKey(data.session_key)
|
||||
@ -88,10 +94,12 @@ export default () => {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
reject(res.errMsg)
|
||||
}
|
||||
loginStatus = false
|
||||
},
|
||||
fail: function(e) {
|
||||
console.log('登录失败!::',e)
|
||||
reject(e)
|
||||
loginStatus = false
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user