From 7e12050a94a246c670190da14dda7ff215e418bd Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Sat, 23 Jul 2022 21:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=B5=8B=E8=AF=95=E7=89=88v7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 2 +- src/common/enum.ts | 4 +- src/components/LabAndImg/index.tsx | 2 + src/components/afterOrderBtns/index.tsx | 14 ++-- src/components/checkbox/index.tsx | 9 ++- src/components/filter/index.module.scss | 2 + src/components/shopCart/index.tsx | 20 +++++- .../details/components/orderCount/index.tsx | 52 +++++--------- src/pages/index/index.module.scss | 3 +- src/pages/order/comfirm.tsx | 4 +- .../components/addressInfoDetail/index.tsx | 69 +++++++++++++------ src/pages/order/components/payment/index.tsx | 12 ++-- src/pages/order/components/scanPay/index.tsx | 2 +- .../order/components/scanPayCheck/index.tsx | 2 +- src/pages/order/index.tsx | 4 +- .../searchList/hightSearchList.module.scss | 8 +-- src/pages/searchList/hightSearchList.tsx | 3 +- src/pages/searchList/search.module.scss | 5 +- src/pages/searchList/search.tsx | 2 +- src/pages/searchList/searchList.module.scss | 10 ++- 20 files changed, 129 insertions(+), 100 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 4512c59..9d25ea9 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -11,7 +11,7 @@ export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.7:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN diff --git a/src/common/enum.ts b/src/common/enum.ts index d52de88..88b9f5a 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -67,7 +67,7 @@ export const REFUND_STATUS = { //申请单退款状态枚举 export const REFUND_STATUS_ORDER = { - ReturnApplyOrderTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, // 预收退款 - ReturnApplyOrderTypeReturnForRefund: {value:2, label:'退货退款'}, // 退货退款 + ReturnApplyOrderTypeAdvanceReceiptRefund: {value:2, label:'预收退款'}, // 预收退款 + ReturnApplyOrderTypeReturnForRefund: {value:1, label:'退货退款'}, // 退货退款 ReturnApplyOrderTypeSalesRefund: {value:3, label:'销售退款'}, // 销售退款 } \ No newline at end of file diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx index 87eb683..ddb93a7 100644 --- a/src/components/LabAndImg/index.tsx +++ b/src/components/LabAndImg/index.tsx @@ -43,8 +43,10 @@ export default memo(({value, onClick, showStatus = false}:Param) => { setLabAndImgShow(false) }, []) const onShowLabAndImg = () => { + onClick?.(value) if(!showStatus) return false setLabAndImgShow(true) + } return ( diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index d85567f..edcc862 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -63,13 +63,13 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { return orderInfo?.is_quality_check } }, - { - id: 5, - label: '上传物流', - validatarFunc: (orderInfo) => { - return orderInfo?.stage == ReturnStageWaitCheck.value - } - }, + // { + // id: 5, + // label: '上传物流', + // validatarFunc: (orderInfo) => { + // return orderInfo?.stage == ReturnStageWaitCheck.value + // } + // }, { id: 6, label: '取消退款', diff --git a/src/components/checkbox/index.tsx b/src/components/checkbox/index.tsx index e79a1a4..7658fe0 100644 --- a/src/components/checkbox/index.tsx +++ b/src/components/checkbox/index.tsx @@ -1,6 +1,6 @@ import { View } from "@tarojs/components" import classnames from "classnames"; -import { useEffect, useState } from "react"; +import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import styles from "./index.module.scss" type params = { @@ -9,7 +9,7 @@ type params = { status?: false|true //是否选中 disabled?: false|true //是否禁用 } -export default ({onSelect, onClose, status = false, disabled = false}: params) => { +export default forwardRef(({onSelect, onClose, status = false, disabled = false}: params, ref) => { const [selected, SetSelected] = useState(false) const onSelectEven = () => { if(disabled) return false @@ -21,6 +21,9 @@ export default ({onSelect, onClose, status = false, disabled = false}: params) = } SetSelected(res) } + useImperativeHandle(ref, () => ({ + onSelectEven + })) useEffect(() => { SetSelected(status) }, [status]) @@ -33,4 +36,4 @@ export default ({onSelect, onClose, status = false, disabled = false}: params) = ) -} \ No newline at end of file +}) \ No newline at end of file diff --git a/src/components/filter/index.module.scss b/src/components/filter/index.module.scss index 48538c0..1ddd8b2 100644 --- a/src/components/filter/index.module.scss +++ b/src/components/filter/index.module.scss @@ -45,6 +45,7 @@ color: $color_main; background: #ecf5ff; border: 2px solid #007aff; + box-sizing: border-box; width: 161.75px; height: 65.2px; } @@ -102,6 +103,7 @@ width: 552px; height: 82px; border: 2px solid #cde5ff; + box-sizing: border-box; font-size: $font_size_big; border-radius: 40px; margin-bottom: 20px; diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index e5c1f0f..daa3065 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -273,6 +273,17 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { //绑定业务员和电话号码 const [showBindSalesman, setShowBindSalesman] = useState(false) + //显示图片弹窗 + const [showLabImage, setShowLabImage] = useState(false) + const [labImageValue, setLabImageValue] = useState() + const getLabAndImg = useCallback((val) => { + setShowLabImage(() => true) + setLabImageValue(val) + }, []) + const closeLabImgShow = useCallback(() => { + setShowLabImage(() => false) + }, []) + return ( closePopup()} > @@ -300,7 +311,7 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { selectCallBack(item)} onClose={() => colseCallBack(item)}/> - + @@ -353,7 +364,12 @@ export default ({show = false, onClose, intoStatus='shop'}: param) => { - setShowBindSalesman(false)}/> + + setShowBindSalesman(false)}/> + + + + ) } diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index dd26c17..cc110ee 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -198,14 +198,25 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) return ¥{price} /{selectList[selectIndex].eunit} }, [selectIndex]) + //显示图片弹窗 + const [showLabImage, setShowLabImage] = useState(false) + const [labImageValue, setLabImageValue] = useState() + const getLabAndImg = useCallback((val) => { + setShowLabImage(() => true) + setLabImageValue(val) + }, []) + const closeLabImgShow = useCallback(() => { + setShowLabImage(() => false) + }, []) + //虚拟滚动 - const Rows = useCallback(({id, index, style, data}:any) => { + const Rows = memo(({id, index, style, data}:any) => { let item = data[index] return ( <> {item&& - + {formatHashTag(item.code, item.name)} @@ -233,7 +244,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) } ) - }, [list]) + }) return ( @@ -262,38 +273,6 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) {(list.length <= 0 && colorState.loading)&&} {(list.length > 0&& !colorState.loading)&& - // - // - // {list.map(item => { - // return - // - // - // - // - // {formatHashTag(item.code, item.name)} - // - // {formatPrice(item)} - // - // - // - // {!item.show&& onAdd(item)}>添加 - // || - // getInputValue(e, item)} - // defaultNum={item.count} - // step={selectList[selectIndex].step} - // digits={selectList[selectIndex].digits} - // onClickBtn={(e) => getInputValue(e, item)} - // unit={selectList[selectIndex].unit} - // minNum={selectList[selectIndex].minNum} - // maxNum={selectList[selectIndex].maxNum} - // /> - // } - // - // - // })} - // - // } + + + ) }) diff --git a/src/pages/index/index.module.scss b/src/pages/index/index.module.scss index b1732f8..7a5fd68 100644 --- a/src/pages/index/index.module.scss +++ b/src/pages/index/index.module.scss @@ -21,7 +21,8 @@ line-height: 44px; } .search_input{ - width: 300px; + flex:1; + margin-left: 20px; } } .products{ diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 018b15e..d8c0590 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -91,8 +91,8 @@ import { throttle } from "@/common/util"; name: address?.name, phone: address?.phone, shipment_mode: address?.shipment_mode, - take_goods_address: address?.take_goods_address, - take_goods_phone: address?.take_goods_phone, + take_goods_address: preViewOrder?.take_goods_address, + take_goods_phone: preViewOrder?.take_goods_phone, } }, [preViewOrder]) diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index e6573af..e1e936f 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -1,23 +1,18 @@ +import { GetAddressListApi } from "@/api/addressList"; +import { addressListApi } from "@/api/addressManager"; import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order"; -import { alert } from "@/common/common"; +import { alert, goLink } from "@/common/common"; import { ORDER_STATUS } from "@/common/enum"; -import { debounce } from "@/common/util"; +import { debounce, throttle } from "@/common/util"; import AddressList from "@/components/AddressList"; import Popup from "@/components/popup"; import { Text, View } from "@tarojs/components" import classnames from "classnames"; import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react"; +import Taro from "@tarojs/taro"; import styles from './index.module.scss' -export type AddressInfoParam = { - province_name: string, - city_name: string, - district_name: string, - address_detail: string, - id?: number, - name: string, - phone: string, -} + type Param = { onSelect?: (val:any) => void, //选择地址 disabled?: false|true, //true禁用后只用于展示 @@ -61,7 +56,6 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat } }, [orderInfo]) - //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) const changeShow = () => { @@ -77,10 +71,37 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat //收货方法,1:自提,2物流 const [receivingStatus, setReceivingStatus] = useState(2) const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() - const onReceivingStatus = (value, e) => { + const onReceivingStatus = async (value, e) => { e.stopPropagation() if(limitEdit()) changeReceivingStatus(value) + } + + //当没有地址时获取地址列表中的第一个数据 + const {fetchData: addressListFetchData} = addressListApi() + const getAddressListOne = async () => { + if(orderInfo?.address_detail) return true + let res = await addressListFetchData() + if( res.data.list && res.data.list?.length > 0 ) { + let info = res.data.list[0] + await addressFetchData({id: orderInfo?.id, address_id: info.id}) + setAddressInfo((e) => ({...e, ...info, target_user_name: info.name, target_user_phone: info.phone})) + return true + } else { + Taro.showModal({ + content: '您还没有地址,请前去新增地址', + success: function (res) { + if (res.confirm) { + goLink('/pages/addressManager/index') + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + return false + } + + } const changeReceivingStatus = debounce(async (value) => { @@ -90,16 +111,20 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat setReceivingStatus(value) return false } + if(value == 2) { + let res = await getAddressListOne() + if(!res) return false + } alert.loading('正在修改') const res = await shipmentModeFetchData({id: orderInfo.id, shipment_mode:value}) if(res.success) { alert.success('收货方式修改成功') onChangeShipmentMode?.(value) - setReceivingStatus(value) + setReceivingStatus(() => value) } else { alert.none(res.msg) } - }, 10) + }, 300) //修改地址 const [addressId, setAddressId] = useState(0) @@ -109,7 +134,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat if(status == 1) { setShowAddressList(() => false) setAddressId(value.id) - setAddressInfo(() => value) + setAddressInfo((e) => ({...e, ...value, target_user_name: value.name, target_user_phone: value.phone})) onSelect?.(value) return false } @@ -120,13 +145,13 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat onSelect?.(value) setShowAddressList(() => false) setAddressId(value.id) - setAddressInfo(() => value) + setAddressInfo((e) => ({...e, ...value, target_user_name: value.name, target_user_phone: value.phone})) } else { alert.none(res.msg) } } - //根据订单状态判断是否可用修改 + //根据订单状态判断是否可修改 const limitEdit = () => { let res = [ SaleorderstatusWaitingPrePayment.value, @@ -149,11 +174,13 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat //地址格式 const formatAddress = useMemo(() => { if(receivingStatus == 2) { + console.log('take_goods_addressbb::', addressInfo) return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:'' } else { + console.log('take_goods_address::', addressInfo) return addressInfo?.take_goods_address } - }, [addressInfo, receivingStatus]) + }, [receivingStatus, addressInfo]) return ( @@ -165,8 +192,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat {(receivingStatus == 2 && !logisticsShow)&&} - {receivingStatus == 1?'管理员':addressInfo?.name} - {receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.phone} + {receivingStatus == 1?'管理员':addressInfo?.target_user_name} + {receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.target_user_phone} {!logisticsShow&& diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index c29e09f..f5ff106 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -1,5 +1,5 @@ import { Text, View } from "@tarojs/components"; -import { memo, useCallback, useEffect, useMemo, useState } from "react"; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import AmountShow from "../amountShow"; import classnames from "classnames"; import styles from './index.module.scss' @@ -86,9 +86,13 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) }, [show, orderInfo]) //预存款选择 + const advanceRef = useRef(null) const advanceSelectData = useCallback((val) => { setSubmitData((e) => ({...e, payment_method:val})) }, []) + const changeSelect = () => { + advanceRef.current.onSelectEven() + } //账期选择 const periodSelectData = (val) => { @@ -155,10 +159,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) ) }, [payInfo]) - //选择改变 - const changeSelect = () => { - } - //在线支付所需数据 const onlinePayData = useMemo(() => { return {...orderInfo, offline_remittance_information: payInfo?.offline_remittance_information} @@ -199,7 +199,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) {advance_payment} - advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/> + advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/> {show_account_payment&& diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx index cf4ad29..3730bea 100644 --- a/src/pages/order/components/scanPay/index.tsx +++ b/src/pages/order/components/scanPay/index.tsx @@ -70,7 +70,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { client: orderInfo.purchaser_name, //客户名称 phone: userPhone(orderInfo), //收货手机号码 order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度 - order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 + order_total_price: formatPriceDiv(orderInfo.total_should_collect_money).toString(), //订单价格 order_total_num: (orderInfo.total_number) + '', qrcode:"", //跳转链接 order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量 diff --git a/src/pages/order/components/scanPayCheck/index.tsx b/src/pages/order/components/scanPayCheck/index.tsx index 4011d3c..77a9fc2 100644 --- a/src/pages/order/components/scanPayCheck/index.tsx +++ b/src/pages/order/components/scanPayCheck/index.tsx @@ -74,7 +74,7 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { client: orderInfo.purchaser_name, //客户名称 phone: userPhone(orderInfo), //收货手机号码 order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度 - order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 + order_total_price: formatPriceDiv(orderInfo.total_should_collect_money).toString(), //订单价格 order_total_num: (orderInfo.total_number).toString(), qrcode:"", //跳转链接 order_total_weight: formatWeightDiv(orderInfo.total_weight||orderInfo.total_estimate_weight).toString(), //订单布匹重量 diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 3f8c6a8..f36e9b4 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -106,8 +106,8 @@ import styles from './index.module.scss' city_name: orderDetail?.city_name, district_name: orderDetail?.district_name, address_detail: orderDetail?.address_detail, - name: orderDetail?.target_user_name, - phone: orderDetail?.target_user_phone, + target_user_name: orderDetail?.target_user_name, + target_user_phone: orderDetail?.target_user_phone, shipment_mode: orderDetail?.shipment_mode, id: orderDetail?.id, sale_mode: orderDetail?.sale_mode, diff --git a/src/pages/searchList/hightSearchList.module.scss b/src/pages/searchList/hightSearchList.module.scss index 3f47d29..d828503 100644 --- a/src/pages/searchList/hightSearchList.module.scss +++ b/src/pages/searchList/hightSearchList.module.scss @@ -135,9 +135,7 @@ } } .list{ - flex:1; - display: flex; - flex-direction: column; + height: calc(100vh - 440px); .list_num { font-size: $font_size_min; color:$color_font_two; @@ -148,8 +146,7 @@ box-shadow: 0px 5px 5px #ccc; } .scroll{ - flex:1; - height:0; + height: 100%; padding-top: 3px; } .product_list{ @@ -162,6 +159,7 @@ background-color: #fff; border-radius: 20px; margin-bottom: 20px; + box-shadow: 0px 3px 10px 0px rgba(0,0,0,0.1) ; .product_img{ width: 100%; height: 224px; diff --git a/src/pages/searchList/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx index 97e638f..0791dbb 100644 --- a/src/pages/searchList/hightSearchList.tsx +++ b/src/pages/searchList/hightSearchList.tsx @@ -197,9 +197,8 @@ export default () => { 搜索结果 ({materialList.total}条记录) - getScrolltolower()} + selfonScrollToLower={getScrolltolower} selfOnScroll={(e) => onscroll(e)} statusMore={statusMore} > diff --git a/src/pages/searchList/search.module.scss b/src/pages/searchList/search.module.scss index f31b47a..b539403 100644 --- a/src/pages/searchList/search.module.scss +++ b/src/pages/searchList/search.module.scss @@ -47,7 +47,7 @@ .history_header { width:100%; display: flex; - justify-content: space-between; + // justify-content: space-between; font-size: $font_size_medium; .history_header_title { font-size: $font_size; @@ -55,8 +55,9 @@ font-weight: 700; } .miconfont{ - font-size: 30px; + font-size: 40px; color: $color_font_three; + margin-left: 20px; } } .list{ diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index dffa3ce..c255911 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -80,7 +80,7 @@ export default () => { {searchData?.historyField.length > 0 && 历史搜索 - + {/* */} {searchData?.historyField?.map((item, index) => searchEvent(item.search_key, false)}>{item.search_key})} diff --git a/src/pages/searchList/searchList.module.scss b/src/pages/searchList/searchList.module.scss index 68f2e4b..b590338 100644 --- a/src/pages/searchList/searchList.module.scss +++ b/src/pages/searchList/searchList.module.scss @@ -2,7 +2,7 @@ display: flex; flex-direction: column; height: 100vh; - background-color: $color_bg_one; + background-color: #F8F8F8; .search{ padding: 20px; } @@ -118,9 +118,7 @@ } } .list{ - flex:1; - display: flex; - flex-direction: column; + height: calc(100vh - 330px); .list_num { font-size: $font_size_min; color:$color_font_two; @@ -131,8 +129,7 @@ box-shadow: 0px 5px 5px #ccc; } .scroll{ - flex:1; - height:0; + height: 100%; padding-top: 3px; } .product_list{ @@ -145,6 +142,7 @@ background-color: #fff; border-radius: 20px; margin-bottom: 20px; + box-shadow: 0px 3px 10px 0px rgba(0,0,0,0.1) ; .product_img{ width: 100%; height: 224px;