diff --git a/src/api/favorite.ts b/src/api/favorite.ts
index 964d317..0032d7b 100644
--- a/src/api/favorite.ts
+++ b/src/api/favorite.ts
@@ -33,4 +33,26 @@ export const DelFavoriteApi = () => {
url: `/v1/mall/favorite`,
method: "delete",
})
+}
+
+/**
+ * 更新收藏夹
+ * @returns
+*/
+export const UpdateFavoriteApi = () => {
+ return useRequest({
+ url: `/v1/mall/favorite`,
+ method: "put",
+ })
+}
+
+/**
+ * 加入收藏夹
+ * @returns
+*/
+export const AddFavoriteApi = () => {
+ return useRequest({
+ url: `/v1/mall/favorite/product`,
+ method: "post",
+ })
}
\ No newline at end of file
diff --git a/src/api/order.ts b/src/api/order.ts
index 26c175c..952811e 100644
--- a/src/api/order.ts
+++ b/src/api/order.ts
@@ -99,4 +99,14 @@ export const ReceiveOrderApi = () => {
url: `/v1/mall/saleOrder/receive`,
method: "put",
})
+}
+
+/**
+ * 订单状态列表
+ */
+ export const OrderStatusListApi = () => {
+ return useRequest({
+ url: `/v1/mall/enum/filterSaleOrderStatus`,
+ method: "get",
+ })
}
\ No newline at end of file
diff --git a/src/api/salesAfterOrder.ts b/src/api/salesAfterOrder.ts
index 9178eea..23a6732 100644
--- a/src/api/salesAfterOrder.ts
+++ b/src/api/salesAfterOrder.ts
@@ -99,4 +99,14 @@ export const GetSaleOrderListApi = () => {
url: `/v1/mall/enum/filterReturnStage`,
method: "get",
})
+}
+
+/**
+ * 退款说明
+ */
+ export const RefundExplainApi = () => {
+ return useRequest({
+ url: `/v1/mall/enum/refundExplain`,
+ method: "get",
+ })
}
\ No newline at end of file
diff --git a/src/api/user.ts b/src/api/user.ts
index 7d7c97f..abdc9c9 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -1,5 +1,4 @@
import { useRequest } from "@/use/useHttp"
-
/**
* 解密用户微信信息
*/
@@ -68,4 +67,25 @@ import { useRequest } from "@/use/useHttp"
url: `/v1/mall/user/binding/company`,
method: "put",
})
-}
\ No newline at end of file
+}
+
+/**
+ * 申请下单权限
+ */
+ export const ApplyOrderAccessApi = () => {
+ return useRequest({
+ url: `/v1/mall/orderAccess/apply`,
+ method: "post",
+ })
+}
+
+/**
+ * 订阅模板id
+ */
+ export const SubscriptionMessageApi = () => {
+ return useRequest({
+ url: `/v1/mall/subscriptionMessage`,
+ method: "get",
+ })
+}
+
diff --git a/src/app.config.ts b/src/app.config.ts
index 0d19c18..66e2c08 100644
--- a/src/app.config.ts
+++ b/src/app.config.ts
@@ -176,6 +176,7 @@ export default {
root: "pages/collection",
pages: [
"index",
+ "collectionClass/index"
]
},
{
diff --git a/src/common/constant.js b/src/common/constant.js
index 9eb3a66..6d6ce4d 100644
--- a/src/common/constant.js
+++ b/src/common/constant.js
@@ -4,13 +4,14 @@
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
-// export const BASE_URL = `https://test.zzfzyc.com/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.7:50002/lymarket` // 添
// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰
// CDN
diff --git a/src/common/enum.ts b/src/common/enum.ts
index 51d35a0..3a57fb1 100644
--- a/src/common/enum.ts
+++ b/src/common/enum.ts
@@ -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
//订单类型
@@ -50,3 +50,25 @@ export const SHARE_SCENE = {
ShareDetail: {value:1, label:'详情分享'},
SharePage : {value:2, label:'页面分享'},
}
+
+//订阅消息
+export const SUBSCRIPTION_MESSAGE_SCENE = {
+ SubmitOrder: {value:1, label:'确认下单'},
+ ToPay : {value:2, label:'去付款'},
+ 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:'销售退款'}, // 销售退款
+}
\ No newline at end of file
diff --git a/src/common/util.ts b/src/common/util.ts
index 15f5d6b..4bb0803 100644
--- a/src/common/util.ts
+++ b/src/common/util.ts
@@ -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;
@@ -39,15 +38,15 @@ export const throttle = (fn, delay) => {
* @param {Array} arr 排除过滤的属性
* @returns
*/
- export const getFilterData = (val = {}, arr = []) => {
+ export const getFilterData = (val = {}, arr: string[] = []) => {
let res = {}
for(let key in val) {
if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){
- if(val[key] instanceof Number){
+ if(typeof val[key] == 'number'){
if(!isNaN(val[key])) {
res[key] = val[key]
}
- }else{
+ } else{
res[key] = val[key]
}
}
diff --git a/src/components/addCollection/index.module.scss b/src/components/addCollection/index.module.scss
new file mode 100644
index 0000000..a4e7480
--- /dev/null
+++ b/src/components/addCollection/index.module.scss
@@ -0,0 +1,47 @@
+
+.collection_con{
+ padding: 20px ;
+ .header{
+ display: flex;
+ justify-content: center;
+ position: relative;
+ .title{
+ font-size: 30px;
+ font-weight: 700;
+ }
+ .miconfont_con{
+ position: absolute;
+ right: 10px;
+ top: 0;
+ font-size: 26px;
+ color: #007AFF;
+ .miconfont{
+ font-size: 30px;
+ color: #007AFF;
+ border: 1px solid #007AFF;
+ border-radius: 50%;
+ margin-right: 10px;
+ }
+ }
+ }
+ .scrollView{
+ height: 60vh;
+ }
+ .collection_item{
+ padding: 30px 0 15px 0;
+ border-bottom: 1px solid #F3F3F3;
+ .name{
+ font-size: 26px;
+ font-weight: 700;
+ text{
+ font-weight: normal;
+ }
+ }
+ .desc{
+ font-size: 22px;
+ color: #707070;
+ padding-left: 10px;
+ margin-top: 20px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/components/addCollection/index.tsx b/src/components/addCollection/index.tsx
new file mode 100644
index 0000000..6e56256
--- /dev/null
+++ b/src/components/addCollection/index.tsx
@@ -0,0 +1,49 @@
+import Popup from "@/components/popup";
+import { Input, ScrollView, Text, View } from "@tarojs/components";
+import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
+import classnames from "classnames";
+import styles from './index.module.scss'
+import TextareaEnhance from "@/components/textareaEnhance";
+import { CreateFavoriteApi, FavoriteListApi } from "@/api/favorite";
+import { alert, goLink } from "@/common/common";
+import { getFilterData } from "@/common/util";
+
+//原因选择
+type ReasonInfoParam = {
+ show?: boolean, //显示
+ onClose?: () => void, //关闭
+ onAdd?: (val: any) => void
+
+}
+export default memo(({show = false, onClose, onAdd}: ReasonInfoParam) => {
+ //获取列表
+ const [list, setList] = useState([])
+ const {fetchData: fetchDataList} = FavoriteListApi()
+ const getFavoriteList = async () => {
+ let res = await fetchDataList(getFilterData())
+ setList(() => res.data.list)
+ }
+ useEffect(() => {
+ if(show) getFavoriteList()
+ }, [show])
+
+ return (
+
+
+
+ 选择文件夹
+
+
+ goLink('/pages/collection/index')}>新建
+
+
+
+ {list?.map((item: any) => onAdd?.(item)} className={styles.collection_item}>
+ {item.name}({item.product_color_list?.length||0})
+ {item.remark}
+ )}
+
+
+
+ )
+})
\ No newline at end of file
diff --git a/src/components/afterOrderBtns/index.module.scss b/src/components/afterOrderBtns/index.module.scss
index 252b22e..d57e7b0 100644
--- a/src/components/afterOrderBtns/index.module.scss
+++ b/src/components/afterOrderBtns/index.module.scss
@@ -1,3 +1,40 @@
+.submit_order{
+ display: flex;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ justify-content: flex-end;
+ width: 100%;
+ height: 175px;
+ align-items: center;
+ background-color: #fff;
+ box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16);
+ padding: 20px 20px;
+ box-sizing: border-box;
+ padding-bottom: constant(safe-area-inset-bottom);
+ padding-bottom: env(safe-area-inset-bottom);
+ .order_btn {
+ width: 152px;
+ height: 72px;
+ border: 2px solid #dddddd;
+ border-radius: 46px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ color: $color_font_three;
+ &:nth-child(n+2) {
+ margin-left: 34px;
+ }
+ }
+ .order_btn_select{
+ color: $color_main;
+ border: 2px solid $color_main;
+ }
+ .order_number_desc{
+ font-size: $font_size_medium;
+ color: $color_font_two;
+ }
+}
.btns_list{
width: 100%;
// margin-top: 30px;
diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx
index 3fdacbe..2f730a6 100644
--- a/src/components/afterOrderBtns/index.tsx
+++ b/src/components/afterOrderBtns/index.tsx
@@ -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: {
@@ -17,10 +18,11 @@ type Param = {
return_apply_order_id: number //售后申请单
},
onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
- onBtnNull?: () => void //所有按钮都为空
+ fixedBottom?: true|false, //是否固定在底部
+
}
-export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
+export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
//售后订单状态
const {
ReturnStageApplying,
@@ -30,6 +32,12 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
ReturnStageServiceOrderPendingRefund,
} = AFTER_ORDER_STATUS
+ const {
+ ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
+ ReturnApplyOrderTypeReturnForRefund, // 退货退款
+ ReturnApplyOrderTypeSalesRefund // 销售退款
+ } = REFUND_STATUS_ORDER
+
//订单类型
// const {
// SaLeModeBulk,
@@ -39,68 +47,61 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
//售后按钮按售后状态归类, value是该订单状态,可能该按钮会出现
const orderBtnsList = useRef([
+ {
+ id: 8,
+ big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value],
+ cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value ],
+ model_value: [],
+ label: '申请记录'
+ },
{
id: 1,
- value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
+ big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value],
+ cut_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value, ],
+ model_value: [],
label: '取消退货'
},
- {
- id: 2,
- value: [ReturnStageWaitCheck.value],
- label: '退货物流'
- },
- // {
- // id: 3,
- // value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value],
- // label: '查看物流'
- // },
{
id: 4,
- value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
+ big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
+ cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
+ model_value: [],
label: '质检结果'
},
- // {
- // id: 5,
- // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
- // label: '退货码单'
- // },
{
id: 6,
- value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value],
+ big_value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value],
+ cut_value: [ReturnStageWaitCheck.value, ReturnStageApplying.value],
+ model_value: [ReturnStageApplying.value],
label: '取消退款'
},
- // {
- // id: 7,
- // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
- // label: '退款码单'
- // },
- {
- id: 8,
- value: [],
- label: '申请记录'
- },
+
])
//判断是否显示该按钮
const orderBtnsShow = (item) => {
- if(!orderInfo) return false
+ let key = ['big_value', 'model_value', 'cut_value']
if(item.id == 1) {
//取消退货
- return (orderInfo.type == 1)&&item.value.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.value.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.value.includes(orderInfo.stage) //退货才有
+ return (orderInfo?.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有
} else {
- return item.value.includes(orderInfo.stage)
+ return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage)
}
}
//显示的按钮数组
- const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => {
+ const orderBtnsShowList: any[] = useMemo(() => {
return orderBtnsList.current.filter(item => {
return orderBtnsShow(item)
})
@@ -109,19 +110,19 @@ export default memo(({orderInfo, onClick, onBtnNull}: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) {
@@ -129,7 +130,7 @@ export default memo(({orderInfo, onClick, onBtnNull}: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)
}
@@ -147,25 +148,28 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => {
}, [orderBtnsShowList])
return (
-
- {(orderBtnsShowList.length > 3)&&
- setShowMore(true)}>更多
- {showMore&&
-
- {orderBtnsShowList.map((item, index) => {
- return ((index >= 3) && submitBtns(item.id, index)}>{item.label})
- })}
-
- setShowMore(false)}>
- }
- }
+ <>
+ {(orderBtnsShowList.length > 0)&&
+
+ {(orderBtnsShowList.length > 3)&&
+ setShowMore(true)}>更多
+ {showMore&&
+
+ {orderBtnsShowList.map((item, index) => {
+ return ((index >= 3) && submitBtns(item.id, index)}>{item.label})
+ })}
+
+ setShowMore(false)}>
+ }
+ }
-
- {orderBtnsShowList.map((item, index) =>
- (index < 3)&& submitBtns(item.id, index)}>{item.label}
- )}
-
-
-
+
+ {orderBtnsShowList.map((item, index) =>
+ (index < 3)&& submitBtns(item.id, index)}>{item.label}
+ )}
+
+
+ }
+ >
)
})
\ No newline at end of file
diff --git a/src/components/checkbox/index.module.scss b/src/components/checkbox/index.module.scss
index b50f17d..8224c9a 100644
--- a/src/components/checkbox/index.module.scss
+++ b/src/components/checkbox/index.module.scss
@@ -12,6 +12,7 @@
border-radius: 50%;
text-align: center;
line-height: 40px;
+ background-color: #fff;
}
.no_checkbox_item{
border:0;
diff --git a/src/components/moveBtn/index.module.scss b/src/components/moveBtn/index.module.scss
index f04d5be..d7f4fe7 100644
--- a/src/components/moveBtn/index.module.scss
+++ b/src/components/moveBtn/index.module.scss
@@ -14,7 +14,21 @@
align-items: center;
z-index:999;
.shop_icon{
- font-size: 50px;
+ font-size: 70px;
color: $color_main;
}
+ .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: 0;
+ }
}
\ No newline at end of file
diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx
index e30e888..23e5b53 100644
--- a/src/components/moveBtn/index.tsx
+++ b/src/components/moveBtn/index.tsx
@@ -3,6 +3,7 @@ import Taro, { useReady } from "@tarojs/taro"
import { ReactElement, useEffect, useRef, useState } from "react"
import classnames from "classnames";
import styles from './index.module.scss'
+import { GetShoppingCartApi } from "@/api/shopCart";
type param = {
children?: ReactElement|null,
@@ -22,6 +23,19 @@ export default ({children = null, onClick}:param) => {
setShowMoveBtn(true)
})
+ //获取数据
+ const [list, setList] = useState([])
+ const {fetchData} = GetShoppingCartApi()
+ const getShoppingCart = async () => {
+ const {data} = await fetchData()
+ let color_list = data.color_list||[]
+ setList(color_list)
+ }
+
+ useEffect(() => {
+ getShoppingCart()
+ }, [])
+
const dragEnd = (e) => {
}
@@ -31,6 +45,7 @@ export default ({children = null, onClick}:param) => {
{children}
{showMoveBtn&& dragEnd(e)}>
+ {(list.length > 0)&&{list.length > 99?'99+':list.length}}
}
)
diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx
index b0d4ce6..aaef418 100644
--- a/src/components/orderBtns/index.tsx
+++ b/src/components/orderBtns/index.tsx
@@ -1,6 +1,6 @@
import { CancelOrderApi, ReceiveOrderApi } from "@/api/order"
import { alert, goLink } from "@/common/common"
-import { ORDER_STATUS, SALE_MODE } from "@/common/enum"
+import { ORDER_STATUS, SALE_MODE, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"
import {Text, View } from "@tarojs/components"
import Taro from "@tarojs/taro"
import {useRef, memo, useState, useMemo } from "react"
@@ -8,6 +8,8 @@ import classnames from "classnames";
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: {
@@ -126,22 +128,42 @@ export default memo(({orderInfo, onClick}:Param) => {
})
}, [orderInfo])
-
+ //订阅消息
+ const {ApplyGoods} = SUBSCRIPTION_MESSAGE_SCENE
+ const {openSubscriptionMessage} = UseSubscriptionMessage()
//点击按钮操作
- const submitBtns = (val, index) => {
+ const submitBtns = throttle(async (val, index) => {
if (val == 1) {
cancelOrder()
} else if (val == 6) {
receiveOrder()
} else if(val == 5) {
if(!orderInfo?.av_return_roll) return alert.none('该订单没有可退条数')
- goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
+ await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
+ goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId})
+ } else if (val == 3) {
+ 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('用户点击取消')
+ }
+ }
+ })
}
//取消订单
@@ -168,7 +190,6 @@ export default memo(({orderInfo, onClick}:Param) => {
//确认订单
const {fetchData: receiveOrderFetchData} = ReceiveOrderApi()
const receiveOrder = async () => {
- console.log('123456')
Taro.showModal({
title: '确定收货?',
success: async function (res) {
@@ -195,6 +216,7 @@ export default memo(({orderInfo, onClick}:Param) => {
title: '确定退款?',
success: async function async (res) {
if(res.confirm) {
+ await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value})
let res = await fetchDataApplyRefund({sale_order_id: orderInfo?.orderId})
if(res.success) {
alert.success('申请成功')
diff --git a/src/components/product/index.module.scss b/src/components/product/index.module.scss
index 35f7693..3b62f33 100644
--- a/src/components/product/index.module.scss
+++ b/src/components/product/index.module.scss
@@ -51,15 +51,16 @@
.tag_list{
display: flex;
margin-top: 16px;
+ flex-wrap: wrap;
.tag, .tag_g{
+ max-width: 260rpx;
padding: 3px 10px;
background-color: #CDE5FF;
font-size: $font_size_min;
border-radius: 5px;
color: $color_main;
- &:nth-child(2) {
- margin-left: 10px;
- }
+ margin-right: 10px;
+ margin-bottom: 10px;
}
.tag_g{
background-color: #FFE6CE;
@@ -69,7 +70,7 @@
.introduce{
font-size: $font_size_medium;
color: $color_font_two;
- margin-top: 16px;
+
}
.des{
font-size:$font_size_medium;
diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx
index 905ef9d..a8b51fe 100644
--- a/src/components/shopCart/index.tsx
+++ b/src/components/shopCart/index.tsx
@@ -13,6 +13,7 @@ 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,
@@ -25,6 +26,7 @@ export default ({show = false, onClose}: param) => {
{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)
@@ -35,16 +37,18 @@ export default ({show = false, onClose}: param) => {
setSelectStatus(true)
}, [selectIndex])
+
+
//重置勾选数据
const resetList = () => {
list?.map(item => {
if(selectIndex == item.sale_mode || selectIndex == -1) {
- item.select = true
+ checkboxData[item.id] = true
} else {
- item.select = false
+ checkboxData[item.id] = false
}
})
- setList([...list])
+ setCheckboxData(() => ({...checkboxData}))
}
//获取数据
@@ -59,12 +63,17 @@ export default ({show = false, onClose}: param) => {
setLoading(false)
}
- //初始化全部数据
+ //初始化全部数据默认勾选
+ const [checkboxData, setCheckboxData] = useState<{[index:number]:true|false}>({})
+ const initStatus = useRef(false)
const initList = (color_list) => {
- color_list?.map(item => {
- if(selectIndex == item.sale_mode) item.select = true
- item.count = formatCount(item)
- })
+ if(initStatus.current) {
+ color_list?.map(item => {
+ if(selectIndex == item.sale_mode) checkboxData[item.id] = true
+ })
+ initStatus.current = false
+ }
+ setCheckboxData(() => checkboxData)
}
//显示是展示数据
@@ -74,6 +83,7 @@ export default ({show = false, onClose}: param) => {
setSelectIndex(0)
} else {
setLoading(true)
+ initStatus.current = true
getShoppingCart()
}
}, [show])
@@ -94,17 +104,17 @@ export default ({show = false, onClose}: param) => {
const selectAll = () => {
list.map(item => {
if(selectIndex == item.sale_mode || selectIndex == -1)
- item.select = !selectStatus
+ checkboxData[item.id] = !selectStatus
})
setSelectStatus(!selectStatus)
- setList([...list])
+ setCheckboxData(() => ({...checkboxData}))
}
//checkbox选中回调
const selectCallBack = (item) => {
- item.select = true
+ checkboxData[item.id] = true
checkSelect()
- setList([...list])
+ setCheckboxData(() => ({...checkboxData}))
}
//checkbox选中判断是否全部选中,全部选中后是全选,否则反选
@@ -114,7 +124,7 @@ export default ({show = false, onClose}: param) => {
list?.map(item => {
if(selectIndex == -1 || selectIndex == item.sale_mode) {
list_count ++
- if(item.select) select_count++
+ if(checkboxData[item.id]) select_count++
}
})
setSelectStatus(select_count == list_count)
@@ -122,9 +132,9 @@ export default ({show = false, onClose}: param) => {
//checkbox关闭回调
const colseCallBack = (item) => {
- item.select = false
+ checkboxData[item.id] = false
checkSelect()
- setList([...list])
+ setCheckboxData(() => ({...checkboxData}))
}
//popup关闭
@@ -170,7 +180,7 @@ export default ({show = false, onClose}: param) => {
selectIds.current = []
list?.map(item => {
if(selectIndex == -1 || selectIndex == item.sale_mode) {
- item.select&&selectIds.current.push(item.id)
+ checkboxData[item.id]&&selectIds.current.push(item.id)
}
})
}
@@ -198,7 +208,7 @@ export default ({show = false, onClose}: param) => {
let color_count = 0 //颜色数量
let all_count = 0 //总数量
list.map(item => {
- if(item.select) {
+ if(checkboxData[item.id]) {
estimate_amount += item.estimate_amount
product_list.add(item.product_id)
color_count++
@@ -207,11 +217,30 @@ export default ({show = false, onClose}: param) => {
})
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])
+ },[list, checkboxData])
//去结算
- const orderDetail = debounce(() => {
+ 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('请选择面料')
@@ -223,6 +252,7 @@ export default ({show = false, onClose}: param) => {
}
}, 500)
+
//计数组件-当后端修改完成才修改前端显示
const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi()
const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false)
@@ -236,12 +266,12 @@ export default ({show = false, onClose}: param) => {
getShoppingCart()
}
}, 300)
-
+
return (
closePopup()} >
-
+
{!selectStatus?'全选':'反选'}
@@ -261,7 +291,7 @@ export default ({show = false, onClose}: param) => {
{list?.map((item, index) => {
return
- selectCallBack(item)} onClose={() => colseCallBack(item)}/>
+ selectCallBack(item)} onClose={() => colseCallBack(item)}/>
@@ -272,12 +302,12 @@ export default ({show = false, onClose}: param) => {
{item.sale_mode_name}
- ¥{formatPirce(item.sale_price)}/{selectList[selectIndex].eunit}
+ ¥{formatPirce(item.sale_price)}/{selectList[item.sale_mode].eunit}
{/* ×{formatCount(item)}{selectList[selectIndex].unit} */}
getInputValue(e, item)}
- defaultNum={item.count}
+ defaultNum={formatCount(item)}
step={selectList[selectIndex].step}
digits={selectList[selectIndex].digits}
onClickBtn={(e) => getInputValue(e, item)}
diff --git a/src/components/textareaEnhance/index.tsx b/src/components/textareaEnhance/index.tsx
index 7d41b2c..52e4189 100644
--- a/src/components/textareaEnhance/index.tsx
+++ b/src/components/textareaEnhance/index.tsx
@@ -1,5 +1,5 @@
import {Textarea, View } from "@tarojs/components";
-import { memo, useMemo, useState } from "react";
+import { memo, useEffect, useMemo, useState } from "react";
import styles from './index.module.scss'
import classnames from "classnames";
@@ -8,17 +8,17 @@ 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: '',
count: 200,
show: false
})
- const getDesc = (e) => {
- let value = e.detail.value
+ const getDesc = (value = '') => {
let res = value
if(value.length > descData.count) {
res = value.slice(0, descData.count)
@@ -27,6 +27,10 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
onChange?.(res)
}
+ useEffect(() => {
+ getDesc(defaultValue)
+ }, [defaultValue])
+
const toggleShowRealTextarea = (show) => {
setDescData({...descData, show:show})
}
@@ -34,7 +38,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa
{title}
- {descData.show&&||
+ {(descData.show && !onlyRead)&&||
toggleShowRealTextarea(true)}>{descData.value||placeholder}
}
{descData.number +'/'+ descData.count}
diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx
index 8a144be..53502c7 100644
--- a/src/components/uploadImage/index.tsx
+++ b/src/components/uploadImage/index.tsx
@@ -8,17 +8,26 @@ import styles from './index.module.scss'
//图片列表
type ImageParam = {
- onChange?:(val: string[]) => void
+ onChange?:(val: string[]) => void,
+ defaultList?: string[],
+ onlyRead?: false|true
}
-const PictureItem:FC = memo(({onChange}) => {
+const PictureItem:FC = memo(({onChange, defaultList, onlyRead = false}) => {
const {getWxPhoto} = useUploadCDNImg()
const [imageList, setImageLise] = useState([])
+
+ useEffect(() => {
+ setImageLise(defaultList||[])
+ }, [defaultList])
+
//上传图片
const uploadImage = async () => {
- let res:any = await getWxPhoto('after-sale')
- if(res.code == 200) {
- setImageLise([...imageList, res.url])
- }
+ let list:any = await getWxPhoto('after-sale', 5)
+ let images:any[] = []
+ list?.map(item => {
+ images.push(item.url)
+ })
+ setImageLise([...imageList, ...images])
}
//删除图片
const delImage = (index) => {
@@ -27,7 +36,7 @@ const PictureItem:FC = memo(({onChange}) => {
}
//监听上传的图片变化
useEffect(() => {
- onChange?.(imageList||[])
+ onChange?.(imageList)
}, [imageList])
//预览图片
@@ -46,12 +55,12 @@ const PictureItem:FC = memo(({onChange}) => {
{imageList.map((item, index) =>
- delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}>
+ {!onlyRead && delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}>}
)}
-
+ {!onlyRead &&
上传照片
-
+ }
)
})
diff --git a/src/pages/addressAdd/index.tsx b/src/pages/addressAdd/index.tsx
index cf9ac26..a9a106a 100644
--- a/src/pages/addressAdd/index.tsx
+++ b/src/pages/addressAdd/index.tsx
@@ -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(()=>{
diff --git a/src/pages/addressManager/index.tsx b/src/pages/addressManager/index.tsx
index 081d0bc..427553e 100644
--- a/src/pages/addressManager/index.tsx
+++ b/src/pages/addressManager/index.tsx
@@ -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 (
diff --git a/src/pages/applyAfterSales/components/cutKindList/index.module.scss b/src/pages/applyAfterSales/components/cutKindList/index.module.scss
new file mode 100644
index 0000000..bc49015
--- /dev/null
+++ b/src/pages/applyAfterSales/components/cutKindList/index.module.scss
@@ -0,0 +1,64 @@
+.apply_after_sales_list{
+ padding: 0 20px;
+ .apply_after_sales_item{
+ margin-bottom: 50px;
+ .apply_after_sales_title{
+ display: flex;
+ align-items: center;
+ .tag{
+ font-size: $font_size_min;
+ background-color: #CDE5FF;
+ padding: 5px 10px;
+ border-radius: 6px;
+ color: $color_main;
+ }
+ .title{
+ font-weight: 700;
+ font-size: $font_size;
+ margin-left: 20px;
+ flex:1;
+ }
+ }
+ .color_list {
+ .color_item{
+ display: flex;
+ align-items: center;
+ margin: 30px 0;
+ }
+ .image{
+ width: 70px;
+ height: 70px;
+ image{
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ }
+ }
+ .name_and_number{
+ padding-left: 30px;
+ flex:1;
+ text{
+ &:nth-child(1) {
+ font-weight: 700;
+ font-size: $font_size;
+ }
+ &:nth-child(2) {
+ color: $color_font_two;
+ font-size: $font_size;
+ margin-left: 20px;
+ }
+ }
+ }
+ .btn_count{
+ width: 216px;
+ height: 64px;
+ background-color: #ECF5FF;
+ border-radius: 40px 0px 16px 0px;
+ padding: 0 20px;
+ display: flex;
+ align-items: center;
+ }
+ }
+ }
+
+}
diff --git a/src/pages/applyAfterSales/components/cutKindList/index.tsx b/src/pages/applyAfterSales/components/cutKindList/index.tsx
new file mode 100644
index 0000000..2af3855
--- /dev/null
+++ b/src/pages/applyAfterSales/components/cutKindList/index.tsx
@@ -0,0 +1,68 @@
+import { formatHashTag, formatImgUrl } from "@/common/fotmat";
+import Counter from "@/components/counter";
+import MCheckbox from "@/components/checkbox";
+import { Image, Text, View } from "@tarojs/components";
+import { FC, memo, useCallback } from "react";
+import styles from './index.module.scss'
+
+type OrderParam = {
+ list?: any[],
+ sale_mode?: number,
+ sale_mode_name?: string,
+ unit?: string,
+ total_colors?: number,
+ total_fabrics?: number,
+ total_number?: number,
+ status?: number, //订单状态
+}
+
+type Param = {
+ order: OrderParam,
+ onSelectChange?: (val: {color_id:number, length: number, status: true|false, sale_order_detail_id:number}) => void
+}
+
+const kindeList:FC = memo(({order, onSelectChange}) => {
+ //对应数量
+ const formatCount = useCallback((item) => {
+ return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit
+ }, [order])
+
+
+ //checkbox选中回调
+ const selectCallBack = (colorItem) => {
+ console.log('colorItem::',colorItem)
+ onSelectChange?.({color_id:colorItem.id, length:colorItem.length, sale_order_detail_id:colorItem.sale_order_detail_id, status: true})
+ }
+
+ //checkbox关闭回调
+ const colseCallBack = (colorItem) => {
+ onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false, sale_order_detail_id:colorItem.sale_order_detail_id,})
+ }
+
+ //判断该面料下的颜色都退完了
+ const colorNum = (item) => {
+ return item.product_colors.some(val => {
+ return val.return_roll + val.apply_return_roll == 0
+ })
+ }
+
+ return (
+
+ {order?.list?.map(item => colorNum(item)&&
+
+ {order.sale_mode_name}
+ {formatHashTag(item.code, item.name)}
+
+
+ {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) == 0)&&
+
+ {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)}
+ selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/>
+ )}
+
+ )}
+
+ )
+})
+
+export default kindeList
\ No newline at end of file
diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx
index 3a26d92..f046edb 100644
--- a/src/pages/applyAfterSales/components/kindList/index.tsx
+++ b/src/pages/applyAfterSales/components/kindList/index.tsx
@@ -19,48 +19,43 @@ type OrderParam = {
type Param = {
order: OrderParam,
onNumChange?: (val:any) => void
- onSelectChange?: (val: {color_id:number, length: number, status: true|false}) => void
}
-const kindeList:FC = memo(({order, onNumChange, onSelectChange}) => {
+const kindeList:FC = memo(({order, onNumChange}) => {
//对应数量
const formatCount = useCallback((item) => {
- return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit
+ return (item.roll - item.return_roll - item.apply_return_roll) + order?.unit!
}, [order])
//计步器失返回值
const getCounterChange = useCallback((colorItem) => {
return (number) => {
- onNumChange?.({number, color_id: colorItem.id})
+ onNumChange?.({number, color_id: colorItem.id, sale_order_detail_id:colorItem.sale_order_detail_id})
}
}, [])
- //checkbox选中回调
- const selectCallBack = (colorItem) => {
- console.log('colorItem::',colorItem)
- onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: true})
- }
-
- //checkbox关闭回调
- const colseCallBack = (colorItem) => {
- onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false})
+ //判断该面料下的颜色都退完了
+ const colorNum = (item) => {
+ let res = item.product_colors.some(val => {
+ return val.return_roll < val.roll
+ })
+ return res
}
return (
- {order?.list?.map(item =>
+ {order?.list?.map(item => (colorNum(item))&&
{order.sale_mode_name}
{formatHashTag(item.code, item.name)}
- {item.product_colors.map(colorItem =>
+ {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) < colorItem.roll)&&
{colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)}
- {(order.sale_mode == 0)&&
-
- ||
- selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/>}
+
+
+
)}
)}
diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx
index 7cfbc41..fd06f1d 100644
--- a/src/pages/applyAfterSales/index.tsx
+++ b/src/pages/applyAfterSales/index.tsx
@@ -6,10 +6,12 @@ import ReasonPopup from "./components/reasonPopup";
import { useDidShow, useRouter } from "@tarojs/taro";
import { GetSaleOrderDetailApi } from "@/api/order";
import KindList from "./components/kindList"
+import CutKindList from "./components/cutkindList"
import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder";
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, //原因
@@ -18,7 +20,7 @@ enum returnStatus {
}
export default () => {
-
+ useLogin()
useDidShow(() => {
getSaleOrderPreView()
})
@@ -67,7 +69,6 @@ export default () => {
unit: orderDetail.sale_mode == 0?'条':'m', //单位
list: orderDetail.product_list,
status: orderDetail.status, //订单状态
-
})
}
@@ -86,7 +87,7 @@ export default () => {
//大货时获取计步器数据
const getNumChange = useCallback((val) => {
if(parseInt(val.number) > 0) {
- roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number}
+ roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id}
} else {
delete roll_list.current[val.color_id]
}
@@ -101,7 +102,7 @@ export default () => {
//散剪和剪板
const getSelectChange = useCallback((val) => {
if(val.status) {
- roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length}
+ roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id}
} else {
delete roll_list.current[val.color_id]
}
@@ -126,6 +127,7 @@ export default () => {
const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi()
const onSubmitData = async () => {
if(submitData.roll_list.length <= 0) return alert.error('请选择退货颜色')
+ console.log('submitData::',submitData)
let res = await fetchDataReturnApply(submitData)
if(res.success) {
alert.success('申请成功')
@@ -157,6 +159,8 @@ export default () => {
setShowReason(true)
}
+ console.log('aaa:', 123456789)
+
//请求获取到的数据
const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[], status: 1|2|3}>({title:'', list:[], status: returnStatus.goods_status})
//售后货物状况
@@ -202,7 +206,8 @@ export default () => {
{dataCount}
-
+ {(orderDetail?.sale_mode == 0)&&||
+ }
退货原因
diff --git a/src/pages/certification/index.tsx b/src/pages/certification/index.tsx
index da5912b..bc53251 100644
--- a/src/pages/certification/index.tsx
+++ b/src/pages/certification/index.tsx
@@ -36,7 +36,7 @@ export default () => {
business_license_url: "",
legal_person: "",
legal_person_identity: "",
- businessLicense: '',
+ business_license: '',
legal_person_identity_url: [],
name: ""
});
@@ -47,6 +47,9 @@ export default () => {
name: [{
message: "请输入企业名称"
}],
+ business_license: [{
+ message: "请输入企业营业执照"
+ }],
business_license_url: [{
message: "请上传营业执照"
}],
@@ -132,7 +135,7 @@ export default () => {
setFormData({ ...formData, name: ev.detail.value })} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required />
{/* */}
- setFormData({ ...formData, businessLicense: ev.detail.value })} value={formData["businessLicense"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required />
+ setFormData({ ...formData, business_license: ev.detail.value })} value={formData["business_license"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required />
handleUploadImage("business_license_url")} className="certification-upload">
{(formData as any)?.business_license_url ?
<>
diff --git a/src/pages/classList/index.tsx b/src/pages/classList/index.tsx
index c2a46c9..6538ab8 100644
--- a/src/pages/classList/index.tsx
+++ b/src/pages/classList/index.tsx
@@ -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()
diff --git a/src/pages/collection/collectionClass/index.config.ts b/src/pages/collection/collectionClass/index.config.ts
new file mode 100644
index 0000000..42b7aff
--- /dev/null
+++ b/src/pages/collection/collectionClass/index.config.ts
@@ -0,0 +1,4 @@
+export default {
+ navigationBarTitleText: '我的收藏a',
+ enableShareAppMessage: true,
+}
diff --git a/src/pages/collection/collectionClass/index.module.scss b/src/pages/collection/collectionClass/index.module.scss
new file mode 100644
index 0000000..51ba4ab
--- /dev/null
+++ b/src/pages/collection/collectionClass/index.module.scss
@@ -0,0 +1,50 @@
+
+.collection_main {
+ padding: 0 20px;
+ min-height: 100%;
+ background-color: #F8F8F8;
+ .search {
+ display: flex;
+ align-items: center;
+ .miconfont_con{
+ padding: 0 20px;
+ }
+ .miconfont{
+ font-size: 30px;
+ color: #007AFF;
+ border: 1px solid #007AFF;
+ border-radius: 50%;
+ }
+ }
+ .operation{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20px 30px 0 30px;
+ font-size: 26px;
+ color: #707070;
+ .operation_check{
+ display: flex;
+ align-items: center;
+ Text{
+ margin-left: 15px;
+ height: 100%;
+ display: inline-block;
+
+ }
+ }
+ }
+ .operation_check_right{
+ .operation_check_move{
+ color: #707070;
+ margin-right: 30px;
+ }
+ .operation_check_cancel{
+ color: #007AFF;
+ }
+ }
+ .class_list{
+ margin-top: 30px;
+
+ }
+}
\ No newline at end of file
diff --git a/src/pages/collection/collectionClass/index.tsx b/src/pages/collection/collectionClass/index.tsx
new file mode 100644
index 0000000..16a0447
--- /dev/null
+++ b/src/pages/collection/collectionClass/index.tsx
@@ -0,0 +1,105 @@
+import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
+import { alert } from "@/common/common";
+import { getFilterData } from "@/common/util";
+import Product from "../components/product";
+import Search from "@/components/search"
+import { Text, View } from "@tarojs/components"
+import Taro, { useRouter } from "@tarojs/taro";
+import classnames from "classnames";
+import { useCallback, useEffect, useRef, useState } from "react";
+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 () => {
+
+ const router = useRouter()
+
+ //获取收藏夹面料
+ const [list, setList] = useState([])
+ const getFavoriteInfo = () => {
+ let arr:any[] = []
+ new Array(10).fill("").map((item, index) => {
+ arr.push({id:index, code: index})
+ })
+ setList(arr)
+ }
+
+ //获取搜索数据
+ const [searchData, setSearchData] = useState('')
+ const onSearch = useCallback((e) => {
+ setSearchData(() => e)
+ }, [])
+ useEffect(() => {
+ getFavoriteInfo()
+ }, [searchData])
+
+
+ //获取选中的id
+ const [ids, setIds] = useState([])
+ const getSelectIds = useCallback((val) => {
+ setIds(() => val)
+ }, [])
+
+ //全选反选
+ const [allSelectStatus, setAllSelectStatus] = useState(false)
+ const selectCallBack = useCallback(() => {
+ setAllSelectStatus(() => true)
+ setSelectStatus(1)
+ }, [])
+ const colseCallBack = useCallback(() => {
+ setAllSelectStatus(() => false)
+ setSelectStatus(3)
+ }, [])
+
+ 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)
+ }, [])
+
+ const onAdd = () => {
+
+ }
+
+ return (
+
+
+
+
+
+
+ selectCallBack()} onClose={() => colseCallBack()}/>
+ 全选
+
+
+ setCollectionShow(true)}>移动到
+ 取消收藏
+
+
+
+
+
+
+
+ )
+ }
\ No newline at end of file
diff --git a/src/pages/collection/components/createPopup/index.tsx b/src/pages/collection/components/createPopup/index.tsx
index f86f664..48ce577 100644
--- a/src/pages/collection/components/createPopup/index.tsx
+++ b/src/pages/collection/components/createPopup/index.tsx
@@ -1,6 +1,6 @@
import Popup from "@/components/popup";
import { Input, ScrollView, Text, View } from "@tarojs/components";
-import { memo, useCallback, useMemo, useRef } from "react";
+import { memo, useCallback, useEffect, useMemo, useRef } from "react";
import classnames from "classnames";
import styles from './index.module.scss'
import TextareaEnhance from "@/components/textareaEnhance";
@@ -11,7 +11,7 @@ import { alert } from "@/common/common";
type ReasonInfoParam = {
show?: boolean, //显示
onClose?: () => void, //关闭
- onSuccess?: () => void, //成功
+ onSuccess?: (val:any) => void, //成功
defaultValue?: {
remark: string,
name: string
@@ -24,40 +24,34 @@ export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInf
"remark": ''
})
- const getOtherReason = useCallback((val) => {
+ const getOtherReason = (val) => {
submitData.current.remark = val
- }, [])
-
- const changeInput = useCallback((val) => {
- submitData.current.name = val.detail.value
- }, [])
-
- //创建
- const {fetchData} = CreateFavoriteApi()
- const onSubmit = async () => {
- if(!submitData.current.name) return alert.none('请输入收藏夹名称!')
- let res = await fetchData(submitData.current)
- if(res.success) {
- alert.success('创建成功')
- onSuccess?.()
- } else {
- alert.error('创建失败')
- }
- onClose?.()
}
+
+ const changeInput = (val) => {
+ submitData.current.name = val.detail.value
+ }
+
+ const onSubmit = () => {
+ onSuccess?.(submitData.current)
+ }
+
+ useEffect(() => {
+ submitData.current = {name: defaultValue?.name!, remark: defaultValue?.remark!}
+ }, [defaultValue])
return (
名称
-
+
简介
-
+
diff --git a/src/pages/collection/components/product/index.module.scss b/src/pages/collection/components/product/index.module.scss
new file mode 100644
index 0000000..691077d
--- /dev/null
+++ b/src/pages/collection/components/product/index.module.scss
@@ -0,0 +1,89 @@
+
+.products_list{
+ padding: 0 20px 20px 20px;
+ box-sizing: border-box;
+ height: 100%;
+}
+.products_item{
+ width: 100%;
+ background-color: #fff;
+ border-radius: 20px;
+ padding: 20px;
+ box-sizing: border-box;
+ display: flex;
+ justify-content: space-between;
+ position: relative;
+ &:nth-child(n+2){
+ margin-top: 16px;
+ }
+ .checkbox{
+ position: absolute;
+ left: 10px;
+ top: 10px;
+ z-index: 999;
+ }
+ .item_img{
+ width: 198px;
+ height: 198px;
+ position: relative;
+ image{
+ width: 100%;
+ height: 100%;
+ border-radius: 10px;
+ }
+ .num{
+ padding: 5px 10px 5px 20px;
+ font-size: $font_size_min;
+ position: absolute;
+ right:0;
+ bottom: 0;
+ background: rgba($color: #000, $alpha: 0.3);
+ border-radius: 36px 0px 10px 0px;
+ color: #fff;
+ text-align: center;
+ }
+ }
+ .item_con{
+ padding-left: 20px;
+ font-size: $font_size;
+ flex:1;
+ .title{
+ font-size: $font_size;
+ color: #707070;
+ text{
+ color: $color_font_one;
+ font-weight: bold;
+ }
+ }
+ .tag_list{
+ display: flex;
+ margin-top: 16px;
+ flex-wrap: wrap;
+ .tag, .tag_g{
+ max-width: 260rpx;
+ padding: 3px 10px;
+ background-color: #CDE5FF;
+ font-size: $font_size_min;
+ border-radius: 5px;
+ color: $color_main;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ }
+ .tag_g{
+ background-color: #FFE6CE;
+ color: #EE7500;
+ }
+ }
+ .introduce{
+ font-size: $font_size_medium;
+ color: $color_font_two;
+
+ }
+ .des{
+ font-size:$font_size_medium;
+ color: #707070;
+ margin-top: 16px;
+ @include common_ellipsis($params:2);
+ }
+ }
+}
diff --git a/src/pages/collection/components/product/index.tsx b/src/pages/collection/components/product/index.tsx
new file mode 100644
index 0000000..1e48ba7
--- /dev/null
+++ b/src/pages/collection/components/product/index.tsx
@@ -0,0 +1,83 @@
+import { Image, View } from "@tarojs/components"
+import Taro from "@tarojs/taro"
+import { goLink } from "@/common/common"
+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, useRef, useState } from "react"
+
+type Params = {
+ productList?: any[],
+ onSelectIds?: (val: number[]) => void,
+ selectStatus?: 1|2|3, //1全选,2不做处理,3全清空
+ openCheckBox?: true|false //是否开启选择
+}
+export default ({productList = [], onSelectIds, selectStatus = 2, openCheckBox = false}:Params) => {
+ const [list, setList] = useState([])
+ useEffect(() => {
+ setList(() => [...productList])
+ },[productList])
+
+ useEffect(() => {
+ if(list.length && selectStatus != 2) {
+ list.map(item => {
+ item.check = (selectStatus == 1)
+ })
+ setList(() => [...list])
+ }
+
+ }, [selectStatus])
+
+ const onChangeSelect = (item) => {
+ if(item.check) {
+ onClose(item)
+ } else {
+ onSelect(item)
+ }
+ }
+
+ //选中和取消选中
+ const onSelect = (item) => {
+ item.check = true
+ setList(() => ([...list]))
+ }
+ 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 (
+
+ {list?.map(item => {
+ return openCheckBox?onChangeSelect(item):goLink(`/pages/details/index?id=${item.product_id}`)}>
+ {openCheckBox&& e.stopPropagation()}>
+ onSelect(item)} onClose={() => onClose(item)}/>
+ }
+
+
+ {item.enable_product_color_count}色
+
+
+ {formatHashTag(item.product_code, '')} {item.product_name}
+
+ {item.width}
+ {item.weight_density}
+
+ {item.component}
+
+
+ })}
+
+
+ )
+}
diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx
index 3efdab7..c78a1ac 100644
--- a/src/pages/collection/index.tsx
+++ b/src/pages/collection/index.tsx
@@ -1,7 +1,7 @@
-import { DelFavoriteApi, FavoriteListApi } from "@/api/favorite";
-import { alert } from "@/common/common";
+import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite";
+import { alert, goLink } from "@/common/common";
import { getFilterData } from "@/common/util";
-import Product from "@/components/product";
+import Product from "./components/product";
import Search from "@/components/search"
import { Text, View } from "@tarojs/components"
import Taro from "@tarojs/taro";
@@ -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])
@@ -32,9 +33,6 @@ export default () => {
let res = await fetchDataList(getFilterData({name: searchData}))
setList(() => res.data.list)
}
- useEffect(() => {
- getFavoriteList()
- }, [])
//创建收藏夹
const [collectioinShow, setCollectioinShow] = useState(false)
@@ -42,12 +40,31 @@ export default () => {
setCollectioinShow(false)
}, [])
- //创建成功
- const onCreatSuccess = useCallback(() => {
- getFavoriteList()
- }, [])
+ const creatShow = () => {
+ setCollectioinShow(true)
+ setInitData(() => ({ remark: '',name: '', id:0}))
+ }
+
+
+ //新增
+ const {fetchData} = CreateFavoriteApi()
+ const onCreate = async (submitData) => {
+ if(!submitData.name) return alert.none('请输入收藏夹名称!')
+ let res = await fetchData({...submitData})
+ if(res.success) {
+ alert.success('创建成功')
+ getFavoriteList()
+ } else {
+ alert.error('创建失败')
+ }
+ }
//更多编辑
+ const [initData, setInitData] = useState({
+ remark: '',
+ name: '',
+ id:0
+ })
const selectInfo = useRef(null)
const [updateShow, setUpdateShow] = useState(false)
const closeUpdate = useCallback(() => {
@@ -56,6 +73,8 @@ export default () => {
const moreUpdate = (item,e) => {
e.stopPropagation()
selectInfo.current = item
+ console.log('item:::', item)
+ setInitData((e) =>({ ...e, remark:item.remark , name: item.name, id: item.id}))
setUpdateShow(true)
}
@@ -84,15 +103,40 @@ export default () => {
}, [])
//编辑
- const onUpdate = useCallback(() => {
-
+ const {fetchData: updateFavoriteFetchData} = UpdateFavoriteApi()
+ const onUpdateShow = useCallback(() => {
+ setCollectioinShow(true)
}, [])
+ const onUpdate = async (submitData) => {
+ if(!submitData.name) return alert.none('请输入收藏夹名称!')
+ let res = await updateFavoriteFetchData({...submitData})
+ if(res.success) {
+ alert.success('编辑成功')
+ getFavoriteList()
+ } else {
+ alert.error('编辑失败')
+ }
+ }
+
+ const onBatchManagement = useCallback(() => {
+ // goLink('pages/collection/collectionClass/index', {id: })
+ }, [])
+
+ //操作文件夹
+ const onCreatSuccess = (submitData) => {
+ if (!initData.id) {
+ onCreate(submitData)
+ } else {
+ onUpdate({...submitData, id: initData.id})
+ }
+ setCollectioinShow(false)
+ }
return (
- setCollectioinShow(true)}>
+
{list?.map((item:any) =>
@@ -104,12 +148,12 @@ export default () => {
moreUpdate(item,e)}>更多
-
+
)}
-
-
+
+
)
}
\ No newline at end of file
diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx
index 0472783..e2b9845 100644
--- a/src/pages/company/index.tsx
+++ b/src/pages/company/index.tsx
@@ -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);
diff --git a/src/pages/creditLine/index.tsx b/src/pages/creditLine/index.tsx
index 6a9d4e9..c56062e 100644
--- a/src/pages/creditLine/index.tsx
+++ b/src/pages/creditLine/index.tsx
@@ -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()
diff --git a/src/pages/creditUsed/index.tsx b/src/pages/creditUsed/index.tsx
index 11cdbd8..f2f5eed 100644
--- a/src/pages/creditUsed/index.tsx
+++ b/src/pages/creditUsed/index.tsx
@@ -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({
diff --git a/src/pages/depositBeforehand/index.tsx b/src/pages/depositBeforehand/index.tsx
index 9636d30..6232afc 100644
--- a/src/pages/depositBeforehand/index.tsx
+++ b/src/pages/depositBeforehand/index.tsx
@@ -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();
diff --git a/src/pages/depositBeforehandDetail/index.tsx b/src/pages/depositBeforehandDetail/index.tsx
index 7d5f73e..11abfb0 100644
--- a/src/pages/depositBeforehandDetail/index.tsx
+++ b/src/pages/depositBeforehandDetail/index.tsx
@@ -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 (
diff --git a/src/pages/depositList/index.tsx b/src/pages/depositList/index.tsx
index eb9077c..3ef5918 100644
--- a/src/pages/depositList/index.tsx
+++ b/src/pages/depositList/index.tsx
@@ -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({
diff --git a/src/pages/details/components/preview/index.module.scss b/src/pages/details/components/preview/index.module.scss
index cab4ce5..9db49ae 100644
--- a/src/pages/details/components/preview/index.module.scss
+++ b/src/pages/details/components/preview/index.module.scss
@@ -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;
diff --git a/src/pages/details/components/preview/index.tsx b/src/pages/details/components/preview/index.tsx
index 8b3488a..ff86ecf 100644
--- a/src/pages/details/components/preview/index.tsx
+++ b/src/pages/details/components/preview/index.tsx
@@ -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&& onClose?.()}>
-
+
{value?.title}
}
diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss
index 750aefa..ec682c6 100644
--- a/src/pages/details/index.module.scss
+++ b/src/pages/details/index.module.scss
@@ -43,7 +43,7 @@
opacity: 0;
}
.miconfont{
- font-size: 36px;
+ font-size: 45px;
}
.collected{
color: #FFC300;
@@ -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;
diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx
index 87903c5..5e20e56 100644
--- a/src/pages/details/index.tsx
+++ b/src/pages/details/index.tsx
@@ -7,7 +7,7 @@ import OrderCount from './components/orderCount';
import ShopCart from '@/components/shopCart';
import Preview,{colorItem} from './components/preview';
import styles from './index.module.scss'
-import { useEffect, useMemo, useRef, useState } from 'react';
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {formatHashTag, formatImgUrl} from '@/common/fotmat'
import {GetProductDetailApi} from '@/api/material'
import useLogin from '@/use/useLogin';
@@ -16,6 +16,9 @@ import { SHARE_SCENE } from '@/common/enum';
import useUserInfo from '@/use/useUserInfo';
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}
@@ -25,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()
@@ -48,9 +51,9 @@ export default (props:Params) => {
}
useDidShow(() => {
- checkLogin()
judgeParam()
setShowCart(false)
+ getShoppingCart()
})
useEffect(() => {
@@ -69,7 +72,10 @@ export default (props:Params) => {
}
useEffect(() => {
- if(productInfo.code) getShortCode()
+ if(productInfo.code) {
+ getShortCode()
+ setCollectStatus(() => productInfo.is_favorite)
+ }
}, [productInfo])
@@ -91,21 +97,14 @@ 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)
}
- //收藏功能
- const [collectStatus, setCollectStatus] = useState(false)
- const changeCollect = () => {
- setCollectStatus(!collectStatus)
- Taro.showToast({
- title: '收藏成功',
- icon: 'success',
- duration: 2000
- })
- }
+
const {setSortCode, userInfo : userObj } = useUserInfo()
//详情页获取分享短码
@@ -134,7 +133,35 @@ export default (props:Params) => {
setShowOrderCount(true)
}
-
+ //收藏功能
+ const [collectStatus, setCollectStatus] = useState(false)
+ const [collectionShow, setCollectionShow] = useState(false)
+ const {fetchData: addFavoritefetchData} = AddFavoriteApi()
+ const onAdd = useCallback(async (val) => {
+ let res = await addFavoritefetchData({favorite_id: val.id, product_id: Number(params.id)})
+ if(res.success) {
+ alert.success('添加成功')
+ setCollectStatus(true)
+ } else {
+ alert.none(res.msg)
+ }
+
+ setCollectionShow(false)
+ }, [params])
+ const closeCollection = useCallback(() => {
+ setCollectionShow(false)
+ }, [])
+
+ //获取购物车数据数量
+ const [shopCount, setShopCount] = useState(0)
+ const {fetchData: fetchDataShopCount} = GetShoppingCartApi()
+ const getShoppingCart = async () => {
+ const {data} = await fetchDataShopCount()
+ let color_list = data.color_list||[]
+ setShopCount(color_list.length)
+ }
+
+
//页面下拉刷新
usePullDownRefresh(() => {
getProductDetail()
@@ -146,7 +173,7 @@ export default (props:Params) => {
- {productName}
+ {productInfo.code&&{productName}}
{productInfo.describe}
@@ -154,8 +181,8 @@ export default (props:Params) => {
分享
-
- changeCollect()}>
+ setCollectionShow(true)}>
+
收藏
@@ -188,6 +215,7 @@ export default (props:Params) => {
setShowCart(true)}>
购物车
+ {(shopCount > 0)&&{shopCount > 99?'99+':shopCount}}
{
(!userInfo.adminUserInfo?.is_authorize_phone)&&
@@ -202,6 +230,7 @@ export default (props:Params) => {
setShowCart(false)}/>
setShowPreview(false)}/>
+
)
diff --git a/src/pages/editOrder/index.tsx b/src/pages/editOrder/index.tsx
index 627165c..1ce0acf 100644
--- a/src/pages/editOrder/index.tsx
+++ b/src/pages/editOrder/index.tsx
@@ -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(params)
diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx
index eafe883..9aea20a 100644
--- a/src/pages/index/index.tsx
+++ b/src/pages/index/index.tsx
@@ -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 (
setShowShopCart(!showShopCart)}>
diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx
index 52371dc..586b157 100644
--- a/src/pages/order/comfirm.tsx
+++ b/src/pages/order/comfirm.tsx
@@ -5,16 +5,16 @@ import { View } from "@tarojs/components"
import Taro, { useDidShow, usePullDownRefresh} from "@tarojs/taro";
import classnames from "classnames";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import AddressInfo from "./components/addressInfo";
import KindList from "./components/kindList";
import Remark from "./components/remark";
import styles from './comfirm.module.scss'
import { getParam } from "@/common/system";
-import useLogin from "@/use/useLogin";
import { alert, goLink } from "@/common/common";
-import ShipmentMode from "../editOrder/components/shipmentMode";
import SubmitOrderBtn from "./components/submitOrderBtn";
import AddressInfoDetail from "./components/addressInfoDetail";
+import { SubscriptionMessageApi } from "@/api/user";
+import { SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
+import { UseSubscriptionMessage } from "@/use/useCommonData";
export default () => {
@@ -89,7 +89,9 @@ import AddressInfoDetail from "./components/addressInfoDetail";
id: address?.id,
name: address?.name,
phone: address?.phone,
- shipment_mode: address?.shipment_mode
+ shipment_mode: address?.shipment_mode,
+ take_goods_address: address?.take_goods_address,
+ take_goods_phone: address?.take_goods_phone,
}
}, [preViewOrder])
@@ -132,9 +134,13 @@ import AddressInfoDetail from "./components/addressInfoDetail";
}
}, [formatPreViewOrder])
+ //订阅消息
+ const {SubmitOrder} = SUBSCRIPTION_MESSAGE_SCENE
+ const {openSubscriptionMessage} = UseSubscriptionMessage()
+
//提交订单
const {fetchData: saleOrderFetchData} = SaleOrderApi()
- const submitOrderEven = () => {
+ const submitOrderEven = async () => {
if(!submitOrderData?.shipment_mode) {
alert.error('请选择收货方式')
return false
@@ -143,28 +149,20 @@ import AddressInfoDetail from "./components/addressInfoDetail";
alert.error('请选择地址')
return false
}
-
- Taro.showModal({
- title: '确定提交?',
- success: async function (res) {
- if (res.confirm) {
- const res = await saleOrderFetchData(submitOrderData)
- if(res.success) {
- goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
- } else {
- alert.none(res.msg)
- }
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
+ await openSubscriptionMessage({scenes: SubmitOrder.value})
+ const res = await saleOrderFetchData(submitOrderData)
+ if(res.success) {
+ goLink('/pages/order/index',{id: res.data.id}, 'redirectTo')
+ } else {
+ alert.none(res.msg)
+ }
}
//页面下拉刷新
usePullDownRefresh(() => {
getSaleOrderPreView()
})
+
return (
diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx
index f7194be..8ec72ac 100644
--- a/src/pages/order/components/addressInfoDetail/index.tsx
+++ b/src/pages/order/components/addressInfoDetail/index.tsx
@@ -31,10 +31,26 @@ type Param = {
province_name: string,
city_name: string,
district_name: string,
- address_detail: string
+ address_detail: string,
+ take_goods_address: string,
+ take_goods_phone: string
}
}
+//订单状态
+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()
@@ -46,19 +62,12 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
}, [orderInfo])
- //地址格式
- const formatAddress = useMemo(() => {
- if(addressInfo?.province_name) {
- return addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail
- } else {
- return ''
- }
- }, [addressInfo])
+
//打开地址列表
const [showAddressList, setShowAddressList] = useState(false)
const changeShow = () => {
- if(receivingStatus == 2 && !logisticsShow)
+ if(receivingStatus == 2 && !logisticsShow && limitEdit())
setShowAddressList(() => true)
}
@@ -72,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
@@ -117,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
+ }
//根据订单状态判断是否显示物流
@@ -134,6 +148,15 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
return logisticsShowList.includes(orderInfo?.status as number)
}, [orderInfo])
+ //地址格式
+ const formatAddress = useMemo(() => {
+ if(receivingStatus == 2) {
+ return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:''
+ } else {
+ return addressInfo?.take_goods_address
+ }
+ }, [addressInfo, receivingStatus])
+
return (
changeShow()}>
@@ -144,8 +167,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
{(receivingStatus == 2 && !logisticsShow)&&}
- {addressInfo?.name}
- {addressInfo?.phone}
+ {receivingStatus == 1?'管理员':addressInfo?.name}
+ {receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.phone}
{!logisticsShow&&
diff --git a/src/pages/order/components/applyRefund/index.tsx b/src/pages/order/components/applyRefund/index.tsx
index 3f6311e..b64db9d 100644
--- a/src/pages/order/components/applyRefund/index.tsx
+++ b/src/pages/order/components/applyRefund/index.tsx
@@ -5,7 +5,7 @@ import { memo, useCallback, useEffect, useRef, useState } from "react";
import ReasonPopup from "../reasonPopup";
import styles from './index.module.scss'
import classnames from "classnames";
-import { ApplyRefundApi } from "@/api/salesAfterOrder";
+import { ApplyRefundApi, RefundExplainApi } from "@/api/salesAfterOrder";
import { alert } from "@/common/common";
type Param = {
@@ -17,21 +17,24 @@ export default memo(({show, onClose, orderId}:Param) => {
//提交的数据
const submitData = useRef({
- return_explain: 1,
+ return_explain: 0,
sale_order_id: 0,
reason_describe: ''
})
useEffect(() => {
- if(orderId)
+ if(orderId) {
submitData.current.sale_order_id = orderId
+ refundExplain()
+ }
+
}, [orderId])
//申请退款
const {fetchData} = ApplyRefundApi()
const getApplyRefund = async () => {
- let res = await fetchData(submitData.current)
if(!submitData.current.return_explain) return alert.error('请选择说明原因')
+ let res = await fetchData(submitData.current)
if(res.success) {
alert.error('申请成功')
} else {
@@ -42,6 +45,17 @@ export default memo(({show, onClose, orderId}:Param) => {
//获取说明数据
const [list, setList] = useState([])
+ const {fetchData: refundExplainFetchdata} = RefundExplainApi()
+ const refundExplain = async () => {
+ let res = await refundExplainFetchdata()
+ setList(res.data.list)
+ }
+ const [reason, setReason] = useState({id:0, name:''})
+ const reasonSelect = useCallback((e) => {
+ setReason({...reason, name:e.name, id:e.id})
+ submitData.current.return_explain = e.id
+ closeReason()
+ }, [])
//备注
@@ -71,8 +85,6 @@ export default memo(({show, onClose, orderId}:Param) => {
}
}
-
-
return (
<>
@@ -80,7 +92,7 @@ export default memo(({show, onClose, orderId}:Param) => {
退款说明
setShowReason(true)}>
- 请选择
+ {reason.name||'请选择'}
@@ -93,7 +105,7 @@ export default memo(({show, onClose, orderId}:Param) => {
-
+
>
)
})
\ No newline at end of file
diff --git a/src/pages/order/components/kindList/index.module.scss b/src/pages/order/components/kindList/index.module.scss
index 64b65b8..052a8b5 100644
--- a/src/pages/order/components/kindList/index.module.scss
+++ b/src/pages/order/components/kindList/index.module.scss
@@ -90,7 +90,6 @@
.order_list_item_count{
display: flex;
flex-direction: column;
- justify-content: center;
align-items: flex-end;
.count_num{
color: $color_main;
diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx
index ce8e4b6..fc32cc1 100644
--- a/src/pages/order/components/kindList/index.tsx
+++ b/src/pages/order/components/kindList/index.tsx
@@ -167,13 +167,13 @@ export default memo(({order, comfirm = false}:Param) => {
{colorItem.code + ' ' + colorItem.name}
- {colorItem?.return_roll&&{`已退${colorItem?.return_roll}条`}}
+ {(colorItem?.return_roll > 0)&&{`已退${colorItem?.return_roll}条`}}
+ {(colorItem?.apply_return_roll > 0)&&{`待退${colorItem?.apply_return_roll}条`}}
¥{standardPrice(colorItem.sale_price)}
{aboutWeight(colorItem.estimate_weight)}
-
×{formatCount(colorItem)}{order.unit}
diff --git a/src/pages/order/components/payment/index.module.scss b/src/pages/order/components/payment/index.module.scss
index ade0ca3..f2828c7 100644
--- a/src/pages/order/components/payment/index.module.scss
+++ b/src/pages/order/components/payment/index.module.scss
@@ -27,6 +27,13 @@ $top:190px;
text-align: center;
padding: 25px 0;
}
+ .playMode{
+ width: 100%;
+ padding-bottom: 20px;
+ font-size: 26px;
+ text-align: center;
+ color: #707070;
+ }
.payment_list{
background-color: #fff;
@@ -44,7 +51,7 @@ $top:190px;
position: absolute;
border-bottom: 3px dashed #ccc;
top: $top;
- width: calc(100% - 100px);
+ width: calc(100% - 50px);
left:0;
right: 0;
margin: auto;
diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx
index 7476080..acb049f 100644
--- a/src/pages/order/components/payment/index.tsx
+++ b/src/pages/order/components/payment/index.tsx
@@ -11,7 +11,8 @@ import ScanPay from "../scanPay";
import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay";
import { formatPriceDiv } from "@/common/fotmat";
import {alert} from "@/common/common"
-import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum";
+import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
+import { UseSubscriptionMessage } from "@/use/useCommonData";
type Param = {
show?: true|false,
@@ -21,11 +22,13 @@ type Param = {
}
type OrderInfo = {
+ id?: number, //销售单id
should_collect_order_id?: number, //应付单id
pre_collect_order_id?: number, //预付单id
status?: number, //订单状态
payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式
- sale_mode?: number //订单类型 0:大货 1剪板 2散剪
+ sale_mode?: number, //订单类型 0:大货 1剪板 2散剪
+ [val: string]: any
}
type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款
@@ -88,28 +91,36 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
const periodSelectData = (val) => {
setSubmitData((e) => ({...e, payment_method:val}))
}
+
+ //订阅消息
+ const {ToPay} = SUBSCRIPTION_MESSAGE_SCENE
+ const {openSubscriptionMessage} = UseSubscriptionMessage()
//提交支付
const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交
const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交
const submitPay = async () => {
- if(submitData.payment_method === null) {
- alert.error('请选择支付方式')
- return false
- }
- alert.loading('正在支付')
- let res:any = null
- if(orderInfo?.should_collect_order_id) {
- res = await submitFetchData(submitData)
- } else {
- res = await submitPrepayOrderFetchData(submitData)
- }
- if(res.success) {
- alert.success('支付成功')
- onSubmitSuccess?.()
- } else {
- alert.none(res.msg)
- }
+ if(submitData.payment_method === null) {
+ alert.error('请选择支付方式')
+ return false
+ }
+ //账期支付,或预付款并且不是剪板才会订阅
+ if((submitData.payment_method == PaymentMethodAccountPeriod.value || orderInfo?.status == SaleorderstatusWaitingPrePayment.value)&& orderInfo?.sale_mode != 1) {
+ await openSubscriptionMessage({orderId: orderInfo?.id, scenes: ToPay.value})
+ }
+ alert.loading('正在支付')
+ let res:any = null
+ if(orderInfo?.should_collect_order_id) {
+ res = await submitFetchData(submitData)
+ } else {
+ res = await submitPrepayOrderFetchData(submitData)
+ }
+ if(res.success) {
+ alert.success('支付成功')
+ onSubmitSuccess?.()
+ } else {
+ alert.none(res.msg)
+ }
}
//预付款
@@ -122,7 +133,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
//是否显示七天账期
const show_account_payment = useMemo(() => {
- console.log('orderInfo?.status::123',orderInfo)
//剪板合散剪不显示
if(orderInfo?.sale_mode != 0) return false
//支付方式是账期支付,不显示
@@ -146,15 +156,22 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
const changeSelect = () => {
}
+ //在线支付所需数据
+ const onlinePayData = useMemo(() => {
+ return {...orderInfo, offline_remittance_information: payInfo?.offline_remittance_information}
+
+ }, [orderInfo, payInfo])
+
return (
- 订单支付
+ 待支付款项
+ {(payInfo?.delivery_payment_name)&&已使用{payInfo?.delivery_payment_name}方式付款}
@@ -215,7 +232,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
setofflinePayShow(false)} offlineInfo={payInfo?.offline_remittance_information}/>
- setScanPayShow(false)}/>
+ setScanPayShow(false)} />
)
diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx
index d6fb06e..4b78bcf 100644
--- a/src/pages/order/components/scanPay/index.tsx
+++ b/src/pages/order/components/scanPay/index.tsx
@@ -5,7 +5,7 @@ import styles from './index.module.scss'
import Popup from "@/components/popup";
import Taro from "@tarojs/taro";
import { alert } from "@/common/common";
-import { formatImgUrl } from "@/common/fotmat";
+import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from "@/common/fotmat";
import useCheckAuthorize from "@/use/useCheckAuthorize";
import { GetPayCode } from "@/api/onlinePay";
import LoadingCard from "@/components/loadingCard";
@@ -13,45 +13,91 @@ import LoadingCard from "@/components/loadingCard";
type Param = {
show?: true|false,
- onClose?: () => void
+ onClose?: () => void,
+ company?: string,
+ qrcode?: string,
+ orderInfo?: any,
+
}
-
-
-type Item = {
+type ListParam = {
product_code: string,
product_name: string,
product_color_code: string,
product_color_name: string,
num: string,
weight: string,
+ length: string,
sale_price: string,
total_price: string
}
-type CodeParam = {
- title: string,
- company: string,
- order_type: string,
- sale_user: string,
- order_created_time: string,
- order_no: string,
- department: string,
- shipment_mode: string,
- target_user_name: string,
- target_address: string,
- target_description: string,
- pay_account: string,
- bank_account_name: string,
- bank_name: string,
- pay_type: string,
- client: string,
- phone: string,
- order_total_length: string,
- order_total_price: string,
- qrcode: string,
- order_total_weight: string,
- list: Item[]
-}
-export default memo(({show = true, onClose}:Param) => {
+export default memo(({show = true, onClose, company, orderInfo}:Param) => {
+ const [detail, setDetail] = useState()
+
+ useEffect(() => {
+ if(orderInfo) {
+ console.log('orderInfo::',orderInfo)
+ let lists:ListParam[] = []
+ orderInfo.product_list?.map(pitem => {
+ pitem?.product_colors?.map(citem => {
+ lists.push({
+ product_code: formatHashTag(pitem.code, '', 'name')!,
+ product_name: pitem.name,
+ product_color_code: formatHashTag(citem.code)!,
+ product_color_name: citem.name,
+ num: citem.roll.toString(),
+ length: (citem.length/100).toString(),
+ weight: formatWeightDiv(citem.estimate_weight).toString(),
+ sale_price: formatPriceDiv(citem.sale_price).toString(),
+ total_price: formatPriceDiv(citem.estimate_amount).toString(),
+ })
+ })
+ })
+ setDetail(() => ({
+ title: "面料销售电子确认单",
+ company: orderInfo.company_name, //后端公司
+ order_type: orderInfo.sale_mode_name, //类型:大货
+ sale_user: orderInfo.sale_user_name, //业务员
+ order_created_time: formatDateTime(orderInfo.create_time),
+ order_no: orderInfo.order_no,
+ shipment_mode: orderInfo.shipment_mode_name, //发货方式
+ target_user_name: userName(orderInfo), //收件人
+ target_address: address(orderInfo), //收货地址
+ target_description: orderInfo.remark, //发货备注
+ pay_account: orderInfo.offline_remittance_information?.transfer_remittance_account, //专属收款账号
+ bank_account_name: orderInfo.offline_remittance_information?.account_name, //账户名称
+ bank_name: orderInfo.offline_remittance_information?.bank_of_deposit, //开户银行
+ pay_type:"", //支付方式, 可不传
+ client: orderInfo.purchaser_name, //客户名称
+ phone: userPhone(orderInfo), //收货手机号码
+ order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度
+ order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格
+ order_total_num: (orderInfo.total_number) + '',
+ qrcode:"", //跳转链接
+ order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量
+ list: lists
+ }))
+ }
+ }, [orderInfo])
+
+ //收货地址
+ const address = (addressInfo) => {
+ if(addressInfo?.shipment_mode == 2) {
+ return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:''
+ } else {
+ return addressInfo?.take_goods_address
+ }
+ }
+
+ //收件人
+ const userName = (addressInfo) => {
+ return addressInfo?.shipment_mode == 2? orderInfo.target_user_name: ''
+ }
+
+ //手机号
+ const userPhone = (addressInfo) => {
+ return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone
+ }
+
//获取支付二维码
const [payCodeImage, setPayCodeImage] = useState('')
@@ -61,30 +107,7 @@ export default memo(({show = true, onClose}:Param) => {
})
const {fetchData, state} = GetPayCode()
const getCore = async () => {
- let res = await fetchData({
- title: "面料销售电子确认单",
- company: "什么什么公司123",
- order_type: "散剪",
- sale_user: "小崔",
- order_created_time:"2022/02/01 12:32:13",
- order_no:"XS-211005888",
- department:"嘻嘻嘻",
- shipment_mode:"自提",
- target_user_name:"大崔",
- target_address:"阿斯顿发斯蒂芬",
- target_description:"无",
- pay_account:"1234567890123450001",
- bank_account_name:"佛山市浩川长盛科技有限公司",
- bank_name:"招商银行佛山分行禅城支行",
- pay_type:"现结",
- client:"客户名称",
- phone:"15818085802",
- order_total_length:"12",
- order_total_price:"63000",
- qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888",
- order_total_weight:"300.00",
- list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}]
- })
+ let res = await fetchData(detail)
const base64 = res.data.base64
setPayCodeImage(() => base64)
const time = new Date().valueOf()
@@ -98,7 +121,6 @@ export default memo(({show = true, onClose}:Param) => {
data: fileData.current.base64,
encoding: 'base64',
})
-
}
useEffect(() => {
if(show)
diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx
index 022c164..1af69a7 100644
--- a/src/pages/order/index.tsx
+++ b/src/pages/order/index.tsx
@@ -5,13 +5,15 @@ import {
} from "@/api/order";
import { GetOrderPayApi } from "@/api/orderPay";
import { AddShoppingCartApi } from "@/api/shopCart";
+import { SubscriptionMessageApi } from "@/api/user";
import { alert, goLink } from "@/common/common";
-import { ORDER_STATUS } from "@/common/enum";
+import { ORDER_STATUS, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum";
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
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";
@@ -27,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(router.params.id))
@@ -34,7 +37,20 @@ import styles from './index.module.scss'
getSaleOrderPreView()
})
+ //订单状态枚举
+ const {
+ SaleOrderStatusTaking,
+ SaleOrderStatusWaitingDelivery,
+ SaleOrderStatusWaitingReceipt, // 待收货
+ SaleOrderStatusAlreadyReceipt, // 已收货
+ SaleOrderStatusComplete, // 已完成
+ SaleOrderStatusRefund, // 已退款
+ SaleOrderStatusCancel, // 已取消
+ SaleorderstatusWaitingPrePayment, // 预付款
+ } = ORDER_STATUS
+
//获取订单详情
+ const firstOpen = useRef(true)
const [orderDetail, setOrderDetail] = useState() //获取到的原始数据
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
const getSaleOrderPreView = async () => {
@@ -42,6 +58,10 @@ import styles from './index.module.scss'
let res = await getOrderFetchData({id: orderId.current})
setOrderDetail(res.data)
setOrderRemark(res.data.remark)
+ if(firstOpen.current) {
+ firstOpen.current = false
+ toPay()
+ }
}
Taro.stopPullDownRefresh()
Taro.hideToast()
@@ -103,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])
@@ -122,6 +144,19 @@ import styles from './index.module.scss'
}
setShowDesc(() => false)
}, [])
+ const noCanOpenDescList = useRef([
+ SaleOrderStatusTaking.value, //提货中
+ SaleOrderStatusWaitingDelivery.value, //待发货
+ SaleOrderStatusWaitingReceipt.value, // 待收货
+ SaleOrderStatusAlreadyReceipt.value, // 已收货
+ SaleOrderStatusComplete.value, // 已完成
+ SaleOrderStatusRefund.value, // 已退款
+ SaleOrderStatusCancel.value, // 已取消
+ ])
+ const descOpen = () => {
+ if(noCanOpenDescList.current.includes(orderDetail?.status)) return alert.none('该订单状态不能修改备注')
+ setShowDesc(() => true)
+ }
//去付款
const [payMentShow, setPayMentShow] = useState(false)
@@ -144,7 +179,6 @@ import styles from './index.module.scss'
//获取底部按钮点击, 获取按钮状态
const orderStateClick = useCallback((val) => {
- console.log('123456789',val)
if(val == 1 || val == 6) {
//取消订单
getSaleOrderPreView()
@@ -191,8 +225,7 @@ import styles from './index.module.scss'
}
}, [orderDetail])
- //订单状态枚举
- const {SaleOrderStatusCancel, SaleorderstatusWaitingPrePayment} = ORDER_STATUS
+
//刷新页面
const refresh = useCallback(() => {
@@ -268,11 +301,11 @@ import styles from './index.module.scss'
{formatDateTime(orderDetail?.create_time)}
-
- {formatDateTime(orderDetail?.create_time)}
-
+ {(orderDetail?.payment_time)&&
+ {formatDateTime(orderDetail?.payment_time)}
+ }
- setShowDesc(true)}>
+
订单备注
{
orderRemark&&{orderDetail?.remark}||
diff --git a/src/pages/orderList/components/order/index.module.scss b/src/pages/orderList/components/order/index.module.scss
index d63a621..edbaba9 100644
--- a/src/pages/orderList/components/order/index.module.scss
+++ b/src/pages/orderList/components/order/index.module.scss
@@ -9,38 +9,46 @@
.user{
display: flex;
align-items: center;
- .name {
- color: #000;
- font-weight: 700;
- margin-left: 15px;
- font-size: $font_size;
- }
+
image{
width: 70px;
height: 70px;
border-radius: 50%;
}
}
- .order_num {
- flex: 1;
- font-size: $font_size_medium;
- color: $color_font_one;
- text-align: right;
- padding-right: 30px;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .miconfont {
- font-size: 20px;
+ .order_con {
+ padding-left: 15px;
+ width: 100%;
+ .name {
+ color: #000;
+ font-weight: 700;
+ font-size: $font_size;
+ }
+ .order_num {
+ font-size: $font_size_medium;
+ padding-right: 30px;
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+ width: 100%;
+ .order_num_con{
+ flex:1;
+ }
+ .miconfont {
+ font-size: 20px;
+ }
+ .order_no{
+
+ }
+
}
}
- .tag{
- font-size: $font_size_min;
- padding: 5px 15px;
- background-color: $color_main;
- color: #fff;
- border-radius: 0px 20px 0px 20px;
+ .product_status{
+ font-size: $font_size;
+ color: $color_main;
+ font-weight: 700;
}
+
}
.product_con{
margin-bottom: 20px;
@@ -63,9 +71,15 @@
padding: 0 20px;
@include common_ellipsis()
}
- .product_status{
- font-size: $font_size;
- color: $color_main;
+
+ .tag{
+ font-size: $font_size_min;
+ padding: 5px 15px;
+ background-color: $color_main;
+ color: #fff;
+ border-radius: 0px 20px 0px 20px;
+ position:relative;
+ right: 0;
}
}
.product_list{
diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx
index 5dbb13c..960f734 100644
--- a/src/pages/orderList/components/order/index.tsx
+++ b/src/pages/orderList/components/order/index.tsx
@@ -5,6 +5,7 @@ import OrderBtns from "@/components/orderBtns";
import Payment from "@/pages/order/components/payment";
import { useSelector } from "@/reducers/hooks";
import { Image, Text, View } from "@tarojs/components"
+import { useRouter } from "@tarojs/taro";
import classnames from "classnames";
import { memo, useCallback, useMemo, useRef, useState } from "react";
import styles from './index.module.scss'
@@ -29,10 +30,12 @@ type Param = {
actual_amount: number, //实付金额
wait_pay_amount: number, //待付金额
should_collect_order_id: number, //应付单id
+ av_return_roll: number
},
onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void
}
export default memo(({value, onClickBtn}: Param) => {
+
const userInfo = useSelector(state => state.userInfo)
//对应数量
const formatCount = useCallback((item, sale_mode) => {
@@ -56,6 +59,7 @@ export default memo(({value, onClickBtn}: Param) => {
actual_amount: value?.actual_amount, //实付金额
wait_pay_amount: value?.wait_pay_amount, //待付金额
sale_mode: value?.sale_mode, //订单类型
+ av_return_roll: value?.av_return_roll //可退条数
}
}, [value])
@@ -68,20 +72,26 @@ export default memo(({value, onClickBtn}: Param) => {
goLink('/pages/order/index', {id: value?.id})}>
-
- {userInfo?.adminUserInfo?.user_name}
+
-
- 订单号:{value?.order_no}
-
+
+ {userInfo?.adminUserInfo?.user_name}
+
+
+ 订单号:{value?.order_no}
+
+
+ {value?.status_name}
+
- {value?.shipment_mode_name}
+
+
goLink('/pages/order/index', {id: value?.id})}>
{value?.sale_mode_name}
{formatHashTag(value?.product_list[0].code, value?.product_list[0].name)}
- {value?.status_name}
+ {value?.shipment_mode_name}
diff --git a/src/pages/orderList/components/orderStatusList/index.tsx b/src/pages/orderList/components/orderStatusList/index.tsx
index 3e12f6f..1257330 100644
--- a/src/pages/orderList/components/orderStatusList/index.tsx
+++ b/src/pages/orderList/components/orderStatusList/index.tsx
@@ -15,8 +15,8 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => {
})
useEffect(() => {
if(defaultId) {
+ console.log('defaultId:::', defaultId)
const index = list?.findIndex(item => {
- console.log(item.id, defaultId)
return item.id == defaultId
})
if(index !== -1) {
@@ -24,6 +24,7 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => {
setSelectInfo((e) => ({...e, tabId:list[num].id.toString()}))
}
}
+ setSelectInfo((e) => ({...e, selected: defaultId||-1}))
}, [defaultId])
const clickEvent = ({item, index}: {item:any, index:number}) => {
const num = index > 0?( index - 1) : 0
diff --git a/src/pages/orderList/index copy.tsx b/src/pages/orderList/index copy.tsx
new file mode 100644
index 0000000..66d344b
--- /dev/null
+++ b/src/pages/orderList/index copy.tsx
@@ -0,0 +1,194 @@
+import Search from "@/components/search"
+import useLogin from "@/use/useLogin"
+import { Image, ScrollView, Text, View } from "@tarojs/components"
+import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"
+import { useCallback, useEffect, useMemo, useRef, useState } from "react"
+import styles from './index.module.scss'
+import classnames from "classnames";
+import Order from "./components/order"
+import InfiniteScroll from "@/components/infiniteScroll"
+import {GetOrderStatusListApi, GetOrderListApi, OrderStatusListApi} from '@/api/order'
+import { dataLoadingStatus, getFilterData } from "@/common/util"
+import OrderStatusList from "./components/orderStatusList"
+import Payment from "../order/components/payment"
+import { ORDER_STATUS } from "@/common/enum"
+import { AddShoppingCartApi } from "@/api/shopCart"
+import ShopCart from "@/components/shopCart"
+import ApplyRefund from "./components/applyRefund"
+import { alert } from "@/common/common"
+
+export default () => {
+ const {checkLogin} = useLogin()
+ useDidShow(async () => {
+ await checkLogin()
+ })
+
+ //搜索参数
+ const [searchField, setSearchField] = useState({
+ status: -1,
+ page : 1,
+ size : 10,
+ Name:''
+ })
+
+ //获取订单状态
+ const {fetchData: orderStatusListFetchData} = OrderStatusListApi()
+ const [statusList, setStatusList] = useState([{id: -1, name: '全部'}])
+ const getOrderStatusList = () => {
+ const status = Object.values(ORDER_STATUS).map(item => {
+ return {id: item.value, name: item.label}
+ })
+ setStatusList((e) => [...e, ...status])
+ }
+ useEffect(() => {
+ getOrderStatusList()
+ }, [])
+
+ //获取订单列表
+ const {fetchData: listFetchData, state:orderState} = GetOrderListApi()
+ const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0})
+ const getOrderList = async () => {
+ let res = await listFetchData(getFilterData(searchField))
+ setOrderData({list: res.data.list, total: res.data.total})
+ setRefresherTriggeredStatus(() => false)
+ }
+
+
+ //监听筛选条件变化
+ useEffect(() => {
+ getOrderList()
+ }, [searchField])
+
+ //上拉加载数据
+ const pageNum = useRef({size: searchField.size, page: searchField.page})
+ const getScrolltolower = useCallback(() => {
+ if(orderData.list.length < orderData.total) {
+ pageNum.current.page++
+ const size = pageNum.current.size * pageNum.current.page
+ setSearchField({...searchField, size })
+ }
+ }, [orderData])
+
+ //状态改变
+ const changeStatus = useCallback((e) => {
+ pageNum.current.page = 1
+ setSearchField((value) => ({...value, status:e, size:10}))
+ setOrderData(() => ({list:[], total:0}))
+ }, [])
+
+
+ //数据加载状态
+ const statusMore = useMemo(() => {
+ return dataLoadingStatus({list:orderData.list, total: orderData.total, status: orderState.loading})
+ }, [orderData, orderState])
+
+ //输入了搜索关键字
+ const getSearchData = useCallback((e) => {
+ pageNum.current.page = 1
+ setOrderData(() => ({list:[], total:0}))
+ setSearchField((val) => ({...val, name:e, size:10}))
+ }, [])
+
+
+ //列表下拉刷新
+ const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
+ const getRefresherRefresh = async () => {
+ pageNum.current.size = 1
+ setRefresherTriggeredStatus(true)
+ setSearchField((val) => ({...val, size:10}))
+ }
+
+ //监听点击的按钮
+ const clickOrderBtn = useCallback(({status, orderInfo}) => {
+ setCallBackPayOrderInfo(() => orderInfo)
+ if(status == 1 || status == 6) {
+ getOrderList()
+ } else if(status == 2) {
+ //去支付
+ toPay()
+ } else if (status == 3) {
+ //申请退款
+ if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款')
+ setRefundShow(true)
+ } else if (status == 7) {
+ //购买
+ addShopCart(orderInfo)
+ }
+ }, [orderData])
+
+
+ const [callBackOrderInfo, setCallBackPayOrderInfo] = useState()
+
+ //去付款
+ const [payMentShow, setPayMentShow] = useState(false)
+ const toPay = () => {
+ setPayMentShow(true)
+ }
+ //关闭支付弹窗
+ const closePayShow = useCallback(() => {
+ setPayMentShow(() => false)
+ }, [])
+ //支付成功
+ const onPaySuccess = useCallback(() => {
+ getOrderList()
+ closePayShow()
+ }, [])
+
+ //添加购物车
+ const [showCart, setShowCart] = useState(false)
+ const {fetchData:addFetchData} = AddShoppingCartApi()
+ const addShopCart = async (item) => {
+ let color_list:{product_color_id: number, roll?: number, length?: number}[] = []
+ item?.product_list.map(pitem => {
+ pitem?.product_colors.map(citem => {
+ if(item?.sale_mode == 0) {
+ return color_list.push({product_color_id: citem.id, roll: citem.roll})
+ } else {
+ return color_list.push({product_color_id: citem.id, length: citem.length})
+ }
+ })
+ })
+ const state = await addFetchData({
+ sale_mode: item?.sale_mode,
+ color_list
+ })
+ if(state.success) {
+ Taro.showToast({
+ title:'已加入购物车'
+ })
+ setShowCart(true)
+ } else {
+ Taro.showToast({
+ icon:'none',
+ title: state.msg
+ })
+ }
+
+ }
+
+ //申请退款
+ const [refundShow, setRefundShow] = useState(false)
+ const applyRefundClose = useCallback(() => {
+ setRefundShow(false)
+ }, [])
+
+
+ return (
+
+
+
+
+
+
+
+ {orderData?.list.map(item => {
+ return
+ })}
+
+
+
+ setShowCart(false)}/>
+
+
+ )
+}
diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx
index fa55e30..42adcc6 100644
--- a/src/pages/orderList/index.tsx
+++ b/src/pages/orderList/index.tsx
@@ -1,21 +1,20 @@
import Search from "@/components/search"
import useLogin from "@/use/useLogin"
-import { Image, ScrollView, Text, View } from "@tarojs/components"
-import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"
+import {View } from "@tarojs/components"
+import Taro, { useDidShow,} from "@tarojs/taro"
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
import styles from './index.module.scss'
-import classnames from "classnames";
import Order from "./components/order"
import InfiniteScroll from "@/components/infiniteScroll"
-import {GetOrderStatusListApi, GetOrderListApi} from '@/api/order'
+import { GetOrderListApi, OrderStatusListApi} from '@/api/order'
import { dataLoadingStatus, getFilterData } from "@/common/util"
import OrderStatusList from "./components/orderStatusList"
import Payment from "../order/components/payment"
-import { ORDER_STATUS } from "@/common/enum"
import { AddShoppingCartApi } from "@/api/shopCart"
import ShopCart from "@/components/shopCart"
import ApplyRefund from "./components/applyRefund"
import { alert } from "@/common/common"
+import { useRouter } from "@tarojs/runtime"
export default () => {
const {checkLogin} = useLogin()
@@ -23,22 +22,30 @@ export default () => {
await checkLogin()
})
+ //传递过来的参数
+ const router = useRouter()
+ useEffect(() => {
+ if(router?.params.status != undefined && router?.params.status !== '') {
+ setSearchField((e) => ({...e, status: router?.params.status as number}))
+ } else {
+ setSearchField((e) => ({...e, status:-1}))
+ }
+ }, [router])
+
//搜索参数
- const [searchField, setSearchField] = useState({
- status: -1,
+ const [searchField, setSearchField] = useState<{status: number|null, page: number, size: number, name: string}>({
+ status: null,
page : 1,
size : 10,
- Name:''
+ name:''
})
//获取订单状态
- // const {fetchData: statusFetchData} = GetOrderStatusListApi()
+ const {fetchData: orderStatusListFetchData} = OrderStatusListApi()
const [statusList, setStatusList] = useState([{id: -1, name: '全部'}])
- const getOrderStatusList = () => {
- const status = Object.values(ORDER_STATUS).map(item => {
- return {id: item.value, name: item.label}
- })
- setStatusList((e) => [...e, ...status])
+ const getOrderStatusList = async () => {
+ let res = await orderStatusListFetchData()
+ setStatusList((e) => [...e, ...res.data.list])
}
useEffect(() => {
getOrderStatusList()
@@ -49,14 +56,13 @@ export default () => {
const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0})
const getOrderList = async () => {
let res = await listFetchData(getFilterData(searchField))
- setOrderData({list: res.data.list, total: res.data.total})
+ setOrderData((e) => ({...e, list: res.data.list, total: res.data.total}))
setRefresherTriggeredStatus(() => false)
}
-
//监听筛选条件变化
useEffect(() => {
- getOrderList()
+ if(searchField.status != null) getOrderList()
}, [searchField])
//上拉加载数据
@@ -177,7 +183,7 @@ export default () => {
-
+
diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss
index 82159da..907e73f 100644
--- a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss
+++ b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss
@@ -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;
diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx
index db4d5f3..d219d4d 100644
--- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx
+++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx
@@ -7,8 +7,8 @@ import styles from './index.module.scss'
type Param = {
return_address?:string,
return_phone?: string,
- onLogistics?: (val: number) => void,
- stage?: number
+ onLogistics?: (val: 1|2) => void, //1 上传物流 2 查看物流
+ stage?: number,
}
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
const {
@@ -30,12 +30,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
//上传物流
const upLogistics = useMemo(() => {
return stage == ReturnStageWaitCheck.value
- }, [stage])
-
- //查看物流
- const showLogistics = useMemo(() => {
- return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value)
- }, [stage])
+ }, [stage])
return (
@@ -56,8 +51,8 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
{return_phone}
{upLogistics&& onLogistics?.(1)}>
上传物流
- }
- {showLogistics&& onLogistics?.(2)}>
+
+ || onLogistics?.(2)}>
查看物流
}
diff --git a/src/pages/salesAfter/components/applyRecord/index.module.scss b/src/pages/salesAfter/components/applyRecord/index.module.scss
index ad1916d..b9603f6 100644
--- a/src/pages/salesAfter/components/applyRecord/index.module.scss
+++ b/src/pages/salesAfter/components/applyRecord/index.module.scss
@@ -89,6 +89,11 @@
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
+ text{
+ &:nth-child(1) {
+ margin-right: 10px;
+ }
+ }
}
}
.order_list_item_count{
diff --git a/src/pages/salesAfter/components/applyRecord/index.tsx b/src/pages/salesAfter/components/applyRecord/index.tsx
index 2d48da6..d631ac3 100644
--- a/src/pages/salesAfter/components/applyRecord/index.tsx
+++ b/src/pages/salesAfter/components/applyRecord/index.tsx
@@ -98,7 +98,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => {
{colorItem.code + ' ' + colorItem.name}
- ¥{standardPrice(colorItem.sale_price)}
+
+ ¥{standardPrice(colorItem.sale_price)}
+ 总重{standardPrice(colorItem.estimate_weight)}
+
×{formatCount(colorItem)}{formatDetailOrder.unit}
diff --git a/src/pages/salesAfter/components/cutlKindList/index.module.scss b/src/pages/salesAfter/components/cutlKindList/index.module.scss
new file mode 100644
index 0000000..e713a98
--- /dev/null
+++ b/src/pages/salesAfter/components/cutlKindList/index.module.scss
@@ -0,0 +1,131 @@
+
+.kindsList_main{
+ margin-top: 20px;
+}
+.orders_list_con{
+
+ background-color: #fff;
+ border-radius: 20px;
+ padding: 20px;
+ .orders_return_title{
+ font-size: 28px;
+ font-weight: 700;
+ padding-bottom: 20px;
+ }
+ .order_list{
+ &:nth-child(n+2) {
+ margin-top: 30px;
+ }
+ .order_list_title{
+ display: flex;
+ align-items: center;
+ .tag{
+ font-size: $font_size_min;
+ background-color: #CDE5FF;
+ padding: 5px 10px;
+ border-radius: 6px;
+ color: $color_main;
+ }
+ .title{
+ font-weight: 700;
+ font-size: $font_size;
+ margin-left: 20px;
+ flex:1;
+ }
+ .num{
+ color: $color_font_two;
+ font-size: $font_size_min;
+ }
+ }
+ }
+ .order_list_scroll{
+ margin-top: 30px;
+
+ .order_list_item {
+ display: flex;
+ &:nth-child(2) {
+ margin-top: 30px;
+ }
+ .order_list_item_img{
+ width: 126px;
+ height: 126px;
+ border-radius: 20px;
+ }
+ .order_list_item_con{
+ display: flex;
+ width: 100%;
+ flex:1;
+ border-bottom: 1px solid #f0f0f0;
+ height: 150px;
+ padding-top: 20px;
+ box-sizing: border-box;
+ }
+ .order_list_item_des{
+ flex:1;
+ box-sizing: border-box;
+ padding-left: 30px;
+ .order_list_item_title{
+ font-weight: 700;
+ font-size: $font_size;
+ margin-bottom: 15px;
+ }
+ .order_list_item_price{
+ font-size: 26px;
+ color: $color_font_three;
+ text{
+ &:nth-child(n+1) {
+ margin-right: 20px;
+ }
+ }
+ }
+ }
+ .order_list_item_count{
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-end;
+ .count_num{
+ color: $color_main;
+ font-size: $font_size;
+ margin-bottom: 15px;
+ font-weight: 400;
+ text{
+ font-size: $font_size_min;
+ }
+ }
+ .count_price {
+ font-size: $font_size;
+ font-weight: 700;
+ text{
+ font-size: $font_size_min;
+ }
+ }
+ }
+ }
+ }
+ .order_total{
+ padding-top: 20px;
+ display: flex;
+ justify-content: space-between;
+ text{
+ &:nth-child(1) {
+ font-size: 28px;
+ font-weight: 700;
+ }
+ &:nth-child(2) {
+ font-size: 24px;
+ font-weight: 700;
+ }
+ }
+ }
+ .order_estimated_amount{
+ display: flex;
+ align-items: flex-end;
+ flex-direction: column;
+ padding: 30px 0;
+ .order_price_des{
+ font-size: $font_size_medium;
+ color: $color_font_two;
+ }
+ }
+}
diff --git a/src/pages/salesAfter/components/cutlKindList/index.tsx b/src/pages/salesAfter/components/cutlKindList/index.tsx
new file mode 100644
index 0000000..ca0caf5
--- /dev/null
+++ b/src/pages/salesAfter/components/cutlKindList/index.tsx
@@ -0,0 +1,192 @@
+import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
+import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
+import LabAndImg from "@/components/LabAndImg"
+import { Text, View } from "@tarojs/components"
+import { memo, useCallback, useMemo } from "react"
+import EstimatedAmount from "../estimatedAmount"
+import styles from './index.module.scss'
+
+type OrderParam = {
+ estimate_amount: number, //预估金额
+ list: any[],
+ sale_mode: number,
+ sale_mode_name: string,
+ unit: string,
+ total_colors: number,
+ total_fabrics: number,
+ total_number: number,
+ stage: number, //订单状态
+ type: 1|2, //1退货, 2退款
+ total_sale_price: number, //销售金额
+ total_should_collect_money: number, //应收金额
+ total_weight_error_discount: number, //空差优惠
+ the_previous_status: number, //取消订单时的订单状态
+ actual_amount: number //实付金额
+}
+
+type Param = {
+ order: OrderParam,
+ comfirm?: boolean //是否是确认订单页面使用
+}
+
+export default memo(({order, comfirm = false}:Param) => {
+ //对应数量
+ const formatCount = useCallback((item) => {
+ return order?.sale_mode == 0? item.roll : Number(item.length / 100)
+ }, [order])
+ //对应单价
+ const standardPrice = useCallback(price => {
+ return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
+ }, [order])
+
+ //数量格式
+ const numText = useMemo(() => {
+ if(order)
+ return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
+ }, [order])
+
+ //售后单状态枚举
+ const {
+ ReturnStageApplying, // 申请中
+ ReturnStageWaitCheck, // 退货中
+ ReturnStageChecked, // 待验布
+ ReturnStageReturned, // 已退款
+ ReturnStageCancel, // 已取消
+ ReturnStageQualityCheckPendingRefund, // 已验布
+ ReturnStageServiceOrderPendingRefund, // 待退款
+ ReturnStageRejected, // 已拒绝
+ } = AFTER_ORDER_STATUS
+
+
+ //金额列表枚举
+ const priceList = [
+ {
+ id:1,
+ value:[],
+ label:'退货条数',
+ field: ''
+ },
+ {
+ id:2,
+ value:[
+ ReturnStageServiceOrderPendingRefund.value,
+ ReturnStageReturned.value
+ ],
+ label:'扣款金额',
+ field: 'total_sale_price'
+ },
+ {
+ id:3,
+ value:[
+ ReturnStageServiceOrderPendingRefund.value,
+ ReturnStageReturned.value
+ ],
+ label:'其他扣款',
+ field: 'total_weight_error_discount'
+ },
+ {
+ id:4,
+ value:[
+ ReturnStageServiceOrderPendingRefund.value,
+ ReturnStageReturned.value
+ ],
+ label:'应退金额',
+ field: 'total_should_collect_money'
+ },
+ {
+ id:5,
+ value:[ReturnStageReturned.value],
+ label:'退款金额',
+ field: 'total_should_collect_money'
+ },
+ {
+ id:6,
+ value:[ReturnStageReturned.value],
+ label:'退款去向',
+ field: 'actual_amount'
+ },
+ {
+ id:7,
+ value:[ReturnStageQualityCheckPendingRefund.value],
+ label:'合计金额',
+ field: 'actual_amount'
+ },
+ ]
+
+ //是否显示价格
+ const showPrice = useCallback((priceInfo) => {
+ if(priceInfo.value == 8) {
+ //合计金额
+
+ }
+ return priceInfo.value.includes(order?.stage)
+ }, [order])
+
+ const priceConDom = useMemo(() => {
+ if(!order) return
+ return (
+ <>
+ {
+ priceList.map(item => {
+ return <>{showPrice(item)&&}>
+ })
+ }
+ >
+ )
+ }, [order])
+
+ //整理颜色
+ const labAndRgbAndUrl = useCallback((item) => {
+ return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
+ }, [])
+
+ //单价显示判断
+ const sale_price_show = useMemo(() => {
+ return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
+ }, [order])
+
+ return (
+
+
+ {order?.type == 1?'退货信息':'退款信息'}
+ {
+ order?.list?.map(item => {
+ return
+
+ {order.sale_mode_name}
+ {formatHashTag(item.code, item.name)}
+ 共{item?.product_colors?.length}种
+
+
+ {item?.product_colors?.map(colorItem => {
+ return
+
+
+
+
+
+ {colorItem.code + ' ' + colorItem.name}
+
+ {sale_price_show&&¥{standardPrice(colorItem.sale_price)}}
+ 总重{formatWeightDiv(colorItem.estimate_weight)}kg
+
+
+
+ ×{formatCount(colorItem)}{order.unit}
+ ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}
+
+
+
+ })}
+
+
+ })
+ }
+ 合计{numText}
+
+ {priceConDom}
+
+
+
+ )
+})
\ No newline at end of file
diff --git a/src/pages/salesAfter/components/kindList/index.module.scss b/src/pages/salesAfter/components/kindList/index.module.scss
index de1171e..e713a98 100644
--- a/src/pages/salesAfter/components/kindList/index.module.scss
+++ b/src/pages/salesAfter/components/kindList/index.module.scss
@@ -72,6 +72,11 @@
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
+ text{
+ &:nth-child(n+1) {
+ margin-right: 20px;
+ }
+ }
}
}
.order_list_item_count{
diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx
index 2cc8d3a..9e9ee6f 100644
--- a/src/pages/salesAfter/components/kindList/index.tsx
+++ b/src/pages/salesAfter/components/kindList/index.tsx
@@ -1,5 +1,5 @@
-import { ORDER_STATUS } from "@/common/enum"
-import { formatHashTag, formatPriceDiv } from "@/common/fotmat"
+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"
import { memo, useCallback, useMemo } from "react"
@@ -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, //空差优惠
@@ -45,68 +46,92 @@ export default memo(({order, comfirm = false}:Param) => {
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
}, [order])
- // const {
- // SaleOrderStatusBooking, // 待接单
- // SaleOrderStatusArranging, // 配布中
- // SaleOrderStatusArranged, // 已配布
- // SaleOrderStatusWaitingPayment, // 待付款
- // SaleOrderStatusWaitingDelivery, // 待发货
- // SaleOrderStatusWaitingReceipt, // 待收货
- // SaleOrderStatusAlreadyReceipt, // 已收货
- // SaleOrderStatusComplete, // 已完成
- // SaleOrderStatusRefund, // 已退款
- // SaleOrderStatusCancel, // 已取消
- // } = ORDER_STATUS
+ //售后单状态枚举
+ const {
+ ReturnStageApplying, // 申请中
+ ReturnStageWaitCheck, // 退货中
+ ReturnStageChecked, // 待验布
+ ReturnStageReturned, // 已退款
+ ReturnStageCancel, // 已取消
+ ReturnStageQualityCheckPendingRefund, // 已验布
+ ReturnStageServiceOrderPendingRefund, // 待退款
+ ReturnStageRejected, // 已拒绝
+ } = AFTER_ORDER_STATUS
+
+ //退款状态枚举
+ const {
+ ShouldCollectOrderRefundTypeUnknown,
+ ShouldCollectOrderRefundTypeAdvanceReceiptRefund,
+ ShouldCollectOrderRefundTypeReturnForRefund,
+ ShouldCollectOrderRefundTypeSalesRefund,
+ } = REFUND_STATUS
//金额列表枚举
const priceList = [
{
- id:1,
- value:[],
- label:'退货条数',
- field: 'estimate_amount'
+ 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:2,
- value:[],
+ id:1,
+ big_value:[ReturnStageReturned.value],
+ cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
+ model_value: [],
label:'扣款金额',
- field: 'total_sale_price'
+ field: 'other_deduction_amount'
},
{
id:3,
- value:[],
- label:'其他扣款',
- field: 'total_weight_error_discount'
+ big_value:[ReturnStageReturned.value],
+ cut_value: [ReturnStageReturned.value],
+ model_value: [ReturnStageReturned.value],
+ label:'退款金额',
+ field: 'refund_amount'
},
{
id:4,
- value:[],
- label:'应退金额',
- field: 'total_should_collect_money'
- },
- {
- id:5,
- value:[],
- label:'退款金额',
- field: 'total_should_collect_money'
- },
- {
- id:6,
- value:[],
+ big_value:[ReturnStageReturned.value],
+ cut_value: [ReturnStageReturned.value],
+ model_value: [ReturnStageReturned.value],
label:'退款去向',
- field: 'actual_amount'
+ field: 'refund_flow_name'
},
- {
- id:7,
- value:[],
- label:'实付金额',
- field: 'actual_amount'
- }
- ]
+
+ ]
//是否显示价格
- const showPrice = useCallback((priceInfo, status) => {
- return priceInfo.value.includes(status)
+ const showPrice = useCallback((priceInfo) => {
+ let key = ['big_value', 'model_value', 'cut_value']
+ 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(() => {
@@ -115,7 +140,7 @@ export default memo(({order, comfirm = false}:Param) => {
<>
{
priceList.map(item => {
- return <>{showPrice(item, order?.stage)&&}>
+ return <>{showPrice(item)&&}>
})
}
>
@@ -126,6 +151,11 @@ export default memo(({order, comfirm = false}:Param) => {
const labAndRgbAndUrl = useCallback((item) => {
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
}, [])
+
+ //单价显示判断
+ const sale_price_show = useMemo(() => {
+ return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
+ }, [order])
return (
@@ -137,7 +167,7 @@ export default memo(({order, comfirm = false}:Param) => {
{order.sale_mode_name}
{formatHashTag(item.code, item.name)}
- 共{item?.product_colors.length}种
+ 共{item?.product_colors?.length}种
{item?.product_colors?.map(colorItem => {
@@ -148,7 +178,10 @@ export default memo(({order, comfirm = false}:Param) => {
{colorItem.code + ' ' + colorItem.name}
- ¥{standardPrice(colorItem.sale_price)}
+
+ {sale_price_show&&¥{standardPrice(colorItem.sale_price)}}
+ {(order?.stage == ReturnStageReturned.value)&&总重{formatWeightDiv(colorItem.estimate_weight)}kg}
+
×{formatCount(colorItem)}{order.unit}
diff --git a/src/pages/salesAfter/components/modelKindList/index.module.scss b/src/pages/salesAfter/components/modelKindList/index.module.scss
new file mode 100644
index 0000000..e713a98
--- /dev/null
+++ b/src/pages/salesAfter/components/modelKindList/index.module.scss
@@ -0,0 +1,131 @@
+
+.kindsList_main{
+ margin-top: 20px;
+}
+.orders_list_con{
+
+ background-color: #fff;
+ border-radius: 20px;
+ padding: 20px;
+ .orders_return_title{
+ font-size: 28px;
+ font-weight: 700;
+ padding-bottom: 20px;
+ }
+ .order_list{
+ &:nth-child(n+2) {
+ margin-top: 30px;
+ }
+ .order_list_title{
+ display: flex;
+ align-items: center;
+ .tag{
+ font-size: $font_size_min;
+ background-color: #CDE5FF;
+ padding: 5px 10px;
+ border-radius: 6px;
+ color: $color_main;
+ }
+ .title{
+ font-weight: 700;
+ font-size: $font_size;
+ margin-left: 20px;
+ flex:1;
+ }
+ .num{
+ color: $color_font_two;
+ font-size: $font_size_min;
+ }
+ }
+ }
+ .order_list_scroll{
+ margin-top: 30px;
+
+ .order_list_item {
+ display: flex;
+ &:nth-child(2) {
+ margin-top: 30px;
+ }
+ .order_list_item_img{
+ width: 126px;
+ height: 126px;
+ border-radius: 20px;
+ }
+ .order_list_item_con{
+ display: flex;
+ width: 100%;
+ flex:1;
+ border-bottom: 1px solid #f0f0f0;
+ height: 150px;
+ padding-top: 20px;
+ box-sizing: border-box;
+ }
+ .order_list_item_des{
+ flex:1;
+ box-sizing: border-box;
+ padding-left: 30px;
+ .order_list_item_title{
+ font-weight: 700;
+ font-size: $font_size;
+ margin-bottom: 15px;
+ }
+ .order_list_item_price{
+ font-size: 26px;
+ color: $color_font_three;
+ text{
+ &:nth-child(n+1) {
+ margin-right: 20px;
+ }
+ }
+ }
+ }
+ .order_list_item_count{
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-end;
+ .count_num{
+ color: $color_main;
+ font-size: $font_size;
+ margin-bottom: 15px;
+ font-weight: 400;
+ text{
+ font-size: $font_size_min;
+ }
+ }
+ .count_price {
+ font-size: $font_size;
+ font-weight: 700;
+ text{
+ font-size: $font_size_min;
+ }
+ }
+ }
+ }
+ }
+ .order_total{
+ padding-top: 20px;
+ display: flex;
+ justify-content: space-between;
+ text{
+ &:nth-child(1) {
+ font-size: 28px;
+ font-weight: 700;
+ }
+ &:nth-child(2) {
+ font-size: 24px;
+ font-weight: 700;
+ }
+ }
+ }
+ .order_estimated_amount{
+ display: flex;
+ align-items: flex-end;
+ flex-direction: column;
+ padding: 30px 0;
+ .order_price_des{
+ font-size: $font_size_medium;
+ color: $color_font_two;
+ }
+ }
+}
diff --git a/src/pages/salesAfter/components/modelKindList/index.tsx b/src/pages/salesAfter/components/modelKindList/index.tsx
new file mode 100644
index 0000000..d33bf66
--- /dev/null
+++ b/src/pages/salesAfter/components/modelKindList/index.tsx
@@ -0,0 +1,168 @@
+import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
+import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
+import LabAndImg from "@/components/LabAndImg"
+import { Text, View } from "@tarojs/components"
+import { memo, useCallback, useMemo } from "react"
+import EstimatedAmount from "../estimatedAmount"
+import styles from './index.module.scss'
+
+type OrderParam = {
+ estimate_amount: number, //预估金额
+ list: any[],
+ sale_mode: number,
+ sale_mode_name: string,
+ unit: string,
+ total_colors: number,
+ total_fabrics: number,
+ total_number: number,
+ stage: number, //订单状态
+ type: 1|2, //1退货, 2退款
+ total_sale_price: number, //销售金额
+ total_should_collect_money: number, //应收金额
+ total_weight_error_discount: number, //空差优惠
+ the_previous_status: number, //取消订单时的订单状态
+ actual_amount: number //实付金额
+}
+
+type Param = {
+ order: OrderParam,
+ comfirm?: boolean //是否是确认订单页面使用
+}
+
+export default memo(({order, comfirm = false}:Param) => {
+ //对应数量
+ const formatCount = useCallback((item) => {
+ return order?.sale_mode == 0? item.roll : Number(item.length / 100)
+ }, [order])
+ //对应单价
+ const standardPrice = useCallback(price => {
+ return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
+ }, [order])
+
+ //数量格式
+ const numText = useMemo(() => {
+ if(order)
+ return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
+ }, [order])
+
+ //售后单状态枚举
+ const {
+ ReturnStageApplying, // 申请中
+ ReturnStageWaitCheck, // 退货中
+ ReturnStageChecked, // 待验布
+ ReturnStageReturned, // 已退款
+ ReturnStageCancel, // 已取消
+ ReturnStageQualityCheckPendingRefund, // 已验布
+ ReturnStageServiceOrderPendingRefund, // 待退款
+ ReturnStageRejected, // 已拒绝
+ } = AFTER_ORDER_STATUS
+
+
+ //金额列表枚举
+ const priceList = [
+ {
+ id:1,
+ value:[
+ ReturnStageServiceOrderPendingRefund.value,
+ ReturnStageReturned.value
+ ],
+ label:'应退金额',
+ field: 'total_should_collect_money'
+ },
+ {
+ id:2,
+ value:[ReturnStageReturned.value],
+ label:'退款金额',
+ field: 'total_should_collect_money'
+ },
+ {
+ id:3,
+ value:[ReturnStageReturned.value],
+ label:'退款去向',
+ field: 'actual_amount'
+ },
+ {
+ id:4,
+ value:[ReturnStageQualityCheckPendingRefund.value],
+ label:'合计金额',
+ field: 'actual_amount'
+ },
+ ]
+
+ //是否显示价格
+ const showPrice = useCallback((priceInfo) => {
+ if(priceInfo.value == 8) {
+ //合计金额
+
+ }
+ return priceInfo.value.includes(order?.stage)
+ }, [order])
+
+ const priceConDom = useMemo(() => {
+ if(!order) return
+ return (
+ <>
+ {
+ priceList.map(item => {
+ return <>{showPrice(item)&&}>
+ })
+ }
+ >
+ )
+ }, [order])
+
+ //整理颜色
+ const labAndRgbAndUrl = useCallback((item) => {
+ return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
+ }, [])
+
+ //单价显示判断
+ const sale_price_show = useMemo(() => {
+ return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
+ }, [order])
+
+ return (
+
+
+ {order?.type == 1?'退货信息':'退款信息'}
+ {
+ order?.list?.map(item => {
+ return
+
+ {order.sale_mode_name}
+ {formatHashTag(item.code, item.name)}
+ 共{item?.product_colors?.length}种
+
+
+ {item?.product_colors?.map(colorItem => {
+ return
+
+
+
+
+
+ {colorItem.code + ' ' + colorItem.name}
+
+ {sale_price_show&&¥{standardPrice(colorItem.sale_price)}}
+ 总重{formatWeightDiv(colorItem.estimate_weight)}kg
+
+
+
+ ×{formatCount(colorItem)}{order.unit}
+ ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}
+
+
+
+ })}
+
+
+ })
+ }
+ 合计{numText}
+
+ {priceConDom}
+
+
+
+ )
+})
\ No newline at end of file
diff --git a/src/pages/salesAfter/components/returnLogistics/index.tsx b/src/pages/salesAfter/components/returnLogistics/index.tsx
index 3d6b19f..61b034b 100644
--- a/src/pages/salesAfter/components/returnLogistics/index.tsx
+++ b/src/pages/salesAfter/components/returnLogistics/index.tsx
@@ -11,9 +11,12 @@ type Param = {
show?: true|false,
onClose?: () => void,
onSubmit?: () => void,
- id?: number //订单id
+ id?: number, //订单id
+ images: string[], //图片列表
+ descValue?: string, //描述
+ onlyRead?: false|true //true 只读
}
-export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => {
+export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = '', onlyRead = false}: Param) => {
//需要提交的数据
const submitData = useRef({
accessory_url: [],
@@ -45,24 +48,25 @@ export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => {
} else {
alert.error('上传失败')
}
+ onSubmit?.()
}
return (
<>
-
+
上传附件:
-
+
-
+
-
+ {!onlyRead&&
onSubmitEven()}>保存
-
+ }
>
diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx
index d84ae04..0122f35 100644
--- a/src/pages/salesAfter/index.tsx
+++ b/src/pages/salesAfter/index.tsx
@@ -1,15 +1,10 @@
-import {
- GetSaleOrderDetailApi,
- EditSaleOrderRemarkApi,
-} from "@/api/order";
-import { GetOrderPayApi } from "@/api/orderPay";
+
import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder";
-import { alert, goLink } from "@/common/common";
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum";
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
import AfterOrderBtns from "@/components/afterOrderBtns";
-import OrderBtns from "@/components/orderBtns";
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";
@@ -23,7 +18,7 @@ import ReturnLogistics from "./components/returnLogistics";
import styles from './index.module.scss'
export default () => {
-
+ useLogin()
const router = useRouter()
const orderId = useRef(Number(router.params.id))
useDidShow(() => {
@@ -58,7 +53,7 @@ import styles from './index.module.scss'
total_number: orderDetail.total_number, //总数量
total_fabrics: orderDetail.total_fabrics, //面料数量
unit: orderDetail.sale_mode == 0?'条':'m', //单位
- list: orderDetail.product_list,
+ list: orderDetail.quality_check_pass_product,
stage: orderDetail.stage, //订单状态
type: orderDetail.type, //退货or退款
total_sale_price: orderDetail.total_sale_price, //销售金额
@@ -66,6 +61,12 @@ 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, //退款状态
+ refund_flow_name: orderDetail.refund_flow_name //退款去向
+
})
}
const formatPreViewOrderMemo = useMemo(() => {
@@ -75,7 +76,12 @@ import styles from './index.module.scss'
//获取底部按钮点击, 获取按钮状态
const orderStateClick = useCallback((val) => {
-
+ if(val == 1 || val == 6) {
+ getSaleOrderPreView()
+ } else if(val == 8) {
+ //申请记录
+ setApplyRecord(true)
+ }
}, [orderDetail])
//页面下拉刷新
@@ -91,7 +97,7 @@ import styles from './index.module.scss'
orderId: orderDetail?.id,
settle_mode: orderDetail?.settle_mode,
type: orderDetail?.type, //退货or退款
- sale_mode: orderDetail?.sale_model, //订单类型
+ sale_mode: orderDetail?.sale_mode, //订单类型
return_apply_order_id: orderDetail?.return_apply_order_id
}
}, [orderDetail])
@@ -103,41 +109,44 @@ 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?.fabric_piece_accessory_url.map(item => {
- return formatImgUrl(item)
- })
- Taro.previewImage({
- current: list[0], // 当前显示
- urls: list // 需要预览的图片http链接列表
- })
- }
- }, [orderDetail])
- const onCloseLogistics = useCallback(() => setLogisticsShow(false), [])
+ 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)
+ }, [])
//物流成功上传
const logisticsSuccess = useCallback(() => {
+ setLogisticsShow(false)
getSaleOrderPreView()
}, [])
- //显示生气记录
+ //显示记录
const [applyRecord, setApplyRecord] = useState(false)
- //货
return (
-
+
-
-
-
+
-
+
setApplyRecord(false)}/>
@@ -195,7 +204,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])
diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx
index 749d956..29b88e1 100644
--- a/src/pages/salesAfterList/components/order/index.tsx
+++ b/src/pages/salesAfterList/components/order/index.tsx
@@ -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,8 @@ 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
}
@@ -52,7 +54,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])
@@ -61,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 (
goLink('/pages/salesAfter/index', {id: value?.id})}>
@@ -69,24 +76,24 @@ export default memo(({value, onClickBtn}: Param) => {
{userInfo?.adminUserInfo?.user_name}
- 售后单号:{value?.return_order_no}
-
+ 售后单号:{value?.return_order_no}
+
goLink('/pages/salesAfter/index', {id: value?.id})}>
{value?.sale_mode_name}
- {formatHashTag(value?.product_list[0].code, value?.product_list[0].name)}
+ {formatHashTag(value?.product_list?.[0].code, value?.product_list?.[0].name)}
{value?.stage_name}
- {value?.product_list[0].product_colors[0].code}
+ {value?.product_list?.[0].product_colors?.[0].code}
- {value?.product_list[0].product_colors.map((itemColor, index) => {
+ {value?.product_list?.[0].product_colors.map((itemColor, index) => {
return (
(index <= 1)&&
{formatHashTag(itemColor.code, itemColor.name)}
@@ -105,11 +112,11 @@ export default memo(({value, onClickBtn}: Param) => {
{`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`}
- {value?.type == 1?'已申请退货':'已申请退款'}
+ {value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'}
订单号:{value?.order_no}
-
+
)
})
diff --git a/src/pages/salesAfterList/components/orderStatusTag/index.tsx b/src/pages/salesAfterList/components/orderStatusTag/index.tsx
index c72373e..968fe99 100644
--- a/src/pages/salesAfterList/components/orderStatusTag/index.tsx
+++ b/src/pages/salesAfterList/components/orderStatusTag/index.tsx
@@ -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)&&
+ {(status !== 0)&&
- { status == 1?'退货':'退款'}
+ { status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'}
}
>
)
diff --git a/src/pages/salesAfterList/index copy 2.tsx b/src/pages/salesAfterList/index copy.tsx
similarity index 93%
rename from src/pages/salesAfterList/index copy 2.tsx
rename to src/pages/salesAfterList/index copy.tsx
index 2d64951..6cc25ea 100644
--- a/src/pages/salesAfterList/index copy 2.tsx
+++ b/src/pages/salesAfterList/index copy.tsx
@@ -10,7 +10,7 @@ import InfiniteScroll from "@/components/infiniteScroll"
import { dataLoadingStatus, getFilterData } from "@/common/util"
import OrderStatusList from "./components/orderStatusList"
import { AFTER_ORDER_STATUS } from "@/common/enum"
-import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder"
+import { GetSaleOrderListApi } from "@/api/salesAfterOrder"
import ReturnLogistics from "./components/returnLogistics"
export default () => {
@@ -29,10 +29,11 @@ export default () => {
//获取订单状态
const [statusList, setStatusList] = useState([{id: -1, name: '全部'}])
- const {fetchData: fetchDataStatus} = RefundOrderSatausApi()
- const getOrderStatusList = async () => {
- let res = await fetchDataStatus()
- setStatusList((e) => [...e, ...res.data.list])
+ const getOrderStatusList = () => {
+ const status = Object.values(AFTER_ORDER_STATUS).map(item => {
+ return {id: item.value, name: item.label}
+ })
+ setStatusList((e) => [...e, ...status])
}
useEffect(() => {
getOrderStatusList()
diff --git a/src/pages/salesAfterList/index.tsx b/src/pages/salesAfterList/index.tsx
index 6cc25ea..8256d9e 100644
--- a/src/pages/salesAfterList/index.tsx
+++ b/src/pages/salesAfterList/index.tsx
@@ -10,13 +10,13 @@ import InfiniteScroll from "@/components/infiniteScroll"
import { dataLoadingStatus, getFilterData } from "@/common/util"
import OrderStatusList from "./components/orderStatusList"
import { AFTER_ORDER_STATUS } from "@/common/enum"
-import { GetSaleOrderListApi } from "@/api/salesAfterOrder"
+import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder"
import ReturnLogistics from "./components/returnLogistics"
export default () => {
- const {checkLogin} = useLogin()
- useDidShow(async () => {
- await checkLogin()
+ useLogin()
+ useDidShow(() => {
+ getOrderList()
})
//搜索参数
@@ -29,11 +29,10 @@ export default () => {
//获取订单状态
const [statusList, setStatusList] = useState([{id: -1, name: '全部'}])
- const getOrderStatusList = () => {
- const status = Object.values(AFTER_ORDER_STATUS).map(item => {
- return {id: item.value, name: item.label}
- })
- setStatusList((e) => [...e, ...status])
+ const {fetchData: fetchDataStatus} = RefundOrderSatausApi()
+ const getOrderStatusList = async () => {
+ let res = await fetchDataStatus()
+ setStatusList((e) => [...e, ...res.data.list])
}
useEffect(() => {
getOrderStatusList()
@@ -95,9 +94,8 @@ export default () => {
//监听点击的按钮
const clickOrderBtn = useCallback(({status, orderInfo}) => {
- if(status == 2) {
- //退货物流
-
+ if(status == 1 || status == 6) {
+ getOrderList()
}
}, [orderData])
diff --git a/src/pages/sampleComparison/index.tsx b/src/pages/sampleComparison/index.tsx
index 6639e3a..6dc80ff 100644
--- a/src/pages/sampleComparison/index.tsx
+++ b/src/pages/sampleComparison/index.tsx
@@ -18,11 +18,11 @@ export default () => {
a2: '',
b2: '',
})
-
- const [colorList, setColorList] = useState({
- one: null,
- two: null
- })
+ type ColorList = {
+ one?: any,
+ two?: any
+ }
+ const [colorList, setColorList] = useState()
const { state: colorState, measureAndGetLab } = useBluetooth()
const getLab = async (val) => {
@@ -57,25 +57,28 @@ export default () => {
useEffect(() => {
if (colorState.deviceLab) {
- if (colorList.one?.constructor === Object) {
- const rgb = toRgb([colorList.one.L, colorList.one.a, colorList.one.b])
+ if ((colorList as any).one?.constructor === Object) {
+ const rgb = toRgb([(colorList as any).one.L, (colorList as any).one.a, (colorList as any).one.b])
setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
setTime(getNowTime())
setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] })
}
- if (colorList.two?.constructor === Object) {
- const rgb = toRgb([colorList.two.L, colorList.two.a, colorList.two.b])
+ if ((colorList as any).two?.constructor === Object) {
+
+ const rgb = toRgb([(colorList as any).two.L, (colorList as any).two.a, (colorList as any).two.b])
setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
setTimeTwo(getNowTime())
setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] })
+
}
}
}, [colorList])
const reset = () => {
+ setColorList({})
setBlueToothColor('')
setBlueToothColorTwo('')
setTime('')
- setTime('')
+ setTimeTwo('')
setData('')
setResult('')
}
diff --git a/src/pages/search/index.tsx b/src/pages/search/index.tsx
index d342443..dbdc018 100644
--- a/src/pages/search/index.tsx
+++ b/src/pages/search/index.tsx
@@ -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 (
diff --git a/src/pages/searchList/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx
index 9496028..7a696e0 100644
--- a/src/pages/searchList/hightSearchList.tsx
+++ b/src/pages/searchList/hightSearchList.tsx
@@ -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)
diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx
index dd80f20..46616cf 100644
--- a/src/pages/searchList/search.tsx
+++ b/src/pages/searchList/search.tsx
@@ -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: [],
diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx
index 53e50f4..13b5309 100644
--- a/src/pages/searchList/searchList.tsx
+++ b/src/pages/searchList/searchList.tsx
@@ -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()
diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx
index be206a9..b41bdc9 100644
--- a/src/pages/user/index.tsx
+++ b/src/pages/user/index.tsx
@@ -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({})
+ 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 (
-
- checkGo()} />
+
+ checkGo()} userInfo={userDataAgain}/>
{/* {(adminUserInfo as any)?.authentication_status==1&&} */}
{/* 测试暂时添加 */}
{BASE_URL}
- {!adminUserInfo.is_authorize_name && }
+ {!userDataAgain?.is_authorize_name && }
)
}
@@ -97,8 +108,8 @@ const Modal = memo((props: any) => {
const Header = memo((props: any) => {
const { data } = props;
console.log(props, 'propsprops')
- let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" },
- { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" },
+ let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index?status=0" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index?status=1" },
+ { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index?status=2" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index?status=3" },
{ text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/salesAfterList/index" }];
const { getPhoneNumber } = useLogin();
const mGetPhoneNumber = (ev) => {
@@ -143,7 +154,7 @@ const Header = memo((props: any) => {
- {(data?.authentication_status == 0 || data?.authentication_status == 1) &&
+ {((data?.authentication_status == 0 || data?.authentication_status == 1) && data?.order_access_status == 3) &&
navTo()}>
@@ -156,7 +167,7 @@ const Header = memo((props: any) => {
}
- {(data?.authentication_status == 3) &&
+ {(data?.authentication_status == 3 && data?.order_access_status == 3) &&
navTo()}>
@@ -169,7 +180,7 @@ const Header = memo((props: any) => {
}
- {data?.authentication_status == 2 &&
+ {(data?.authentication_status == 2 && data?.order_access_status == 3) &&
navTo()}>
@@ -182,7 +193,7 @@ const Header = memo((props: any) => {
}
- {data?.authentication_status == 4 &&
+ {(data?.authentication_status == 4 && data?.order_access_status == 3) &&
navTo()}>
@@ -274,34 +285,36 @@ const Header = memo((props: any) => {
// 我的资产
const Assets = (props: any) => {
return (
-
- 我的资产
-
-
-
- ¥
- {formatPriceDiv(props.data.data.wallet_money || 0)}
- {/* {props.wallet_money || 0} */}
-
- 预存款
-
- {/*
-
- {props.data.data.coupon_count || 0}
- 张
-
- 优惠券
- */}
- props.checkShow()}>
-
- ¥
- {formatPriceDiv(props.data.data.credit_line || 0)}
- {/* .-00 */}
-
- 授信额度
-
-
-
+ <>
+ {(props.userInfo.order_access_status == 3) &&
+ 我的资产
+
+
+
+ ¥
+ {formatPriceDiv(props.data.data.wallet_money || 0)}
+ {/* {props.wallet_money || 0} */}
+
+ 预存款
+
+ {/*
+
+ {props.data.data.coupon_count || 0}
+ 张
+
+ 优惠券
+ */}
+ props.checkShow()}>
+
+ ¥
+ {formatPriceDiv(props.data.data.credit_line || 0)}
+ {/* .-00 */}
+
+ 授信额度
+
+
+ ||}
+ >
)
};
diff --git a/src/pages/userEdit/index.tsx b/src/pages/userEdit/index.tsx
index f4bb132..1372fc7 100644
--- a/src/pages/userEdit/index.tsx
+++ b/src/pages/userEdit/index.tsx
@@ -12,6 +12,7 @@ import useLogin from "@/use/useLogin";
import { useSelector } from "@/reducers/hooks";
import useUploadCDNImg from "@/use/useUploadImage";
import { IMG_CND_Prefix } from "@/common/constant";
+import useUserInfo from "@/use/useUserInfo";
export default () => {
const { getPhoneNumber, getAdminUserInfo } = useLogin();
@@ -141,6 +142,14 @@ export default () => {
}
}
+ const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo()
+ const outLogin = () => {
+ removeToken()
+ removeSessionKey()
+ removeUserInfo()
+ goLink('/pages/index/index',{}, 'switchTab')
+ }
+
return (
@@ -174,7 +183,7 @@ export default () => {
- {/* */}
+
handleTextareaSave(value, "Ickname")} />
handleTextareaSave(value, "companyName")} />
diff --git a/src/pages/weightList/index.tsx b/src/pages/weightList/index.tsx
index 9c67547..00a8a69 100644
--- a/src/pages/weightList/index.tsx
+++ b/src/pages/weightList/index.tsx
@@ -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(
diff --git a/src/pages/weightListAdd/index.tsx b/src/pages/weightListAdd/index.tsx
index 19241c7..ecd060e 100644
--- a/src/pages/weightListAdd/index.tsx
+++ b/src/pages/weightListAdd/index.tsx
@@ -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"){
diff --git a/src/use/useCommonData.ts b/src/use/useCommonData.ts
index ee36c61..0b6c366 100644
--- a/src/use/useCommonData.ts
+++ b/src/use/useCommonData.ts
@@ -1,3 +1,5 @@
+import { SubscriptionMessageApi } from "@/api/user"
+import Taro from "@tarojs/taro"
import dayjs from "dayjs"
import { useEffect, useRef, useState } from "react"
@@ -13,6 +15,7 @@ export const useTimeCountDown = () => {
const timeObj:any = useRef()
const endTime = useRef('')
const onStart = (val = '') => {
+ console.log('time:::', val)
endTime.current = val
if(endTime.current) {
clearInterval(timeObj.current)
@@ -49,7 +52,7 @@ export const useTimeCountDown = () => {
var HH = ('00'+hh).slice(-2);
var MM = ('00'+mm).slice(-2);
var SS = ('00'+ss).slice(-2);
- // console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
+ console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
setShowTime((e) => ({...e, DD, HH, MM, SS}))
}
return {
@@ -58,3 +61,32 @@ export const useTimeCountDown = () => {
timeStatus
}
}
+
+
+//订阅消息hook
+export const UseSubscriptionMessage = () => {
+ const {fetchData: fetchDataMessage} = SubscriptionMessageApi()
+ const openSubscriptionMessage = ({orderId = 0, scenes = 0}:{orderId?: number, scenes: number}) => {
+ return new Promise(async (resolve) => {
+ let params:{sale_order_id?: number, scenes?: number} = {}
+ orderId&&(params.sale_order_id = orderId)
+ params.scenes = scenes
+ let res = await fetchDataMessage(params)
+ if(res.success&&res.data.TemplateID&&res.data.TemplateID.length > 0) {
+ Taro.requestSubscribeMessage({
+ tmplIds: res.data.TemplateID,
+ complete: function (res) {
+ resolve(res)
+ }
+ })
+ } else {
+ resolve(true)
+ }
+ })
+ }
+
+ return {
+ openSubscriptionMessage
+ }
+
+}
diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts
index 2a2227d..0403c1b 100644
--- a/src/use/useHttp.ts
+++ b/src/use/useHttp.ts
@@ -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 = {
@@ -171,10 +169,19 @@ export const useRequest = (options:option = {
stateRef.current.msg = msg
stateRef.current.data = data
stateRef.current.total = data?.list ? data?.total : 0
+ if(code !== 0) {
+ Taro.showToast({
+ title: `${msg}`,
+ icon: 'none'
+ })
+ console.log('错误::',msg)
+ }
}else{
+
if (statusCode === 401) {
removeToken()
removeSessionKey()
+ removeUserInfo()
login()
//todo 登录数据刷新次数问题
} else {
@@ -189,6 +196,7 @@ export const useRequest = (options:option = {
stateRef.current.success = false
stateRef.current.error = true
stateRef.current.msg = e.errMsg
+ console.log('后台错误信息::',e.errMsg)
}
stateRef.current.error = false
diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts
index 7435b02..698aed8 100644
--- a/src/use/useLogin.ts
+++ b/src/use/useLogin.ts
@@ -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()
diff --git a/src/use/useLoginRequest.ts b/src/use/useLoginRequest.ts
index dc7d55e..d4db5de 100644
--- a/src/use/useLoginRequest.ts
+++ b/src/use/useLoginRequest.ts
@@ -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
}
})
})
diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts
index 86c698e..5c05e3c 100644
--- a/src/use/useUploadImage.ts
+++ b/src/use/useUploadImage.ts
@@ -114,26 +114,39 @@ export default () => {
})
}
- /**
- * 上传手机图片
- * @param cdn_upload_type //CDN 文件上传场景值
- */
+
// product 产品相关,图片、纹理图等 全平台
// after-sale 售后(申请退货、退款)相关的、图片、视频 全平台
// mall 电子商城相关的 全平台
// logistics 物流(发货、提货)相关的、图片、视频 全平台
type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics'
- const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => {
+ /**
+ * 上传手机图片
+ * @param cdn_upload_type 场景值
+ * @param count // 1时返回一张图片信息, 大于1时返回图片数组
+ * @returns
+ */
+ const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param, count: number = 1) => {
return new Promise((resolve, reject) => {
+ let list:any[] = []
Taro.chooseImage({
- count: 1,
+ count: count,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: async function (res) {
- const file = res.tempFiles[0]
try {
- let data = await uploadCDNImg(file, cdn_upload_type, cdn_upload_type)
- resolve(data)
+ if(count > 1) {
+ for(let i = 0; i < res.tempFiles.length; i++) {
+ let data = await uploadCDNImg(res.tempFiles[i], cdn_upload_type, cdn_upload_type)
+ list.push(data)
+ }
+ resolve(list)
+ } else {
+ //兼容以前上传一张的情况
+ let data = await uploadCDNImg(res.tempFiles[0], cdn_upload_type, cdn_upload_type)
+ resolve(data)
+ }
+
} catch(res) {
reject(res)
}