From ca4c8a6b0b41af70c88a887af46f34b90c8e0cbf Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 8 Jun 2022 19:12:13 +0800 Subject: [PATCH 1/4] 1 --- src/components/popup/index.tsx | 2 +- .../addressInfoDetail/index.module.scss | 7 ++++++- .../components/addressInfoDetail/index.tsx | 6 ++++-- .../applyAfterSales/index.module.scss | 5 +++-- .../components/applyAfterSales/index.tsx | 21 +++++++++++++++---- src/pages/order/index.tsx | 2 +- src/pages/searchList/searchList.tsx | 1 - 7 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/components/popup/index.tsx b/src/components/popup/index.tsx index 227f12e..75030cf 100644 --- a/src/components/popup/index.tsx +++ b/src/components/popup/index.tsx @@ -62,7 +62,7 @@ export default memo(( } - {children} + {show&&children} diff --git a/src/pages/order/components/addressInfoDetail/index.module.scss b/src/pages/order/components/addressInfoDetail/index.module.scss index 68e6171..2d6c306 100644 --- a/src/pages/order/components/addressInfoDetail/index.module.scss +++ b/src/pages/order/components/addressInfoDetail/index.module.scss @@ -101,12 +101,17 @@ } .order_address_list { - height: 900px; + height:80vh; .order_address_title{ font-size: $font_size; font-weight: 700; width: 100%; text-align: center; padding: 20px 0 30px 0; + height: 100px; + } + .addressList_con{ + padding-bottom: 20px; + height: calc(100% - 160px); } } \ No newline at end of file diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index d58b12b..d2b4251 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -114,9 +114,11 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = setShowAddressList(false)}> 请选择收货地址 - + + + + - ) diff --git a/src/pages/order/components/applyAfterSales/index.module.scss b/src/pages/order/components/applyAfterSales/index.module.scss index 22a31e0..3cbb03b 100644 --- a/src/pages/order/components/applyAfterSales/index.module.scss +++ b/src/pages/order/components/applyAfterSales/index.module.scss @@ -24,7 +24,7 @@ .apply_after_sales_con{ height: 80vh; .scroll{ - height: calc(100% - 80px); + height: calc(100% - 170px); } .returnSaleInput{ margin: 0 20px; @@ -85,8 +85,9 @@ font-size: $font_size; font-weight: 700; } - .uploadImg{ + .textarea{ position: relative; + height: 165.4px; .descDataNum{ position: absolute; right: 10px; diff --git a/src/pages/order/components/applyAfterSales/index.tsx b/src/pages/order/components/applyAfterSales/index.tsx index 735e476..fb5c64a 100644 --- a/src/pages/order/components/applyAfterSales/index.tsx +++ b/src/pages/order/components/applyAfterSales/index.tsx @@ -1,5 +1,5 @@ import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components"; -import { memo, useState } from "react"; +import { memo, useCallback, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' import Popup from "@/components/popup"; @@ -8,6 +8,19 @@ import Counter from "@/components/counter"; export default memo(() => { const [showDesc, setShowDesc] = useState(true) + const [descData, setDescData] = useState({ + number: 0, + value: '', + count: 200 + }) + const getDesc = useCallback((e) => { + let value = e.detail.value + let res = value + if(value.length > descData.count) { + res = value.slice(0, descData.count) + } + setDescData({...descData, number:res.length, value: res}) + },[]) return ( setShowDesc(false)} > @@ -94,9 +107,9 @@ export default memo(() => { 其他说明 - - - 0/100 + + + {descData.number +'/'+ descData.count} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 3c0304f..060dc54 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -226,7 +226,7 @@ import styles from './index.module.scss' getRemark(e)}/> - {/* */} + ) diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 7acb9fe..532c671 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -8,7 +8,6 @@ import SelectData, {ListProps} from "./components/selectData"; import { goLink } from "@/common/common"; import styles from './searchList.module.scss' import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import useManualPullDownRefresh from "@/use/useManualPullDownRefresh"; import {GetProductListApi} from "@/api/material" import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import { formatHashTag, formatImgUrl } from "@/common/fotmat"; From a52c73a95d85a1f415086485d02854b94e5faddb Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 8 Jun 2022 20:30:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8Ev2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 +- .../applyAfterSales/index.module.scss | 50 +++++++++++++++++++ .../components/applyAfterSales/index.tsx | 40 ++++++++++++++- 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 76db424..a9d44b0 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -6,11 +6,11 @@ // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 -export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 +// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 +export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN diff --git a/src/pages/order/components/applyAfterSales/index.module.scss b/src/pages/order/components/applyAfterSales/index.module.scss index 3cbb03b..978b749 100644 --- a/src/pages/order/components/applyAfterSales/index.module.scss +++ b/src/pages/order/components/applyAfterSales/index.module.scss @@ -34,9 +34,11 @@ display: flex; align-items: center; padding-bottom: 20px; + flex-wrap: wrap; .title{ font-size: $font_size; font-weight: 700; + width: 119px; } .select{ flex:1; @@ -67,6 +69,8 @@ justify-content: center; align-items: center; position: relative; + margin-bottom: 20px; + position: relative; .miconfont{ font-size: 50px; } @@ -74,8 +78,35 @@ font-size: 26px; color: $color_font_three; } + } + .ImgItem{ + width: 202px; + height: 150px; + background: #f0f0f0; + margin-left: 20px; + margin-bottom: 20px; + position: relative; + border-radius: 10px; + image{ + width: 100%; + height: 100%; + border-radius: 10px; + } + .miconfont_close{ + width: 30px; + height: 30px; + background-color: #ccc; + border-radius: 50%; + position: absolute; + right: -10px; + top: -10px; + text-align: center; + line-height: 30px; + color: #fff; + } + } } } .other_desc{ @@ -173,5 +204,24 @@ } } + + .reason_return_con{ + .reason_title{ + padding: 10px 20px 0 20px; + height: 60px; + border-bottom: 1PX solid #F3F3F3; + box-sizing: border-box; + Text{ + font-size: 26px; + border-bottom: 3px solid #000; + padding: 10px; + font-weight: 400; + } + + } + .reason_scroll{ + + } + } } diff --git a/src/pages/order/components/applyAfterSales/index.tsx b/src/pages/order/components/applyAfterSales/index.tsx index fb5c64a..125733f 100644 --- a/src/pages/order/components/applyAfterSales/index.tsx +++ b/src/pages/order/components/applyAfterSales/index.tsx @@ -98,6 +98,7 @@ export default memo(() => { 拍照上传 + 上传照片 @@ -116,6 +117,43 @@ export default memo(() => { + setShowDesc(false)} > + + 货物状况 + + + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + + + + ) -}) \ No newline at end of file +}) + +//图片列表 +const PictureItem = memo(() => { + return ( + <> + + + + + + ) +}) + +//其他说明 From 30efe70995dd92c1110729953ed79766ad2fcbee Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 9 Jun 2022 17:07:00 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=94=AE=E5=90=8E=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order.ts | 12 +- src/app.config.ts | 6 + src/common/uploadImage.js | 18 --- src/components/orderBtns/index.tsx | 38 +++++- src/components/shopCart/index.tsx | 2 - .../components/otherReason/index.module.scss | 36 +++++ .../components/otherReason/index.tsx | 37 +++++ .../components/reasonPopup/index.module.scss | 27 ++++ .../components/reasonPopup/index.tsx | 44 ++++++ src/pages/applyAfterSales/index.config.ts | 4 + .../applyAfterSales/index.module.scss | 84 ++++++------ .../components => }/applyAfterSales/index.tsx | 128 +++++++++--------- src/pages/order/index.tsx | 2 - .../orderList/components/order/index.tsx | 1 - src/reducers/userInfo.ts | 1 + src/use/useLogin.ts | 12 +- 16 files changed, 302 insertions(+), 150 deletions(-) create mode 100644 src/pages/applyAfterSales/components/otherReason/index.module.scss create mode 100644 src/pages/applyAfterSales/components/otherReason/index.tsx create mode 100644 src/pages/applyAfterSales/components/reasonPopup/index.module.scss create mode 100644 src/pages/applyAfterSales/components/reasonPopup/index.tsx create mode 100644 src/pages/applyAfterSales/index.config.ts rename src/pages/{order/components => }/applyAfterSales/index.module.scss (78%) rename src/pages/{order/components => }/applyAfterSales/index.tsx (55%) diff --git a/src/api/order.ts b/src/api/order.ts index f723f47..26c175c 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -84,9 +84,19 @@ export const SaleOrderApi = () => { /** * 作废销售单 */ - export const CancelOrderApi = () => { +export const CancelOrderApi = () => { return useRequest({ url: `/v1/mall/saleOrder/cancel`, method: "put", }) +} + +/** + * 确认收货 + */ +export const ReceiveOrderApi = () => { + return useRequest({ + url: `/v1/mall/saleOrder/receive`, + method: "put", + }) } \ No newline at end of file diff --git a/src/app.config.ts b/src/app.config.ts index 61bd39e..8130e2c 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -158,6 +158,12 @@ export default { pages: [ "index", ] + }, + { + root: "pages/applyAfterSales", + pages: [ + "index", + ] } ] } diff --git a/src/common/uploadImage.js b/src/common/uploadImage.js index 6a6cf8a..ae7724b 100644 --- a/src/common/uploadImage.js +++ b/src/common/uploadImage.js @@ -129,22 +129,4 @@ const uploadCDNImg = (file, secene, type) => { }) } -const taroChooseImg = () => { - Taro.chooseImage({ - count: 1, - sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 - sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 - success: (res) => { - console.log('res:', res) - Taro.chooseMessageFile({ - count: 1, - - }) - }, - fail: (err) => { - console.log('图片选择失败:', err) - } - }) -} - export default uploadCDNImg \ No newline at end of file diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index f098520..6cb1292 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -1,7 +1,7 @@ -import { CancelOrderApi } from "@/api/order" +import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert } from "@/common/common" import { ORDER_STATUS } from "@/common/enum" -import { View } from "@tarojs/components" +import { ScrollView, View } from "@tarojs/components" import Taro from "@tarojs/taro" import { useCallback, useRef, memo } from "react" import styles from './index.module.scss' @@ -24,7 +24,6 @@ export default memo(({orderInfo, onClick}:Param) => { SaleOrderStatusArranged, SaleOrderStatusWaitingDelivery, SaleOrderStatusComplete, - SaleOrderStatusCancel, SaleOrderStatusRefund, SaleOrderStatusWaitingPayment, SaleOrderStatusWaitingReceipt, @@ -90,6 +89,7 @@ export default memo(({orderInfo, onClick}:Param) => { const submitBtns = (val) => { (val == 1)&&cancelOrder(); //取消订单按钮 (val == 2)&&onClick?.(val); //去付款按钮 + (val == 6)&&receiveOrder(); //确认收货 } //取消订单 @@ -113,11 +113,37 @@ export default memo(({orderInfo, onClick}:Param) => { }) } + //确认订单 + const {fetchData: receiveOrderFetchData} = ReceiveOrderApi() + const receiveOrder = async () => { + console.log('123456') + Taro.showModal({ + title: '确定收货?', + success: async function (res) { + if (res.confirm) { + let res = await receiveOrderFetchData({sale_order_id: orderInfo?.orderId}) + if(res.success){ + onClick?.(6) + alert.success('收货成功') + } else { + alert.error('收货失败') + } + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + + } + return ( - {orderBtnsList.current.map((item) => - orderBtnsShow(item)&& submitBtns(item.id)}>{item.label} - )} + + {orderBtnsList.current.map((item) => + orderBtnsShow(item)&& submitBtns(item.id)}>{item.label} + )} + + ) }) \ No newline at end of file diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 8eb3d75..2470ef1 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -117,8 +117,6 @@ export default ({show = false, onClose}: param) => { if(item.select) select_count++ } }) - console.log('list_count::',list_count) - console.log('select_count::',select_count) setSelectStatus(select_count == list_count) } diff --git a/src/pages/applyAfterSales/components/otherReason/index.module.scss b/src/pages/applyAfterSales/components/otherReason/index.module.scss new file mode 100644 index 0000000..e2d1b1b --- /dev/null +++ b/src/pages/applyAfterSales/components/otherReason/index.module.scss @@ -0,0 +1,36 @@ +.other_desc{ + padding: 0 20px; + box-sizing: border-box; + .title{ + font-size: $font_size; + font-weight: 700; + } + .textarea{ + position: relative; + height: 165.4px; + .descDataNum{ + position: absolute; + right: 10px; + bottom: 10px; + font-size: 22px; + color: #ABABAB; + } + } + .textarea_con, .textarea_con_pretend{ + background-color: #f3f3f3; + border: 2px solid #e6e6e6; + border-radius: 10px; + width: 100%; + font-size: 25px; + height: 165.4px; + padding: 20px 20px 30px 20px; + box-sizing: border-box; + margin-top: 20px; + } + .textarea_con_pretend{ + color: $color_font_two; + } + .textarea_con_pretend_ed{ + color: #000; + } +} \ No newline at end of file diff --git a/src/pages/applyAfterSales/components/otherReason/index.tsx b/src/pages/applyAfterSales/components/otherReason/index.tsx new file mode 100644 index 0000000..fc580c9 --- /dev/null +++ b/src/pages/applyAfterSales/components/otherReason/index.tsx @@ -0,0 +1,37 @@ +import {Textarea, View } from "@tarojs/components"; +import { memo, useMemo, useState } from "react"; +import styles from './index.module.scss' +import classnames from "classnames"; + +//其他说明 +export default memo(() => { + const [descData, setDescData] = useState({ + number: 0, + value: '', + count: 200, + show: false + }) + const getDesc = (e) => { + let value = e.detail.value + let res = value + if(value.length > descData.count) { + res = value.slice(0, descData.count) + } + setDescData({...descData, number:res.length, value: res}) + } + + const toggleShowRealTextarea = (show) => { + setDescData({...descData, show:show}) + } + return ( + + 其他说明 + + {descData.show&&|| + toggleShowRealTextarea(true)}>{descData.value||'一般情况下选填,当退货说明=“其它问题”时,必填'} + } + {descData.number +'/'+ descData.count} + + + ) +}) diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.module.scss b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss new file mode 100644 index 0000000..eba26cd --- /dev/null +++ b/src/pages/applyAfterSales/components/reasonPopup/index.module.scss @@ -0,0 +1,27 @@ +.reason_return_con{ + height: 50vh; + .reason_title{ + padding: 10px 20px 0 20px; + height: 60px; + border-bottom: 1PX solid #F3F3F3; + box-sizing: border-box; + Text{ + font-size: 26px; + border-bottom: 3px solid #000; + padding: 10px; + font-weight: 400; + } + + } + .reason_scroll{ + height: calc(100% - 70px); + .reason_list{ + font-size: 26px; + padding: 30px 20px 0 20px; + color: #707070; + .reason_item{ + margin-bottom: 36px; + } + } + } +} \ No newline at end of file diff --git a/src/pages/applyAfterSales/components/reasonPopup/index.tsx b/src/pages/applyAfterSales/components/reasonPopup/index.tsx new file mode 100644 index 0000000..fc7ba76 --- /dev/null +++ b/src/pages/applyAfterSales/components/reasonPopup/index.tsx @@ -0,0 +1,44 @@ +import Popup from "@/components/popup"; +import { ScrollView, Text, View } from "@tarojs/components"; +import { memo, useMemo } from "react"; +import styles from './index.module.scss' + +type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 +//原因选择 +type ReasonInfoParam = { + show?: boolean, + onClose?: () => void, + status: ReasonParam +} +export default memo(({show = false, onClose, status}: ReasonInfoParam) => { + const title = useMemo(() => { + if(status == 1) return '退货原因' + if(status == 2) return '货物状况' + if(status == 3) return '退货说明' + },[status]) + return ( + + + {title} + + + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/applyAfterSales/index.config.ts b/src/pages/applyAfterSales/index.config.ts new file mode 100644 index 0000000..a7a7e32 --- /dev/null +++ b/src/pages/applyAfterSales/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '申请售后', + enableShareAppMessage: true, +} diff --git a/src/pages/order/components/applyAfterSales/index.module.scss b/src/pages/applyAfterSales/index.module.scss similarity index 78% rename from src/pages/order/components/applyAfterSales/index.module.scss rename to src/pages/applyAfterSales/index.module.scss index 978b749..e82626c 100644 --- a/src/pages/order/components/applyAfterSales/index.module.scss +++ b/src/pages/applyAfterSales/index.module.scss @@ -10,6 +10,7 @@ width: 100%; padding: 20px; box-sizing: border-box; + border-bottom: 1PX solid #f3f3f3; text{ background-color: #F6F6F6; border-radius: 10px; @@ -22,10 +23,12 @@ } } .apply_after_sales_con{ - height: 80vh; .scroll{ height: calc(100% - 170px); } + .scroll_con{ + padding: 20px 0 150px 0; + } .returnSaleInput{ margin: 0 20px; padding-top: 30px; @@ -109,36 +112,7 @@ } } } - .other_desc{ - padding: 0 20px; - box-sizing: border-box; - .title{ - font-size: $font_size; - font-weight: 700; - } - .textarea{ - position: relative; - height: 165.4px; - .descDataNum{ - position: absolute; - right: 10px; - bottom: 10px; - font-size: 22px; - color: #ABABAB; - } - } - Textarea{ - background-color: #f3f3f3; - border: 2px solid #e6e6e6; - border-radius: 10px; - width: 100%; - font-size: 25px; - height: 165.4px; - padding: 20px 20px 30px 20px; - box-sizing: border-box; - margin-top: 20px; - } - } + } .apply_after_sales_list{ padding: 0 20px; @@ -205,22 +179,40 @@ } - .reason_return_con{ - .reason_title{ - padding: 10px 20px 0 20px; - height: 60px; - border-bottom: 1PX solid #F3F3F3; - box-sizing: border-box; - Text{ - font-size: 26px; - border-bottom: 3px solid #000; - padding: 10px; - font-weight: 400; + + .btns_con{ + width: 100%; + position: fixed; + bottom:0; + padding: 0 20px; + box-sizing: border-box; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + .btns_two{ + display: flex; + height: 82px; + // border: 1PX solid #007aff; + font-size: $font_size_big; + border-radius: 40px; + margin-bottom: 20px; + .rest_btn{ + flex:1; + border: 1PX solid #007aff; + border-radius: 40px 0 0 40px; + text-align: center; + line-height: 82px; + color: $color_main; + background-color: #fff; + + } + .verify_btn{ + flex:1; + border-radius: 0 40px 40px 0; + background: #007aff; + text-align: center; + line-height: 82px; + color: #fff; } - - } - .reason_scroll{ - } } } diff --git a/src/pages/order/components/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx similarity index 55% rename from src/pages/order/components/applyAfterSales/index.tsx rename to src/pages/applyAfterSales/index.tsx index 125733f..dec0ace 100644 --- a/src/pages/order/components/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -1,33 +1,36 @@ import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components"; -import { memo, useCallback, useState } from "react"; +import { memo, useCallback, useMemo, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' -import Popup from "@/components/popup"; import { formatImgUrl } from "@/common/fotmat"; import Counter from "@/components/counter"; +import ReasonPopup from "./components/reasonPopup"; +import OtherReason from "./components/otherReason"; +import Taro from "@tarojs/taro"; +import uploadCDNImg from "@/common/uploadImage"; -export default memo(() => { +type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 +export default () => { const [showDesc, setShowDesc] = useState(true) - const [descData, setDescData] = useState({ - number: 0, - value: '', - count: 200 - }) - const getDesc = useCallback((e) => { - let value = e.detail.value - let res = value - if(value.length > descData.count) { - res = value.slice(0, descData.count) - } - setDescData({...descData, number:res.length, value: res}) - },[]) + + //退货选择弹窗 + const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1}) + const closeReason = useCallback(() => setShowReason({...showReason, show:false}), []) + const onShowReason = (status) => setShowReason({...showReason, status, show:true}) + + + + //底部按钮 + const onSubmit = (val) => { + + } + return ( - setShowDesc(false)} > - - 申请退货 - 2种面料,3种颜色,共6条 - + + 2种面料,3种颜色,共6条 + + @@ -77,21 +80,21 @@ export default memo(() => { 退货原因 - + onShowReason(1)}> 请选择 货物状况 - + onShowReason(2)}> 请选择 退货说明 - + onShowReason(3)}> 请选择 @@ -99,61 +102,52 @@ export default memo(() => { 拍照上传 - - - 上传照片 - - - - - - 其他说明 - - - {descData.number +'/'+ descData.count} + - - - - - setShowDesc(false)} > - - 货物状况 - - - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - 完好无损带原标签 - - - - + + + + + + + + onSubmit(1)}>取消 + onSubmit(2)}>确认 + + + ) -}) +} //图片列表 const PictureItem = memo(() => { + + //图片 + const uploadImage = () => { + Taro.chooseImage({ + count: 1, // 默认9 + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: function (res) { + // var tempFilePaths = res.tempFilePaths + const file = res.tempFiles[0] + console.log('res:::',res.tempFiles[0]) + // uploadCDNImg(file, 'product', 'product') + } + }) + } return ( <> - + + + + + 上传照片 ) }) - -//其他说明 diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 060dc54..1367b57 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -16,7 +16,6 @@ import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import order from "../orderList/components/order"; import AddressInfoDetail from "./components/addressInfoDetail"; -import ApplyAfterSales from "./components/applyAfterSales"; import KindList from "./components/kindList"; import OrderState from "./components/orderState"; import Payment from "./components/payment"; @@ -226,7 +225,6 @@ import styles from './index.module.scss' getRemark(e)}/> - ) diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 7bff925..a78b6f1 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -99,7 +99,6 @@ export default memo(({value, onClickBtn}: Param) => { {`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`} - ) }) diff --git a/src/reducers/userInfo.ts b/src/reducers/userInfo.ts index bcf3724..928c4fa 100644 --- a/src/reducers/userInfo.ts +++ b/src/reducers/userInfo.ts @@ -39,6 +39,7 @@ export type UserAdminParam = { wechat_user_open_id?: number is_authorize_name?: false|true, is_authorize_phone?: false|true, + phone?:string, } export type SortCodeParam = { diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index c06e543..400e9cc 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -8,8 +8,6 @@ import { GetShortCodeApi } from "@/api/share" export default () => { const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo() - console.log('userInfo:::', userInfo) - //登录请求 (调用这个就不能再useHttp中使用,当前这个hook, 否则会死循环内存溢出) // const {fetchData} = LoginApi() @@ -26,9 +24,9 @@ export default () => { //获取用户信息 const {fetchData: useFetchData} = GetAdminUserInfoApi() - const getAdminUserInfo = async () => { + const getAdminUserInfo = async (params = {}) => { let res = await useFetchData() - setAdminUserInfo(res.data) + setAdminUserInfo({...res.data, ...params}) getShortCode(res.data.user_id) } @@ -76,7 +74,7 @@ export default () => { }) if(user_res.success) { setUserInfo({...user_res.data}) - reslove(user_res.data) + getAdminUserInfo() } else { reject(user_res.msg) @@ -94,7 +92,7 @@ export default () => { //获取手机号码 const {fetchData: fetchDataUserPhone} = GetPhoneNumberApi() - const getPhoneNumber = (code) =>{ + const getPhoneNumber = (code) => { return new Promise( async (reslove, reject) => { if(userInfo.adminUserInfo?.is_authorize_phone) { reslove(true) @@ -103,7 +101,7 @@ export default () => { const res = await fetchDataUserPhone({code}) if(res.success) { setUserInfo({...userInfo.userInfo, phone:res.data.phone_number}) - getAdminUserInfo() + getAdminUserInfo({phone:res.data.phone_number}) reslove(res.data) } else { reject(res.msg) From 46357615e9d54c92903492a9b068aba1657966a6 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 10:18:56 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8Ev2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 +- src/components/orderBtns/index.module.scss | 16 ++++++-- src/components/orderBtns/index.tsx | 37 ++++++++++++++----- .../components/addressInfoDetail/index.tsx | 1 - src/pages/order/index.tsx | 6 +-- .../components/order/index.module.scss | 3 ++ src/pages/orderList/index.tsx | 5 ++- src/use/useLogin.ts | 6 +-- 8 files changed, 55 insertions(+), 23 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index a9d44b0..5b71cd0 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -9,8 +9,8 @@ // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 -// export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞 -export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 +export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN diff --git a/src/components/orderBtns/index.module.scss b/src/components/orderBtns/index.module.scss index a8f7963..49c2bc9 100644 --- a/src/components/orderBtns/index.module.scss +++ b/src/components/orderBtns/index.module.scss @@ -2,13 +2,23 @@ display: flex; justify-content: flex-end; // margin-top: 30px; + .scroll{ + white-space: nowrap; + width: 100%; + } + .list_scroll{ + white-space: nowrap; + width: 100%; + display: flex; + justify-content: flex-end; + } .btns_item{ - width: 152px; - height: 72px; + padding: 0 10px; + height: 60px; border: 2px solid #dddddd; border-radius: 38px; text-align: center; - line-height: 72px; + line-height: 60px; font-size: $font_size; color: $color_font_three; &:nth-child(n+2) { diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 6cb1292..91949ec 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -3,7 +3,7 @@ import { alert } from "@/common/common" import { ORDER_STATUS } from "@/common/enum" import { ScrollView, View } from "@tarojs/components" import Taro from "@tarojs/taro" -import { useCallback, useRef, memo } from "react" +import { useCallback, useRef, memo, useState, useEffect } from "react" import styles from './index.module.scss' type Param = { @@ -72,24 +72,27 @@ export default memo(({orderInfo, onClick}:Param) => { if(orderInfo) { if(item.id == 1) { //取消订单按钮 - return( orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) //在代发货之前没有付过款 + return( orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) //在待发货之前没有付过款 } else if (item.id == 2) { //去付款按钮 return( orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) //只要没有付完款就显示 } else if(item.id == 3) { //申请退款 - return (orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //在代发货之前付过款 + return (orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) //在待发货之前付过款 } else { + //其他按钮 return item.value.includes(orderInfo.status) } } },[orderInfo]) //点击按钮操作 - const submitBtns = (val) => { + const submitBtns = (val, index) => { + clickEvent(val, index); (val == 1)&&cancelOrder(); //取消订单按钮 - (val == 2)&&onClick?.(val); //去付款按钮 + (val == 2)&&onClick?.(2); //去付款按钮 (val == 6)&&receiveOrder(); //确认收货 + } //取消订单 @@ -136,12 +139,28 @@ export default memo(({orderInfo, onClick}:Param) => { } + + //按钮点击滚动 + const [selectInfo, setSelectInfo] = useState({ + selected: -1, //当前选中的id + tabId: '', //需要滚动到的id + }) + const clickEvent = (id, index) => { + console.log(id, index) + const num = index > 0?( index - 1) : 0 + console.log('num::',orderBtnsList.current[num].id) + setSelectInfo((e) => ({...e, tabId:orderBtnsList.current[num].id.toString(), selected: id})) + } + return ( - - {orderBtnsList.current.map((item) => - orderBtnsShow(item)&& submitBtns(item.id)}>{item.label} - )} + + + {orderBtnsList.current.map((item, index) => + orderBtnsShow(item)&& submitBtns(item.id, index)}>{item.label} + // submitBtns(item.id, index)}>{item.label} + )} + diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index d2b4251..305805d 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -117,7 +117,6 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = - diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 1367b57..582f333 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -142,12 +142,10 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - console.log('val::', val) - if(val == 1) { + if(val == 1 || val == 6) { //取消订单 getSaleOrderPreView() - } - if(val == 2) { + }else if(val == 2) { //待付款 toPay() } diff --git a/src/pages/orderList/components/order/index.module.scss b/src/pages/orderList/components/order/index.module.scss index 85e1123..63a4e0a 100644 --- a/src/pages/orderList/components/order/index.module.scss +++ b/src/pages/orderList/components/order/index.module.scss @@ -42,6 +42,9 @@ border-radius: 0px 20px 0px 20px; } } + .product_con{ + margin-bottom: 20px; + } .product_title{ display: flex; align-items: center; diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index dee8c57..a235806 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -96,7 +96,10 @@ export default () => { //监听点击的按钮 const clickOrderBtn = useCallback(({status, orderInfo}) => { - if(status == 2) { + console.log('status:::', status) + if(status == 1 || status == 6) { + getOrderList() + } else if(status == 2) { //去支付 setPayOrderInfo({orderId:orderInfo.should_collect_order_id, payment_method:orderInfo.payment_method}) toPay() diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index 400e9cc..4ee8e87 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -24,9 +24,9 @@ export default () => { //获取用户信息 const {fetchData: useFetchData} = GetAdminUserInfoApi() - const getAdminUserInfo = async (params = {}) => { + const getAdminUserInfo = async () => { let res = await useFetchData() - setAdminUserInfo({...res.data, ...params}) + setAdminUserInfo({...res.data}) getShortCode(res.data.user_id) } @@ -101,7 +101,7 @@ export default () => { const res = await fetchDataUserPhone({code}) if(res.success) { setUserInfo({...userInfo.userInfo, phone:res.data.phone_number}) - getAdminUserInfo({phone:res.data.phone_number}) + getAdminUserInfo() reslove(res.data) } else { reject(res.msg)