🐳 chore(eslint): 修正所有文件的eslint 错误❌
This commit is contained in:
parent
99a920975f
commit
cc99111b4f
@ -4,6 +4,9 @@
|
|||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"@typescript-eslint/no-shadow": "off",
|
"@typescript-eslint/no-shadow": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
"eqeqeq": "off"
|
"eqeqeq": "off",
|
||||||
|
"no-prototype-builtins": "off",
|
||||||
|
"import/first": "off",
|
||||||
|
"react/no-children-prop": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,5 +236,5 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libVersion": "2.27.3"
|
"libVersion": "2.28.0"
|
||||||
}
|
}
|
||||||
@ -12,35 +12,35 @@ export const GetAddressListApi = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取客户地址
|
// 获取客户地址
|
||||||
export const mppurchaseraddresslist = () => {
|
export const MpPurchaserAddressList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/address/list',
|
url: '/v2/mp/purchaser/address/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 新增客户地址
|
// 新增客户地址
|
||||||
export const mppurchaseraddress = () => {
|
export const MpPurchaserAddress = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/address',
|
url: '/v2/mp/purchaser/address',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取编辑地址信息
|
// 获取编辑地址信息
|
||||||
export const mppurchaseraddressget = () => {
|
export const MpPurchaserAddressGet = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/address',
|
url: '/v2/mp/purchaser/address',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 编辑收货地址信息
|
// 编辑收货地址信息
|
||||||
export const mppurchaseraddressput = () => {
|
export const MpPurchaserAddressPut = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/address',
|
url: '/v2/mp/purchaser/address',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 删除收货地址信息
|
// 删除收货地址信息
|
||||||
export const mppurchaseraddressdelect = () => {
|
export const MpPurchaserAddressDelete = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/address',
|
url: '/v2/mp/purchaser/address',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
|
|||||||
@ -1,35 +1,35 @@
|
|||||||
import { useRequest } from '@/use/useHttp'
|
import { useRequest } from '@/use/useHttp'
|
||||||
|
|
||||||
// 获取客户信息
|
// 获取客户信息
|
||||||
export const mppurchaser = () => {
|
export const MpPurchaser = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser',
|
url: '/v2/mp/purchaser',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 新建客户
|
// 新建客户
|
||||||
export const mppurchaserpost = () => {
|
export const MpPurchaserPost = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser',
|
url: '/v2/mp/purchaser',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 编辑客户
|
// 编辑客户
|
||||||
export const mppurchaserput = () => {
|
export const MpPurchaserPut = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser',
|
url: '/v2/mp/purchaser',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取标签列表
|
// 获取标签列表
|
||||||
export const mppurchaserlist = () => {
|
export const MpPurchaserList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/label/list',
|
url: '/v2/mp/purchaser/label/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 保存标签
|
// 保存标签
|
||||||
export const mppurchaserlabeladd = () => {
|
export const MpPurchaserLabelAdd = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/purchaser/label/add',
|
url: '/v2/mp/purchaser/label/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export {
|
|||||||
* 系列列表
|
* 系列列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const kindListApi = () => {
|
export const KindListApi = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/product/kind/list',
|
url: '/v2/mp/product/kind/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@ -1,35 +1,35 @@
|
|||||||
import { useRequest } from '@/use/useHttp'
|
import { useRequest } from '@/use/useHttp'
|
||||||
|
|
||||||
// 收款单列表
|
// 收款单列表
|
||||||
export const mpcashManagementOrderlist = () => {
|
export const MpCashManagementOrderList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/cashManagementOrder/list',
|
url: '/v2/mp/cashManagementOrder/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 收款单详情
|
// 收款单详情
|
||||||
export const mpcashManagementOrder = () => {
|
export const MpCashManagementOrder = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/cashManagementOrder',
|
url: '/v2/mp/cashManagementOrder',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 收款账号
|
// 收款账号
|
||||||
export const mpcashManagementOrderaccount = () => {
|
export const MpCashManagementOrderAccount = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/cashManagementOrder/account',
|
url: '/v2/mp/cashManagementOrder/account',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 新建收款单
|
// 新建收款单
|
||||||
export const mpcashManagementOrderpost = () => {
|
export const MpCashManagementOrderPost = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/cashManagementOrder',
|
url: '/v2/mp/cashManagementOrder',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 扫描获取应收单的客户信息
|
// 扫描获取应收单的客户信息
|
||||||
export const mpshouldCollectOrderpurchaser = () => {
|
export const MpShouldCollectOrderPurchaser = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/shouldCollectOrder/purchaser',
|
url: '/v2/mp/shouldCollectOrder/purchaser',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useRequest } from '@/use/useHttp'
|
import { useRequest } from '@/use/useHttp'
|
||||||
import { CAP_HTML_TO_IMAGE_BASE_URL } from '@/common/constant'
|
import { CAP_HTML_TO_IMAGE_BASE_URL } from '@/common/constant'
|
||||||
|
|
||||||
export const mpenumsaleorderstatus = () => {
|
export const MpEnumSaleOrderStatus = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/filterMPSaleOrderStatus',
|
url: '/v2/mp/enum/filterMPSaleOrderStatus',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -30,70 +30,70 @@ export const ClientListApi = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 面料种类列表
|
// 面料种类列表
|
||||||
export const mpproductcolorlist = () => {
|
export const MpProductColorList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/product/color/list',
|
url: '/v2/mp/product/color/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 购物车提交
|
// 购物车提交
|
||||||
export const mpsaleOrderpreView = () => {
|
export const MpSaleOrderPreview = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder/preView',
|
url: '/v2/mp/saleOrder/preView',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 业务员枚举
|
// 业务员枚举
|
||||||
export const mpenumsaleUserlist = () => {
|
export const MpEnumSaleUserList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/saleUser/list',
|
url: '/v2/mp/enum/saleUser/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 订单详情
|
// 订单详情
|
||||||
export const mpsaleOrder = () => {
|
export const MpSaleOrder = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder',
|
url: '/v2/mp/saleOrder',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 取消订单
|
// 取消订单
|
||||||
export const mpsaleOrdercancel = () => {
|
export const MpSaleOrderCancel = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder/cancel',
|
url: '/v2/mp/saleOrder/cancel',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 再次购买
|
// 再次购买
|
||||||
export const mpshoppingCartproductColorlist = () => {
|
export const MpShoppingCartProductColorList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/shoppingCart/productColor/list',
|
url: '/v2/mp/shoppingCart/productColor/list',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取账期付款
|
// 获取账期付款
|
||||||
export const orderPaymentorderPaymentMethodInfo = () => {
|
export const OrderPaymentOrderPaymentMethodInfo = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/orderPayment/orderPaymentMethodInfo',
|
url: '/v2/mp/orderPayment/orderPaymentMethodInfo',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 预收单获取接口信息
|
// 预收单获取接口信息
|
||||||
export const orderPaymentpreCollectOrderorderPaymentMethodInfo = () => {
|
export const OrderPaymentPreCollectOrderOrderPaymentMethodInfo = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentMethodInfo',
|
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentMethodInfo',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 确认交易
|
// 确认交易
|
||||||
export const orderPaymentorderPaymentSubmission = () => {
|
export const OrderPaymentOrderPaymentSubmission = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/orderPayment/orderPaymentSubmission',
|
url: '/v2/mp/orderPayment/orderPaymentSubmission',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 订单预支付提交
|
// 订单预支付提交
|
||||||
export const orderPaymentpreCollectOrderorderPaymentSubmission = () => {
|
export const OrderPaymentPreCollectOrderOrderPaymentSubmission = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentSubmission',
|
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentSubmission',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
@ -120,70 +120,70 @@ export const GetReturnPayCode = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 编辑备注信息
|
// 编辑备注信息
|
||||||
export const mpsaleOrderput = () => {
|
export const MpSaleOrderPut = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder',
|
url: '/v2/mp/saleOrder',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 修改销售单的收货地址
|
// 修改销售单的收货地址
|
||||||
export const mpsaleOrderaddress = () => {
|
export const MpSaleOrderAddress = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder/address',
|
url: '/v2/mp/saleOrder/address',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 关键字搜索历史
|
// 关键字搜索历史
|
||||||
export const mpsearchHistorylist = () => {
|
export const MpSearchHistoryList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/searchHistory/list',
|
url: '/v2/mp/searchHistory/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 添加关键字搜索
|
// 添加关键字搜索
|
||||||
export const mpsearchHistory = () => {
|
export const MpSearchHistory = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/searchHistory',
|
url: '/v2/mp/searchHistory',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 确认收货
|
// 确认收货
|
||||||
export const mpsaleOrderreceive = () => {
|
export const MpSaleOrderReceive = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder/receive',
|
url: '/v2/mp/saleOrder/receive',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 退货原因
|
// 退货原因
|
||||||
export const mpenumreturnOrderreturnReason = () => {
|
export const MpEnumReturnOrderReturnReason = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/returnOrder/returnReason',
|
url: '/v2/mp/enum/returnOrder/returnReason',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 二次选择退货原因
|
// 二次选择退货原因
|
||||||
export const mpenumreturnExplain = () => {
|
export const MpEnumReturnExplain = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/returnExplain',
|
url: '/v2/mp/enum/returnExplain',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 货物状况
|
// 货物状况
|
||||||
export const mpenumreturngoodsStatus = () => {
|
export const MpEnumReturnGoodsStatus = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/return/goodsStatus',
|
url: '/v2/mp/enum/return/goodsStatus',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 申请退货
|
// 申请退货
|
||||||
export const mpreturnApplyOrder = () => {
|
export const MpReturnApplyOrder = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/returnApplyOrder',
|
url: '/v2/mp/returnApplyOrder',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 退款说明
|
// 退款说明
|
||||||
export const mpenumrefundExplainone = () => {
|
export const MpEnumRefundExplainOne = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/refundExplain',
|
url: '/v2/mp/enum/refundExplain',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -191,14 +191,14 @@ export const mpenumrefundExplainone = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 提交订单
|
// 提交订单
|
||||||
export const mpsaleOrderpost = () => {
|
export const MpSaleOrderPost = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder',
|
url: '/v2/mp/saleOrder',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 修改销售单物流方式
|
// 修改销售单物流方式
|
||||||
export const mpsaleOrdershipmentMode = () => {
|
export const MpSaleOrderShipmentMode = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/saleOrder/shipmentMode',
|
url: '/v2/mp/saleOrder/shipmentMode',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
|
|||||||
@ -1,42 +1,42 @@
|
|||||||
import { useRequest } from '@/use/useHttp'
|
import { useRequest } from '@/use/useHttp'
|
||||||
|
|
||||||
// 售后订单列表
|
// 售后订单列表
|
||||||
export const mpreturnApplyOrderlist = () => {
|
export const MpReturnApplyOrderList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/returnApplyOrder/list',
|
url: '/v2/mp/returnApplyOrder/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 售后状态枚举
|
// 售后状态枚举
|
||||||
export const mpenumreturnStage = () => {
|
export const MpEnumReturnStage = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/returnStage',
|
url: '/v2/mp/enum/returnStage',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 退款类型枚举
|
// 退款类型枚举
|
||||||
export const mpenumreturnType = () => {
|
export const MpEnumReturnType = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/enum/returnType',
|
url: '/v2/mp/enum/returnType',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 售后详情
|
// 售后详情
|
||||||
export const mpreturnApplyOrder = () => {
|
export const MpReturnApplyOrder = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/returnApplyOrder',
|
url: '/v2/mp/returnApplyOrder',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 取消退货
|
// 取消退货
|
||||||
export const returnApplyOrdercancel = () => {
|
export const ReturnApplyOrderCancel = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/returnApplyOrder/cancel',
|
url: '/v2/mp/returnApplyOrder/cancel',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 售后确认上传附件
|
// 售后确认上传附件
|
||||||
export const returnApplyOrderuploadAccessory = () => {
|
export const ReturnApplyOrderUploadAccessory = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/returnApplyOrder/uploadAccessory',
|
url: '/v2/mp/returnApplyOrder/uploadAccessory',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useRequest } from '@/use/useHttp'
|
import { useRequest } from '@/use/useHttp'
|
||||||
// 搜索商品
|
// 搜索商品
|
||||||
export const mpproductlist = () => {
|
export const MpProductList = () => {
|
||||||
return useRequest({
|
return useRequest({
|
||||||
url: '/v2/mp/product/list',
|
url: '/v2/mp/product/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
import Taro, { onAppShow } from '@tarojs/taro'
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import configStore from './store'
|
import configStore from './store'
|
||||||
|
import { shareShop } from './common/util'
|
||||||
import ContextBlueTooth from '@/use/contextBlueTooth'
|
import ContextBlueTooth from '@/use/contextBlueTooth'
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
import Taro, { onAppShow, useDidShow } from '@tarojs/taro'
|
|
||||||
import { shareShop } from './common/util'
|
|
||||||
|
|
||||||
interface ParamsType {
|
interface ParamsType {
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
module.exports = function(lab1, lab2) {
|
module.exports = function(lab1, lab2) {
|
||||||
const rgb2labArray1 = lab1
|
const rgb2labArray1 = lab1
|
||||||
const rgb2labArray2 = lab2
|
const rgb2labArray2 = lab2
|
||||||
|
|
||||||
@ -10,35 +10,35 @@ module.exports = function(lab1, lab2) {
|
|||||||
const a2 = rgb2labArray2[1]
|
const a2 = rgb2labArray2[1]
|
||||||
const b2 = rgb2labArray2[2]
|
const b2 = rgb2labArray2[2]
|
||||||
|
|
||||||
const avg_lp = (l1 + l2) / 2
|
const avg_lp = (l1 + l2) / 2
|
||||||
const c1 = Math.sqrt(Math.pow(a1, 2) + Math.pow(b1, 2))
|
const c1 = Math.sqrt(Math.pow(a1, 2) + Math.pow(b1, 2))
|
||||||
const c2 = Math.sqrt(Math.pow(a2, 2) + Math.pow(b2, 2))
|
const c2 = Math.sqrt(Math.pow(a2, 2) + Math.pow(b2, 2))
|
||||||
const avg_c = (c1 + c2) / 2
|
const avg_c = (c1 + c2) / 2
|
||||||
const g = (1 - Math.sqrt(Math.pow(avg_c, 7) / (Math.pow(avg_c, 7) + Math.pow(25, 7)))) / 2
|
const g = (1 - Math.sqrt(Math.pow(avg_c, 7) / (Math.pow(avg_c, 7) + Math.pow(25, 7)))) / 2
|
||||||
|
|
||||||
const a1p = a1 * (1 + g)
|
const a1p = a1 * (1 + g)
|
||||||
const a2p = a2 * (1 + g)
|
const a2p = a2 * (1 + g)
|
||||||
|
|
||||||
const c1p = Math.sqrt(Math.pow(a1p, 2) + Math.pow(b1, 2))
|
const c1p = Math.sqrt(Math.pow(a1p, 2) + Math.pow(b1, 2))
|
||||||
const c2p = Math.sqrt(Math.pow(a2p, 2) + Math.pow(b2, 2))
|
const c2p = Math.sqrt(Math.pow(a2p, 2) + Math.pow(b2, 2))
|
||||||
|
|
||||||
const avg_cp = (c1p + c2p) / 2
|
const avg_cp = (c1p + c2p) / 2
|
||||||
|
|
||||||
let h1p = rad2deg(Math.atan2(b1, a1p))
|
let h1p = rad2deg(Math.atan2(b1, a1p))
|
||||||
if (h1p < 0) {
|
if (h1p < 0) {
|
||||||
h1p = h1p + 360
|
h1p = h1p + 360
|
||||||
}
|
}
|
||||||
|
|
||||||
let h2p = rad2deg(Math.atan2(b2, a2p))
|
let h2p = rad2deg(Math.atan2(b2, a2p))
|
||||||
if (h2p < 0) {
|
if (h2p < 0) {
|
||||||
h2p = h2p + 360
|
h2p = h2p + 360
|
||||||
}
|
}
|
||||||
|
|
||||||
const avg_hp = Math.abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h1p) / 2
|
const avg_hp = Math.abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h1p) / 2
|
||||||
|
|
||||||
const t = 1 - 0.17 * Math.cos(deg2rad(avg_hp - 30)) + 0.24 * Math.cos(deg2rad(2 * avg_hp)) + 0.32 * Math.cos(deg2rad(3 * avg_hp + 6)) - 0.2 * Math.cos(deg2rad(4 * avg_hp - 63))
|
const t = 1 - 0.17 * Math.cos(deg2rad(avg_hp - 30)) + 0.24 * Math.cos(deg2rad(2 * avg_hp)) + 0.32 * Math.cos(deg2rad(3 * avg_hp + 6)) - 0.2 * Math.cos(deg2rad(4 * avg_hp - 63))
|
||||||
|
|
||||||
let delta_hp = h2p - h1p
|
let delta_hp = h2p - h1p
|
||||||
if (Math.abs(delta_hp) > 180) {
|
if (Math.abs(delta_hp) > 180) {
|
||||||
if (h2p <= h1p) {
|
if (h2p <= h1p) {
|
||||||
delta_hp += 360
|
delta_hp += 360
|
||||||
@ -48,18 +48,18 @@ module.exports = function(lab1, lab2) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const delta_lp = l2 - l1
|
const delta_lp = l2 - l1
|
||||||
const delta_cp = c2p - c1p
|
const delta_cp = c2p - c1p
|
||||||
|
|
||||||
delta_hp = 2 * Math.sqrt(c1p * c2p) * Math.sin(deg2rad(delta_hp) / 2)
|
delta_hp = 2 * Math.sqrt(c1p * c2p) * Math.sin(deg2rad(delta_hp) / 2)
|
||||||
|
|
||||||
const s_l = 1 + ((0.015 * Math.pow(avg_lp - 50, 2)) / Math.sqrt(20 + Math.pow(avg_lp - 50, 2)))
|
const s_l = 1 + ((0.015 * Math.pow(avg_lp - 50, 2)) / Math.sqrt(20 + Math.pow(avg_lp - 50, 2)))
|
||||||
const s_c = 1 + 0.045 * avg_cp
|
const s_c = 1 + 0.045 * avg_cp
|
||||||
const s_h = 1 + 0.015 * avg_cp * t
|
const s_h = 1 + 0.015 * avg_cp * t
|
||||||
|
|
||||||
const delta_ro = 30 * Math.exp(-(Math.pow((avg_hp - 275) / 25, 2)))
|
const delta_ro = 30 * Math.exp(-(Math.pow((avg_hp - 275) / 25, 2)))
|
||||||
const r_c = 2 * Math.sqrt(Math.pow(avg_cp, 7) / (Math.pow(avg_cp, 7) + Math.pow(25, 7)))
|
const r_c = 2 * Math.sqrt(Math.pow(avg_cp, 7) / (Math.pow(avg_cp, 7) + Math.pow(25, 7)))
|
||||||
const r_t = -r_c * Math.sin(2 * deg2rad(delta_ro))
|
const r_t = -r_c * Math.sin(2 * deg2rad(delta_ro))
|
||||||
|
|
||||||
const kl = 1; const kc = 1; const kh = 1
|
const kl = 1; const kc = 1; const kh = 1
|
||||||
|
|
||||||
@ -67,10 +67,10 @@ module.exports = function(lab1, lab2) {
|
|||||||
|
|
||||||
return delta_e
|
return delta_e
|
||||||
|
|
||||||
function rad2deg(rad) {
|
function rad2deg(rad) {
|
||||||
return 360 * rad / (2 * Math.PI)
|
return 360 * rad / (2 * Math.PI)
|
||||||
}
|
}
|
||||||
function deg2rad(deg) {
|
function deg2rad(deg) {
|
||||||
return (2 * Math.PI * deg) / 360
|
return (2 * Math.PI * deg) / 360
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
const xyz = require('./xyz')
|
const xyz = require('./xyz')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -17,7 +19,7 @@ module.exports = {
|
|||||||
if (l <= 8) {
|
if (l <= 8) {
|
||||||
y = (l * 100) / 903.3
|
y = (l * 100) / 903.3
|
||||||
y2 = (7.787 * (y / 100)) + (16 / 116)
|
y2 = (7.787 * (y / 100)) + (16 / 116)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
y = 100 * Math.pow((l + 16) / 116, 3)
|
y = 100 * Math.pow((l + 16) / 116, 3)
|
||||||
y2 = Math.pow(y / 100, 1 / 3)
|
y2 = Math.pow(y / 100, 1 / 3)
|
||||||
@ -32,11 +34,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extend xyz
|
// extend xyz
|
||||||
xyz.lab = function(xyz) {
|
xyz.lab = function(xyz1) {
|
||||||
let x = xyz[0]
|
let x = xyz1[0]
|
||||||
let y = xyz[1]
|
let y = xyz1[1]
|
||||||
let z = xyz[2]
|
let z = xyz1[2]
|
||||||
let l; let a; let b
|
|
||||||
|
|
||||||
x /= 95.047
|
x /= 95.047
|
||||||
y /= 100
|
y /= 100
|
||||||
@ -46,9 +47,9 @@ xyz.lab = function(xyz) {
|
|||||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116)
|
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116)
|
||||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116)
|
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116)
|
||||||
|
|
||||||
l = (116 * y) - 16
|
const l = (116 * y) - 16
|
||||||
a = 500 * (x - y)
|
const a = 500 * (x - y)
|
||||||
b = 200 * (y - z)
|
const b = 200 * (y - z)
|
||||||
|
|
||||||
return [l, a, b]
|
return [l, a, b]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'rgb',
|
name: 'rgb',
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
const rgb = require('./rgb')
|
const rgb = require('./rgb')
|
||||||
|
|
||||||
const xyz = {
|
const xyz = {
|
||||||
@ -86,15 +88,15 @@ xyz.rgb = function(_xyz, white) {
|
|||||||
g = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175)
|
g = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175)
|
||||||
b = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878)
|
b = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878)
|
||||||
|
|
||||||
r = r > 0.0031308
|
r = r > 0.0031308
|
||||||
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
||||||
: r = (r * 12.92)
|
: r = (r * 12.92)
|
||||||
|
|
||||||
g = g > 0.0031308
|
g = g > 0.0031308
|
||||||
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
||||||
: g = (g * 12.92)
|
: g = (g * 12.92)
|
||||||
|
|
||||||
b = b > 0.0031308
|
b = b > 0.0031308
|
||||||
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
||||||
: b = (b * 12.92)
|
: b = (b * 12.92)
|
||||||
|
|
||||||
@ -112,10 +114,10 @@ xyz.rgb = function(_xyz, white) {
|
|||||||
*
|
*
|
||||||
* @return {Array} XYZ channels
|
* @return {Array} XYZ channels
|
||||||
*/
|
*/
|
||||||
rgb.xyz = function(rgb, white) {
|
rgb.xyz = function(rgb1, white) {
|
||||||
let r = rgb[0] / 255
|
let r = rgb1[0] / 255
|
||||||
let g = rgb[1] / 255
|
let g = rgb1[1] / 255
|
||||||
let b = rgb[2] / 255
|
let b = rgb1[2] / 255
|
||||||
|
|
||||||
// assume sRGB
|
// assume sRGB
|
||||||
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92)
|
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92)
|
||||||
|
|||||||
@ -55,11 +55,11 @@ export function uint8ArrayToHex(raw) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 二进制转字符串(ascii)
|
// 二进制转字符串(ascii)
|
||||||
export function bufferToString(buffer) {
|
// export function bufferToString(buffer) {
|
||||||
let str = ''
|
// let str = ''
|
||||||
for (const code of buffer) {
|
// for (const code of buffer) {
|
||||||
if (code === 0) { break }
|
// if (code === 0) { break }
|
||||||
str += utf82string(code)
|
// str += utf82string(code)
|
||||||
}
|
// }
|
||||||
return str
|
// return str
|
||||||
}
|
// }
|
||||||
|
|||||||
@ -1,5 +1,27 @@
|
|||||||
import { IMG_CND_Prefix } from './constant'
|
import { IMG_CND_Prefix } from './constant'
|
||||||
|
/**
|
||||||
|
* 精度
|
||||||
|
* @param {*} num
|
||||||
|
* @param {*} precision
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const strip = (num, precision = 12) => {
|
||||||
|
return +parseFloat(num.toPrecision(precision))
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {千位分割付} number
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const numberWithCommas = ({ number = 0, digit = 2 }) => {
|
||||||
|
if (!Number.isNaN(Number(number))) {
|
||||||
|
// return parseFloat(number).toFixed(digit).replace(/^\B(?<!\.\d*)(?=(\d{3})+(?!\d))$/g, ",");
|
||||||
|
return parseFloat(number).toLocaleString('zh', { minimumFractionDigits: digit })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 移除井号
|
* 移除井号
|
||||||
* @param {String} val code 编码
|
* @param {String} val code 编码
|
||||||
@ -118,26 +140,6 @@ export const formatDateTime = (val, fmt = 'YYYY-MM-DD HH:mm:ss') => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 精度
|
|
||||||
* @param {*} num
|
|
||||||
* @param {*} precision
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const strip = (num, precision = 12) => {
|
|
||||||
return +parseFloat(num.toPrecision(precision))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换金额单位
|
|
||||||
* @param {*} num 金额 / 数值
|
|
||||||
* @param {*} digit 转换单位
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const formatMillionYuan = (num, digit = 10000) => {
|
|
||||||
return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数值保留两位小数
|
* 数值保留两位小数
|
||||||
* @param {*} x
|
* @param {*} x
|
||||||
@ -145,7 +147,7 @@ export const formatMillionYuan = (num, digit = 10000) => {
|
|||||||
*/
|
*/
|
||||||
export const toDecimal2 = (x) => {
|
export const toDecimal2 = (x) => {
|
||||||
let f = parseFloat(x)
|
let f = parseFloat(x)
|
||||||
if (isNaN(f)) {
|
if (Number.isNaN(f)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
f = `${f}`
|
f = `${f}`
|
||||||
@ -162,6 +164,16 @@ export const toDecimal2 = (x) => {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换金额单位
|
||||||
|
* @param {*} num 金额 / 数值
|
||||||
|
* @param {*} digit 转换单位
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const formatMillionYuan = (num, digit = 10000) => {
|
||||||
|
return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false }
|
||||||
|
}
|
||||||
|
|
||||||
// 匹配前缀 例如://xxx.com 或者 http://xxx.com 或者 https://xxx.com
|
// 匹配前缀 例如://xxx.com 或者 http://xxx.com 或者 https://xxx.com
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape
|
||||||
const URL_REGEXP = /(https?:)?\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&=]*)/gi
|
const URL_REGEXP = /(https?:)?\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&=]*)/gi
|
||||||
@ -231,21 +243,6 @@ export const isLabImage = (imgurl, rgb, suffix = '!w200') => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {千位分割付} number
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const numberWithCommas = ({ number = 0, digit = 2 }) => {
|
|
||||||
if (!isNaN(Number(number))) {
|
|
||||||
// return parseFloat(number).toFixed(digit).replace(/^\B(?<!\.\d*)(?=(\d{3})+(?!\d))$/g, ",");
|
|
||||||
return parseFloat(number).toLocaleString('zh', { minimumFractionDigits: digit })
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算数值大于指定值
|
// 计算数值大于指定值
|
||||||
export const setPriceUnit = (num, cls) => {
|
export const setPriceUnit = (num, cls) => {
|
||||||
if (cls) {
|
if (cls) {
|
||||||
|
|||||||
@ -1,6 +1,20 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import { BASE_URL } from '../constant'
|
import { BASE_URL } from '../constant'
|
||||||
|
|
||||||
|
// 绑定上下级
|
||||||
|
const bindParent = (share_user_id) => {
|
||||||
|
// 绑定上下级
|
||||||
|
Taro.request({
|
||||||
|
url: `${BASE_URL}/v1/mall/shortCode/bind`,
|
||||||
|
method: 'POST',
|
||||||
|
data: { share_user_id },
|
||||||
|
success: (res) => {
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
// 绑定上下级
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
// 解析短码(主要用于右上角按钮分享)
|
// 解析短码(主要用于右上角按钮分享)
|
||||||
export const analysisShortCodeApi = (val) => {
|
export const analysisShortCodeApi = (val) => {
|
||||||
// 解析短码
|
// 解析短码
|
||||||
@ -16,18 +30,3 @@ export const analysisShortCodeApi = (val) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绑定上下级
|
|
||||||
const bindParent = (share_user_id) => {
|
|
||||||
// 绑定上下级
|
|
||||||
Taro.request({
|
|
||||||
url: `${BASE_URL}/v1/mall/shortCode/bind`,
|
|
||||||
method: 'POST',
|
|
||||||
data: { share_user_id },
|
|
||||||
success: (res) => {
|
|
||||||
if (res.data.code == 0) {
|
|
||||||
// 绑定上下级
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
|
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { mppurchaseraddresslist } from '@/api/addressList'
|
import { MpPurchaserAddressList } from '@/api/addressList'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
|
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
|
||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
import { mpsaleOrderaddress } from '@/api/order'
|
import { MpSaleOrderAddress } from '@/api/order'
|
||||||
|
|
||||||
interface Params {
|
interface Params {
|
||||||
refresherEnabled?: boolean// 是否开启刷新
|
refresherEnabled?: boolean// 是否开启刷新
|
||||||
@ -19,12 +19,14 @@ interface Params {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 地址列表
|
// 地址列表
|
||||||
const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
|
const AddressList = (props: Params, AddressListRef) => {
|
||||||
const pages = Taro.getCurrentPages() // 获取当前的页面栈
|
const pages = Taro.getCurrentPages() // 获取当前的页面栈
|
||||||
const prevPage = pages[pages.length - 2]
|
const prevPage = pages[pages.length - 2]
|
||||||
|
|
||||||
|
// 焦点
|
||||||
|
const [focusId, setFocusId] = useState()
|
||||||
const { addButtonEnabled = true, focusBorderEnabled = false } = props
|
const { addButtonEnabled = true, focusBorderEnabled = false } = props
|
||||||
const { fetchData, state } = mppurchaseraddresslist()
|
const { fetchData, state } = MpPurchaserAddressList()
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const result = await fetchData({ purchaser_id: props.purchaser_id })
|
const result = await fetchData({ purchaser_id: props.purchaser_id })
|
||||||
@ -64,12 +66,10 @@ const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
|
|||||||
setRefreshState(false)
|
setRefreshState(false)
|
||||||
}
|
}
|
||||||
const data = Array.from({ length: 15 })
|
const data = Array.from({ length: 15 })
|
||||||
// 焦点
|
|
||||||
const [focusId, setFocusId] = useState()
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [addressObj, setAddressObj] = useState<any>({})
|
const [addressObj, setAddressObj] = useState<any>({})
|
||||||
// 列表选择
|
// 列表选择
|
||||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
const { fetchData: selectFetch } = MpSaleOrderAddress()
|
||||||
const handleSelect = async(item: any, index: number) => {
|
const handleSelect = async(item: any, index: number) => {
|
||||||
if (router.params.orderId && router.params.orderId != '-100') {
|
if (router.params.orderId && router.params.orderId != '-100') {
|
||||||
console.log(typeof (router.params.orderId) != 'undefined', 'router.params.orderId')
|
console.log(typeof (router.params.orderId) != 'undefined', 'router.params.orderId')
|
||||||
@ -126,7 +126,7 @@ const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
|
|||||||
// data.length>0?
|
// data.length>0?
|
||||||
// data.map((item,index)=>{
|
// data.map((item,index)=>{
|
||||||
return (
|
return (
|
||||||
<View onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
<View key={index} onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
||||||
<View className="address-user">
|
<View className="address-user">
|
||||||
{item.name}
|
{item.name}
|
||||||
<Text className="address-list-phone">{item.phone}</Text>
|
<Text className="address-list-phone">{item.phone}</Text>
|
||||||
@ -164,6 +164,6 @@ const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
|
|||||||
{addButtonEnabled && <Navigator url={`/pages/addAddress/index?type=add&purchaser_id=${Number(props.purchaser_id)}`} hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
{addButtonEnabled && <Navigator url={`/pages/addAddress/index?type=add&purchaser_id=${Number(props.purchaser_id)}`} hoverClass="none" className="add-address">添加收货地址</Navigator>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
|
||||||
export default AddressList
|
export default memo(forwardRef(AddressList))
|
||||||
|
|||||||
@ -20,8 +20,7 @@ interface prosObj {
|
|||||||
showDetail?: boolean
|
showDetail?: boolean
|
||||||
goodsObj?: any
|
goodsObj?: any
|
||||||
}
|
}
|
||||||
|
const BottomBtns = (props: prosObj, ref) => {
|
||||||
export default memo(forwardRef((props: prosObj, ref) => {
|
|
||||||
const {
|
const {
|
||||||
obj = {
|
obj = {
|
||||||
sale_mode: 0,
|
sale_mode: 0,
|
||||||
@ -192,4 +191,5 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(BottomBtns))
|
||||||
|
|||||||
@ -10,8 +10,7 @@ interface prosObj {
|
|||||||
clientId?: Number
|
clientId?: Number
|
||||||
clientName?: string
|
clientName?: string
|
||||||
}
|
}
|
||||||
|
const BottomCustomer = (props: prosObj) => {
|
||||||
export default memo((props: prosObj) => {
|
|
||||||
const {
|
const {
|
||||||
isDisabled = true,
|
isDisabled = true,
|
||||||
handSure,
|
handSure,
|
||||||
@ -32,4 +31,5 @@ export default memo((props: prosObj) => {
|
|||||||
<Button className={classnames(isDisabled ? styles.activeButton : styles.button)} disabled={isDisabled} onClick={() => { handSure?.() }}> 加入购物车</Button >
|
<Button className={classnames(isDisabled ? styles.activeButton : styles.button)} disabled={isDisabled} onClick={() => { handSure?.() }}> 加入购物车</Button >
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(BottomCustomer)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ interface ListParams{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 表单列表
|
// 表单列表
|
||||||
const FromList = memo((props: ListParams) => {
|
const FromList = (props: ListParams) => {
|
||||||
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false } = props
|
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -37,11 +37,11 @@ const FromList = memo((props: ListParams) => {
|
|||||||
&& <View><Text onClick={() => props.onInput && props.onInput({ detail: { value: '' } })} className="iconfont icon-qingkong" /></View>
|
&& <View><Text onClick={() => props.onInput && props.onInput({ detail: { value: '' } })} className="iconfont icon-qingkong" /></View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
: type == 'textarea'
|
: type == 'textarea'
|
||||||
? <Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />
|
? <Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />
|
||||||
: <>
|
: <>
|
||||||
{
|
{
|
||||||
props.value
|
props.value
|
||||||
? <View>{value}</View>
|
? <View>{value}</View>
|
||||||
: <View className="form-list-right-placeholder">
|
: <View className="form-list-right-placeholder">
|
||||||
{props.placeholder}
|
{props.placeholder}
|
||||||
@ -55,9 +55,5 @@ const FromList = memo((props: ListParams) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
|
||||||
|
|
||||||
const A = () => {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
export default FromList
|
export default memo(FromList)
|
||||||
|
|||||||
@ -17,9 +17,7 @@ interface ListParams{
|
|||||||
required?: boolean
|
required?: boolean
|
||||||
showIcon?: boolean // 是否显示右边的箭头,type=select
|
showIcon?: boolean // 是否显示右边的箭头,type=select
|
||||||
}
|
}
|
||||||
|
const FromListCertification = (props: ListParams) => {
|
||||||
// 表单列表
|
|
||||||
const FromList = memo((props: ListParams) => {
|
|
||||||
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false, showIcon = true } = props
|
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false, showIcon = true } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -37,11 +35,11 @@ const FromList = memo((props: ListParams) => {
|
|||||||
&& <View><Text onClick={() => props.onInput && props.onInput({ detail: { value: '' } })} className="iconfont icon-qingkong" /></View>
|
&& <View><Text onClick={() => props.onInput && props.onInput({ detail: { value: '' } })} className="iconfont icon-qingkong" /></View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
: type == 'textarea'
|
: type == 'textarea'
|
||||||
? <Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />
|
? <Textarea value={value} placeholder-class="phcolor" onInput={props?.onInput} placeholder={props.placeholder} />
|
||||||
: <>
|
: <>
|
||||||
{
|
{
|
||||||
props.value
|
props.value
|
||||||
? <View>{value}</View>
|
? <View>{value}</View>
|
||||||
: <View className="From-list-certification-right-placeholder">
|
: <View className="From-list-certification-right-placeholder">
|
||||||
{props.placeholder}
|
{props.placeholder}
|
||||||
@ -57,9 +55,8 @@ const FromList = memo((props: ListParams) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
|
||||||
|
|
||||||
const A = () => {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
export default FromList
|
// 表单列表
|
||||||
|
const FromList = memo(FromListCertification)
|
||||||
|
|
||||||
|
export default FromList
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||||
@ -10,20 +10,23 @@ interface Params {
|
|||||||
fetchData: (data: object) => any
|
fetchData: (data: object) => any
|
||||||
change?: (data: any) => void
|
change?: (data: any) => void
|
||||||
}
|
}
|
||||||
|
const InfiniteScrollPaging = (props: Params) => {
|
||||||
export default (props: Params) => {
|
|
||||||
const { query = {} } = props
|
const { query = {} } = props
|
||||||
useEffect(() => {
|
|
||||||
refreshDataRef.current = refreshData
|
// 加载刷新数据
|
||||||
dataRef.current = data
|
const [refreshData, setRefreshData] = useState({
|
||||||
getData({ moreStatus: true }, { moreStatus: true })
|
refreshStatus: false,
|
||||||
}, [])
|
moreStatus: false,
|
||||||
useEffect(() => {
|
page: 1,
|
||||||
if (!isEmptyObject(query)) {
|
size: 10,
|
||||||
setData({ list: [], total: 0 })
|
loading: false,
|
||||||
getData({ moreStatus: true }, { moreStatus: true })
|
})
|
||||||
}
|
const refreshDataRef = useRef({})
|
||||||
}, [query])
|
// 渲染(数据)
|
||||||
|
const [data, setData] = useState({
|
||||||
|
list: [],
|
||||||
|
total: 0,
|
||||||
|
})
|
||||||
const getData = async(startStatus, endStatus) => {
|
const getData = async(startStatus, endStatus) => {
|
||||||
const tRefreshDataRef = refreshDataRef.current as any
|
const tRefreshDataRef = refreshDataRef.current as any
|
||||||
setRefreshData({
|
setRefreshData({
|
||||||
@ -45,7 +48,7 @@ export default (props: Params) => {
|
|||||||
...endStatus,
|
...endStatus,
|
||||||
loading: false,
|
loading: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setData({
|
setData({
|
||||||
list: result.data.list,
|
list: result.data.list,
|
||||||
@ -59,7 +62,7 @@ export default (props: Params) => {
|
|||||||
loading: false,
|
loading: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert.none(result.msg)
|
alert.none(result.msg)
|
||||||
setRefreshData({
|
setRefreshData({
|
||||||
@ -70,20 +73,6 @@ export default (props: Params) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 加载刷新数据
|
|
||||||
const [refreshData, setRefreshData] = useState({
|
|
||||||
refreshStatus: false,
|
|
||||||
moreStatus: false,
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
|
||||||
loading: false,
|
|
||||||
})
|
|
||||||
const refreshDataRef = useRef({})
|
|
||||||
// 渲染(数据)
|
|
||||||
const [data, setData] = useState({
|
|
||||||
list: [],
|
|
||||||
total: 0,
|
|
||||||
})
|
|
||||||
const dataRef = useRef({})
|
const dataRef = useRef({})
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
const handleRefresh = async() => {
|
const handleRefresh = async() => {
|
||||||
@ -119,7 +108,17 @@ export default (props: Params) => {
|
|||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: data.list, total: data.total, status: refreshData.loading })
|
return dataLoadingStatus({ list: data.list, total: data.total, status: refreshData.loading })
|
||||||
}, [refreshData.loading])
|
}, [refreshData.loading])
|
||||||
|
useEffect(() => {
|
||||||
|
refreshDataRef.current = refreshData
|
||||||
|
dataRef.current = data
|
||||||
|
getData({ moreStatus: true }, { moreStatus: true })
|
||||||
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isEmptyObject(query)) {
|
||||||
|
setData({ list: [], total: 0 })
|
||||||
|
getData({ moreStatus: true }, { moreStatus: true })
|
||||||
|
}
|
||||||
|
}, [query])
|
||||||
return (
|
return (
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
refresherEnabled
|
refresherEnabled
|
||||||
@ -127,9 +126,11 @@ export default (props: Params) => {
|
|||||||
moreStatus={refreshData.moreStatus}
|
moreStatus={refreshData.moreStatus}
|
||||||
selfOnRefresherRefresh={handleRefresh}
|
selfOnRefresherRefresh={handleRefresh}
|
||||||
selfonScrollToLower={handleMoreLoad}
|
selfonScrollToLower={handleMoreLoad}
|
||||||
statusMore={statusMore}
|
statusMore={statusMore}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default InfiniteScrollPaging
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import { Image, View } from '@tarojs/components'
|
import { Image, View } from '@tarojs/components'
|
||||||
import Taro from '@tarojs/taro'
|
|
||||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import LabAndImgShow from '../LabAndImgShow'
|
import LabAndImgShow from '../LabAndImgShow'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Preview from '@/pages/details/components/preview'
|
import { formatImgUrl } from '@/common/format'
|
||||||
import { formatImgUrl, formatRemoveHashTag } from '@/common/format'
|
|
||||||
|
|
||||||
// 该组件宽高为100%需调整外层元素宽高
|
// 该组件宽高为100%需调整外层元素宽高
|
||||||
interface Param {
|
interface Param {
|
||||||
@ -17,14 +15,14 @@ interface Param {
|
|||||||
showStatus?: true | false
|
showStatus?: true | false
|
||||||
onClick?: (val: Param['value']) => void
|
onClick?: (val: Param['value']) => void
|
||||||
}
|
}
|
||||||
export default memo(({ value, onClick, showStatus = false }: Param) => {
|
const LabAndImg = ({ value, onClick, showStatus = false }: Param) => {
|
||||||
const [imgs, setImgs] = useState<string[]>([])
|
const [imgs, setImgs] = useState<string[]>([])
|
||||||
|
|
||||||
// lab是否都是0
|
// lab是否都是0
|
||||||
const rgbStyle = useMemo(() => {
|
const rgbStyle = useMemo(() => {
|
||||||
if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) {
|
if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) {
|
||||||
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -63,4 +61,5 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
|
|||||||
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LabAndImg)
|
||||||
|
|||||||
@ -15,20 +15,14 @@ export interface colorParams {
|
|||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
showNumber?: number // 图片显示张数,0不限制
|
showNumber?: number // 图片显示张数,0不限制
|
||||||
}
|
}
|
||||||
export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) => {
|
const LabAndImgShow = ({ value, show = false, onClose, showNumber = 1 }: colorParams) => {
|
||||||
useEffect(() => {
|
|
||||||
if (show && rgbStyle) { setLabShow(() => true) }
|
|
||||||
if (show && value?.texture_url) { onShowImage() }
|
|
||||||
if (!show) { setLabShow(() => false) }
|
|
||||||
}, [show])
|
|
||||||
|
|
||||||
// 显示颜色
|
// 显示颜色
|
||||||
const [labShow, setLabShow] = useState(false)
|
const [labShow, setLabShow] = useState(false)
|
||||||
// lab是否都是0
|
// lab是否都是0
|
||||||
const rgbStyle = useMemo(() => {
|
const rgbStyle = useMemo(() => {
|
||||||
if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) {
|
if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) {
|
||||||
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -49,7 +43,11 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
|
|||||||
urls: n_res,
|
urls: n_res,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (show && rgbStyle) { setLabShow(() => true) }
|
||||||
|
if (show && value?.texture_url) { onShowImage() }
|
||||||
|
if (!show) { setLabShow(() => false) }
|
||||||
|
}, [show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{labShow && (
|
{labShow && (
|
||||||
@ -63,3 +61,5 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default LabAndImgShow
|
||||||
|
|||||||
@ -8,12 +8,12 @@ interface Params{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 消息提示
|
// 消息提示
|
||||||
const Message = memo((props: Params) => {
|
const Message = (props: Params) => {
|
||||||
return (
|
return (
|
||||||
<View className="message-custom-tips">
|
<View className="message-custom-tips">
|
||||||
<Text className="iconfont icon-zhuyi"></Text> {props.text}
|
<Text className="iconfont icon-zhuyi"></Text> {props.text}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default Message
|
export default memo(Message)
|
||||||
|
|||||||
@ -17,15 +17,9 @@ interface Props {
|
|||||||
showPopup: boolean
|
showPopup: boolean
|
||||||
popupClose: () => void
|
popupClose: () => void
|
||||||
}
|
}
|
||||||
|
const RefundCodelist = (props: Props) => {
|
||||||
export default memo((props: Props) => {
|
|
||||||
const { fetchData: payFetch } = GetReturnPayCode()
|
const { fetchData: payFetch } = GetReturnPayCode()
|
||||||
const [PicUrl, setPicUrl] = useState<string>('')
|
const [PicUrl, setPicUrl] = useState<string>('')
|
||||||
useEffect(() => {
|
|
||||||
// 判断进来的是否是空对象,减少性能问题
|
|
||||||
const length = Object.keys(props.obj)
|
|
||||||
if (length.length > 0) { getPic() }
|
|
||||||
}, [props.obj])
|
|
||||||
|
|
||||||
const getPic = async() => {
|
const getPic = async() => {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
@ -142,11 +136,12 @@ export default memo((props: Props) => {
|
|||||||
|
|
||||||
// 检查是否开启保存图片权限
|
// 检查是否开启保存图片权限
|
||||||
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' })
|
||||||
const saveImageCheck = async() => {
|
|
||||||
const res = await check()
|
|
||||||
res && saveImage()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// 判断进来的是否是空对象,减少性能问题
|
||||||
|
const length = Object.keys(props.obj)
|
||||||
|
if (length.length > 0) { getPic() }
|
||||||
|
}, [props.obj])
|
||||||
// 保存图片
|
// 保存图片
|
||||||
const saveImage = () => {
|
const saveImage = () => {
|
||||||
const time = new Date().valueOf()
|
const time = new Date().valueOf()
|
||||||
@ -171,7 +166,10 @@ export default memo((props: Props) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const saveImageCheck = async() => {
|
||||||
|
const res = await check()
|
||||||
|
res && saveImage()
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Popup show={props.showPopup} title="退款码单" onClose={() => props.popupClose?.()}>
|
<Popup show={props.showPopup} title="退款码单" onClose={() => props.popupClose?.()}>
|
||||||
<View className={styles.popupBox}>
|
<View className={styles.popupBox}>
|
||||||
@ -184,4 +182,5 @@ export default memo((props: Props) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(RefundCodelist)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ interface PropsType {
|
|||||||
onSelect?: (data: { id: number; name: string }) => void
|
onSelect?: (data: { id: number; name: string }) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const segmentedControl: FC<PropsType> = (props) => {
|
const SegmentedControl: FC<PropsType> = (props) => {
|
||||||
const [selectInfo, setSelectInfo] = useState({
|
const [selectInfo, setSelectInfo] = useState({
|
||||||
selected: -1, // 当前选中的id
|
selected: -1, // 当前选中的id
|
||||||
tabId: '', // 需要滚动到的id
|
tabId: '', // 需要滚动到的id
|
||||||
@ -69,4 +69,4 @@ const segmentedControl: FC<PropsType> = (props) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export default segmentedControl
|
export default SegmentedControl
|
||||||
|
|||||||
@ -18,20 +18,20 @@ interface EnumList {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
// 营销部门
|
// 营销部门
|
||||||
const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
const SelectSaleType = (props: SelectSaleTypeProps, ref) => {
|
||||||
const selectName = '营销部门'
|
const selectName = '营销部门'
|
||||||
|
|
||||||
const { onChange, onCloseOverlay } = props
|
const { onChange, onCloseOverlay } = props
|
||||||
console.log(props)
|
console.log(props)
|
||||||
const { fetchData } = EnumMarketingDepartmentApi()
|
const { fetchData } = EnumMarketingDepartmentApi()
|
||||||
|
|
||||||
|
const [enumList, setEnumList] = useState<EnumList[]>([])
|
||||||
|
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
||||||
}
|
}
|
||||||
|
|
||||||
const [enumList, setEnumList] = useState<EnumList[]>([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData()
|
getData()
|
||||||
}, [])
|
}, [])
|
||||||
@ -67,9 +67,9 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
|
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
|
||||||
<View className={styles.grid}>
|
<View className={styles.grid}>
|
||||||
{!!enumList.length
|
{!!enumList.length
|
||||||
&& enumList.map((item: EnumList) => {
|
&& enumList.map((item: EnumList, key) => {
|
||||||
return (
|
return (
|
||||||
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</FilterButton>
|
</FilterButton>
|
||||||
)
|
)
|
||||||
@ -77,5 +77,5 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
export default SelectSaleType
|
export default memo(forwardRef(SelectSaleType))
|
||||||
|
|||||||
@ -22,20 +22,19 @@ interface EnumList {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
// 销售排行指标
|
// 销售排行指标
|
||||||
const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
|
const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = (props) => {
|
||||||
const selectName = '排行指标'
|
const selectName = '排行指标'
|
||||||
|
|
||||||
const { onChange, dropDownStyle, dropDownClassName } = props
|
const { onChange, dropDownStyle, dropDownClassName } = props
|
||||||
console.log(props)
|
console.log(props)
|
||||||
const { fetchData } = SaleOrderDataFormdataFormStatus()
|
const { fetchData } = SaleOrderDataFormdataFormStatus()
|
||||||
|
|
||||||
|
const [enumList, setEnumList] = useState<EnumList[]>([])
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
||||||
}
|
}
|
||||||
|
|
||||||
const [enumList, setEnumList] = useState<EnumList[]>([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData()
|
getData()
|
||||||
}, [])
|
}, [])
|
||||||
@ -58,9 +57,9 @@ const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
|
|||||||
<DropDownItem title={displayTitle} customClassName={dropDownClassName} customStyle={dropDownStyle} value={currentValue} activeColor="#337fff" showOverlay={false}>
|
<DropDownItem title={displayTitle} customClassName={dropDownClassName} customStyle={dropDownStyle} value={currentValue} activeColor="#337fff" showOverlay={false}>
|
||||||
<View className={classnames(styles.grid)}>
|
<View className={classnames(styles.grid)}>
|
||||||
{!!enumList.length
|
{!!enumList.length
|
||||||
&& enumList.map((item: EnumList) => {
|
&& enumList.map((item: EnumList, key) => {
|
||||||
return (
|
return (
|
||||||
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</FilterButton>
|
</FilterButton>
|
||||||
)
|
)
|
||||||
@ -68,5 +67,5 @@ const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
|
|||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
export default SelectSaleRankingIndicators
|
export default memo(SelectSaleRankingIndicators)
|
||||||
|
|||||||
@ -19,19 +19,18 @@ interface EnumList {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
// 销售类型
|
// 销售类型
|
||||||
const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
const SelectSaleType = (props: SelectSaleTypeProps, ref) => {
|
||||||
const selectName = '销售类型'
|
const selectName = '销售类型'
|
||||||
const { onChange, defaultValue = 0, onCloseOverlay } = props
|
const { onChange, defaultValue = 0, onCloseOverlay } = props
|
||||||
console.log(props)
|
console.log(props)
|
||||||
const { fetchData } = EnumSalesTypeApi()
|
const { fetchData } = EnumSalesTypeApi()
|
||||||
|
const [enumList, setEnumList] = useState<EnumList[]>([])
|
||||||
|
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
|
||||||
}
|
}
|
||||||
|
|
||||||
const [enumList, setEnumList] = useState<EnumList[]>([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData()
|
getData()
|
||||||
}, [])
|
}, [])
|
||||||
@ -68,9 +67,9 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
|
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
|
||||||
<View className={styles.grid}>
|
<View className={styles.grid}>
|
||||||
{!!enumList.length
|
{!!enumList.length
|
||||||
&& enumList.map((item: EnumList) => {
|
&& enumList.map((item: EnumList, key) => {
|
||||||
return (
|
return (
|
||||||
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</FilterButton>
|
</FilterButton>
|
||||||
)
|
)
|
||||||
@ -78,5 +77,5 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
export default SelectSaleType
|
export default memo(forwardRef(SelectSaleType))
|
||||||
|
|||||||
@ -78,7 +78,7 @@ const FilterTimeOptions = {
|
|||||||
type Key = keyof typeof FilterTimeOptions
|
type Key = keyof typeof FilterTimeOptions
|
||||||
type Value = typeof FilterTimeOptions[Key]
|
type Value = typeof FilterTimeOptions[Key]
|
||||||
|
|
||||||
const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
const SelectTimePicker = (props: SelectSaleTypeProps, ref) => {
|
||||||
const { onChange: change, onCloseOverlay, defaultValue = '0', timeOptions = FilterTimeOptions } = props
|
const { onChange: change, onCloseOverlay, defaultValue = '0', timeOptions = FilterTimeOptions } = props
|
||||||
// rerender 的时候需要更新 ref 的值
|
// rerender 的时候需要更新 ref 的值
|
||||||
const Options = useRef({ ...timeOptions, custom: FilterTimeOptions.custom })
|
const Options = useRef({ ...timeOptions, custom: FilterTimeOptions.custom })
|
||||||
@ -98,6 +98,7 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
const handClose = () => {
|
const handClose = () => {
|
||||||
setShowTime(false)
|
setShowTime(false)
|
||||||
}
|
}
|
||||||
|
const customFilterButtonText = useRef('自定义时间')
|
||||||
|
|
||||||
const handleClick = (key: Key) => {
|
const handleClick = (key: Key) => {
|
||||||
setCurrentValue(key)
|
setCurrentValue(key)
|
||||||
@ -118,7 +119,6 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// const [customFilterButtonText, setCustomFilterButtonText] = useState('自定义时间')
|
// const [customFilterButtonText, setCustomFilterButtonText] = useState('自定义时间')
|
||||||
const customFilterButtonText = useRef('自定义时间')
|
|
||||||
|
|
||||||
// 点击自定义时间
|
// 点击自定义时间
|
||||||
const handleCustomTime = () => {
|
const handleCustomTime = () => {
|
||||||
@ -151,9 +151,9 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
<View className={styles.grid} style={{ paddingBottom: '24rpx' }}>
|
<View className={styles.grid} style={{ paddingBottom: '24rpx' }}>
|
||||||
{Object.entries(Options.current)
|
{Object.entries(Options.current)
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
.map(([key, value]) => {
|
.map(([key, value], index) => {
|
||||||
return (
|
return (
|
||||||
<FilterButton isActive={key === currentValue} onClick={() => handleClick(key as Key)}>
|
<FilterButton key={index} isActive={key === currentValue} onClick={() => handleClick(key as Key)}>
|
||||||
{value.name}
|
{value.name}
|
||||||
</FilterButton>
|
</FilterButton>
|
||||||
)
|
)
|
||||||
@ -167,5 +167,5 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
|
|||||||
<TimePickerPopup start={currentDate.start} end={currentDate.end} showTime={showTime} closePopup={handClose} onSelectDate={onSelectDate}></TimePickerPopup>
|
<TimePickerPopup start={currentDate.start} end={currentDate.end} showTime={showTime} closePopup={handClose} onSelectDate={onSelectDate}></TimePickerPopup>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
export default SelectTimePicker
|
export default memo(forwardRef(SelectTimePicker))
|
||||||
|
|||||||
@ -20,8 +20,7 @@ interface Param {
|
|||||||
fixedBottom?: true|false // 是否固定在底部
|
fixedBottom?: true|false // 是否固定在底部
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
||||||
export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|
||||||
// 售后订单状态
|
// 售后订单状态
|
||||||
const {
|
const {
|
||||||
ReturnStageApplying,
|
ReturnStageApplying,
|
||||||
@ -92,10 +91,10 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
const submitBtns = throttle((val, index) => {
|
const submitBtns = throttle((val, index) => {
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
cancelOrder({ title: '要取消退货吗?', val })
|
cancelOrder({ title: '要取消退货吗?', val })
|
||||||
}
|
}
|
||||||
else if (val == 6) {
|
else if (val == 6) {
|
||||||
cancelOrder({ title: '要取消退款吗?', val })
|
cancelOrder({ title: '要取消退款吗?', val })
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
onClick?.(val)
|
onClick?.(val)
|
||||||
}
|
}
|
||||||
@ -112,11 +111,11 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
alert.success('取消成功')
|
alert.success('取消成功')
|
||||||
onClick?.(val)
|
onClick?.(val)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert.none(res.msg)
|
alert.none(res.msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res.cancel) {
|
else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -155,4 +154,5 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
|||||||
</View>}
|
</View>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(AfterOrderBtns)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Param {
|
|||||||
number: number // 数字
|
number: number // 数字
|
||||||
status: 0 | 1 | 2 // 0 小型,1中型,2大
|
status: 0 | 1 | 2 // 0 小型,1中型,2大
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, status = 1 }: Param) => {
|
const AmountShow = ({ number = 0, status = 1 }: Param) => {
|
||||||
const priceDom = useCallback(() => {
|
const priceDom = useCallback(() => {
|
||||||
const res = number.toFixed(2).split('.')
|
const res = number.toFixed(2).split('.')
|
||||||
const int_num = `${parseInt(res[0])}`
|
const int_num = `${parseInt(res[0])}`
|
||||||
@ -22,4 +22,5 @@ export default memo(({ number = 0, status = 1 }: Param) => {
|
|||||||
)
|
)
|
||||||
}, [number])
|
}, [number])
|
||||||
return <View className={classnames(styles.order_price_num, status == 1 && styles.emphasis_num, status == 2 && styles.emphasis_num_big)}>{priceDom()}</View>
|
return <View className={classnames(styles.order_price_num, status == 1 && styles.emphasis_num, status == 2 && styles.emphasis_num_big)}>{priceDom()}</View>
|
||||||
})
|
}
|
||||||
|
export default memo(AmountShow)
|
||||||
|
|||||||
@ -12,25 +12,23 @@ interface params {
|
|||||||
swiperOnClick?: (val: item) => void
|
swiperOnClick?: (val: item) => void
|
||||||
style?: Object
|
style?: Object
|
||||||
}
|
}
|
||||||
export default (props: params) => {
|
const Banner = (props: params) => {
|
||||||
const { swiperOnClick, style = {} } = props
|
const { swiperOnClick, style = {} } = props
|
||||||
|
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
const { fetchData, state } = GetBannerList()
|
const { fetchData, state } = GetBannerList()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const getData = async() => {
|
const getData = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
setList(res.data?.list)
|
setList(res.data?.list)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getData()
|
||||||
|
}, [])
|
||||||
|
|
||||||
const skipTo = (item) => {
|
const skipTo = (item) => {
|
||||||
if (item.jump_type == 2 || item.jump_type == 0) {
|
if (item.jump_type == 2 || item.jump_type == 0) {
|
||||||
goLink(`${item.link}&title=${item.title}`)
|
goLink(`${item.link}&title=${item.title}`)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goLink(item.link)
|
goLink(item.link)
|
||||||
}
|
}
|
||||||
@ -52,3 +50,5 @@ export default (props: params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Banner
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface params {
|
|||||||
show?: true | false
|
show?: true | false
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
}
|
}
|
||||||
export default ({ show, onClose }: params) => {
|
const BindSalesManPopUp = ({ show, onClose }: params) => {
|
||||||
const onCustomer = async() => {
|
const onCustomer = async() => {
|
||||||
const res = await Taro.showModal({
|
const res = await Taro.showModal({
|
||||||
title: '是否拨打服务热线',
|
title: '是否拨打服务热线',
|
||||||
@ -54,3 +54,5 @@ export default ({ show, onClose }: params) => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default BindSalesManPopUp
|
||||||
|
|||||||
@ -12,8 +12,7 @@ interface params {
|
|||||||
onOff: () => void
|
onOff: () => void
|
||||||
onFind: () => void
|
onFind: () => void
|
||||||
}
|
}
|
||||||
|
const Popup = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
||||||
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
|
||||||
const [popupShow, setPopupShow] = useState(show)
|
const [popupShow, setPopupShow] = useState(show)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPopupShow(show)
|
setPopupShow(show)
|
||||||
@ -31,38 +30,44 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
<View className={style.list}>
|
<View className={style.list}>
|
||||||
<ScrollView scrollY className={style.scroll}>
|
<ScrollView scrollY className={style.scroll}>
|
||||||
{
|
{
|
||||||
(state.devices && state.devices.length > 0) && state?.devices.map((item) => {
|
(state.devices && state.devices.length > 0)
|
||||||
return (
|
? state?.devices.map((item, key) => {
|
||||||
<View className={style.item} onClick={() => onLink(item)}>
|
return (
|
||||||
<View>{item.name}</View>
|
<View className={style.item} onClick={() => onLink(item)} key={key}>
|
||||||
{
|
<View>{item.name}</View>
|
||||||
(!state.connecting && !state.connected) && <View >链接</View>
|
{
|
||||||
|| (state.connecting && item.deviceId == state.connecting.deviceId) && <View className={style.link_ing}>正在链接...</View>
|
(!state.connecting && !state.connected)
|
||||||
|| (state.connected && item.deviceId == state.connected.deviceId) && <View className={style.link_success}>链接成功</View>
|
? <View >链接</View>
|
||||||
}
|
: (state.connecting && (item.deviceId == state.connecting.deviceId))
|
||||||
</View>
|
? <View className={style.link_ing}>正在链接...</View>
|
||||||
)
|
: (state.connected && (item.deviceId == state.connected.deviceId)) ? <View className={style.link_success}>链接成功</View> : null
|
||||||
})
|
}
|
||||||
|| <View className={style.noDevice}>
|
</View>
|
||||||
{
|
)
|
||||||
(!state.discovering) && <>
|
})
|
||||||
<View>暂无设备,请按以下条件检查</View>
|
: <View className={style.noDevice}>
|
||||||
<View className={style.n_item}>1.请确保取色仪处于激活状态</View>
|
{
|
||||||
<View className={style.n_item}>2.请确保取色仪没有链接其他设备</View>
|
(!state.discovering)
|
||||||
<View className={style.n_item}>3.请打开手机定位</View>
|
? <>
|
||||||
</>
|
<View>暂无设备,请按以下条件检查</View>
|
||||||
|| <View>设备搜索中</View>
|
<View className={style.n_item}>1.请确保取色仪处于激活状态</View>
|
||||||
}
|
<View className={style.n_item}>2.请确保取色仪没有链接其他设备</View>
|
||||||
|
<View className={style.n_item}>3.请打开手机定位</View>
|
||||||
|
</>
|
||||||
|
: <View>设备搜索中</View>
|
||||||
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
}
|
}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
state.connected && <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}>断开链接</View>
|
state.connected
|
||||||
|| (!state.connected && state.discovering) && <View className={`${style.footer} ${style.finding}`}>搜索中<Loading width={30} color="orange" /></View>
|
? <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}>断开链接</View>
|
||||||
|| <View className={style.footer} onClick={onFind}>重新搜索</View>
|
: (!state.connected && state.discovering)
|
||||||
|
? <View className={`${style.footer} ${style.finding}`}>搜索中<Loading width={30} color="orange" /></View>
|
||||||
|
: <View className={style.footer} onClick={onFind}>重新搜索</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View className={style.mask} onClick={onCloseListener}></View>
|
<View className={style.mask} onClick={onCloseListener}></View>
|
||||||
@ -70,4 +75,5 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Popup)
|
||||||
|
|||||||
@ -22,7 +22,7 @@ interface params {
|
|||||||
customClassName?: string
|
customClassName?: string
|
||||||
customTextClass?: string
|
customTextClass?: string
|
||||||
}
|
}
|
||||||
export default forwardRef((props: params, ref) => {
|
const Checkbox = (props: params, ref) => {
|
||||||
const {
|
const {
|
||||||
onSelect,
|
onSelect,
|
||||||
onClose,
|
onClose,
|
||||||
@ -61,7 +61,7 @@ export default forwardRef((props: params, ref) => {
|
|||||||
const res = !selected
|
const res = !selected
|
||||||
if (res) {
|
if (res) {
|
||||||
onSelect?.()
|
onSelect?.()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
onClose?.()
|
onClose?.()
|
||||||
}
|
}
|
||||||
@ -116,4 +116,5 @@ export default forwardRef((props: params, ref) => {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(Checkbox)
|
||||||
|
|||||||
@ -16,7 +16,7 @@ interface params {
|
|||||||
unit?: string
|
unit?: string
|
||||||
disable?: boolean // 是否禁用
|
disable?: boolean // 是否禁用
|
||||||
}
|
}
|
||||||
export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum = 0, onChange: onValueChange, onBlue, onClickBtn, unit = '', disable = false }: params) => {
|
const Counter = ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum = 0, onChange: onValueChange, onBlue, onClickBtn, unit = '', disable = false }: params) => {
|
||||||
const [value, setValue] = usePropsValue<number>({
|
const [value, setValue] = usePropsValue<number>({
|
||||||
value: defaultNum,
|
value: defaultNum,
|
||||||
defaultValue: defaultNum,
|
defaultValue: defaultNum,
|
||||||
@ -24,6 +24,19 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
onValueChange && onValueChange(nextValue)
|
onValueChange && onValueChange(nextValue)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 保留小数
|
||||||
|
const formatDigits = (num) => {
|
||||||
|
num = `${num}`
|
||||||
|
if (num.includes('.') && digits > 0) {
|
||||||
|
console.log('num::', num.includes('.'))
|
||||||
|
const res = num.split('.')
|
||||||
|
const last_num = res[1].substr(0, digits)
|
||||||
|
return `${res[0]}.${last_num}`
|
||||||
|
}
|
||||||
|
return parseFloat(num)
|
||||||
|
}
|
||||||
|
|
||||||
// 加号
|
// 加号
|
||||||
const onPlus = (event) => {
|
const onPlus = (event) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
@ -44,18 +57,6 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
onClickBtn?.(parseFloat(num_res))
|
onClickBtn?.(parseFloat(num_res))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保留小数
|
|
||||||
const formatDigits = (num) => {
|
|
||||||
num = `${num}`
|
|
||||||
if (num.includes('.') && digits > 0) {
|
|
||||||
console.log('num::', num.includes('.'))
|
|
||||||
const res = num.split('.')
|
|
||||||
const last_num = res[1].substr(0, digits)
|
|
||||||
return `${res[0]}.${last_num}`
|
|
||||||
}
|
|
||||||
return parseFloat(num)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查数据
|
// 检查数据
|
||||||
const checkData = (val) => {
|
const checkData = (val) => {
|
||||||
const num = parseFloat(val)
|
const num = parseFloat(val)
|
||||||
@ -70,24 +71,24 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
setValue(minNum)
|
setValue(minNum)
|
||||||
return minNum
|
return minNum
|
||||||
}
|
}
|
||||||
else if (!isNaN(Number(res))) {
|
else if (!Number.isNaN(Number(res))) {
|
||||||
let count = formatDigits(res)
|
let count = formatDigits(res)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue(count as number)
|
setValue(count as number)
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const num = parseFloat(res)
|
const num = parseFloat(res)
|
||||||
if (!isNaN(num)) {
|
if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue(count as number)
|
setValue(count as number)
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setValue(defaultNum)
|
setValue(defaultNum)
|
||||||
return defaultNum
|
return defaultNum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,13 +96,13 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
const num = parseFloat(String(value))
|
const num = parseFloat(String(value))
|
||||||
console.log('onInputEven res===>', num)
|
console.log('onInputEven res===>', num)
|
||||||
|
|
||||||
if (!isNaN(num)) {
|
if (!Number.isNaN(num)) {
|
||||||
let count = formatDigits(num)
|
let count = formatDigits(num)
|
||||||
count = checkData(count)
|
count = checkData(count)
|
||||||
setValue(count as number)
|
setValue(count as number)
|
||||||
onBlue?.(count as number)
|
onBlue?.(count as number)
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setValue(defaultNum)
|
setValue(defaultNum)
|
||||||
onBlue?.(defaultNum)
|
onBlue?.(defaultNum)
|
||||||
@ -109,7 +110,7 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const noop = (e) => {
|
const noop = (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
@ -126,3 +127,5 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Counter
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { View } from '@tarojs/components'
|
|||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export default memo(() => {
|
const DotLoading = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.load_box}>
|
<View className={styles.load_box}>
|
||||||
@ -14,4 +14,5 @@ export default memo(() => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(DotLoading)
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import Iconfont from '../iconfont/iconfont'
|
|||||||
import Popup from '../popup'
|
import Popup from '../popup'
|
||||||
import Cell from '../cell'
|
import Cell from '../cell'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { usePropsValue } from '@/use/useCommon'
|
|
||||||
// 弹窗选择向上弹窗还是向下弹窗
|
// 弹窗选择向上弹窗还是向下弹窗
|
||||||
type Direction = 'up' | 'down'
|
type Direction = 'up' | 'down'
|
||||||
// 配置 菜单可选项
|
// 配置 菜单可选项
|
||||||
@ -36,8 +35,7 @@ interface PropsType extends DropDownEvent {
|
|||||||
customStyle?: React.CSSProperties
|
customStyle?: React.CSSProperties
|
||||||
hasBottomBtn?: boolean // 底部有按钮不允许点击蒙层关闭
|
hasBottomBtn?: boolean // 底部有按钮不允许点击蒙层关闭
|
||||||
}
|
}
|
||||||
|
const DropDownItem = (props: PropsType, ref) => {
|
||||||
export default forwardRef((props: PropsType, ref) => {
|
|
||||||
const { children, direction = 'down', title = '', value, options = [], change, activeColor, showOverlay = true, hasBottomBtn = false, customClassName, customStyle, onCloseOverlay } = props
|
const { children, direction = 'down', title = '', value, options = [], change, activeColor, showOverlay = true, hasBottomBtn = false, customClassName, customStyle, onCloseOverlay } = props
|
||||||
|
|
||||||
const [showPopup, setShowPopup] = useState(false)
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
@ -61,9 +59,9 @@ export default forwardRef((props: PropsType, ref) => {
|
|||||||
|
|
||||||
const defaultOptions = useMemo(() => {
|
const defaultOptions = useMemo(() => {
|
||||||
const currentValue = value
|
const currentValue = value
|
||||||
return options?.map(({ text, value }) => {
|
return options?.map(({ text, value }, key) => {
|
||||||
currentValue === value && setText(text)
|
currentValue === value && setText(text)
|
||||||
return <Cell title={text} desc="" isLink onClick={() => handleClickOption(value)}></Cell>
|
return <Cell key={key} title={text} desc="" isLink onClick={() => handleClickOption(value)}></Cell>
|
||||||
})
|
})
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
@ -144,4 +142,5 @@ export default forwardRef((props: PropsType, ref) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(DropDownItem)
|
||||||
|
|||||||
@ -6,8 +6,7 @@ interface PropsObj {
|
|||||||
picUrl?: string
|
picUrl?: string
|
||||||
text?: string
|
text?: string
|
||||||
}
|
}
|
||||||
|
const Empty = (pros: PropsObj) => {
|
||||||
export default memo((pros: PropsObj) => {
|
|
||||||
const {
|
const {
|
||||||
picUrl = '',
|
picUrl = '',
|
||||||
text = '无搜索历史',
|
text = '无搜索历史',
|
||||||
@ -19,4 +18,5 @@ export default memo((pros: PropsObj) => {
|
|||||||
<View className={styles.text}>{text}</View>
|
<View className={styles.text}>{text}</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Empty)
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useState } from
|
|||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import AmountShow from '../amountShow'
|
import AmountShow from '../amountShow'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { formatKbPrice } from '@/common/common'
|
|
||||||
|
|
||||||
interface Param {
|
interface Param {
|
||||||
style?: Object
|
style?: Object
|
||||||
@ -17,7 +16,7 @@ interface Param {
|
|||||||
messageShow?: true|false
|
messageShow?: true|false
|
||||||
numberFormat?: 'number'|'text' // 数字还是字符串
|
numberFormat?: 'number'|'text' // 数字还是字符串
|
||||||
}
|
}
|
||||||
export default memo(({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false, numberFormat = 'number' }: Param) => {
|
const EstimatedAmount = ({ number = 0, titleStatus = true, title = '', messageTitle = '', numberStatus = 1, messageWidth = 430, messageShow = false, numberFormat = 'number' }: Param) => {
|
||||||
const [show, setShow] = useState(messageShow)
|
const [show, setShow] = useState(messageShow)
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setShow(false)
|
setShow(false)
|
||||||
@ -28,14 +27,6 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
|
|
||||||
const [style, setStyle] = useState<{ top: string }>()
|
const [style, setStyle] = useState<{ top: string }>()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (show) {
|
|
||||||
getDomDes('#message')
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setStyle(() => ({ top: '0' }))
|
|
||||||
}
|
|
||||||
}, [show])
|
|
||||||
// 设置弹出层高度
|
// 设置弹出层高度
|
||||||
const getDomDes = (id) => {
|
const getDomDes = (id) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -46,6 +37,15 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
}).exec()
|
}).exec()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (show) {
|
||||||
|
getDomDes('#message')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setStyle(() => ({ top: '0' }))
|
||||||
|
}
|
||||||
|
}, [show])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.order_price}>
|
<View className={styles.order_price}>
|
||||||
@ -62,4 +62,5 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(EstimatedAmount)
|
||||||
|
|||||||
@ -4,14 +4,15 @@ import classnames from 'classnames'
|
|||||||
import { memo, useEffect, useRef, useState } from 'react'
|
import { memo, useEffect, useRef, useState } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import type { Params as PopuParams } from '@/components/popup'
|
import type { Params as PopuParams } from '@/components/popup'
|
||||||
import { GetProductKindListApi } from '@/api/material'
|
import { GetProductKindListApi } from '@/api/material'
|
||||||
|
|
||||||
type params = {
|
type params = {
|
||||||
onFiltr?: (val: object) => void // 确定搜索
|
onFiltr?: (val: object) => void // 确定搜索
|
||||||
onRest?: (val: Object) => void // 重置
|
onRest?: (val: Object) => void // 重置
|
||||||
} & PopuParams
|
} & PopuParams
|
||||||
export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
|
|
||||||
|
const Filter = ({ onClose, onFiltr, show = false, onRest }: params) => {
|
||||||
// 搜索条件
|
// 搜索条件
|
||||||
const [filterObj, setFilterObj] = useState({
|
const [filterObj, setFilterObj] = useState({
|
||||||
seriesName: '',
|
seriesName: '',
|
||||||
@ -115,4 +116,5 @@ export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Filter)
|
||||||
|
|||||||
@ -4,13 +4,14 @@ import classnames from 'classnames'
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import type { Params as PopuParams } from '@/components/popup'
|
import type { Params as PopuParams } from '@/components/popup'
|
||||||
import { GetProductKindListApi } from '@/api/material'
|
import { GetProductKindListApi } from '@/api/material'
|
||||||
|
|
||||||
type params = {
|
type params = {
|
||||||
onFiltr?: (val: object) => void
|
onFiltr?: (val: object) => void
|
||||||
} & PopuParams
|
} & PopuParams
|
||||||
export default ({ onClose, onFiltr, show = false }: params) => {
|
|
||||||
|
const FilterV2 = ({ onClose, onFiltr, show = false }: params) => {
|
||||||
// 搜索条件
|
// 搜索条件
|
||||||
const [filterObj, setFilterObj] = useState({
|
const [filterObj, setFilterObj] = useState({
|
||||||
seriesId: '',
|
seriesId: '',
|
||||||
@ -64,9 +65,9 @@ export default ({ onClose, onFiltr, show = false }: params) => {
|
|||||||
const setNumber = (e, field) => {
|
const setNumber = (e, field) => {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
const num = parseFloat(e.detail.value)
|
const num = parseFloat(e.detail.value)
|
||||||
if (isNaN(num)) {
|
if (Number.isNaN(num)) {
|
||||||
filterObj[field] = null
|
filterObj[field] = null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
filterObj[field] = parseFloat(num.toFixed(2))
|
filterObj[field] = parseFloat(num.toFixed(2))
|
||||||
}
|
}
|
||||||
@ -126,4 +127,6 @@ export default ({ onClose, onFiltr, show = false }: params) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default FilterV2
|
||||||
|
|||||||
@ -26,8 +26,7 @@ interface props {
|
|||||||
goodList?: any[]
|
goodList?: any[]
|
||||||
onBlur?: (a: any, c: any) => void
|
onBlur?: (a: any, c: any) => void
|
||||||
}
|
}
|
||||||
|
const GoodsItem = (props: props) => {
|
||||||
export default memo((props: props) => {
|
|
||||||
const [value, setValue] = useState<any>({ count: props.value.nums })
|
const [value, setValue] = useState<any>({ count: props.value.nums })
|
||||||
|
|
||||||
const onInputEven = (e) => {
|
const onInputEven = (e) => {
|
||||||
@ -99,5 +98,6 @@ export default memo((props: props) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(GoodsItem)
|
||||||
// ($event) => onInputEven($event, props.value)
|
// ($event) => onInputEven($event, props.value)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const SystemWidth = Taro.getSystemInfoSync().windowWidth
|
|||||||
const quot = '"'
|
const quot = '"'
|
||||||
|
|
||||||
function hex2rgb(hex) {
|
function hex2rgb(hex) {
|
||||||
const rgb = []
|
const rgb: number[] = []
|
||||||
|
|
||||||
hex = hex.substr(1)
|
hex = hex.substr(1)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ScrollView, View } from '@tarojs/components'
|
import { ScrollView, View } from '@tarojs/components'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import React, { memo, useMemo, useState } from 'react'
|
import React, { memo, useMemo, useState } from 'react'
|
||||||
import LoadingCard from '../loadingCard'
|
import LoadingCard from '../loadingCard'
|
||||||
import style from './index.module.scss'
|
import style from './index.module.scss'
|
||||||
@ -30,126 +30,127 @@ interface Params {
|
|||||||
enableBackToTop?: boolean
|
enableBackToTop?: boolean
|
||||||
emptySlot?: React.ReactNode
|
emptySlot?: React.ReactNode
|
||||||
}
|
}
|
||||||
export default memo(
|
const InfiniteScroll = ({
|
||||||
({
|
styleObj,
|
||||||
styleObj,
|
selfonScrollToLower,
|
||||||
selfonScrollToLower,
|
selfOnScrollToUpper,
|
||||||
selfOnScrollToUpper,
|
selfOnScroll,
|
||||||
selfOnScroll,
|
selfOnRefresherPulling,
|
||||||
selfOnRefresherPulling,
|
selfOnRefresherRefresh,
|
||||||
selfOnRefresherRefresh,
|
selfOnRefresherRestore,
|
||||||
selfOnRefresherRestore,
|
selfOnRefresherAbort,
|
||||||
selfOnRefresherAbort,
|
safeAreaInsetBottom = true,
|
||||||
safeAreaInsetBottom = true,
|
enableLoadMoreStatus = true,
|
||||||
enableLoadMoreStatus = true,
|
children,
|
||||||
children,
|
lowerThresholdNum = 5,
|
||||||
lowerThresholdNum = 5,
|
paddingBottom = 0,
|
||||||
paddingBottom = 0,
|
refresherTriggered = false,
|
||||||
refresherTriggered = false,
|
refresherEnabled = false,
|
||||||
refresherEnabled = false,
|
moreStatus = true,
|
||||||
moreStatus = true,
|
statusMore = 0,
|
||||||
statusMore = 0,
|
enableBackToTop = true,
|
||||||
enableBackToTop = true,
|
emptySlot,
|
||||||
emptySlot,
|
}: Params) => {
|
||||||
}: Params) => {
|
const scrollToLower = () => {
|
||||||
const scrollToLower = () => {
|
selfonScrollToLower?.()
|
||||||
selfonScrollToLower?.()
|
}
|
||||||
}
|
const scrollToUpper = () => {
|
||||||
const scrollToUpper = () => {
|
selfOnScrollToUpper?.()
|
||||||
selfOnScrollToUpper?.()
|
}
|
||||||
}
|
const scroll = (e) => {
|
||||||
const scroll = (e) => {
|
selfOnScroll?.(e)
|
||||||
selfOnScroll?.(e)
|
}
|
||||||
}
|
const refresherPulling = () => {
|
||||||
const refresherPulling = () => {
|
selfOnRefresherPulling?.()
|
||||||
selfOnRefresherPulling?.()
|
}
|
||||||
}
|
const refresherRefresh = () => {
|
||||||
const refresherRefresh = () => {
|
selfOnRefresherRefresh?.()
|
||||||
selfOnRefresherRefresh?.()
|
}
|
||||||
}
|
const refresherRestore = () => {
|
||||||
const refresherRestore = () => {
|
selfOnRefresherRestore?.()
|
||||||
selfOnRefresherRestore?.()
|
}
|
||||||
}
|
const refresherAbort = () => {
|
||||||
const refresherAbort = () => {
|
selfOnRefresherAbort?.()
|
||||||
selfOnRefresherAbort?.()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 返回顶部
|
// 返回顶部
|
||||||
const scrollTop = useMemo(() => {
|
const scrollTop = useMemo(() => {
|
||||||
if (statusMore == 0) {
|
if (statusMore == 0) {
|
||||||
return 0.1
|
return 0.1
|
||||||
}
|
}
|
||||||
}, [statusMore])
|
}, [statusMore])
|
||||||
|
|
||||||
const component = () => {
|
const component = () => {
|
||||||
if (enableLoadMoreStatus) {
|
if (enableLoadMoreStatus) {
|
||||||
if (!moreStatus) {
|
if (!moreStatus) {
|
||||||
return (
|
|
||||||
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
|
||||||
{children}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{(statusMore == 2 || statusMore == 3) && (
|
|
||||||
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
|
||||||
{children}
|
|
||||||
<View className={style.infinite_scroll}>
|
|
||||||
{statusMore == 2
|
|
||||||
? (
|
|
||||||
<View className={style.loading_more}>
|
|
||||||
加载中
|
|
||||||
<DotLoading />
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
: (
|
|
||||||
<View className={style.noMore}>没有更多数据了</View>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
{statusMore == 0 && <LoadingCard />}
|
|
||||||
{statusMore == 1 && (emptySlot || <Empty picUrl={SEARCH_EMPTY_IMAGE} text="暂无数据" />)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return (
|
return (
|
||||||
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(statusMore == 2 || statusMore == 3) && (
|
||||||
|
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
||||||
|
{children}
|
||||||
|
<View className={style.infinite_scroll}>
|
||||||
|
{statusMore == 2
|
||||||
|
? (
|
||||||
|
<View className={style.loading_more}>
|
||||||
|
加载中
|
||||||
|
<DotLoading />
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<View className={style.noMore}>没有更多数据了</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{statusMore == 0 && <LoadingCard />}
|
||||||
|
{statusMore == 1 && (emptySlot || <Empty picUrl={SEARCH_EMPTY_IMAGE} text="暂无数据" />)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return (
|
||||||
|
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
id="infiniteScroll"
|
id="infiniteScroll"
|
||||||
style={styleObj}
|
style={styleObj}
|
||||||
className={style.scroll_main}
|
className={style.scroll_main}
|
||||||
scrollY
|
scrollY
|
||||||
onScrollToLower={() => scrollToLower()}
|
onScrollToLower={() => scrollToLower()}
|
||||||
onScrollToUpper={() => scrollToUpper()}
|
onScrollToUpper={() => scrollToUpper()}
|
||||||
onScroll={e => scroll(e)}
|
onScroll={e => scroll(e)}
|
||||||
lowerThreshold={lowerThresholdNum}
|
lowerThreshold={lowerThresholdNum}
|
||||||
refresherEnabled={refresherEnabled}
|
refresherEnabled={refresherEnabled}
|
||||||
refresherTriggered={refresherTriggered}
|
refresherTriggered={refresherTriggered}
|
||||||
onRefresherPulling={() => refresherPulling()}
|
onRefresherPulling={() => refresherPulling()}
|
||||||
onRefresherRefresh={() => refresherRefresh()}
|
onRefresherRefresh={() => refresherRefresh()}
|
||||||
onRefresherRestore={() => refresherRestore()}
|
onRefresherRestore={() => refresherRestore()}
|
||||||
onRefresherAbort={() => refresherAbort()}
|
onRefresherAbort={() => refresherAbort()}
|
||||||
refresherBackground="#F8F8F8"
|
refresherBackground="#F8F8F8"
|
||||||
enableBackToTop={enableBackToTop}
|
enableBackToTop={enableBackToTop}
|
||||||
scrollTop={scrollTop}
|
scrollTop={scrollTop}
|
||||||
>
|
>
|
||||||
{component()}
|
{component()}
|
||||||
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
|
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
|
export default memo(
|
||||||
|
InfiniteScroll,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { View } from '@tarojs/components'
|
import { View } from '@tarojs/components'
|
||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
import style from './index.module.scss'
|
import style from './index.module.scss'
|
||||||
|
|
||||||
export default memo(({ width = 60, color = '#6190e8' }: { width?: number; color?: string }) => {
|
const Loading = ({ width = 60, color = '#6190e8' }: { width?: number; color?: string }) => {
|
||||||
const styleObj = useMemo(() => {
|
const styleObj = useMemo(() => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
|
||||||
if (color) { obj = { ...obj, borderColor: `${color} transparent transparent` } }
|
if (color) { obj = { ...obj, borderColor: `${color} transparent transparent` } }
|
||||||
return obj
|
return obj
|
||||||
}, [width, color])
|
}, [width, color])
|
||||||
console.log('loading:::')
|
console.log('loading:::')
|
||||||
return (
|
return (
|
||||||
@ -18,5 +18,6 @@ export default memo(({ width = 60, color = '#6190e8' }: { width?: number; color?
|
|||||||
<View style={styleObj} className={style.loading__ring}></View>
|
<View style={styleObj} className={style.loading__ring}></View>
|
||||||
<View style={styleObj} className={style.loading__ring}></View>
|
<View style={styleObj} className={style.loading__ring}></View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Loading)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Params {
|
|||||||
title?: string
|
title?: string
|
||||||
loadingIcon?: boolean
|
loadingIcon?: boolean
|
||||||
}
|
}
|
||||||
export default memo((props: Params) => {
|
const LoadingCard = (props: Params) => {
|
||||||
console.log(props)
|
console.log(props)
|
||||||
const {
|
const {
|
||||||
title = '加载中...', // 显示的文字
|
title = '加载中...', // 显示的文字
|
||||||
@ -24,4 +24,5 @@ export default memo((props: Params) => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LoadingCard)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { MovableArea, MovableView, View } from '@tarojs/components'
|
import { MovableArea, MovableView, View } from '@tarojs/components'
|
||||||
import Taro, { useReady } from '@tarojs/taro'
|
import Taro, { useReady } from '@tarojs/taro'
|
||||||
import type { ReactElement } from 'react'
|
import type { ReactElement } from 'react'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
@ -12,7 +12,7 @@ interface param {
|
|||||||
children?: ReactElement|null
|
children?: ReactElement|null
|
||||||
onClick?: () => void
|
onClick?: () => void
|
||||||
}
|
}
|
||||||
export default ({ children = null, onClick }: param) => {
|
const MoveBtn = ({ children = null, onClick }: param) => {
|
||||||
// 获取购物车数据数量
|
// 获取购物车数据数量
|
||||||
const { getShopCount, commonData } = useCommonData()
|
const { getShopCount, commonData } = useCommonData()
|
||||||
|
|
||||||
@ -46,4 +46,5 @@ export default ({ children = null, onClick }: param) => {
|
|||||||
</MovableView>}
|
</MovableView>}
|
||||||
</MovableArea>
|
</MovableArea>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default MoveBtn
|
||||||
|
|||||||
@ -25,8 +25,7 @@ interface Param {
|
|||||||
showStatus?: 'detail' | 'list' // 订单详情,订单列表
|
showStatus?: 'detail' | 'list' // 订单详情,订单列表
|
||||||
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
|
||||||
}
|
}
|
||||||
|
const OrderBtns = ({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
||||||
export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|
||||||
// 订单状态枚举
|
// 订单状态枚举
|
||||||
const {
|
const {
|
||||||
SaleOrderStatusBooking,
|
SaleOrderStatusBooking,
|
||||||
@ -161,28 +160,6 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
const { ApplyGoods } = SUBSCRIPTION_MESSAGE_SCENE
|
const { ApplyGoods } = SUBSCRIPTION_MESSAGE_SCENE
|
||||||
const { openSubscriptionMessage } = UseSubscriptionMessage()
|
const { openSubscriptionMessage } = UseSubscriptionMessage()
|
||||||
|
|
||||||
// 点击按钮操作
|
|
||||||
const submitBtns = throttle(async(val, index) => {
|
|
||||||
if (val == 1) {
|
|
||||||
cancelOrder()
|
|
||||||
}
|
|
||||||
else if (val == 6) {
|
|
||||||
receiveOrder()
|
|
||||||
}
|
|
||||||
else if (val == 5) {
|
|
||||||
applyProduct()
|
|
||||||
}
|
|
||||||
else if (val == 3) {
|
|
||||||
bigApplyRefurn()
|
|
||||||
}
|
|
||||||
else if (val == 8) {
|
|
||||||
applyRefund()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
onClick?.(val)
|
|
||||||
}
|
|
||||||
}, 800)
|
|
||||||
|
|
||||||
// 大货申请退款
|
// 大货申请退款
|
||||||
const bigApplyRefurn = () => {
|
const bigApplyRefurn = () => {
|
||||||
Taro.showModal({
|
Taro.showModal({
|
||||||
@ -191,7 +168,7 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
await openSubscriptionMessage({ orderId: orderInfo?.orderId, scenes: ApplyGoods.value })
|
await openSubscriptionMessage({ orderId: orderInfo?.orderId, scenes: ApplyGoods.value })
|
||||||
onClick?.(3)
|
onClick?.(3)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -210,11 +187,11 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
alert.success('取消成功')
|
alert.success('取消成功')
|
||||||
onClick?.(1)
|
onClick?.(1)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert.none(res.msg)
|
alert.none(res.msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res.cancel) {
|
else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -234,12 +211,12 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
onClick?.(6)
|
onClick?.(6)
|
||||||
alert.success('收货成功')
|
alert.success('收货成功')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert.error('收货失败')
|
alert.error('收货失败')
|
||||||
}
|
}
|
||||||
alert.hideLoading()
|
alert.hideLoading()
|
||||||
}
|
}
|
||||||
else if (res.cancel) {
|
else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -259,13 +236,13 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
const res = await fetchDataApplyRefund({ sale_order_id: orderInfo?.orderId })
|
const res = await fetchDataApplyRefund({ sale_order_id: orderInfo?.orderId })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
alert.success('申请成功')
|
alert.success('申请成功')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert.error('申请失败')
|
alert.error('申请失败')
|
||||||
}
|
}
|
||||||
alert.hideLoading()
|
alert.hideLoading()
|
||||||
onClick?.(8)
|
onClick?.(8)
|
||||||
}
|
}
|
||||||
else if (res.cancel) {
|
else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -286,6 +263,28 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
|
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
|
||||||
}, [orderBtnsShowList])
|
}, [orderBtnsShowList])
|
||||||
|
|
||||||
|
// 点击按钮操作
|
||||||
|
const submitBtns = throttle(async(val, index) => {
|
||||||
|
if (val == 1) {
|
||||||
|
cancelOrder()
|
||||||
|
}
|
||||||
|
else if (val == 6) {
|
||||||
|
receiveOrder()
|
||||||
|
}
|
||||||
|
else if (val == 5) {
|
||||||
|
applyProduct()
|
||||||
|
}
|
||||||
|
else if (val == 3) {
|
||||||
|
bigApplyRefurn()
|
||||||
|
}
|
||||||
|
else if (val == 8) {
|
||||||
|
applyRefund()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onClick?.(val)
|
||||||
|
}
|
||||||
|
}, 800)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.btns_list}>
|
<View className={styles.btns_list}>
|
||||||
{orderBtnsShowList.length > 3 && (
|
{orderBtnsShowList.length > 3 && (
|
||||||
@ -321,4 +320,5 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(OrderBtns)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { RootPortal, View } from '@tarojs/components'
|
import { RootPortal, View } from '@tarojs/components'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import style from './index.module.scss'
|
import style from './index.module.scss'
|
||||||
import CloseBtnIcon from '@/components/closeBtn'
|
import CloseBtnIcon from '@/components/closeBtn'
|
||||||
@ -25,73 +25,73 @@ export interface Params extends PopupEvent {
|
|||||||
safeAreaInsetBottom?: boolean // 是否为iphoneX提供小黑条适配
|
safeAreaInsetBottom?: boolean // 是否为iphoneX提供小黑条适配
|
||||||
showOverLay?: boolean // 是否显示遮罩层
|
showOverLay?: boolean // 是否显示遮罩层
|
||||||
}
|
}
|
||||||
export default memo(
|
const Popup = ({
|
||||||
({
|
title = '标题',
|
||||||
title = '标题',
|
show = false,
|
||||||
show = false,
|
showTitle = true,
|
||||||
showTitle = true,
|
onClose,
|
||||||
onClose,
|
isFixed = false,
|
||||||
isFixed = false,
|
showIconButton = false,
|
||||||
showIconButton = false,
|
children,
|
||||||
children,
|
position = 'bottom',
|
||||||
position = 'bottom',
|
animationEnd,
|
||||||
animationEnd,
|
customStyle = {},
|
||||||
customStyle = {},
|
safeAreaInsetBottom = true,
|
||||||
safeAreaInsetBottom = true,
|
showOverLay = true,
|
||||||
showOverLay = true,
|
overlayStyle,
|
||||||
overlayStyle,
|
}: Params) => {
|
||||||
}: Params) => {
|
const animationTime = useRef<any>(null)
|
||||||
const animationTime = useRef<any>(null)
|
useEffect(() => {
|
||||||
useEffect(() => {
|
if (show) {
|
||||||
if (show) {
|
animationTime.current = setTimeout(() => {
|
||||||
animationTime.current = setTimeout(() => {
|
animationEnd?.()
|
||||||
animationEnd?.()
|
customStyle.overflow = 'unset'
|
||||||
customStyle.overflow = 'unset'
|
}, 260)
|
||||||
}, 260)
|
}
|
||||||
}
|
else {
|
||||||
else {
|
clearTimeout(animationTime.current)
|
||||||
clearTimeout(animationTime.current)
|
}
|
||||||
}
|
}, [show])
|
||||||
}, [show])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(animationTime.current)
|
clearTimeout(animationTime.current)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={style.drawer_main}>
|
<View className={style.drawer_main}>
|
||||||
<View catchMove className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
|
<View catchMove className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
|
||||||
{/* 遮罩层 start */}
|
{/* 遮罩层 start */}
|
||||||
<View
|
<View
|
||||||
className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show, [style['drawer_mask--hidden']]: !showOverLay })}
|
className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show, [style['drawer_mask--hidden']]: !showOverLay })}
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
style={overlayStyle}
|
style={overlayStyle}
|
||||||
></View>
|
></View>
|
||||||
{/* 遮罩层 end */}
|
{/* 遮罩层 end */}
|
||||||
<View
|
<View
|
||||||
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}` }}
|
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}` }}
|
||||||
className={classnames(style.drawer_container, style[`drawer_container_${position}`], {
|
className={classnames(style.drawer_container, style[`drawer_container_${position}`], {
|
||||||
[style.drawer_container_active]: show,
|
[style.drawer_container_active]: show,
|
||||||
[style[`drawer_container_${position}-withShadow`]]: !showOverLay,
|
[style[`drawer_container_${position}-withShadow`]]: !showOverLay,
|
||||||
})}
|
})}
|
||||||
onClick={e => e.stopPropagation()}
|
onClick={e => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
|
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
|
||||||
{showIconButton && (
|
{showIconButton && (
|
||||||
<View className={style.common_close_btn_icon}>
|
<View className={style.common_close_btn_icon}>
|
||||||
<CloseBtnIcon onClose={onClose} />
|
<CloseBtnIcon onClose={onClose} />
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<View id="drawerContainerContext" className={style.drawer_container_context}>
|
|
||||||
{children}
|
|
||||||
</View>
|
</View>
|
||||||
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
|
)}
|
||||||
|
|
||||||
|
<View id="drawerContainerContext" className={style.drawer_container_context}>
|
||||||
|
{children}
|
||||||
</View>
|
</View>
|
||||||
|
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
</View>
|
||||||
},
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
export default memo(Popup)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ interface Params {
|
|||||||
productList?: any[]
|
productList?: any[]
|
||||||
popupShow?: (any) => void
|
popupShow?: (any) => void
|
||||||
}
|
}
|
||||||
export default ({ desStatus = true, productList = [], popupShow }: Params) => {
|
const Product = ({ desStatus = true, productList = [], popupShow }: Params) => {
|
||||||
const labAndImgObj = useCallback(
|
const labAndImgObj = useCallback(
|
||||||
(item) => {
|
(item) => {
|
||||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||||
@ -20,9 +20,9 @@ export default ({ desStatus = true, productList = [], popupShow }: Params) => {
|
|||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_list}>
|
<View className={styles.products_list}>
|
||||||
{productList?.map((item) => {
|
{productList?.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.products_item} onClick={() => popupShow?.(item)}>
|
<View key={key} className={styles.products_item} onClick={() => popupShow?.(item)}>
|
||||||
<View className={styles.item_img}>
|
<View className={styles.item_img}>
|
||||||
<LabAndImg value={labAndImgObj(item)} />
|
<LabAndImg value={labAndImgObj(item)} />
|
||||||
<View className={styles.num}>{item.product_color_count}色</View>
|
<View className={styles.num}>{item.product_color_count}色</View>
|
||||||
@ -45,3 +45,5 @@ export default ({ desStatus = true, productList = [], popupShow }: Params) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Product
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { View } from '@tarojs/components'
|
import { View } from '@tarojs/components'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
|
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
|
||||||
import IconFont from '../iconfont/iconfont'
|
import IconFont from '../iconfont/iconfont'
|
||||||
import InputX from '../InputX/index'
|
import InputX from '../InputX/index'
|
||||||
@ -26,104 +26,102 @@ interface Params {
|
|||||||
handScan?: () => void
|
handScan?: () => void
|
||||||
cursorSpacing?: Number
|
cursorSpacing?: Number
|
||||||
}
|
}
|
||||||
|
const Search = (
|
||||||
|
{
|
||||||
|
clickOnSearch, // 点击筛选按钮触发
|
||||||
|
changeOnSearch, // 输入文字触发
|
||||||
|
adjustPosition = false,
|
||||||
|
disabled = false, // 是否禁用
|
||||||
|
placeholder = '输入搜索内容',
|
||||||
|
showIcon = true, // 是否显示关闭图标
|
||||||
|
showBtn = false, // 是否显示搜索按钮
|
||||||
|
btnStyle = {},
|
||||||
|
placeIcon = 'inner', // 搜索图标位置:inner在里面,out在外面
|
||||||
|
btnTitle = '搜索', // 搜索文字
|
||||||
|
defaultValue = '', // 默认值
|
||||||
|
children,
|
||||||
|
customRightSlot,
|
||||||
|
showScan = false,
|
||||||
|
handScan,
|
||||||
|
cursorSpacing = 0,
|
||||||
|
}: Params,
|
||||||
|
ref,
|
||||||
|
) => {
|
||||||
|
const [inputCon, setInputCon] = useState('')
|
||||||
|
useEffect(() => {
|
||||||
|
setInputCon(defaultValue)
|
||||||
|
}, [defaultValue])
|
||||||
|
|
||||||
export default memo(
|
const onInputEven = (e) => {
|
||||||
forwardRef(
|
const value = e.detail.value
|
||||||
(
|
setInputCon(value)
|
||||||
{
|
changeOnSearch?.(value)
|
||||||
clickOnSearch, // 点击筛选按钮触发
|
}
|
||||||
changeOnSearch, // 输入文字触发
|
|
||||||
adjustPosition = false,
|
|
||||||
disabled = false, // 是否禁用
|
|
||||||
placeholder = '输入搜索内容',
|
|
||||||
showIcon = true, // 是否显示关闭图标
|
|
||||||
showBtn = false, // 是否显示搜索按钮
|
|
||||||
btnStyle = {},
|
|
||||||
placeIcon = 'inner', // 搜索图标位置:inner在里面,out在外面
|
|
||||||
btnTitle = '搜索', // 搜索文字
|
|
||||||
defaultValue = '', // 默认值
|
|
||||||
children,
|
|
||||||
customRightSlot,
|
|
||||||
showScan = false,
|
|
||||||
handScan,
|
|
||||||
cursorSpacing = 0,
|
|
||||||
}: Params,
|
|
||||||
ref,
|
|
||||||
) => {
|
|
||||||
const [inputCon, setInputCon] = useState('')
|
|
||||||
useEffect(() => {
|
|
||||||
setInputCon(defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
const onInputEven = (e) => {
|
const clearInput = () => {
|
||||||
const value = e.detail.value
|
setInputCon('')
|
||||||
setInputCon(value)
|
changeOnSearch?.('')
|
||||||
changeOnSearch?.(value)
|
}
|
||||||
}
|
useImperativeHandle(ref, () => ({
|
||||||
|
clearInput,
|
||||||
|
}))
|
||||||
|
const onSearch = () => {
|
||||||
|
clickOnSearch?.(inputCon)
|
||||||
|
}
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
return (
|
||||||
clearInput,
|
<>
|
||||||
}))
|
<View className={styles.search_main}>
|
||||||
|
<View className={styles.search_con}>
|
||||||
const clearInput = () => {
|
{showIcon && (
|
||||||
setInputCon('')
|
<IconFont
|
||||||
changeOnSearch?.('')
|
name="icon-sousuo"
|
||||||
}
|
size={37}
|
||||||
|
color="#ababac"
|
||||||
const onSearch = () => {
|
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}
|
||||||
clickOnSearch?.(inputCon)
|
></IconFont>
|
||||||
}
|
)}
|
||||||
|
<View className={styles.input_bar}>
|
||||||
return (
|
<InputX
|
||||||
<>
|
cursorSpacing={cursorSpacing as any}
|
||||||
<View className={styles.search_main}>
|
adjustPosition={adjustPosition}
|
||||||
<View className={styles.search_con}>
|
placeholderStyle="color:#ABABAB; font-size:26rpx"
|
||||||
{showIcon && (
|
onConfirm={onSearch}
|
||||||
<IconFont
|
disabled={disabled}
|
||||||
name="icon-sousuo"
|
value={inputCon}
|
||||||
size={37}
|
placeholder={placeholder}
|
||||||
color="#ababac"
|
onInput={e => onInputEven(e)}
|
||||||
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}
|
customClassName={classnames(placeIcon == 'out' && styles.input_out)}
|
||||||
></IconFont>
|
customStyle={{ width: '100%' }}
|
||||||
)}
|
/>
|
||||||
<View className={styles.input_bar}>
|
<View className={styles.search_closeBtn}>
|
||||||
<InputX
|
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
|
||||||
cursorSpacing={cursorSpacing as any}
|
|
||||||
adjustPosition={adjustPosition}
|
|
||||||
placeholderStyle="color:#ABABAB; font-size:26rpx"
|
|
||||||
onConfirm={onSearch}
|
|
||||||
disabled={disabled}
|
|
||||||
value={inputCon}
|
|
||||||
placeholder={placeholder}
|
|
||||||
onInput={e => onInputEven(e)}
|
|
||||||
customClassName={classnames(placeIcon == 'out' && styles.input_out)}
|
|
||||||
customStyle={{ width: '100%' }}
|
|
||||||
/>
|
|
||||||
<View className={styles.search_closeBtn}>
|
|
||||||
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
|
|
||||||
</View>
|
|
||||||
{showScan && (
|
|
||||||
<View
|
|
||||||
onClick={() => {
|
|
||||||
handScan?.()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconFont name="icon-saomiao" size={40} color="#337FFF"></IconFont>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<View className={styles.customRightSlot}>{customRightSlot}</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
{showBtn && (
|
{showScan && (
|
||||||
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
|
<View
|
||||||
{btnTitle}
|
onClick={() => {
|
||||||
|
handScan?.()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconFont name="icon-saomiao" size={40} color="#337FFF"></IconFont>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{children}
|
|
||||||
|
<View className={styles.customRightSlot}>{customRightSlot}</View>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</View>
|
||||||
)
|
{showBtn && (
|
||||||
},
|
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
|
||||||
|
{btnTitle}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default memo(
|
||||||
|
forwardRef(
|
||||||
|
Search,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { View } from '@tarojs/components'
|
import { View } from '@tarojs/components'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
import IconFont from '../iconfont/iconfont'
|
import IconFont from '../iconfont/iconfont'
|
||||||
import InputX from '../InputX'
|
import InputX from '../InputX'
|
||||||
@ -19,8 +19,7 @@ interface Params {
|
|||||||
titleStyle?: Object
|
titleStyle?: Object
|
||||||
styleObj?: Object
|
styleObj?: Object
|
||||||
}
|
}
|
||||||
|
const SearchInput = (props: Params) => {
|
||||||
export default memo((props: Params) => {
|
|
||||||
const {
|
const {
|
||||||
showTitle = true,
|
showTitle = true,
|
||||||
title = '标题',
|
title = '标题',
|
||||||
@ -55,4 +54,5 @@ export default memo((props: Params) => {
|
|||||||
{showIcon && <IconFont customClassName={styles.icon_more_self} name="icon-chakanquanbukehu" size={36} color="#333"></IconFont>}
|
{showIcon && <IconFont customClassName={styles.icon_more_self} name="icon-chakanquanbukehu" size={36} color="#333"></IconFont>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(SearchInput)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ interface productType {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const SelectProduct = forwardRef((params: PropsType, ref) => {
|
const SelectProduct = (params: PropsType, ref) => {
|
||||||
const { selectColorId, noAll, onSelect } = params
|
const { selectColorId, noAll, onSelect } = params
|
||||||
|
|
||||||
const [selectId, setSelectId] = useState(selectColorId)
|
const [selectId, setSelectId] = useState(selectColorId)
|
||||||
@ -34,6 +34,19 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
|
|||||||
|
|
||||||
const [productList, setProductList] = useState<productType[]>([])
|
const [productList, setProductList] = useState<productType[]>([])
|
||||||
|
|
||||||
|
const [showPopup, setShowPopup] = useState(false)
|
||||||
|
|
||||||
|
const changeName = (item) => {
|
||||||
|
console.log('changeName', item)
|
||||||
|
if (item) {
|
||||||
|
if (item.id) {
|
||||||
|
return formatHashTag(item.code, item.name)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return item.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const clickEvent = () => {
|
const clickEvent = () => {
|
||||||
setShowPopup(true)
|
setShowPopup(true)
|
||||||
}
|
}
|
||||||
@ -53,22 +66,6 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
|
|||||||
onSelect && onSelect(item)
|
onSelect && onSelect(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeName = (item) => {
|
|
||||||
console.log('changeName', item)
|
|
||||||
if (item) {
|
|
||||||
if (item.id) {
|
|
||||||
return formatHashTag(item.code, item.name)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return item.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getProductList()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const getProductList = async() => {
|
const getProductList = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
// !noAll && res.data.list?.unshift({ name: '全部', id: 0 })
|
// !noAll && res.data.list?.unshift({ name: '全部', id: 0 })
|
||||||
@ -76,7 +73,9 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
|
|||||||
originList.current = [{ name: '全部', id: 0 }, ...res.data.list]
|
originList.current = [{ name: '全部', id: 0 }, ...res.data.list]
|
||||||
}
|
}
|
||||||
|
|
||||||
const [showPopup, setShowPopup] = useState(false)
|
useEffect(() => {
|
||||||
|
getProductList()
|
||||||
|
}, [])
|
||||||
|
|
||||||
const closeEven = () => {
|
const closeEven = () => {
|
||||||
setShowPopup(false)
|
setShowPopup(false)
|
||||||
@ -118,7 +117,7 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
<Popup title="请选择面料名称" showTitle show={showPopup} onClose={closeEven} position="bottom" customStyle={{ zIndex: 9999 }}>
|
<Popup title="请选择面料名称" showTitle show={showPopup} onClose={closeEven} position="bottom" customStyle={{ zIndex: 9999 }}>
|
||||||
<View style={{ padding: '0 24rpx' }}>
|
<View style={{ padding: '0 24rpx' }}>
|
||||||
<Search placeholder="请输入编号/面料" showBtn={false} changeOnSearch={getSearchData} debounceTime={350}></Search>
|
<Search placeholder="请输入编号/面料" showBtn={false} changeOnSearch={getSearchData}></Search>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.selectList}>
|
<View className={styles.selectList}>
|
||||||
<ScrollView className={styles['selectList-scroll-view']} scrollY>
|
<ScrollView className={styles['selectList-scroll-view']} scrollY>
|
||||||
@ -134,5 +133,5 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
export default SelectProduct
|
export default forwardRef(SelectProduct)
|
||||||
|
|||||||
@ -25,18 +25,52 @@ interface param {
|
|||||||
intoStatus?: 'again' | 'shop'
|
intoStatus?: 'again' | 'shop'
|
||||||
default_sale_mode?: number // 面料类型(0:大货, 1:剪版,2:散剪
|
default_sale_mode?: number // 面料类型(0:大货, 1:剪版,2:散剪
|
||||||
}
|
}
|
||||||
export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mode }: param) => {
|
||||||
const selectList = [
|
const selectList = [
|
||||||
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
|
||||||
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
|
||||||
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 },
|
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 },
|
||||||
]
|
]
|
||||||
|
// 获取数据
|
||||||
|
const [list, setList] = useState<any[]>([])
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const { fetchData } = GetShoppingCartApi()
|
||||||
// 切换面料类型
|
// 切换面料类型
|
||||||
const [selectIndex, setSelectIndex] = useState(default_sale_mode || 0)
|
const [selectIndex, setSelectIndex] = useState(default_sale_mode || 0)
|
||||||
const selectProduct = (index: number) => {
|
const selectProduct = (index: number) => {
|
||||||
setSelectIndex(index)
|
setSelectIndex(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化全部数据默认勾选
|
||||||
|
const [checkboxData, setCheckboxData] = useState<Record<number, true | false>>({})
|
||||||
|
const initStatus = useRef(false)
|
||||||
|
|
||||||
|
// 全选反选
|
||||||
|
const [selectStatus, setSelectStatus] = useState(false)
|
||||||
|
|
||||||
|
const initList = (color_list) => {
|
||||||
|
if (initStatus.current) {
|
||||||
|
color_list?.forEach((item) => {
|
||||||
|
if (selectIndex == item.sale_mode) { checkboxData[item.id] = true }
|
||||||
|
})
|
||||||
|
initStatus.current = false
|
||||||
|
}
|
||||||
|
setCheckboxData(() => checkboxData)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置勾选数据
|
||||||
|
const resetList = () => {
|
||||||
|
list?.forEach((item) => {
|
||||||
|
if (selectIndex == item.sale_mode || selectIndex == -1) {
|
||||||
|
checkboxData[item.id] = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkboxData[item.id] = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setCheckboxData(() => ({ ...checkboxData }))
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectIndex(() => default_sale_mode!)
|
setSelectIndex(() => default_sale_mode!)
|
||||||
}, [default_sale_mode])
|
}, [default_sale_mode])
|
||||||
@ -46,26 +80,11 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
setSelectStatus(true)
|
setSelectStatus(true)
|
||||||
}, [selectIndex])
|
}, [selectIndex])
|
||||||
|
|
||||||
|
// 绑定业务员和电话号码
|
||||||
|
const [showBindSalesman, setShowBindSalesman] = useState(false)
|
||||||
// 获取购物车数据数量
|
// 获取购物车数据数量
|
||||||
const { setShopCount } = useCommonData()
|
const { setShopCount } = useCommonData()
|
||||||
|
|
||||||
// 重置勾选数据
|
|
||||||
const resetList = () => {
|
|
||||||
list?.map((item) => {
|
|
||||||
if (selectIndex == item.sale_mode || selectIndex == -1) {
|
|
||||||
checkboxData[item.id] = true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
checkboxData[item.id] = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setCheckboxData(() => ({ ...checkboxData }))
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取数据
|
|
||||||
const [list, setList] = useState<any[]>([])
|
|
||||||
const [loading, setLoading] = useState(false)
|
|
||||||
const { fetchData } = GetShoppingCartApi()
|
|
||||||
const getShoppingCart = async() => {
|
const getShoppingCart = async() => {
|
||||||
const { data } = await fetchData()
|
const { data } = await fetchData()
|
||||||
const color_list = data.color_list || []
|
const color_list = data.color_list || []
|
||||||
@ -75,25 +94,12 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化全部数据默认勾选
|
|
||||||
const [checkboxData, setCheckboxData] = useState<Record<number, true | false>>({})
|
|
||||||
const initStatus = useRef(false)
|
|
||||||
const initList = (color_list) => {
|
|
||||||
if (initStatus.current) {
|
|
||||||
color_list?.map((item) => {
|
|
||||||
if (selectIndex == item.sale_mode) { checkboxData[item.id] = true }
|
|
||||||
})
|
|
||||||
initStatus.current = false
|
|
||||||
}
|
|
||||||
setCheckboxData(() => checkboxData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示是展示数据
|
// 显示是展示数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!show) {
|
if (!show) {
|
||||||
setList([])
|
setList([])
|
||||||
setSelectIndex(default_sale_mode || 0)
|
setSelectIndex(default_sale_mode || 0)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
initStatus.current = true
|
initStatus.current = true
|
||||||
@ -113,28 +119,19 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
setShowPopup(show)
|
setShowPopup(show)
|
||||||
}, [show])
|
}, [show])
|
||||||
|
|
||||||
// 全选反选
|
|
||||||
const [selectStatus, setSelectStatus] = useState(false)
|
|
||||||
const selectAll = () => {
|
const selectAll = () => {
|
||||||
list.map((item) => {
|
list.forEach((item) => {
|
||||||
if (selectIndex == item.sale_mode || selectIndex == -1) { checkboxData[item.id] = !selectStatus }
|
if (selectIndex == item.sale_mode || selectIndex == -1) { checkboxData[item.id] = !selectStatus }
|
||||||
})
|
})
|
||||||
setSelectStatus(!selectStatus)
|
setSelectStatus(!selectStatus)
|
||||||
setCheckboxData(() => ({ ...checkboxData }))
|
setCheckboxData(() => ({ ...checkboxData }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkbox选中回调
|
|
||||||
const selectCallBack = (item) => {
|
|
||||||
checkboxData[item.id] = true
|
|
||||||
checkSelect()
|
|
||||||
setCheckboxData(() => ({ ...checkboxData }))
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
// checkbox选中判断是否全部选中,全部选中后是全选,否则反选
|
||||||
const checkSelect = () => {
|
const checkSelect = () => {
|
||||||
let list_count = 0
|
let list_count = 0
|
||||||
let select_count = 0
|
let select_count = 0
|
||||||
list?.map((item) => {
|
list?.forEach((item) => {
|
||||||
if (selectIndex == -1 || selectIndex == item.sale_mode) {
|
if (selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
list_count++
|
list_count++
|
||||||
if (checkboxData[item.id]) { select_count++ }
|
if (checkboxData[item.id]) { select_count++ }
|
||||||
@ -142,6 +139,12 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})
|
})
|
||||||
setSelectStatus(select_count == list_count)
|
setSelectStatus(select_count == list_count)
|
||||||
}
|
}
|
||||||
|
// checkbox选中回调
|
||||||
|
const selectCallBack = (item) => {
|
||||||
|
checkboxData[item.id] = true
|
||||||
|
checkSelect()
|
||||||
|
setCheckboxData(() => ({ ...checkboxData }))
|
||||||
|
}
|
||||||
|
|
||||||
// checkbox关闭回调
|
// checkbox关闭回调
|
||||||
const colseCallBack = (item) => {
|
const colseCallBack = (item) => {
|
||||||
@ -156,6 +159,17 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
setShowPopup(false)
|
setShowPopup(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取面料选中的id
|
||||||
|
const selectIds = useRef<number[]>([])
|
||||||
|
const getSelectId = () => {
|
||||||
|
selectIds.current = []
|
||||||
|
list?.forEach((item) => {
|
||||||
|
if (selectIndex == -1 || selectIndex == item.sale_mode) {
|
||||||
|
checkboxData[item.id] && selectIds.current.push(item.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 删除购物车内容
|
// 删除购物车内容
|
||||||
const { fetchData: delShopFetchData } = DelShoppingCartApi()
|
const { fetchData: delShopFetchData } = DelShoppingCartApi()
|
||||||
const delSelect = () => {
|
const delSelect = () => {
|
||||||
@ -172,14 +186,14 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
title: '成功',
|
title: '成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res.cancel) {
|
else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
@ -187,17 +201,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取面料选中的id
|
|
||||||
const selectIds = useRef<number[]>([])
|
|
||||||
const getSelectId = () => {
|
|
||||||
selectIds.current = []
|
|
||||||
list?.map((item) => {
|
|
||||||
if (selectIndex == -1 || selectIndex == item.sale_mode) {
|
|
||||||
checkboxData[item.id] && selectIds.current.push(item.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化金额
|
// 格式化金额
|
||||||
const formatPirce = useCallback((price) => {
|
const formatPirce = useCallback((price) => {
|
||||||
return Number(formatPriceDiv(price))
|
return Number(formatPriceDiv(price))
|
||||||
@ -219,7 +222,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
const product_list = new Set() // 面料
|
const product_list = new Set() // 面料
|
||||||
let color_count = 0 // 颜色数量
|
let color_count = 0 // 颜色数量
|
||||||
let all_count = 0 // 总数量
|
let all_count = 0 // 总数量
|
||||||
list.map((item) => {
|
list.forEach((item) => {
|
||||||
if (checkboxData[item.id]) {
|
if (checkboxData[item.id]) {
|
||||||
estimate_amount += item.estimate_amount
|
estimate_amount += item.estimate_amount
|
||||||
product_list.add(item.product_id)
|
product_list.add(item.product_id)
|
||||||
@ -236,10 +239,10 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
}, [list, checkboxData])
|
}, [list, checkboxData])
|
||||||
|
|
||||||
// 去结算
|
// 去结算
|
||||||
const { fetchData: useFetchData } = GetAdminUserInfoApi()
|
const { fetchData: FetchData } = GetAdminUserInfoApi()
|
||||||
const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi()
|
const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi()
|
||||||
const orderDetail = throttle(async() => {
|
const orderDetail = throttle(async() => {
|
||||||
const res = await useFetchData()
|
const res = await FetchData()
|
||||||
if (res.data.order_access_status !== 3) {
|
if (res.data.order_access_status !== 3) {
|
||||||
if (res.data.order_access_status == 1) { applyOrderAccessFetchData() }
|
if (res.data.order_access_status == 1) { applyOrderAccessFetchData() }
|
||||||
setShowBindSalesman(() => true)
|
setShowBindSalesman(() => true)
|
||||||
@ -249,14 +252,14 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
getSelectId()
|
getSelectId()
|
||||||
if (selectIds.current.length == 0) {
|
if (selectIds.current.length == 0) {
|
||||||
alert.error('请选择面料')
|
alert.error('请选择面料')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const ids = selectIds.current.join('-')
|
const ids = selectIds.current.join('-')
|
||||||
setParam({ ids, sale_mode: selectIndex }) // 临时存储
|
setParam({ ids, sale_mode: selectIndex }) // 临时存储
|
||||||
closePopup()
|
closePopup()
|
||||||
if (intoStatus == 'again') {
|
if (intoStatus == 'again') {
|
||||||
goLink('/pages/order/comfirm', {}, 'redirectTo')
|
goLink('/pages/order/comfirm', {}, 'redirectTo')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goLink('/pages/order/comfirm')
|
goLink('/pages/order/comfirm')
|
||||||
}
|
}
|
||||||
@ -277,9 +280,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
}
|
}
|
||||||
}, 300)
|
}, 300)
|
||||||
|
|
||||||
// 绑定业务员和电话号码
|
|
||||||
const [showBindSalesman, setShowBindSalesman] = useState(false)
|
|
||||||
|
|
||||||
// 显示图片弹窗
|
// 显示图片弹窗
|
||||||
const [showLabImage, setShowLabImage] = useState(false)
|
const [showLabImage, setShowLabImage] = useState(false)
|
||||||
const [labImageValue, setLabImageValue] = useState()
|
const [labImageValue, setLabImageValue] = useState()
|
||||||
@ -309,7 +309,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
<View
|
<View
|
||||||
key={item.value}
|
key={item.value}
|
||||||
onClick={() => selectProduct(item.value)}
|
onClick={() => selectProduct(item.value)}
|
||||||
className={classnames(styles.search_item, selectIndex == item.value && styles.search_item_select)}
|
className={classnames(styles.search_item, selectIndex == item.value && styles.search_item_select)}
|
||||||
>
|
>
|
||||||
{item.title}
|
{item.title}
|
||||||
</View>
|
</View>
|
||||||
@ -325,7 +325,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
key={item}
|
key={item}
|
||||||
className={classnames(styles.product_item, selectIndex != -1 && selectIndex != item.sale_mode && styles.no_product_item_select)}
|
className={classnames(styles.product_item, selectIndex != -1 && selectIndex != item.sale_mode && styles.no_product_item_select)}
|
||||||
>
|
>
|
||||||
<View className={styles.checkbox}>
|
<View className={styles.checkbox}>
|
||||||
<MCheckbox
|
<MCheckbox
|
||||||
@ -412,3 +412,5 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ShopCart
|
||||||
|
|||||||
@ -34,7 +34,7 @@ interface prosObj {
|
|||||||
hasBottom?: true | false // 默认不占位底部
|
hasBottom?: true | false // 默认不占位底部
|
||||||
onBlur?: (e: string, res: object) => void
|
onBlur?: (e: string, res: object) => void
|
||||||
}
|
}
|
||||||
export default memo(forwardRef((props: prosObj, ref) => {
|
const ShoppingCart = (props: prosObj, ref) => {
|
||||||
const {
|
const {
|
||||||
showPopup = false,
|
showPopup = false,
|
||||||
closePopup,
|
closePopup,
|
||||||
@ -105,7 +105,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows = memo(({ id, index, style, data }: any) => {
|
const rows = ({ id, index, style, data }: any) => {
|
||||||
const item = data[index]
|
const item = data[index]
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -120,7 +120,8 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
></Goods>
|
></Goods>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
const Rows = memo(rows)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
|
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
|
||||||
@ -164,7 +165,6 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
placeholder="请输入搜索布料"
|
placeholder="请输入搜索布料"
|
||||||
showBtn={false}
|
showBtn={false}
|
||||||
changeOnSearch={getSearchData}
|
changeOnSearch={getSearchData}
|
||||||
debounceTime={300}
|
|
||||||
adjustPosition
|
adjustPosition
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -181,7 +181,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
itemSize={100} /* 列表单项的高度 */
|
itemSize={100} /* 列表单项的高度 */
|
||||||
overscanCount={1}
|
overscanCount={1}
|
||||||
>
|
>
|
||||||
{rows}
|
{Rows}
|
||||||
</VirtualList>
|
</VirtualList>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@ -212,4 +212,5 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(ShoppingCart))
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { ScrollView, View } from '@tarojs/components'
|
import { ScrollView, View } from '@tarojs/components'
|
||||||
import Taro, { useReady } from '@tarojs/taro'
|
import Taro, { useReady } from '@tarojs/taro'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import React, { memo, useEffect, useMemo, useRef, useState } from 'react'
|
import React, { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import type { StatusParam } from '../infiniteScroll'
|
import type { StatusParam } from '../infiniteScroll'
|
||||||
import InfiniteScroll from '../infiniteScroll'
|
import InfiniteScroll from '../infiniteScroll'
|
||||||
import LoadingCard from '../loadingCard'
|
import LoadingCard from '../loadingCard'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
@ -21,8 +21,7 @@ interface Params {
|
|||||||
hasMore?: true | false
|
hasMore?: true | false
|
||||||
statusMore?: StatusParam
|
statusMore?: StatusParam
|
||||||
}
|
}
|
||||||
|
const SideBar = ({
|
||||||
export default memo(({
|
|
||||||
list = [],
|
list = [],
|
||||||
defaultValue = 0,
|
defaultValue = 0,
|
||||||
height = '100vh',
|
height = '100vh',
|
||||||
@ -34,7 +33,7 @@ export default memo(({
|
|||||||
selfOnScrolltolower,
|
selfOnScrolltolower,
|
||||||
hasMore = true,
|
hasMore = true,
|
||||||
statusMore = 0,
|
statusMore = 0,
|
||||||
}: Params) => {
|
}: Params) => {
|
||||||
const num_half = useRef(0)
|
const num_half = useRef(0)
|
||||||
|
|
||||||
const [selected, setSelected] = useState(defaultValue)
|
const [selected, setSelected] = useState(defaultValue)
|
||||||
@ -44,6 +43,15 @@ export default memo(({
|
|||||||
setSelected(defaultValue)
|
setSelected(defaultValue)
|
||||||
}, [defaultValue])
|
}, [defaultValue])
|
||||||
|
|
||||||
|
const computeSelectTab = (index) => {
|
||||||
|
if ((index + 1) > num_half.current) {
|
||||||
|
const num = index + 1 - num_half.current
|
||||||
|
setTabId(list[num].id.toString())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setTabId(list[0].id.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
const init = () => {
|
const init = () => {
|
||||||
const index = list?.findIndex((item) => {
|
const index = list?.findIndex((item) => {
|
||||||
return item.id == defaultValue
|
return item.id == defaultValue
|
||||||
@ -59,16 +67,6 @@ export default memo(({
|
|||||||
computeSelectTab(index)
|
computeSelectTab(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
const computeSelectTab = (index) => {
|
|
||||||
if ((index + 1) > num_half.current) {
|
|
||||||
const num = index + 1 - num_half.current
|
|
||||||
setTabId(list[num].id.toString())
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setTabId(list[0].id.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Taro.nextTick(() => {
|
Taro.nextTick(() => {
|
||||||
const query = Taro.createSelectorQuery()
|
const query = Taro.createSelectorQuery()
|
||||||
@ -127,4 +125,5 @@ export default memo(({
|
|||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(SideBar)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ interface params {
|
|||||||
sortValue?: { desc: string; asc: string } // 排序规则,后端制定
|
sortValue?: { desc: string; asc: string } // 排序规则,后端制定
|
||||||
}
|
}
|
||||||
type sortParam = 'none'|'top'|'bottom'
|
type sortParam = 'none'|'top'|'bottom'
|
||||||
export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref) => {
|
const SortBtn = ({ status = 'none', onChange, sortValue }: params, ref) => {
|
||||||
const [sortStatus, setSortStatus] = useState<sortParam>()
|
const [sortStatus, setSortStatus] = useState<sortParam>()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSortStatus(() => status)
|
setSortStatus(() => status)
|
||||||
@ -19,11 +19,11 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
|
|||||||
let value = ''
|
let value = ''
|
||||||
if (sortStatus == 'none') {
|
if (sortStatus == 'none') {
|
||||||
status = 'top'
|
status = 'top'
|
||||||
value = sortValue?.asc!
|
value = sortValue?.asc as string
|
||||||
}
|
}
|
||||||
if (sortStatus == 'top') {
|
if (sortStatus == 'top') {
|
||||||
status = 'bottom'
|
status = 'bottom'
|
||||||
value = sortValue?.desc!
|
value = sortValue?.desc as string
|
||||||
}
|
}
|
||||||
if (sortStatus == 'bottom') { status = 'none' }
|
if (sortStatus == 'bottom') { status = 'none' }
|
||||||
setSortStatus(() => status)
|
setSortStatus(() => status)
|
||||||
@ -42,4 +42,5 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default forwardRef(SortBtn)
|
||||||
|
|||||||
@ -73,10 +73,10 @@ const Table: FC<TablePropsType> = (props) => {
|
|||||||
&& dataSource.list.map((source) => {
|
&& dataSource.list.map((source) => {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(styles.tr, styles['bg-line'])} key={source.key}>
|
<View className={classnames(styles.tr, styles['bg-line'])} key={source.key}>
|
||||||
{columns.map((column) => {
|
{columns.map((column, key) => {
|
||||||
if (column.render) {
|
if (column.render) {
|
||||||
return (
|
return (
|
||||||
<View className={styles.td} style={{ width: column.width }}>
|
<View key={key} className={styles.td} style={{ width: column.width }}>
|
||||||
{/* 判断表头是不是有render 有就执行render */}
|
{/* 判断表头是不是有render 有就执行render */}
|
||||||
{column.render(source[column.dataIndex])}
|
{column.render(source[column.dataIndex])}
|
||||||
</View>
|
</View>
|
||||||
@ -84,7 +84,7 @@ const Table: FC<TablePropsType> = (props) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(styles.td, getColumnStyle(column))} style={{ width: column.width }}>
|
<View key={key} className={classnames(styles.td, getColumnStyle(column))} style={{ width: column.width }}>
|
||||||
{
|
{
|
||||||
source[column.dataIndex] // 根据表头填数据
|
source[column.dataIndex] // 根据表头填数据
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ScrollView, View } from '@tarojs/components'
|
import { ScrollView, View } from '@tarojs/components'
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { memo, useEffect, useState } from 'react'
|
import { memo, useEffect, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
@ -17,8 +17,7 @@ interface Params {
|
|||||||
style?: Object
|
style?: Object
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const Tabs = ({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
|
||||||
export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
|
|
||||||
const [selected, setSelected] = useState(defaultValue)
|
const [selected, setSelected] = useState(defaultValue)
|
||||||
const [tabId, setTabId] = useState('')
|
const [tabId, setTabId] = useState('')
|
||||||
|
|
||||||
@ -57,4 +56,5 @@ export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: P
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Tabs)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ interface Param {
|
|||||||
defaultValue?: string
|
defaultValue?: string
|
||||||
onlyRead?: false|true
|
onlyRead?: false|true
|
||||||
}
|
}
|
||||||
export default memo(({ onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false }: Param) => {
|
const TextareaEnhance = ({ onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false }: Param) => {
|
||||||
const [descData, setDescData] = useState({
|
const [descData, setDescData] = useState({
|
||||||
number: 0,
|
number: 0,
|
||||||
value: '',
|
value: '',
|
||||||
@ -38,11 +38,13 @@ export default memo(({ onChange, title = '', placeholder = '请输入', defaultV
|
|||||||
<View className={styles.other_desc}>
|
<View className={styles.other_desc}>
|
||||||
<View className={styles.title}>{title}</View>
|
<View className={styles.title}>{title}</View>
|
||||||
<View className={styles.textarea}>
|
<View className={styles.textarea}>
|
||||||
{(descData.show && !onlyRead) && <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e.detail.value)}></Textarea>
|
{(descData.show && !onlyRead)
|
||||||
|| <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
|
? <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e.detail.value)}></Textarea>
|
||||||
|
: <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
|
||||||
}
|
}
|
||||||
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(TextareaEnhance)
|
||||||
|
|||||||
@ -12,8 +12,7 @@ interface Props {
|
|||||||
start?: DateArg
|
start?: DateArg
|
||||||
onSelectDate?: (any) => void
|
onSelectDate?: (any) => void
|
||||||
}
|
}
|
||||||
|
const TimePicker = (props: Props) => {
|
||||||
export default memo((props: Props) => {
|
|
||||||
const { start = '', end = '', onSelectDate } = props
|
const { start = '', end = '', onSelectDate } = props
|
||||||
const [time, setTime] = useState<any>({})
|
const [time, setTime] = useState<any>({})
|
||||||
|
|
||||||
@ -49,4 +48,5 @@ export default memo((props: Props) => {
|
|||||||
</View> */}
|
</View> */}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(TimePicker)
|
||||||
|
|||||||
@ -11,8 +11,7 @@ interface Props {
|
|||||||
start?: DateArg
|
start?: DateArg
|
||||||
onSelectDate?: (any) => void
|
onSelectDate?: (any) => void
|
||||||
}
|
}
|
||||||
|
const TimePickerPopup = (props: Props) => {
|
||||||
export default memo((props: Props) => {
|
|
||||||
const { showTime = false, closePopup, start = '', end = '', onSelectDate } = props
|
const { showTime = false, closePopup, start = '', end = '', onSelectDate } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -20,4 +19,5 @@ export default memo((props: Props) => {
|
|||||||
<TimePicker start={start} end={end} onSelectDate={onSelectDate}></TimePicker>
|
<TimePicker start={start} end={end} onSelectDate={onSelectDate}></TimePicker>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(TimePickerPopup)
|
||||||
|
|||||||
@ -54,7 +54,7 @@ const popoverStyle = {
|
|||||||
color: '#333333',
|
color: '#333333',
|
||||||
}
|
}
|
||||||
|
|
||||||
const ToolTip = forwardRef<ToolTipRef, ToolTipPropsType>((props, ref) => {
|
const ToolTip = (props: ToolTipPropsType, ref) => {
|
||||||
const id = useId()
|
const id = useId()
|
||||||
const [, setForceUpdate] = useState({})
|
const [, setForceUpdate] = useState({})
|
||||||
const { placement = 'top-start', defaultVisible = false, onVisibleChange, children, content = '请填入提示信息', customClassName, customStyle, customContentStyle } = props
|
const { placement = 'top-start', defaultVisible = false, onVisibleChange, children, content = '请填入提示信息', customClassName, customStyle, customContentStyle } = props
|
||||||
@ -326,6 +326,6 @@ const ToolTip = forwardRef<ToolTipRef, ToolTipPropsType>((props, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default ToolTip
|
export default forwardRef<ToolTipRef, ToolTipPropsType>(ToolTip)
|
||||||
|
|||||||
@ -13,11 +13,13 @@ interface ImageParam {
|
|||||||
defaultList?: string[]
|
defaultList?: string[]
|
||||||
onlyRead?: boolean
|
onlyRead?: boolean
|
||||||
}
|
}
|
||||||
const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false }) => {
|
const PictureItem = ({ onChange, defaultList, onlyRead = false }: ImageParam) => {
|
||||||
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
|
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
|
||||||
|
|
||||||
const [imageList, setImageLise] = useState<string[]>([])
|
const [imageList, setImageLise] = useState<string[]>([])
|
||||||
|
// 筛选内容展示
|
||||||
|
const [showPopup, setshowPopup] = useState(false)
|
||||||
|
const [List, setList] = useState<any[]>([{ id: 1, name: '手机相册', check: false }, { id: 2, name: '从微信对话选择', check: false }])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setImageLise(defaultList || [])
|
setImageLise(defaultList || [])
|
||||||
}, [defaultList])
|
}, [defaultList])
|
||||||
@ -29,17 +31,18 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
|
|||||||
|
|
||||||
// 上传图片逻辑
|
// 上传图片逻辑
|
||||||
const handPic = async(id) => {
|
const handPic = async(id) => {
|
||||||
|
let list: any
|
||||||
// let resArr = List.filter(item => {
|
// let resArr = List.filter(item => {
|
||||||
// return item.check
|
// return item.check
|
||||||
// })
|
// })
|
||||||
if (id == 1) {
|
if (id == 1) {
|
||||||
var list: any = await getWxPhoto('after-sale', 5)
|
list = await getWxPhoto('after-sale', 5)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var list: any = await getChatPhoto('after-sale', 5)
|
list = await getChatPhoto('after-sale', 5)
|
||||||
}
|
}
|
||||||
const images: any[] = []
|
const images: any[] = []
|
||||||
list?.map((item) => {
|
list?.forEach((item) => {
|
||||||
images.push(item.url)
|
images.push(item.url)
|
||||||
})
|
})
|
||||||
setImageLise([...imageList, ...images])
|
setImageLise([...imageList, ...images])
|
||||||
@ -67,15 +70,12 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 筛选内容展示
|
|
||||||
const [showPopup, setshowPopup] = useState(false)
|
|
||||||
const [List, setList] = useState<any[]>([{ id: 1, name: '手机相册', check: false }, { id: 2, name: '从微信对话选择', check: false }])
|
|
||||||
// 点击选择的方式
|
// 点击选择的方式
|
||||||
const handItem = (item) => {
|
const handItem = (item) => {
|
||||||
List.map((it) => {
|
List.map((it) => {
|
||||||
if (item.id == it.id) {
|
if (item.id == it.id) {
|
||||||
it.check = true
|
it.check = true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
it.check = false
|
it.check = false
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
|
|||||||
<>
|
<>
|
||||||
<View className={styles.image_main}>
|
<View className={styles.image_main}>
|
||||||
{imageList?.map((item, index) => (
|
{imageList?.map((item, index) => (
|
||||||
<View className={styles.ImgItem}>
|
<View className={styles.ImgItem} key={index}>
|
||||||
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
|
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
|
||||||
{!onlyRead && <View onClick={() => delImage(index)}>
|
{!onlyRead && <View onClick={() => delImage(index)}>
|
||||||
<IconFont name="icon-guanbi" size={30} customClassName={styles.miconfont_close} color="#ffffff"></IconFont>
|
<IconFont name="icon-guanbi" size={30} customClassName={styles.miconfont_close} color="#ffffff"></IconFont>
|
||||||
@ -119,6 +119,6 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
|
|||||||
</Popup>
|
</Popup>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
export default PictureItem
|
export default memo<ImageParam>(PictureItem)
|
||||||
|
|||||||
@ -35,16 +35,15 @@ const CustomTabBar: FC = () => {
|
|||||||
console.log('selectedId', selectedId)
|
console.log('selectedId', selectedId)
|
||||||
|
|
||||||
const dispatch = useDispatch<Dispatch<TabBarAction>>()
|
const dispatch = useDispatch<Dispatch<TabBarAction>>()
|
||||||
|
const setSelected = (id: TabBarIndexMap[number]['id']) => {
|
||||||
|
dispatch({ type: TabBarType.SET_SELECTED, data: { tabItem, selectedId: id } })
|
||||||
|
}
|
||||||
const handleSelectTabItem = (id: TabBarIndexMap[number]['id']) => {
|
const handleSelectTabItem = (id: TabBarIndexMap[number]['id']) => {
|
||||||
return () => {
|
return () => {
|
||||||
setSelected(id)
|
setSelected(id)
|
||||||
Taro.switchTab({ url: tabItem?.find(item => item.id === id)?.pagePath! })
|
Taro.switchTab({ url: tabItem?.find(item => item.id === id)?.pagePath as string })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const setSelected = (id: TabBarIndexMap[number]['id']) => {
|
|
||||||
dispatch({ type: TabBarType.SET_SELECTED, data: { tabItem, selectedId: id } })
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.customTabBar}>
|
<View className={styles.customTabBar}>
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
||||||
<title></title>
|
<title></title>
|
||||||
<script>
|
<script>
|
||||||
!function(n){function e(){var e=n.document.documentElement,t=e.getBoundingClientRect().width;e.style.fontSize=t>=640?"40px":t<=320?"20px":t/320*20+"px"}n.addEventListener("resize",(function(){e()})),e()}(window);
|
// eslint-disable-next-line no-unused-expressions, no-shadow, no-sequences
|
||||||
|
!(function(n) { function e() { const e = n.document.documentElement; const t = e.getBoundingClientRect().width; e.style.fontSize = t >= 640 ? '40px' : t <= 320 ? '20px' : `${t / 320 * 20}px` }n.addEventListener('resize', () => { e() }), e() }(window))
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import { mpcashManagementOrderaccount } from '@/api/newCollection'
|
import { MpCashManagementOrderAccount } from '@/api/newCollection'
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||||
|
|
||||||
export default () => {
|
const AccountPage = () => {
|
||||||
const [search, setSearch] = useState({
|
const [search, setSearch] = useState({
|
||||||
search_name: null,
|
search_name: null,
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -16,7 +16,7 @@ export default () => {
|
|||||||
})
|
})
|
||||||
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||||
|
|
||||||
const { fetchData: clitentFetch, state: orderState } = mpcashManagementOrderaccount()
|
const { fetchData: clitentFetch, state: orderState } = MpCashManagementOrderAccount()
|
||||||
// 数据加载状态
|
// 数据加载状态
|
||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading! })
|
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading! })
|
||||||
@ -27,22 +27,8 @@ export default () => {
|
|||||||
bankName: '',
|
bankName: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
// 输入了搜索关键字
|
|
||||||
const getSearchData = useCallback((eq) => {
|
|
||||||
pageNum.current.page = 1
|
|
||||||
setClientlist(() => ({ list: [], total: 0 }))
|
|
||||||
setSearch(e => ({ ...e, search_name: eq, size: 10 }))
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (search.search_name === '') {
|
|
||||||
setSearch(e => ({ ...e, search_name: null }))
|
|
||||||
}
|
|
||||||
if (search.search_name !== '') { getCuss() }
|
|
||||||
}, [search])
|
|
||||||
|
|
||||||
// 上拉加载数据
|
// 上拉加载数据
|
||||||
const pageNum = useRef({ size: search.size, page: search.page })
|
const pageNum = useRef({ size: search.size, page: search.page })
|
||||||
const getScrolltolower = useCallback(() => {
|
const getScrolltolower = useCallback(() => {
|
||||||
@ -54,6 +40,13 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}, [clentList])
|
}, [clentList])
|
||||||
|
|
||||||
|
// 输入了搜索关键字
|
||||||
|
const getSearchData = useCallback((eq) => {
|
||||||
|
pageNum.current.page = 1
|
||||||
|
setClientlist(() => ({ list: [], total: 0 }))
|
||||||
|
setSearch(e => ({ ...e, search_name: eq, size: 10 }))
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 列表下拉刷新
|
// 列表下拉刷新
|
||||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||||
const getRefresherRefresh = async() => {
|
const getRefresherRefresh = async() => {
|
||||||
@ -77,6 +70,12 @@ export default () => {
|
|||||||
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||||
setRefresherTriggeredStatus(() => false)
|
setRefresherTriggeredStatus(() => false)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (search.search_name === '') {
|
||||||
|
setSearch(e => ({ ...e, search_name: null }))
|
||||||
|
}
|
||||||
|
if (search.search_name !== '') { getCuss() }
|
||||||
|
}, [search])
|
||||||
// 选择业务员
|
// 选择业务员
|
||||||
const selectClient = (item) => {
|
const selectClient = (item) => {
|
||||||
clentList.list.map((it) => {
|
clentList.list.map((it) => {
|
||||||
@ -146,3 +145,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default AccountPage
|
||||||
|
|||||||
@ -6,11 +6,10 @@ import styles from './index.module.scss'
|
|||||||
import FromList from '@/components/FromList'
|
import FromList from '@/components/FromList'
|
||||||
import Address from '@/components/address'
|
import Address from '@/components/address'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import { mppurchaseraddress, mppurchaseraddressdelect, mppurchaseraddressget, mppurchaseraddressput } from '@/api/addressList'
|
import { MpPurchaserAddress, MpPurchaserAddressDelete, MpPurchaserAddressGet, MpPurchaserAddressPut } from '@/api/addressList'
|
||||||
import { getFilterData } from '@/common/util'
|
|
||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
|
|
||||||
export default () => {
|
const AddAddress = () => {
|
||||||
const [itemList, setItemList] = useState<any[]>(
|
const [itemList, setItemList] = useState<any[]>(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -54,22 +53,6 @@ export default () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const [ischecked, setIsChecked] = useState(false)
|
const [ischecked, setIsChecked] = useState(false)
|
||||||
const onChange = (eq) => {
|
|
||||||
setIsChecked(eq.detail.value)
|
|
||||||
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
|
|
||||||
}
|
|
||||||
|
|
||||||
const router = useRouter()
|
|
||||||
useDidShow(() => {
|
|
||||||
if (router.params.type === 'add') {
|
|
||||||
setNavigationBarTitle({ title: '新增收货地址' })
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setFormData(e => ({ ...e, id: router.params.id as any }))
|
|
||||||
getInfo()
|
|
||||||
setNavigationBarTitle({ title: '编辑收货地址' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
name: '',
|
name: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
@ -81,8 +64,15 @@ export default () => {
|
|||||||
id: '',
|
id: '',
|
||||||
factory: '',
|
factory: '',
|
||||||
})
|
})
|
||||||
|
const onChange = (eq) => {
|
||||||
|
setIsChecked(eq.detail.value)
|
||||||
|
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
// 获取相应id的信息
|
// 获取相应id的信息
|
||||||
const { fetchData: infoFetch } = mppurchaseraddressget()
|
const { fetchData: infoFetch } = MpPurchaserAddressGet()
|
||||||
const [infoObj, setinfoObj] = useState<any>()
|
const [infoObj, setinfoObj] = useState<any>()
|
||||||
const getInfo = async() => {
|
const getInfo = async() => {
|
||||||
const res = await infoFetch({
|
const res = await infoFetch({
|
||||||
@ -116,7 +106,7 @@ export default () => {
|
|||||||
item.value = res.data.phone
|
item.value = res.data.phone
|
||||||
}
|
}
|
||||||
if (item.title === '收货地址') {
|
if (item.title === '收货地址') {
|
||||||
item.value = res.data.province_name, res.data.city_name, res.data.district_name
|
item.value = `${res.data.province_name}${res.data.city_name}${res.data.district_name}`
|
||||||
}
|
}
|
||||||
if (item.title === '详细地址') {
|
if (item.title === '详细地址') {
|
||||||
item.value = res.data.address_detail
|
item.value = res.data.address_detail
|
||||||
@ -131,13 +121,20 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// `${res.data.province_name} + ${res.data.city_name} + ${res.data.district_name}`
|
// `${res.data.province_name} + ${res.data.city_name} + ${res.data.district_name}`
|
||||||
|
useDidShow(() => {
|
||||||
|
if (router.params.type === 'add') {
|
||||||
|
setNavigationBarTitle({ title: '新增收货地址' })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setFormData(e => ({ ...e, id: router.params.id as any }))
|
||||||
|
getInfo()
|
||||||
|
setNavigationBarTitle({ title: '编辑收货地址' })
|
||||||
|
}
|
||||||
|
})
|
||||||
const btnDisabled = useMemo(() => {
|
const btnDisabled = useMemo(() => {
|
||||||
let canShow = false
|
let canShow = false
|
||||||
const obj = itemList.filter((item) => {
|
const obj = itemList.filter((item) => {
|
||||||
if (item.require) {
|
return item.require && (item.value !== '')
|
||||||
return item.value !== ''
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
if (obj.length < 4) {
|
if (obj.length < 4) {
|
||||||
canShow = true
|
canShow = true
|
||||||
@ -214,7 +211,7 @@ export default () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 新增地址
|
// 新增地址
|
||||||
const { fetchData: addAddressFetch } = mppurchaseraddress()
|
const { fetchData: addAddressFetch } = MpPurchaserAddress()
|
||||||
const handAdd = async() => {
|
const handAdd = async() => {
|
||||||
// if (!btnDisabled) return false
|
// if (!btnDisabled) return false
|
||||||
const res = await addAddressFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id) })
|
const res = await addAddressFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id) })
|
||||||
@ -233,7 +230,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 编辑地址
|
// 编辑地址
|
||||||
const { fetchData: putFetch } = mppurchaseraddressput()
|
const { fetchData: putFetch } = MpPurchaserAddressPut()
|
||||||
const handEdit = async() => {
|
const handEdit = async() => {
|
||||||
// if (!btnDisabled) return false
|
// if (!btnDisabled) return false
|
||||||
const res = await putFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id), id: Number(infoObj?.id) })
|
const res = await putFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id), id: Number(infoObj?.id) })
|
||||||
@ -251,7 +248,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除地址
|
// 删除地址
|
||||||
const { fetchData: deleteFetch } = mppurchaseraddressdelect()
|
const { fetchData: deleteFetch } = MpPurchaserAddressDelete()
|
||||||
const handleDelete = async() => {
|
const handleDelete = async() => {
|
||||||
Taro.showModal(({
|
Taro.showModal(({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@ -334,3 +331,5 @@ export default () => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default AddAddress
|
||||||
|
|||||||
@ -30,8 +30,7 @@ interface Params {
|
|||||||
bigMoney?: any // 展示的大写金额,
|
bigMoney?: any // 展示的大写金额,
|
||||||
isOpen?: boolean // 是否展开状态
|
isOpen?: boolean // 是否展开状态
|
||||||
}
|
}
|
||||||
|
const Form = (pros: Params) => {
|
||||||
export default memo((pros: Params) => {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
@ -98,4 +97,5 @@ export default memo((pros: Params) => {
|
|||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Form)
|
||||||
|
|||||||
@ -5,26 +5,17 @@ import classnames from 'classnames'
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Form from './components/form'
|
import Form from './components/form'
|
||||||
import {
|
import {
|
||||||
mpcashManagementOrderaccount, mpcashManagementOrderpost,
|
MpCashManagementOrderAccount, MpCashManagementOrderPost,
|
||||||
mpshouldCollectOrderpurchaser,
|
MpShouldCollectOrderPurchaser,
|
||||||
} from '@/api/newCollection'
|
} from '@/api/newCollection'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import smallToBig from '@/common/money'
|
import smallToBig from '@/common/money'
|
||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
|
|
||||||
export default () => {
|
const AddCollection = () => {
|
||||||
// 获取选择的客户
|
// 获取选择的客户
|
||||||
const pages = Taro.getCurrentPages()
|
const pages = Taro.getCurrentPages()
|
||||||
const currPage = pages[pages.length - 1] // 获取当前页面
|
const currPage = pages[pages.length - 1] // 获取当前页面
|
||||||
useDidShow(() => {
|
|
||||||
setQuery(e => ({
|
|
||||||
...e,
|
|
||||||
purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : Query.purchaser_id,
|
|
||||||
clientName: currPage.data?.clientName ? currPage.data?.clientName : Query.clientName,
|
|
||||||
bankId: currPage.data?.bankId ? currPage.data?.bankId : Query.bankId,
|
|
||||||
bankName: currPage.data?.bankName ? currPage.data?.bankName : Query.bankName,
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
const [Query, setQuery] = useState<any>({})
|
const [Query, setQuery] = useState<any>({})
|
||||||
|
|
||||||
@ -35,12 +26,8 @@ export default () => {
|
|||||||
setQuery(val => ({ ...val, picList: list }))
|
setQuery(val => ({ ...val, picList: list }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getCuss()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 获取首个银行账号
|
// 获取首个银行账号
|
||||||
const { fetchData: clitentFetch } = mpcashManagementOrderaccount()
|
const { fetchData: clitentFetch } = MpCashManagementOrderAccount()
|
||||||
const getCuss = async() => {
|
const getCuss = async() => {
|
||||||
const res = await clitentFetch({ page: 1, size: 10 })
|
const res = await clitentFetch({ page: 1, size: 10 })
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
@ -48,7 +35,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { fetchData: scanFetch } = mpshouldCollectOrderpurchaser()
|
const { fetchData: scanFetch } = MpShouldCollectOrderPurchaser()
|
||||||
// 扫描
|
// 扫描
|
||||||
const handScan = (e) => {
|
const handScan = (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
@ -81,7 +68,18 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useDidShow(() => {
|
||||||
|
setQuery(e => ({
|
||||||
|
...e,
|
||||||
|
purchaser_id: currPage.data?.clientId ? currPage.data?.clientId : Query.purchaser_id,
|
||||||
|
clientName: currPage.data?.clientName ? currPage.data?.clientName : Query.clientName,
|
||||||
|
bankId: currPage.data?.bankId ? currPage.data?.bankId : Query.bankId,
|
||||||
|
bankName: currPage.data?.bankName ? currPage.data?.bankName : Query.bankName,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
useEffect(() => {
|
||||||
|
getCuss()
|
||||||
|
}, [])
|
||||||
// 判断是否可以提交
|
// 判断是否可以提交
|
||||||
const isDisabled = useMemo(() => {
|
const isDisabled = useMemo(() => {
|
||||||
if (Query.clientName == ''
|
if (Query.clientName == ''
|
||||||
@ -125,7 +123,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 确认新建
|
// 确认新建
|
||||||
const { fetchData: sureFetch } = mpcashManagementOrderpost()
|
const { fetchData: sureFetch } = MpCashManagementOrderPost()
|
||||||
const handSure = () => {
|
const handSure = () => {
|
||||||
const query = {
|
const query = {
|
||||||
payment_credential_url: picUrl.current,
|
payment_credential_url: picUrl.current,
|
||||||
@ -279,3 +277,5 @@ export default () => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default AddCollection
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { useState } from 'react'
|
|||||||
import AddressList from '@/components/AddressList'
|
import AddressList from '@/components/AddressList'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
export default () => {
|
const AddressManager = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
return (
|
return (
|
||||||
<View className="address-manager">
|
<View className="address-manager">
|
||||||
@ -13,3 +13,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default AddressManager
|
||||||
|
|||||||
@ -5,21 +5,99 @@ import classnames from 'classnames'
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import {
|
import {
|
||||||
mpenumreturnExplain,
|
MpEnumReturnExplain,
|
||||||
mpenumreturnOrderreturnReason,
|
MpEnumReturnGoodsStatus,
|
||||||
mpenumreturngoodsStatus,
|
MpEnumReturnOrderReturnReason,
|
||||||
mpreturnApplyOrder,
|
MpReturnApplyOrder,
|
||||||
mpsaleOrder,
|
MpSaleOrder,
|
||||||
} from '@/api/order'
|
} from '@/api/order'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import UploadImage from '@/components/uploadImage'
|
import UploadImage from '@/components/uploadImage'
|
||||||
|
|
||||||
export default () => {
|
// 产品商品元素
|
||||||
|
interface PropGoods {
|
||||||
|
list: any[]
|
||||||
|
obj: {
|
||||||
|
sale_mode?: number | string
|
||||||
|
}
|
||||||
|
handTui?: (any) => void
|
||||||
|
handCancel?: (any) => void
|
||||||
|
onBlur?: (e: any, obj: any) => void
|
||||||
|
onInputEven?: (e: any, obj: any) => void
|
||||||
|
handReduce?: (any) => void
|
||||||
|
handAdd?: (any) => void
|
||||||
|
}
|
||||||
|
const GoodsItem = (porps: PropGoods) => {
|
||||||
|
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||||
|
// const [value, setValue] = useState<any>({ count: 1 })
|
||||||
|
// const onInputEven = (e) => {
|
||||||
|
// let res = Number(e.detail.value)
|
||||||
|
// if (res < 1) {
|
||||||
|
// setValue({ count: 1 })
|
||||||
|
// } else {
|
||||||
|
// setValue({ count: res })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
list.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<View className={styles.goodsBox} key={index}>
|
||||||
|
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||||
|
<View className={styles.goodsLine}></View>
|
||||||
|
{
|
||||||
|
item.av_product_color.map((it, inx) => {
|
||||||
|
return (
|
||||||
|
<View className={styles.itemGoods} key={inx}>
|
||||||
|
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||||
|
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||||
|
<View className={styles.itemRight}>
|
||||||
|
<View className={styles.item_right_top}>
|
||||||
|
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.item_right_Bottom}>
|
||||||
|
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||||
|
{
|
||||||
|
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||||
|
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||||
|
<View className={styles.reduce}></View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.inputBig}>
|
||||||
|
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||||
|
</View>
|
||||||
|
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||||
|
+
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const GoodsItemWithMemo = memo(GoodsItem)
|
||||||
|
|
||||||
|
const ApplyGoods = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
useEffect(() => {
|
|
||||||
getDetail()
|
const { fetchData: infoFetch } = MpSaleOrder()
|
||||||
}, [])
|
|
||||||
const { fetchData: infoFetch } = mpsaleOrder()
|
|
||||||
const [infoObj, setInfoObj] = useState<any>({})
|
const [infoObj, setInfoObj] = useState<any>({})
|
||||||
const [ListArr, setListArr] = useState<any[]>([])
|
const [ListArr, setListArr] = useState<any[]>([])
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
@ -31,7 +109,7 @@ export default () => {
|
|||||||
const res = await infoFetch({ id: router.params.orderId })
|
const res = await infoFetch({ id: router.params.orderId })
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
res.data.av_return_product.forEach((item) => {
|
res.data.av_return_product.forEach((item) => {
|
||||||
item.av_product_color.map((it) => {
|
item.av_product_color.forEach((it) => {
|
||||||
it.isTui = false
|
it.isTui = false
|
||||||
it.nums = 1
|
it.nums = 1
|
||||||
})
|
})
|
||||||
@ -132,16 +210,12 @@ export default () => {
|
|||||||
// 点击加
|
// 点击加
|
||||||
const handAdd = (val) => {
|
const handAdd = (val) => {
|
||||||
ListArr.forEach((item) => {
|
ListArr.forEach((item) => {
|
||||||
item.av_product_color.map((it) => {
|
item.av_product_color.forEach((it) => {
|
||||||
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
||||||
if (it.nums < it.roll) {
|
if (it.nums < it.roll) {
|
||||||
it.nums++
|
it.nums++
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return it
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
setListArr([...ListArr])
|
setListArr([...ListArr])
|
||||||
@ -159,6 +233,10 @@ export default () => {
|
|||||||
return arr.length
|
return arr.length
|
||||||
}, [ListArr])
|
}, [ListArr])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDetail()
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 获取图片列表
|
// 获取图片列表
|
||||||
const picUrl = useRef([])
|
const picUrl = useRef([])
|
||||||
const getImageList = useCallback((list) => {
|
const getImageList = useCallback((list) => {
|
||||||
@ -168,11 +246,6 @@ export default () => {
|
|||||||
// 筛选内容展示
|
// 筛选内容展示
|
||||||
const [showPopup, setshowPopup] = useState(false)
|
const [showPopup, setshowPopup] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getReason()
|
|
||||||
getReasonTwo()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const queryRef = useRef(
|
const queryRef = useRef(
|
||||||
{
|
{
|
||||||
return_reason: 1, // 退货原因
|
return_reason: 1, // 退货原因
|
||||||
@ -210,7 +283,7 @@ export default () => {
|
|||||||
}, [Query, totalNums])
|
}, [Query, totalNums])
|
||||||
|
|
||||||
/// 获取退货原因
|
/// 获取退货原因
|
||||||
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
|
const { fetchData: resonFetch } = MpEnumReturnOrderReturnReason()
|
||||||
const [ReasonList, setReasonList] = useState<any[]>([])
|
const [ReasonList, setReasonList] = useState<any[]>([])
|
||||||
const getReason = async() => {
|
const getReason = async() => {
|
||||||
const res = await resonFetch()
|
const res = await resonFetch()
|
||||||
@ -220,7 +293,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取退货原因2
|
// 获取退货原因2
|
||||||
const { fetchData: resonTwoFetch } = mpenumreturnExplain()
|
const { fetchData: resonTwoFetch } = MpEnumReturnExplain()
|
||||||
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
|
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
|
||||||
const getReasonTwo = async() => {
|
const getReasonTwo = async() => {
|
||||||
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
|
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
|
||||||
@ -264,7 +337,18 @@ export default () => {
|
|||||||
|
|
||||||
// queryRef.current.return_explain = item.id
|
// queryRef.current.return_explain = item.id
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getReason()
|
||||||
|
getReasonTwo()
|
||||||
|
}, [])
|
||||||
|
// 数组重置
|
||||||
|
const resetArr = (arr) => {
|
||||||
|
arr.map((it) => {
|
||||||
|
it.default = false
|
||||||
|
return it
|
||||||
|
})
|
||||||
|
return arr
|
||||||
|
}
|
||||||
// 重置
|
// 重置
|
||||||
const handReset = () => {
|
const handReset = () => {
|
||||||
queryRef.current.return_reason = 1
|
queryRef.current.return_reason = 1
|
||||||
@ -279,15 +363,6 @@ export default () => {
|
|||||||
setReasonListTwo([...arrTwo])
|
setReasonListTwo([...arrTwo])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数组重置
|
|
||||||
const resetArr = (arr) => {
|
|
||||||
arr.map((it) => {
|
|
||||||
it.default = false
|
|
||||||
return it
|
|
||||||
})
|
|
||||||
return arr
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断选择原因
|
// 判断选择原因
|
||||||
const selectIsDisabled = useMemo(() => {
|
const selectIsDisabled = useMemo(() => {
|
||||||
if (Query.return_explain !== '') {
|
if (Query.return_explain !== '') {
|
||||||
@ -327,18 +402,18 @@ export default () => {
|
|||||||
|
|
||||||
// 货物情况
|
// 货物情况
|
||||||
const [DescPopup, setDescPopup] = useState(false)
|
const [DescPopup, setDescPopup] = useState(false)
|
||||||
const { fetchData: statusFetch } = mpenumreturngoodsStatus()
|
const { fetchData: statusFetch } = MpEnumReturnGoodsStatus()
|
||||||
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
|
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
|
||||||
useEffect(() => {
|
|
||||||
getGoodStatus()
|
|
||||||
}, [])
|
|
||||||
const getGoodStatus = async() => {
|
const getGoodStatus = async() => {
|
||||||
const res = await statusFetch()
|
const res = await statusFetch()
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
setGoodStatusList(res.data.list)
|
setGoodStatusList(res.data.list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getGoodStatus()
|
||||||
|
}, [])
|
||||||
const handStatus = (item) => {
|
const handStatus = (item) => {
|
||||||
GoodStatusList.map((it) => {
|
GoodStatusList.map((it) => {
|
||||||
if (it.id === item.id) {
|
if (it.id === item.id) {
|
||||||
@ -389,9 +464,10 @@ export default () => {
|
|||||||
delta: 1,
|
delta: 1,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 备注信息
|
||||||
|
const [TextareaValue, setTextareaValue] = useState('')
|
||||||
// 确认退货
|
// 确认退货
|
||||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
const { fetchData: sureFetch } = MpReturnApplyOrder()
|
||||||
const handSure = () => {
|
const handSure = () => {
|
||||||
if (Query.reasonNameTwo == '其他问题' && TextareaValue == '') {
|
if (Query.reasonNameTwo == '其他问题' && TextareaValue == '') {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -458,15 +534,13 @@ export default () => {
|
|||||||
setQuery(Query)
|
setQuery(Query)
|
||||||
}, [Query])
|
}, [Query])
|
||||||
|
|
||||||
// 备注信息
|
|
||||||
const [TextareaValue, setTextareaValue] = useState('')
|
|
||||||
const getDesc = (e) => {
|
const getDesc = (e) => {
|
||||||
setTextareaValue(e)
|
setTextareaValue(e)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
<View className={styles.bgBox}>
|
<View className={styles.bgBox}>
|
||||||
<GoodsItem
|
<GoodsItemWithMemo
|
||||||
list={ListArr}
|
list={ListArr}
|
||||||
obj={infoObj}
|
obj={infoObj}
|
||||||
handTui={item => handTui(item)}
|
handTui={item => handTui(item)}
|
||||||
@ -475,7 +549,7 @@ export default () => {
|
|||||||
handReduce={item => handReduce(item)}
|
handReduce={item => handReduce(item)}
|
||||||
handAdd={item => handAdd(item)}
|
handAdd={item => handAdd(item)}
|
||||||
onInputEven={(e, item) => onInputEven(e, item)}
|
onInputEven={(e, item) => onInputEven(e, item)}
|
||||||
></GoodsItem>
|
></GoodsItemWithMemo>
|
||||||
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.resonBig}>
|
<View className={styles.resonBig}>
|
||||||
@ -589,82 +663,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default ApplyGoods
|
||||||
// 产品商品元素
|
|
||||||
interface PropGoods {
|
|
||||||
list: any[]
|
|
||||||
obj: {
|
|
||||||
sale_mode?: number | string
|
|
||||||
}
|
|
||||||
handTui?: (any) => void
|
|
||||||
handCancel?: (any) => void
|
|
||||||
onBlur?: (e: any, obj: any) => void
|
|
||||||
onInputEven?: (e: any, obj: any) => void
|
|
||||||
handReduce?: (any) => void
|
|
||||||
handAdd?: (any) => void
|
|
||||||
}
|
|
||||||
const GoodsItem = memo((porps: PropGoods) => {
|
|
||||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
|
||||||
// const [value, setValue] = useState<any>({ count: 1 })
|
|
||||||
// const onInputEven = (e) => {
|
|
||||||
// let res = Number(e.detail.value)
|
|
||||||
// if (res < 1) {
|
|
||||||
// setValue({ count: 1 })
|
|
||||||
// } else {
|
|
||||||
// setValue({ count: res })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
list.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.goodsBox} key={index}>
|
|
||||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
|
||||||
<View className={styles.goodsLine}></View>
|
|
||||||
{
|
|
||||||
item.av_product_color.map((it, inx) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.itemGoods} key={inx}>
|
|
||||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
|
||||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
|
||||||
<View className={styles.itemRight}>
|
|
||||||
<View className={styles.item_right_top}>
|
|
||||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.item_right_Bottom}>
|
|
||||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
|
||||||
{
|
|
||||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
|
||||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
|
||||||
<View className={styles.reduce}></View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.inputBig}>
|
|
||||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
|
||||||
</View>
|
|
||||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
|
||||||
+
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</>
|
|
||||||
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|||||||
@ -5,19 +5,96 @@ import classnames from 'classnames'
|
|||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import {
|
import {
|
||||||
mpenumrefundExplainone,
|
MpEnumRefundExplainOne,
|
||||||
mpreturnApplyOrder,
|
MpReturnApplyOrder,
|
||||||
mpsaleOrder,
|
MpSaleOrder,
|
||||||
} from '@/api/order'
|
} from '@/api/order'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
|
|
||||||
export default () => {
|
// 产品商品元素
|
||||||
useEffect(() => {
|
interface PropGoods {
|
||||||
getDetail()
|
list: any[]
|
||||||
getEnum()
|
obj: {
|
||||||
}, [])
|
sale_mode?: number | string
|
||||||
|
}
|
||||||
|
handTui?: (any) => void
|
||||||
|
handCancel?: (any) => void
|
||||||
|
onBlur?: (e: any, obj: any) => void
|
||||||
|
onInputEven?: (e: any, obj: any) => void
|
||||||
|
handReduce?: (any) => void
|
||||||
|
handAdd?: (any) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const GoodsItem = (porps: PropGoods) => {
|
||||||
|
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
||||||
|
// const [value, setValue] = useState<any>({ count: 1 })
|
||||||
|
// const onInputEven = (e) => {
|
||||||
|
// let res = Number(e.detail.value)
|
||||||
|
// if (res < 1) {
|
||||||
|
// setValue({ count: 1 })
|
||||||
|
// } else {
|
||||||
|
// setValue({ count: res })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
list.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<View className={styles.goodsBox} key={index}>
|
||||||
|
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
||||||
|
<View className={styles.goodsLine}></View>
|
||||||
|
{
|
||||||
|
item.av_product_color.map((it, inx) => {
|
||||||
|
return (
|
||||||
|
<View className={styles.itemGoods} key={inx}>
|
||||||
|
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||||
|
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
||||||
|
<View className={styles.itemRight}>
|
||||||
|
<View className={styles.item_right_top}>
|
||||||
|
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.item_right_Bottom}>
|
||||||
|
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
||||||
|
{
|
||||||
|
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
||||||
|
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
||||||
|
<View className={styles.reduce}></View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.inputBig}>
|
||||||
|
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
||||||
|
</View>
|
||||||
|
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
||||||
|
+
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const GoodsItemWithMemo = memo(GoodsItem)
|
||||||
|
|
||||||
|
const ApplyMoney = () => {
|
||||||
const Router = useRouter()
|
const Router = useRouter()
|
||||||
const { fetchData: infoFetch } = mpsaleOrder()
|
const { fetchData: infoFetch } = MpSaleOrder()
|
||||||
const [ListArr, setListArr] = useState<any[]>([])
|
const [ListArr, setListArr] = useState<any[]>([])
|
||||||
const [infoObj, setInfoObj] = useState<any>({})
|
const [infoObj, setInfoObj] = useState<any>({})
|
||||||
|
|
||||||
@ -30,7 +107,7 @@ export default () => {
|
|||||||
const res = await infoFetch({ id: Router.params.orderId })
|
const res = await infoFetch({ id: Router.params.orderId })
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
res.data.av_return_product.forEach((item) => {
|
res.data.av_return_product.forEach((item) => {
|
||||||
item.av_product_color.map((it) => {
|
item.av_product_color.forEach((it) => {
|
||||||
it.isTui = false
|
it.isTui = false
|
||||||
it.nums = 1
|
it.nums = 1
|
||||||
})
|
})
|
||||||
@ -132,16 +209,12 @@ export default () => {
|
|||||||
// 点击加
|
// 点击加
|
||||||
const handAdd = (val) => {
|
const handAdd = (val) => {
|
||||||
ListArr.forEach((item) => {
|
ListArr.forEach((item) => {
|
||||||
item.av_product_color.map((it) => {
|
item.av_product_color.forEach((it) => {
|
||||||
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
if (it.sale_order_detail_id === val.sale_order_detail_id) {
|
||||||
if (it.nums < it.roll) {
|
if (it.nums < it.roll) {
|
||||||
it.nums++
|
it.nums++
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return it
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
setListArr([...ListArr])
|
setListArr([...ListArr])
|
||||||
@ -149,14 +222,20 @@ export default () => {
|
|||||||
|
|
||||||
// 获取枚举
|
// 获取枚举
|
||||||
const [List, setList] = useState<any[]>([])
|
const [List, setList] = useState<any[]>([])
|
||||||
const { fetchData: explanFetch } = mpenumrefundExplainone()
|
const { fetchData: explanFetch } = MpEnumRefundExplainOne()
|
||||||
const getEnum = async() => {
|
const getEnum = async() => {
|
||||||
const res = await explanFetch()
|
const res = await explanFetch()
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
setList(res.data.list)
|
setList(res.data.list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const queryRef = useRef({
|
||||||
|
reasonName: '请选择',
|
||||||
|
})
|
||||||
|
const [Query, setQuery] = useState<any>({
|
||||||
|
reasonId: '',
|
||||||
|
reasonName: '请选择',
|
||||||
|
})
|
||||||
// 选择退货原因
|
// 选择退货原因
|
||||||
const handReasonOne = (item) => {
|
const handReasonOne = (item) => {
|
||||||
List.map((it) => {
|
List.map((it) => {
|
||||||
@ -176,14 +255,6 @@ export default () => {
|
|||||||
// 筛选内容展示
|
// 筛选内容展示
|
||||||
const [showPopup, setshowPopup] = useState(false)
|
const [showPopup, setshowPopup] = useState(false)
|
||||||
|
|
||||||
const queryRef = useRef({
|
|
||||||
reasonName: '请选择',
|
|
||||||
})
|
|
||||||
const [Query, setQuery] = useState<any>({
|
|
||||||
reasonId: '',
|
|
||||||
reasonName: '请选择',
|
|
||||||
})
|
|
||||||
|
|
||||||
// 备注信息
|
// 备注信息
|
||||||
const [TextareaValue, setTextareaValue] = useState('')
|
const [TextareaValue, setTextareaValue] = useState('')
|
||||||
const getDesc = (e) => {
|
const getDesc = (e) => {
|
||||||
@ -214,7 +285,14 @@ export default () => {
|
|||||||
})
|
})
|
||||||
return arr.length
|
return arr.length
|
||||||
}, [ListArr])
|
}, [ListArr])
|
||||||
|
// 数组重置
|
||||||
|
const resetArr = (arr) => {
|
||||||
|
arr.map((it) => {
|
||||||
|
it.default = false
|
||||||
|
return it
|
||||||
|
})
|
||||||
|
return arr
|
||||||
|
}
|
||||||
// 重置
|
// 重置
|
||||||
const handReset = () => {
|
const handReset = () => {
|
||||||
setQuery(({ reasonId: '', reasonName: '请选择' }))
|
setQuery(({ reasonId: '', reasonName: '请选择' }))
|
||||||
@ -251,17 +329,13 @@ export default () => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}, [Query])
|
}, [Query])
|
||||||
|
useEffect(() => {
|
||||||
|
getDetail()
|
||||||
|
getEnum()
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 数组重置
|
|
||||||
const resetArr = (arr) => {
|
|
||||||
arr.map((it) => {
|
|
||||||
it.default = false
|
|
||||||
return it
|
|
||||||
})
|
|
||||||
return arr
|
|
||||||
}
|
|
||||||
// 确认退款
|
// 确认退款
|
||||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
const { fetchData: sureFetch } = MpReturnApplyOrder()
|
||||||
const handSure = () => {
|
const handSure = () => {
|
||||||
if (queryRef.current.reasonName == '其他问题' && TextareaValue == '') {
|
if (queryRef.current.reasonName == '其他问题' && TextareaValue == '') {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -354,7 +428,7 @@ export default () => {
|
|||||||
<View className={styles.main}>
|
<View className={styles.main}>
|
||||||
{
|
{
|
||||||
showItem && <View className={styles.bgBox}>
|
showItem && <View className={styles.bgBox}>
|
||||||
<GoodsItem
|
<GoodsItemWithMemo
|
||||||
list={ListArr}
|
list={ListArr}
|
||||||
obj={infoObj}
|
obj={infoObj}
|
||||||
handTui={item => handTui(item)}
|
handTui={item => handTui(item)}
|
||||||
@ -363,7 +437,7 @@ export default () => {
|
|||||||
handReduce={item => handReduce(item)}
|
handReduce={item => handReduce(item)}
|
||||||
handAdd={item => handAdd(item)}
|
handAdd={item => handAdd(item)}
|
||||||
onInputEven={(e, item) => onInputEven(e, item)}
|
onInputEven={(e, item) => onInputEven(e, item)}
|
||||||
></GoodsItem>
|
></GoodsItemWithMemo>
|
||||||
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
@ -435,82 +509,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default ApplyMoney
|
||||||
// 产品商品元素
|
|
||||||
interface PropGoods {
|
|
||||||
list: any[]
|
|
||||||
obj: {
|
|
||||||
sale_mode?: number | string
|
|
||||||
}
|
|
||||||
handTui?: (any) => void
|
|
||||||
handCancel?: (any) => void
|
|
||||||
onBlur?: (e: any, obj: any) => void
|
|
||||||
onInputEven?: (e: any, obj: any) => void
|
|
||||||
handReduce?: (any) => void
|
|
||||||
handAdd?: (any) => void
|
|
||||||
}
|
|
||||||
const GoodsItem = memo((porps: PropGoods) => {
|
|
||||||
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
|
|
||||||
// const [value, setValue] = useState<any>({ count: 1 })
|
|
||||||
// const onInputEven = (e) => {
|
|
||||||
// let res = Number(e.detail.value)
|
|
||||||
// if (res < 1) {
|
|
||||||
// setValue({ count: 1 })
|
|
||||||
// } else {
|
|
||||||
// setValue({ count: res })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
list.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.goodsBox} key={index}>
|
|
||||||
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
|
|
||||||
<View className={styles.goodsLine}></View>
|
|
||||||
{
|
|
||||||
item.av_product_color.map((it, inx) => {
|
|
||||||
return (
|
|
||||||
<View className={styles.itemGoods} key={inx}>
|
|
||||||
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
|
||||||
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
|
|
||||||
<View className={styles.itemRight}>
|
|
||||||
<View className={styles.item_right_top}>
|
|
||||||
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.item_right_Bottom}>
|
|
||||||
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
|
|
||||||
{
|
|
||||||
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
|
|
||||||
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
|
|
||||||
<View className={styles.reduce}></View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.inputBig}>
|
|
||||||
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
|
|
||||||
</View>
|
|
||||||
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
|
|
||||||
+
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</>
|
|
||||||
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|||||||
@ -29,8 +29,7 @@ interface Params {
|
|||||||
showSizeFont?: boolean // 展示金额的大写
|
showSizeFont?: boolean // 展示金额的大写
|
||||||
bigMoney?: any // 展示的大写金额
|
bigMoney?: any // 展示的大写金额
|
||||||
}
|
}
|
||||||
|
const Form = (pros: Params) => {
|
||||||
export default memo((pros: Params) => {
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.itemBox}
|
<View className={styles.itemBox}
|
||||||
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}
|
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}
|
||||||
@ -98,4 +97,5 @@ export default memo((pros: Params) => {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Form)
|
||||||
|
|||||||
@ -11,20 +11,15 @@ import Popup from '@/components/popup'
|
|||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import {
|
import {
|
||||||
mpcashManagementOrder,
|
MpCashManagementOrder,
|
||||||
} from '@/api/newCollection'
|
} from '@/api/newCollection'
|
||||||
import TimePicker from '@/components/timePicker'
|
|
||||||
import { alert } from '@/common/common'
|
|
||||||
import smallToBig from '@/common/money'
|
import smallToBig from '@/common/money'
|
||||||
import { IMG_CND_Prefix } from '@/common/constant'
|
|
||||||
|
|
||||||
export default () => {
|
const CollectionDetail = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [Query, setQuery] = useState<any>({})
|
const [Query, setQuery] = useState<any>({})
|
||||||
const { fetchData: getFetch } = mpcashManagementOrder()
|
const { fetchData: getFetch } = MpCashManagementOrder()
|
||||||
useEffect(() => {
|
|
||||||
getDetail()
|
|
||||||
}, [])
|
|
||||||
const getDetail = async() => {
|
const getDetail = async() => {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '请稍等',
|
title: '请稍等',
|
||||||
@ -50,7 +45,9 @@ export default () => {
|
|||||||
res = Query.receipt_amount / 100
|
res = Query.receipt_amount / 100
|
||||||
return res
|
return res
|
||||||
}, [Query])
|
}, [Query])
|
||||||
|
useEffect(() => {
|
||||||
|
getDetail()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.topBox}>
|
<View className={styles.topBox}>
|
||||||
@ -152,3 +149,5 @@ export default () => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default CollectionDetail
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import Popup from './Popup'
|
|||||||
import { useBluetooth } from '@/use/contextBlueTooth'
|
import { useBluetooth } from '@/use/contextBlueTooth'
|
||||||
import SearchInput from '@/components/searchInput'
|
import SearchInput from '@/components/searchInput'
|
||||||
|
|
||||||
export default memo(() => {
|
const LinkBlueTooth = () => {
|
||||||
const { state, init, startScan, connect, disconnect } = useBluetooth()
|
const { state, init, startScan, connect, disconnect } = useBluetooth()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -36,7 +36,9 @@ export default memo(() => {
|
|||||||
const onLinkListen = (item) => {
|
const onLinkListen = (item) => {
|
||||||
if (!state.connected && !state.connecting) { connect(item) }
|
if (!state.connected && !state.connecting) { connect(item) }
|
||||||
}
|
}
|
||||||
|
const onFindEven = () => {
|
||||||
|
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
||||||
|
}
|
||||||
const [popupShow, setPopupShow] = useState(false)
|
const [popupShow, setPopupShow] = useState(false)
|
||||||
// 显示设备列表
|
// 显示设备列表
|
||||||
const onFindDevice = () => {
|
const onFindDevice = () => {
|
||||||
@ -52,9 +54,6 @@ export default memo(() => {
|
|||||||
onFindEven()
|
onFindEven()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onFindEven = () => {
|
|
||||||
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
|
|
||||||
}
|
|
||||||
|
|
||||||
// 断开链接
|
// 断开链接
|
||||||
const onDisconnect = () => {
|
const onDisconnect = () => {
|
||||||
@ -84,4 +83,5 @@ export default memo(() => {
|
|||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(LinkBlueTooth)
|
||||||
|
|||||||
@ -12,8 +12,7 @@ interface params {
|
|||||||
onOff: () => void
|
onOff: () => void
|
||||||
onFind: () => void
|
onFind: () => void
|
||||||
}
|
}
|
||||||
|
const Popup = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
||||||
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
|
|
||||||
const [popupShow, setPopupShow] = useState(show)
|
const [popupShow, setPopupShow] = useState(show)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPopupShow(show)
|
setPopupShow(show)
|
||||||
@ -32,9 +31,9 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
<ScrollView scrollY className={style.scroll}>
|
<ScrollView scrollY className={style.scroll}>
|
||||||
{(state.devices
|
{(state.devices
|
||||||
&& state.devices.length > 0
|
&& state.devices.length > 0
|
||||||
&& state?.devices.map((item) => {
|
&& state?.devices.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={style.item} onClick={() => onLink(item)}>
|
<View key={key} className={style.item} onClick={() => onLink(item)}>
|
||||||
<View>{item.name}</View>
|
<View>{item.name}</View>
|
||||||
{(!state.connecting && !state.connected && <View>链接</View>)
|
{(!state.connecting && !state.connected && <View>链接</View>)
|
||||||
|| (state.connecting && item.deviceId == state.connecting.deviceId && <View className={style.link_ing}>正在链接...</View>)
|
|| (state.connecting && item.deviceId == state.connecting.deviceId && <View className={style.link_ing}>正在链接...</View>)
|
||||||
@ -76,4 +75,5 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Popup)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface PropsType {
|
|||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
const DrawerCenter: FC<PropsType> = memo((props) => {
|
const DrawerCenter: FC<PropsType> = (props) => {
|
||||||
const { children, showModal } = props
|
const { children, showModal } = props
|
||||||
|
|
||||||
const [show, setShow] = useState(false)
|
const [show, setShow] = useState(false)
|
||||||
@ -29,5 +29,5 @@ const DrawerCenter: FC<PropsType> = memo((props) => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
})
|
}
|
||||||
export default DrawerCenter
|
export default memo(DrawerCenter)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ interface HistoryListItem {
|
|||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
const HistoryColor = (props: PropsType, ref) => {
|
||||||
const { onColor, showModal, onVisibleChange } = props
|
const { onColor, showModal, onVisibleChange } = props
|
||||||
|
|
||||||
const [visible, setVisible] = usePropsValue({
|
const [visible, setVisible] = usePropsValue({
|
||||||
@ -28,12 +28,6 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
|||||||
onChange: onVisibleChange,
|
onChange: onVisibleChange,
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (visible) {
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
}, [visible])
|
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
() => {
|
() => {
|
||||||
@ -50,6 +44,7 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
|||||||
console.log('closeEven')
|
console.log('closeEven')
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
|
const [list, setList] = useState<HistoryListItem[]>([])
|
||||||
|
|
||||||
// 获取本地列表(无差别存储版本)
|
// 获取本地列表(无差别存储版本)
|
||||||
const getList = () => {
|
const getList = () => {
|
||||||
@ -57,8 +52,11 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
|||||||
console.log('historyColorList==>', historyColorList)
|
console.log('historyColorList==>', historyColorList)
|
||||||
setList(historyColorList || [])
|
setList(historyColorList || [])
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
const [list, setList] = useState<HistoryListItem[]>([])
|
if (visible) {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}, [visible])
|
||||||
|
|
||||||
// 保留1位小数
|
// 保留1位小数
|
||||||
const noScale = (val, num = 1) => {
|
const noScale = (val, num = 1) => {
|
||||||
@ -116,5 +114,5 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
export default HistoryColor
|
export default forwardRef(HistoryColor)
|
||||||
|
|||||||
@ -68,13 +68,12 @@ const FindColor: FC = () => {
|
|||||||
})
|
})
|
||||||
getData(val.lab)
|
getData(val.lab)
|
||||||
}
|
}
|
||||||
|
const [showHistory, setShowHistory] = useState(false)
|
||||||
|
|
||||||
const handleVisibleChange = (visible) => {
|
const handleVisibleChange = (visible) => {
|
||||||
setShowHistory(visible)
|
setShowHistory(visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [showHistory, setShowHistory] = useState(false)
|
|
||||||
|
|
||||||
const ResultContainer = useMemo(() => {
|
const ResultContainer = useMemo(() => {
|
||||||
if (!colorState.loading && list?.length > 0) {
|
if (!colorState.loading && list?.length > 0) {
|
||||||
return <RecommendColor customStyle={{ flex: 1 }} list={list} />
|
return <RecommendColor customStyle={{ flex: 1 }} list={list} />
|
||||||
@ -94,7 +93,18 @@ const FindColor: FC = () => {
|
|||||||
const historyShowEven = () => {
|
const historyShowEven = () => {
|
||||||
setShowHistory(true)
|
setShowHistory(true)
|
||||||
}
|
}
|
||||||
|
// 本地存储取色记录(无差别存储版本)
|
||||||
|
const localSave = (lab) => {
|
||||||
|
const historyColorList = Taro.getStorageSync('historyColor') || []
|
||||||
|
const obj = {
|
||||||
|
...product,
|
||||||
|
p_time: +new Date(),
|
||||||
|
lab,
|
||||||
|
}
|
||||||
|
historyColorList.unshift(obj)
|
||||||
|
if (historyColorList.length > 30) { historyColorList.pop() }
|
||||||
|
Taro.setStorageSync('historyColor', historyColorList)
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!product) {
|
if (!product) {
|
||||||
Taro.showToast({ title: '请选择面料', icon: 'none' })
|
Taro.showToast({ title: '请选择面料', icon: 'none' })
|
||||||
@ -109,19 +119,6 @@ const FindColor: FC = () => {
|
|||||||
}
|
}
|
||||||
}, [bluetoothState.deviceLab])
|
}, [bluetoothState.deviceLab])
|
||||||
|
|
||||||
// 本地存储取色记录(无差别存储版本)
|
|
||||||
const localSave = (lab) => {
|
|
||||||
const historyColorList = Taro.getStorageSync('historyColor') || []
|
|
||||||
const obj = {
|
|
||||||
...product,
|
|
||||||
p_time: +new Date(),
|
|
||||||
lab,
|
|
||||||
}
|
|
||||||
historyColorList.unshift(obj)
|
|
||||||
if (historyColorList.length > 30) { historyColorList.pop() }
|
|
||||||
Taro.setStorageSync('historyColor', historyColorList)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.findColor_main}>
|
<View className={styles.findColor_main}>
|
||||||
<View className={styles.findColor_main_search}>
|
<View className={styles.findColor_main_search}>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { toRgb } from '@/common/bluetooth/color/colorSpace'
|
|||||||
import { productabsorbcontrast } from '@/api/index'
|
import { productabsorbcontrast } from '@/api/index'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
|
|
||||||
export default () => {
|
const SampleComparison = () => {
|
||||||
// 搜索参数
|
// 搜索参数
|
||||||
const [searchField, setSearchField] = useState({
|
const [searchField, setSearchField] = useState({
|
||||||
l1: '',
|
l1: '',
|
||||||
@ -79,15 +79,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [colorList])
|
}, [colorList])
|
||||||
const reset = () => {
|
|
||||||
setColorList({})
|
|
||||||
setBlueToothColor('')
|
|
||||||
setBlueToothColorTwo('')
|
|
||||||
setTime('')
|
|
||||||
setTimeTwo('')
|
|
||||||
setData('')
|
|
||||||
setResult('')
|
|
||||||
}
|
|
||||||
const [data, setData] = useState('')
|
const [data, setData] = useState('')
|
||||||
const [result, setResult] = useState('')
|
const [result, setResult] = useState('')
|
||||||
const { fetchData } = productabsorbcontrast()
|
const { fetchData } = productabsorbcontrast()
|
||||||
@ -126,6 +118,15 @@ export default () => {
|
|||||||
}
|
}
|
||||||
alert.hideLoading()
|
alert.hideLoading()
|
||||||
}
|
}
|
||||||
|
const reset = () => {
|
||||||
|
setColorList({})
|
||||||
|
setBlueToothColor('')
|
||||||
|
setBlueToothColorTwo('')
|
||||||
|
setTime('')
|
||||||
|
setTimeTwo('')
|
||||||
|
setData('')
|
||||||
|
setResult('')
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.body}>
|
<View className={styles.body}>
|
||||||
<View className={styles.topBox}>
|
<View className={styles.topBox}>
|
||||||
@ -186,3 +187,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default SampleComparison
|
||||||
|
|||||||
@ -13,7 +13,7 @@ interface PropsType extends UploadColorEvent {
|
|||||||
uploadConfirmState: boolean
|
uploadConfirmState: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const UploadColor = forwardRef((params: PropsType, ref) => {
|
const UploadColor = (params: PropsType, ref) => {
|
||||||
const { onUploadConfirm, uploadConfirmState } = params
|
const { onUploadConfirm, uploadConfirmState } = params
|
||||||
const [showModal, setShowModal] = useState(false)
|
const [showModal, setShowModal] = useState(false)
|
||||||
const [filePath, setFilePath] = useState('')
|
const [filePath, setFilePath] = useState('')
|
||||||
@ -31,13 +31,6 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (uploadConfirmState) {
|
|
||||||
setFilePath('')
|
|
||||||
handleTriggerUploadModal(false)
|
|
||||||
}
|
|
||||||
}, [uploadConfirmState])
|
|
||||||
|
|
||||||
const handleTriggerUploadModal = (bool: boolean) => {
|
const handleTriggerUploadModal = (bool: boolean) => {
|
||||||
setShowModal(bool)
|
setShowModal(bool)
|
||||||
}
|
}
|
||||||
@ -55,7 +48,12 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
|||||||
const handleUploadConfirm = () => {
|
const handleUploadConfirm = () => {
|
||||||
onUploadConfirm && onUploadConfirm(file)
|
onUploadConfirm && onUploadConfirm(file)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (uploadConfirmState) {
|
||||||
|
setFilePath('')
|
||||||
|
handleTriggerUploadModal(false)
|
||||||
|
}
|
||||||
|
}, [uploadConfirmState])
|
||||||
return (
|
return (
|
||||||
<View className={styles['upload-container']}>
|
<View className={styles['upload-container']}>
|
||||||
<Popup title="上传纹理" show={showModal} onClose={() => handleTriggerUploadModal(false)}>
|
<Popup title="上传纹理" show={showModal} onClose={() => handleTriggerUploadModal(false)}>
|
||||||
@ -75,5 +73,5 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
export default UploadColor
|
export default forwardRef(UploadColor)
|
||||||
|
|||||||
@ -23,6 +23,7 @@ const TakeColor: FC = () => {
|
|||||||
const { measureAndGetLab, state: bluetoothState } = useBluetooth()
|
const { measureAndGetLab, state: bluetoothState } = useBluetooth()
|
||||||
const [searchValue, setSearchValue] = useState('')
|
const [searchValue, setSearchValue] = useState('')
|
||||||
const [selectedProduct, setSelectedProduct] = useState<Record<string, any>>({})
|
const [selectedProduct, setSelectedProduct] = useState<Record<string, any>>({})
|
||||||
|
const [listData, setListData] = useState<Record<string, any>[]>([])
|
||||||
|
|
||||||
const selectInput = async(event) => {
|
const selectInput = async(event) => {
|
||||||
if (event) {
|
if (event) {
|
||||||
@ -30,7 +31,7 @@ const TakeColor: FC = () => {
|
|||||||
setSelectedProduct(event)
|
setSelectedProduct(event)
|
||||||
const res = await fetchData({ id: event.id })
|
const res = await fetchData({ id: event.id })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
res.data?.list.map((item, index) => {
|
res.data?.list.forEach((item, index) => {
|
||||||
item.currnetRgb = item.rgb
|
item.currnetRgb = item.rgb
|
||||||
item.currentLab = item.lab
|
item.currentLab = item.lab
|
||||||
item.sampling = !(item.currentLab?.l == 0 && item.currentLab?.a == 0 && item.currentLab?.b == 0)
|
item.sampling = !(item.currentLab?.l == 0 && item.currentLab?.a == 0 && item.currentLab?.b == 0)
|
||||||
@ -53,18 +54,12 @@ const TakeColor: FC = () => {
|
|||||||
setSearchValue('')
|
setSearchValue('')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePrViewRgb = useCallback((event) => {
|
|
||||||
setLabPreview(event)
|
|
||||||
setShowLabPreview(true)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const [currentTakeColorIndex, setCurrentTakeColorIndex] = useState<number | null>(null)
|
const [currentTakeColorIndex, setCurrentTakeColorIndex] = useState<number | null>(null)
|
||||||
|
|
||||||
const handleTakeColor = (index: number) => {
|
const handleTakeColor = (index: number) => {
|
||||||
setCurrentTakeColorIndex(index)
|
setCurrentTakeColorIndex(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [listData, setListData] = useState<Record<string, any>[]>([])
|
|
||||||
// const listData = useMemo(() => {
|
// const listData = useMemo(() => {
|
||||||
// return state.data?.list?.filter(item => {
|
// return state.data?.list?.filter(item => {
|
||||||
// if (searchValue) {
|
// if (searchValue) {
|
||||||
@ -73,6 +68,7 @@ const TakeColor: FC = () => {
|
|||||||
// return true
|
// return true
|
||||||
// })
|
// })
|
||||||
// }, [state.data?.list, state])
|
// }, [state.data?.list, state])
|
||||||
|
const productSelectEl = useRef<any>(null)
|
||||||
|
|
||||||
const onSearchInput = (event) => {
|
const onSearchInput = (event) => {
|
||||||
const current = event.detail.value
|
const current = event.detail.value
|
||||||
@ -149,8 +145,6 @@ const TakeColor: FC = () => {
|
|||||||
|
|
||||||
const [showLabPreview, setShowLabPreview] = useState(false)
|
const [showLabPreview, setShowLabPreview] = useState(false)
|
||||||
|
|
||||||
const productSelectEl = useRef<any>(null)
|
|
||||||
|
|
||||||
const [uploadConfirmState, setUploadConfirmState] = useState(false)
|
const [uploadConfirmState, setUploadConfirmState] = useState(false)
|
||||||
|
|
||||||
const handleUploadConfirm = async(file) => {
|
const handleUploadConfirm = async(file) => {
|
||||||
@ -185,7 +179,10 @@ const TakeColor: FC = () => {
|
|||||||
alert.none('请选择图片')
|
alert.none('请选择图片')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const handlePrViewRgb = useCallback((event) => {
|
||||||
|
setLabPreview(event)
|
||||||
|
setShowLabPreview(true)
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.card}>
|
<View className={styles.card}>
|
||||||
|
|||||||
@ -13,8 +13,7 @@ interface Props {
|
|||||||
isPhone?: boolean
|
isPhone?: boolean
|
||||||
isBorder?: boolean
|
isBorder?: boolean
|
||||||
}
|
}
|
||||||
|
const Form = (props: Props) => {
|
||||||
export default memo((props: Props) => {
|
|
||||||
const {
|
const {
|
||||||
isPhone = false,
|
isPhone = false,
|
||||||
isBorder = true,
|
isBorder = true,
|
||||||
@ -35,4 +34,5 @@ export default memo((props: Props) => {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Form)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ interface Props {
|
|||||||
list: any[]
|
list: any[]
|
||||||
handChose?: (any) => void
|
handChose?: (any) => void
|
||||||
}
|
}
|
||||||
export default memo((props: Props) => {
|
const Tabs = (props: Props) => {
|
||||||
const { list = [], handChose } = props
|
const { list = [], handChose } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -29,4 +29,5 @@ export default memo((props: Props) => {
|
|||||||
}
|
}
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Tabs)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { alert, goLink } from '@/common/common'
|
|||||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
import Popup from '@/components/popup'
|
import Popup from '@/components/popup'
|
||||||
import { mppurchaserlabeladd, mppurchaserlist } from '@/api/customer'
|
import { MpPurchaserLabelAdd, MpPurchaserList } from '@/api/customer'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
showPopup: boolean
|
showPopup: boolean
|
||||||
@ -15,12 +15,12 @@ interface Props {
|
|||||||
purchaser_id?: string | number
|
purchaser_id?: string | number
|
||||||
diseShow?: () => void
|
diseShow?: () => void
|
||||||
}
|
}
|
||||||
export default memo(forwardRef((props: Props, ref) => {
|
const TagPopup = (props: Props, ref) => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
useEffect(() => {
|
|
||||||
getList()
|
const { fetchData } = MpPurchaserList()
|
||||||
}, [])
|
// 标签
|
||||||
const { fetchData } = mppurchaserlist()
|
const [modeList, setModeList] = useState<any[]>([])
|
||||||
const getList = async() => {
|
const getList = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
@ -28,8 +28,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 标签
|
|
||||||
const [modeList, setModeList] = useState<any[]>([])
|
|
||||||
// 选择标签
|
// 选择标签
|
||||||
const handCheckMode = (item) => {
|
const handCheckMode = (item) => {
|
||||||
modeList.map((it) => {
|
modeList.map((it) => {
|
||||||
@ -48,7 +46,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
})
|
})
|
||||||
setModeList([...modeList])
|
setModeList([...modeList])
|
||||||
}
|
}
|
||||||
const { fetchData: addFetch } = mppurchaserlabeladd()
|
const { fetchData: addFetch } = MpPurchaserLabelAdd()
|
||||||
const handSure = async() => {
|
const handSure = async() => {
|
||||||
const arr: any[] = []
|
const arr: any[] = []
|
||||||
const fltArr = modeList.filter((item) => { return item.checked })
|
const fltArr = modeList.filter((item) => { return item.checked })
|
||||||
@ -98,6 +96,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
modeList,
|
modeList,
|
||||||
setModeList,
|
setModeList,
|
||||||
}))
|
}))
|
||||||
|
useEffect(() => {
|
||||||
|
getList()
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<Popup title="选择标签" show={props.showPopup} onClose={() => { props.handClose() }}>
|
<Popup title="选择标签" show={props.showPopup} onClose={() => { props.handClose() }}>
|
||||||
<ScrollView scrollY className={styles.scrollView}>
|
<ScrollView scrollY className={styles.scrollView}>
|
||||||
@ -142,4 +143,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(TagPopup))
|
||||||
|
|||||||
@ -11,34 +11,21 @@ import { debounce } from '@/common/util'
|
|||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import AddressList from '@/components/AddressList'
|
import AddressList from '@/components/AddressList'
|
||||||
import { mppurchaser } from '@/api/customer'
|
import { MpPurchaser } from '@/api/customer'
|
||||||
|
|
||||||
export default () => {
|
const CustomerDetails = () => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const [status, setstatus] = useState<number>(1)
|
const [status, setstatus] = useState<number>(1)
|
||||||
|
|
||||||
useDidShow(() => {
|
|
||||||
getInfo()
|
|
||||||
})
|
|
||||||
const [infoObj, setinfoObj] = useState<any>()
|
const [infoObj, setinfoObj] = useState<any>()
|
||||||
const { fetchData: getDesc } = mppurchaser()
|
const { fetchData: getDesc } = MpPurchaser()
|
||||||
const getInfo = async() => {
|
|
||||||
Taro.showLoading({
|
|
||||||
title: '请稍等...',
|
|
||||||
mask: true,
|
|
||||||
})
|
|
||||||
const res = await getDesc({ id: router.params.purchaser_id })
|
|
||||||
setinfoObj(res.data)
|
|
||||||
Taro.hideLoading()
|
|
||||||
setshowPopup(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 顶部栏
|
// 顶部栏
|
||||||
const AddressListRef = useRef<any>()
|
const AddressListRef = useRef<any>()
|
||||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }])
|
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }])
|
||||||
const handChose = (item) => {
|
const handChose = (item) => {
|
||||||
TarBarList.map((it) => {
|
TarBarList.forEach((it) => {
|
||||||
if (it.id === item.id) {
|
if (it.id === item.id) {
|
||||||
it.showBorder = true
|
it.showBorder = true
|
||||||
}
|
}
|
||||||
@ -72,6 +59,19 @@ export default () => {
|
|||||||
TagPopupRef.current.setModeList([...TagPopupRef.current.modeList])
|
TagPopupRef.current.setModeList([...TagPopupRef.current.modeList])
|
||||||
setshowPopup(true)
|
setshowPopup(true)
|
||||||
}
|
}
|
||||||
|
const getInfo = async() => {
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '请稍等...',
|
||||||
|
mask: true,
|
||||||
|
})
|
||||||
|
const res = await getDesc({ id: router.params.purchaser_id })
|
||||||
|
setinfoObj(res.data)
|
||||||
|
Taro.hideLoading()
|
||||||
|
setshowPopup(false)
|
||||||
|
}
|
||||||
|
useDidShow(() => {
|
||||||
|
getInfo()
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<View className={styles.mainBox}>
|
<View className={styles.mainBox}>
|
||||||
<View className={styles.mainTop}>
|
<View className={styles.mainTop}>
|
||||||
@ -133,3 +133,4 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default CustomerDetails
|
||||||
|
|||||||
@ -11,14 +11,45 @@ import { debounce } from '@/common/util'
|
|||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import Address from '@/components/address'
|
import Address from '@/components/address'
|
||||||
import { mppurchaser, mppurchaserpost, mppurchaserput } from '@/api/customer'
|
import { MpPurchaser, MpPurchaserPost, MpPurchaserPut } from '@/api/customer'
|
||||||
|
// 卡片盒子元素
|
||||||
|
interface Obs {
|
||||||
|
title?: string
|
||||||
|
modeName?: string
|
||||||
|
showMode?: boolean
|
||||||
|
children?: ReactNode
|
||||||
|
clickNode?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const DefaultBox = (props: Obs) => {
|
||||||
|
const {
|
||||||
|
title = '标题',
|
||||||
|
modeName = '大货',
|
||||||
|
showMode = false,
|
||||||
|
children,
|
||||||
|
clickNode,
|
||||||
|
} = props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={styles.defaltBox}>
|
||||||
|
<View className={styles.titleBox}>
|
||||||
|
<View className={styles.title}>{title}</View>
|
||||||
|
{
|
||||||
|
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<View className={styles.modeLine}></View>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const DefaultBoxWithMemo = memo(DefaultBox)
|
||||||
|
|
||||||
interface AddressParms {
|
interface AddressParms {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
const CustomerEditor = () => {
|
||||||
export default () => {
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const [infoObj, setinfoObj] = useState<any>()
|
const [infoObj, setinfoObj] = useState<any>()
|
||||||
@ -26,11 +57,6 @@ export default () => {
|
|||||||
const [formData, setformData] = useState<any>()
|
const [formData, setformData] = useState<any>()
|
||||||
|
|
||||||
const [addressArr, setaddressArr] = useState<AddressParms[]>([])
|
const [addressArr, setaddressArr] = useState<AddressParms[]>([])
|
||||||
useEffect(() => {
|
|
||||||
if (router.params.type === 'edit') {
|
|
||||||
getInfo()
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 默认业务员
|
// 默认业务员
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
@ -62,46 +88,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { fetchData: getDesc } = mppurchaser()
|
const { fetchData: getDesc } = MpPurchaser()
|
||||||
const getInfo = async() => {
|
|
||||||
Taro.showLoading({
|
|
||||||
title: '请稍等...',
|
|
||||||
mask: true,
|
|
||||||
})
|
|
||||||
const res = await getDesc({ id: router.params.id })
|
|
||||||
setinfoObj(res.data)
|
|
||||||
list.map((item) => {
|
|
||||||
if (item.id == res.data.purchaser_type) {
|
|
||||||
item.check = true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
item.check = false
|
|
||||||
}
|
|
||||||
return item
|
|
||||||
})
|
|
||||||
setlist([...list])
|
|
||||||
setformData({
|
|
||||||
sale_user_id: res.data?.sale_user_id,
|
|
||||||
sale_user_name: res.data?.sale_user_name,
|
|
||||||
name: res.data?.name,
|
|
||||||
short_name: res.data?.short_name,
|
|
||||||
director: res.data?.director,
|
|
||||||
phone: res.data?.phone,
|
|
||||||
addressName: res.data?.province_name + res.data?.city_name + res.data?.district_name,
|
|
||||||
address_detail: res.data?.address_detail,
|
|
||||||
purchaser_type: res.data?.purchaser_type,
|
|
||||||
district_id: res.data?.district_id,
|
|
||||||
})
|
|
||||||
setremarkDesc(res.data?.remark)
|
|
||||||
let arr: any[] = []
|
|
||||||
arr = [
|
|
||||||
{ id: res.data.province_id, name: res.data.province_name },
|
|
||||||
{ id: res.data.city_id, name: res.data.city_name },
|
|
||||||
{ id: res.data.district_id, name: res.data.district_name },
|
|
||||||
]
|
|
||||||
setaddressArr([...arr])
|
|
||||||
Taro.hideLoading()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handTitle = useCallback((e) => {
|
const handTitle = useCallback((e) => {
|
||||||
setformData(val => ({ ...val, name: e }))
|
setformData(val => ({ ...val, name: e }))
|
||||||
@ -156,9 +143,48 @@ export default () => {
|
|||||||
setlist([...list])
|
setlist([...list])
|
||||||
setformData(val => ({ ...val, purchaser_type: item.id }))
|
setformData(val => ({ ...val, purchaser_type: item.id }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 备注操作
|
// 备注操作
|
||||||
const [remarkDesc, setremarkDesc] = useState('')
|
const [remarkDesc, setremarkDesc] = useState('')
|
||||||
|
const getInfo = async() => {
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '请稍等...',
|
||||||
|
mask: true,
|
||||||
|
})
|
||||||
|
const res = await getDesc({ id: router.params.id })
|
||||||
|
setinfoObj(res.data)
|
||||||
|
list.map((item) => {
|
||||||
|
if (item.id == res.data.purchaser_type) {
|
||||||
|
item.check = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item.check = false
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
setlist([...list])
|
||||||
|
setformData({
|
||||||
|
sale_user_id: res.data?.sale_user_id,
|
||||||
|
sale_user_name: res.data?.sale_user_name,
|
||||||
|
name: res.data?.name,
|
||||||
|
short_name: res.data?.short_name,
|
||||||
|
director: res.data?.director,
|
||||||
|
phone: res.data?.phone,
|
||||||
|
addressName: res.data?.province_name + res.data?.city_name + res.data?.district_name,
|
||||||
|
address_detail: res.data?.address_detail,
|
||||||
|
purchaser_type: res.data?.purchaser_type,
|
||||||
|
district_id: res.data?.district_id,
|
||||||
|
})
|
||||||
|
setremarkDesc(res.data?.remark)
|
||||||
|
let arr: any[] = []
|
||||||
|
arr = [
|
||||||
|
{ id: res.data.province_id, name: res.data.province_name },
|
||||||
|
{ id: res.data.city_id, name: res.data.city_name },
|
||||||
|
{ id: res.data.district_id, name: res.data.district_name },
|
||||||
|
]
|
||||||
|
setaddressArr([...arr])
|
||||||
|
Taro.hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
const [showDesc, setShowDesc] = useState(false)
|
const [showDesc, setShowDesc] = useState(false)
|
||||||
const getRemark = useCallback(async(e) => {
|
const getRemark = useCallback(async(e) => {
|
||||||
setShowDesc(false)
|
setShowDesc(false)
|
||||||
@ -183,12 +209,16 @@ export default () => {
|
|||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setShowSiteModal(false)
|
setShowSiteModal(false)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (router.params.type === 'edit') {
|
||||||
|
getInfo()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
const isDisabled = useMemo(() => {
|
const isDisabled = useMemo(() => {
|
||||||
let empty: any = null
|
let empty: any = null
|
||||||
if (typeof (formData) == 'undefined') { return }
|
if (typeof (formData) == 'undefined') { return }
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (formData.hasOwnProperty(key)) {
|
if (key in formData) {
|
||||||
if (formData[key] !== '' && typeof (formData[key]) !== 'undefined') {
|
if (formData[key] !== '' && typeof (formData[key]) !== 'undefined') {
|
||||||
empty = false
|
empty = false
|
||||||
}
|
}
|
||||||
@ -218,8 +248,8 @@ export default () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const { fetchData: postFetch } = mppurchaserpost()
|
const { fetchData: postFetch } = MpPurchaserPost()
|
||||||
const { fetchData: putFetch } = mppurchaserput()
|
const { fetchData: putFetch } = MpPurchaserPut()
|
||||||
// 提交
|
// 提交
|
||||||
const handSure = async() => {
|
const handSure = async() => {
|
||||||
// if (!isDisabled) return false
|
// if (!isDisabled) return false
|
||||||
@ -284,9 +314,9 @@ export default () => {
|
|||||||
>
|
>
|
||||||
<View className={styles.flexBox}>
|
<View className={styles.flexBox}>
|
||||||
{
|
{
|
||||||
list.map((item) => {
|
list.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(item.check ? styles.activeBox : styles.itemBox)} onClick={() => handItem(item)}>{item.name}</View>
|
<View key={key} className={classnames(item.check ? styles.activeBox : styles.itemBox)} onClick={() => handItem(item)}>{item.name}</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -330,9 +360,9 @@ export default () => {
|
|||||||
inputValue={formData?.sale_user_name}
|
inputValue={formData?.sale_user_name}
|
||||||
></Form>
|
></Form>
|
||||||
</View>
|
</View>
|
||||||
<DefaultBox title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
<DefaultBoxWithMemo title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
|
||||||
<View className={classnames(remarkDesc === '' ? styles.remarkFontactive : styles.remarkFont)}>{remarkDesc === '' ? '尚未备注信息' : remarkDesc}</View>
|
<View className={classnames(remarkDesc === '' ? styles.remarkFontactive : styles.remarkFont)}>{remarkDesc === '' ? '尚未备注信息' : remarkDesc}</View>
|
||||||
</DefaultBox>
|
</DefaultBoxWithMemo>
|
||||||
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
|
||||||
<Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} showInput={!!showDesc} />
|
<Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} showInput={!!showDesc} />
|
||||||
</Popup>
|
</Popup>
|
||||||
@ -345,35 +375,4 @@ export default () => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export default CustomerEditor
|
||||||
// 卡片盒子元素
|
|
||||||
interface Obs {
|
|
||||||
title?: string
|
|
||||||
modeName?: string
|
|
||||||
showMode?: boolean
|
|
||||||
children?: ReactNode
|
|
||||||
clickNode?: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
const DefaultBox = memo((props: Obs) => {
|
|
||||||
const {
|
|
||||||
title = '标题',
|
|
||||||
modeName = '大货',
|
|
||||||
showMode = false,
|
|
||||||
children,
|
|
||||||
clickNode,
|
|
||||||
} = props
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View className={styles.defaltBox}>
|
|
||||||
<View className={styles.titleBox}>
|
|
||||||
<View className={styles.title}>{title}</View>
|
|
||||||
{
|
|
||||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<View className={styles.modeLine}></View>
|
|
||||||
{children}
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|||||||
@ -15,8 +15,7 @@ interface Props {
|
|||||||
value?: any
|
value?: any
|
||||||
onCloseOverlay?: () => void
|
onCloseOverlay?: () => void
|
||||||
}
|
}
|
||||||
|
const ChoseCity = (props: Props, ref) => {
|
||||||
export default memo(forwardRef((props: Props, ref) => {
|
|
||||||
const DropDownItemRef = useRef<any>()
|
const DropDownItemRef = useRef<any>()
|
||||||
const close = () => {
|
const close = () => {
|
||||||
DropDownItemRef.current.closePopup()
|
DropDownItemRef.current.closePopup()
|
||||||
@ -35,17 +34,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
|
|
||||||
// 获取地址
|
// 获取地址
|
||||||
const { fetchData } = GetAddressListApi()
|
const { fetchData } = GetAddressListApi()
|
||||||
useEffect(() => {
|
|
||||||
getProvince()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 获取省
|
|
||||||
const getProvince = async() => {
|
|
||||||
const res = await fetchData({ parent_id: 1 })
|
|
||||||
if (res.data) {
|
|
||||||
setlist([...res.data.list])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 已选的集合市
|
// 已选的集合市
|
||||||
// const [choseCityArr, setchoseCityArr] = useState<any[]>([])
|
// const [choseCityArr, setchoseCityArr] = useState<any[]>([])
|
||||||
@ -55,14 +43,23 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
const [list, setlist] = useState<any[]>([])
|
const [list, setlist] = useState<any[]>([])
|
||||||
// 区数组
|
// 区数组
|
||||||
const [cityList, setcityList] = useState<any[]>([])
|
const [cityList, setcityList] = useState<any[]>([])
|
||||||
|
// 获取省
|
||||||
|
const getProvince = async() => {
|
||||||
|
const res = await fetchData({ parent_id: 1 })
|
||||||
|
if (res.data) {
|
||||||
|
setlist([...res.data.list])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getProvince()
|
||||||
|
}, [])
|
||||||
// 区分在哪一栏
|
// 区分在哪一栏
|
||||||
const [currentValue, setCurrentValue] = useState<number>(1)
|
const [currentValue, setCurrentValue] = useState<number>(1)
|
||||||
|
|
||||||
// 顶部栏
|
// 顶部栏
|
||||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '选择省', showBorder: true }, { id: 2, name: '选择市', showBorder: false }])
|
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '选择省', showBorder: true }, { id: 2, name: '选择市', showBorder: false }])
|
||||||
const handChose = (item) => {
|
const handChose = (item) => {
|
||||||
TarBarList.map((it) => {
|
TarBarList.forEach((it) => {
|
||||||
if (it.id === item.id) {
|
if (it.id === item.id) {
|
||||||
it.showBorder = true
|
it.showBorder = true
|
||||||
}
|
}
|
||||||
@ -74,6 +71,23 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取市
|
||||||
|
const getCity = async(id) => {
|
||||||
|
const res = await fetchData({ parent_id: id })
|
||||||
|
if (res.data) {
|
||||||
|
res.data.list.map((item) => {
|
||||||
|
choseCityArr.current.list.forEach((it) => {
|
||||||
|
if (item.id == it.id) {
|
||||||
|
item.check = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
setcityList([...res.data.list])
|
||||||
|
}
|
||||||
|
const provinceArr = list.filter((next) => { return next.check })
|
||||||
|
props.handCity?.(provinceArr, choseCityArr.current.list)
|
||||||
|
}
|
||||||
// 选择省
|
// 选择省
|
||||||
const handProvince = (item) => {
|
const handProvince = (item) => {
|
||||||
list.map((it) => {
|
list.map((it) => {
|
||||||
@ -98,25 +112,6 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
})
|
})
|
||||||
setTarBarList([...TarBarList])
|
setTarBarList([...TarBarList])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取市
|
|
||||||
const getCity = async(id) => {
|
|
||||||
const res = await fetchData({ parent_id: id })
|
|
||||||
if (res.data) {
|
|
||||||
res.data.list.map((item) => {
|
|
||||||
choseCityArr.current.list.forEach((it) => {
|
|
||||||
if (item.id == it.id) {
|
|
||||||
item.check = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return item
|
|
||||||
})
|
|
||||||
setcityList([...res.data.list])
|
|
||||||
}
|
|
||||||
const provinceArr = list.filter((next) => { return next.check })
|
|
||||||
props.handCity?.(provinceArr, choseCityArr.current.list)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 选择市
|
// 选择市
|
||||||
const handCity = (item) => {
|
const handCity = (item) => {
|
||||||
cityList.map((it) => {
|
cityList.map((it) => {
|
||||||
@ -197,9 +192,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
{
|
{
|
||||||
currentValue == 1 && <ScrollView scrollY className={styles.scrollView}>
|
currentValue == 1 && <ScrollView scrollY className={styles.scrollView}>
|
||||||
{
|
{
|
||||||
list.map((item) => {
|
list.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.itemBox} onClick={() => handProvince(item)}>
|
<View key={key} className={styles.itemBox} onClick={() => handProvince(item)}>
|
||||||
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
||||||
<IconFont name="icon-chakanquanbukehu" size={50} color="#d8d8d8"></IconFont>
|
<IconFont name="icon-chakanquanbukehu" size={50} color="#d8d8d8"></IconFont>
|
||||||
</View>
|
</View>
|
||||||
@ -211,9 +206,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
{
|
{
|
||||||
currentValue == 2 && <ScrollView scrollY className={styles.scrollView}>
|
currentValue == 2 && <ScrollView scrollY className={styles.scrollView}>
|
||||||
{
|
{
|
||||||
cityList.map((item) => {
|
cityList.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.itemBox} onClick={() => handCity(item)}>
|
<View key={key} className={styles.itemBox} onClick={() => handCity(item)}>
|
||||||
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
<View className={classnames(item.check ? styles.activeitemProvince : styles.itemProvince)}>{item.name}</View>
|
||||||
{/* <IconFont name={'icon-chakanquanbukehu'} size={50} color={'#d8d8d8'}></IconFont> */}
|
{/* <IconFont name={'icon-chakanquanbukehu'} size={50} color={'#d8d8d8'}></IconFont> */}
|
||||||
</View>
|
</View>
|
||||||
@ -225,4 +220,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(ChoseCity))
|
||||||
|
|||||||
@ -11,8 +11,7 @@ interface Props {
|
|||||||
obj: any
|
obj: any
|
||||||
sortId: number | string
|
sortId: number | string
|
||||||
}
|
}
|
||||||
|
const ItemList = (props: Props) => {
|
||||||
export default memo((props: Props) => {
|
|
||||||
const handPhone = (e) => {
|
const handPhone = (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
Taro.makePhoneCall({
|
Taro.makePhoneCall({
|
||||||
@ -72,9 +71,9 @@ export default memo((props: Props) => {
|
|||||||
<View className={styles.item_tagItem}>{props.obj.purchaser_type_name || '暂无'}</View>
|
<View className={styles.item_tagItem}>{props.obj.purchaser_type_name || '暂无'}</View>
|
||||||
<View className={styles.item_tagItem}>{props.obj.sale_user_name || '暂无'}</View>
|
<View className={styles.item_tagItem}>{props.obj.sale_user_name || '暂无'}</View>
|
||||||
{
|
{
|
||||||
props.obj?.label_list?.map((item) => {
|
props.obj?.label_list?.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<View className={styles.item_tagItem}>{item.label_name}</View>
|
<View key={key} className={styles.item_tagItem}>{item.label_name}</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -94,4 +93,5 @@ export default memo((props: Props) => {
|
|||||||
</View>
|
</View>
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(ItemList)
|
||||||
|
|||||||
@ -18,8 +18,7 @@ interface ListType {
|
|||||||
id: string
|
id: string
|
||||||
checked: boolean
|
checked: boolean
|
||||||
}
|
}
|
||||||
|
const Sort = (props: Props, ref) => {
|
||||||
export default memo(forwardRef((props: Props, ref) => {
|
|
||||||
const DropDownItemRef = useRef<any>()
|
const DropDownItemRef = useRef<any>()
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
@ -98,11 +97,12 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
{
|
{
|
||||||
list.map((item, index) => {
|
list.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(Sort))
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { alert } from '@/common/common'
|
|||||||
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||||
import { EnumPurchaserType } from '@/api/order'
|
import { EnumPurchaserType } from '@/api/order'
|
||||||
import DropDownItem from '@/components/dropDown-item'
|
import DropDownItem from '@/components/dropDown-item'
|
||||||
import { mppurchaserlist } from '@/api/customer'
|
import { MpPurchaserList } from '@/api/customer'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
handType: (any) => void
|
handType: (any) => void
|
||||||
@ -15,8 +15,7 @@ interface Props {
|
|||||||
value?: any
|
value?: any
|
||||||
onCloseOverlay?: () => void
|
onCloseOverlay?: () => void
|
||||||
}
|
}
|
||||||
|
const Tag = (props: Props, ref) => {
|
||||||
export default memo(forwardRef((props: Props, ref) => {
|
|
||||||
const DropDownItemRef = useRef<any>()
|
const DropDownItemRef = useRef<any>()
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
@ -49,11 +48,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getList()
|
|
||||||
}, [])
|
|
||||||
const { fetchData: fetchPurchaserType } = EnumPurchaserType()
|
const { fetchData: fetchPurchaserType } = EnumPurchaserType()
|
||||||
const { fetchData } = mppurchaserlist()
|
const { fetchData } = MpPurchaserList()
|
||||||
|
const [taglist, settaglist] = useState<any[]>([])
|
||||||
const getList = async() => {
|
const getList = async() => {
|
||||||
const res = await fetchData()
|
const res = await fetchData()
|
||||||
const purchaserType = await fetchPurchaserType()
|
const purchaserType = await fetchPurchaserType()
|
||||||
@ -62,8 +59,9 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
setlist([...purchaserType.data.list])
|
setlist([...purchaserType.data.list])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
const [taglist, settaglist] = useState<any[]>([])
|
getList()
|
||||||
|
}, [])
|
||||||
|
|
||||||
const handItem = (it) => {
|
const handItem = (it) => {
|
||||||
list.map((item) => {
|
list.map((item) => {
|
||||||
@ -98,7 +96,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
{
|
{
|
||||||
list.map((item, index) => {
|
list.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handItem?.(item)}>{item.name}</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -108,7 +106,7 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
{
|
{
|
||||||
taglist.map((item, index) => {
|
taglist.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handTag?.(item)}>{item.name}</View>
|
<View key={index} className={classnames(item.checked ? styles.itemactiveFlex : styles.itemFlex)} onClick={() => handTag?.(item)}>{item.name}</View>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -116,4 +114,5 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
</View>
|
</View>
|
||||||
</DropDownItem>
|
</DropDownItem>
|
||||||
)
|
)
|
||||||
}))
|
}
|
||||||
|
export default memo(forwardRef(Tag))
|
||||||
|
|||||||
@ -8,7 +8,7 @@ interface Props {
|
|||||||
handChose?: (any) => void
|
handChose?: (any) => void
|
||||||
handReset?: () => void
|
handReset?: () => void
|
||||||
}
|
}
|
||||||
export default memo((props: Props) => {
|
const Tabs = (props: Props) => {
|
||||||
const { list = [], handChose } = props
|
const { list = [], handChose } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -34,4 +34,5 @@ export default memo((props: Props) => {
|
|||||||
<View className={styles.resetBox} onClick={() => props?.handReset?.()}>重置</View>
|
<View className={styles.resetBox} onClick={() => props?.handReset?.()}>重置</View>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
export default memo(Tabs)
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import InfiniteScroll from '@/components/infiniteScroll'
|
|||||||
import { ClientListApi } from '@/api/order'
|
import { ClientListApi } from '@/api/order'
|
||||||
import SelectGroup from '@/components/SelectGroup'
|
import SelectGroup from '@/components/SelectGroup'
|
||||||
|
|
||||||
export default () => {
|
const CustomerManagement = () => {
|
||||||
const [searchField, setSearchField] = useState<
|
const [searchField, setSearchField] = useState<
|
||||||
{
|
{
|
||||||
page: number
|
page: number
|
||||||
@ -41,6 +41,9 @@ export default () => {
|
|||||||
|
|
||||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||||
const { fetchData: listFetchData, state: orderState } = ClientListApi()
|
const { fetchData: listFetchData, state: orderState } = ClientListApi()
|
||||||
|
|
||||||
|
// 列表下拉刷新
|
||||||
|
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
||||||
const getOrderList = async() => {
|
const getOrderList = async() => {
|
||||||
const res = await listFetchData({
|
const res = await listFetchData({
|
||||||
...getFilterData(searchField),
|
...getFilterData(searchField),
|
||||||
@ -54,13 +57,6 @@ export default () => {
|
|||||||
getOrderList()
|
getOrderList()
|
||||||
}, [searchField])
|
}, [searchField])
|
||||||
|
|
||||||
// 输入了搜索关键字
|
|
||||||
const getSearchData = useCallback((e) => {
|
|
||||||
pageNum.current.page = 1
|
|
||||||
setOrderData(() => ({ list: [], total: 0 }))
|
|
||||||
setSearchField(val => ({ ...val, name_phone_or_sale_user: e, size: 10 }))
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
// 数据加载状态
|
// 数据加载状态
|
||||||
const statusMore = useMemo(() => {
|
const statusMore = useMemo(() => {
|
||||||
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading! })
|
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading! })
|
||||||
@ -68,6 +64,12 @@ export default () => {
|
|||||||
|
|
||||||
// 上拉加载数据
|
// 上拉加载数据
|
||||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||||
|
// 输入了搜索关键字
|
||||||
|
const getSearchData = useCallback((e) => {
|
||||||
|
pageNum.current.page = 1
|
||||||
|
setOrderData(() => ({ list: [], total: 0 }))
|
||||||
|
setSearchField(val => ({ ...val, name_phone_or_sale_user: e, size: 10 }))
|
||||||
|
}, [])
|
||||||
const getScrolltolower = useCallback(() => {
|
const getScrolltolower = useCallback(() => {
|
||||||
if (orderData.list.length < orderData.total) {
|
if (orderData.list.length < orderData.total) {
|
||||||
pageNum.current.page++
|
pageNum.current.page++
|
||||||
@ -76,8 +78,6 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}, [orderData])
|
}, [orderData])
|
||||||
|
|
||||||
// 列表下拉刷新
|
|
||||||
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
|
|
||||||
const getRefresherRefresh = async() => {
|
const getRefresherRefresh = async() => {
|
||||||
pageNum.current.size = 1
|
pageNum.current.size = 1
|
||||||
setRefresherTriggeredStatus(true)
|
setRefresherTriggeredStatus(true)
|
||||||
@ -137,7 +137,7 @@ export default () => {
|
|||||||
<View className={styles.mainBox}>
|
<View className={styles.mainBox}>
|
||||||
<View className={styles.topBox}>
|
<View className={styles.topBox}>
|
||||||
<View className={styles.search_input}>
|
<View className={styles.search_input}>
|
||||||
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} />
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.menuBox} >
|
<View className={styles.menuBox} >
|
||||||
<SelectGroup>
|
<SelectGroup>
|
||||||
@ -158,7 +158,7 @@ export default () => {
|
|||||||
>
|
>
|
||||||
{orderData?.list?.map((item, index) => {
|
{orderData?.list?.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<ItemLiist sortId={sortRefRef.current} obj={item}></ItemLiist>
|
<ItemLiist key={index} sortId={sortRefRef.current} obj={item}></ItemLiist>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
@ -169,3 +169,5 @@ export default () => {
|
|||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default CustomerManagement
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { ClientListApi } from '@/api/order'
|
|||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
import InfiniteScroll from '@/components/infiniteScroll'
|
||||||
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
import { dataLoadingStatus, getFilterData } from '@/common/util'
|
||||||
|
|
||||||
export default () => {
|
const CustomerPage = () => {
|
||||||
const [search, setSearch] = useState({
|
const [search, setSearch] = useState({
|
||||||
name_phone_or_sale_user: null,
|
name_phone_or_sale_user: null,
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -26,7 +26,8 @@ export default () => {
|
|||||||
clientId: null,
|
clientId: null,
|
||||||
clientName: '',
|
clientName: '',
|
||||||
})
|
})
|
||||||
|
// 上拉加载数据
|
||||||
|
const pageNum = useRef({ size: search.size, page: search.page })
|
||||||
// 输入了搜索关键字
|
// 输入了搜索关键字
|
||||||
const getSearchData = useCallback((eq) => {
|
const getSearchData = useCallback((eq) => {
|
||||||
pageNum.current.page = 1
|
pageNum.current.page = 1
|
||||||
@ -36,15 +37,6 @@ export default () => {
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (search.name_phone_or_sale_user === '') {
|
|
||||||
setSearch(e => ({ ...e, name_phone_or_sale_user: null }))
|
|
||||||
}
|
|
||||||
if (search.name_phone_or_sale_user !== '') { getCuss() }
|
|
||||||
}, [search])
|
|
||||||
|
|
||||||
// 上拉加载数据
|
|
||||||
const pageNum = useRef({ size: search.size, page: search.page })
|
|
||||||
const getScrolltolower = useCallback(() => {
|
const getScrolltolower = useCallback(() => {
|
||||||
if (clentList.list.length < clentList.total) {
|
if (clentList.list.length < clentList.total) {
|
||||||
pageNum.current.page++
|
pageNum.current.page++
|
||||||
@ -77,7 +69,12 @@ export default () => {
|
|||||||
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
|
||||||
setRefresherTriggeredStatus(() => false)
|
setRefresherTriggeredStatus(() => false)
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (search.name_phone_or_sale_user === '') {
|
||||||
|
setSearch(e => ({ ...e, name_phone_or_sale_user: null }))
|
||||||
|
}
|
||||||
|
if (search.name_phone_or_sale_user !== '') { getCuss() }
|
||||||
|
}, [search])
|
||||||
// 选择客户
|
// 选择客户
|
||||||
const selectClient = (item) => {
|
const selectClient = (item) => {
|
||||||
clentList.list.map((it) => {
|
clentList.list.map((it) => {
|
||||||
@ -118,7 +115,7 @@ export default () => {
|
|||||||
<View className={styles.cussBox}>
|
<View className={styles.cussBox}>
|
||||||
<View className={styles.searchBox}>
|
<View className={styles.searchBox}>
|
||||||
<View className={styles.two}>
|
<View className={styles.two}>
|
||||||
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
|
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -147,3 +144,5 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default CustomerPage
|
||||||
|
|||||||
@ -6,7 +6,7 @@ interface PropsType {
|
|||||||
onChangeStatus?: (data: { id: number; name: string }) => void
|
onChangeStatus?: (data: { id: number; name: string }) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeliveryStatusList = memo<PropsType>((props) => {
|
const DeliveryStatusList = (props: PropsType) => {
|
||||||
const { onChangeStatus } = props
|
const { onChangeStatus } = props
|
||||||
const { fetchData } = EnumSaleorderStatus()
|
const { fetchData } = EnumSaleorderStatus()
|
||||||
const [statusList, setStatusList] = useState([
|
const [statusList, setStatusList] = useState([
|
||||||
@ -38,5 +38,5 @@ const DeliveryStatusList = memo<PropsType>((props) => {
|
|||||||
[onChangeStatus],
|
[onChangeStatus],
|
||||||
)
|
)
|
||||||
return <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={statusList[0].id} />
|
return <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={statusList[0].id} />
|
||||||
})
|
}
|
||||||
export default DeliveryStatusList
|
export default memo<PropsType>(DeliveryStatusList)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user