🐳 chore(eslint): 修正所有文件的eslint 错误

This commit is contained in:
xuan 2022-11-28 11:06:15 +08:00
parent 99a920975f
commit cc99111b4f
149 changed files with 3270 additions and 3252 deletions

View File

@ -4,6 +4,9 @@
"no-console": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-unused-vars": "off",
"eqeqeq": "off"
"eqeqeq": "off",
"no-prototype-builtins": "off",
"import/first": "off",
"react/no-children-prop": "off"
}
}

View File

@ -236,5 +236,5 @@
]
}
},
"libVersion": "2.27.3"
"libVersion": "2.28.0"
}

View File

@ -12,35 +12,35 @@ export const GetAddressListApi = () => {
}
// 获取客户地址
export const mppurchaseraddresslist = () => {
export const MpPurchaserAddressList = () => {
return useRequest({
url: '/v2/mp/purchaser/address/list',
method: 'get',
})
}
// 新增客户地址
export const mppurchaseraddress = () => {
export const MpPurchaserAddress = () => {
return useRequest({
url: '/v2/mp/purchaser/address',
method: 'post',
})
}
// 获取编辑地址信息
export const mppurchaseraddressget = () => {
export const MpPurchaserAddressGet = () => {
return useRequest({
url: '/v2/mp/purchaser/address',
method: 'get',
})
}
// 编辑收货地址信息
export const mppurchaseraddressput = () => {
export const MpPurchaserAddressPut = () => {
return useRequest({
url: '/v2/mp/purchaser/address',
method: 'put',
})
}
// 删除收货地址信息
export const mppurchaseraddressdelect = () => {
export const MpPurchaserAddressDelete = () => {
return useRequest({
url: '/v2/mp/purchaser/address',
method: 'delete',

View File

@ -1,35 +1,35 @@
import { useRequest } from '@/use/useHttp'
// 获取客户信息
export const mppurchaser = () => {
export const MpPurchaser = () => {
return useRequest({
url: '/v2/mp/purchaser',
method: 'get',
})
}
// 新建客户
export const mppurchaserpost = () => {
export const MpPurchaserPost = () => {
return useRequest({
url: '/v2/mp/purchaser',
method: 'post',
})
}
// 编辑客户
export const mppurchaserput = () => {
export const MpPurchaserPut = () => {
return useRequest({
url: '/v2/mp/purchaser',
method: 'put',
})
}
// 获取标签列表
export const mppurchaserlist = () => {
export const MpPurchaserList = () => {
return useRequest({
url: '/v2/mp/purchaser/label/list',
method: 'get',
})
}
// 保存标签
export const mppurchaserlabeladd = () => {
export const MpPurchaserLabelAdd = () => {
return useRequest({
url: '/v2/mp/purchaser/label/add',
method: 'post',

View File

@ -54,7 +54,7 @@ export {
*
* @returns
*/
export const kindListApi = () => {
export const KindListApi = () => {
return useRequest({
url: '/v2/mp/product/kind/list',
method: 'get',

View File

@ -1,35 +1,35 @@
import { useRequest } from '@/use/useHttp'
// 收款单列表
export const mpcashManagementOrderlist = () => {
export const MpCashManagementOrderList = () => {
return useRequest({
url: '/v2/mp/cashManagementOrder/list',
method: 'get',
})
}
// 收款单详情
export const mpcashManagementOrder = () => {
export const MpCashManagementOrder = () => {
return useRequest({
url: '/v2/mp/cashManagementOrder',
method: 'get',
})
}
// 收款账号
export const mpcashManagementOrderaccount = () => {
export const MpCashManagementOrderAccount = () => {
return useRequest({
url: '/v2/mp/cashManagementOrder/account',
method: 'get',
})
}
// 新建收款单
export const mpcashManagementOrderpost = () => {
export const MpCashManagementOrderPost = () => {
return useRequest({
url: '/v2/mp/cashManagementOrder',
method: 'post',
})
}
// 扫描获取应收单的客户信息
export const mpshouldCollectOrderpurchaser = () => {
export const MpShouldCollectOrderPurchaser = () => {
return useRequest({
url: '/v2/mp/shouldCollectOrder/purchaser',
method: 'get',

View File

@ -1,7 +1,7 @@
import { useRequest } from '@/use/useHttp'
import { CAP_HTML_TO_IMAGE_BASE_URL } from '@/common/constant'
export const mpenumsaleorderstatus = () => {
export const MpEnumSaleOrderStatus = () => {
return useRequest({
url: '/v2/mp/enum/filterMPSaleOrderStatus',
method: 'get',
@ -30,70 +30,70 @@ export const ClientListApi = () => {
})
}
// 面料种类列表
export const mpproductcolorlist = () => {
export const MpProductColorList = () => {
return useRequest({
url: '/v2/mp/product/color/list',
method: 'get',
})
}
// 购物车提交
export const mpsaleOrderpreView = () => {
export const MpSaleOrderPreview = () => {
return useRequest({
url: '/v2/mp/saleOrder/preView',
method: 'put',
})
}
// 业务员枚举
export const mpenumsaleUserlist = () => {
export const MpEnumSaleUserList = () => {
return useRequest({
url: '/v2/mp/enum/saleUser/list',
method: 'get',
})
}
// 订单详情
export const mpsaleOrder = () => {
export const MpSaleOrder = () => {
return useRequest({
url: '/v2/mp/saleOrder',
method: 'get',
})
}
// 取消订单
export const mpsaleOrdercancel = () => {
export const MpSaleOrderCancel = () => {
return useRequest({
url: '/v2/mp/saleOrder/cancel',
method: 'put',
})
}
// 再次购买
export const mpshoppingCartproductColorlist = () => {
export const MpShoppingCartProductColorList = () => {
return useRequest({
url: '/v2/mp/shoppingCart/productColor/list',
method: 'post',
})
}
// 获取账期付款
export const orderPaymentorderPaymentMethodInfo = () => {
export const OrderPaymentOrderPaymentMethodInfo = () => {
return useRequest({
url: '/v2/mp/orderPayment/orderPaymentMethodInfo',
method: 'get',
})
}
// 预收单获取接口信息
export const orderPaymentpreCollectOrderorderPaymentMethodInfo = () => {
export const OrderPaymentPreCollectOrderOrderPaymentMethodInfo = () => {
return useRequest({
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentMethodInfo',
method: 'get',
})
}
// 确认交易
export const orderPaymentorderPaymentSubmission = () => {
export const OrderPaymentOrderPaymentSubmission = () => {
return useRequest({
url: '/v2/mp/orderPayment/orderPaymentSubmission',
method: 'put',
})
}
// 订单预支付提交
export const orderPaymentpreCollectOrderorderPaymentSubmission = () => {
export const OrderPaymentPreCollectOrderOrderPaymentSubmission = () => {
return useRequest({
url: '/v2/mp/orderPayment/preCollectOrder/orderPaymentSubmission',
method: 'put',
@ -120,70 +120,70 @@ export const GetReturnPayCode = () => {
})
}
// 编辑备注信息
export const mpsaleOrderput = () => {
export const MpSaleOrderPut = () => {
return useRequest({
url: '/v2/mp/saleOrder',
method: 'put',
})
}
// 修改销售单的收货地址
export const mpsaleOrderaddress = () => {
export const MpSaleOrderAddress = () => {
return useRequest({
url: '/v2/mp/saleOrder/address',
method: 'put',
})
}
// 关键字搜索历史
export const mpsearchHistorylist = () => {
export const MpSearchHistoryList = () => {
return useRequest({
url: '/v2/mp/searchHistory/list',
method: 'get',
})
}
// 添加关键字搜索
export const mpsearchHistory = () => {
export const MpSearchHistory = () => {
return useRequest({
url: '/v2/mp/searchHistory',
method: 'post',
})
}
// 确认收货
export const mpsaleOrderreceive = () => {
export const MpSaleOrderReceive = () => {
return useRequest({
url: '/v2/mp/saleOrder/receive',
method: 'put',
})
}
// 退货原因
export const mpenumreturnOrderreturnReason = () => {
export const MpEnumReturnOrderReturnReason = () => {
return useRequest({
url: '/v2/mp/enum/returnOrder/returnReason',
method: 'get',
})
}
// 二次选择退货原因
export const mpenumreturnExplain = () => {
export const MpEnumReturnExplain = () => {
return useRequest({
url: '/v2/mp/enum/returnExplain',
method: 'get',
})
}
// 货物状况
export const mpenumreturngoodsStatus = () => {
export const MpEnumReturnGoodsStatus = () => {
return useRequest({
url: '/v2/mp/enum/return/goodsStatus',
method: 'get',
})
}
// 申请退货
export const mpreturnApplyOrder = () => {
export const MpReturnApplyOrder = () => {
return useRequest({
url: '/v2/mp/returnApplyOrder',
method: 'put',
})
}
// 退款说明
export const mpenumrefundExplainone = () => {
export const MpEnumRefundExplainOne = () => {
return useRequest({
url: '/v2/mp/enum/refundExplain',
method: 'get',
@ -191,14 +191,14 @@ export const mpenumrefundExplainone = () => {
}
// 提交订单
export const mpsaleOrderpost = () => {
export const MpSaleOrderPost = () => {
return useRequest({
url: '/v2/mp/saleOrder',
method: 'post',
})
}
// 修改销售单物流方式
export const mpsaleOrdershipmentMode = () => {
export const MpSaleOrderShipmentMode = () => {
return useRequest({
url: '/v2/mp/saleOrder/shipmentMode',
method: 'put',

View File

@ -1,42 +1,42 @@
import { useRequest } from '@/use/useHttp'
// 售后订单列表
export const mpreturnApplyOrderlist = () => {
export const MpReturnApplyOrderList = () => {
return useRequest({
url: '/v2/mp/returnApplyOrder/list',
method: 'get',
})
}
// 售后状态枚举
export const mpenumreturnStage = () => {
export const MpEnumReturnStage = () => {
return useRequest({
url: '/v2/mp/enum/returnStage',
method: 'get',
})
}
// 退款类型枚举
export const mpenumreturnType = () => {
export const MpEnumReturnType = () => {
return useRequest({
url: '/v2/mp/enum/returnType',
method: 'get',
})
}
// 售后详情
export const mpreturnApplyOrder = () => {
export const MpReturnApplyOrder = () => {
return useRequest({
url: '/v2/mp/returnApplyOrder',
method: 'get',
})
}
// 取消退货
export const returnApplyOrdercancel = () => {
export const ReturnApplyOrderCancel = () => {
return useRequest({
url: '/v2/mp/returnApplyOrder/cancel',
method: 'post',
})
}
// 售后确认上传附件
export const returnApplyOrderuploadAccessory = () => {
export const ReturnApplyOrderUploadAccessory = () => {
return useRequest({
url: '/v2/mp/returnApplyOrder/uploadAccessory',
method: 'put',

View File

@ -1,6 +1,6 @@
import { useRequest } from '@/use/useHttp'
// 搜索商品
export const mpproductlist = () => {
export const MpProductList = () => {
return useRequest({
url: '/v2/mp/product/list',
method: 'get',

View File

@ -1,10 +1,10 @@
import Taro, { onAppShow } from '@tarojs/taro'
import type { FC } from 'react'
import { Provider } from 'react-redux'
import configStore from './store'
import { shareShop } from './common/util'
import ContextBlueTooth from '@/use/contextBlueTooth'
import './app.scss'
import Taro, { onAppShow, useDidShow } from '@tarojs/taro'
import { shareShop } from './common/util'
interface ParamsType {
children?: React.ReactNode

View File

@ -10,35 +10,35 @@ module.exports = function(lab1, lab2) {
const a2 = rgb2labArray2[1]
const b2 = rgb2labArray2[2]
const avg_lp = (l1 + l2) / 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 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 avg_lp = (l1 + l2) / 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 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 a1p = a1 * (1 + g)
const a2p = a2 * (1 + g)
const a1p = a1 * (1 + g)
const a2p = a2 * (1 + g)
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 c1p = Math.sqrt(Math.pow(a1p, 2) + Math.pow(b1, 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) {
h1p = h1p + 360
}
let h2p = rad2deg(Math.atan2(b2, a2p))
let h2p = rad2deg(Math.atan2(b2, a2p))
if (h2p < 0) {
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 (h2p <= h1p) {
delta_hp += 360
@ -48,18 +48,18 @@ module.exports = function(lab1, lab2) {
}
}
const delta_lp = l2 - l1
const delta_cp = c2p - c1p
const delta_lp = l2 - l1
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_c = 1 + 0.045 * avg_cp
const s_h = 1 + 0.015 * avg_cp * t
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_h = 1 + 0.015 * avg_cp * t
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_t = -r_c * Math.sin(2 * deg2rad(delta_ro))
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_t = -r_c * Math.sin(2 * deg2rad(delta_ro))
const kl = 1; const kc = 1; const kh = 1

View File

@ -1,4 +1,6 @@
/* eslint-disable import/no-commonjs */
const xyz = require('./xyz')
module.exports = {
@ -32,11 +34,10 @@ module.exports = {
}
// extend xyz
xyz.lab = function(xyz) {
let x = xyz[0]
let y = xyz[1]
let z = xyz[2]
let l; let a; let b
xyz.lab = function(xyz1) {
let x = xyz1[0]
let y = xyz1[1]
let z = xyz1[2]
x /= 95.047
y /= 100
@ -46,9 +47,9 @@ xyz.lab = function(xyz) {
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)
l = (116 * y) - 16
a = 500 * (x - y)
b = 200 * (y - z)
const l = (116 * y) - 16
const a = 500 * (x - y)
const b = 200 * (y - z)
return [l, a, b]
}

View File

@ -1,3 +1,4 @@
/* eslint-disable import/no-commonjs */
module.exports = {
name: 'rgb',

View File

@ -1,4 +1,6 @@
/* eslint-disable import/no-commonjs */
const rgb = require('./rgb')
const xyz = {
@ -112,10 +114,10 @@ xyz.rgb = function(_xyz, white) {
*
* @return {Array} XYZ channels
*/
rgb.xyz = function(rgb, white) {
let r = rgb[0] / 255
let g = rgb[1] / 255
let b = rgb[2] / 255
rgb.xyz = function(rgb1, white) {
let r = rgb1[0] / 255
let g = rgb1[1] / 255
let b = rgb1[2] / 255
// assume sRGB
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92)

View File

@ -55,11 +55,11 @@ export function uint8ArrayToHex(raw) {
}
// 二进制转字符串(ascii)
export function bufferToString(buffer) {
let str = ''
for (const code of buffer) {
if (code === 0) { break }
str += utf82string(code)
}
return str
}
// export function bufferToString(buffer) {
// let str = ''
// for (const code of buffer) {
// if (code === 0) { break }
// str += utf82string(code)
// }
// return str
// }

View File

@ -1,5 +1,27 @@
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 编码
@ -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
@ -145,7 +147,7 @@ export const formatMillionYuan = (num, digit = 10000) => {
*/
export const toDecimal2 = (x) => {
let f = parseFloat(x)
if (isNaN(f)) {
if (Number.isNaN(f)) {
return 0
}
f = `${f}`
@ -162,6 +164,16 @@ export const toDecimal2 = (x) => {
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
// 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
@ -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) => {
if (cls) {

View File

@ -1,22 +1,6 @@
import Taro from '@tarojs/taro'
import { BASE_URL } from '../constant'
// 解析短码(主要用于右上角按钮分享)
export const analysisShortCodeApi = (val) => {
// 解析短码
Taro.request({
url: `${BASE_URL}/v1/mall/shortCode`,
method: 'GET',
data: { md5_key: val },
success: (res) => {
if (res.data.code == 0) {
// 绑定上下级
bindParent(res.data.data.share_user_id)
}
},
})
}
// 绑定上下级
const bindParent = (share_user_id) => {
// 绑定上下级
@ -31,3 +15,18 @@ const bindParent = (share_user_id) => {
},
})
}
// 解析短码(主要用于右上角按钮分享)
export const analysisShortCodeApi = (val) => {
// 解析短码
Taro.request({
url: `${BASE_URL}/v1/mall/shortCode`,
method: 'GET',
data: { md5_key: val },
success: (res) => {
if (res.data.code == 0) {
// 绑定上下级
bindParent(res.data.data.share_user_id)
}
},
})
}

View File

@ -2,11 +2,11 @@
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
import './index.scss'
import { mppurchaseraddresslist } from '@/api/addressList'
import { MpPurchaserAddressList } from '@/api/addressList'
import { alert } from '@/common/common'
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
import IconFont from '@/components/iconfont/iconfont'
import { mpsaleOrderaddress } from '@/api/order'
import { MpSaleOrderAddress } from '@/api/order'
interface Params {
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 prevPage = pages[pages.length - 2]
// 焦点
const [focusId, setFocusId] = useState()
const { addButtonEnabled = true, focusBorderEnabled = false } = props
const { fetchData, state } = mppurchaseraddresslist()
const { fetchData, state } = MpPurchaserAddressList()
// 获取数据
const getData = async() => {
const result = await fetchData({ purchaser_id: props.purchaser_id })
@ -64,12 +66,10 @@ const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
setRefreshState(false)
}
const data = Array.from({ length: 15 })
// 焦点
const [focusId, setFocusId] = useState()
const router = useRouter()
const [addressObj, setAddressObj] = useState<any>({})
// 列表选择
const { fetchData: selectFetch } = mpsaleOrderaddress()
const { fetchData: selectFetch } = MpSaleOrderAddress()
const handleSelect = async(item: any, index: number) => {
if (router.params.orderId && router.params.orderId != '-100') {
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.map((item,index)=>{
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">
{item.name}
<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>}
</View>
)
}))
}
export default AddressList
export default memo(forwardRef(AddressList))

View File

@ -20,8 +20,7 @@ interface prosObj {
showDetail?: boolean
goodsObj?: any
}
export default memo(forwardRef((props: prosObj, ref) => {
const BottomBtns = (props: prosObj, ref) => {
const {
obj = {
sale_mode: 0,
@ -192,4 +191,5 @@ export default memo(forwardRef((props: prosObj, ref) => {
</View>
)
}))
}
export default memo(forwardRef(BottomBtns))

View File

@ -10,8 +10,7 @@ interface prosObj {
clientId?: Number
clientName?: string
}
export default memo((props: prosObj) => {
const BottomCustomer = (props: prosObj) => {
const {
isDisabled = true,
handSure,
@ -32,4 +31,5 @@ export default memo((props: prosObj) => {
<Button className={classnames(isDisabled ? styles.activeButton : styles.button)} disabled={isDisabled} onClick={() => { handSure?.() }}> </Button >
</View >
)
})
}
export default memo(BottomCustomer)

View File

@ -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
return (
@ -55,9 +55,5 @@ const FromList = memo((props: ListParams) => {
</View>
</View>
)
})
const A = () => {
}
export default FromList
export default memo(FromList)

View File

@ -17,9 +17,7 @@ interface ListParams{
required?: boolean
showIcon?: boolean // 是否显示右边的箭头type=select
}
// 表单列表
const FromList = memo((props: ListParams) => {
const FromListCertification = (props: ListParams) => {
const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false, showIcon = true } = props
return (
@ -57,9 +55,8 @@ const FromList = memo((props: ListParams) => {
</View>
</View>
)
})
const A = () => {
}
// 表单列表
const FromList = memo(FromListCertification)
export default FromList

View File

@ -10,20 +10,23 @@ interface Params {
fetchData: (data: object) => any
change?: (data: any) => void
}
export default (props: Params) => {
const InfiniteScrollPaging = (props: Params) => {
const { query = {} } = props
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])
// 加载刷新数据
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 getData = async(startStatus, endStatus) => {
const tRefreshDataRef = refreshDataRef.current as any
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 handleRefresh = async() => {
@ -119,7 +108,17 @@ export default (props: Params) => {
const statusMore = useMemo(() => {
return dataLoadingStatus({ list: data.list, total: data.total, status: 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 (
<InfiniteScroll
refresherEnabled
@ -133,3 +132,5 @@ export default (props: Params) => {
</InfiniteScroll>
)
}
export default InfiniteScrollPaging

View File

@ -1,10 +1,8 @@
import { Image, View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
import LabAndImgShow from '../LabAndImgShow'
import styles from './index.module.scss'
import Preview from '@/pages/details/components/preview'
import { formatImgUrl, formatRemoveHashTag } from '@/common/format'
import { formatImgUrl } from '@/common/format'
// 该组件宽高为100%需调整外层元素宽高
interface Param {
@ -17,7 +15,7 @@ interface Param {
showStatus?: true | false
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[]>([])
// lab是否都是0
@ -63,4 +61,5 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
</>
)
})
}
export default memo(LabAndImg)

View File

@ -15,13 +15,7 @@ export interface colorParams {
onClose?: () => void
showNumber?: number // 图片显示张数0不限制
}
export default ({ 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 LabAndImgShow = ({ value, show = false, onClose, showNumber = 1 }: colorParams) => {
// 显示颜色
const [labShow, setLabShow] = useState(false)
// lab是否都是0
@ -49,7 +43,11 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
urls: n_res,
})
}
useEffect(() => {
if (show && rgbStyle) { setLabShow(() => true) }
if (show && value?.texture_url) { onShowImage() }
if (!show) { setLabShow(() => false) }
}, [show])
return (
<>
{labShow && (
@ -63,3 +61,5 @@ export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) =
</>
)
}
export default LabAndImgShow

View File

@ -8,12 +8,12 @@ interface Params{
}
// 消息提示
const Message = memo((props: Params) => {
const Message = (props: Params) => {
return (
<View className="message-custom-tips">
<Text className="iconfont icon-zhuyi"></Text> {props.text}
</View>
)
})
}
export default Message
export default memo(Message)

View File

@ -17,15 +17,9 @@ interface Props {
showPopup: boolean
popupClose: () => void
}
export default memo((props: Props) => {
const RefundCodelist = (props: Props) => {
const { fetchData: payFetch } = GetReturnPayCode()
const [PicUrl, setPicUrl] = useState<string>('')
useEffect(() => {
// 判断进来的是否是空对象,减少性能问题
const length = Object.keys(props.obj)
if (length.length > 0) { getPic() }
}, [props.obj])
const getPic = async() => {
Taro.showLoading({
@ -142,11 +136,12 @@ export default memo((props: Props) => {
// 检查是否开启保存图片权限
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 time = new Date().valueOf()
@ -171,7 +166,10 @@ export default memo((props: Props) => {
},
})
}
const saveImageCheck = async() => {
const res = await check()
res && saveImage()
}
return (
<Popup show={props.showPopup} title="退款码单" onClose={() => props.popupClose?.()}>
<View className={styles.popupBox}>
@ -184,4 +182,5 @@ export default memo((props: Props) => {
</View>
</Popup>
)
})
}
export default memo(RefundCodelist)

View File

@ -15,7 +15,7 @@ interface PropsType {
onSelect?: (data: { id: number; name: string }) => void
}
const segmentedControl: FC<PropsType> = (props) => {
const SegmentedControl: FC<PropsType> = (props) => {
const [selectInfo, setSelectInfo] = useState({
selected: -1, // 当前选中的id
tabId: '', // 需要滚动到的id
@ -69,4 +69,4 @@ const segmentedControl: FC<PropsType> = (props) => {
</View>
)
}
export default segmentedControl
export default SegmentedControl

View File

@ -18,20 +18,20 @@ interface EnumList {
name: string
}
// 营销部门
const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
const SelectSaleType = (props: SelectSaleTypeProps, ref) => {
const selectName = '营销部门'
const { onChange, onCloseOverlay } = props
console.log(props)
const { fetchData } = EnumMarketingDepartmentApi()
const [enumList, setEnumList] = useState<EnumList[]>([])
const getData = async() => {
const res = await fetchData()
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
}
const [enumList, setEnumList] = useState<EnumList[]>([])
useEffect(() => {
getData()
}, [])
@ -67,9 +67,9 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
<View className={styles.grid}>
{!!enumList.length
&& enumList.map((item: EnumList) => {
&& enumList.map((item: EnumList, key) => {
return (
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
{item.name}
</FilterButton>
)
@ -77,5 +77,5 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
</View>
</DropDownItem>
)
}))
export default SelectSaleType
}
export default memo(forwardRef(SelectSaleType))

View File

@ -22,20 +22,19 @@ interface EnumList {
name: string
}
// 销售排行指标
const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = (props) => {
const selectName = '排行指标'
const { onChange, dropDownStyle, dropDownClassName } = props
console.log(props)
const { fetchData } = SaleOrderDataFormdataFormStatus()
const [enumList, setEnumList] = useState<EnumList[]>([])
const getData = async() => {
const res = await fetchData()
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
}
const [enumList, setEnumList] = useState<EnumList[]>([])
useEffect(() => {
getData()
}, [])
@ -58,9 +57,9 @@ const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
<DropDownItem title={displayTitle} customClassName={dropDownClassName} customStyle={dropDownStyle} value={currentValue} activeColor="#337fff" showOverlay={false}>
<View className={classnames(styles.grid)}>
{!!enumList.length
&& enumList.map((item: EnumList) => {
&& enumList.map((item: EnumList, key) => {
return (
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
{item.name}
</FilterButton>
)
@ -68,5 +67,5 @@ const SelectSaleRankingIndicators: FC<SelectSaleTypeProps> = memo((props) => {
</View>
</DropDownItem>
)
})
export default SelectSaleRankingIndicators
}
export default memo(SelectSaleRankingIndicators)

View File

@ -19,19 +19,18 @@ interface EnumList {
name: string
}
// 销售类型
const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
const SelectSaleType = (props: SelectSaleTypeProps, ref) => {
const selectName = '销售类型'
const { onChange, defaultValue = 0, onCloseOverlay } = props
console.log(props)
const { fetchData } = EnumSalesTypeApi()
const [enumList, setEnumList] = useState<EnumList[]>([])
const getData = async() => {
const res = await fetchData()
setEnumList([{ id: -1, code: '', name: '全部' }, ...res.data.list])
}
const [enumList, setEnumList] = useState<EnumList[]>([])
useEffect(() => {
getData()
}, [])
@ -68,9 +67,9 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
<DropDownItem title={displayTitle} value={currentValue} activeColor="#337fff" ref={dropDownRef} onCloseOverlay={onCloseOverlay}>
<View className={styles.grid}>
{!!enumList.length
&& enumList.map((item: EnumList) => {
&& enumList.map((item: EnumList, key) => {
return (
<FilterButton isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
<FilterButton key={key} isActive={item.id === currentValue} onClick={() => handleClick(item.id)}>
{item.name}
</FilterButton>
)
@ -78,5 +77,5 @@ const SelectSaleType = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
</View>
</DropDownItem>
)
}))
export default SelectSaleType
}
export default memo(forwardRef(SelectSaleType))

View File

@ -78,7 +78,7 @@ const FilterTimeOptions = {
type Key = keyof typeof FilterTimeOptions
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
// rerender 的时候需要更新 ref 的值
const Options = useRef({ ...timeOptions, custom: FilterTimeOptions.custom })
@ -98,6 +98,7 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
const handClose = () => {
setShowTime(false)
}
const customFilterButtonText = useRef('自定义时间')
const handleClick = (key: Key) => {
setCurrentValue(key)
@ -118,7 +119,6 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
}
// const [customFilterButtonText, setCustomFilterButtonText] = useState('自定义时间')
const customFilterButtonText = useRef('自定义时间')
// 点击自定义时间
const handleCustomTime = () => {
@ -151,9 +151,9 @@ const SelectTimePicker = memo(forwardRef((props: SelectSaleTypeProps, ref) => {
<View className={styles.grid} style={{ paddingBottom: '24rpx' }}>
{Object.entries(Options.current)
.slice(0, -1)
.map(([key, value]) => {
.map(([key, value], index) => {
return (
<FilterButton isActive={key === currentValue} onClick={() => handleClick(key as Key)}>
<FilterButton key={index} isActive={key === currentValue} onClick={() => handleClick(key as Key)}>
{value.name}
</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>
</>
)
}))
export default SelectTimePicker
}
export default memo(forwardRef(SelectTimePicker))

View File

@ -20,8 +20,7 @@ interface Param {
fixedBottom?: true|false // 是否固定在底部
}
export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
// 售后订单状态
const {
ReturnStageApplying,
@ -155,4 +154,5 @@ export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
</View>}
</>
)
})
}
export default memo(AfterOrderBtns)

View File

@ -8,7 +8,7 @@ interface Param {
number: number // 数字
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 res = number.toFixed(2).split('.')
const int_num = `${parseInt(res[0])}`
@ -22,4 +22,5 @@ export default memo(({ number = 0, status = 1 }: Param) => {
)
}, [number])
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)

View File

@ -12,20 +12,18 @@ interface params {
swiperOnClick?: (val: item) => void
style?: Object
}
export default (props: params) => {
const Banner = (props: params) => {
const { swiperOnClick, style = {} } = props
const [list, setList] = useState<any[]>([])
const { fetchData, state } = GetBannerList()
useEffect(() => {
getData()
}, [])
const getData = async() => {
const res = await fetchData()
setList(res.data?.list)
}
useEffect(() => {
getData()
}, [])
const skipTo = (item) => {
if (item.jump_type == 2 || item.jump_type == 0) {
@ -52,3 +50,5 @@ export default (props: params) => {
</View>
)
}
export default Banner

View File

@ -8,7 +8,7 @@ interface params {
show?: true | false
onClose?: () => void
}
export default ({ show, onClose }: params) => {
const BindSalesManPopUp = ({ show, onClose }: params) => {
const onCustomer = async() => {
const res = await Taro.showModal({
title: '是否拨打服务热线',
@ -54,3 +54,5 @@ export default ({ show, onClose }: params) => {
</>
)
}
export default BindSalesManPopUp

View File

@ -12,8 +12,7 @@ interface params {
onOff: () => void
onFind: () => void
}
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
const Popup = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
const [popupShow, setPopupShow] = useState(show)
useEffect(() => {
setPopupShow(show)
@ -31,38 +30,44 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
<View className={style.list}>
<ScrollView scrollY className={style.scroll}>
{
(state.devices && state.devices.length > 0) && state?.devices.map((item) => {
return (
<View className={style.item} onClick={() => onLink(item)}>
<View>{item.name}</View>
{
(!state.connecting && !state.connected) && <View ></View>
|| (state.connecting && item.deviceId == state.connecting.deviceId) && <View className={style.link_ing}>...</View>
|| (state.connected && item.deviceId == state.connected.deviceId) && <View className={style.link_success}></View>
}
</View>
)
})
|| <View className={style.noDevice}>
{
(!state.discovering) && <>
<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>
}
(state.devices && state.devices.length > 0)
? state?.devices.map((item, key) => {
return (
<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.connected && (item.deviceId == state.connected.deviceId)) ? <View className={style.link_success}></View> : null
}
</View>
)
})
: <View className={style.noDevice}>
{
(!state.discovering)
? <>
<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>
</View>
{
state.connected && <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}></View>
|| (!state.connected && state.discovering) && <View className={`${style.footer} ${style.finding}`}><Loading width={30} color="orange" /></View>
|| <View className={style.footer} onClick={onFind}></View>
state.connected
? <View className={`${style.footer} ${style.footer_off}`} onClick={onOff}></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 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)

View File

@ -22,7 +22,7 @@ interface params {
customClassName?: string
customTextClass?: string
}
export default forwardRef((props: params, ref) => {
const Checkbox = (props: params, ref) => {
const {
onSelect,
onClose,
@ -116,4 +116,5 @@ export default forwardRef((props: params, ref) => {
)}
</View>
)
})
}
export default forwardRef(Checkbox)

View File

@ -16,7 +16,7 @@ interface params {
unit?: string
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>({
value: defaultNum,
defaultValue: defaultNum,
@ -24,6 +24,19 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
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) => {
event.stopPropagation()
@ -44,18 +57,6 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
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 num = parseFloat(val)
@ -70,7 +71,7 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
setValue(minNum)
return minNum
}
else if (!isNaN(Number(res))) {
else if (!Number.isNaN(Number(res))) {
let count = formatDigits(res)
count = checkData(count)
setValue(count as number)
@ -78,7 +79,7 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
}
else {
const num = parseFloat(res)
if (!isNaN(num)) {
if (!Number.isNaN(num)) {
let count = formatDigits(num)
count = checkData(count)
setValue(count as number)
@ -95,7 +96,7 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
const num = parseFloat(String(value))
console.log('onInputEven res===>', num)
if (!isNaN(num)) {
if (!Number.isNaN(num)) {
let count = formatDigits(num)
count = checkData(count)
setValue(count as number)
@ -126,3 +127,5 @@ export default ({ minNum = 0, maxNum = 10000, step = 1, digits = 0, defaultNum =
</View>
)
}
export default Counter

View File

@ -2,7 +2,7 @@ import { View } from '@tarojs/components'
import { memo } from 'react'
import styles from './index.module.scss'
export default memo(() => {
const DotLoading = () => {
return (
<>
<View className={styles.load_box}>
@ -14,4 +14,5 @@ export default memo(() => {
</View>
</>
)
})
}
export default memo(DotLoading)

View File

@ -10,7 +10,6 @@ import Iconfont from '../iconfont/iconfont'
import Popup from '../popup'
import Cell from '../cell'
import styles from './index.module.scss'
import { usePropsValue } from '@/use/useCommon'
// 弹窗选择向上弹窗还是向下弹窗
type Direction = 'up' | 'down'
// 配置 菜单可选项
@ -36,8 +35,7 @@ interface PropsType extends DropDownEvent {
customStyle?: React.CSSProperties
hasBottomBtn?: boolean // 底部有按钮不允许点击蒙层关闭
}
export default forwardRef((props: PropsType, ref) => {
const DropDownItem = (props: PropsType, ref) => {
const { children, direction = 'down', title = '', value, options = [], change, activeColor, showOverlay = true, hasBottomBtn = false, customClassName, customStyle, onCloseOverlay } = props
const [showPopup, setShowPopup] = useState(false)
@ -61,9 +59,9 @@ export default forwardRef((props: PropsType, ref) => {
const defaultOptions = useMemo(() => {
const currentValue = value
return options?.map(({ text, value }) => {
return options?.map(({ text, value }, key) => {
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])
@ -144,4 +142,5 @@ export default forwardRef((props: PropsType, ref) => {
</Popup>
</View>
)
})
}
export default forwardRef(DropDownItem)

View File

@ -6,8 +6,7 @@ interface PropsObj {
picUrl?: string
text?: string
}
export default memo((pros: PropsObj) => {
const Empty = (pros: PropsObj) => {
const {
picUrl = '',
text = '无搜索历史',
@ -19,4 +18,5 @@ export default memo((pros: PropsObj) => {
<View className={styles.text}>{text}</View>
</View>
)
})
}
export default memo(Empty)

View File

@ -4,7 +4,6 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useState } from
import classnames from 'classnames'
import AmountShow from '../amountShow'
import styles from './index.module.scss'
import { formatKbPrice } from '@/common/common'
interface Param {
style?: Object
@ -17,7 +16,7 @@ interface Param {
messageShow?: true|false
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 onClose = () => {
setShow(false)
@ -28,14 +27,6 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
const [style, setStyle] = useState<{ top: string }>()
useEffect(() => {
if (show) {
getDomDes('#message')
}
else {
setStyle(() => ({ top: '0' }))
}
}, [show])
// 设置弹出层高度
const getDomDes = (id) => {
setTimeout(() => {
@ -46,6 +37,15 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
}).exec()
}, 0)
}
useEffect(() => {
if (show) {
getDomDes('#message')
}
else {
setStyle(() => ({ top: '0' }))
}
}, [show])
return (
<>
<View className={styles.order_price}>
@ -62,4 +62,5 @@ export default memo(({ number = 0, titleStatus = true, title = '', messageTitle
</View>
</>
)
})
}
export default memo(EstimatedAmount)

View File

@ -11,7 +11,8 @@ type params = {
onFiltr?: (val: object) => void // 确定搜索
onRest?: (val: Object) => void // 重置
} & PopuParams
export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
const Filter = ({ onClose, onFiltr, show = false, onRest }: params) => {
// 搜索条件
const [filterObj, setFilterObj] = useState({
seriesName: '',
@ -115,4 +116,5 @@ export default memo(({ onClose, onFiltr, show = false, onRest }: params) => {
</View>
</Popup>
)
})
}
export default memo(Filter)

View File

@ -10,7 +10,8 @@ import { GetProductKindListApi } from '@/api/material'
type params = {
onFiltr?: (val: object) => void
} & PopuParams
export default ({ onClose, onFiltr, show = false }: params) => {
const FilterV2 = ({ onClose, onFiltr, show = false }: params) => {
// 搜索条件
const [filterObj, setFilterObj] = useState({
seriesId: '',
@ -64,7 +65,7 @@ export default ({ onClose, onFiltr, show = false }: params) => {
const setNumber = (e, field) => {
console.log(e)
const num = parseFloat(e.detail.value)
if (isNaN(num)) {
if (Number.isNaN(num)) {
filterObj[field] = null
}
else {
@ -127,3 +128,5 @@ export default ({ onClose, onFiltr, show = false }: params) => {
)
}
export default FilterV2

View File

@ -26,8 +26,7 @@ interface props {
goodList?: any[]
onBlur?: (a: any, c: any) => void
}
export default memo((props: props) => {
const GoodsItem = (props: props) => {
const [value, setValue] = useState<any>({ count: props.value.nums })
const onInputEven = (e) => {
@ -99,5 +98,6 @@ export default memo((props: props) => {
</View>
</View>
)
})
}
export default memo(GoodsItem)
// ($event) => onInputEven($event, props.value)

View File

@ -9,7 +9,7 @@ const SystemWidth = Taro.getSystemInfoSync().windowWidth
const quot = '"'
function hex2rgb(hex) {
const rgb = []
const rgb: number[] = []
hex = hex.substr(1)

View File

@ -30,126 +30,127 @@ interface Params {
enableBackToTop?: boolean
emptySlot?: React.ReactNode
}
export default memo(
({
styleObj,
selfonScrollToLower,
selfOnScrollToUpper,
selfOnScroll,
selfOnRefresherPulling,
selfOnRefresherRefresh,
selfOnRefresherRestore,
selfOnRefresherAbort,
safeAreaInsetBottom = true,
enableLoadMoreStatus = true,
children,
lowerThresholdNum = 5,
paddingBottom = 0,
refresherTriggered = false,
refresherEnabled = false,
moreStatus = true,
statusMore = 0,
enableBackToTop = true,
emptySlot,
}: Params) => {
const scrollToLower = () => {
selfonScrollToLower?.()
}
const scrollToUpper = () => {
selfOnScrollToUpper?.()
}
const scroll = (e) => {
selfOnScroll?.(e)
}
const refresherPulling = () => {
selfOnRefresherPulling?.()
}
const refresherRefresh = () => {
selfOnRefresherRefresh?.()
}
const refresherRestore = () => {
selfOnRefresherRestore?.()
}
const refresherAbort = () => {
selfOnRefresherAbort?.()
}
const InfiniteScroll = ({
styleObj,
selfonScrollToLower,
selfOnScrollToUpper,
selfOnScroll,
selfOnRefresherPulling,
selfOnRefresherRefresh,
selfOnRefresherRestore,
selfOnRefresherAbort,
safeAreaInsetBottom = true,
enableLoadMoreStatus = true,
children,
lowerThresholdNum = 5,
paddingBottom = 0,
refresherTriggered = false,
refresherEnabled = false,
moreStatus = true,
statusMore = 0,
enableBackToTop = true,
emptySlot,
}: Params) => {
const scrollToLower = () => {
selfonScrollToLower?.()
}
const scrollToUpper = () => {
selfOnScrollToUpper?.()
}
const scroll = (e) => {
selfOnScroll?.(e)
}
const refresherPulling = () => {
selfOnRefresherPulling?.()
}
const refresherRefresh = () => {
selfOnRefresherRefresh?.()
}
const refresherRestore = () => {
selfOnRefresherRestore?.()
}
const refresherAbort = () => {
selfOnRefresherAbort?.()
}
// 返回顶部
const scrollTop = useMemo(() => {
if (statusMore == 0) {
return 0.1
}
}, [statusMore])
// 返回顶部
const scrollTop = useMemo(() => {
if (statusMore == 0) {
return 0.1
}
}, [statusMore])
const component = () => {
if (enableLoadMoreStatus) {
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 {
const component = () => {
if (enableLoadMoreStatus) {
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 (
<View style={{ paddingBottom: `${paddingBottom}rpx` }} className={style.scrollViewCon}>
{children}
</View>
)
}
}
return (
<>
<ScrollView
id="infiniteScroll"
style={styleObj}
className={style.scroll_main}
scrollY
onScrollToLower={() => scrollToLower()}
onScrollToUpper={() => scrollToUpper()}
onScroll={e => scroll(e)}
lowerThreshold={lowerThresholdNum}
refresherEnabled={refresherEnabled}
refresherTriggered={refresherTriggered}
onRefresherPulling={() => refresherPulling()}
onRefresherRefresh={() => refresherRefresh()}
onRefresherRestore={() => refresherRestore()}
onRefresherAbort={() => refresherAbort()}
refresherBackground="#F8F8F8"
enableBackToTop={enableBackToTop}
scrollTop={scrollTop}
>
{component()}
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
</ScrollView>
</>
)
},
return (
<>
<ScrollView
id="infiniteScroll"
style={styleObj}
className={style.scroll_main}
scrollY
onScrollToLower={() => scrollToLower()}
onScrollToUpper={() => scrollToUpper()}
onScroll={e => scroll(e)}
lowerThreshold={lowerThresholdNum}
refresherEnabled={refresherEnabled}
refresherTriggered={refresherTriggered}
onRefresherPulling={() => refresherPulling()}
onRefresherRefresh={() => refresherRefresh()}
onRefresherRestore={() => refresherRestore()}
onRefresherAbort={() => refresherAbort()}
refresherBackground="#F8F8F8"
enableBackToTop={enableBackToTop}
scrollTop={scrollTop}
>
{component()}
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
</ScrollView>
</>
)
}
export default memo(
InfiniteScroll,
)

View File

@ -2,7 +2,7 @@ import { View } from '@tarojs/components'
import { memo, useMemo } from 'react'
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(() => {
let obj = {}
if (width > 0) { obj = { width: `${width}rpx`, height: `${width}rpx` } }
@ -19,4 +19,5 @@ export default memo(({ width = 60, color = '#6190e8' }: { width?: number; color?
<View style={styleObj} className={style.loading__ring}></View>
</View>
)
})
}
export default memo(Loading)

View File

@ -8,7 +8,7 @@ interface Params {
title?: string
loadingIcon?: boolean
}
export default memo((props: Params) => {
const LoadingCard = (props: Params) => {
console.log(props)
const {
title = '加载中...', // 显示的文字
@ -24,4 +24,5 @@ export default memo((props: Params) => {
</View>
</>
)
})
}
export default memo(LoadingCard)

View File

@ -12,7 +12,7 @@ interface param {
children?: ReactElement|null
onClick?: () => void
}
export default ({ children = null, onClick }: param) => {
const MoveBtn = ({ children = null, onClick }: param) => {
// 获取购物车数据数量
const { getShopCount, commonData } = useCommonData()
@ -47,3 +47,4 @@ export default ({ children = null, onClick }: param) => {
</MovableArea>
)
}
export default MoveBtn

View File

@ -25,8 +25,7 @@ interface Param {
showStatus?: 'detail' | 'list' // 订单详情,订单列表
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
}
export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
const OrderBtns = ({ orderInfo, showStatus = 'detail', onClick }: Param) => {
// 订单状态枚举
const {
SaleOrderStatusBooking,
@ -161,28 +160,6 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
const { ApplyGoods } = SUBSCRIPTION_MESSAGE_SCENE
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 = () => {
Taro.showModal({
@ -286,6 +263,28 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
}, [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 (
<View className={styles.btns_list}>
{orderBtnsShowList.length > 3 && (
@ -321,4 +320,5 @@ export default memo(({ orderInfo, showStatus = 'detail', onClick }: Param) => {
</View>
</View>
)
})
}
export default memo(OrderBtns)

View File

@ -25,73 +25,73 @@ export interface Params extends PopupEvent {
safeAreaInsetBottom?: boolean // 是否为iphoneX提供小黑条适配
showOverLay?: boolean // 是否显示遮罩层
}
export default memo(
({
title = '标题',
show = false,
showTitle = true,
onClose,
isFixed = false,
showIconButton = false,
children,
position = 'bottom',
animationEnd,
customStyle = {},
safeAreaInsetBottom = true,
showOverLay = true,
overlayStyle,
}: Params) => {
const animationTime = useRef<any>(null)
useEffect(() => {
if (show) {
animationTime.current = setTimeout(() => {
animationEnd?.()
customStyle.overflow = 'unset'
}, 260)
}
else {
clearTimeout(animationTime.current)
}
}, [show])
const Popup = ({
title = '标题',
show = false,
showTitle = true,
onClose,
isFixed = false,
showIconButton = false,
children,
position = 'bottom',
animationEnd,
customStyle = {},
safeAreaInsetBottom = true,
showOverLay = true,
overlayStyle,
}: Params) => {
const animationTime = useRef<any>(null)
useEffect(() => {
if (show) {
animationTime.current = setTimeout(() => {
animationEnd?.()
customStyle.overflow = 'unset'
}, 260)
}
else {
clearTimeout(animationTime.current)
}
}, [show])
useEffect(() => {
return () => {
clearTimeout(animationTime.current)
}
}, [])
useEffect(() => {
return () => {
clearTimeout(animationTime.current)
}
}, [])
return (
<View className={style.drawer_main}>
<View catchMove className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
{/* 遮罩层 start */}
<View
className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show, [style['drawer_mask--hidden']]: !showOverLay })}
onClick={onClose}
style={overlayStyle}
></View>
{/* 遮罩层 end */}
<View
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}` }}
className={classnames(style.drawer_container, style[`drawer_container_${position}`], {
[style.drawer_container_active]: show,
[style[`drawer_container_${position}-withShadow`]]: !showOverLay,
})}
onClick={e => e.stopPropagation()}
>
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
{showIconButton && (
<View className={style.common_close_btn_icon}>
<CloseBtnIcon onClose={onClose} />
</View>
)}
<View id="drawerContainerContext" className={style.drawer_container_context}>
{children}
return (
<View className={style.drawer_main}>
<View catchMove className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
{/* 遮罩层 start */}
<View
className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show, [style['drawer_mask--hidden']]: !showOverLay })}
onClick={onClose}
style={overlayStyle}
></View>
{/* 遮罩层 end */}
<View
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}` }}
className={classnames(style.drawer_container, style[`drawer_container_${position}`], {
[style.drawer_container_active]: show,
[style[`drawer_container_${position}-withShadow`]]: !showOverLay,
})}
onClick={e => e.stopPropagation()}
>
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
{showIconButton && (
<View className={style.common_close_btn_icon}>
<CloseBtnIcon onClose={onClose} />
</View>
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
)}
<View id="drawerContainerContext" className={style.drawer_container_context}>
{children}
</View>
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
</View>
</View>
)
},
)
</View>
)
}
export default memo(Popup)

View File

@ -11,7 +11,7 @@ interface Params {
productList?: any[]
popupShow?: (any) => void
}
export default ({ desStatus = true, productList = [], popupShow }: Params) => {
const Product = ({ desStatus = true, productList = [], popupShow }: Params) => {
const labAndImgObj = useCallback(
(item) => {
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
@ -20,9 +20,9 @@ export default ({ desStatus = true, productList = [], popupShow }: Params) => {
)
return (
<View className={styles.products_list}>
{productList?.map((item) => {
{productList?.map((item, key) => {
return (
<View className={styles.products_item} onClick={() => popupShow?.(item)}>
<View key={key} className={styles.products_item} onClick={() => popupShow?.(item)}>
<View className={styles.item_img}>
<LabAndImg value={labAndImgObj(item)} />
<View className={styles.num}>{item.product_color_count}</View>
@ -45,3 +45,5 @@ export default ({ desStatus = true, productList = [], popupShow }: Params) => {
</View>
)
}
export default Product

View File

@ -26,104 +26,102 @@ interface Params {
handScan?: () => void
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(
forwardRef(
(
{
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 value = e.detail.value
setInputCon(value)
changeOnSearch?.(value)
}
const onInputEven = (e) => {
const value = e.detail.value
setInputCon(value)
changeOnSearch?.(value)
}
const clearInput = () => {
setInputCon('')
changeOnSearch?.('')
}
useImperativeHandle(ref, () => ({
clearInput,
}))
const onSearch = () => {
clickOnSearch?.(inputCon)
}
useImperativeHandle(ref, () => ({
clearInput,
}))
const clearInput = () => {
setInputCon('')
changeOnSearch?.('')
}
const onSearch = () => {
clickOnSearch?.(inputCon)
}
return (
<>
<View className={styles.search_main}>
<View className={styles.search_con}>
{showIcon && (
<IconFont
name="icon-sousuo"
size={37}
color="#ababac"
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}
></IconFont>
)}
<View className={styles.input_bar}>
<InputX
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>
return (
<>
<View className={styles.search_main}>
<View className={styles.search_con}>
{showIcon && (
<IconFont
name="icon-sousuo"
size={37}
color="#ababac"
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}
></IconFont>
)}
<View className={styles.input_bar}>
<InputX
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>
{showBtn && (
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
{btnTitle}
{showScan && (
<View
onClick={() => {
handScan?.()
}}
>
<IconFont name="icon-saomiao" size={40} color="#337FFF"></IconFont>
</View>
)}
{children}
<View className={styles.customRightSlot}>{customRightSlot}</View>
</View>
</>
)
},
</View>
{showBtn && (
<View style={btnStyle} className={styles.btn} onClick={onSearch}>
{btnTitle}
</View>
)}
{children}
</View>
</>
)
}
export default memo(
forwardRef(
Search,
),
)

View File

@ -19,8 +19,7 @@ interface Params {
titleStyle?: Object
styleObj?: Object
}
export default memo((props: Params) => {
const SearchInput = (props: Params) => {
const {
showTitle = true,
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>}
</View>
)
})
}
export default memo(SearchInput)

View File

@ -23,7 +23,7 @@ interface productType {
name: string
}
const SelectProduct = forwardRef((params: PropsType, ref) => {
const SelectProduct = (params: PropsType, ref) => {
const { selectColorId, noAll, onSelect } = params
const [selectId, setSelectId] = useState(selectColorId)
@ -34,6 +34,19 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
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 = () => {
setShowPopup(true)
}
@ -53,22 +66,6 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
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 res = await fetchData()
// !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]
}
const [showPopup, setShowPopup] = useState(false)
useEffect(() => {
getProductList()
}, [])
const closeEven = () => {
setShowPopup(false)
@ -118,7 +117,7 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
</View>
<Popup title="请选择面料名称" showTitle show={showPopup} onClose={closeEven} position="bottom" customStyle={{ zIndex: 9999 }}>
<View style={{ padding: '0 24rpx' }}>
<Search placeholder="请输入编号/面料" showBtn={false} changeOnSearch={getSearchData} debounceTime={350}></Search>
<Search placeholder="请输入编号/面料" showBtn={false} changeOnSearch={getSearchData}></Search>
</View>
<View className={styles.selectList}>
<ScrollView className={styles['selectList-scroll-view']} scrollY>
@ -134,5 +133,5 @@ const SelectProduct = forwardRef((params: PropsType, ref) => {
</Popup>
</>
)
})
export default SelectProduct
}
export default forwardRef(SelectProduct)

View File

@ -25,33 +25,42 @@ interface param {
intoStatus?: 'again' | 'shop'
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 = [
{ value: 0, title: '大货', unit: '条', eunit: 'kg', step: 1, digits: 0, minNum: 1, maxNum: 100000, defaultNum: 1 },
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.5, maxNum: 9.99, defaultNum: 1 },
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 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 selectProduct = (index: number) => {
setSelectIndex(index)
}
useEffect(() => {
setSelectIndex(() => default_sale_mode!)
}, [default_sale_mode])
useEffect(() => {
resetList()
setSelectStatus(true)
}, [selectIndex])
// 初始化全部数据默认勾选
const [checkboxData, setCheckboxData] = useState<Record<number, true | false>>({})
const initStatus = useRef(false)
// 获取购物车数据数量
const { setShopCount } = useCommonData()
// 全选反选
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?.map((item) => {
list?.forEach((item) => {
if (selectIndex == item.sale_mode || selectIndex == -1) {
checkboxData[item.id] = true
}
@ -62,10 +71,20 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
setCheckboxData(() => ({ ...checkboxData }))
}
// 获取数据
const [list, setList] = useState<any[]>([])
const [loading, setLoading] = useState(false)
const { fetchData } = GetShoppingCartApi()
useEffect(() => {
setSelectIndex(() => default_sale_mode!)
}, [default_sale_mode])
useEffect(() => {
resetList()
setSelectStatus(true)
}, [selectIndex])
// 绑定业务员和电话号码
const [showBindSalesman, setShowBindSalesman] = useState(false)
// 获取购物车数据数量
const { setShopCount } = useCommonData()
const getShoppingCart = async() => {
const { data } = await fetchData()
const color_list = data.color_list || []
@ -75,19 +94,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
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(() => {
if (!show) {
@ -113,28 +119,19 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
setShowPopup(show)
}, [show])
// 全选反选
const [selectStatus, setSelectStatus] = useState(false)
const selectAll = () => {
list.map((item) => {
list.forEach((item) => {
if (selectIndex == item.sale_mode || selectIndex == -1) { checkboxData[item.id] = !selectStatus }
})
setSelectStatus(!selectStatus)
setCheckboxData(() => ({ ...checkboxData }))
}
// checkbox选中回调
const selectCallBack = (item) => {
checkboxData[item.id] = true
checkSelect()
setCheckboxData(() => ({ ...checkboxData }))
}
// checkbox选中判断是否全部选中全部选中后是全选否则反选
const checkSelect = () => {
let list_count = 0
let select_count = 0
list?.map((item) => {
list?.forEach((item) => {
if (selectIndex == -1 || selectIndex == item.sale_mode) {
list_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)
}
// checkbox选中回调
const selectCallBack = (item) => {
checkboxData[item.id] = true
checkSelect()
setCheckboxData(() => ({ ...checkboxData }))
}
// checkbox关闭回调
const colseCallBack = (item) => {
@ -156,6 +159,17 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
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 delSelect = () => {
@ -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) => {
return Number(formatPriceDiv(price))
@ -219,7 +222,7 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
const product_list = new Set() // 面料
let color_count = 0 // 颜色数量
let all_count = 0 // 总数量
list.map((item) => {
list.forEach((item) => {
if (checkboxData[item.id]) {
estimate_amount += item.estimate_amount
product_list.add(item.product_id)
@ -236,10 +239,10 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
}, [list, checkboxData])
// 去结算
const { fetchData: useFetchData } = GetAdminUserInfoApi()
const { fetchData: FetchData } = GetAdminUserInfoApi()
const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi()
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 == 1) { applyOrderAccessFetchData() }
setShowBindSalesman(() => true)
@ -277,9 +280,6 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
}
}, 300)
// 绑定业务员和电话号码
const [showBindSalesman, setShowBindSalesman] = useState(false)
// 显示图片弹窗
const [showLabImage, setShowLabImage] = useState(false)
const [labImageValue, setLabImageValue] = useState()
@ -412,3 +412,5 @@ export default ({ show = false, onClose, intoStatus = 'shop', default_sale_mode
</View>
)
}
export default ShopCart

View File

@ -34,7 +34,7 @@ interface prosObj {
hasBottom?: true | false // 默认不占位底部
onBlur?: (e: string, res: object) => void
}
export default memo(forwardRef((props: prosObj, ref) => {
const ShoppingCart = (props: prosObj, ref) => {
const {
showPopup = false,
closePopup,
@ -105,7 +105,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
return s
}
const rows = memo(({ id, index, style, data }: any) => {
const rows = ({ id, index, style, data }: any) => {
const item = data[index]
return (
<>
@ -120,7 +120,8 @@ export default memo(forwardRef((props: prosObj, ref) => {
></Goods>
</>
)
})
}
const Rows = memo(rows)
return (
<Popup showTitle={false} show={showPopup} onClose={() => closePopup?.()}>
@ -164,7 +165,6 @@ export default memo(forwardRef((props: prosObj, ref) => {
placeholder="请输入搜索布料"
showBtn={false}
changeOnSearch={getSearchData}
debounceTime={300}
adjustPosition
/>
</View>
@ -181,7 +181,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
itemSize={100} /* 列表单项的高度 */
overscanCount={1}
>
{rows}
{Rows}
</VirtualList>
</View>
@ -212,4 +212,5 @@ export default memo(forwardRef((props: prosObj, ref) => {
</ScrollView>
</Popup>
)
}))
}
export default memo(forwardRef(ShoppingCart))

View File

@ -21,8 +21,7 @@ interface Params {
hasMore?: true | false
statusMore?: StatusParam
}
export default memo(({
const SideBar = ({
list = [],
defaultValue = 0,
height = '100vh',
@ -44,6 +43,15 @@ export default memo(({
setSelected(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 index = list?.findIndex((item) => {
return item.id == defaultValue
@ -59,16 +67,6 @@ export default memo(({
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(() => {
Taro.nextTick(() => {
const query = Taro.createSelectorQuery()
@ -127,4 +125,5 @@ export default memo(({
</>
)
})
}
export default memo(SideBar)

View File

@ -9,7 +9,7 @@ interface params {
sortValue?: { desc: string; asc: string } // 排序规则,后端制定
}
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>()
useEffect(() => {
setSortStatus(() => status)
@ -19,11 +19,11 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
let value = ''
if (sortStatus == 'none') {
status = 'top'
value = sortValue?.asc!
value = sortValue?.asc as string
}
if (sortStatus == 'top') {
status = 'bottom'
value = sortValue?.desc!
value = sortValue?.desc as string
}
if (sortStatus == 'bottom') { status = 'none' }
setSortStatus(() => status)
@ -42,4 +42,5 @@ export default forwardRef(({ status = 'none', onChange, sortValue }: params, ref
</View>
</>
)
})
}
export default forwardRef(SortBtn)

View File

@ -73,10 +73,10 @@ const Table: FC<TablePropsType> = (props) => {
&& dataSource.list.map((source) => {
return (
<View className={classnames(styles.tr, styles['bg-line'])} key={source.key}>
{columns.map((column) => {
{columns.map((column, key) => {
if (column.render) {
return (
<View className={styles.td} style={{ width: column.width }}>
<View key={key} className={styles.td} style={{ width: column.width }}>
{/* 判断表头是不是有render 有就执行render */}
{column.render(source[column.dataIndex])}
</View>
@ -84,7 +84,7 @@ const Table: FC<TablePropsType> = (props) => {
}
else {
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] // 根据表头填数据
}

View File

@ -17,8 +17,7 @@ interface Params {
style?: Object
}
export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
const Tabs = ({ list = [], defaultValue = 0, tabsOnClick, style = {} }: Params) => {
const [selected, setSelected] = useState(defaultValue)
const [tabId, setTabId] = useState('')
@ -57,4 +56,5 @@ export default memo(({ list = [], defaultValue = 0, tabsOnClick, style = {} }: P
</View>
</>
)
})
}
export default memo(Tabs)

View File

@ -11,7 +11,7 @@ interface Param {
defaultValue?: string
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({
number: 0,
value: '',
@ -38,11 +38,13 @@ export default memo(({ onChange, title = '', placeholder = '请输入', defaultV
<View className={styles.other_desc}>
<View className={styles.title}>{title}</View>
<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>
|| <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
{(descData.show && !onlyRead)
? <Textarea autoFocus value={descData.value} onBlur={() => toggleShowRealTextarea(false)} className={styles.textarea_con} cursorSpacing={100} maxlength={descData.count} onInput={e => getDesc(e.detail.value)}></Textarea>
: <View className={classnames(styles.textarea_con_pretend, descData.value && styles.textarea_con_pretend_ed)} onClick={() => toggleShowRealTextarea(true)}>{descData.value || placeholder}</View>
}
<View className={styles.descDataNum}>{`${descData.number}/${descData.count}`}</View>
</View>
</View>
)
})
}
export default memo(TextareaEnhance)

View File

@ -12,8 +12,7 @@ interface Props {
start?: DateArg
onSelectDate?: (any) => void
}
export default memo((props: Props) => {
const TimePicker = (props: Props) => {
const { start = '', end = '', onSelectDate } = props
const [time, setTime] = useState<any>({})
@ -49,4 +48,5 @@ export default memo((props: Props) => {
</View> */}
</>
)
})
}
export default memo(TimePicker)

View File

@ -11,8 +11,7 @@ interface Props {
start?: DateArg
onSelectDate?: (any) => void
}
export default memo((props: Props) => {
const TimePickerPopup = (props: Props) => {
const { showTime = false, closePopup, start = '', end = '', onSelectDate } = props
return (
@ -20,4 +19,5 @@ export default memo((props: Props) => {
<TimePicker start={start} end={end} onSelectDate={onSelectDate}></TimePicker>
</Popup>
)
})
}
export default memo(TimePickerPopup)

View File

@ -54,7 +54,7 @@ const popoverStyle = {
color: '#333333',
}
const ToolTip = forwardRef<ToolTipRef, ToolTipPropsType>((props, ref) => {
const ToolTip = (props: ToolTipPropsType, ref) => {
const id = useId()
const [, setForceUpdate] = useState({})
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>
</>
)
})
}
export default ToolTip
export default forwardRef<ToolTipRef, ToolTipPropsType>(ToolTip)

View File

@ -13,11 +13,13 @@ interface ImageParam {
defaultList?: string[]
onlyRead?: boolean
}
const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false }) => {
const PictureItem = ({ onChange, defaultList, onlyRead = false }: ImageParam) => {
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
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(() => {
setImageLise(defaultList || [])
}, [defaultList])
@ -29,17 +31,18 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
// 上传图片逻辑
const handPic = async(id) => {
let list: any
// let resArr = List.filter(item => {
// return item.check
// })
if (id == 1) {
var list: any = await getWxPhoto('after-sale', 5)
list = await getWxPhoto('after-sale', 5)
}
else {
var list: any = await getChatPhoto('after-sale', 5)
list = await getChatPhoto('after-sale', 5)
}
const images: any[] = []
list?.map((item) => {
list?.forEach((item) => {
images.push(item.url)
})
setImageLise([...imageList, ...images])
@ -67,9 +70,6 @@ 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) => {
List.map((it) => {
@ -89,7 +89,7 @@ const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false
<>
<View className={styles.image_main}>
{imageList?.map((item, index) => (
<View className={styles.ImgItem}>
<View className={styles.ImgItem} key={index}>
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
{!onlyRead && <View onClick={() => delImage(index)}>
<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>
</>
)
})
}
export default PictureItem
export default memo<ImageParam>(PictureItem)

View File

@ -35,16 +35,15 @@ const CustomTabBar: FC = () => {
console.log('selectedId', selectedId)
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']) => {
return () => {
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 (
<View className={styles.customTabBar}>

View File

@ -10,7 +10,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
<title></title>
<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>
</head>
<body>

View File

@ -4,11 +4,11 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import classnames from 'classnames'
import styles from './index.module.scss'
import Search from '@/components/search'
import { mpcashManagementOrderaccount } from '@/api/newCollection'
import { MpCashManagementOrderAccount } from '@/api/newCollection'
import InfiniteScroll from '@/components/infiniteScroll'
import { dataLoadingStatus, getFilterData } from '@/common/util'
export default () => {
const AccountPage = () => {
const [search, setSearch] = useState({
search_name: null,
page: 1,
@ -16,7 +16,7 @@ export default () => {
})
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(() => {
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading! })
@ -27,22 +27,8 @@ export default () => {
bankName: '',
})
// 输入了搜索关键字
const getSearchData = useCallback((eq) => {
pageNum.current.page = 1
setClientlist(() => ({ list: [], total: 0 }))
setSearch(e => ({ ...e, search_name: eq, size: 10 }))
}, [])
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 getScrolltolower = useCallback(() => {
@ -54,6 +40,13 @@ export default () => {
}
}, [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 getRefresherRefresh = async() => {
@ -77,6 +70,12 @@ export default () => {
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
setRefresherTriggeredStatus(() => false)
}
useEffect(() => {
if (search.search_name === '') {
setSearch(e => ({ ...e, search_name: null }))
}
if (search.search_name !== '') { getCuss() }
}, [search])
// 选择业务员
const selectClient = (item) => {
clentList.list.map((it) => {
@ -146,3 +145,5 @@ export default () => {
</View>
)
}
export default AccountPage

View File

@ -6,11 +6,10 @@ import styles from './index.module.scss'
import FromList from '@/components/FromList'
import Address from '@/components/address'
import { alert } from '@/common/common'
import { mppurchaseraddress, mppurchaseraddressdelect, mppurchaseraddressget, mppurchaseraddressput } from '@/api/addressList'
import { getFilterData } from '@/common/util'
import { MpPurchaserAddress, MpPurchaserAddressDelete, MpPurchaserAddressGet, MpPurchaserAddressPut } from '@/api/addressList'
import IconFont from '@/components/iconfont/iconfont'
export default () => {
const AddAddress = () => {
const [itemList, setItemList] = useState<any[]>(
[
{
@ -54,22 +53,6 @@ export default () => {
)
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({
name: '',
phone: '',
@ -81,8 +64,15 @@ export default () => {
id: '',
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的信息
const { fetchData: infoFetch } = mppurchaseraddressget()
const { fetchData: infoFetch } = MpPurchaserAddressGet()
const [infoObj, setinfoObj] = useState<any>()
const getInfo = async() => {
const res = await infoFetch({
@ -116,7 +106,7 @@ export default () => {
item.value = res.data.phone
}
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 === '详细地址') {
item.value = res.data.address_detail
@ -131,13 +121,20 @@ export default () => {
}
}
// `${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(() => {
let canShow = false
const obj = itemList.filter((item) => {
if (item.require) {
return item.value !== ''
}
return item.require && (item.value !== '')
})
if (obj.length < 4) {
canShow = true
@ -214,7 +211,7 @@ export default () => {
})
}
// 新增地址
const { fetchData: addAddressFetch } = mppurchaseraddress()
const { fetchData: addAddressFetch } = MpPurchaserAddress()
const handAdd = async() => {
// if (!btnDisabled) return false
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() => {
// if (!btnDisabled) return false
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() => {
Taro.showModal(({
title: '提示',
@ -334,3 +331,5 @@ export default () => {
</>
)
}
export default AddAddress

View File

@ -30,8 +30,7 @@ interface Params {
bigMoney?: any // 展示的大写金额,
isOpen?: boolean // 是否展开状态
}
export default memo((pros: Params) => {
const Form = (pros: Params) => {
return (
<>
{
@ -98,4 +97,5 @@ export default memo((pros: Params) => {
}
</>
)
})
}
export default memo(Form)

View File

@ -5,26 +5,17 @@ import classnames from 'classnames'
import styles from './index.module.scss'
import Form from './components/form'
import {
mpcashManagementOrderaccount, mpcashManagementOrderpost,
mpshouldCollectOrderpurchaser,
MpCashManagementOrderAccount, MpCashManagementOrderPost,
MpShouldCollectOrderPurchaser,
} from '@/api/newCollection'
import { alert } from '@/common/common'
import smallToBig from '@/common/money'
import IconFont from '@/components/iconfont/iconfont'
export default () => {
const AddCollection = () => {
// 获取选择的客户
const pages = Taro.getCurrentPages()
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>({})
@ -35,12 +26,8 @@ export default () => {
setQuery(val => ({ ...val, picList: list }))
}, [])
useEffect(() => {
getCuss()
}, [])
// 获取首个银行账号
const { fetchData: clitentFetch } = mpcashManagementOrderaccount()
const { fetchData: clitentFetch } = MpCashManagementOrderAccount()
const getCuss = async() => {
const res = await clitentFetch({ page: 1, size: 10 })
if (res.data) {
@ -48,7 +35,7 @@ export default () => {
}
}
const { fetchData: scanFetch } = mpshouldCollectOrderpurchaser()
const { fetchData: scanFetch } = MpShouldCollectOrderPurchaser()
// 扫描
const handScan = (e) => {
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(() => {
if (Query.clientName == ''
@ -125,7 +123,7 @@ export default () => {
}
// 确认新建
const { fetchData: sureFetch } = mpcashManagementOrderpost()
const { fetchData: sureFetch } = MpCashManagementOrderPost()
const handSure = () => {
const query = {
payment_credential_url: picUrl.current,
@ -279,3 +277,5 @@ export default () => {
</>
)
}
export default AddCollection

View File

@ -5,7 +5,7 @@ import { useState } from 'react'
import AddressList from '@/components/AddressList'
import './index.scss'
export default () => {
const AddressManager = () => {
const router = useRouter()
return (
<View className="address-manager">
@ -13,3 +13,4 @@ export default () => {
</View>
)
}
export default AddressManager

View File

@ -5,21 +5,99 @@ import classnames from 'classnames'
import styles from './index.module.scss'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpenumreturnExplain,
mpenumreturnOrderreturnReason,
mpenumreturngoodsStatus,
mpreturnApplyOrder,
mpsaleOrder,
MpEnumReturnExplain,
MpEnumReturnGoodsStatus,
MpEnumReturnOrderReturnReason,
MpReturnApplyOrder,
MpSaleOrder,
} from '@/api/order'
import Popup from '@/components/popup'
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()
useEffect(() => {
getDetail()
}, [])
const { fetchData: infoFetch } = mpsaleOrder()
const { fetchData: infoFetch } = MpSaleOrder()
const [infoObj, setInfoObj] = useState<any>({})
const [ListArr, setListArr] = useState<any[]>([])
// 获取订单详情
@ -31,7 +109,7 @@ export default () => {
const res = await infoFetch({ id: router.params.orderId })
if (res.data) {
res.data.av_return_product.forEach((item) => {
item.av_product_color.map((it) => {
item.av_product_color.forEach((it) => {
it.isTui = false
it.nums = 1
})
@ -132,16 +210,12 @@ export default () => {
// 点击加
const handAdd = (val) => {
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.nums < it.roll) {
it.nums++
}
else {
return
}
}
return it
})
})
setListArr([...ListArr])
@ -159,6 +233,10 @@ export default () => {
return arr.length
}, [ListArr])
useEffect(() => {
getDetail()
}, [])
// 获取图片列表
const picUrl = useRef([])
const getImageList = useCallback((list) => {
@ -168,11 +246,6 @@ export default () => {
// 筛选内容展示
const [showPopup, setshowPopup] = useState(false)
useEffect(() => {
getReason()
getReasonTwo()
}, [])
const queryRef = useRef(
{
return_reason: 1, // 退货原因
@ -210,7 +283,7 @@ export default () => {
}, [Query, totalNums])
/// 获取退货原因
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
const { fetchData: resonFetch } = MpEnumReturnOrderReturnReason()
const [ReasonList, setReasonList] = useState<any[]>([])
const getReason = async() => {
const res = await resonFetch()
@ -220,7 +293,7 @@ export default () => {
}
// 获取退货原因2
const { fetchData: resonTwoFetch } = mpenumreturnExplain()
const { fetchData: resonTwoFetch } = MpEnumReturnExplain()
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
const getReasonTwo = async() => {
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
@ -264,7 +337,18 @@ export default () => {
// queryRef.current.return_explain = item.id
}
useEffect(() => {
getReason()
getReasonTwo()
}, [])
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.default = false
return it
})
return arr
}
// 重置
const handReset = () => {
queryRef.current.return_reason = 1
@ -279,15 +363,6 @@ export default () => {
setReasonListTwo([...arrTwo])
}
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.default = false
return it
})
return arr
}
// 判断选择原因
const selectIsDisabled = useMemo(() => {
if (Query.return_explain !== '') {
@ -327,18 +402,18 @@ export default () => {
// 货物情况
const [DescPopup, setDescPopup] = useState(false)
const { fetchData: statusFetch } = mpenumreturngoodsStatus()
const { fetchData: statusFetch } = MpEnumReturnGoodsStatus()
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
useEffect(() => {
getGoodStatus()
}, [])
const getGoodStatus = async() => {
const res = await statusFetch()
if (res.data) {
setGoodStatusList(res.data.list)
}
}
useEffect(() => {
getGoodStatus()
}, [])
const handStatus = (item) => {
GoodStatusList.map((it) => {
if (it.id === item.id) {
@ -389,9 +464,10 @@ export default () => {
delta: 1,
})
}
// 备注信息
const [TextareaValue, setTextareaValue] = useState('')
// 确认退货
const { fetchData: sureFetch } = mpreturnApplyOrder()
const { fetchData: sureFetch } = MpReturnApplyOrder()
const handSure = () => {
if (Query.reasonNameTwo == '其他问题' && TextareaValue == '') {
Taro.showToast({
@ -458,15 +534,13 @@ export default () => {
setQuery(Query)
}, [Query])
// 备注信息
const [TextareaValue, setTextareaValue] = useState('')
const getDesc = (e) => {
setTextareaValue(e)
}
return (
<View className={styles.main}>
<View className={styles.bgBox}>
<GoodsItem
<GoodsItemWithMemo
list={ListArr}
obj={infoObj}
handTui={item => handTui(item)}
@ -475,7 +549,7 @@ export default () => {
handReduce={item => handReduce(item)}
handAdd={item => handAdd(item)}
onInputEven={(e, item) => onInputEven(e, item)}
></GoodsItem>
></GoodsItemWithMemo>
<View className={styles.hasSelect}>{totalNums}</View>
</View>
<View className={styles.resonBig}>
@ -589,82 +663,4 @@ export default () => {
</View>
)
}
// 产品商品元素
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>
)
})
}
</>
)
})
export default ApplyGoods

View File

@ -5,19 +5,96 @@ import classnames from 'classnames'
import styles from './index.module.scss'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpenumrefundExplainone,
mpreturnApplyOrder,
mpsaleOrder,
MpEnumRefundExplainOne,
MpReturnApplyOrder,
MpSaleOrder,
} from '@/api/order'
import Popup from '@/components/popup'
export default () => {
useEffect(() => {
getDetail()
getEnum()
}, [])
// 产品商品元素
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 ApplyMoney = () => {
const Router = useRouter()
const { fetchData: infoFetch } = mpsaleOrder()
const { fetchData: infoFetch } = MpSaleOrder()
const [ListArr, setListArr] = useState<any[]>([])
const [infoObj, setInfoObj] = useState<any>({})
@ -30,7 +107,7 @@ export default () => {
const res = await infoFetch({ id: Router.params.orderId })
if (res.data) {
res.data.av_return_product.forEach((item) => {
item.av_product_color.map((it) => {
item.av_product_color.forEach((it) => {
it.isTui = false
it.nums = 1
})
@ -132,16 +209,12 @@ export default () => {
// 点击加
const handAdd = (val) => {
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.nums < it.roll) {
it.nums++
}
else {
return
}
}
return it
})
})
setListArr([...ListArr])
@ -149,14 +222,20 @@ export default () => {
// 获取枚举
const [List, setList] = useState<any[]>([])
const { fetchData: explanFetch } = mpenumrefundExplainone()
const { fetchData: explanFetch } = MpEnumRefundExplainOne()
const getEnum = async() => {
const res = await explanFetch()
if (res.data) {
setList(res.data.list)
}
}
const queryRef = useRef({
reasonName: '请选择',
})
const [Query, setQuery] = useState<any>({
reasonId: '',
reasonName: '请选择',
})
// 选择退货原因
const handReasonOne = (item) => {
List.map((it) => {
@ -176,14 +255,6 @@ export default () => {
// 筛选内容展示
const [showPopup, setshowPopup] = useState(false)
const queryRef = useRef({
reasonName: '请选择',
})
const [Query, setQuery] = useState<any>({
reasonId: '',
reasonName: '请选择',
})
// 备注信息
const [TextareaValue, setTextareaValue] = useState('')
const getDesc = (e) => {
@ -214,7 +285,14 @@ export default () => {
})
return arr.length
}, [ListArr])
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.default = false
return it
})
return arr
}
// 重置
const handReset = () => {
setQuery(({ reasonId: '', reasonName: '请选择' }))
@ -251,17 +329,13 @@ export default () => {
return true
}
}, [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 = () => {
if (queryRef.current.reasonName == '其他问题' && TextareaValue == '') {
Taro.showToast({
@ -354,7 +428,7 @@ export default () => {
<View className={styles.main}>
{
showItem && <View className={styles.bgBox}>
<GoodsItem
<GoodsItemWithMemo
list={ListArr}
obj={infoObj}
handTui={item => handTui(item)}
@ -363,7 +437,7 @@ export default () => {
handReduce={item => handReduce(item)}
handAdd={item => handAdd(item)}
onInputEven={(e, item) => onInputEven(e, item)}
></GoodsItem>
></GoodsItemWithMemo>
<View className={styles.hasSelect}>{totalNums}</View>
</View>
}
@ -435,82 +509,4 @@ export default () => {
</View>
)
}
// 产品商品元素
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>
)
})
}
</>
)
})
export default ApplyMoney

View File

@ -29,8 +29,7 @@ interface Params {
showSizeFont?: boolean // 展示金额的大写
bigMoney?: any // 展示的大写金额
}
export default memo((pros: Params) => {
const Form = (pros: Params) => {
return (
<View className={styles.itemBox}
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}
@ -98,4 +97,5 @@ export default memo((pros: Params) => {
</View>
)
})
}
export default memo(Form)

View File

@ -11,20 +11,15 @@ import Popup from '@/components/popup'
import InfiniteScroll from '@/components/infiniteScroll'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpcashManagementOrder,
MpCashManagementOrder,
} from '@/api/newCollection'
import TimePicker from '@/components/timePicker'
import { alert } from '@/common/common'
import smallToBig from '@/common/money'
import { IMG_CND_Prefix } from '@/common/constant'
export default () => {
const CollectionDetail = () => {
const router = useRouter()
const [Query, setQuery] = useState<any>({})
const { fetchData: getFetch } = mpcashManagementOrder()
useEffect(() => {
getDetail()
}, [])
const { fetchData: getFetch } = MpCashManagementOrder()
const getDetail = async() => {
Taro.showLoading({
title: '请稍等',
@ -50,7 +45,9 @@ export default () => {
res = Query.receipt_amount / 100
return res
}, [Query])
useEffect(() => {
getDetail()
}, [])
return (
<>
<View className={styles.topBox}>
@ -152,3 +149,5 @@ export default () => {
</>
)
}
export default CollectionDetail

View File

@ -7,7 +7,7 @@ import Popup from './Popup'
import { useBluetooth } from '@/use/contextBlueTooth'
import SearchInput from '@/components/searchInput'
export default memo(() => {
const LinkBlueTooth = () => {
const { state, init, startScan, connect, disconnect } = useBluetooth()
useEffect(() => {
@ -36,7 +36,9 @@ export default memo(() => {
const onLinkListen = (item) => {
if (!state.connected && !state.connecting) { connect(item) }
}
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
const [popupShow, setPopupShow] = useState(false)
// 显示设备列表
const onFindDevice = () => {
@ -52,9 +54,6 @@ export default memo(() => {
onFindEven()
}
}
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
// 断开链接
const onDisconnect = () => {
@ -84,4 +83,5 @@ export default memo(() => {
</View>
</>
)
})
}
export default memo(LinkBlueTooth)

View File

@ -12,8 +12,7 @@ interface params {
onOff: () => void
onFind: () => void
}
export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
const Popup = ({ state, show = false, onClose, onLink, onOff, onFind }: params) => {
const [popupShow, setPopupShow] = useState(show)
useEffect(() => {
setPopupShow(show)
@ -32,9 +31,9 @@ export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: pa
<ScrollView scrollY className={style.scroll}>
{(state.devices
&& state.devices.length > 0
&& state?.devices.map((item) => {
&& state?.devices.map((item, key) => {
return (
<View className={style.item} onClick={() => onLink(item)}>
<View key={key} className={style.item} onClick={() => onLink(item)}>
<View>{item.name}</View>
{(!state.connecting && !state.connected && <View></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)

View File

@ -8,7 +8,7 @@ interface PropsType {
children?: React.ReactNode
}
const DrawerCenter: FC<PropsType> = memo((props) => {
const DrawerCenter: FC<PropsType> = (props) => {
const { children, showModal } = props
const [show, setShow] = useState(false)
@ -29,5 +29,5 @@ const DrawerCenter: FC<PropsType> = memo((props) => {
</View>
)
: null
})
export default DrawerCenter
}
export default memo(DrawerCenter)

View File

@ -19,7 +19,7 @@ interface HistoryListItem {
code: string
name: string
}
const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
const HistoryColor = (props: PropsType, ref) => {
const { onColor, showModal, onVisibleChange } = props
const [visible, setVisible] = usePropsValue({
@ -28,12 +28,6 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
onChange: onVisibleChange,
})
useEffect(() => {
if (visible) {
getList()
}
}, [visible])
useImperativeHandle(
ref,
() => {
@ -50,6 +44,7 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
console.log('closeEven')
setVisible(false)
}
const [list, setList] = useState<HistoryListItem[]>([])
// 获取本地列表(无差别存储版本)
const getList = () => {
@ -57,8 +52,11 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
console.log('historyColorList==>', historyColorList)
setList(historyColorList || [])
}
const [list, setList] = useState<HistoryListItem[]>([])
useEffect(() => {
if (visible) {
getList()
}
}, [visible])
// 保留1位小数
const noScale = (val, num = 1) => {
@ -116,5 +114,5 @@ const HistoryColor: FC<PropsType> = forwardRef((props, ref) => {
</Popup>
</View>
)
})
export default HistoryColor
}
export default forwardRef(HistoryColor)

View File

@ -68,13 +68,12 @@ const FindColor: FC = () => {
})
getData(val.lab)
}
const [showHistory, setShowHistory] = useState(false)
const handleVisibleChange = (visible) => {
setShowHistory(visible)
}
const [showHistory, setShowHistory] = useState(false)
const ResultContainer = useMemo(() => {
if (!colorState.loading && list?.length > 0) {
return <RecommendColor customStyle={{ flex: 1 }} list={list} />
@ -94,7 +93,18 @@ const FindColor: FC = () => {
const historyShowEven = () => {
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(() => {
if (!product) {
Taro.showToast({ title: '请选择面料', icon: 'none' })
@ -109,19 +119,6 @@ const FindColor: FC = () => {
}
}, [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 (
<View className={styles.findColor_main}>
<View className={styles.findColor_main_search}>

View File

@ -10,7 +10,7 @@ import { toRgb } from '@/common/bluetooth/color/colorSpace'
import { productabsorbcontrast } from '@/api/index'
import { alert } from '@/common/common'
export default () => {
const SampleComparison = () => {
// 搜索参数
const [searchField, setSearchField] = useState({
l1: '',
@ -79,15 +79,7 @@ export default () => {
}
}
}, [colorList])
const reset = () => {
setColorList({})
setBlueToothColor('')
setBlueToothColorTwo('')
setTime('')
setTimeTwo('')
setData('')
setResult('')
}
const [data, setData] = useState('')
const [result, setResult] = useState('')
const { fetchData } = productabsorbcontrast()
@ -126,6 +118,15 @@ export default () => {
}
alert.hideLoading()
}
const reset = () => {
setColorList({})
setBlueToothColor('')
setBlueToothColorTwo('')
setTime('')
setTimeTwo('')
setData('')
setResult('')
}
return (
<View className={styles.body}>
<View className={styles.topBox}>
@ -186,3 +187,4 @@ export default () => {
</View>
)
}
export default SampleComparison

View File

@ -13,7 +13,7 @@ interface PropsType extends UploadColorEvent {
uploadConfirmState: boolean
}
const UploadColor = forwardRef((params: PropsType, ref) => {
const UploadColor = (params: PropsType, ref) => {
const { onUploadConfirm, uploadConfirmState } = params
const [showModal, setShowModal] = useState(false)
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) => {
setShowModal(bool)
}
@ -55,7 +48,12 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
const handleUploadConfirm = () => {
onUploadConfirm && onUploadConfirm(file)
}
useEffect(() => {
if (uploadConfirmState) {
setFilePath('')
handleTriggerUploadModal(false)
}
}, [uploadConfirmState])
return (
<View className={styles['upload-container']}>
<Popup title="上传纹理" show={showModal} onClose={() => handleTriggerUploadModal(false)}>
@ -75,5 +73,5 @@ const UploadColor = forwardRef((params: PropsType, ref) => {
</Popup>
</View>
)
})
export default UploadColor
}
export default forwardRef(UploadColor)

View File

@ -23,6 +23,7 @@ const TakeColor: FC = () => {
const { measureAndGetLab, state: bluetoothState } = useBluetooth()
const [searchValue, setSearchValue] = useState('')
const [selectedProduct, setSelectedProduct] = useState<Record<string, any>>({})
const [listData, setListData] = useState<Record<string, any>[]>([])
const selectInput = async(event) => {
if (event) {
@ -30,7 +31,7 @@ const TakeColor: FC = () => {
setSelectedProduct(event)
const res = await fetchData({ id: event.id })
if (res.success) {
res.data?.list.map((item, index) => {
res.data?.list.forEach((item, index) => {
item.currnetRgb = item.rgb
item.currentLab = item.lab
item.sampling = !(item.currentLab?.l == 0 && item.currentLab?.a == 0 && item.currentLab?.b == 0)
@ -53,18 +54,12 @@ const TakeColor: FC = () => {
setSearchValue('')
}
const handlePrViewRgb = useCallback((event) => {
setLabPreview(event)
setShowLabPreview(true)
}, [])
const [currentTakeColorIndex, setCurrentTakeColorIndex] = useState<number | null>(null)
const handleTakeColor = (index: number) => {
setCurrentTakeColorIndex(index)
}
const [listData, setListData] = useState<Record<string, any>[]>([])
// const listData = useMemo(() => {
// return state.data?.list?.filter(item => {
// if (searchValue) {
@ -73,6 +68,7 @@ const TakeColor: FC = () => {
// return true
// })
// }, [state.data?.list, state])
const productSelectEl = useRef<any>(null)
const onSearchInput = (event) => {
const current = event.detail.value
@ -149,8 +145,6 @@ const TakeColor: FC = () => {
const [showLabPreview, setShowLabPreview] = useState(false)
const productSelectEl = useRef<any>(null)
const [uploadConfirmState, setUploadConfirmState] = useState(false)
const handleUploadConfirm = async(file) => {
@ -185,7 +179,10 @@ const TakeColor: FC = () => {
alert.none('请选择图片')
}
}
const handlePrViewRgb = useCallback((event) => {
setLabPreview(event)
setShowLabPreview(true)
}, [])
return (
<>
<View className={styles.card}>

View File

@ -13,8 +13,7 @@ interface Props {
isPhone?: boolean
isBorder?: boolean
}
export default memo((props: Props) => {
const Form = (props: Props) => {
const {
isPhone = false,
isBorder = true,
@ -35,4 +34,5 @@ export default memo((props: Props) => {
}
</View>
)
})
}
export default memo(Form)

View File

@ -7,7 +7,7 @@ interface Props {
list: any[]
handChose?: (any) => void
}
export default memo((props: Props) => {
const Tabs = (props: Props) => {
const { list = [], handChose } = props
return (
@ -29,4 +29,5 @@ export default memo((props: Props) => {
}
</View >
)
})
}
export default memo(Tabs)

View File

@ -7,7 +7,7 @@ import { alert, goLink } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
import Popup from '@/components/popup'
import { mppurchaserlabeladd, mppurchaserlist } from '@/api/customer'
import { MpPurchaserLabelAdd, MpPurchaserList } from '@/api/customer'
interface Props {
showPopup: boolean
@ -15,12 +15,12 @@ interface Props {
purchaser_id?: string | number
diseShow?: () => void
}
export default memo(forwardRef((props: Props, ref) => {
const TagPopup = (props: Props, ref) => {
const router = useRouter()
useEffect(() => {
getList()
}, [])
const { fetchData } = mppurchaserlist()
const { fetchData } = MpPurchaserList()
// 标签
const [modeList, setModeList] = useState<any[]>([])
const getList = async() => {
const res = await fetchData()
if (res.data) {
@ -28,8 +28,6 @@ export default memo(forwardRef((props: Props, ref) => {
}
}
// 标签
const [modeList, setModeList] = useState<any[]>([])
// 选择标签
const handCheckMode = (item) => {
modeList.map((it) => {
@ -48,7 +46,7 @@ export default memo(forwardRef((props: Props, ref) => {
})
setModeList([...modeList])
}
const { fetchData: addFetch } = mppurchaserlabeladd()
const { fetchData: addFetch } = MpPurchaserLabelAdd()
const handSure = async() => {
const arr: any[] = []
const fltArr = modeList.filter((item) => { return item.checked })
@ -98,6 +96,9 @@ export default memo(forwardRef((props: Props, ref) => {
modeList,
setModeList,
}))
useEffect(() => {
getList()
}, [])
return (
<Popup title="选择标签" show={props.showPopup} onClose={() => { props.handClose() }}>
<ScrollView scrollY className={styles.scrollView}>
@ -142,4 +143,5 @@ export default memo(forwardRef((props: Props, ref) => {
</View>
</Popup>
)
}))
}
export default memo(forwardRef(TagPopup))

View File

@ -11,34 +11,21 @@ import { debounce } from '@/common/util'
import { alert, goLink } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import AddressList from '@/components/AddressList'
import { mppurchaser } from '@/api/customer'
import { MpPurchaser } from '@/api/customer'
export default () => {
const CustomerDetails = () => {
const router = useRouter()
const [status, setstatus] = useState<number>(1)
useDidShow(() => {
getInfo()
})
const [infoObj, setinfoObj] = useState<any>()
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 { fetchData: getDesc } = MpPurchaser()
// 顶部栏
const AddressListRef = useRef<any>()
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }])
const handChose = (item) => {
TarBarList.map((it) => {
TarBarList.forEach((it) => {
if (it.id === item.id) {
it.showBorder = true
}
@ -72,6 +59,19 @@ export default () => {
TagPopupRef.current.setModeList([...TagPopupRef.current.modeList])
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 (
<View className={styles.mainBox}>
<View className={styles.mainTop}>
@ -133,3 +133,4 @@ export default () => {
</View>
)
}
export default CustomerDetails

View File

@ -11,14 +11,45 @@ import { debounce } from '@/common/util'
import { alert, goLink } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
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 {
id: number
name: string
}
export default () => {
const CustomerEditor = () => {
const router = useRouter()
const [infoObj, setinfoObj] = useState<any>()
@ -26,11 +57,6 @@ export default () => {
const [formData, setformData] = useState<any>()
const [addressArr, setaddressArr] = useState<AddressParms[]>([])
useEffect(() => {
if (router.params.type === 'edit') {
getInfo()
}
}, [])
// 默认业务员
useDidShow(() => {
@ -62,46 +88,7 @@ export default () => {
}
})
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 { fetchData: getDesc } = MpPurchaser()
const handTitle = useCallback((e) => {
setformData(val => ({ ...val, name: e }))
@ -156,9 +143,48 @@ export default () => {
setlist([...list])
setformData(val => ({ ...val, purchaser_type: item.id }))
}
// 备注操作
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 getRemark = useCallback(async(e) => {
setShowDesc(false)
@ -183,12 +209,16 @@ export default () => {
const onClose = () => {
setShowSiteModal(false)
}
useEffect(() => {
if (router.params.type === 'edit') {
getInfo()
}
}, [])
const isDisabled = useMemo(() => {
let empty: any = null
if (typeof (formData) == 'undefined') { return }
for (const key in formData) {
if (formData.hasOwnProperty(key)) {
if (key in formData) {
if (formData[key] !== '' && typeof (formData[key]) !== 'undefined') {
empty = false
}
@ -218,8 +248,8 @@ export default () => {
})
}
const { fetchData: postFetch } = mppurchaserpost()
const { fetchData: putFetch } = mppurchaserput()
const { fetchData: postFetch } = MpPurchaserPost()
const { fetchData: putFetch } = MpPurchaserPut()
// 提交
const handSure = async() => {
// if (!isDisabled) return false
@ -284,9 +314,9 @@ export default () => {
>
<View className={styles.flexBox}>
{
list.map((item) => {
list.map((item, key) => {
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}
></Form>
</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>
</DefaultBox>
</DefaultBoxWithMemo>
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
<Remark onSave={e => getRemark(e)} defaultValue={infoObj?.remark} showInput={!!showDesc} />
</Popup>
@ -345,35 +375,4 @@ export default () => {
</>
)
}
// 卡片盒子元素
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>
)
})
export default CustomerEditor

View File

@ -15,8 +15,7 @@ interface Props {
value?: any
onCloseOverlay?: () => void
}
export default memo(forwardRef((props: Props, ref) => {
const ChoseCity = (props: Props, ref) => {
const DropDownItemRef = useRef<any>()
const close = () => {
DropDownItemRef.current.closePopup()
@ -35,17 +34,6 @@ export default memo(forwardRef((props: Props, ref) => {
// 获取地址
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[]>([])
@ -55,14 +43,23 @@ export default memo(forwardRef((props: Props, ref) => {
const [list, setlist] = 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 [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '选择省', showBorder: true }, { id: 2, name: '选择市', showBorder: false }])
const handChose = (item) => {
TarBarList.map((it) => {
TarBarList.forEach((it) => {
if (it.id === item.id) {
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) => {
list.map((it) => {
@ -98,25 +112,6 @@ export default memo(forwardRef((props: Props, ref) => {
})
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) => {
cityList.map((it) => {
@ -197,9 +192,9 @@ export default memo(forwardRef((props: Props, ref) => {
{
currentValue == 1 && <ScrollView scrollY className={styles.scrollView}>
{
list.map((item) => {
list.map((item, key) => {
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>
<IconFont name="icon-chakanquanbukehu" size={50} color="#d8d8d8"></IconFont>
</View>
@ -211,9 +206,9 @@ export default memo(forwardRef((props: Props, ref) => {
{
currentValue == 2 && <ScrollView scrollY className={styles.scrollView}>
{
cityList.map((item) => {
cityList.map((item, key) => {
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>
{/* <IconFont name={'icon-chakanquanbukehu'} size={50} color={'#d8d8d8'}></IconFont> */}
</View>
@ -225,4 +220,5 @@ export default memo(forwardRef((props: Props, ref) => {
</View>
</DropDownItem>
)
}))
}
export default memo(forwardRef(ChoseCity))

View File

@ -11,8 +11,7 @@ interface Props {
obj: any
sortId: number | string
}
export default memo((props: Props) => {
const ItemList = (props: Props) => {
const handPhone = (e) => {
e.stopPropagation()
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.sale_user_name || '暂无'}</View>
{
props.obj?.label_list?.map((item) => {
props.obj?.label_list?.map((item, key) => {
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 >
)
})
}
export default memo(ItemList)

View File

@ -18,8 +18,7 @@ interface ListType {
id: string
checked: boolean
}
export default memo(forwardRef((props: Props, ref) => {
const Sort = (props: Props, ref) => {
const DropDownItemRef = useRef<any>()
useImperativeHandle(
ref,
@ -98,11 +97,12 @@ export default memo(forwardRef((props: Props, ref) => {
{
list.map((item, index) => {
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>
</DropDownItem>
)
}))
}
export default memo(forwardRef(Sort))

View File

@ -7,7 +7,7 @@ import { alert } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import { EnumPurchaserType } from '@/api/order'
import DropDownItem from '@/components/dropDown-item'
import { mppurchaserlist } from '@/api/customer'
import { MpPurchaserList } from '@/api/customer'
interface Props {
handType: (any) => void
@ -15,8 +15,7 @@ interface Props {
value?: any
onCloseOverlay?: () => void
}
export default memo(forwardRef((props: Props, ref) => {
const Tag = (props: Props, ref) => {
const DropDownItemRef = useRef<any>()
useImperativeHandle(
ref,
@ -49,11 +48,9 @@ export default memo(forwardRef((props: Props, ref) => {
},
])
useEffect(() => {
getList()
}, [])
const { fetchData: fetchPurchaserType } = EnumPurchaserType()
const { fetchData } = mppurchaserlist()
const { fetchData } = MpPurchaserList()
const [taglist, settaglist] = useState<any[]>([])
const getList = async() => {
const res = await fetchData()
const purchaserType = await fetchPurchaserType()
@ -62,8 +59,9 @@ export default memo(forwardRef((props: Props, ref) => {
setlist([...purchaserType.data.list])
}
}
const [taglist, settaglist] = useState<any[]>([])
useEffect(() => {
getList()
}, [])
const handItem = (it) => {
list.map((item) => {
@ -98,7 +96,7 @@ export default memo(forwardRef((props: Props, ref) => {
{
list.map((item, index) => {
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) => {
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>
</DropDownItem>
)
}))
}
export default memo(forwardRef(Tag))

View File

@ -8,7 +8,7 @@ interface Props {
handChose?: (any) => void
handReset?: () => void
}
export default memo((props: Props) => {
const Tabs = (props: Props) => {
const { list = [], handChose } = props
return (
@ -34,4 +34,5 @@ export default memo((props: Props) => {
<View className={styles.resetBox} onClick={() => props?.handReset?.()}></View>
</View>
)
})
}
export default memo(Tabs)

View File

@ -16,7 +16,7 @@ import InfiniteScroll from '@/components/infiniteScroll'
import { ClientListApi } from '@/api/order'
import SelectGroup from '@/components/SelectGroup'
export default () => {
const CustomerManagement = () => {
const [searchField, setSearchField] = useState<
{
page: number
@ -41,6 +41,9 @@ export default () => {
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
const { fetchData: listFetchData, state: orderState } = ClientListApi()
// 列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getOrderList = async() => {
const res = await listFetchData({
...getFilterData(searchField),
@ -54,13 +57,6 @@ export default () => {
getOrderList()
}, [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(() => {
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 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(() => {
if (orderData.list.length < orderData.total) {
pageNum.current.page++
@ -76,8 +78,6 @@ export default () => {
}
}, [orderData])
// 列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getRefresherRefresh = async() => {
pageNum.current.size = 1
setRefresherTriggeredStatus(true)
@ -137,7 +137,7 @@ export default () => {
<View className={styles.mainBox}>
<View className={styles.topBox}>
<View className={styles.search_input}>
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
<Search placeholder="搜索客户名称、电话、业务员" showBtn={false} changeOnSearch={getSearchData} />
</View>
<View className={styles.menuBox} >
<SelectGroup>
@ -158,7 +158,7 @@ export default () => {
>
{orderData?.list?.map((item, index) => {
return (
<ItemLiist sortId={sortRefRef.current} obj={item}></ItemLiist>
<ItemLiist key={index} sortId={sortRefRef.current} obj={item}></ItemLiist>
)
})}
</InfiniteScroll>
@ -169,3 +169,5 @@ export default () => {
</View >
)
}
export default CustomerManagement

View File

@ -8,7 +8,7 @@ import { ClientListApi } from '@/api/order'
import InfiniteScroll from '@/components/infiniteScroll'
import { dataLoadingStatus, getFilterData } from '@/common/util'
export default () => {
const CustomerPage = () => {
const [search, setSearch] = useState({
name_phone_or_sale_user: null,
page: 1,
@ -26,7 +26,8 @@ export default () => {
clientId: null,
clientName: '',
})
// 上拉加载数据
const pageNum = useRef({ size: search.size, page: search.page })
// 输入了搜索关键字
const getSearchData = useCallback((eq) => {
pageNum.current.page = 1
@ -36,15 +37,6 @@ export default () => {
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(() => {
if (clentList.list.length < clentList.total) {
pageNum.current.page++
@ -77,7 +69,12 @@ export default () => {
setClientlist(e => ({ ...e, list: res.data?.list, total: res.data?.total }))
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) => {
clentList.list.map((it) => {
@ -118,7 +115,7 @@ export default () => {
<View className={styles.cussBox}>
<View className={styles.searchBox}>
<View className={styles.two}>
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} debounceTime={300} />
<Search placeholder="请输入客户名称或手机号码" showBtn={false} changeOnSearch={getSearchData} />
</View>
</View>
@ -147,3 +144,5 @@ export default () => {
</View>
)
}
export default CustomerPage

View File

@ -6,7 +6,7 @@ interface PropsType {
onChangeStatus?: (data: { id: number; name: string }) => void
}
const DeliveryStatusList = memo<PropsType>((props) => {
const DeliveryStatusList = (props: PropsType) => {
const { onChangeStatus } = props
const { fetchData } = EnumSaleorderStatus()
const [statusList, setStatusList] = useState([
@ -38,5 +38,5 @@ const DeliveryStatusList = memo<PropsType>((props) => {
[onChangeStatus],
)
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