From f1cc28bd0b25bc8d3915ee7706e23c41190569e9 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 8 Jun 2022 17:02:06 +0800 Subject: [PATCH 01/47] 1 --- src/common/constant.js | 5 +++-- src/common/fotmat.js | 21 +++++++++++++++++++-- src/components/search/index.tsx | 4 ++-- src/pages/order/index.tsx | 2 +- src/pages/searchList/hightSearchList.tsx | 2 +- src/pages/searchList/search.module.scss | 13 +++++++++---- src/pages/searchList/search.tsx | 12 ++++++------ src/pages/searchList/searchList.tsx | 9 +++------ src/use/useLogin.ts | 1 + 9 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 76db424..dc069fb 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:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN @@ -22,6 +22,7 @@ export const UPLOAD_CDN_URL = `https://v0.api.upyun.com/` export const IMG_CND_Prefix = CURRENT_ENV.includes('development')? "https://test.cdn.zzfzyc.com":"https://cdn.zzfzyc.com" + // 上传图片视频 export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`; diff --git a/src/common/fotmat.js b/src/common/fotmat.js index 2176a51..09b2d01 100644 --- a/src/common/fotmat.js +++ b/src/common/fotmat.js @@ -142,5 +142,22 @@ export const toDecimal2 = (x) => { * @returns */ export const formatImgUrl = (url, suffix="!w200") => { - return url?IMG_CND_Prefix + url + suffix:'https://cdn.zzfzyc.com/mall/no_img.png' -} \ No newline at end of file + return url?IMG_CND_Prefix + url + suffix:IMG_CND_Prefix +'/mall/no_img.png' +} + +/** + * + * @param {纹理图} imgurl + * @param {rgb} rgb + * @param {} suffix + * @returns 1 有纹理图,2 有rgb 3默认图 + */ +export const isLabImage = (imgurl, rgb, suffix="!w200") => { + if(imgurl) { + return {status:1, value: IMG_CND_Prefix+'/'+imgurl+suffix} + } else if(rgb.r != 0 || rgb.g != 0 || rgb.b != 0) { + return {status:2, value: rgb} + } else { + return {status:3, value: IMG_CND_Prefix+'/mall/no_img.png'} + } +} diff --git a/src/components/search/index.tsx b/src/components/search/index.tsx index 9c2191b..294aec5 100644 --- a/src/components/search/index.tsx +++ b/src/components/search/index.tsx @@ -71,12 +71,12 @@ export default memo(forwardRef(({ {showIcon&&} - onInputEven(e)}> + onInputEven(e)}> {!!inputCon&& clearInput()} styleObj={{width: '20rpx', height:'20rpx', backgroundColor:'#fff', border:'0'}}/> } - {showBtn&& onSearch()}>{btnTitle}} + {showBtn&&{btnTitle}} ) 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/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx index f7d31db..ffc8dcc 100644 --- a/src/pages/searchList/hightSearchList.tsx +++ b/src/pages/searchList/hightSearchList.tsx @@ -108,6 +108,7 @@ export default () => { //获取筛选条件 const getFiltr = (e) => { + setMaterialList(() => ({list:[], total:0})) const {data} = e setSearchField({ ...searchField, @@ -123,7 +124,6 @@ export default () => { //筛选条件格式化 const [selectList , setSelectList] = useState() const formatSelectList = (val = {data:{}, field:{}}) => { - console.log('data123::',val.data) let data:ListProps[] = [] for(let key in val.data) { if(key !== 'seriesId'&& val.data[key] != '') { diff --git a/src/pages/searchList/search.module.scss b/src/pages/searchList/search.module.scss index 2e4ede6..f31b47a 100644 --- a/src/pages/searchList/search.module.scss +++ b/src/pages/searchList/search.module.scss @@ -1,11 +1,17 @@ .main{ + position: relative; .search{ display: flex; justify-content: space-between; padding: 20px; padding-bottom: 50px; } - + .up_search{ + color: $color_main; + font-size: $font_size; + position: absolute; + right: 20px; + } .hot { padding: 0 20px; .hot_header { @@ -18,10 +24,9 @@ color: $color_font_one; font-weight: 700; } - .hot_header_up{ - color: $color_main; - } + } + .list{ display: flex; font-size: $font_size_medium; diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index 7505bcd..756bd77 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -69,18 +69,18 @@ export default () => { searchEvent(e)}/> - + goLink('/pages/searchList/searchList')}>高级搜索 + {searchData?.hotField.length > 0 && 热门面料 - goLink('/pages/searchList/searchList')}>高级搜索 - {searchData?.hotField?.map((item, index) => { + {searchData.hotField.map((item, index) => { return searchEvent(item.search_key, false)}>{item.search_key} })} - - + } + {searchData?.historyField.length > 0 && 历史搜索 @@ -88,7 +88,7 @@ export default () => { {searchData?.historyField?.map((item, index) => searchEvent(item.search_key, false)}>{item.search_key})} - + } ) } diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 7acb9fe..5ae921c 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -8,12 +8,10 @@ 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"; import { dataLoadingStatus, getFilterData } from "@/common/util"; -import LoadingCard from "@/components/loadingCard"; import useLogin from "@/use/useLogin"; export default () => { @@ -95,6 +93,7 @@ export default () => { //获取筛选条件 const getFiltr = (e) => { pageNum.current.page = 1 + setMaterialList(() => ({list:[], total:0})) const {data} = e setSearchField({ ...searchField, @@ -110,14 +109,12 @@ export default () => { //筛选条件格式化 const [selectList , setSelectList] = useState() const formatSelectList = (val = {data:{}, field:{}}) => { - console.log('data123::',val.data) let data:ListProps[] = [] for(let key in val.data) { if(key !== 'seriesId'&& val.data[key] != '') { data.push({title:val.field[key], value:val.data[key]}) } } - console.log('data::',data) setSelectList([...data]) } @@ -156,8 +153,8 @@ export default () => { 搜索结果 ({materialList.total}条记录) getScrolltolower()} - selfOnScroll={(e) => onscroll(e)} + selfonScrollToLower={getScrolltolower} + selfOnScroll={onscroll} statusMore={statusMore} > diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index c06e543..a7950fa 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -79,6 +79,7 @@ export default () => { reslove(user_res.data) getAdminUserInfo() } else { + console.log('aaa:::',user_res.msg) reject(user_res.msg) } }, 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 02/47] 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 03/47] =?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 04/47] =?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 05/47] =?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) From 617b83d3081f1368a84473eabf55af0e79c6bf65 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 10:33:10 +0800 Subject: [PATCH 06/47] =?UTF-8?q?--=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddressList/index.tsx | 2 +- src/pages/user/index.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index b2066a0..71e9827 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -93,7 +93,7 @@ const AddressList = memo((props:Params)=>{ {item.name} { item.is_default?默认: - {item.phone.replace(item.phone.substring(4,7), "****")} + {item.phone.replace(item.phone.substring(3,7), "****")} } diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 1dfc6d7..1a1a0b5 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -36,13 +36,13 @@ export default () => { } const Modal = memo((props:any)=>{ const {data} = props; + const [modalShow, setModalShow]=useState(true); const handleouter = ()=>{ console.log(222); - } return( <> - {!data?.is_authorize_phone&& + {!data?.is_authorize_phone&&modalShow&& e.stopPropagation()}> 首次登录提醒 @@ -53,7 +53,7 @@ const Modal = memo((props:any)=>{ - 我知道 + setModalShow(false)}>我知道 @@ -90,7 +90,7 @@ const Header = memo((props:any) => { {data?.user_name} - {userInfo?.phone||} + {userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****")||} From 0454f26cc94562d7c50b1f3709e9ab4fa863edfb Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 10:34:04 +0800 Subject: [PATCH 07/47] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 ---- src/pages/order/components/addressInfoDetail/index.tsx | 4 +++- src/pages/order/index.module.scss | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 72b9c51..c1e0354 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -9,11 +9,7 @@ // 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` // 正式环境 -<<<<<<< HEAD -// export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞 -======= // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 ->>>>>>> 订单售后v2 export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index 305805d..bc915ed 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -75,6 +75,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = }, 10) //修改地址 + const [addressId, setAddressId] = useState(0) const {fetchData: addressFetchData} = EditSaleOrderAddressApi() const getAddress = async (value) => { alert.loading('正在修改') @@ -83,6 +84,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = alert.success('地址修改成功') onSelect?.(value) setShowAddressList(() => false) + setAddressId(value.id) setUserInfo(() => value) } else { alert.none(res.msg) @@ -115,7 +117,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = 请选择收货地址 - + diff --git a/src/pages/order/index.module.scss b/src/pages/order/index.module.scss index a032fbe..87ea5e5 100644 --- a/src/pages/order/index.module.scss +++ b/src/pages/order/index.module.scss @@ -69,7 +69,6 @@ left: 0; justify-content: flex-end; width: 100%; - height: 175px; align-items: center; background-color: #fff; box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); From 69089dd9af376e0093bdef9520b60e54f2c925eb Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 10:34:12 +0800 Subject: [PATCH 08/47] =?UTF-8?q?---=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 72b9c51..dc069fb 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -9,11 +9,7 @@ // 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` // 正式环境 -<<<<<<< HEAD // export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞 -======= -// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 ->>>>>>> 订单售后v2 export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 From 8197140027112149178340fbf02bd4d825262eed Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 10:49:31 +0800 Subject: [PATCH 09/47] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shopCart/index.module.scss | 3 +- .../components/LabAndImg/index.modul.scss | 0 .../details/components/LabAndImg/index.tsx | 9 ++++++ src/pages/details/index.tsx | 29 ++++++++++--------- 4 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 src/pages/details/components/LabAndImg/index.modul.scss create mode 100644 src/pages/details/components/LabAndImg/index.tsx diff --git a/src/components/shopCart/index.module.scss b/src/components/shopCart/index.module.scss index 633b89e..43de2c1 100644 --- a/src/components/shopCart/index.module.scss +++ b/src/components/shopCart/index.module.scss @@ -175,7 +175,7 @@ .price_con{ flex:1; .price_real{ - font-size: $font_size; + font-size: $font_size_big; color: #fff; text{ font-size: $font_size_min; @@ -184,7 +184,6 @@ .price_forecast{ font-size: $font_size_min; color: $color_font_two; - margin-top: 10px; } } .goPay{ diff --git a/src/pages/details/components/LabAndImg/index.modul.scss b/src/pages/details/components/LabAndImg/index.modul.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/details/components/LabAndImg/index.tsx b/src/pages/details/components/LabAndImg/index.tsx new file mode 100644 index 0000000..2e4bfcc --- /dev/null +++ b/src/pages/details/components/LabAndImg/index.tsx @@ -0,0 +1,9 @@ +import { memo } from "react"; + +export default memo(() => { + return ( + <> + + + ) +}) \ No newline at end of file diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index a7e6341..f76a6fe 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -115,15 +115,15 @@ export default (props:Params) => { //开始下单 const placeOrder = async (e:any) => { - try { - await getPhoneNumber(e.detail.code) - } catch(msg) { - Taro.showToast({ - icon:"none", - title: msg - }) - return false - } + // try { + // await getPhoneNumber(e.detail.code) + // } catch(msg) { + // Taro.showToast({ + // icon:"none", + // title: msg + // }) + // return false + // } setShowOrderCount(true) } @@ -183,11 +183,12 @@ export default (props:Params) => { 购物车 { - !userInfo.adminUserInfo?.is_authorize_phone&& - - 开始下单 - - || placeOrder(e)}>开始下单 + // !userInfo.adminUserInfo?.is_authorize_phone&& + // + // 开始下单 + // + // || placeOrder(e)}>开始下单 + placeOrder(e)}>开始下单 } From b07194ea616b2e75fa9abdc61947c01cc0e78535 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 15:36:53 +0800 Subject: [PATCH 10/47] =?UTF-8?q?--=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=8C=89=E9=92=AE=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddressList/index.scss | 2 +- src/pages/creditLine/index.scss | 16 ---------------- src/pages/creditLine/index.tsx | 5 ++--- src/pages/creditUsed/index.tsx | 6 ++++-- src/pages/user/index.tsx | 18 +++++++++--------- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/components/AddressList/index.scss b/src/components/AddressList/index.scss index 8c6198c..6b8bd5e 100644 --- a/src/components/AddressList/index.scss +++ b/src/components/AddressList/index.scss @@ -89,7 +89,7 @@ font-weight: 400; color: #ffffff; display: flex;align-items: center;justify-content: center; - position: absolute;bottom: 4%;left: 50%; + position: absolute;bottom: 50px;left: 50%; transform: translateX(-50%); } .address-no-data{ diff --git a/src/pages/creditLine/index.scss b/src/pages/creditLine/index.scss index 29a272e..79772fc 100644 --- a/src/pages/creditLine/index.scss +++ b/src/pages/creditLine/index.scss @@ -5,22 +5,6 @@ width: 238px; height: 238px; } - - .credit-line-tips{ - width: 100%; - height: 66px; - background: #FFE6CE; - border: 2px solid #ffe6ce; - padding: 0 30px; - display: flex;align-items: center; - font-size: 24px; - font-weight: 400; - color: #EE7500; - } - .credit-line-tips text{ - margin-right: 10px; - font-size: 30px; - } .credit-line-card{ width: 702px; background: #ffffff; diff --git a/src/pages/creditLine/index.tsx b/src/pages/creditLine/index.tsx index 5468d50..2aaf9ff 100644 --- a/src/pages/creditLine/index.tsx +++ b/src/pages/creditLine/index.tsx @@ -7,6 +7,7 @@ import {creditInfoApi} from "@/api/creditLine" import "./index.scss" import { useSelector } from "@/reducers/hooks"; import { formatDateTime, formatPriceDiv } from "@/common/fotmat" +import Message from "@/components/Message" export default ()=>{ @@ -120,9 +121,7 @@ export default ()=>{ return ( - - 暂不支持线上申请授权,请联系平台客服。 - + diff --git a/src/pages/creditUsed/index.tsx b/src/pages/creditUsed/index.tsx index 8858ad9..17d60f3 100644 --- a/src/pages/creditUsed/index.tsx +++ b/src/pages/creditUsed/index.tsx @@ -4,7 +4,7 @@ import Taro, { useReady } from "@tarojs/taro" import { useCallback, useEffect, useMemo, useRef, useState } from "react" import {creditListApi} from "@/api/creditLine" import "./index.scss" -import { formatDateTime } from "@/common/fotmat" +import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat" import { dataLoadingStatus, getFilterData } from "@/common/util"; export default ()=>{ @@ -30,7 +30,9 @@ export default ()=>{ 下单 - 0?'green':item.amount<0?'red':''}`}>{item.amount.toLocaleString()} + 0?'green':item.amount<0?'red':''}`}> + {item.amount>0?"-":"+"}{toDecimal2(formatPriceDiv(item.amount)).toLocaleString()} + {formatDateTime(item.order_pay_time)} diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 1a1a0b5..b4849ea 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -5,7 +5,7 @@ import classnames from "classnames"; import { useSelector } from "@/reducers/hooks"; import { GetAdminUserInfoApi } from "@/api/user"; import { alert, goLink } from "@/common/common"; - +import useLogin from '@/use/useLogin' export default () => { // 用户信息 @@ -38,7 +38,6 @@ const Modal = memo((props:any)=>{ const {data} = props; const [modalShow, setModalShow]=useState(true); const handleouter = ()=>{ - console.log(222); } return( <> @@ -68,11 +67,12 @@ const Header = memo((props:any) => { let menu = [{ text: "待配布", icon: "icon-daipeibu" }, { text: "待付款", icon: "icon-daifukuan" }, { text: "待发货", icon: "icon-daifahuo" }, { text: "已发货", icon: "icon-yifahuo" }, { text: "退款/售后", icon: "icon-a-tuikuanshouhou" }]; - const getPhoneNumber = (ev)=>{ - console.log(ev); - if(ev.detail?.code){ - }else{ - alert.none("取消了授权"); + const { getPhoneNumber } = useLogin(); + const mGetPhoneNumber = (ev)=>{ + try { + getPhoneNumber(ev.detail.code); + } catch (error) { + alert.none("绑定失败!"); } } @@ -90,7 +90,7 @@ const Header = memo((props:any) => { {data?.user_name} - {userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****")||} + {userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****")||} @@ -114,7 +114,7 @@ const Header = memo((props:any) => { 重新认证 - 佛山市带生纺织品有限公司 + {data?.company_name} From 811e93e628cad71162e9ed615b49ffc4edadb793 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 15:41:28 +0800 Subject: [PATCH 11/47] =?UTF-8?q?--=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E5=9C=B0=E5=9D=80=E6=8C=89=E9=92=AE=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E8=B7=9D=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddressList/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddressList/index.scss b/src/components/AddressList/index.scss index 6b8bd5e..1224a8e 100644 --- a/src/components/AddressList/index.scss +++ b/src/components/AddressList/index.scss @@ -89,7 +89,7 @@ font-weight: 400; color: #ffffff; display: flex;align-items: center;justify-content: center; - position: absolute;bottom: 50px;left: 50%; + position: absolute;bottom: 100px;left: 50%; transform: translateX(-50%); } .address-no-data{ From 38a3b348bde7529ca4fd072214a84c1afaf9c6c1 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 15:41:33 +0800 Subject: [PATCH 12/47] =?UTF-8?q?=E5=B0=81=E8=A3=85=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/cdn.ts | 13 + src/common/uploadImage.js | 132 ---------- src/components/LabAndImg/index.module.scss | 17 ++ src/components/LabAndImg/index.tsx | 30 +++ src/components/moveBtn/index.tsx | 2 +- src/components/orderBtns/index.module.scss | 9 +- src/components/orderBtns/index.tsx | 2 +- src/components/product/index.tsx | 3 +- src/pages/applyAfterSales/index.tsx | 9 +- src/pages/cutOrder/comfirm.config.ts | 4 + src/pages/cutOrder/comfirm.module.scss | 130 ++++++++++ src/pages/cutOrder/comfirm.tsx | 188 ++++++++++++++ .../components/addressInfo/index.module.scss | 71 ++++++ .../cutOrder/components/addressInfo/index.tsx | 76 ++++++ .../addressInfoDetail/index.module.scss | 117 +++++++++ .../components/addressInfoDetail/index.tsx | 126 ++++++++++ .../components/amountShow/index.module.scss | 35 +++ .../cutOrder/components/amountShow/index.tsx | 28 +++ .../estimatedAmount/index.module.scss | 70 ++++++ .../components/estimatedAmount/index.tsx | 29 +++ .../components/kindList/index.module.scss | 108 +++++++++ .../cutOrder/components/kindList/index.tsx | 169 +++++++++++++ .../components/offlinePay/index.module.scss | 46 ++++ .../cutOrder/components/offlinePay/index.tsx | 52 ++++ .../orderState copy/index.module.scss | 18 ++ .../components/orderState copy/index.tsx | 14 ++ .../components/orderState/index.module.scss | 105 ++++++++ .../cutOrder/components/orderState/index.tsx | 63 +++++ .../components/payment/index.module.scss | 126 ++++++++++ .../cutOrder/components/payment/index.tsx | 185 ++++++++++++++ .../components/remark/index.module.scss | 48 ++++ .../cutOrder/components/remark/index.tsx | 38 +++ .../components/scanPay/index.module.scss | 54 +++++ .../cutOrder/components/scanPay/index.tsx | 161 ++++++++++++ .../components/shipmentMode/index.module.scss | 33 +++ .../components/shipmentMode/index.tsx | 28 +++ .../submitOrderBtn/index.module.scss | 69 ++++++ .../components/submitOrderBtn/index.tsx | 40 +++ .../components/weightMemo/index.module.scss | 39 +++ .../cutOrder/components/weightMemo/index.tsx | 36 +++ src/pages/cutOrder/index.config.ts | 6 + src/pages/cutOrder/index.module.scss | 133 ++++++++++ src/pages/cutOrder/index.tsx | 229 ++++++++++++++++++ .../components/LabAndImg/index.modul.scss | 0 .../details/components/LabAndImg/index.tsx | 9 - .../components/orderCount/index.module.scss | 7 +- .../details/components/orderCount/index.tsx | 24 +- src/pages/details/index.tsx | 3 +- .../components/kindList/index.module.scss | 1 - src/pages/order/components/kindList/index.tsx | 5 +- .../order/components/submitOrderBtn/index.tsx | 2 +- .../orderList/components/order/index.tsx | 6 +- .../searchList/hightSearchList.module.scss | 1 - src/pages/searchList/hightSearchList.tsx | 6 +- src/pages/searchList/searchList.module.scss | 1 - src/pages/searchList/searchList.tsx | 3 +- src/use/useUploadImage.ts | 121 +++++++++ 57 files changed, 2899 insertions(+), 181 deletions(-) create mode 100644 src/api/cdn.ts delete mode 100644 src/common/uploadImage.js create mode 100644 src/components/LabAndImg/index.module.scss create mode 100644 src/components/LabAndImg/index.tsx create mode 100644 src/pages/cutOrder/comfirm.config.ts create mode 100644 src/pages/cutOrder/comfirm.module.scss create mode 100644 src/pages/cutOrder/comfirm.tsx create mode 100644 src/pages/cutOrder/components/addressInfo/index.module.scss create mode 100644 src/pages/cutOrder/components/addressInfo/index.tsx create mode 100644 src/pages/cutOrder/components/addressInfoDetail/index.module.scss create mode 100644 src/pages/cutOrder/components/addressInfoDetail/index.tsx create mode 100644 src/pages/cutOrder/components/amountShow/index.module.scss create mode 100644 src/pages/cutOrder/components/amountShow/index.tsx create mode 100644 src/pages/cutOrder/components/estimatedAmount/index.module.scss create mode 100644 src/pages/cutOrder/components/estimatedAmount/index.tsx create mode 100644 src/pages/cutOrder/components/kindList/index.module.scss create mode 100644 src/pages/cutOrder/components/kindList/index.tsx create mode 100644 src/pages/cutOrder/components/offlinePay/index.module.scss create mode 100644 src/pages/cutOrder/components/offlinePay/index.tsx create mode 100644 src/pages/cutOrder/components/orderState copy/index.module.scss create mode 100644 src/pages/cutOrder/components/orderState copy/index.tsx create mode 100644 src/pages/cutOrder/components/orderState/index.module.scss create mode 100644 src/pages/cutOrder/components/orderState/index.tsx create mode 100644 src/pages/cutOrder/components/payment/index.module.scss create mode 100644 src/pages/cutOrder/components/payment/index.tsx create mode 100644 src/pages/cutOrder/components/remark/index.module.scss create mode 100644 src/pages/cutOrder/components/remark/index.tsx create mode 100644 src/pages/cutOrder/components/scanPay/index.module.scss create mode 100644 src/pages/cutOrder/components/scanPay/index.tsx create mode 100644 src/pages/cutOrder/components/shipmentMode/index.module.scss create mode 100644 src/pages/cutOrder/components/shipmentMode/index.tsx create mode 100644 src/pages/cutOrder/components/submitOrderBtn/index.module.scss create mode 100644 src/pages/cutOrder/components/submitOrderBtn/index.tsx create mode 100644 src/pages/cutOrder/components/weightMemo/index.module.scss create mode 100644 src/pages/cutOrder/components/weightMemo/index.tsx create mode 100644 src/pages/cutOrder/index.config.ts create mode 100644 src/pages/cutOrder/index.module.scss create mode 100644 src/pages/cutOrder/index.tsx delete mode 100644 src/pages/details/components/LabAndImg/index.modul.scss delete mode 100644 src/pages/details/components/LabAndImg/index.tsx create mode 100644 src/use/useUploadImage.ts diff --git a/src/api/cdn.ts b/src/api/cdn.ts new file mode 100644 index 0000000..8289c45 --- /dev/null +++ b/src/api/cdn.ts @@ -0,0 +1,13 @@ +import { useRequest } from "@/use/useHttp" + + +/** + * 获取cdn 签名/密钥 + * @returns + */ + export const GetSignApi = () => { + return useRequest({ + url: `/v1/mall/cdn/token`, + method: "get" + }) +} diff --git a/src/common/uploadImage.js b/src/common/uploadImage.js deleted file mode 100644 index ae7724b..0000000 --- a/src/common/uploadImage.js +++ /dev/null @@ -1,132 +0,0 @@ -import Taro from '@tarojs/taro'; -import { GET_UPLOAD_SIGN, CDN_UPLOAD_IMG, UPLOAD_CDN_URL } from './constant' - -import { GetSignApi } from '@/api/cdn' - - -const { fetchData: GetSign, success, data: resData, msg, code } = GetSignApi() - - -// 上传图片 获取auth,Policy -/* - scene 场景值,区分上传文件的根路径 - type 类型值,区分上传业务bucket -*/ -const getSecret = (scene, type) => { - return new Promise(async (resolve, reject) => { - - const SAVE_PATH = `/${scene}/{filemd5}{day}{hour}{min}{sec}{.suffix}`; - - - let params = { - 'method': 'post', - 'save_key': SAVE_PATH - } - - // 获取签名 - await GetSign(params) - if (success.value) { - // console.log('返回签名',resData.value); - resolve(resData.value) - } else { - reject({ - code: code.value || '9999', - msg: msg.value - }); - } - - }) -} -const getFileType = (name) => { - if (!name) return false; - var imgType = ["gif", "jpeg", "jpg", "bmp", "png"]; - var videoType = ["avi", "wmv", "mkv", "mp4", "mov", "rm", "3gp", "flv", "mpg", "rmvb", "quicktime"]; - - if (RegExp("\.?(" + imgType.join("|") + ")$", "i").test(name.toLowerCase())) { - return 'image'; - } else if (RegExp("\.(" + videoType.join("|") + ")$", "i").test(name.toLowerCase())) { - return 'video'; - } else { - return false; - } -} - -const upYunbucket = (type) => { - var bucket = "" - switch (type) { - case "product": - bucket = "testzzfzyc" - break; - } - return bucket -} - - -/** - * - * @param {*} file 传入文件 - * @param {String} secene 传入 'product' - * @param {String} type 传入 'product' - * @returns - */ -const uploadCDNImg = (file, secene, type) => { - // var file = event.target.files[0]; - // var filetype = file.type - let filetype = file.tempFilePath - - if (!getFileType(filetype)) { - Taro.showToast({ - title: "上传文件类型错误", - icon: "none", - duration: 3800 - }) - return false - } - return new Promise((resolve, reject, race) => { - getSecret(secene, type) - .then(result => { - - console.log('bucket', result.bucket); - var formdata = { - 'authorization': result.authorization, - 'policy': result.policy, - // "file": file.tempFilePath, - } - - const uploadTask = Taro.uploadFile({ - url: `${UPLOAD_CDN_URL}${result.bucket}`, - formData: formdata, - filePath: file.tempFilePath, - name: 'file', - success: res => { - resolve(JSON.parse(`${res.data}`)) - }, - fail: err => { - console.log(err) - reject(err) - } - }) - - uploadTask.progress(res => { - console.log('上传进度', res.progress); - if (res.progress < 100) { - Taro.showLoading({ - title: '上传中...' - }) - } else { - Taro.hideLoading() - } - }) - }) - .catch(result => { - reject(result) - Taro.showToast({ - title: "获取密钥失败!", - icon: "none", - duration: 3800 - }) - }) - }) -} - -export default uploadCDNImg \ No newline at end of file diff --git a/src/components/LabAndImg/index.module.scss b/src/components/LabAndImg/index.module.scss new file mode 100644 index 0000000..836ba5b --- /dev/null +++ b/src/components/LabAndImg/index.module.scss @@ -0,0 +1,17 @@ + +.labAndImg_main{ + width: 100%; + height: 100%; + .boxColor{ + width: 100%; + height: 100%; + border-radius: 20px; + border:1PX solid #818181; + } + image{ + width: 100%; + height: 100%; + border-radius: 20px; + } + +} diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx new file mode 100644 index 0000000..842d0d9 --- /dev/null +++ b/src/components/LabAndImg/index.tsx @@ -0,0 +1,30 @@ +import { formatImgUrl } from "@/common/fotmat"; +import { Image, View } from "@tarojs/components"; +import { memo, useMemo } from "react"; +import styles from './index.module.scss' + +//该组件宽高为100%需调整外层元素宽高 +type Param = { + value?: { + texture_url?: string, //纹理图路径 + lab?: {l:number, a:number, b:number}, //lab + rgb?: {r:number, g:number, b:number} //rgb + } +} +export default memo(({value}:Param) => { + //lab是否都是0 + const rgbStyle = useMemo(() => { + if(value?.lab&&(value.lab.l||value.lab.a||value.lab.b)) { + return {'backgroundColor':`rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})`} + } else { + return null + } + }, [value]) + return ( + + {value?.texture_url&&} + {(!value?.texture_url&&rgbStyle)&&} + {(!value?.texture_url&&!rgbStyle)&&} + + ) +}) \ No newline at end of file diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx index f7bac85..e30e888 100644 --- a/src/components/moveBtn/index.tsx +++ b/src/components/moveBtn/index.tsx @@ -29,7 +29,7 @@ export default ({children = null, onClick}:param) => { return ( {children} - {showMoveBtn&& dragEnd(e)}> + {showMoveBtn&& dragEnd(e)}> } diff --git a/src/components/orderBtns/index.module.scss b/src/components/orderBtns/index.module.scss index 49c2bc9..3444eb0 100644 --- a/src/components/orderBtns/index.module.scss +++ b/src/components/orderBtns/index.module.scss @@ -1,6 +1,7 @@ .btns_list{ display: flex; justify-content: flex-end; + width: 100%; // margin-top: 30px; .scroll{ white-space: nowrap; @@ -9,18 +10,18 @@ .list_scroll{ white-space: nowrap; width: 100%; - display: flex; - justify-content: flex-end; + text-align: right; } .btns_item{ - padding: 0 10px; - height: 60px; + padding: 0 15px; + width: 100px; border: 2px solid #dddddd; border-radius: 38px; text-align: center; line-height: 60px; font-size: $font_size; color: $color_font_three; + display:inline-block; &:nth-child(n+2) { margin-left: 32px; } diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 91949ec..8720675 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -158,7 +158,7 @@ export default memo(({orderInfo, onClick}:Param) => { {orderBtnsList.current.map((item, index) => orderBtnsShow(item)&& submitBtns(item.id, index)}>{item.label} - // submitBtns(item.id, index)}>{item.label} + // submitBtns(item.id, index)}>{item.label} )} diff --git a/src/components/product/index.tsx b/src/components/product/index.tsx index 7a14628..0e849f8 100644 --- a/src/components/product/index.tsx +++ b/src/components/product/index.tsx @@ -3,6 +3,7 @@ import Taro from "@tarojs/taro" import { goLink } from "@/common/common" import styles from './index.module.scss' import { formatHashTag, formatImgUrl } from "@/common/fotmat" +import LabAndImg from "../LabAndImg" type Params = { desStatus?: true|false, @@ -14,7 +15,7 @@ export default ({desStatus = true, productList = []}:Params) => { {productList?.map(item => { return goLink(`/pages/details/index?id=${item.id}`)}> - + {item.product_color_count}色 diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index dec0ace..3beefd0 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -7,7 +7,7 @@ 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"; +import useUploadCDNImg from "@/use/useUploadImage"; type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 export default () => { @@ -123,7 +123,8 @@ export default () => { //图片列表 const PictureItem = memo(() => { - + const {uploadCDNImg} = useUploadCDNImg() + //图片 const uploadImage = () => { Taro.chooseImage({ @@ -131,10 +132,8 @@ const PictureItem = memo(() => { 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') + uploadCDNImg(file, 'product', 'product') } }) } diff --git a/src/pages/cutOrder/comfirm.config.ts b/src/pages/cutOrder/comfirm.config.ts new file mode 100644 index 0000000..67ce23e --- /dev/null +++ b/src/pages/cutOrder/comfirm.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '确认订单', + enableShareAppMessage: true, +} diff --git a/src/pages/cutOrder/comfirm.module.scss b/src/pages/cutOrder/comfirm.module.scss new file mode 100644 index 0000000..2858dec --- /dev/null +++ b/src/pages/cutOrder/comfirm.module.scss @@ -0,0 +1,130 @@ +.order_main{ + min-height: 100%; + background-color:$color_bg_one; + padding: 20px; + padding-bottom: 190px; + box-sizing: border-box; + + .order_title{ + display: flex; + align-items: center; + padding: 20px 30px; + box-sizing: border-box; + background-color: #fff; + height: 116px; + border-radius: 20px; + margin-top: 20px; + text{ + flex:1; + font-size: $font_size; + font-weight: 700; + } + .order_status{ + background-color: #F0F0F0; + width: 148px; + height: 55px; + color: $color_font_three; + text-align: center; + line-height: 55px; + font-size: $font_size_medium; + border-radius: 30px; + &:nth-last-child(1) { + margin-left: 20px; + } + } + .order_status_selected{ + color: $color_main; + border: 1px solid $color_main; + } + } + .order_desc{ + display: flex; + align-items: center; + background-color: #fff; + padding: 20px; + min-height: 116px; + border-radius: 20px; + margin-top: 20px; + box-sizing: border-box; + .order_desc_con{ + width: 150px; + font-size: $font_size; + font-weight: 700; + } + .order_desc_text, .order_desc_text_hint{ + font-size: $font_size_medium; + color: $color_font_two; + margin-right: 10px; + flex:1; + } + .order_desc_text_hint{ + text-align: right; + } + .miconfont{ + font-size: 20px; + color: $color_font_two; + } + } + .submit_order{ + display: flex; + position: fixed; + bottom: 0; + left: 0; + justify-content: space-between; + width: 100%; + height: 175px; + align-items: center; + background-color: #fff; + box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); + padding: 20px 50px; + box-sizing: border-box; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + .order_btn { + width: 250px; + height: 90px; + opacity: 0.6; + background: linear-gradient(38deg,#007aff, #4fa6ff 100%, #68b4ff 100%); + border-radius: 46px; + display: flex; + justify-content: center; + align-items: center; + color: #fff; + } + .ok_order_btn { + opacity: 1; + } + .order_number_desc{ + font-size: $font_size_medium; + color: $color_font_two; + } + } + .order_info{ + background-color: #fff; + margin-top: 20px; + border-radius: 20px; + padding: 20px; + .order_info_title{ + font-size: $font_size; + font-weight: 700; + margin-bottom: 20px; + + } + .order_num{ + display: flex; + justify-content: space-between; + align-items: center; + .order_num_btn{ + font-size: $font_size_medium; + padding: 5px 10px; + border: 2px solid #007cf7; + border-radius: 10px; + color: $color_main; + } + } + text{ + font-size: $font_size; + } + + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/comfirm.tsx b/src/pages/cutOrder/comfirm.tsx new file mode 100644 index 0000000..e8a8a45 --- /dev/null +++ b/src/pages/cutOrder/comfirm.tsx @@ -0,0 +1,188 @@ +import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order"; +import { formatPriceDiv } from "@/common/fotmat"; +import Popup from "@/components/popup"; +import SearchInput from "@/components/searchInput"; +import { Text, Textarea, View } from "@tarojs/components" +import Taro, { useDidShow, useRouter } from "@tarojs/taro"; +import classnames from "classnames"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import AddressInfo,{AddressInfoParam} from "./components/addressInfo"; +import EstimatedAmount from "./components/estimatedAmount"; +import KindList from "./components/kindList"; +import OrderState from "./components/orderState"; +import Remark from "./components/remark"; +import styles from './comfirm.module.scss' +import { getParam } from "@/common/system"; +import useLogin from "@/use/useLogin"; +import { alert, goLink } from "@/common/common"; +import ShipmentMode from "../editOrder/components/shipmentMode"; +import SubmitOrderBtn from "./components/submitOrderBtn"; + + export default () => { + const {checkLogin} = useLogin() + + const [showDesc, setShowDesc] = useState(false) + //下单信息 + type OrderParams = {address_id?: number, remark?: string, sale_mode?: number, shipment_mode?: number, list?: any[]} + const [submitOrderData, setSubmitOrderData] = useState() + + //获取购物车传过来的id + type orderPreParam = {shopping_cart_product_color_list:{shopping_cart_product_color_id:number}[], sale_mode:number} + const param = getParam() + const idsAndSaleModel = useRef({shopping_cart_product_color_list:[], sale_mode:0}) + useDidShow(async () => { + idsAndSaleModel.current = {shopping_cart_product_color_list:[], sale_mode:0} //初始化 + idsAndSaleModel.current.sale_mode = Number(param?.sale_mode) + param?.ids?.split('-')?.map(item => { + return idsAndSaleModel.current.shopping_cart_product_color_list?.push({ + shopping_cart_product_color_id: Number(item) + }) + }) + getSaleOrderPreView() + setSubmitOrderData((val) => ({...val, sale_mode:param?.sale_mode})) + }) + + //获取销售预览订单 + const [preViewOrder, setPreViewOrder] = useState() //获取到的原始数据 + const {fetchData} = SaleOrderPreViewApi() + const getSaleOrderPreView = async () => { + if(idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) { + let res = await fetchData(idsAndSaleModel.current) + setPreViewOrder(res.data) + } + } + + //监听获取到的数据 + useEffect(() => { + if(preViewOrder) { + formatData() + getDataList() + //当有默认地址时设置默认地址id + preViewOrder.default_address&&setSubmitOrderData((val) => ({...val, address_id:preViewOrder.default_address.id})) + } + }, [preViewOrder]) + + //格式化数据格式 + const [formatPreViewOrder, setFormatPreViewOrder] = useState() //格式化后的数据 + const formatData = () => { + setFormatPreViewOrder({ + estimate_amount: preViewOrder.estimate_amount, //预估金额 + sale_mode: preViewOrder.sale_mode, + sale_mode_name: preViewOrder.sale_mode_name, + total_colors: preViewOrder.total_colors, //总颜色数量 + total_number: preViewOrder.total_number, //总数量 + total_fabrics: preViewOrder.total_fabrics, //面料数量 + unit: preViewOrder.sale_mode == 0?'条':'m', //单位 + list: preViewOrder.product_list + }) + } + const formatPreViewOrderMemo = useMemo(() => { + return formatPreViewOrder + }, [formatPreViewOrder]) + + //格式化初始地址 + const defaultAddress = useMemo(() => { + const address = preViewOrder?.default_address + if(address) { + return { + province_name: address.province_name, + city_name: address.city_name, + district_name: address.district_name, + address_detail: address.address_detail, + id: address.id, + name: address.name, + phone: address.phone + } + } + return null + }, [preViewOrder]) + + //获取提交格式数据列表 + const getDataList = () => { + let list:{shopping_cart_product_color_id:number}[] = [] + preViewOrder.product_list?.map(item => { + item.product_colors?.map(colorItem => { + list.push({shopping_cart_product_color_id:colorItem.id}) + }) + }) + setSubmitOrderData((val) => ({...val, list})) + } + + //获取地址 + const getAddress = (e) => { + setSubmitOrderData((val) => ({...val, address_id:e.id})) + } + + const selectShipmentMode = useCallback((value) => { + setSubmitOrderData((val) => ({...val, shipment_mode:value})) + }, []) + + //获取备注 + const getRemark = useCallback((e) => { + setSubmitOrderData((val) => ({...val, remark:e})) + setShowDesc(() => false) + }, []) + + //提交按钮是否可用 + const btnStatus = useMemo(() => { + if( submitOrderData?.list?.length == 0 || !submitOrderData?.shipment_mode || (submitOrderData?.shipment_mode == 2 && !submitOrderData?.address_id)) { + return false + } else { + return true + } + }, [submitOrderData]) + + //提交订单 + const {fetchData: saleOrderFetchData} = SaleOrderApi() + const submitOrderEven = () => { + if(!submitOrderData?.address_id) { + alert.error('请选择地址') + return false + } + if(!submitOrderData?.shipment_mode) { + alert.error('请选择收货方式') + return false + } + Taro.showModal({ + title: '确定提交?', + success: async function (res) { + if (res.confirm) { + const res = await saleOrderFetchData(submitOrderData) + if(res.success) { + goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') + } else { + alert.none(res.msg) + } + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } + return ( + + + getAddress(e)} defaultValue={defaultAddress}/> + + setShowDesc(true)}> + 订单备注 + { + submitOrderData?.remark&&{submitOrderData?.remark}|| + 填写备注 + } + + + + + + {`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`} + + submitOrderEven()}>提交订单 + + setShowDesc(false)} > + getRemark(e)}/> + + + + ) + } diff --git a/src/pages/cutOrder/components/addressInfo/index.module.scss b/src/pages/cutOrder/components/addressInfo/index.module.scss new file mode 100644 index 0000000..4e9ea21 --- /dev/null +++ b/src/pages/cutOrder/components/addressInfo/index.module.scss @@ -0,0 +1,71 @@ +.order_address{ + height: 178px; + background: #ffffff; + border-radius: 20px; + display: flex; + align-items: center; + padding: 30px; + box-sizing: border-box; + margin-top: 20px; + .order_address_icon{ + font-size: 76px; + color: $color_main; + } + .order_address_text_con{ + flex:1; + padding: 0 30px; + box-sizing: border-box; + .order_address_text_title{ + font-size: $font_size_medium; + margin-top: 10px; + @include common_ellipsis; + } + .order_address_text_name{ + + align-items: center; + text{ + &:nth-child(1) { + color: #000; + font-weight: 700; + font-size: $color_font_one; + margin-right: 40px; + } + &:nth-child(2) { + color: $color_font_one; + font-size: $font_size_medium; + } + } + } + } + .updateBtn{ + font-size: $font_size_medium; + color: $color_font_three; + width: 96px; + height: 52px; + border: 2px solid #dddddd; + border-radius: 28px; + text-align: center; + line-height: 52px; + } + .order_address_text_no{ + flex: 1; + font-size: $font_size; + font-weight: 700; + margin-left: 30px; + } + .order_address_more_icon{ + color: $color_font_three; + font-size: $font_size; + } + +} +.order_address_list { + height: 900px; + .order_address_title{ + font-size: $font_size; + font-weight: 700; + width: 100%; + text-align: center; + padding: 20px 0 30px 0; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/addressInfo/index.tsx b/src/pages/cutOrder/components/addressInfo/index.tsx new file mode 100644 index 0000000..4225fea --- /dev/null +++ b/src/pages/cutOrder/components/addressInfo/index.tsx @@ -0,0 +1,76 @@ +import AddressList from "@/components/AddressList"; +import Popup from "@/components/popup"; +import { Text, View } from "@tarojs/components" +import classnames from "classnames"; +import { memo, useCallback, useEffect, useMemo, useState } from "react"; +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, //选择 + defaultValue?: AddressInfoParam|null //默认值 + disabled?: false|true //true禁用后只用于展示 +} + +export default memo(({onSelect, defaultValue = null, disabled = false}: Param) => { + const [showAddressList, setShowAddressList] = useState(false) + + useEffect(() => { + setUserInfo(() => defaultValue) + }, [defaultValue]) + + //选择地址 + const [userInfo, setUserInfo] = useState() + const getAddress = useCallback((val) => { + setShowAddressList(() => false) + setUserInfo(() => val) + onSelect?.(val) + }, []) + + //地址格式 + const formatAddress = useMemo(() => { + if(userInfo) + return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail + }, [userInfo]) + + const changeShow = () => { + if(!disabled) + setShowAddressList(() => true) + } + return ( + + changeShow()}> + + {!userInfo&& + <> + 请选择收货地址及信息 + + + ||<> + + + {userInfo?.name} + {userInfo?.phone} + + {formatAddress} + + 修改 + } + + {!disabled&& setShowAddressList(false)}> + + 请选择收货地址 + getAddress(item)}/> + + } + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/addressInfoDetail/index.module.scss b/src/pages/cutOrder/components/addressInfoDetail/index.module.scss new file mode 100644 index 0000000..2d6c306 --- /dev/null +++ b/src/pages/cutOrder/components/addressInfoDetail/index.module.scss @@ -0,0 +1,117 @@ +.order_address{ + height: 178px; + background: #ffffff; + border-radius: 20px; + display: flex; + align-items: center; + padding: 30px; + box-sizing: border-box; + margin-top: 20px; + position: relative; + .order_address_icon{ + font-size: 50px; + color: $color_main; + position: absolute; + top: 35px; + left: 20px; + } + .order_address_text_con{ + flex:1; + padding-left: 50px; + box-sizing: border-box; + height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; + .order_address_text_title{ + font-size: $font_size_medium; + margin-top: 10px; + @include common_ellipsis; + display: flex; + align-items: center; + justify-content: space-between; + .moreIconfont{ + font-size: 20px; + } + } + .order_address_text_name{ + + align-items: center; + text{ + &:nth-child(1) { + color: #000; + font-weight: 700; + font-size: $color_font_one; + margin-right: 40px; + } + &:nth-child(2) { + color: $color_font_one; + font-size: $font_size_medium; + } + } + } + } + .updateBtn{ + width:200px; + font-size: $font_size_min; + background-color: #F0F0F0; + height: 64px; + border-radius: 24px; + color: $color_font_two; + position: absolute; + bottom: 10px; + right: 10px; + z-index: 999; + .updateBtn_list{ + position: absolute; + display: flex; + z-index: 5; + width: 100%; + .updateBtn_item_select{ + color: #fff; + } + } + .updateBtn_item{ + flex:1; + text-align: center; + line-height: 64px; + } + .updateBtn_select{ + color: #fff; + background-color: $color_main; + border-radius: 24px; + position: absolute; + width: 100px; + height: 61px; + z-index: 1; + transition: all 0.3s ease-in-out; + } + + } + .order_address_text_no{ + flex: 1; + font-size: $font_size; + font-weight: 700; + margin-left: 30px; + } + .order_address_more_icon{ + color: $color_font_three; + font-size: $font_size; + } + +} +.order_address_list { + 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/cutOrder/components/addressInfoDetail/index.tsx b/src/pages/cutOrder/components/addressInfoDetail/index.tsx new file mode 100644 index 0000000..bc915ed --- /dev/null +++ b/src/pages/cutOrder/components/addressInfoDetail/index.tsx @@ -0,0 +1,126 @@ +import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order"; +import { alert } from "@/common/common"; +import { debounce } 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, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react"; +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, //选择 + defaultValue?: AddressInfoParam|null, //默认值 + disabled?: false|true, //true禁用后只用于展示 + shipment_mode?: 1|2, //1自提 2物流 + onChangeShipmentMode?: (val: number) => void, //返回收货方式 + orderId?: number //订单id +} + +export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => { + const [showAddressList, setShowAddressList] = useState(false) + + useEffect(() => { + setUserInfo(() => defaultValue) + }, [defaultValue]) + + const [userInfo, setUserInfo] = useState() + + //地址格式 + const formatAddress = useMemo(() => { + if(userInfo) + return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail + }, [userInfo]) + + const changeShow = () => { + if(receivingStatus == 2) + setShowAddressList(() => true) + } + + useEffect(() => { + setReceivingStatus(() => shipment_mode) + }, [shipment_mode]) + + //把内部方法提供给外部 + useImperativeHandle(ref, () => ({ + changeShow + })) + + //收货方法,1:自提,2物流 + const [receivingStatus, setReceivingStatus] = useState(1) + const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() + const onReceivingStatus = (value, e) => { + e.stopPropagation() + changeReceivingStatus(value) + } + const changeReceivingStatus = debounce(async (value) => { + alert.loading('正在修改') + const res = await shipmentModeFetchData({id: orderId, shipment_mode:value}) + if(res.success) { + alert.success('收货方式修改成功') + onChangeShipmentMode?.(value) + setReceivingStatus(value) + } else { + alert.none(res.msg) + } + }, 10) + + //修改地址 + const [addressId, setAddressId] = useState(0) + const {fetchData: addressFetchData} = EditSaleOrderAddressApi() + const getAddress = async (value) => { + alert.loading('正在修改') + const res = await addressFetchData({id: orderId, address_id: value.id}) + if(res.success) { + alert.success('地址修改成功') + onSelect?.(value) + setShowAddressList(() => false) + setAddressId(value.id) + setUserInfo(() => value) + } else { + alert.none(res.msg) + } + } + + return ( + + changeShow()}> + + + + {formatAddress} + {(receivingStatus == 2)&&} + + + {userInfo?.name} + {userInfo?.phone} + + + + + onReceivingStatus(1,e)}>自提 + onReceivingStatus(2,e)}>物流 + + + + + setShowAddressList(false)}> + + 请选择收货地址 + + + + + + + ) +})) \ No newline at end of file diff --git a/src/pages/cutOrder/components/amountShow/index.module.scss b/src/pages/cutOrder/components/amountShow/index.module.scss new file mode 100644 index 0000000..647e203 --- /dev/null +++ b/src/pages/cutOrder/components/amountShow/index.module.scss @@ -0,0 +1,35 @@ +.order_price_num{ + color: $color_main; + font-weight: 700; + text{ + &:nth-child(1) { + font-size: $font_size_min; + } + &:nth-child(2) { + font-size: $font_size; + } + &:nth-child(3) { + font-size: $font_size_medium; + } + } +} +.emphasis_num{ + .price_text{ + &:nth-child(2) { + font-size: $font_size_big; + } + } +} +.emphasis_num_big{ + .price_text{ + &:nth-child(1) { + font-size: $font_size_big; + } + &:nth-child(2) { + font-size: 60px; + } + &:nth-child(1) { + font-size: $font_size_big; + } + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/amountShow/index.tsx b/src/pages/cutOrder/components/amountShow/index.tsx new file mode 100644 index 0000000..877f7df --- /dev/null +++ b/src/pages/cutOrder/components/amountShow/index.tsx @@ -0,0 +1,28 @@ +import { Text, View } from "@tarojs/components"; +import { memo, useCallback } from "react"; +import styles from './index.module.scss' +import classnames from "classnames"; + +type Param = { + number: number, //数字 + status: 0|1|2 //0 小型,1中型,2大 +} +export default memo(({number = 0, status = 1}:Param) => { + const priceDom = useCallback(() => { + let res = number.toFixed(2).split('.') + let int_num = parseInt(res[0]) + '' + let decimals_num = res[1] + return ( + <> + ¥ + {Number(int_num).toLocaleString()} + .{decimals_num} + + ) + }, [number]) + return ( + + {priceDom()} + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/estimatedAmount/index.module.scss b/src/pages/cutOrder/components/estimatedAmount/index.module.scss new file mode 100644 index 0000000..4b4a958 --- /dev/null +++ b/src/pages/cutOrder/components/estimatedAmount/index.module.scss @@ -0,0 +1,70 @@ +.order_price{ + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + &:nth-last-child(n+2) { + margin-bottom: 30px; + } + .order_price_text{ + font-size: $font_size_medium; + // margin-right: 10px; + display: flex; + .iconfont_msg{ + position: relative; + } + .miconfont{ + font-size: 26px; + font-weight: normal; + margin-left: 5px; + } + .message{ + position: absolute; + top: -50px; + background: #A8B3BD; + z-index: 9; + min-height: 50px; + border-radius: 10px; + padding: 10px; + box-sizing: border-box; + &::before{ + z-index: 1; + position: absolute; + bottom: -7px; + left: 10px; + width: 15px; + height: 15px; + content: " "; + transform: rotate(45deg); + background: #A8B3BD; + box-sizing: border-box; + } + } + } + .emphasis{ + font-weight: 700; + } + .order_price_num{ + color: $color_main; + font-weight: 700; + text{ + &:nth-child(1) { + font-size: $font_size_min; + } + &:nth-child(2) { + font-size: 26px; + } + &:nth-child(3) { + font-size: $font_size_medium; + } + } + } + .emphasis_num{ + text{ + &:nth-child(2) { + font-size: $font_size_big; + } + } + } + +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/estimatedAmount/index.tsx b/src/pages/cutOrder/components/estimatedAmount/index.tsx new file mode 100644 index 0000000..04bc49a --- /dev/null +++ b/src/pages/cutOrder/components/estimatedAmount/index.tsx @@ -0,0 +1,29 @@ +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useEffect, useMemo } from "react" +import {formatKbPrice} from '@/common/common' +import classnames from "classnames"; +import styles from './index.module.scss' +import AmountShow from "../amountShow"; +type Param = { + style?: Object, + number?: number, + title?: string, + titleStatus?: true|false, //true 标题加大加深 + numberStatus?: 0|1|2, //数字尺寸 +} +export default memo(({style, number = 0, titleStatus = true, title = '', numberStatus = 1}:Param) => { + return ( + <> + + + {title} + + + {/* 123123123121212312312312312 */} + + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/kindList/index.module.scss b/src/pages/cutOrder/components/kindList/index.module.scss new file mode 100644 index 0000000..2d9b040 --- /dev/null +++ b/src/pages/cutOrder/components/kindList/index.module.scss @@ -0,0 +1,108 @@ + +.orders_list_title{ + padding: 20px 20px 10px 20px; + color: $color_font_two; + font-size: $font_size_medium; +} +.orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .order_list{ + &:nth-child(n+2) { + margin-top: 30px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } +} diff --git a/src/pages/cutOrder/components/kindList/index.tsx b/src/pages/cutOrder/components/kindList/index.tsx new file mode 100644 index 0000000..b2491f8 --- /dev/null +++ b/src/pages/cutOrder/components/kindList/index.tsx @@ -0,0 +1,169 @@ +import { ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + status: number, //订单状态 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` + }, [order]) + + const { + SaleOrderStatusBooking, // 待接单 + SaleOrderStatusArranging, // 配布中 + SaleOrderStatusArranged, // 已配布 + SaleOrderStatusWaitingPayment, // 待付款 + SaleOrderStatusWaitingDelivery, // 待发货 + SaleOrderStatusWaitingReceipt, // 待收货 + SaleOrderStatusAlreadyReceipt, // 已收货 + SaleOrderStatusComplete, // 已完成 + SaleOrderStatusRefund, // 已退款 + SaleOrderStatusCancel, // 已取消 + } = ORDER_STATUS + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value], + label:'预估金额', + field: 'estimate_amount' + }, + { + id:2, + value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'合计金额', + field: 'total_sale_price' + }, + { + id:3, + value:[SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'空差优惠', + field: 'total_weight_error_discount' + }, + { + id:4, + value:[ SaleOrderStatusWaitingPayment.value], + label:'应付金额', + field: 'total_should_collect_money' + }, + { + id:5, + value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + label:'实付金额', + field: 'actual_amount' + } + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo, status) => { + return priceInfo.value.includes(status) + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + //确认订单 + if(comfirm == true) { + return + } + //订单为取消订单状态 + if(order?.status == SaleOrderStatusCancel.value) { + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item, order?.the_previous_status)&&} + }) + } + + ) + } else { + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item, order?.status)&&} + }) + } + + ) + } + }, [order]) + + return ( + <> + {numText} + + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + ¥{standardPrice(colorItem.sale_price)} + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/offlinePay/index.module.scss b/src/pages/cutOrder/components/offlinePay/index.module.scss new file mode 100644 index 0000000..f84e995 --- /dev/null +++ b/src/pages/cutOrder/components/offlinePay/index.module.scss @@ -0,0 +1,46 @@ +$top:170px; +.offlinePay_main{ + .offlinePay_con{ + padding: 20px; + background-color: #F6F6F6; + border-radius: 20px; + .miconfont_title{ + transform: rotate(-180deg); + position: absolute; + left: 20px; + top: 27px; + font-size: 37px; + color: $color_font_three; + z-index: 99; + } + } + .title{ + font-size: $font_size_big; + color: #000000; + text-align: center; + font-weight: 700; + position: relative; + + } + + .offlinePay_list{ + border-radius: 10px; + padding: 60px 0; + .offlinePay_con_text{ + font-size: $font_size; + font-weight: 700; + } + } + .btns{ + background: #007aff; + border-radius: 40px; + width: 668px; + height: 82px; + text-align: center; + line-height: 80px; + width: 100%; + color: #fff; + font-size: 32px; + margin-top: 30px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/offlinePay/index.tsx b/src/pages/cutOrder/components/offlinePay/index.tsx new file mode 100644 index 0000000..4022374 --- /dev/null +++ b/src/pages/cutOrder/components/offlinePay/index.tsx @@ -0,0 +1,52 @@ +import { Text, View } from "@tarojs/components"; +import { memo } from "react"; +import AmountShow from "../amountShow"; +import classnames from "classnames"; +import styles from './index.module.scss' + +import MCheckbox from "@/components/checkbox"; +import Popup from "@/components/popup"; +import SearchInput from "@/components/searchInput"; +import Taro from "@tarojs/taro"; + +type Param = { + show?: true|false, + onClose?: () => void +} +export default memo(({show = true, onClose}:Param) => { + //复制功能 + const clipboardData = () => { + Taro.setClipboardData({ + data: '开户名称:佛山市浩川盛世科技有限公司; 开户银行:招商银行汾江支行; 转账汇款账号:62062342120001221231212', + success: function (res) { + Taro.showToast({ + icon: 'none', + title: '复制成功' + }) + } + }) + } + return ( + + + + + 线下汇款 + + + 佛山市浩川盛世科技有限公司 + + + 招商银行汾江支行 + + + 62062342120001221231212 + + + 复制信息 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState copy/index.module.scss b/src/pages/cutOrder/components/orderState copy/index.module.scss new file mode 100644 index 0000000..78bda44 --- /dev/null +++ b/src/pages/cutOrder/components/orderState copy/index.module.scss @@ -0,0 +1,18 @@ +.order_flow_state{ + display: flex; + align-items: center; + padding: 0 30px; + height: 116px; + background-color: #fff; + border-radius: 20px; + .order_flow_state_text{ + color: $color_main; + font-size:$font_size; + font-weight: 700; + } + .order_flow_state_desc{ + color: $color_font_three; + font-size: $font_size_medium; + margin-left: 50px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState copy/index.tsx b/src/pages/cutOrder/components/orderState copy/index.tsx new file mode 100644 index 0000000..58fec4d --- /dev/null +++ b/src/pages/cutOrder/components/orderState copy/index.tsx @@ -0,0 +1,14 @@ +import { View } from "@tarojs/components" +import styles from './index.module.scss' + +export default ({ + state = '', + desc = '' +}) => { + return ( + + {state} + {desc} + + ) +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState/index.module.scss b/src/pages/cutOrder/components/orderState/index.module.scss new file mode 100644 index 0000000..90dbcbb --- /dev/null +++ b/src/pages/cutOrder/components/orderState/index.module.scss @@ -0,0 +1,105 @@ +.order_flow_state{ + background-color: #fff; + border-radius: 20px; + padding: 20px; + box-sizing:border-box; + position: relative; + overflow: hidden; + .order_status_list{ + max-height: 250px; + overflow: hidden; + transition: all 0.3s ease-in-out; + } + .order_status_list_show { + max-height: 1000px !important; + } + .order_status_item{ + position: relative; + padding-left: 50px; + &:nth-last-child(n+2) { + padding-bottom: 30px; + } + .order_status_tail_end, .order_status_tail{ + width: 15px; + height: 15px; + border: 2px solid $color_main; + background-color: #fff; + border-radius: 50%; + position:absolute; + left: 0; + top: 10px; + z-index: 10; + } + .order_status_tail_end{ + background-color: $color_main; + } + .order_status_line{ + border-left: 2px solid $color_main; + height: 100%; + top: 10px; + left: 9px; + position: absolute; + z-index: 1; + } + .order_status_content{ + display: flex; + align-items: center; + .order_status_title{ + color: $color_font_two; + font-size: $font_size; + font-weight: 700; + } + .order_status_time{ + color: $color_font_two; + font-size: $font_size_medium; + padding: 0 20px; + } + .order_status_tag{ + font-size: $font_size_min; + background: #F0F0F0; + border-radius: 6px; + padding: 5px 10px; + color: $color_font_two; + } + .order_status_select{ + color: $color_main; + } + .order_status_tag_select{ + color: $color_main; + } + } + .order_status_des{ + color: $color_font_two; + font-size: $font_size_medium; + } + .order_status_des_select{ + color: $color_font_one; + } + } + .more{ + width: 100%; + text-align: center; + font-size: $font_size_min; + color: $color_font_one; + padding-top: 20px; + .miconfonts{ + display: inline-block; + font-size: 25px; + transform:rotate(90deg); + } + .open_miconfonts{ + transform:rotate(-90deg); + } + } + .image_tag{ + width: 140px; + height: 144px; + .image{ + width: 140px; + height: 144px; + } + position: absolute; + top: -10px; + right: -10px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState/index.tsx b/src/pages/cutOrder/components/orderState/index.tsx new file mode 100644 index 0000000..18ac43d --- /dev/null +++ b/src/pages/cutOrder/components/orderState/index.tsx @@ -0,0 +1,63 @@ +import { Image, Text, View } from "@tarojs/components" +import { memo, useMemo, useState } from "react" +import styles from './index.module.scss' +import classnames from "classnames"; +import { formatDateTime, formatImgUrl } from "@/common/fotmat"; +import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; + + + +type Param = { + list: { + status: string, + time: string, + tag: string, + desc: string + }[], + payment_method: 0|PAYMENT_METHOD_PARAM, + +} + +//支付方式枚举 +const { + PaymentMethodAccountPeriod, + PaymentMethodCashOnDelivery, +} = PAYMENT_METHOD + +export default memo(({list = [], payment_method = 0}:Param) => { + + const [showMore, setShowMore] = useState(false) + const changeMore = () => { + setShowMore(() => !showMore) + } + const dataList = useMemo(() => { + return list.reverse() + }, [list]) + + return ( + <> + {(dataList.length > 0)&& + + {dataList.map((item, index) => + {(dataList.length > 1)&&} + {(dataList.length != (index + 1))&&} + + {item.status} + {formatDateTime(item.time)} + {/* {item.tag} */} + + {item.desc} + )} + + {(dataList.length > 2) && changeMore()}> + {showMore&&'收起详情'||'点击查看详情'} + + } + + {(payment_method == PaymentMethodCashOnDelivery.value)&&} + {(payment_method == PaymentMethodAccountPeriod.value)&&} + + } + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/payment/index.module.scss b/src/pages/cutOrder/components/payment/index.module.scss new file mode 100644 index 0000000..340b0ed --- /dev/null +++ b/src/pages/cutOrder/components/payment/index.module.scss @@ -0,0 +1,126 @@ +$top:190px; +.payment_main{ + .payment_con{ + padding: 20px; + background-color: #F6F6F6; + border-radius: 20px; + .miconfont_title{ + transform: rotate(-180deg); + position: absolute; + left: 20px; + top: 27px; + font-size: 37px; + color: $color_font_three; + z-index: 99; + } + + } + .title{ + font-size: $font_size_big; + color: #000000; + text-align: center; + font-weight: 700; + position: relative; + + } + .amount{ + text-align: center; + padding: 25px 0; + } + + .payment_list{ + background-color: #fff; + // box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.16); + min-height: 300px; + border-radius: 10px; + padding-bottom: 100px; + position: relative; + background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat , + radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat; + filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16)); + position: relative; + &::before{ + content: ''; + position: absolute; + border-bottom: 3px dashed #ccc; + top: $top; + width: calc(100% - 100px); + left:0; + right: 0; + margin: auto; + + } + .payment_list_top_border{ + height: 32px; + width: 100%; + background: linear-gradient(215deg,#cde5ff 2%, #cde5ff 2%, #68b4ff 72%); + border-radius: 10px 10px 0px 0px; + } + .payment_list_title{ + text-align: center; + padding: 30px 0 50px 0; + font-size: $font_size; + color: $color_font_three; + .payment_list_title_price_item{ + display: flex; + justify-content: space-between; + padding: 0 90px; + &:nth-child(1) { + margin-bottom: 15px; + } + } + text{ + &:nth-child(2) { + color: $color_main; + } + } + } + .payment_list_con{ + padding: 20px 30px 0 30px; + .payment_list_item{ + display: flex; + justify-content: space-between; + align-items: center; + height: 123px; + &:nth-last-child(n+2) { + border-bottom: 2px solid #F3F3F3; + } + } + .payment_list_item_left{ + display: flex; + flex-direction: column; + font-size: $font_size; + .payment_list_item_left_name{ + display: flex; + align-items: center; + } + .miconfont{ + font-size: 30px; + color: #FFC300; + padding-right: 10px; + } + .payment_list_item_left_price{ + font-size: $font_size_min; + color: $color_font_two; + padding-left: 35px; + padding-top: 5px; + } + } + .miconfont_more{ + font-size: 20px; + } + } + } + .btns{ + background: #007aff; + border-radius: 40px; + width: 668px; + height: 82px; + text-align: center; + line-height: 80px; + width: 100%; + color: #fff; + font-size: 32px; + margin-top: 30px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/payment/index.tsx b/src/pages/cutOrder/components/payment/index.tsx new file mode 100644 index 0000000..86d4306 --- /dev/null +++ b/src/pages/cutOrder/components/payment/index.tsx @@ -0,0 +1,185 @@ +import { Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useMemo, useState } from "react"; +import AmountShow from "../amountShow"; +import classnames from "classnames"; +import styles from './index.module.scss' + +import MCheckbox from "@/components/checkbox"; +import Popup from "@/components/popup"; +import OfflinePay from "../offlinePay"; +import ScanPay from "../scanPay"; +import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay"; +import { formatPriceDiv } from "@/common/fotmat"; +import {alert} from "@/common/common" +import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; + +type Param = { + show?: true|false, + onClose?: () => void, + onSubmitSuccess?: () => void, //支付成功 + orderInfo?: OrderInfo +} + +type OrderInfo = { + orderId: number, //应付单id + payment_method: 0|PAYMENT_METHOD_PARAM //支付方式 +} + +type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款 +export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => { + + //提交参数 + const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({ + id:0, + payment_method: null + }) + + //线下付款 + const [offlinePayShow, setofflinePayShow] = useState(false) + const onShowOfflinePay = () => { + setofflinePayShow(true) + onClose?.() + } + + //扫码支付 + const [scanPayShow, setScanPayShow] = useState(false) + const onShowScanPay = () => { + setScanPayShow(true) + onClose?.() + } + + //获取支付方式数据 + const [payInfo, setPayInfo] = useState() + const {fetchData: orderFetchData} = GetOrderPayApi() + const getOrderPay = async () => { + let {data} = await orderFetchData({id: orderInfo?.orderId}) + setPayInfo(() => data) + } + useEffect(() => { + if(show&&orderInfo?.orderId) { + setSubmitData((val) => ({...val, id:orderInfo.orderId})) + getOrderPay() + } + }, [show, orderInfo]) + + //预存款选择 + const advanceSelectData = useCallback((val) => { + setSubmitData((e) => ({...e, payment_method:val})) + }, []) + + //账期选择 + const periodSelectData = (val) => { + setSubmitData((e) => ({...e, payment_method:val})) + } + + //提交支付 + const {fetchData: submitFetchData} = SubmitOrderPayApi() + const submitPay = async () => { + if(submitData.payment_method === null) { + alert.error('请选择支付方式') + return false + } + alert.loading('正在支付') + let res = await submitFetchData(submitData) + if(res.success) { + alert.success('支付成功') + onSubmitSuccess?.() + } else { + alert.none(res.msg) + } + } + + //预付款 + const advance_payment = useMemo(() => { + const price = payInfo?.should_collect_money - payInfo?.amount_paid + return ( + {(payInfo?.advance_deposit_balance < price)&&'余额不足,' }剩余 ¥{formatPriceDiv(payInfo?.advance_deposit_balance)} + ) + }, [payInfo]) + + //账期 + const account_peyment = useMemo(() => { + const price = payInfo?.should_collect_money - payInfo?.amount_paid + return ( + {(payInfo?.account_period_credit_available_line < price)&&'额度不足, '}剩余 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)} + ) + }, [payInfo]) + + //支付方式枚举 + const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD + + return ( + + + + + 订单支付 + + + + + + + {/* 向商家发起支付 */} + + + 订单金额 + ¥{formatPriceDiv(payInfo?.should_collect_money)} + + + 已付金额 + ¥{formatPriceDiv(payInfo?.amount_paid)} + + + + + + + + + 预存款 + + {advance_payment} + + advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/> + + {(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&& + + + + {payInfo?.account_period}天账期 + + {/* 可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)} */} + {account_peyment} + + periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/> + } + + + + + 线下汇款 + + + + + + + + + 扫码支付 + + + + + + + 确认交易 + + + setofflinePayShow(false)}/> + setScanPayShow(false)}/> + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/remark/index.module.scss b/src/pages/cutOrder/components/remark/index.module.scss new file mode 100644 index 0000000..d624050 --- /dev/null +++ b/src/pages/cutOrder/components/remark/index.module.scss @@ -0,0 +1,48 @@ +.order_popup{ + display: flex; + flex-direction: column; + align-items: center; + padding: 20px 0; + .order_popup_title{ + color: $font_size_big; + font-weight: 700; + color: #000000; + padding-bottom: 20px; + } + .order_popup_input{ + width: 100%; + padding: 0 25px; + box-sizing: border-box; + margin-top: 43px; + position: relative; + .descDataNum{ + position: absolute; + right: 40px; + bottom: 10px; + height: 39px; + font-size: $font_size_medium; + color: $color_font_two; + } + textarea{ + background-color: #f3f3f3; + border-radius: 10px; + width: 100%; + height: 313px; + padding: 20px; + padding-bottom: 50px; + box-sizing: border-box; + font-size: $font_size; + border: 2px solid #e6e6e6; + } + } + .order_save_address{ + height: 82px; + background: #007aff; + border-radius: 40px; + width: 668px; + text-align: center; + line-height: 82px; + color: #fff; + margin-top: 60px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/remark/index.tsx b/src/pages/cutOrder/components/remark/index.tsx new file mode 100644 index 0000000..14d981b --- /dev/null +++ b/src/pages/cutOrder/components/remark/index.tsx @@ -0,0 +1,38 @@ +import Popup from "@/components/popup" +import { Textarea, View } from "@tarojs/components" +import { useCallback, useState } from "react" +import styles from './index.module.scss' + +type Param = { + onBlur?: (val:any) => void + onSave?: (val: string) => void +} +export default ({onBlur, onSave}:Param) => { + 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 setSave = () => { + onSave?.(descData.value) + } + return ( + + 编辑备注 + + + {descData.number}/{descData.count} + + setSave()}>保存 + + ) +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/scanPay/index.module.scss b/src/pages/cutOrder/components/scanPay/index.module.scss new file mode 100644 index 0000000..dcb356d --- /dev/null +++ b/src/pages/cutOrder/components/scanPay/index.module.scss @@ -0,0 +1,54 @@ +$top:170px; +.scanPay_main{ + .scanPay_con{ + padding: 20px; + background-color: #F6F6F6; + border-radius: 20px; + .miconfont_title{ + transform: rotate(-180deg); + position: absolute; + left: 20px; + top: 27px; + font-size: 37px; + color: $color_font_three; + z-index: 99; + + } + } + .title{ + font-size: $font_size_big; + color: #000000; + text-align: center; + font-weight: 700; + position: relative; + } + .desc{ + font-size: $font_size_min; + color: $color_main; + text-align: center; + padding: 10px 0; + .miconfont{ + font-size: 25px; + } + } + + .scanPay_list{ + border-radius: 10px; + height: 900px; + image{ + width: 100%; + } + } + .btns{ + background: #007aff; + border-radius: 40px; + width: 668px; + height: 82px; + text-align: center; + line-height: 80px; + width: 100%; + color: #fff; + font-size: 32px; + margin-top: 30px; + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/scanPay/index.tsx b/src/pages/cutOrder/components/scanPay/index.tsx new file mode 100644 index 0000000..d6fb06e --- /dev/null +++ b/src/pages/cutOrder/components/scanPay/index.tsx @@ -0,0 +1,161 @@ +import { Image, ScrollView, Text, View } from "@tarojs/components"; +import { memo, useEffect, useRef, useState } from "react"; +import classnames from "classnames"; +import styles from './index.module.scss' +import Popup from "@/components/popup"; +import Taro from "@tarojs/taro"; +import { alert } from "@/common/common"; +import { formatImgUrl } from "@/common/fotmat"; +import useCheckAuthorize from "@/use/useCheckAuthorize"; +import { GetPayCode } from "@/api/onlinePay"; +import LoadingCard from "@/components/loadingCard"; + + +type Param = { + show?: true|false, + onClose?: () => void +} + + +type Item = { + product_code: string, + product_name: string, + product_color_code: string, + product_color_name: string, + num: string, + weight: string, + sale_price: string, + total_price: string +} +type CodeParam = { + title: string, + company: string, + order_type: string, + sale_user: string, + order_created_time: string, + order_no: string, + department: string, + shipment_mode: string, + target_user_name: string, + target_address: string, + target_description: string, + pay_account: string, + bank_account_name: string, + bank_name: string, + pay_type: string, + client: string, + phone: string, + order_total_length: string, + order_total_price: string, + qrcode: string, + order_total_weight: string, + list: Item[] +} +export default memo(({show = true, onClose}:Param) => { + + //获取支付二维码 + const [payCodeImage, setPayCodeImage] = useState('') + const fileData = useRef({ + filePath: '', + base64: '' + }) + const {fetchData, state} = GetPayCode() + const getCore = async () => { + let res = await fetchData({ + title: "面料销售电子确认单", + company: "什么什么公司123", + order_type: "散剪", + sale_user: "小崔", + order_created_time:"2022/02/01 12:32:13", + order_no:"XS-211005888", + department:"嘻嘻嘻", + shipment_mode:"自提", + target_user_name:"大崔", + target_address:"阿斯顿发斯蒂芬", + target_description:"无", + pay_account:"1234567890123450001", + bank_account_name:"佛山市浩川长盛科技有限公司", + bank_name:"招商银行佛山分行禅城支行", + pay_type:"现结", + client:"客户名称", + phone:"15818085802", + order_total_length:"12", + order_total_price:"63000", + qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888", + order_total_weight:"300.00", + list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}] + }) + const base64 = res.data.base64 + setPayCodeImage(() => base64) + const time = new Date().valueOf() + const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []; + let filePath = Taro.env.USER_DATA_PATH + '/img' + time +'.'+ format + fileData.current.filePath = filePath + fileData.current.base64 = bodyData + const save = Taro.getFileSystemManager() + save.writeFile({ + filePath: fileData.current.filePath, + data: fileData.current.base64, + encoding: 'base64', + }) + + } + useEffect(() => { + if(show) + getCore() + }, [show]) + + //检查是否开启保存图片权限 + const {check} = useCheckAuthorize({scope:'scope.writePhotosAlbum', msg:'您没授权,无法保存图片'}) + const saveImageCheck = async () => { + const res = await check() + res&&saveImage() + } + + //保存图片 + const saveImage = () => { + alert.loading('正在保存图片') + Taro.saveImageToPhotosAlbum({ + filePath: fileData.current.filePath, + success: function (res) { + alert.success('图片保存成功') + }, + fail: function (err) { + console.log('err::', err) + } + }) + } + + //预览图片 + const showImage = () => { + console.log('fileData.current.filePath::', fileData.current.filePath) + Taro.previewImage({ + current: fileData.current.filePath, // 当前显示 + urls: [fileData.current.filePath] // 需要预览的图片http链接列表 + }) + } + + //复制功能 + return ( + + + + + 扫码支付 + + + 扫码支付成功后,自动更新状态 + + + {(state.loading)&&|| + + + } + + 保存电子确认单 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/shipmentMode/index.module.scss b/src/pages/cutOrder/components/shipmentMode/index.module.scss new file mode 100644 index 0000000..5f818f9 --- /dev/null +++ b/src/pages/cutOrder/components/shipmentMode/index.module.scss @@ -0,0 +1,33 @@ + + .order_title{ + display: flex; + align-items: center; + padding: 20px 30px; + box-sizing: border-box; + background-color: #fff; + height: 116px; + border-radius: 20px; + margin-top: 20px; + text{ + flex:1; + font-size: $font_size; + font-weight: 700; + } + .order_status{ + background-color: #F0F0F0; + width: 148px; + height: 55px; + color: $color_font_three; + text-align: center; + line-height: 55px; + font-size: $font_size_medium; + border-radius: 30px; + &:nth-last-child(1) { + margin-left: 20px; + } + } + .order_status_selected{ + color: $color_main; + border: 1px solid $color_main; + } + } \ No newline at end of file diff --git a/src/pages/cutOrder/components/shipmentMode/index.tsx b/src/pages/cutOrder/components/shipmentMode/index.tsx new file mode 100644 index 0000000..235591c --- /dev/null +++ b/src/pages/cutOrder/components/shipmentMode/index.tsx @@ -0,0 +1,28 @@ +import { Text, View } from "@tarojs/components" +import styles from './index.module.scss' +import classnames from "classnames"; +import { memo, useRef, useState } from "react"; + +type Param = { + onSelect?:(val:number) => void +} +export default memo(({onSelect}: Param) => { + //收货方法 1:自提,2:物流 + const shipmentMode = useRef([ + {value:1, label:'上门自提', selected:false}, + {value:2, label:'物流', selected:false} + ]) + const [selectValue, setSelectValue] = useState() + const selectShipmentMode = (value) => { + setSelectValue(() => value) + onSelect?.(value) + } + return ( + + 收货方式 + {shipmentMode.current.map(item => { + return selectShipmentMode(item.value)}>{item.label} + })} + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/submitOrderBtn/index.module.scss b/src/pages/cutOrder/components/submitOrderBtn/index.module.scss new file mode 100644 index 0000000..c5ac9ed --- /dev/null +++ b/src/pages/cutOrder/components/submitOrderBtn/index.module.scss @@ -0,0 +1,69 @@ +.order_price{ + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + &:nth-last-child(n+2) { + margin-bottom: 30px; + } + .order_price_text{ + font-size: $font_size_medium; + // margin-right: 10px; + display: flex; + .iconfont_msg{ + position: relative; + } + .miconfont{ + font-size: 30px; + font-weight: normal; + } + .message{ + position: absolute; + top: -50px; + background: #A8B3BD; + z-index: 9; + min-height: 50px; + border-radius: 10px; + padding: 10px; + box-sizing: border-box; + &::before{ + z-index: 1; + position: absolute; + bottom: -7px; + left: 10px; + width: 15px; + height: 15px; + content: " "; + transform: rotate(45deg); + background: #A8B3BD; + box-sizing: border-box; + } + } + } + .emphasis{ + font-weight: 700; + } + .order_price_num{ + color: $color_main; + font-weight: 700; + text{ + &:nth-child(1) { + font-size: $font_size_min; + } + &:nth-child(2) { + font-size: 26px; + } + &:nth-child(3) { + font-size: $font_size_medium; + } + } + } + .emphasis_num{ + text{ + &:nth-child(2) { + font-size: $font_size_big; + } + } + } + +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/submitOrderBtn/index.tsx b/src/pages/cutOrder/components/submitOrderBtn/index.tsx new file mode 100644 index 0000000..20ed202 --- /dev/null +++ b/src/pages/cutOrder/components/submitOrderBtn/index.tsx @@ -0,0 +1,40 @@ +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useEffect, useMemo } from "react" +import {formatKbPrice} from '@/common/common' +import classnames from "classnames"; +import styles from './index.module.scss' +type Param = { + style?: Object, + number?: number +} +export default memo(({style, number = 0}:Param) => { + const priceDom = useCallback(() => { + let res = number.toFixed(2).split('.') + let int_num = parseInt(res[0]) + '' + let decimals_num = res[1] + return ( + <> + ¥ + {Number(int_num).toLocaleString()} + .{decimals_num} + + ) + }, [number]) + return ( + <> + + + 预估金额 + + + {/* 123123123121212312312312312 */} + + + + {priceDom()} + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/weightMemo/index.module.scss b/src/pages/cutOrder/components/weightMemo/index.module.scss new file mode 100644 index 0000000..3c74511 --- /dev/null +++ b/src/pages/cutOrder/components/weightMemo/index.module.scss @@ -0,0 +1,39 @@ + +.weight_memo{ + background-color: #fff; + border-radius: 20px; + padding: 0 20px; + .weight_memo_item{ + display: flex; + justify-content: space-between; + height: 130px; + &:nth-child(1) { + border-bottom: 1px solid #f3f3f3; + } + .title, .desc{ + display: flex; + align-items: center; + } + .title { + font-size: $font_size; + font-weight: 700; + } + .desc{ + color: $color_font_two; + font-size: $font_size_medium; + } + .miconfont_check, .miconfont_custom{ + font-size: 37px; + color: $color_main; + font-weight: normal; + padding-right: 10px; + } + .miconfont_custom{ + color:#FFC300; + } + .miconfont_more{ + font-size: 30px; + padding-left: 10px; + } + } +} \ No newline at end of file diff --git a/src/pages/cutOrder/components/weightMemo/index.tsx b/src/pages/cutOrder/components/weightMemo/index.tsx new file mode 100644 index 0000000..7cbfd13 --- /dev/null +++ b/src/pages/cutOrder/components/weightMemo/index.tsx @@ -0,0 +1,36 @@ +import Popup from "@/components/popup" +import { Text, Textarea, View } from "@tarojs/components" +import { memo, useCallback, useState } from "react" +import styles from './index.module.scss' +import classnames from "classnames"; + +type Param = { + onCheck?: () => void + onCustom?: () => void +} +export default memo(({onCheck, onCustom}:Param) => { + return ( + + onCheck?.()}> + + + 陆盈纺织 + + + 查看原码单 + + + + onCustom?.()}> + + + 我的码单 + + + 自定义 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/cutOrder/index.config.ts b/src/pages/cutOrder/index.config.ts new file mode 100644 index 0000000..030cb10 --- /dev/null +++ b/src/pages/cutOrder/index.config.ts @@ -0,0 +1,6 @@ +export default { + navigationBarTitleText: '订单详情', + enablePullDownRefresh: true, + backgroundTextStyle: 'dark', + enableShareAppMessage: true, +} diff --git a/src/pages/cutOrder/index.module.scss b/src/pages/cutOrder/index.module.scss new file mode 100644 index 0000000..87ea5e5 --- /dev/null +++ b/src/pages/cutOrder/index.module.scss @@ -0,0 +1,133 @@ +.order_main{ + min-height: 100%; + background-color:$color_bg_one; + padding: 20px; + padding-bottom: 190px; + box-sizing: border-box; + + .order_title{ + display: flex; + align-items: center; + padding: 20px 30px; + box-sizing: border-box; + background-color: #fff; + height: 116px; + border-radius: 20px; + margin-top: 20px; + text{ + flex:1; + font-size: $font_size; + font-weight: 700; + } + .order_status{ + background-color: #F0F0F0; + width: 148px; + height: 55px; + color: $color_font_three; + text-align: center; + line-height: 55px; + font-size: $font_size_medium; + border-radius: 30px; + &:nth-last-child(1) { + margin-left: 20px; + } + } + } + .order_desc{ + display: flex; + align-items: center; + background-color: #fff; + padding: 20px; + min-height: 116px; + border-radius: 20px; + margin-top: 20px; + box-sizing: border-box; + .order_desc_con{ + width: 150px; + font-size: $font_size; + font-weight: 700; + } + .order_desc_text, .order_desc_text_hint{ + font-size: $font_size_medium; + color: $color_font_two; + margin-right: 10px; + flex:1; + word-break:break-all; + } + .order_desc_text_hint{ + text-align: right; + } + .miconfont{ + font-size: 20px; + color: $color_font_two; + } + } + .submit_order{ + display: flex; + position: fixed; + bottom: 0; + left: 0; + justify-content: flex-end; + width: 100%; + align-items: center; + background-color: #fff; + box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); + padding: 20px 20px; + box-sizing: border-box; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + .order_btn { + width: 152px; + height: 72px; + border: 2px solid #dddddd; + border-radius: 46px; + display: flex; + justify-content: center; + align-items: center; + color: $color_font_three; + &:nth-child(n+2) { + margin-left: 34px; + } + } + .order_btn_select{ + color: $color_main; + border: 2px solid $color_main; + } + .order_number_desc{ + font-size: $font_size_medium; + color: $color_font_two; + } + } + .order_info{ + background-color: #fff; + margin-top: 20px; + border-radius: 20px; + padding: 20px; + .order_info_title{ + font-size: $font_size; + font-weight: 700; + margin-bottom: 20px; + + } + .order_num{ + display: flex; + justify-content: space-between; + align-items: center; + .order_num_btn{ + font-size: $font_size_medium; + padding: 5px 10px; + border: 2px solid #007cf7; + border-radius: 10px; + color: $color_main; + } + } + text{ + font-size: $font_size; + } + + } + .weight_memo_con{ + margin-bottom: 20px; + } + +} \ No newline at end of file diff --git a/src/pages/cutOrder/index.tsx b/src/pages/cutOrder/index.tsx new file mode 100644 index 0000000..582f333 --- /dev/null +++ b/src/pages/cutOrder/index.tsx @@ -0,0 +1,229 @@ +import { + GetSaleOrderDetailApi, + EditSaleOrderRemarkApi, + CancelOrderApi +} from "@/api/order"; +import { GetOrderPayApi } from "@/api/orderPay"; +import { alert, goLink } from "@/common/common"; +import { ORDER_STATUS } from "@/common/enum"; +import { formatDateTime, formatPriceDiv } from "@/common/fotmat"; +import OrderBtns from "@/components/orderBtns"; +import Popup from "@/components/popup"; +import SearchInput from "@/components/searchInput"; +import { Text, Textarea, View } from "@tarojs/components" +import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; +import classnames from "classnames"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import order from "../orderList/components/order"; +import AddressInfoDetail from "./components/addressInfoDetail"; +import KindList from "./components/kindList"; +import OrderState from "./components/orderState"; +import Payment from "./components/payment"; +import Remark from "./components/remark"; +import styles from './index.module.scss' + + export default () => { + const [showDesc, setShowDesc] = useState(false) + const router = useRouter() + const orderId = useRef(Number(router.params.id)) + useDidShow(() => { + getSaleOrderPreView() + }) + + //获取订单详情 + const [orderDetail, setOrderDetail] = useState() //获取到的原始数据 + const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi() + const getSaleOrderPreView = async () => { + if(orderId.current) { + let res = await getOrderFetchData({id: orderId.current}) + setOrderDetail(res.data) + setOrderRemark(res.data.remark) + } + Taro.stopPullDownRefresh() + } + + //监听获取到的数据 + useEffect(() => { + if(orderDetail) + formatData() + }, [orderDetail]) + + //格式化数据格式 + const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据 + const formatData = () => { + setFormatDetailOrder({ + estimate_amount: orderDetail.estimate_amount, //预估金额 + sale_mode: orderDetail.sale_mode, + sale_mode_name: orderDetail.sale_mode_name, + total_colors: orderDetail.total_colors, //总颜色数量 + total_number: orderDetail.total_number, //总数量 + total_fabrics: orderDetail.total_fabrics, //面料数量 + unit: orderDetail.sale_mode == 0?'条':'m', //单位 + list: orderDetail.product_list, + status: orderDetail.status, //订单状态 + total_sale_price: orderDetail.total_sale_price, //销售金额 + total_should_collect_money: orderDetail.total_should_collect_money, //应收金额 + total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠 + actual_amount: orderDetail.actual_amount, //实付金额 + the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态 + + }) + } + const formatPreViewOrderMemo = useMemo(() => { + return formatDetailOrder + }, [formatDetailOrder]) + + //复制功能 + const clipboardData = () => { + Taro.setClipboardData({ + data: orderDetail?.order_no||'', + success: function (res) { + Taro.showToast({ + icon: 'none', + title: '复制成功' + }) + } + }) + } + + //格式化初始地址 + const defaultAddress = useMemo(() => { + return { + province_name: orderDetail?.province_name, + city_name: orderDetail?.city_name, + district_name: orderDetail?.district_name, + address_detail: orderDetail?.address_detail, + // id: address.id, + name: orderDetail?.target_user_name, + phone: orderDetail?.target_user_phone + } + + }, [orderDetail]) + + //订单备注 + const {fetchData: remarkFetchData} = EditSaleOrderRemarkApi() + const [orderRemark, setOrderRemark] = useState('') + const getRemark = useCallback(async (e) => { + setOrderRemark(() => e) + let res = await remarkFetchData({remark:e, id: orderId.current}) + if(res.success) { + getSaleOrderPreView() + alert.success('提交成功') + } else { + alert.error(res.msg) + } + setShowDesc(() => false) + }, []) + + //支付所需数据 + const payOrderInfo = useMemo(() => { + if(orderDetail) + return {orderId: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method } + }, [orderDetail]) + + //去付款 + const [payMentShow, setPayMentShow] = useState(false) + const toPay = () => { + setPayMentShow(true) + } + + //打开地址修改 + const addressRef = useRef(null) + + //修改收货方式 + const getShipmentMode = useCallback(() => { + getSaleOrderPreView() + }, [orderDetail]) + + //修改地址 + const getAddress = useCallback(() => { + getSaleOrderPreView() + }, [orderDetail]) + + //获取底部按钮点击, 获取按钮状态 + const orderStateClick = useCallback((val) => { + if(val == 1 || val == 6) { + //取消订单 + getSaleOrderPreView() + }else if(val == 2) { + //待付款 + toPay() + } + }, [orderDetail]) + + //页面下拉刷新 + usePullDownRefresh(() => { + getSaleOrderPreView() + }) + + //支付成功 + const onPaySuccess = useCallback(() => { + getSaleOrderPreView() + closePayShow() + }, [orderDetail]) + + //关闭支付弹窗 + const closePayShow = useCallback(() => { + setPayMentShow(() => false) + }, [orderDetail]) + + //按钮所需数据 + const orderInfo = useMemo(() => { + return { + status: orderDetail?.status, //订单状态 + orderId: orderDetail?.id, + settle_mode: orderDetail?.settle_mode, + actual_amount: orderDetail?.actual_amount, //实付金额 + wait_pay_amount: orderDetail?.wait_pay_amount, //待付金额 + } + }, [orderDetail]) + + //订单状态枚举 + const {SaleOrderStatusCancel} = ORDER_STATUS + + + + return ( + + {/* + + */} + + + + + + + 订单信息 + + + {orderDetail?.order_no} + clipboardData()}>复制 + + + + {formatDateTime(orderDetail?.create_time)} + + + {formatDateTime(orderDetail?.create_time)} + + + setShowDesc(true)}> + 订单备注 + { + orderRemark&&{orderDetail?.remark}|| + 填写备注 + } + + + {(orderDetail?.status != SaleOrderStatusCancel.value)&& + + } + setShowDesc(false)} > + getRemark(e)}/> + + + + + ) + } diff --git a/src/pages/details/components/LabAndImg/index.modul.scss b/src/pages/details/components/LabAndImg/index.modul.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/pages/details/components/LabAndImg/index.tsx b/src/pages/details/components/LabAndImg/index.tsx deleted file mode 100644 index 2e4bfcc..0000000 --- a/src/pages/details/components/LabAndImg/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { memo } from "react"; - -export default memo(() => { - return ( - <> - - - ) -}) \ No newline at end of file diff --git a/src/pages/details/components/orderCount/index.module.scss b/src/pages/details/components/orderCount/index.module.scss index 8c745e2..c22118d 100644 --- a/src/pages/details/components/orderCount/index.module.scss +++ b/src/pages/details/components/orderCount/index.module.scss @@ -81,12 +81,7 @@ width: 156.5px; height: 156.5px; border-radius: 20px; - background-color: red; - image{ - width: 100%; - height: 100%; - border-radius: 20px; - } + } .item_con{ flex:1; diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index ea3340a..7b993bd 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -15,6 +15,7 @@ import Taro, { useRouter } from "@tarojs/taro"; import UseLogin from "@/use/useLogin" import { formatHashTag, formatPriceDiv } from "@/common/fotmat"; import { debounce, getFilterData } from "@/common/util"; +import LabAndImg from "@/components/LabAndImg"; @@ -144,15 +145,15 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) const {getSelfUserInfo} = UseLogin() const {fetchData:addFetchData} = AddShoppingCartApi() const addShopCart = async () => { - try { - await getSelfUserInfo() - } catch(msg) { - Taro.showToast({ - icon:'none', - title:'授权失败,请求完善授权' - }) - return false - } + // try { + // await getSelfUserInfo() + // } catch(msg) { + // Taro.showToast({ + // icon:'none', + // title:'授权失败,请求完善授权' + // }) + // return false + // } if(selectCount.sumCount == 0) { Taro.showToast({ @@ -233,7 +234,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) {list.map(item => { return - + {formatHashTag(item.code, item.name)} @@ -273,4 +274,5 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) ) -}) \ No newline at end of file +}) + diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index f76a6fe..34b704f 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -14,6 +14,7 @@ import useLogin from '@/use/useLogin'; import { AnalysisShortCodeApi, BindShortCodeApi, GetShortCodeApi } from '@/api/share'; import { SHARE_SCENE } from '@/common/enum'; import useUserInfo from '@/use/useUserInfo'; +import LabAndImg from '@/components/LabAndImg'; type item = {title:string, img:string, url:string, id:number} @@ -167,7 +168,7 @@ export default (props:Params) => { {productInfo?.product_color_list?.map(item => { return getColorItem(item)}> - + {item.code} diff --git a/src/pages/order/components/kindList/index.module.scss b/src/pages/order/components/kindList/index.module.scss index be8f53f..2d9b040 100644 --- a/src/pages/order/components/kindList/index.module.scss +++ b/src/pages/order/components/kindList/index.module.scss @@ -47,7 +47,6 @@ width: 126px; height: 126px; border-radius: 20px; - background-color: red; } .order_list_item_con{ display: flex; diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index e93be35..b2491f8 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -1,5 +1,6 @@ import { ORDER_STATUS } from "@/common/enum" import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" import { View } from "@tarojs/components" import { memo, useCallback, useMemo } from "react" import EstimatedAmount from "../estimatedAmount" @@ -140,7 +141,9 @@ export default memo(({order, comfirm = false}:Param) => { {item?.product_colors?.map(colorItem => { return - + + + {colorItem.code + ' ' + colorItem.name} diff --git a/src/pages/order/components/submitOrderBtn/index.tsx b/src/pages/order/components/submitOrderBtn/index.tsx index db9b432..20ed202 100644 --- a/src/pages/order/components/submitOrderBtn/index.tsx +++ b/src/pages/order/components/submitOrderBtn/index.tsx @@ -24,7 +24,7 @@ export default memo(({style, number = 0}:Param) => { <> - 应付金额 + 预估金额 {/* 123123123121212312312312312 */} diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index a78b6f1..f96a49e 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -1,5 +1,6 @@ import { goLink } from "@/common/common"; import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; +import LabAndImg from "@/components/LabAndImg"; import OrderBtns from "@/components/orderBtns"; import Payment from "@/pages/order/components/payment"; import { useSelector } from "@/reducers/hooks"; @@ -21,6 +22,9 @@ type Param = { total_number: number, status: 0, id: number, + lab: any, + rgb: any, + texture_url: string, payment_method: number, //支付方式 actual_amount: number, //实付金额 wait_pay_amount: number //待付金额 @@ -75,7 +79,7 @@ export default memo(({value, onClickBtn}: Param) => { - + {value?.product_list[0].product_colors[0].code} diff --git a/src/pages/searchList/hightSearchList.module.scss b/src/pages/searchList/hightSearchList.module.scss index c4e305b..a8f6bce 100644 --- a/src/pages/searchList/hightSearchList.module.scss +++ b/src/pages/searchList/hightSearchList.module.scss @@ -165,7 +165,6 @@ .product_img{ width: 100%; height: 224px; - background: #e5ad3a; border-radius: 20px 20px 0px 0px; position: relative; image{ diff --git a/src/pages/searchList/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx index ffc8dcc..9496028 100644 --- a/src/pages/searchList/hightSearchList.tsx +++ b/src/pages/searchList/hightSearchList.tsx @@ -17,6 +17,7 @@ import LoadingCard from "@/components/loadingCard"; import useLogin from "@/use/useLogin"; import { goLink } from "@/common/common"; import SelectData, {ListProps} from "./components/selectData"; +import LabAndImg from "@/components/LabAndImg"; export default () => { const {checkLogin} = useLogin() @@ -95,7 +96,6 @@ export default () => { const [blueToothColor, setBlueToothColor] = useState('') useEffect(() => { if(colorState.deviceLab) { - console.log('颜色:',colorState.deviceLab) const rgb = toRgb([colorState.deviceLab.L, colorState.deviceLab.a, colorState.deviceLab.b]) setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) setSearchField({...searchField, l:rgb[0], a:rgb[1], b:rgb[2], size:10}) @@ -103,7 +103,7 @@ export default () => { }, [colorState.deviceLab]) const goLinkPage = (item) => { - goLink('/pages/details/index',{id:item.id}) + goLink('/pages/details/index',{id:item.product_id}) } //获取筛选条件 @@ -186,7 +186,7 @@ export default () => { {materialList.list.map(item => { return goLinkPage(item)}> - + {(item.product_color_code)}# diff --git a/src/pages/searchList/searchList.module.scss b/src/pages/searchList/searchList.module.scss index cb88783..0e4bb51 100644 --- a/src/pages/searchList/searchList.module.scss +++ b/src/pages/searchList/searchList.module.scss @@ -148,7 +148,6 @@ .product_img{ width: 100%; height: 224px; - background: #e5ad3a; border-radius: 20px 20px 0px 0px; position: relative; image{ diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 5ae921c..53e50f4 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -13,6 +13,7 @@ import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import { formatHashTag, formatImgUrl } from "@/common/fotmat"; import { dataLoadingStatus, getFilterData } from "@/common/util"; import useLogin from "@/use/useLogin"; +import LabAndImg from "@/components/LabAndImg"; export default () => { const {checkLogin} = useLogin() @@ -161,7 +162,7 @@ export default () => { {materialList.list.map(item => { return goLinkPage(item)}> - + {(item.product_color_count)}色 diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts new file mode 100644 index 0000000..6e02d19 --- /dev/null +++ b/src/use/useUploadImage.ts @@ -0,0 +1,121 @@ +import Taro from '@tarojs/taro'; +import {UPLOAD_CDN_URL } from '@/common/constant' +import { GetSignApi } from '@/api/cdn' + + + +export default () => { + + const { fetchData: GetSign, state} = GetSignApi() + + // 上传图片 获取auth,Policy + /* + scene 场景值,区分上传文件的根路径 + type 类型值,区分上传业务bucket + */ + const getSecret = (scene, type) => { + return new Promise(async (resolve, reject) => { + + const SAVE_PATH = `/${scene}/{filemd5}{day}{hour}{min}{sec}{.suffix}`; + + let params = { + 'method': 'post', + 'save_key': SAVE_PATH + } + // 获取签名 + let res = await GetSign(params) + if (res.success) { + resolve(res.data) + } else { + reject({ + code: res.code || '9999', + msg: res.msg + }); + } + + }) + } + const getFileType = (name) => { + if (!name) return false; + var imgType = ["gif", "jpeg", "jpg", "bmp", "png"]; + var videoType = ["avi", "wmv", "mkv", "mp4", "mov", "rm", "3gp", "flv", "mpg", "rmvb", "quicktime"]; + + if (RegExp("\.?(" + imgType.join("|") + ")$", "i").test(name.toLowerCase())) { + return 'image'; + } else if (RegExp("\.(" + videoType.join("|") + ")$", "i").test(name.toLowerCase())) { + return 'video'; + } else { + return false; + } + } + + /** + * + * @param {*} file 传入文件 + * @param {String} secene 传入 'product' + * @param {String} type 传入 'product' + * @returns + */ + const uploadCDNImg = (file, secene, type) => { + let filetype = file.path + console.log('filetype::',filetype) + if (!getFileType(filetype)) { + Taro.showToast({ + title: "上传文件类型错误", + icon: "none", + duration: 3800 + }) + return false + } + + return new Promise((resolve, reject) => { + getSecret(secene, type) + .then(result => { + let res:any = result + console.log('bucket', res.bucket); + var formdata = { + 'authorization': res.authorization, + 'policy': res.policy, + } + + const uploadTask = Taro.uploadFile({ + url: `${UPLOAD_CDN_URL}${res.bucket}`, + formData: formdata, + filePath: file.path, + name: 'file', + success: res => { + resolve(JSON.parse(`${res.data}`)) + }, + fail: err => { + console.log(err) + reject(err) + } + }) + + uploadTask.progress(res => { + console.log('上传进度', res.progress); + if (res.progress < 100) { + Taro.showLoading({ + title: '上传中...' + }) + } else { + Taro.hideLoading() + } + }) + }) + .catch(result => { + reject(result) + Taro.showToast({ + title: "获取密钥失败!", + icon: "none", + duration: 3800 + }) + }) + }) + } + + return { + uploadCDNImg + } + +} From 753906dbd596429cd71db17a9813ae6f5848e5c4 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 17:39:17 +0800 Subject: [PATCH 13/47] =?UTF-8?q?--=E7=BB=91=E5=AE=9A=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddressList/index.tsx | 2 +- src/pages/creditUsed/index.tsx | 2 +- src/pages/depositBeforehand/index.scss | 16 ---------------- src/pages/depositBeforehand/index.tsx | 5 ++--- src/pages/user/index.tsx | 21 +++++---------------- 5 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index 71e9827..7f71e93 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -102,7 +102,7 @@ const AddressList = memo((props:Params)=>{ {/* {item.address_detail} */} { - item.is_default&&{item.phone.replace(item.phone.substring(4,7), "****")} + item.is_default&&{item.phone.replace(item.phone.substring(3,7), "****")} } e.stopPropagation()} url={`/pages/addressAdd/index?type=edit&id=${item.id}`} hoverClass="none" className="address-edit"> diff --git a/src/pages/creditUsed/index.tsx b/src/pages/creditUsed/index.tsx index 17d60f3..11cdbd8 100644 --- a/src/pages/creditUsed/index.tsx +++ b/src/pages/creditUsed/index.tsx @@ -31,7 +31,7 @@ export default ()=>{ 下单 0?'green':item.amount<0?'red':''}`}> - {item.amount>0?"-":"+"}{toDecimal2(formatPriceDiv(item.amount)).toLocaleString()} + {item.trans_type==2?"-":"+"}{toDecimal2(formatPriceDiv(item.amount)).toLocaleString()} diff --git a/src/pages/depositBeforehand/index.scss b/src/pages/depositBeforehand/index.scss index d782d46..157ea4f 100644 --- a/src/pages/depositBeforehand/index.scss +++ b/src/pages/depositBeforehand/index.scss @@ -3,22 +3,6 @@ background-color: #f3f3f3; display: flex; flex-direction: column; - .deposit-beforehand-tips{ - width: 100%; - height: 66px; - background: #FFE6CE; - border: 2px solid #ffe6ce; - padding: 0 30px; - display: flex;align-items: center; - font-size: 24px; - font-weight: 400; - color: #EE7500; - margin: 0; - } - .deposit-beforehand-tips text{ - margin-right: 10px; - font-size: 30px; - } .deposit-beforehand-card{ width: 702px; diff --git a/src/pages/depositBeforehand/index.tsx b/src/pages/depositBeforehand/index.tsx index c904f4c..9636d30 100644 --- a/src/pages/depositBeforehand/index.tsx +++ b/src/pages/depositBeforehand/index.tsx @@ -6,6 +6,7 @@ import { depositInfoApi } from "@/api/deposit" import { useEffect } from "react"; import { formatPriceDiv, toDecimal2 } from "@/common/fotmat"; import { setClipboardData } from "@tarojs/taro"; +import Message from "@/components/Message"; export default ()=>{ const {fetchData, state} = depositInfoApi(); @@ -23,9 +24,7 @@ export default ()=>{ return ( - - 汇款成功后,1-5分钟自动到账。 - + 余额 (元) diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index b4849ea..e8fd7a7 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -3,26 +3,15 @@ import { memo, useEffect, useState } from "react" import styles from './index.module.scss' import classnames from "classnames"; import { useSelector } from "@/reducers/hooks"; -import { GetAdminUserInfoApi } from "@/api/user"; import { alert, goLink } from "@/common/common"; import useLogin from '@/use/useLogin' export default () => { // 用户信息 - const { fetchData, state } = GetAdminUserInfoApi(); + const { getSelfUserInfo } = useLogin(); const {adminUserInfo, userInfo} = useSelector(state => state.userInfo); - const [mUserInfo, setMUserInfo] = useState({ - phone: "" - }); - const getData = ()=>{ - fetchData(); - } useEffect(()=>{ - setMUserInfo({ - ...mUserInfo, - // phone: userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****") as string - }) - getData(); + getSelfUserInfo(); },[]); return ( @@ -69,9 +58,9 @@ const Header = memo((props:any) => { { text: "退款/售后", icon: "icon-a-tuikuanshouhou" }]; const { getPhoneNumber } = useLogin(); const mGetPhoneNumber = (ev)=>{ - try { + if(ev.detail?.code){ getPhoneNumber(ev.detail.code); - } catch (error) { + }else{ alert.none("绑定失败!"); } } @@ -90,7 +79,7 @@ const Header = memo((props:any) => { {data?.user_name} - {userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****")||} + {data?.phone?data?.phone?.replace(data?.phone?.substring(3,7), "****"):} From c1a0866b044919dbaceef56a1c1f9c8b443a832c Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Fri, 10 Jun 2022 17:51:42 +0800 Subject: [PATCH 14/47] =?UTF-8?q?--=E4=BF=AE=E5=A4=8D=E6=8E=88=E4=BF=A1?= =?UTF-8?q?=E9=A2=9D=E5=BA=A6=E5=9C=86=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/InfiniteScrollPaging/index.tsx | 7 ++++--- src/pages/creditLine/index.tsx | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/InfiniteScrollPaging/index.tsx b/src/components/InfiniteScrollPaging/index.tsx index 8db82b0..dc20d57 100644 --- a/src/components/InfiniteScrollPaging/index.tsx +++ b/src/components/InfiniteScrollPaging/index.tsx @@ -2,7 +2,7 @@ import InfiniteScroll from "@/components/infiniteScroll" import { ReactNode, useEffect, useMemo, useRef, useState } from "react" import { dataLoadingStatus, getFilterData } from "@/common/util"; -import { isEmptyObject } from "@/common/common"; +import { alert, isEmptyObject } from "@/common/common"; interface Params{ children?: ReactNode, @@ -36,9 +36,9 @@ export default (props: Params)=>{ page: tRefreshDataRef.page, size: tRefreshDataRef.size, }); - // 返回数据 - props.change&&props.change(result); if(result.success){ + // 返回数据 + props.change&&props.change(result); if(result.data.total<=0){ setRefreshData({ ...tRefreshDataRef, @@ -59,6 +59,7 @@ export default (props: Params)=>{ }) } }else{ + alert.none(result.msg); setRefreshData({ ...tRefreshDataRef, refreshStatus: false, diff --git a/src/pages/creditLine/index.tsx b/src/pages/creditLine/index.tsx index 2aaf9ff..6a9d4e9 100644 --- a/src/pages/creditLine/index.tsx +++ b/src/pages/creditLine/index.tsx @@ -42,7 +42,8 @@ export default ()=>{ const credit_quota_used_line = convertPrice(formatPriceDiv(result.data.credit_quota_used_line)); const credit_quota_line = convertPrice(formatPriceDiv(result.data.credit_quota_line)); const credit_quota_available_line = convertPrice(formatPriceDiv(result.data.credit_quota_available_line)); - const progress = ((credit_quota_available_line[0]??0) / (credit_quota_line[0]??0) * 100).toFixed(0); + const progress = credit_quota_available_line[0]==0&&credit_quota_line[0]==0?100:((credit_quota_available_line[0]??0) / (credit_quota_line[0]??0) * 100).toFixed(0); + switch(Number(result.data.quota_status)){ case 0://暂未开通 From 3e5b19a1242f5baba13b60c0e3c70001cba121bd Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 19:02:36 +0800 Subject: [PATCH 15/47] =?UTF-8?q?=E5=89=AA=E6=9D=BF=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 3 +- src/common/constant.js | 4 +- src/common/enum.ts | 9 +- src/components/orderBtns/index.tsx | 6 +- src/pages/cutOrder/comfirm.config.ts | 4 - src/pages/cutOrder/comfirm.module.scss | 130 ------------ src/pages/cutOrder/comfirm.tsx | 188 ------------------ .../components/addressInfo/index.module.scss | 71 ------- .../cutOrder/components/addressInfo/index.tsx | 76 ------- .../addressInfoDetail/index.module.scss | 117 ----------- .../components/addressInfoDetail/index.tsx | 126 ------------ .../components/amountShow/index.module.scss | 35 ---- .../cutOrder/components/amountShow/index.tsx | 28 --- .../estimatedAmount/index.module.scss | 70 ------- .../components/estimatedAmount/index.tsx | 29 --- .../components/kindList/index.module.scss | 108 ---------- .../cutOrder/components/kindList/index.tsx | 169 ---------------- .../components/offlinePay/index.module.scss | 46 ----- .../cutOrder/components/offlinePay/index.tsx | 52 ----- .../orderState copy/index.module.scss | 18 -- .../components/orderState copy/index.tsx | 14 -- .../components/orderState/index.module.scss | 105 ---------- .../cutOrder/components/orderState/index.tsx | 63 ------ .../components/payment/index.module.scss | 126 ------------ .../cutOrder/components/payment/index.tsx | 185 ----------------- .../components/remark/index.module.scss | 48 ----- .../cutOrder/components/remark/index.tsx | 38 ---- .../components/scanPay/index.module.scss | 54 ----- .../cutOrder/components/scanPay/index.tsx | 161 --------------- .../components/shipmentMode/index.module.scss | 33 --- .../components/shipmentMode/index.tsx | 28 --- .../submitOrderBtn/index.module.scss | 69 ------- .../components/submitOrderBtn/index.tsx | 40 ---- .../components/weightMemo/index.module.scss | 39 ---- .../cutOrder/components/weightMemo/index.tsx | 36 ---- src/pages/order/comfirm.tsx | 11 +- src/pages/order/components/kindList/index.tsx | 13 +- .../order/components/submitOrderBtn/index.tsx | 10 +- .../{ => order}/cutOrder/index.config.ts | 0 .../{ => order}/cutOrder/index.module.scss | 0 src/pages/{ => order}/cutOrder/index.tsx | 15 +- src/pages/order/index.tsx | 1 - 42 files changed, 43 insertions(+), 2335 deletions(-) delete mode 100644 src/pages/cutOrder/comfirm.config.ts delete mode 100644 src/pages/cutOrder/comfirm.module.scss delete mode 100644 src/pages/cutOrder/comfirm.tsx delete mode 100644 src/pages/cutOrder/components/addressInfo/index.module.scss delete mode 100644 src/pages/cutOrder/components/addressInfo/index.tsx delete mode 100644 src/pages/cutOrder/components/addressInfoDetail/index.module.scss delete mode 100644 src/pages/cutOrder/components/addressInfoDetail/index.tsx delete mode 100644 src/pages/cutOrder/components/amountShow/index.module.scss delete mode 100644 src/pages/cutOrder/components/amountShow/index.tsx delete mode 100644 src/pages/cutOrder/components/estimatedAmount/index.module.scss delete mode 100644 src/pages/cutOrder/components/estimatedAmount/index.tsx delete mode 100644 src/pages/cutOrder/components/kindList/index.module.scss delete mode 100644 src/pages/cutOrder/components/kindList/index.tsx delete mode 100644 src/pages/cutOrder/components/offlinePay/index.module.scss delete mode 100644 src/pages/cutOrder/components/offlinePay/index.tsx delete mode 100644 src/pages/cutOrder/components/orderState copy/index.module.scss delete mode 100644 src/pages/cutOrder/components/orderState copy/index.tsx delete mode 100644 src/pages/cutOrder/components/orderState/index.module.scss delete mode 100644 src/pages/cutOrder/components/orderState/index.tsx delete mode 100644 src/pages/cutOrder/components/payment/index.module.scss delete mode 100644 src/pages/cutOrder/components/payment/index.tsx delete mode 100644 src/pages/cutOrder/components/remark/index.module.scss delete mode 100644 src/pages/cutOrder/components/remark/index.tsx delete mode 100644 src/pages/cutOrder/components/scanPay/index.module.scss delete mode 100644 src/pages/cutOrder/components/scanPay/index.tsx delete mode 100644 src/pages/cutOrder/components/shipmentMode/index.module.scss delete mode 100644 src/pages/cutOrder/components/shipmentMode/index.tsx delete mode 100644 src/pages/cutOrder/components/submitOrderBtn/index.module.scss delete mode 100644 src/pages/cutOrder/components/submitOrderBtn/index.tsx delete mode 100644 src/pages/cutOrder/components/weightMemo/index.module.scss delete mode 100644 src/pages/cutOrder/components/weightMemo/index.tsx rename src/pages/{ => order}/cutOrder/index.config.ts (100%) rename src/pages/{ => order}/cutOrder/index.module.scss (100%) rename src/pages/{ => order}/cutOrder/index.tsx (93%) diff --git a/src/app.config.ts b/src/app.config.ts index 6c40fff..27b804e 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -96,7 +96,8 @@ export default { root: "pages/order", pages: [ "index", - "comfirm" + "comfirm", + "cutOrder/index", ] }, { diff --git a/src/common/constant.js b/src/common/constant.js index dc069fb..71c3838 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,12 +5,12 @@ // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -// export const BASE_URL = `http://192.168.1.30:40001/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 = `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:50001/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN diff --git a/src/common/enum.ts b/src/common/enum.ts index 00a8ec1..8e8da01 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -1,6 +1,7 @@ //订单状态枚举 export const ORDER_STATUS = { + SaleOrderStatusCancel : {value:10, label:'预付款'}, // SaleOrderStatusBooking : {value:0, label:'待接单'}, // 待接单 SaleOrderStatusArranging : {value:1, label:'配布中'}, // 配布中 SaleOrderStatusArranged : {value:2, label:'已配布'}, // 已配布 @@ -34,8 +35,14 @@ export const PAYMENT_METHOD = { } export type PAYMENT_METHOD_PARAM = 1|2|3|4|5 + +//订单模式 +export const SALE_MODE = { + +} + //分享场景枚举 export const SHARE_SCENE = { ShareDetail: {value:1, label:'详情分享'}, SharePage : {value:2, label:'页面分享'}, -} \ No newline at end of file +} diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 8720675..ee7228b 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -12,6 +12,7 @@ type Param = { orderId: number, //订单id actual_amount: number, //实付金额 wait_pay_amount: number, //待付金额 + sale_mode: number, //订单类型 }|null, onClick?: (val: number) => void //点击后触发的事件,返回订单状态 } @@ -67,6 +68,8 @@ export default memo(({orderInfo, onClick}:Param) => { label: '再次购买' } ]) + + //判断是否显示该按钮 const orderBtnsShow = useCallback((item) => { if(orderInfo) { @@ -136,10 +139,7 @@ export default memo(({orderInfo, onClick}:Param) => { } } }) - } - - //按钮点击滚动 const [selectInfo, setSelectInfo] = useState({ selected: -1, //当前选中的id diff --git a/src/pages/cutOrder/comfirm.config.ts b/src/pages/cutOrder/comfirm.config.ts deleted file mode 100644 index 67ce23e..0000000 --- a/src/pages/cutOrder/comfirm.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default { - navigationBarTitleText: '确认订单', - enableShareAppMessage: true, -} diff --git a/src/pages/cutOrder/comfirm.module.scss b/src/pages/cutOrder/comfirm.module.scss deleted file mode 100644 index 2858dec..0000000 --- a/src/pages/cutOrder/comfirm.module.scss +++ /dev/null @@ -1,130 +0,0 @@ -.order_main{ - min-height: 100%; - background-color:$color_bg_one; - padding: 20px; - padding-bottom: 190px; - box-sizing: border-box; - - .order_title{ - display: flex; - align-items: center; - padding: 20px 30px; - box-sizing: border-box; - background-color: #fff; - height: 116px; - border-radius: 20px; - margin-top: 20px; - text{ - flex:1; - font-size: $font_size; - font-weight: 700; - } - .order_status{ - background-color: #F0F0F0; - width: 148px; - height: 55px; - color: $color_font_three; - text-align: center; - line-height: 55px; - font-size: $font_size_medium; - border-radius: 30px; - &:nth-last-child(1) { - margin-left: 20px; - } - } - .order_status_selected{ - color: $color_main; - border: 1px solid $color_main; - } - } - .order_desc{ - display: flex; - align-items: center; - background-color: #fff; - padding: 20px; - min-height: 116px; - border-radius: 20px; - margin-top: 20px; - box-sizing: border-box; - .order_desc_con{ - width: 150px; - font-size: $font_size; - font-weight: 700; - } - .order_desc_text, .order_desc_text_hint{ - font-size: $font_size_medium; - color: $color_font_two; - margin-right: 10px; - flex:1; - } - .order_desc_text_hint{ - text-align: right; - } - .miconfont{ - font-size: 20px; - color: $color_font_two; - } - } - .submit_order{ - display: flex; - position: fixed; - bottom: 0; - left: 0; - justify-content: space-between; - width: 100%; - height: 175px; - align-items: center; - background-color: #fff; - box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); - padding: 20px 50px; - box-sizing: border-box; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); - .order_btn { - width: 250px; - height: 90px; - opacity: 0.6; - background: linear-gradient(38deg,#007aff, #4fa6ff 100%, #68b4ff 100%); - border-radius: 46px; - display: flex; - justify-content: center; - align-items: center; - color: #fff; - } - .ok_order_btn { - opacity: 1; - } - .order_number_desc{ - font-size: $font_size_medium; - color: $color_font_two; - } - } - .order_info{ - background-color: #fff; - margin-top: 20px; - border-radius: 20px; - padding: 20px; - .order_info_title{ - font-size: $font_size; - font-weight: 700; - margin-bottom: 20px; - - } - .order_num{ - display: flex; - justify-content: space-between; - align-items: center; - .order_num_btn{ - font-size: $font_size_medium; - padding: 5px 10px; - border: 2px solid #007cf7; - border-radius: 10px; - color: $color_main; - } - } - text{ - font-size: $font_size; - } - - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/comfirm.tsx b/src/pages/cutOrder/comfirm.tsx deleted file mode 100644 index e8a8a45..0000000 --- a/src/pages/cutOrder/comfirm.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order"; -import { formatPriceDiv } from "@/common/fotmat"; -import Popup from "@/components/popup"; -import SearchInput from "@/components/searchInput"; -import { Text, Textarea, View } from "@tarojs/components" -import Taro, { useDidShow, useRouter } from "@tarojs/taro"; -import classnames from "classnames"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import AddressInfo,{AddressInfoParam} from "./components/addressInfo"; -import EstimatedAmount from "./components/estimatedAmount"; -import KindList from "./components/kindList"; -import OrderState from "./components/orderState"; -import Remark from "./components/remark"; -import styles from './comfirm.module.scss' -import { getParam } from "@/common/system"; -import useLogin from "@/use/useLogin"; -import { alert, goLink } from "@/common/common"; -import ShipmentMode from "../editOrder/components/shipmentMode"; -import SubmitOrderBtn from "./components/submitOrderBtn"; - - export default () => { - const {checkLogin} = useLogin() - - const [showDesc, setShowDesc] = useState(false) - //下单信息 - type OrderParams = {address_id?: number, remark?: string, sale_mode?: number, shipment_mode?: number, list?: any[]} - const [submitOrderData, setSubmitOrderData] = useState() - - //获取购物车传过来的id - type orderPreParam = {shopping_cart_product_color_list:{shopping_cart_product_color_id:number}[], sale_mode:number} - const param = getParam() - const idsAndSaleModel = useRef({shopping_cart_product_color_list:[], sale_mode:0}) - useDidShow(async () => { - idsAndSaleModel.current = {shopping_cart_product_color_list:[], sale_mode:0} //初始化 - idsAndSaleModel.current.sale_mode = Number(param?.sale_mode) - param?.ids?.split('-')?.map(item => { - return idsAndSaleModel.current.shopping_cart_product_color_list?.push({ - shopping_cart_product_color_id: Number(item) - }) - }) - getSaleOrderPreView() - setSubmitOrderData((val) => ({...val, sale_mode:param?.sale_mode})) - }) - - //获取销售预览订单 - const [preViewOrder, setPreViewOrder] = useState() //获取到的原始数据 - const {fetchData} = SaleOrderPreViewApi() - const getSaleOrderPreView = async () => { - if(idsAndSaleModel.current.shopping_cart_product_color_list?.length > 0) { - let res = await fetchData(idsAndSaleModel.current) - setPreViewOrder(res.data) - } - } - - //监听获取到的数据 - useEffect(() => { - if(preViewOrder) { - formatData() - getDataList() - //当有默认地址时设置默认地址id - preViewOrder.default_address&&setSubmitOrderData((val) => ({...val, address_id:preViewOrder.default_address.id})) - } - }, [preViewOrder]) - - //格式化数据格式 - const [formatPreViewOrder, setFormatPreViewOrder] = useState() //格式化后的数据 - const formatData = () => { - setFormatPreViewOrder({ - estimate_amount: preViewOrder.estimate_amount, //预估金额 - sale_mode: preViewOrder.sale_mode, - sale_mode_name: preViewOrder.sale_mode_name, - total_colors: preViewOrder.total_colors, //总颜色数量 - total_number: preViewOrder.total_number, //总数量 - total_fabrics: preViewOrder.total_fabrics, //面料数量 - unit: preViewOrder.sale_mode == 0?'条':'m', //单位 - list: preViewOrder.product_list - }) - } - const formatPreViewOrderMemo = useMemo(() => { - return formatPreViewOrder - }, [formatPreViewOrder]) - - //格式化初始地址 - const defaultAddress = useMemo(() => { - const address = preViewOrder?.default_address - if(address) { - return { - province_name: address.province_name, - city_name: address.city_name, - district_name: address.district_name, - address_detail: address.address_detail, - id: address.id, - name: address.name, - phone: address.phone - } - } - return null - }, [preViewOrder]) - - //获取提交格式数据列表 - const getDataList = () => { - let list:{shopping_cart_product_color_id:number}[] = [] - preViewOrder.product_list?.map(item => { - item.product_colors?.map(colorItem => { - list.push({shopping_cart_product_color_id:colorItem.id}) - }) - }) - setSubmitOrderData((val) => ({...val, list})) - } - - //获取地址 - const getAddress = (e) => { - setSubmitOrderData((val) => ({...val, address_id:e.id})) - } - - const selectShipmentMode = useCallback((value) => { - setSubmitOrderData((val) => ({...val, shipment_mode:value})) - }, []) - - //获取备注 - const getRemark = useCallback((e) => { - setSubmitOrderData((val) => ({...val, remark:e})) - setShowDesc(() => false) - }, []) - - //提交按钮是否可用 - const btnStatus = useMemo(() => { - if( submitOrderData?.list?.length == 0 || !submitOrderData?.shipment_mode || (submitOrderData?.shipment_mode == 2 && !submitOrderData?.address_id)) { - return false - } else { - return true - } - }, [submitOrderData]) - - //提交订单 - const {fetchData: saleOrderFetchData} = SaleOrderApi() - const submitOrderEven = () => { - if(!submitOrderData?.address_id) { - alert.error('请选择地址') - return false - } - if(!submitOrderData?.shipment_mode) { - alert.error('请选择收货方式') - return false - } - Taro.showModal({ - title: '确定提交?', - success: async function (res) { - if (res.confirm) { - const res = await saleOrderFetchData(submitOrderData) - if(res.success) { - goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') - } else { - alert.none(res.msg) - } - } else if (res.cancel) { - console.log('用户点击取消') - } - } - }) - } - return ( - - - getAddress(e)} defaultValue={defaultAddress}/> - - setShowDesc(true)}> - 订单备注 - { - submitOrderData?.remark&&{submitOrderData?.remark}|| - 填写备注 - } - - - - - - {`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`} - - submitOrderEven()}>提交订单 - - setShowDesc(false)} > - getRemark(e)}/> - - - - ) - } diff --git a/src/pages/cutOrder/components/addressInfo/index.module.scss b/src/pages/cutOrder/components/addressInfo/index.module.scss deleted file mode 100644 index 4e9ea21..0000000 --- a/src/pages/cutOrder/components/addressInfo/index.module.scss +++ /dev/null @@ -1,71 +0,0 @@ -.order_address{ - height: 178px; - background: #ffffff; - border-radius: 20px; - display: flex; - align-items: center; - padding: 30px; - box-sizing: border-box; - margin-top: 20px; - .order_address_icon{ - font-size: 76px; - color: $color_main; - } - .order_address_text_con{ - flex:1; - padding: 0 30px; - box-sizing: border-box; - .order_address_text_title{ - font-size: $font_size_medium; - margin-top: 10px; - @include common_ellipsis; - } - .order_address_text_name{ - - align-items: center; - text{ - &:nth-child(1) { - color: #000; - font-weight: 700; - font-size: $color_font_one; - margin-right: 40px; - } - &:nth-child(2) { - color: $color_font_one; - font-size: $font_size_medium; - } - } - } - } - .updateBtn{ - font-size: $font_size_medium; - color: $color_font_three; - width: 96px; - height: 52px; - border: 2px solid #dddddd; - border-radius: 28px; - text-align: center; - line-height: 52px; - } - .order_address_text_no{ - flex: 1; - font-size: $font_size; - font-weight: 700; - margin-left: 30px; - } - .order_address_more_icon{ - color: $color_font_three; - font-size: $font_size; - } - -} -.order_address_list { - height: 900px; - .order_address_title{ - font-size: $font_size; - font-weight: 700; - width: 100%; - text-align: center; - padding: 20px 0 30px 0; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/addressInfo/index.tsx b/src/pages/cutOrder/components/addressInfo/index.tsx deleted file mode 100644 index 4225fea..0000000 --- a/src/pages/cutOrder/components/addressInfo/index.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import AddressList from "@/components/AddressList"; -import Popup from "@/components/popup"; -import { Text, View } from "@tarojs/components" -import classnames from "classnames"; -import { memo, useCallback, useEffect, useMemo, useState } from "react"; -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, //选择 - defaultValue?: AddressInfoParam|null //默认值 - disabled?: false|true //true禁用后只用于展示 -} - -export default memo(({onSelect, defaultValue = null, disabled = false}: Param) => { - const [showAddressList, setShowAddressList] = useState(false) - - useEffect(() => { - setUserInfo(() => defaultValue) - }, [defaultValue]) - - //选择地址 - const [userInfo, setUserInfo] = useState() - const getAddress = useCallback((val) => { - setShowAddressList(() => false) - setUserInfo(() => val) - onSelect?.(val) - }, []) - - //地址格式 - const formatAddress = useMemo(() => { - if(userInfo) - return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail - }, [userInfo]) - - const changeShow = () => { - if(!disabled) - setShowAddressList(() => true) - } - return ( - - changeShow()}> - - {!userInfo&& - <> - 请选择收货地址及信息 - - - ||<> - - - {userInfo?.name} - {userInfo?.phone} - - {formatAddress} - - 修改 - } - - {!disabled&& setShowAddressList(false)}> - - 请选择收货地址 - getAddress(item)}/> - - } - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/addressInfoDetail/index.module.scss b/src/pages/cutOrder/components/addressInfoDetail/index.module.scss deleted file mode 100644 index 2d6c306..0000000 --- a/src/pages/cutOrder/components/addressInfoDetail/index.module.scss +++ /dev/null @@ -1,117 +0,0 @@ -.order_address{ - height: 178px; - background: #ffffff; - border-radius: 20px; - display: flex; - align-items: center; - padding: 30px; - box-sizing: border-box; - margin-top: 20px; - position: relative; - .order_address_icon{ - font-size: 50px; - color: $color_main; - position: absolute; - top: 35px; - left: 20px; - } - .order_address_text_con{ - flex:1; - padding-left: 50px; - box-sizing: border-box; - height: 100%; - display: flex; - flex-direction: column; - justify-content: space-between; - .order_address_text_title{ - font-size: $font_size_medium; - margin-top: 10px; - @include common_ellipsis; - display: flex; - align-items: center; - justify-content: space-between; - .moreIconfont{ - font-size: 20px; - } - } - .order_address_text_name{ - - align-items: center; - text{ - &:nth-child(1) { - color: #000; - font-weight: 700; - font-size: $color_font_one; - margin-right: 40px; - } - &:nth-child(2) { - color: $color_font_one; - font-size: $font_size_medium; - } - } - } - } - .updateBtn{ - width:200px; - font-size: $font_size_min; - background-color: #F0F0F0; - height: 64px; - border-radius: 24px; - color: $color_font_two; - position: absolute; - bottom: 10px; - right: 10px; - z-index: 999; - .updateBtn_list{ - position: absolute; - display: flex; - z-index: 5; - width: 100%; - .updateBtn_item_select{ - color: #fff; - } - } - .updateBtn_item{ - flex:1; - text-align: center; - line-height: 64px; - } - .updateBtn_select{ - color: #fff; - background-color: $color_main; - border-radius: 24px; - position: absolute; - width: 100px; - height: 61px; - z-index: 1; - transition: all 0.3s ease-in-out; - } - - } - .order_address_text_no{ - flex: 1; - font-size: $font_size; - font-weight: 700; - margin-left: 30px; - } - .order_address_more_icon{ - color: $color_font_three; - font-size: $font_size; - } - -} -.order_address_list { - 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/cutOrder/components/addressInfoDetail/index.tsx b/src/pages/cutOrder/components/addressInfoDetail/index.tsx deleted file mode 100644 index bc915ed..0000000 --- a/src/pages/cutOrder/components/addressInfoDetail/index.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order"; -import { alert } from "@/common/common"; -import { debounce } 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, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react"; -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, //选择 - defaultValue?: AddressInfoParam|null, //默认值 - disabled?: false|true, //true禁用后只用于展示 - shipment_mode?: 1|2, //1自提 2物流 - onChangeShipmentMode?: (val: number) => void, //返回收货方式 - orderId?: number //订单id -} - -export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => { - const [showAddressList, setShowAddressList] = useState(false) - - useEffect(() => { - setUserInfo(() => defaultValue) - }, [defaultValue]) - - const [userInfo, setUserInfo] = useState() - - //地址格式 - const formatAddress = useMemo(() => { - if(userInfo) - return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail - }, [userInfo]) - - const changeShow = () => { - if(receivingStatus == 2) - setShowAddressList(() => true) - } - - useEffect(() => { - setReceivingStatus(() => shipment_mode) - }, [shipment_mode]) - - //把内部方法提供给外部 - useImperativeHandle(ref, () => ({ - changeShow - })) - - //收货方法,1:自提,2物流 - const [receivingStatus, setReceivingStatus] = useState(1) - const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() - const onReceivingStatus = (value, e) => { - e.stopPropagation() - changeReceivingStatus(value) - } - const changeReceivingStatus = debounce(async (value) => { - alert.loading('正在修改') - const res = await shipmentModeFetchData({id: orderId, shipment_mode:value}) - if(res.success) { - alert.success('收货方式修改成功') - onChangeShipmentMode?.(value) - setReceivingStatus(value) - } else { - alert.none(res.msg) - } - }, 10) - - //修改地址 - const [addressId, setAddressId] = useState(0) - const {fetchData: addressFetchData} = EditSaleOrderAddressApi() - const getAddress = async (value) => { - alert.loading('正在修改') - const res = await addressFetchData({id: orderId, address_id: value.id}) - if(res.success) { - alert.success('地址修改成功') - onSelect?.(value) - setShowAddressList(() => false) - setAddressId(value.id) - setUserInfo(() => value) - } else { - alert.none(res.msg) - } - } - - return ( - - changeShow()}> - - - - {formatAddress} - {(receivingStatus == 2)&&} - - - {userInfo?.name} - {userInfo?.phone} - - - - - onReceivingStatus(1,e)}>自提 - onReceivingStatus(2,e)}>物流 - - - - - setShowAddressList(false)}> - - 请选择收货地址 - - - - - - - ) -})) \ No newline at end of file diff --git a/src/pages/cutOrder/components/amountShow/index.module.scss b/src/pages/cutOrder/components/amountShow/index.module.scss deleted file mode 100644 index 647e203..0000000 --- a/src/pages/cutOrder/components/amountShow/index.module.scss +++ /dev/null @@ -1,35 +0,0 @@ -.order_price_num{ - color: $color_main; - font-weight: 700; - text{ - &:nth-child(1) { - font-size: $font_size_min; - } - &:nth-child(2) { - font-size: $font_size; - } - &:nth-child(3) { - font-size: $font_size_medium; - } - } -} -.emphasis_num{ - .price_text{ - &:nth-child(2) { - font-size: $font_size_big; - } - } -} -.emphasis_num_big{ - .price_text{ - &:nth-child(1) { - font-size: $font_size_big; - } - &:nth-child(2) { - font-size: 60px; - } - &:nth-child(1) { - font-size: $font_size_big; - } - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/amountShow/index.tsx b/src/pages/cutOrder/components/amountShow/index.tsx deleted file mode 100644 index 877f7df..0000000 --- a/src/pages/cutOrder/components/amountShow/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Text, View } from "@tarojs/components"; -import { memo, useCallback } from "react"; -import styles from './index.module.scss' -import classnames from "classnames"; - -type Param = { - number: number, //数字 - status: 0|1|2 //0 小型,1中型,2大 -} -export default memo(({number = 0, status = 1}:Param) => { - const priceDom = useCallback(() => { - let res = number.toFixed(2).split('.') - let int_num = parseInt(res[0]) + '' - let decimals_num = res[1] - return ( - <> - ¥ - {Number(int_num).toLocaleString()} - .{decimals_num} - - ) - }, [number]) - return ( - - {priceDom()} - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/estimatedAmount/index.module.scss b/src/pages/cutOrder/components/estimatedAmount/index.module.scss deleted file mode 100644 index 4b4a958..0000000 --- a/src/pages/cutOrder/components/estimatedAmount/index.module.scss +++ /dev/null @@ -1,70 +0,0 @@ -.order_price{ - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - &:nth-last-child(n+2) { - margin-bottom: 30px; - } - .order_price_text{ - font-size: $font_size_medium; - // margin-right: 10px; - display: flex; - .iconfont_msg{ - position: relative; - } - .miconfont{ - font-size: 26px; - font-weight: normal; - margin-left: 5px; - } - .message{ - position: absolute; - top: -50px; - background: #A8B3BD; - z-index: 9; - min-height: 50px; - border-radius: 10px; - padding: 10px; - box-sizing: border-box; - &::before{ - z-index: 1; - position: absolute; - bottom: -7px; - left: 10px; - width: 15px; - height: 15px; - content: " "; - transform: rotate(45deg); - background: #A8B3BD; - box-sizing: border-box; - } - } - } - .emphasis{ - font-weight: 700; - } - .order_price_num{ - color: $color_main; - font-weight: 700; - text{ - &:nth-child(1) { - font-size: $font_size_min; - } - &:nth-child(2) { - font-size: 26px; - } - &:nth-child(3) { - font-size: $font_size_medium; - } - } - } - .emphasis_num{ - text{ - &:nth-child(2) { - font-size: $font_size_big; - } - } - } - -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/estimatedAmount/index.tsx b/src/pages/cutOrder/components/estimatedAmount/index.tsx deleted file mode 100644 index 04bc49a..0000000 --- a/src/pages/cutOrder/components/estimatedAmount/index.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Text, View } from "@tarojs/components" -import { memo, useCallback, useEffect, useMemo } from "react" -import {formatKbPrice} from '@/common/common' -import classnames from "classnames"; -import styles from './index.module.scss' -import AmountShow from "../amountShow"; -type Param = { - style?: Object, - number?: number, - title?: string, - titleStatus?: true|false, //true 标题加大加深 - numberStatus?: 0|1|2, //数字尺寸 -} -export default memo(({style, number = 0, titleStatus = true, title = '', numberStatus = 1}:Param) => { - return ( - <> - - - {title} - - - {/* 123123123121212312312312312 */} - - - - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/kindList/index.module.scss b/src/pages/cutOrder/components/kindList/index.module.scss deleted file mode 100644 index 2d9b040..0000000 --- a/src/pages/cutOrder/components/kindList/index.module.scss +++ /dev/null @@ -1,108 +0,0 @@ - -.orders_list_title{ - padding: 20px 20px 10px 20px; - color: $color_font_two; - font-size: $font_size_medium; -} -.orders_list_con{ - - background-color: #fff; - border-radius: 20px; - padding: 20px; - .order_list{ - &:nth-child(n+2) { - margin-top: 30px; - } - .order_list_title{ - display: flex; - align-items: center; - .tag{ - font-size: $font_size_min; - background-color: #CDE5FF; - padding: 5px 10px; - border-radius: 6px; - color: $color_main; - } - .title{ - font-weight: 700; - font-size: $font_size; - margin-left: 20px; - flex:1; - } - .num{ - color: $color_font_two; - font-size: $font_size_min; - } - } - } - .order_list_scroll{ - margin-top: 30px; - - .order_list_item { - display: flex; - &:nth-child(2) { - margin-top: 30px; - } - .order_list_item_img{ - width: 126px; - height: 126px; - border-radius: 20px; - } - .order_list_item_con{ - display: flex; - width: 100%; - flex:1; - border-bottom: 1px solid #f0f0f0; - height: 150px; - padding-top: 20px; - box-sizing: border-box; - } - .order_list_item_des{ - flex:1; - box-sizing: border-box; - padding-left: 30px; - .order_list_item_title{ - font-weight: 700; - font-size: $font_size; - margin-bottom: 15px; - } - .order_list_item_price{ - font-size: 26px; - color: $color_font_three; - } - } - .order_list_item_count{ - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-end; - .count_num{ - color: $color_main; - font-size: $font_size; - margin-bottom: 15px; - font-weight: 400; - text{ - font-size: $font_size_min; - } - } - .count_price { - font-size: $font_size; - font-weight: 700; - text{ - font-size: $font_size_min; - } - } - } - } - } - .order_estimated_amount{ - display: flex; - align-items: flex-end; - flex-direction: column; - padding: 30px 0; - .order_price_des{ - font-size: $font_size_medium; - color: $color_font_two; - } - } -} diff --git a/src/pages/cutOrder/components/kindList/index.tsx b/src/pages/cutOrder/components/kindList/index.tsx deleted file mode 100644 index b2491f8..0000000 --- a/src/pages/cutOrder/components/kindList/index.tsx +++ /dev/null @@ -1,169 +0,0 @@ -import { ORDER_STATUS } from "@/common/enum" -import { formatHashTag, formatPriceDiv } from "@/common/fotmat" -import LabAndImg from "@/components/LabAndImg" -import { View } from "@tarojs/components" -import { memo, useCallback, useMemo } from "react" -import EstimatedAmount from "../estimatedAmount" -import styles from './index.module.scss' - -type OrderParam = { - estimate_amount: number, //预估金额 - list: any[], - sale_mode: number, - sale_mode_name: string, - unit: string, - total_colors: number, - total_fabrics: number, - total_number: number, - status: number, //订单状态 - total_sale_price: number, //销售金额 - total_should_collect_money: number, //应收金额 - total_weight_error_discount: number, //空差优惠 - the_previous_status: number, //取消订单时的订单状态 - actual_amount: number //实付金额 -} - -type Param = { - order: OrderParam, - comfirm?: boolean //是否是确认订单页面使用 -} - -export default memo(({order, comfirm = false}:Param) => { - //对应数量 - const formatCount = useCallback((item) => { - return order?.sale_mode == 0? item.roll : Number(item.length / 100) - }, [order]) - //对应单价 - const standardPrice = useCallback(price => { - return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') - }, [order]) - - //数量格式 - const numText = useMemo(() => { - if(order) - return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` - }, [order]) - - const { - SaleOrderStatusBooking, // 待接单 - SaleOrderStatusArranging, // 配布中 - SaleOrderStatusArranged, // 已配布 - SaleOrderStatusWaitingPayment, // 待付款 - SaleOrderStatusWaitingDelivery, // 待发货 - SaleOrderStatusWaitingReceipt, // 待收货 - SaleOrderStatusAlreadyReceipt, // 已收货 - SaleOrderStatusComplete, // 已完成 - SaleOrderStatusRefund, // 已退款 - SaleOrderStatusCancel, // 已取消 - } = ORDER_STATUS - - //金额列表枚举 - const priceList = [ - { - id:1, - value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value], - label:'预估金额', - field: 'estimate_amount' - }, - { - id:2, - value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], - label:'合计金额', - field: 'total_sale_price' - }, - { - id:3, - value:[SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], - label:'空差优惠', - field: 'total_weight_error_discount' - }, - { - id:4, - value:[ SaleOrderStatusWaitingPayment.value], - label:'应付金额', - field: 'total_should_collect_money' - }, - { - id:5, - value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], - label:'实付金额', - field: 'actual_amount' - } - ] - - //是否显示价格 - const showPrice = useCallback((priceInfo, status) => { - return priceInfo.value.includes(status) - }, [order]) - - const priceConDom = useMemo(() => { - if(!order) return - //确认订单 - if(comfirm == true) { - return - } - //订单为取消订单状态 - if(order?.status == SaleOrderStatusCancel.value) { - return ( - <> - { - priceList.map(item => { - return <>{showPrice(item, order?.the_previous_status)&&} - }) - } - - ) - } else { - return ( - <> - { - priceList.map(item => { - return <>{showPrice(item, order?.status)&&} - }) - } - - ) - } - }, [order]) - - return ( - <> - {numText} - - { - order?.list?.map(item => { - return - - {order.sale_mode_name} - {formatHashTag(item.code, item.name)} - 共{item?.product_colors.length}种 - - - {item?.product_colors?.map(colorItem => { - return - - - - - - {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} - - - ×{formatCount(colorItem)}{order.unit} - ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} - - - - })} - - - }) - } - - {priceConDom} - - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/offlinePay/index.module.scss b/src/pages/cutOrder/components/offlinePay/index.module.scss deleted file mode 100644 index f84e995..0000000 --- a/src/pages/cutOrder/components/offlinePay/index.module.scss +++ /dev/null @@ -1,46 +0,0 @@ -$top:170px; -.offlinePay_main{ - .offlinePay_con{ - padding: 20px; - background-color: #F6F6F6; - border-radius: 20px; - .miconfont_title{ - transform: rotate(-180deg); - position: absolute; - left: 20px; - top: 27px; - font-size: 37px; - color: $color_font_three; - z-index: 99; - } - } - .title{ - font-size: $font_size_big; - color: #000000; - text-align: center; - font-weight: 700; - position: relative; - - } - - .offlinePay_list{ - border-radius: 10px; - padding: 60px 0; - .offlinePay_con_text{ - font-size: $font_size; - font-weight: 700; - } - } - .btns{ - background: #007aff; - border-radius: 40px; - width: 668px; - height: 82px; - text-align: center; - line-height: 80px; - width: 100%; - color: #fff; - font-size: 32px; - margin-top: 30px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/offlinePay/index.tsx b/src/pages/cutOrder/components/offlinePay/index.tsx deleted file mode 100644 index 4022374..0000000 --- a/src/pages/cutOrder/components/offlinePay/index.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { Text, View } from "@tarojs/components"; -import { memo } from "react"; -import AmountShow from "../amountShow"; -import classnames from "classnames"; -import styles from './index.module.scss' - -import MCheckbox from "@/components/checkbox"; -import Popup from "@/components/popup"; -import SearchInput from "@/components/searchInput"; -import Taro from "@tarojs/taro"; - -type Param = { - show?: true|false, - onClose?: () => void -} -export default memo(({show = true, onClose}:Param) => { - //复制功能 - const clipboardData = () => { - Taro.setClipboardData({ - data: '开户名称:佛山市浩川盛世科技有限公司; 开户银行:招商银行汾江支行; 转账汇款账号:62062342120001221231212', - success: function (res) { - Taro.showToast({ - icon: 'none', - title: '复制成功' - }) - } - }) - } - return ( - - - - - 线下汇款 - - - 佛山市浩川盛世科技有限公司 - - - 招商银行汾江支行 - - - 62062342120001221231212 - - - 复制信息 - - - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState copy/index.module.scss b/src/pages/cutOrder/components/orderState copy/index.module.scss deleted file mode 100644 index 78bda44..0000000 --- a/src/pages/cutOrder/components/orderState copy/index.module.scss +++ /dev/null @@ -1,18 +0,0 @@ -.order_flow_state{ - display: flex; - align-items: center; - padding: 0 30px; - height: 116px; - background-color: #fff; - border-radius: 20px; - .order_flow_state_text{ - color: $color_main; - font-size:$font_size; - font-weight: 700; - } - .order_flow_state_desc{ - color: $color_font_three; - font-size: $font_size_medium; - margin-left: 50px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState copy/index.tsx b/src/pages/cutOrder/components/orderState copy/index.tsx deleted file mode 100644 index 58fec4d..0000000 --- a/src/pages/cutOrder/components/orderState copy/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { View } from "@tarojs/components" -import styles from './index.module.scss' - -export default ({ - state = '', - desc = '' -}) => { - return ( - - {state} - {desc} - - ) -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState/index.module.scss b/src/pages/cutOrder/components/orderState/index.module.scss deleted file mode 100644 index 90dbcbb..0000000 --- a/src/pages/cutOrder/components/orderState/index.module.scss +++ /dev/null @@ -1,105 +0,0 @@ -.order_flow_state{ - background-color: #fff; - border-radius: 20px; - padding: 20px; - box-sizing:border-box; - position: relative; - overflow: hidden; - .order_status_list{ - max-height: 250px; - overflow: hidden; - transition: all 0.3s ease-in-out; - } - .order_status_list_show { - max-height: 1000px !important; - } - .order_status_item{ - position: relative; - padding-left: 50px; - &:nth-last-child(n+2) { - padding-bottom: 30px; - } - .order_status_tail_end, .order_status_tail{ - width: 15px; - height: 15px; - border: 2px solid $color_main; - background-color: #fff; - border-radius: 50%; - position:absolute; - left: 0; - top: 10px; - z-index: 10; - } - .order_status_tail_end{ - background-color: $color_main; - } - .order_status_line{ - border-left: 2px solid $color_main; - height: 100%; - top: 10px; - left: 9px; - position: absolute; - z-index: 1; - } - .order_status_content{ - display: flex; - align-items: center; - .order_status_title{ - color: $color_font_two; - font-size: $font_size; - font-weight: 700; - } - .order_status_time{ - color: $color_font_two; - font-size: $font_size_medium; - padding: 0 20px; - } - .order_status_tag{ - font-size: $font_size_min; - background: #F0F0F0; - border-radius: 6px; - padding: 5px 10px; - color: $color_font_two; - } - .order_status_select{ - color: $color_main; - } - .order_status_tag_select{ - color: $color_main; - } - } - .order_status_des{ - color: $color_font_two; - font-size: $font_size_medium; - } - .order_status_des_select{ - color: $color_font_one; - } - } - .more{ - width: 100%; - text-align: center; - font-size: $font_size_min; - color: $color_font_one; - padding-top: 20px; - .miconfonts{ - display: inline-block; - font-size: 25px; - transform:rotate(90deg); - } - .open_miconfonts{ - transform:rotate(-90deg); - } - } - .image_tag{ - width: 140px; - height: 144px; - .image{ - width: 140px; - height: 144px; - } - position: absolute; - top: -10px; - right: -10px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/orderState/index.tsx b/src/pages/cutOrder/components/orderState/index.tsx deleted file mode 100644 index 18ac43d..0000000 --- a/src/pages/cutOrder/components/orderState/index.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Image, Text, View } from "@tarojs/components" -import { memo, useMemo, useState } from "react" -import styles from './index.module.scss' -import classnames from "classnames"; -import { formatDateTime, formatImgUrl } from "@/common/fotmat"; -import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; - - - -type Param = { - list: { - status: string, - time: string, - tag: string, - desc: string - }[], - payment_method: 0|PAYMENT_METHOD_PARAM, - -} - -//支付方式枚举 -const { - PaymentMethodAccountPeriod, - PaymentMethodCashOnDelivery, -} = PAYMENT_METHOD - -export default memo(({list = [], payment_method = 0}:Param) => { - - const [showMore, setShowMore] = useState(false) - const changeMore = () => { - setShowMore(() => !showMore) - } - const dataList = useMemo(() => { - return list.reverse() - }, [list]) - - return ( - <> - {(dataList.length > 0)&& - - {dataList.map((item, index) => - {(dataList.length > 1)&&} - {(dataList.length != (index + 1))&&} - - {item.status} - {formatDateTime(item.time)} - {/* {item.tag} */} - - {item.desc} - )} - - {(dataList.length > 2) && changeMore()}> - {showMore&&'收起详情'||'点击查看详情'} - - } - - {(payment_method == PaymentMethodCashOnDelivery.value)&&} - {(payment_method == PaymentMethodAccountPeriod.value)&&} - - } - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/payment/index.module.scss b/src/pages/cutOrder/components/payment/index.module.scss deleted file mode 100644 index 340b0ed..0000000 --- a/src/pages/cutOrder/components/payment/index.module.scss +++ /dev/null @@ -1,126 +0,0 @@ -$top:190px; -.payment_main{ - .payment_con{ - padding: 20px; - background-color: #F6F6F6; - border-radius: 20px; - .miconfont_title{ - transform: rotate(-180deg); - position: absolute; - left: 20px; - top: 27px; - font-size: 37px; - color: $color_font_three; - z-index: 99; - } - - } - .title{ - font-size: $font_size_big; - color: #000000; - text-align: center; - font-weight: 700; - position: relative; - - } - .amount{ - text-align: center; - padding: 25px 0; - } - - .payment_list{ - background-color: #fff; - // box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.16); - min-height: 300px; - border-radius: 10px; - padding-bottom: 100px; - position: relative; - background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat , - radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat; - filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16)); - position: relative; - &::before{ - content: ''; - position: absolute; - border-bottom: 3px dashed #ccc; - top: $top; - width: calc(100% - 100px); - left:0; - right: 0; - margin: auto; - - } - .payment_list_top_border{ - height: 32px; - width: 100%; - background: linear-gradient(215deg,#cde5ff 2%, #cde5ff 2%, #68b4ff 72%); - border-radius: 10px 10px 0px 0px; - } - .payment_list_title{ - text-align: center; - padding: 30px 0 50px 0; - font-size: $font_size; - color: $color_font_three; - .payment_list_title_price_item{ - display: flex; - justify-content: space-between; - padding: 0 90px; - &:nth-child(1) { - margin-bottom: 15px; - } - } - text{ - &:nth-child(2) { - color: $color_main; - } - } - } - .payment_list_con{ - padding: 20px 30px 0 30px; - .payment_list_item{ - display: flex; - justify-content: space-between; - align-items: center; - height: 123px; - &:nth-last-child(n+2) { - border-bottom: 2px solid #F3F3F3; - } - } - .payment_list_item_left{ - display: flex; - flex-direction: column; - font-size: $font_size; - .payment_list_item_left_name{ - display: flex; - align-items: center; - } - .miconfont{ - font-size: 30px; - color: #FFC300; - padding-right: 10px; - } - .payment_list_item_left_price{ - font-size: $font_size_min; - color: $color_font_two; - padding-left: 35px; - padding-top: 5px; - } - } - .miconfont_more{ - font-size: 20px; - } - } - } - .btns{ - background: #007aff; - border-radius: 40px; - width: 668px; - height: 82px; - text-align: center; - line-height: 80px; - width: 100%; - color: #fff; - font-size: 32px; - margin-top: 30px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/payment/index.tsx b/src/pages/cutOrder/components/payment/index.tsx deleted file mode 100644 index 86d4306..0000000 --- a/src/pages/cutOrder/components/payment/index.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import { Text, View } from "@tarojs/components"; -import { memo, useCallback, useEffect, useMemo, useState } from "react"; -import AmountShow from "../amountShow"; -import classnames from "classnames"; -import styles from './index.module.scss' - -import MCheckbox from "@/components/checkbox"; -import Popup from "@/components/popup"; -import OfflinePay from "../offlinePay"; -import ScanPay from "../scanPay"; -import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay"; -import { formatPriceDiv } from "@/common/fotmat"; -import {alert} from "@/common/common" -import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; - -type Param = { - show?: true|false, - onClose?: () => void, - onSubmitSuccess?: () => void, //支付成功 - orderInfo?: OrderInfo -} - -type OrderInfo = { - orderId: number, //应付单id - payment_method: 0|PAYMENT_METHOD_PARAM //支付方式 -} - -type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款 -export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => { - - //提交参数 - const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({ - id:0, - payment_method: null - }) - - //线下付款 - const [offlinePayShow, setofflinePayShow] = useState(false) - const onShowOfflinePay = () => { - setofflinePayShow(true) - onClose?.() - } - - //扫码支付 - const [scanPayShow, setScanPayShow] = useState(false) - const onShowScanPay = () => { - setScanPayShow(true) - onClose?.() - } - - //获取支付方式数据 - const [payInfo, setPayInfo] = useState() - const {fetchData: orderFetchData} = GetOrderPayApi() - const getOrderPay = async () => { - let {data} = await orderFetchData({id: orderInfo?.orderId}) - setPayInfo(() => data) - } - useEffect(() => { - if(show&&orderInfo?.orderId) { - setSubmitData((val) => ({...val, id:orderInfo.orderId})) - getOrderPay() - } - }, [show, orderInfo]) - - //预存款选择 - const advanceSelectData = useCallback((val) => { - setSubmitData((e) => ({...e, payment_method:val})) - }, []) - - //账期选择 - const periodSelectData = (val) => { - setSubmitData((e) => ({...e, payment_method:val})) - } - - //提交支付 - const {fetchData: submitFetchData} = SubmitOrderPayApi() - const submitPay = async () => { - if(submitData.payment_method === null) { - alert.error('请选择支付方式') - return false - } - alert.loading('正在支付') - let res = await submitFetchData(submitData) - if(res.success) { - alert.success('支付成功') - onSubmitSuccess?.() - } else { - alert.none(res.msg) - } - } - - //预付款 - const advance_payment = useMemo(() => { - const price = payInfo?.should_collect_money - payInfo?.amount_paid - return ( - {(payInfo?.advance_deposit_balance < price)&&'余额不足,' }剩余 ¥{formatPriceDiv(payInfo?.advance_deposit_balance)} - ) - }, [payInfo]) - - //账期 - const account_peyment = useMemo(() => { - const price = payInfo?.should_collect_money - payInfo?.amount_paid - return ( - {(payInfo?.account_period_credit_available_line < price)&&'额度不足, '}剩余 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)} - ) - }, [payInfo]) - - //支付方式枚举 - const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD - - return ( - - - - - 订单支付 - - - - - - - {/* 向商家发起支付 */} - - - 订单金额 - ¥{formatPriceDiv(payInfo?.should_collect_money)} - - - 已付金额 - ¥{formatPriceDiv(payInfo?.amount_paid)} - - - - - - - - - 预存款 - - {advance_payment} - - advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/> - - {(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&& - - - - {payInfo?.account_period}天账期 - - {/* 可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)} */} - {account_peyment} - - periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/> - } - - - - - 线下汇款 - - - - - - - - - 扫码支付 - - - - - - - 确认交易 - - - setofflinePayShow(false)}/> - setScanPayShow(false)}/> - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/remark/index.module.scss b/src/pages/cutOrder/components/remark/index.module.scss deleted file mode 100644 index d624050..0000000 --- a/src/pages/cutOrder/components/remark/index.module.scss +++ /dev/null @@ -1,48 +0,0 @@ -.order_popup{ - display: flex; - flex-direction: column; - align-items: center; - padding: 20px 0; - .order_popup_title{ - color: $font_size_big; - font-weight: 700; - color: #000000; - padding-bottom: 20px; - } - .order_popup_input{ - width: 100%; - padding: 0 25px; - box-sizing: border-box; - margin-top: 43px; - position: relative; - .descDataNum{ - position: absolute; - right: 40px; - bottom: 10px; - height: 39px; - font-size: $font_size_medium; - color: $color_font_two; - } - textarea{ - background-color: #f3f3f3; - border-radius: 10px; - width: 100%; - height: 313px; - padding: 20px; - padding-bottom: 50px; - box-sizing: border-box; - font-size: $font_size; - border: 2px solid #e6e6e6; - } - } - .order_save_address{ - height: 82px; - background: #007aff; - border-radius: 40px; - width: 668px; - text-align: center; - line-height: 82px; - color: #fff; - margin-top: 60px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/remark/index.tsx b/src/pages/cutOrder/components/remark/index.tsx deleted file mode 100644 index 14d981b..0000000 --- a/src/pages/cutOrder/components/remark/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import Popup from "@/components/popup" -import { Textarea, View } from "@tarojs/components" -import { useCallback, useState } from "react" -import styles from './index.module.scss' - -type Param = { - onBlur?: (val:any) => void - onSave?: (val: string) => void -} -export default ({onBlur, onSave}:Param) => { - 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 setSave = () => { - onSave?.(descData.value) - } - return ( - - 编辑备注 - - - {descData.number}/{descData.count} - - setSave()}>保存 - - ) -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/scanPay/index.module.scss b/src/pages/cutOrder/components/scanPay/index.module.scss deleted file mode 100644 index dcb356d..0000000 --- a/src/pages/cutOrder/components/scanPay/index.module.scss +++ /dev/null @@ -1,54 +0,0 @@ -$top:170px; -.scanPay_main{ - .scanPay_con{ - padding: 20px; - background-color: #F6F6F6; - border-radius: 20px; - .miconfont_title{ - transform: rotate(-180deg); - position: absolute; - left: 20px; - top: 27px; - font-size: 37px; - color: $color_font_three; - z-index: 99; - - } - } - .title{ - font-size: $font_size_big; - color: #000000; - text-align: center; - font-weight: 700; - position: relative; - } - .desc{ - font-size: $font_size_min; - color: $color_main; - text-align: center; - padding: 10px 0; - .miconfont{ - font-size: 25px; - } - } - - .scanPay_list{ - border-radius: 10px; - height: 900px; - image{ - width: 100%; - } - } - .btns{ - background: #007aff; - border-radius: 40px; - width: 668px; - height: 82px; - text-align: center; - line-height: 80px; - width: 100%; - color: #fff; - font-size: 32px; - margin-top: 30px; - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/scanPay/index.tsx b/src/pages/cutOrder/components/scanPay/index.tsx deleted file mode 100644 index d6fb06e..0000000 --- a/src/pages/cutOrder/components/scanPay/index.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import { Image, ScrollView, Text, View } from "@tarojs/components"; -import { memo, useEffect, useRef, useState } from "react"; -import classnames from "classnames"; -import styles from './index.module.scss' -import Popup from "@/components/popup"; -import Taro from "@tarojs/taro"; -import { alert } from "@/common/common"; -import { formatImgUrl } from "@/common/fotmat"; -import useCheckAuthorize from "@/use/useCheckAuthorize"; -import { GetPayCode } from "@/api/onlinePay"; -import LoadingCard from "@/components/loadingCard"; - - -type Param = { - show?: true|false, - onClose?: () => void -} - - -type Item = { - product_code: string, - product_name: string, - product_color_code: string, - product_color_name: string, - num: string, - weight: string, - sale_price: string, - total_price: string -} -type CodeParam = { - title: string, - company: string, - order_type: string, - sale_user: string, - order_created_time: string, - order_no: string, - department: string, - shipment_mode: string, - target_user_name: string, - target_address: string, - target_description: string, - pay_account: string, - bank_account_name: string, - bank_name: string, - pay_type: string, - client: string, - phone: string, - order_total_length: string, - order_total_price: string, - qrcode: string, - order_total_weight: string, - list: Item[] -} -export default memo(({show = true, onClose}:Param) => { - - //获取支付二维码 - const [payCodeImage, setPayCodeImage] = useState('') - const fileData = useRef({ - filePath: '', - base64: '' - }) - const {fetchData, state} = GetPayCode() - const getCore = async () => { - let res = await fetchData({ - title: "面料销售电子确认单", - company: "什么什么公司123", - order_type: "散剪", - sale_user: "小崔", - order_created_time:"2022/02/01 12:32:13", - order_no:"XS-211005888", - department:"嘻嘻嘻", - shipment_mode:"自提", - target_user_name:"大崔", - target_address:"阿斯顿发斯蒂芬", - target_description:"无", - pay_account:"1234567890123450001", - bank_account_name:"佛山市浩川长盛科技有限公司", - bank_name:"招商银行佛山分行禅城支行", - pay_type:"现结", - client:"客户名称", - phone:"15818085802", - order_total_length:"12", - order_total_price:"63000", - qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888", - order_total_weight:"300.00", - list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}] - }) - const base64 = res.data.base64 - setPayCodeImage(() => base64) - const time = new Date().valueOf() - const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || []; - let filePath = Taro.env.USER_DATA_PATH + '/img' + time +'.'+ format - fileData.current.filePath = filePath - fileData.current.base64 = bodyData - const save = Taro.getFileSystemManager() - save.writeFile({ - filePath: fileData.current.filePath, - data: fileData.current.base64, - encoding: 'base64', - }) - - } - useEffect(() => { - if(show) - getCore() - }, [show]) - - //检查是否开启保存图片权限 - const {check} = useCheckAuthorize({scope:'scope.writePhotosAlbum', msg:'您没授权,无法保存图片'}) - const saveImageCheck = async () => { - const res = await check() - res&&saveImage() - } - - //保存图片 - const saveImage = () => { - alert.loading('正在保存图片') - Taro.saveImageToPhotosAlbum({ - filePath: fileData.current.filePath, - success: function (res) { - alert.success('图片保存成功') - }, - fail: function (err) { - console.log('err::', err) - } - }) - } - - //预览图片 - const showImage = () => { - console.log('fileData.current.filePath::', fileData.current.filePath) - Taro.previewImage({ - current: fileData.current.filePath, // 当前显示 - urls: [fileData.current.filePath] // 需要预览的图片http链接列表 - }) - } - - //复制功能 - return ( - - - - - 扫码支付 - - - 扫码支付成功后,自动更新状态 - - - {(state.loading)&&|| - - - } - - 保存电子确认单 - - - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/shipmentMode/index.module.scss b/src/pages/cutOrder/components/shipmentMode/index.module.scss deleted file mode 100644 index 5f818f9..0000000 --- a/src/pages/cutOrder/components/shipmentMode/index.module.scss +++ /dev/null @@ -1,33 +0,0 @@ - - .order_title{ - display: flex; - align-items: center; - padding: 20px 30px; - box-sizing: border-box; - background-color: #fff; - height: 116px; - border-radius: 20px; - margin-top: 20px; - text{ - flex:1; - font-size: $font_size; - font-weight: 700; - } - .order_status{ - background-color: #F0F0F0; - width: 148px; - height: 55px; - color: $color_font_three; - text-align: center; - line-height: 55px; - font-size: $font_size_medium; - border-radius: 30px; - &:nth-last-child(1) { - margin-left: 20px; - } - } - .order_status_selected{ - color: $color_main; - border: 1px solid $color_main; - } - } \ No newline at end of file diff --git a/src/pages/cutOrder/components/shipmentMode/index.tsx b/src/pages/cutOrder/components/shipmentMode/index.tsx deleted file mode 100644 index 235591c..0000000 --- a/src/pages/cutOrder/components/shipmentMode/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Text, View } from "@tarojs/components" -import styles from './index.module.scss' -import classnames from "classnames"; -import { memo, useRef, useState } from "react"; - -type Param = { - onSelect?:(val:number) => void -} -export default memo(({onSelect}: Param) => { - //收货方法 1:自提,2:物流 - const shipmentMode = useRef([ - {value:1, label:'上门自提', selected:false}, - {value:2, label:'物流', selected:false} - ]) - const [selectValue, setSelectValue] = useState() - const selectShipmentMode = (value) => { - setSelectValue(() => value) - onSelect?.(value) - } - return ( - - 收货方式 - {shipmentMode.current.map(item => { - return selectShipmentMode(item.value)}>{item.label} - })} - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/submitOrderBtn/index.module.scss b/src/pages/cutOrder/components/submitOrderBtn/index.module.scss deleted file mode 100644 index c5ac9ed..0000000 --- a/src/pages/cutOrder/components/submitOrderBtn/index.module.scss +++ /dev/null @@ -1,69 +0,0 @@ -.order_price{ - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - &:nth-last-child(n+2) { - margin-bottom: 30px; - } - .order_price_text{ - font-size: $font_size_medium; - // margin-right: 10px; - display: flex; - .iconfont_msg{ - position: relative; - } - .miconfont{ - font-size: 30px; - font-weight: normal; - } - .message{ - position: absolute; - top: -50px; - background: #A8B3BD; - z-index: 9; - min-height: 50px; - border-radius: 10px; - padding: 10px; - box-sizing: border-box; - &::before{ - z-index: 1; - position: absolute; - bottom: -7px; - left: 10px; - width: 15px; - height: 15px; - content: " "; - transform: rotate(45deg); - background: #A8B3BD; - box-sizing: border-box; - } - } - } - .emphasis{ - font-weight: 700; - } - .order_price_num{ - color: $color_main; - font-weight: 700; - text{ - &:nth-child(1) { - font-size: $font_size_min; - } - &:nth-child(2) { - font-size: 26px; - } - &:nth-child(3) { - font-size: $font_size_medium; - } - } - } - .emphasis_num{ - text{ - &:nth-child(2) { - font-size: $font_size_big; - } - } - } - -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/submitOrderBtn/index.tsx b/src/pages/cutOrder/components/submitOrderBtn/index.tsx deleted file mode 100644 index 20ed202..0000000 --- a/src/pages/cutOrder/components/submitOrderBtn/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { Text, View } from "@tarojs/components" -import { memo, useCallback, useEffect, useMemo } from "react" -import {formatKbPrice} from '@/common/common' -import classnames from "classnames"; -import styles from './index.module.scss' -type Param = { - style?: Object, - number?: number -} -export default memo(({style, number = 0}:Param) => { - const priceDom = useCallback(() => { - let res = number.toFixed(2).split('.') - let int_num = parseInt(res[0]) + '' - let decimals_num = res[1] - return ( - <> - ¥ - {Number(int_num).toLocaleString()} - .{decimals_num} - - ) - }, [number]) - return ( - <> - - - 预估金额 - - - {/* 123123123121212312312312312 */} - - - - {priceDom()} - - - - - ) -}) \ No newline at end of file diff --git a/src/pages/cutOrder/components/weightMemo/index.module.scss b/src/pages/cutOrder/components/weightMemo/index.module.scss deleted file mode 100644 index 3c74511..0000000 --- a/src/pages/cutOrder/components/weightMemo/index.module.scss +++ /dev/null @@ -1,39 +0,0 @@ - -.weight_memo{ - background-color: #fff; - border-radius: 20px; - padding: 0 20px; - .weight_memo_item{ - display: flex; - justify-content: space-between; - height: 130px; - &:nth-child(1) { - border-bottom: 1px solid #f3f3f3; - } - .title, .desc{ - display: flex; - align-items: center; - } - .title { - font-size: $font_size; - font-weight: 700; - } - .desc{ - color: $color_font_two; - font-size: $font_size_medium; - } - .miconfont_check, .miconfont_custom{ - font-size: 37px; - color: $color_main; - font-weight: normal; - padding-right: 10px; - } - .miconfont_custom{ - color:#FFC300; - } - .miconfont_more{ - font-size: 30px; - padding-left: 10px; - } - } -} \ No newline at end of file diff --git a/src/pages/cutOrder/components/weightMemo/index.tsx b/src/pages/cutOrder/components/weightMemo/index.tsx deleted file mode 100644 index 7cbfd13..0000000 --- a/src/pages/cutOrder/components/weightMemo/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import Popup from "@/components/popup" -import { Text, Textarea, View } from "@tarojs/components" -import { memo, useCallback, useState } from "react" -import styles from './index.module.scss' -import classnames from "classnames"; - -type Param = { - onCheck?: () => void - onCustom?: () => void -} -export default memo(({onCheck, onCustom}:Param) => { - return ( - - onCheck?.()}> - - - 陆盈纺织 - - - 查看原码单 - - - - onCustom?.()}> - - - 我的码单 - - - 自定义 - - - - - ) -}) \ No newline at end of file diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index e8a8a45..d3feb71 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -73,7 +73,8 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; total_number: preViewOrder.total_number, //总数量 total_fabrics: preViewOrder.total_fabrics, //面料数量 unit: preViewOrder.sale_mode == 0?'条':'m', //单位 - list: preViewOrder.product_list + list: preViewOrder.product_list, + total_should_collect_money: preViewOrder.total_should_collect_money //应收金额 }) } const formatPreViewOrderMemo = useMemo(() => { @@ -149,7 +150,11 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; if (res.confirm) { const res = await saleOrderFetchData(submitOrderData) if(res.success) { - goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') + if(preViewOrder?.sale_mode == 0) { + goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') + } else if (preViewOrder?.sale_mode == 1) { + goLink('/pages/order/cutOrder/index',{id: res.data.id}, 'redirectTo') + } } else { alert.none(res.msg) } @@ -174,7 +179,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; - + {`${formatPreViewOrder?.total_fabrics}种面料,${formatPreViewOrder?.total_colors}种颜色,共${formatPreViewOrder?.total_number + formatPreViewOrder?.unit}`} submitOrderEven()}>提交订单 diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index b2491f8..01b7628 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -24,7 +24,7 @@ type OrderParam = { } type Param = { - order: OrderParam, + order: OrderParam, comfirm?: boolean //是否是确认订单页面使用 } @@ -96,14 +96,14 @@ export default memo(({order, comfirm = false}:Param) => { return priceInfo.value.includes(status) }, [order]) + //金额展示 const priceConDom = useMemo(() => { if(!order) return - //确认订单 if(comfirm == true) { - return - } - //订单为取消订单状态 - if(order?.status == SaleOrderStatusCancel.value) { + //确认订单时 + return (order.sale_mode == 1)? : + } else if(order?.status == SaleOrderStatusCancel.value) { + //订单状态为取消订单时 return ( <> { @@ -114,6 +114,7 @@ export default memo(({order, comfirm = false}:Param) => { ) } else { + //其他订单状态 return ( <> { diff --git a/src/pages/order/components/submitOrderBtn/index.tsx b/src/pages/order/components/submitOrderBtn/index.tsx index 20ed202..d84e61e 100644 --- a/src/pages/order/components/submitOrderBtn/index.tsx +++ b/src/pages/order/components/submitOrderBtn/index.tsx @@ -4,10 +4,12 @@ import {formatKbPrice} from '@/common/common' import classnames from "classnames"; import styles from './index.module.scss' type Param = { - style?: Object, - number?: number + style?: Object, + number?: number, //数量 + priceTitle: string //描述 + } -export default memo(({style, number = 0}:Param) => { +export default memo(({style, number = 0, priceTitle = ''}:Param) => { const priceDom = useCallback(() => { let res = number.toFixed(2).split('.') let int_num = parseInt(res[0]) + '' @@ -24,7 +26,7 @@ export default memo(({style, number = 0}:Param) => { <> - 预估金额 + {priceTitle} {/* 123123123121212312312312312 */} diff --git a/src/pages/cutOrder/index.config.ts b/src/pages/order/cutOrder/index.config.ts similarity index 100% rename from src/pages/cutOrder/index.config.ts rename to src/pages/order/cutOrder/index.config.ts diff --git a/src/pages/cutOrder/index.module.scss b/src/pages/order/cutOrder/index.module.scss similarity index 100% rename from src/pages/cutOrder/index.module.scss rename to src/pages/order/cutOrder/index.module.scss diff --git a/src/pages/cutOrder/index.tsx b/src/pages/order/cutOrder/index.tsx similarity index 93% rename from src/pages/cutOrder/index.tsx rename to src/pages/order/cutOrder/index.tsx index 582f333..c1b1bee 100644 --- a/src/pages/cutOrder/index.tsx +++ b/src/pages/order/cutOrder/index.tsx @@ -14,13 +14,12 @@ import { Text, Textarea, View } from "@tarojs/components" import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import order from "../orderList/components/order"; -import AddressInfoDetail from "./components/addressInfoDetail"; -import KindList from "./components/kindList"; -import OrderState from "./components/orderState"; -import Payment from "./components/payment"; -import Remark from "./components/remark"; -import styles from './index.module.scss' +import AddressInfoDetail from "../components/addressInfoDetail"; +import KindList from "../components/kindList"; +import OrderState from "../components/orderState"; +import Payment from "../components/payment"; +import Remark from "../components/remark"; +import styles from '../index.module.scss' export default () => { const [showDesc, setShowDesc] = useState(false) @@ -192,7 +191,7 @@ import styles from './index.module.scss' - + 订单信息 diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 582f333..3cecfc4 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -14,7 +14,6 @@ import { Text, Textarea, View } from "@tarojs/components" import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import order from "../orderList/components/order"; import AddressInfoDetail from "./components/addressInfoDetail"; import KindList from "./components/kindList"; import OrderState from "./components/orderState"; From 4903c026b037f14b50c9ee4282715f9b136a6991 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 10 Jun 2022 20:30:30 +0800 Subject: [PATCH 16/47] =?UTF-8?q?=E5=89=AA=E6=9D=BF=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/orderPay.ts | 14 +++++++-- src/common/enum.ts | 2 +- src/components/orderBtns/index.tsx | 6 ++-- src/pages/applyAfterSales/index.module.scss | 2 +- src/pages/applyAfterSales/index.tsx | 30 +++---------------- src/pages/order/components/kindList/index.tsx | 3 +- 6 files changed, 23 insertions(+), 34 deletions(-) diff --git a/src/api/orderPay.ts b/src/api/orderPay.ts index 99ba9d9..49da5de 100644 --- a/src/api/orderPay.ts +++ b/src/api/orderPay.ts @@ -1,7 +1,7 @@ import { useRequest } from "@/use/useHttp" /** - * 获取订单支付方式信息 + * 获取应收单订单支付方式信息 */ export const GetOrderPayApi = () => { return useRequest({ @@ -11,11 +11,21 @@ import { useRequest } from "@/use/useHttp" } /** - * 订单支付提交 + * 应收单订单支付提交 */ export const SubmitOrderPayApi = () => { return useRequest({ url: `/v1/mall/orderPayment/orderPaymentSubmission`, method: "put", }) +} + +/** + * 获取应收单订单支付方式信息 + */ + export const GetOrderPayApi2 = () => { + return useRequest({ + url: `/v1/mall/orderPayment/preCollectOrder/orderPaymentMethodInfo`, + method: "get", + }) } \ No newline at end of file diff --git a/src/common/enum.ts b/src/common/enum.ts index 8e8da01..c3d84be 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -1,7 +1,7 @@ //订单状态枚举 export const ORDER_STATUS = { - SaleOrderStatusCancel : {value:10, label:'预付款'}, // + SaleorderstatusWaitingPrePayment : {value:10, label:'预付款'}, // 预付款 SaleOrderStatusBooking : {value:0, label:'待接单'}, // 待接单 SaleOrderStatusArranging : {value:1, label:'配布中'}, // 配布中 SaleOrderStatusArranged : {value:2, label:'已配布'}, // 已配布 diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index ee7228b..5a29382 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -12,7 +12,6 @@ type Param = { orderId: number, //订单id actual_amount: number, //实付金额 wait_pay_amount: number, //待付金额 - sale_mode: number, //订单类型 }|null, onClick?: (val: number) => void //点击后触发的事件,返回订单状态 } @@ -28,7 +27,8 @@ export default memo(({orderInfo, onClick}:Param) => { SaleOrderStatusRefund, SaleOrderStatusWaitingPayment, SaleOrderStatusWaitingReceipt, - SaleOrderStatusAlreadyReceipt + SaleOrderStatusAlreadyReceipt, + SaleorderstatusWaitingPrePayment } = ORDER_STATUS //订单按钮按订单状态归类 const orderBtnsList = useRef([ @@ -39,7 +39,7 @@ export default memo(({orderInfo, onClick}:Param) => { }, { id: 2, - value: [SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value], //去付款按钮对应:待付款, 待发货, 待收货, 已收货, 已完成 + value: [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value], //去付款按钮对应:待付款, 待发货, 待收货, 已收货, 已完成 label: '去付款' }, { diff --git a/src/pages/applyAfterSales/index.module.scss b/src/pages/applyAfterSales/index.module.scss index e82626c..b4ce39c 100644 --- a/src/pages/applyAfterSales/index.module.scss +++ b/src/pages/applyAfterSales/index.module.scss @@ -117,7 +117,7 @@ .apply_after_sales_list{ padding: 0 20px; .apply_after_sales_item{ - margin-bottom: 30px; + margin-bottom: 50px; .apply_after_sales_title{ display: flex; align-items: center; diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 3beefd0..31fbd71 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -19,7 +19,6 @@ export default () => { const onShowReason = (status) => setShowReason({...showReason, status, show:true}) - //底部按钮 const onSubmit = (val) => { @@ -32,7 +31,8 @@ export default () => { - + + {new Array(5).fill(5).map(item => 大货 0770# 21S单面平纹(食毛) @@ -53,29 +53,8 @@ export default () => { - - - - 大货 - 0770# 21S单面平纹(食毛) - - - - - 1# 薄荷绿x1 - - - - - - - 1# 薄荷绿x1 - - - - - - + )} + @@ -124,7 +103,6 @@ export default () => { //图片列表 const PictureItem = memo(() => { const {uploadCDNImg} = useUploadCDNImg() - //图片 const uploadImage = () => { Taro.chooseImage({ diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 01b7628..6ae245b 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -55,6 +55,7 @@ export default memo(({order, comfirm = false}:Param) => { SaleOrderStatusComplete, // 已完成 SaleOrderStatusRefund, // 已退款 SaleOrderStatusCancel, // 已取消 + SaleorderstatusWaitingPrePayment // 预付款 } = ORDER_STATUS //金额列表枚举 @@ -67,7 +68,7 @@ export default memo(({order, comfirm = false}:Param) => { }, { id:2, - value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], + value:[SaleorderstatusWaitingPrePayment.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value], label:'合计金额', field: 'total_sale_price' }, From 86a8a76b2705a9e0ef6b35a9c03bb523d4923587 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Mon, 13 Jun 2022 20:30:47 +0800 Subject: [PATCH 17/47] =?UTF-8?q?=E5=89=AA=E6=9D=BF=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/orderPay.ts | 14 +++- src/common/constant.js | 2 +- src/common/enum.ts | 1 + src/components/orderBtns/index.module.scss | 55 ++++++++++++++- src/components/orderBtns/index.tsx | 69 ++++++++++++------- src/pages/applyAfterSales/index.tsx | 14 +--- .../details/components/orderCount/index.tsx | 1 - src/pages/details/index.tsx | 37 +++++----- src/pages/order/comfirm.tsx | 6 +- .../addressInfoDetail/index.module.scss | 9 +-- .../components/addressInfoDetail/index.tsx | 2 +- src/pages/order/components/kindList/index.tsx | 22 +++++- src/pages/order/components/payment/index.tsx | 63 ++++++++++++----- src/pages/order/index.module.scss | 6 +- src/pages/order/index.tsx | 13 ++-- src/pages/orderList/index.tsx | 2 +- src/pages/searchList/search.tsx | 2 +- src/pages/user/index.tsx | 3 + src/use/useLogin.ts | 1 + src/use/useUploadImage.ts | 33 ++++++++- 20 files changed, 251 insertions(+), 104 deletions(-) diff --git a/src/api/orderPay.ts b/src/api/orderPay.ts index 49da5de..2b49a18 100644 --- a/src/api/orderPay.ts +++ b/src/api/orderPay.ts @@ -21,11 +21,21 @@ import { useRequest } from "@/use/useHttp" } /** - * 获取应收单订单支付方式信息 + * 获取预付单支付方式信息 */ - export const GetOrderPayApi2 = () => { + export const GetPrepayOrderPayApi = () => { return useRequest({ url: `/v1/mall/orderPayment/preCollectOrder/orderPaymentMethodInfo`, method: "get", }) +} + +/** + * 预付单订单支付提交 + */ + export const SubmitPrepayOrderPayApi = () => { + return useRequest({ + url: `/v1/mall/orderPayment/preCollectOrder/orderPaymentSubmission`, + method: "put", + }) } \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index 71c3838..ccf9123 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,7 +10,7 @@ export const BASE_URL = `http://192.168.1.30:40001/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/common/enum.ts b/src/common/enum.ts index c3d84be..4e3b378 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -6,6 +6,7 @@ export const ORDER_STATUS = { SaleOrderStatusArranging : {value:1, label:'配布中'}, // 配布中 SaleOrderStatusArranged : {value:2, label:'已配布'}, // 已配布 SaleOrderStatusWaitingPayment : {value:7, label:'待付款'}, // 待付款 + SaleOrderStatusTaking: {value: 11, label:'提货中'}, //提货中 SaleOrderStatusWaitingDelivery : {value:3, label:'待发货'}, // 待发货 SaleOrderStatusWaitingReceipt : {value:8, label:'待收货'}, // 待收货 SaleOrderStatusAlreadyReceipt : {value:9, label:'已收货'}, // 已收货 diff --git a/src/components/orderBtns/index.module.scss b/src/components/orderBtns/index.module.scss index 3444eb0..d6e9810 100644 --- a/src/components/orderBtns/index.module.scss +++ b/src/components/orderBtns/index.module.scss @@ -1,8 +1,57 @@ .btns_list{ - display: flex; - justify-content: flex-end; width: 100%; // margin-top: 30px; + display: flex; + align-content: center; + .more{ + font-size: 28px; + width: 143px; + display: flex; + align-items: center; + color: $color_font_two; + padding-left: 20px; + position: relative; + + .more_list{ + position: absolute; + background-color: #fff; + width: 226px; + box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.06); + border-radius: 10px; + padding: 0 20px; + box-sizing: border-box; + z-index:999; + &::before{ + z-index: 1; + position: absolute; + bottom: -7px; + left: 50px; + width: 15px; + height: 15px; + content: " "; + transform: rotate(45deg); + background: #fff; + box-sizing: border-box; + box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.1); + } + .more_item{ + font-size: 28px; + height: 70px; + line-height: 70px; + text-align: center; + &:nth-last-child(n+2) { + border-bottom: 1PX solid #F0F0F0; + } + } + } + .more_bg{ + position:fixed; + width: 100vw; + height: 100vh; + top: 0; + left: 0; + } + } .scroll{ white-space: nowrap; width: 100%; @@ -14,7 +63,7 @@ } .btns_item{ padding: 0 15px; - width: 100px; + width: 130px; border: 2px solid #dddddd; border-radius: 38px; text-align: center; diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 5a29382..cdc409c 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -1,9 +1,9 @@ import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert } from "@/common/common" import { ORDER_STATUS } from "@/common/enum" -import { ScrollView, View } from "@tarojs/components" +import { ScrollView, Text, View } from "@tarojs/components" import Taro from "@tarojs/taro" -import { useCallback, useRef, memo, useState, useEffect } from "react" +import { useCallback, useRef, memo, useState, useEffect, useMemo } from "react" import styles from './index.module.scss' type Param = { @@ -30,7 +30,7 @@ export default memo(({orderInfo, onClick}:Param) => { SaleOrderStatusAlreadyReceipt, SaleorderstatusWaitingPrePayment } = ORDER_STATUS - //订单按钮按订单状态归类 + //订单按钮按订单状态归类, value是该订单状态,可能该按钮会出现 const orderBtnsList = useRef([ { id: 1, @@ -66,12 +66,17 @@ export default memo(({orderInfo, onClick}:Param) => { id: 7, value: [SaleOrderStatusWaitingReceipt.value,SaleOrderStatusAlreadyReceipt.value,SaleOrderStatusComplete.value,SaleOrderStatusRefund.value], //取消订单按钮对应: 待收货,已收货,已完成, 已退款 label: '再次购买' - } + }, + { + id: 8, + value: [SaleOrderStatusBooking.value], //按钮对应: 待接单 + label: '退款' + }, ]) //判断是否显示该按钮 - const orderBtnsShow = useCallback((item) => { + const orderBtnsShow = (item) => { if(orderInfo) { if(item.id == 1) { //取消订单按钮 @@ -87,11 +92,19 @@ export default memo(({orderInfo, onClick}:Param) => { return item.value.includes(orderInfo.status) } } - },[orderInfo]) + } + + //显示的按钮数组 + const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => { + return orderBtnsList.current.filter(item => { + return orderBtnsShow(item) + }) + }, [orderInfo]) + + //点击按钮操作 const submitBtns = (val, index) => { - clickEvent(val, index); (val == 1)&&cancelOrder(); //取消订单按钮 (val == 2)&&onClick?.(2); //去付款按钮 (val == 6)&&receiveOrder(); //确认收货 @@ -140,28 +153,32 @@ 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})) - } + + //显示更多按钮 + const [showMore, setShowMore] = useState(false) + const styleTop = useMemo(() => { + return {top:`-${(orderBtnsShowList.length - 3)*70 + 10}rpx`, left: `-${10}rpx`} + }, [orderBtnsShowList]) return ( - - - {orderBtnsList.current.map((item, index) => - orderBtnsShow(item)&& submitBtns(item.id, index)}>{item.label} - // submitBtns(item.id, index)}>{item.label} - )} - - + {(orderBtnsShowList.length > 3)&& + setShowMore(true)}>更多 + {showMore&& + + {orderBtnsShowList.map((item, index) => { + return ((index >= 3) && submitBtns(item.id, index)}>{item.label}) + })} + + setShowMore(false)}> + } + } + + + {orderBtnsShowList.map((item, index) => + (index < 3)&& submitBtns(item.id, index)}>{item.label} + )} + ) diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 31fbd71..dd07f90 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -102,18 +102,10 @@ export default () => { //图片列表 const PictureItem = memo(() => { - const {uploadCDNImg} = useUploadCDNImg() + const {getWxPhoto} = useUploadCDNImg() //图片 - const uploadImage = () => { - Taro.chooseImage({ - count: 1, // 默认9 - sizeType: ['original', 'compressed'], - sourceType: ['album', 'camera'], - success: function (res) { - const file = res.tempFiles[0] - uploadCDNImg(file, 'product', 'product') - } - }) + const uploadImage = async () => { + let res = await getWxPhoto('after-sale') } return ( <> diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index 7b993bd..78d4a8f 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -53,7 +53,6 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null}) const getColorList = async () => { setLoading(() => true) - console.log('数据:::',getFilterData(condition.current)) let {data} = await colorFetchData(getFilterData(condition.current)) let lists = initList(data.list) setList(() => [...lists]) diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 34b704f..b08a141 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -15,6 +15,7 @@ import { AnalysisShortCodeApi, BindShortCodeApi, GetShortCodeApi } from '@/api/s import { SHARE_SCENE } from '@/common/enum'; import useUserInfo from '@/use/useUserInfo'; import LabAndImg from '@/components/LabAndImg'; +import { alert } from '@/common/common'; type item = {title:string, img:string, url:string, id:number} @@ -114,17 +115,20 @@ export default (props:Params) => { setSortCode({... userObj.sort_code, shareShortDetail: {title: productName as string, code: resDetail.md5_key, img:''}}) } - //开始下单 - const placeOrder = async (e:any) => { - // try { - // await getPhoneNumber(e.detail.code) - // } catch(msg) { - // Taro.showToast({ - // icon:"none", - // title: msg - // }) - // return false - // } + //授权手机号和下单 + const placeOrder = async (status = 'to_phone',e:any = {}) => { + if(status == 'to_phone') { + if(!e.detail.code) return alert.error('请授权手机号') + try { + await getPhoneNumber(e.detail.code) + } catch(msg) { + Taro.showToast({ + icon:"none", + title: msg + }) + return false + } + } setShowOrderCount(true) } @@ -184,12 +188,11 @@ export default (props:Params) => { 购物车 { - // !userInfo.adminUserInfo?.is_authorize_phone&& - // - // 开始下单 - // - // || placeOrder(e)}>开始下单 - placeOrder(e)}>开始下单 + (!userInfo.adminUserInfo?.is_authorize_phone)&& + + 开始下单 + + || placeOrder('to_order')}>开始下单 } diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index d3feb71..7113d8f 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -150,11 +150,7 @@ import SubmitOrderBtn from "./components/submitOrderBtn"; if (res.confirm) { const res = await saleOrderFetchData(submitOrderData) if(res.success) { - if(preViewOrder?.sale_mode == 0) { - goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') - } else if (preViewOrder?.sale_mode == 1) { - goLink('/pages/order/cutOrder/index',{id: res.data.id}, 'redirectTo') - } + goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') } else { alert.none(res.msg) } diff --git a/src/pages/order/components/addressInfoDetail/index.module.scss b/src/pages/order/components/addressInfoDetail/index.module.scss index 2d6c306..a480dfa 100644 --- a/src/pages/order/components/addressInfoDetail/index.module.scss +++ b/src/pages/order/components/addressInfoDetail/index.module.scss @@ -1,5 +1,4 @@ .order_address{ - height: 178px; background: #ffffff; border-radius: 20px; display: flex; @@ -26,16 +25,18 @@ .order_address_text_title{ font-size: $font_size_medium; margin-top: 10px; - @include common_ellipsis; display: flex; - align-items: center; justify-content: space-between; .moreIconfont{ font-size: 20px; + padding-top: 10px; + } + .address_text{ + word-break:break-all; } } .order_address_text_name{ - + margin-top: 30px; align-items: center; text{ &:nth-child(1) { diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index bc915ed..f42ddf8 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -97,7 +97,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = - {formatAddress} + {formatAddress} {(receivingStatus == 2)&&} diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 6ae245b..26241d2 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -97,12 +97,12 @@ export default memo(({order, comfirm = false}:Param) => { return priceInfo.value.includes(status) }, [order]) - //金额展示 + //金额展示大货 const priceConDom = useMemo(() => { if(!order) return if(comfirm == true) { //确认订单时 - return (order.sale_mode == 1)? : + return } else if(order?.status == SaleOrderStatusCancel.value) { //订单状态为取消订单时 return ( @@ -127,6 +127,22 @@ export default memo(({order, comfirm = false}:Param) => { ) } }, [order]) + + //金额展示剪板 + const cutPriceConDom = useMemo(() => { + if(!order) return + return + }, [order]) + + const showPriceAll = useMemo(() => { + if(order?.sale_mode == 1) { + return cutPriceConDom //剪板 + } else { + return priceConDom //大货 + } + + }, [order]) + return ( <> @@ -163,7 +179,7 @@ export default memo(({order, comfirm = false}:Param) => { }) } - {priceConDom} + {showPriceAll} diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index 86d4306..c3d0b60 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -8,26 +8,33 @@ import MCheckbox from "@/components/checkbox"; import Popup from "@/components/popup"; import OfflinePay from "../offlinePay"; import ScanPay from "../scanPay"; -import { GetOrderPayApi, SubmitOrderPayApi } from "@/api/orderPay"; +import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay"; import { formatPriceDiv } from "@/common/fotmat"; import {alert} from "@/common/common" -import { PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; +import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; type Param = { show?: true|false, onClose?: () => void, onSubmitSuccess?: () => void, //支付成功 - orderInfo?: OrderInfo + orderInfo?: OrderInfo, } type OrderInfo = { - orderId: number, //应付单id - payment_method: 0|PAYMENT_METHOD_PARAM //支付方式 + should_collect_order_id?: number, //应付单id + pre_collect_order_id?: number, //预付单id + status?: number, //订单状态 + payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式 } type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款 export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) => { + //支付方式枚举 + const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod, PaymentMethodCashOnDelivery} = PAYMENT_METHOD + //订单状态枚举 + const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS + //提交参数 const [submitData, setSubmitData] = useState<{id:number, payment_method: PayStatus}>({ id:0, @@ -38,7 +45,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) const [offlinePayShow, setofflinePayShow] = useState(false) const onShowOfflinePay = () => { setofflinePayShow(true) - onClose?.() + // onClose?.() } //扫码支付 @@ -51,13 +58,22 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) //获取支付方式数据 const [payInfo, setPayInfo] = useState() const {fetchData: orderFetchData} = GetOrderPayApi() + const {fetchData: prepayOrderFetchData} = GetPrepayOrderPayApi() const getOrderPay = async () => { - let {data} = await orderFetchData({id: orderInfo?.orderId}) - setPayInfo(() => data) + if(orderInfo&&orderInfo.should_collect_order_id) { + //有应收单id时用应收单获取数据 + let {data} = await orderFetchData({id: orderInfo?.should_collect_order_id}) + setPayInfo(() => data) + } else { + //用预付单id获取支付信息 + let {data} = await prepayOrderFetchData({id: orderInfo?.pre_collect_order_id}) + setPayInfo(() => data) + } } useEffect(() => { - if(show&&orderInfo?.orderId) { - setSubmitData((val) => ({...val, id:orderInfo.orderId})) + if(show&&orderInfo&&(orderInfo?.should_collect_order_id||orderInfo?.pre_collect_order_id)) { + let id = orderInfo.should_collect_order_id||orderInfo.pre_collect_order_id + setSubmitData((val) => ({...val, id:id as number})) getOrderPay() } }, [show, orderInfo]) @@ -73,14 +89,20 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) } //提交支付 - const {fetchData: submitFetchData} = SubmitOrderPayApi() + const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交 + const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交 const submitPay = async () => { if(submitData.payment_method === null) { alert.error('请选择支付方式') return false } alert.loading('正在支付') - let res = await submitFetchData(submitData) + let res:any = null + if(orderInfo?.should_collect_order_id) { + res = await submitFetchData(submitData) + } else { + res = await submitPrepayOrderFetchData(submitData) + } if(res.success) { alert.success('支付成功') onSubmitSuccess?.() @@ -97,6 +119,17 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) ) }, [payInfo]) + //是否显示七天账期 + const show_account_payment = useMemo(() => { + //支付方式是账期支付,不显示 + if(orderInfo?.payment_method == PaymentMethodAccountPeriod.value) return false + //支付方式是货到付款,不显示 + if(orderInfo?.payment_method == PaymentMethodCashOnDelivery.value) return false + //订单状态是预付款,不显示 + if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value) return false + return true + }, [orderInfo]) + //账期 const account_peyment = useMemo(() => { const price = payInfo?.should_collect_money - payInfo?.amount_paid @@ -105,9 +138,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) ) }, [payInfo]) - //支付方式枚举 - const {PaymentMethodPreDeposit, PaymentMethodAccountPeriod} = PAYMENT_METHOD - return ( @@ -143,13 +173,12 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) advanceSelectData(PaymentMethodPreDeposit.value)} onClose={() => advanceSelectData(null)}/> - {(orderInfo?.payment_method != PaymentMethodAccountPeriod.value)&& + {show_account_payment&& {payInfo?.account_period}天账期 - {/* 可用额度 ¥{formatPriceDiv(payInfo?.account_period_credit_available_line)} */} {account_peyment} periodSelectData(PaymentMethodAccountPeriod.value)} onClose={() => periodSelectData(null)}/> diff --git a/src/pages/order/index.module.scss b/src/pages/order/index.module.scss index 87ea5e5..fdef528 100644 --- a/src/pages/order/index.module.scss +++ b/src/pages/order/index.module.scss @@ -63,19 +63,17 @@ } } .submit_order{ - display: flex; position: fixed; bottom: 0; left: 0; - justify-content: flex-end; width: 100%; align-items: center; background-color: #fff; box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); padding: 20px 20px; box-sizing: border-box; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); + // padding-bottom: constant(safe-area-inset-bottom); + // padding-bottom: env(safe-area-inset-bottom); .order_btn { width: 152px; height: 72px; diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 3cecfc4..8664081 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -115,10 +115,10 @@ import styles from './index.module.scss' }, []) //支付所需数据 - const payOrderInfo = useMemo(() => { - if(orderDetail) - return {orderId: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method } - }, [orderDetail]) + // const payOrderInfo = useMemo(() => { + // if(orderDetail) + // return {should_collect_order_id: orderDetail.should_collect_order_id, payment_method:orderDetail.payment_method, pre_collect_order_id:orderDetail.pre_collect_order_id} + // }, [orderDetail]) //去付款 const [payMentShow, setPayMentShow] = useState(false) @@ -217,11 +217,12 @@ import styles from './index.module.scss' {(orderDetail?.status != SaleOrderStatusCancel.value)&& + } - setShowDesc(false)} > + setShowDesc(false)}> getRemark(e)}/> - + ) diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index a235806..7dbe807 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -131,7 +131,7 @@ export default () => { - + {orderData?.list.map(item => { return })} diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index 756bd77..dd80f20 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -69,7 +69,7 @@ export default () => { searchEvent(e)}/> - goLink('/pages/searchList/searchList')}>高级搜索 + goLink('/pages/searchList/hightSearchList')}>高级搜索 {searchData?.hotField.length > 0 && 热门面料 diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index b4849ea..c6d1c8e 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -6,6 +6,7 @@ import { useSelector } from "@/reducers/hooks"; import { GetAdminUserInfoApi } from "@/api/user"; import { alert, goLink } from "@/common/common"; import useLogin from '@/use/useLogin' +import {BASE_URL} from '@/common/constant' export default () => { // 用户信息 @@ -31,6 +32,8 @@ export default () => {
+ {/* 测试暂时添加 */} + {BASE_URL} ) } diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index 5bf2cc3..d65cc51 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -4,6 +4,7 @@ import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi } from "@/api/ import useLoginRequest from "./useLoginRequest" import { SHARE_SCENE } from "@/common/enum" import { GetShortCodeApi } from "@/api/share" +import { alert } from "@/common/common" export default () => { const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo() diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts index 6e02d19..4b69a0d 100644 --- a/src/use/useUploadImage.ts +++ b/src/use/useUploadImage.ts @@ -114,8 +114,39 @@ export default () => { }) } + /** + * 上传手机图片 + * @param cdn_upload_type //CDN 文件上传场景值 + */ + // product 产品相关,图片、纹理图等 全平台 + // after-sale 售后(申请退货、退款)相关的、图片、视频 全平台 + // mall 电子商城相关的 全平台 + // logistics 物流(发货、提货)相关的、图片、视频 全平台 + type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics' + const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => { + return new Promise((resolve, reject) => { + Taro.chooseImage({ + count: 1, // 默认9 + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: async function (res) { + const file = res.tempFiles[0] + try { + let data = await uploadCDNImg(file, cdn_upload_type, cdn_upload_type) + resolve(data) + } catch(res) { + reject(res) + } + + } + }) + }) + + } + return { - uploadCDNImg + uploadCDNImg, + getWxPhoto } } From 7322f1336ded31d51696f8417db3f5179a2e18c5 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Tue, 14 Jun 2022 15:18:55 +0800 Subject: [PATCH 18/47] =?UTF-8?q?--=E7=BC=96=E8=BE=91=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=B9=E6=8E=A550%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 6 +- src/pages/user/index.module.scss | 30 +++-- src/pages/user/index.tsx | 47 +++++--- .../userEdit/components/ModifyModal.scss | 76 ++++++++++++ src/pages/userEdit/components/ModifyModal.tsx | 49 ++++++++ src/pages/userEdit/index.scss | 109 +++++++---------- src/pages/userEdit/index.tsx | 114 ++++++++---------- src/use/useLogin.ts | 3 +- 8 files changed, 269 insertions(+), 165 deletions(-) create mode 100644 src/pages/userEdit/components/ModifyModal.scss create mode 100644 src/pages/userEdit/components/ModifyModal.tsx diff --git a/src/common/constant.js b/src/common/constant.js index dc069fb..2f4fa08 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,12 +5,12 @@ // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -// export const BASE_URL = `http://192.168.1.30:40001/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 = `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.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/pages/user/index.module.scss b/src/pages/user/index.module.scss index 464844d..a34a08c 100644 --- a/src/pages/user/index.module.scss +++ b/src/pages/user/index.module.scss @@ -3,6 +3,7 @@ min-height: 100vh; display: flex; flex-direction: column; + position: relative; .header{ background: #68b4ff; background-size: cover; @@ -12,6 +13,10 @@ margin-top: 10px; } } + .auth-suspension{ + position: absolute; + z-index: 1;inset: 0; + } .header-card{ position: absolute;left: 50%;bottom: -18%; transform: translateX(-50%); @@ -239,12 +244,13 @@ display: flex;align-items: center;justify-content: center; } - .modal{ + .tips-modal{ background: rgba(0,0,0,0.6); position: fixed;inset: 0; display: flex;justify-content: center;align-items: center; + z-index: 2; } - .modal-content{ + .tips-modal-content{ width: 598px; background: #ffffff; border-radius: 10px; @@ -259,7 +265,7 @@ transform: scale(1); } } - .modal-title{ + .tips-modal-title{ font-size: 32px; font-weight: 700; text-align: center; @@ -267,51 +273,51 @@ margin-bottom: 58px; padding-top: 48px; } - .modal-letter{ + .tips-modal-letter{ font-size: 26px; font-weight: 400; color: #707070; padding: 0 30px; line-height: 50px; } - .modal-letter-text{ + .tips-modal-letter-text{ text-indent: 60px; } - .modal-letter-beginn{ + .tips-modal-letter-beginn{ font-size: 28px; font-weight: 400; color: #000000; margin-bottom: 25px; } - .modal-letter-end{ + .tips-modal-letter-end{ font-size: 26px; font-weight: 400; text-align: right; margin-top: 61px; } - .modal-button{ + .tips-modal-button{ display: flex; border-top: 1px solid #DDDDDD; margin-top: 45px; } - .modal-button button, .modal-button view{ + .tips-modal-button button, .tips-modal-button view{ display: flex;align-items: center;justify-content: center; width: 50%; height: 90px; background-color: white; } - .modal-button button{ + .tips-modal-button button{ font-size: 26px; font-weight: 400; color: #707070; border-radius: 0; border-right: 1px solid #DDDDDD; } - .modal-button button::after{ + .tips-modal-button button::after{ border: 0; border-radius: 0; } - .modal-button view{ + .tips-modal-button view{ font-size: 26px; font-weight: 400; color: #007aff; diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index e8fd7a7..c9a8c35 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -9,20 +9,29 @@ import useLogin from '@/use/useLogin' export default () => { // 用户信息 const { getSelfUserInfo } = useLogin(); - const {adminUserInfo, userInfo} = useSelector(state => state.userInfo); + const {adminUserInfo} = useSelector(state => state.userInfo); useEffect(()=>{ - getSelfUserInfo(); + getSelfUserInfo().then().catch(()=>{ + alert.none("授权失败,请授权后再使用"); + }); },[]); + const handleAuth = async ()=>{ + getSelfUserInfo().then().catch(()=>{ + alert.none("授权失败,请授权后再使用"); + }); + } return ( -
+
+ {!adminUserInfo.is_authorize_name&&} ) } +// 提示弹窗 const Modal = memo((props:any)=>{ const {data} = props; const [modalShow, setModalShow]=useState(true); @@ -31,16 +40,16 @@ const Modal = memo((props:any)=>{ return( <> {!data?.is_authorize_phone&&modalShow&& - - e.stopPropagation()}> - 首次登录提醒 - - To: 万丰园纺织科技 - 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。 - 信息错误请联系客服 + + e.stopPropagation()}> + 首次登录提醒 + + To: 万丰园纺织科技 + 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。 + 信息错误请联系客服 - - + + setModalShow(false)}>我知道 @@ -52,10 +61,10 @@ const Modal = memo((props:any)=>{ // 头部 | 订单 const Header = memo((props:any) => { - const {data, userInfo} = props; - let menu = [{ text: "待配布", icon: "icon-daipeibu" }, { text: "待付款", icon: "icon-daifukuan" }, - { text: "待发货", icon: "icon-daifahuo" }, { text: "已发货", icon: "icon-yifahuo" }, - { text: "退款/售后", icon: "icon-a-tuikuanshouhou" }]; + const {data} = props; + let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" }, + { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" }, + { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }]; const { getPhoneNumber } = useLogin(); const mGetPhoneNumber = (ev)=>{ if(ev.detail?.code){ @@ -64,7 +73,6 @@ const Header = memo((props:any) => { alert.none("绑定失败!"); } } - return ( @@ -115,15 +123,14 @@ const Header = memo((props:any) => { { menu.map((item, index) => { return ( - + {item.text} {index==2?"99+":10} - + ) }) } - diff --git a/src/pages/userEdit/components/ModifyModal.scss b/src/pages/userEdit/components/ModifyModal.scss new file mode 100644 index 0000000..fe370e9 --- /dev/null +++ b/src/pages/userEdit/components/ModifyModal.scss @@ -0,0 +1,76 @@ + .modify-ickname-content { + margin: 0 auto; + width: 658px; + padding-bottom: 50px; + + .modify-ickname-input { + width: 658px; + height: 182px; + background: #f3f3f3; + border: 2px solid #e6e6e6; + border-radius: 10px; + padding: 15px; + box-sizing: border-box; + font-size: 22px; + font-weight: 400; + color: #ababab; + display: flex; + flex-direction: column; + align-items: flex-end; + } + + .modify-ickname-input textarea { + width: 100%; + height: 80%; + font-size: 26px; + font-weight: 400; + color: #3c3c3c; + } + + .modify-ickname-tips { + font-size: 22px; + font-weight: 400; + color: #ababab; + margin-top: 30px; + } + + .modify-ickname-operation { + width: 658px; + height: 82px; + background: #ffffff; + border: 2px solid #cde5ff; + border-radius: 40px; + display: flex; + overflow: hidden; + margin-top: 105px; + display: flex; + } + + .modify-ickname-operation button { + height: 100%; + width: 50%; + font-size: 32px; + font-weight: 400; + color: #007aff; + background-color: white; + border: none; + outline: none; + padding: 0; + border-radius: 0; + } + + .modify-ickname-operation button::after, + .user-edit-logout::after { + border-radius: 0; + border: none; + } + + .modify-ickname-operation .modify-ickname-operation-save { + background: #007aff; + color: #ffffff; + } + + .modify-ickname-operation button::after { + border-radius: 0; + } + } \ No newline at end of file diff --git a/src/pages/userEdit/components/ModifyModal.tsx b/src/pages/userEdit/components/ModifyModal.tsx new file mode 100644 index 0000000..0e51ac1 --- /dev/null +++ b/src/pages/userEdit/components/ModifyModal.tsx @@ -0,0 +1,49 @@ + +import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useState } from "react" +import Popup from "@/components/popup"; +import { Button, Image, Text, Textarea, View } from "@tarojs/components" +import "./ModifyModal.scss" + +interface Params{ + title?: string, + save: (value: any)=>void, // 确定保存 +} +export default memo(forwardRef((props:any,ref)=>{ + const {title="修改昵称"} = props; + const [value, setValue] = useState(""); + useEffect(()=>{ + setValue(props.value); + },[props.value]) + // popup输入长度 + const handleTextareaInput = (ev:any)=>{ + setValue(ev.detail.value.slice(0,20)); + } + // 重置 + const handleTextareaReset = ()=>{ + setValue(""); + } + const [textareaBottom, setTextareaBottom] = useState(0); + const handleBlur = ()=>{ + setTextareaBottom(0); + } + const handleFocus = (ev)=>{ + setTextareaBottom(ev.detail.height); + } + const [modalShow,setModalShow] = useState(false); + useImperativeHandle(ref, ()=>({setModalShow})) + return ( + setModalShow(false)} title={title} show={modalShow}> + + + || + toggleShowRealTextarea(true)}>{descData.value||placeholder} + } + {descData.number +'/'+ descData.count} + + + ) +}) diff --git a/src/components/uploadImage/index.module.scss b/src/components/uploadImage/index.module.scss new file mode 100644 index 0000000..c977074 --- /dev/null +++ b/src/components/uploadImage/index.module.scss @@ -0,0 +1,55 @@ +.image_main{ + display: flex; + align-items: center; + flex-wrap: wrap; + .uploadImg{ + width: 202px; + height: 150px; + background: #f0f0f0; + border: 2px dashed #cccccc; + border-radius: 10px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + position: relative; + margin: 0 0 20px 20px; + position: relative; + .miconfont{ + font-size: 50px; + } + .uploadText{ + 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: 43px; + height: 43px; + background-color: #ccc; + border-radius: 50%; + position: absolute; + right: -10px; + top: -10px; + text-align: center; + line-height: 43px; + color: #fff; + font-size: 30px; + } + } +} \ No newline at end of file diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx new file mode 100644 index 0000000..8a144be --- /dev/null +++ b/src/components/uploadImage/index.tsx @@ -0,0 +1,59 @@ +import Taro, { FC } from "@tarojs/taro" +import { memo, useEffect, useState } from "react" +import useUploadCDNImg from "@/use/useUploadImage"; +import { Image, Text, View } from "@tarojs/components"; +import { formatImgUrl } from "@/common/fotmat"; +import classnames from "classnames"; +import styles from './index.module.scss' + +//图片列表 +type ImageParam = { + onChange?:(val: string[]) => void +} +const PictureItem:FC = memo(({onChange}) => { + const {getWxPhoto} = useUploadCDNImg() + const [imageList, setImageLise] = useState([]) + //上传图片 + const uploadImage = async () => { + let res:any = await getWxPhoto('after-sale') + if(res.code == 200) { + setImageLise([...imageList, res.url]) + } + } + //删除图片 + const delImage = (index) => { + imageList.splice(index,1) + setImageLise(() => [...imageList]) + } + //监听上传的图片变化 + useEffect(() => { + onChange?.(imageList||[]) + }, [imageList]) + + //预览图片 + const showImage = () => { + let list = imageList.map(item => { + return formatImgUrl(item) + }) + Taro.previewImage({ + current: list[0], // 当前显示 + urls: list // 需要预览的图片http链接列表 + }) + } + + return ( + + {imageList.map((item, index) => + + + delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}> + )} + + + 上传照片 + + + ) +}) + +export default PictureItem \ No newline at end of file diff --git a/src/pages/applyAfterSales/index.module.scss b/src/pages/applyAfterSales/index.module.scss index c20a8b8..6e11a17 100644 --- a/src/pages/applyAfterSales/index.module.scss +++ b/src/pages/applyAfterSales/index.module.scss @@ -59,60 +59,8 @@ font-size: 30px; } } - - .uploadImg{ - width: 202px; - height: 150px; - background: #f0f0f0; - border: 2px dashed #cccccc; - margin-left: 20px; - border-radius: 10px; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - position: relative; - margin-bottom: 20px; - position: relative; - .miconfont{ - font-size: 50px; - } - .uploadText{ - 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; - &:nth-child(1) { - margin-left: 50px; - } - image{ - width: 100%; - height: 100%; - border-radius: 10px; - } - .miconfont_close{ - width: 43px; - height: 43px; - background-color: #ccc; - border-radius: 50%; - position: absolute; - right: -10px; - top: -10px; - text-align: center; - line-height: 43px; - color: #fff; - font-size: 30px; - } + .upload_image{ + flex:1; } } } diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 2837b71..44f3b95 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -1,23 +1,20 @@ -import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components"; +import { Image, ScrollView, Text, View } from "@tarojs/components"; import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' -import { formatHashTag, formatImgUrl } from "@/common/fotmat"; -import Counter from "@/components/counter"; import ReasonPopup from "./components/reasonPopup"; import OtherReason from "./components/otherReason"; -import Taro, { useDidShow, useRouter } from "@tarojs/taro"; -import useUploadCDNImg from "@/use/useUploadImage"; +import { useDidShow, useRouter } from "@tarojs/taro"; import { GetSaleOrderDetailApi } from "@/api/order"; import KindList from "./components/kindList" import { ReturnApplyOrderApi } from "@/api/salesAfterOrder"; import { alert, goLink } from "@/common/common"; +import UploadImage from "@/components/uploadImage" +import TextareaEnhance from "@/components/textareaEnhance"; type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明 export default () => { - - useDidShow(() => { getSaleOrderPreView() }) @@ -178,11 +175,13 @@ export default () => { 拍照上传 - - + + + + - + @@ -196,45 +195,4 @@ export default () => { ) -} - -//图片列表 -type ImageParam = { - onChange?:(val: string[]) => void -} -const PictureItem:FC = memo(({onChange}) => { - const {getWxPhoto} = useUploadCDNImg() - const [imageList, setImageLise] = useState([]) - //上传图片 - const uploadImage = async () => { - let res:any = await getWxPhoto('after-sale') - if(res.code == 200) { - setImageLise([...imageList, res.url]) - } - } - - //删除图片 - const delImage = (index) => { - imageList.splice(index,1) - setImageLise(() => [...imageList]) - } - - //监听上传的图片变化 - useEffect(() => { - onChange?.(imageList||[]) - }, [imageList]) - - return ( - <> - {imageList.map((item, index) => - - - delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}> - )} - - - 上传照片 - - - ) -}) +} \ No newline at end of file diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index f9b122a..ea454ec 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -16,6 +16,7 @@ import UseLogin from "@/use/useLogin" import { formatHashTag, formatPriceDiv } from "@/common/fotmat"; import { debounce, getFilterData } from "@/common/util"; import LabAndImg from "@/components/LabAndImg"; +import VirtualList from '@tarojs/components/virtual-list' @@ -123,11 +124,14 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) //计数组件 const getInputValue = (num, item) => { - item.count = parseFloat(num) - if(num == 0) item.show = false - setList([...list]) - console.log(num) + item.count = parseFloat(num) + if(num == 0) item.show = false + setList([...list]) + console.log(num) + } + + const onAdd = (item) => { item.show = true item.count = selectList[selectIndex].defaultNum @@ -198,10 +202,41 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) return ¥{price} /{selectList[selectIndex].eunit} }, [selectIndex]) + //虚拟滚动 + const Rows = memo(({id, index, style, data}:any) => { + let item = data[index] + 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} + /> + } + + + ) + }) return ( - closePopup()} > {title} @@ -227,39 +262,52 @@ 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} - /> - } - - - })} - - } + // + // + // {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} + // /> + // } + // + // + // })} + // + // } + + + {Rows} + + + } + {(list.length <= 0 && !colorState.loading)&&暂无此商品} diff --git a/src/pages/order/components/applyRefund/index.module.scss b/src/pages/order/components/applyRefund/index.module.scss index e69de29..ec17129 100644 --- a/src/pages/order/components/applyRefund/index.module.scss +++ b/src/pages/order/components/applyRefund/index.module.scss @@ -0,0 +1,66 @@ + +.apply_after_sales_con{ + padding: 20px; + .returnSaleInput_item{ + display: flex; + align-items: center; + padding-bottom: 50px; + flex-wrap: wrap; + .title{ + font-size: $font_size; + font-weight: 700; + width: 119px; + } + .select{ + flex:1; + height: 60px; + border: 2px solid #e6e6e6; + border-radius: 10px; + margin-left: 20px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20px; + font-size: 26px; + color: $color_font_two; + .miconfont{ + font-size: 30px; + } + } + .upload_image{ + flex:1; + } + } + .btns_con{ + width: 100%; + bottom:0; + box-sizing: border-box; + margin-top: 50px; + .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; + } + } + } +} \ No newline at end of file diff --git a/src/pages/order/components/applyRefund/index.tsx b/src/pages/order/components/applyRefund/index.tsx index 91f98dc..481d03f 100644 --- a/src/pages/order/components/applyRefund/index.tsx +++ b/src/pages/order/components/applyRefund/index.tsx @@ -1,9 +1,57 @@ -import { memo } from "react"; +import Popup from "@/components/popup"; +import TextareaEnhance from "@/components/textareaEnhance"; +import { ScrollView, Text, View } from "@tarojs/components"; +import { memo, useCallback, useState } from "react"; +import ReasonPopup from "../reasonPopup"; +import styles from './index.module.scss' +import classnames from "classnames"; + +type Param = { + show?: true|false, + onClose?: () => void +} +export default memo(({show, onClose}:Param) => { + + + const getOtherReason = useCallback(() => { + + }, []) + + const onSubmit = (val) => { + + } + + //显示说明 + const [showReason, setShowReason] = useState(false) + const closeReason = useCallback(() => { + setShowReason(false) + }, []) + + const onShowReason = () => { + setShowReason(true) + } -export default memo(() => { return ( <> - 123123 + + + + 退款说明 + onShowReason()}> + 请选择 + + + + + + + onSubmit(1)}>取消 + onSubmit(2)}>确认 + + + + + ) }) \ No newline at end of file diff --git a/src/pages/order/components/reasonPopup/index.module.scss b/src/pages/order/components/reasonPopup/index.module.scss new file mode 100644 index 0000000..eba26cd --- /dev/null +++ b/src/pages/order/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/order/components/reasonPopup/index.tsx b/src/pages/order/components/reasonPopup/index.tsx new file mode 100644 index 0000000..1230787 --- /dev/null +++ b/src/pages/order/components/reasonPopup/index.tsx @@ -0,0 +1,37 @@ +import Popup from "@/components/popup"; +import { ScrollView, Text, View } from "@tarojs/components"; +import { memo, useMemo } from "react"; +import styles from './index.module.scss' + +//原因选择 +type ReasonInfoParam = { + show?: boolean, + onClose?: () => void, +} +export default memo(({show = false, onClose}: ReasonInfoParam) => { + return ( + + + 退款说明 + + + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + 完好无损带原标签 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/order/components/remark/index.tsx b/src/pages/order/components/remark/index.tsx index 14d981b..ce82f0f 100644 --- a/src/pages/order/components/remark/index.tsx +++ b/src/pages/order/components/remark/index.tsx @@ -1,18 +1,24 @@ import Popup from "@/components/popup" import { Textarea, View } from "@tarojs/components" -import { useCallback, useState } from "react" +import { useCallback, useEffect, useState } from "react" import styles from './index.module.scss' type Param = { onBlur?: (val:any) => void onSave?: (val: string) => void + defaultValue?: string } -export default ({onBlur, onSave}:Param) => { +export default ({onBlur, onSave, defaultValue = ''}:Param) => { const [descData, setDescData] = useState({ number: 0, value: '', count: 200 }) + + useEffect(() => { + getDesc(defaultValue) + }, [defaultValue]) + const getDesc = useCallback((e) => { let value = e.detail.value let res = value diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 5d6b559..e1e3b45 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -15,6 +15,7 @@ import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import AddressInfoDetail from "./components/addressInfoDetail"; +import ApplyRefund from "./components/applyRefund"; import KindList from "./components/kindList"; import OrderState from "./components/orderState"; import Payment from "./components/payment"; @@ -149,7 +150,10 @@ import styles from './index.module.scss' }else if(val == 2) { //待付款 toPay() + } else if(val == 3) { + setRefundShow(true) } + }, [orderDetail]) //页面下拉刷新 @@ -189,6 +193,12 @@ import styles from './index.module.scss' getSaleOrderPreView() }, [orderDetail]) + //退款申请 + const [refundShow, setRefundShow] = useState(false) + const applyRefundClose = useCallback(() => { + setRefundShow(false) + }, []) + return ( @@ -224,10 +234,10 @@ import styles from './index.module.scss' } setShowDesc(false)}> - getRemark(e)}/> + getRemark(e)} defaultValue={orderDetail?.remark}/> - + ) diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index e4d7ed7..d8e8b70 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -1,30 +1,69 @@ +import { AFTER_ORDER_STATUS } from "@/common/enum"; import { Text, View } from "@tarojs/components" import classnames from "classnames"; -import {memo} from "react"; +import {memo, useMemo} from "react"; import styles from './index.module.scss' -export default memo(({return_address = '', return_phone = ''}:{return_address:string, return_phone: string}) => { +type Param = { + return_address?:string, + return_phone?: string, + onLogistics?: (val: number) => void, + stage?: number +} +export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => { + const { + ReturnStageApplying, + ReturnStageWaitCheck, + ReturnStageChecked, + ReturnStageReturned, + ReturnStageCancel, + ReturnStageQualityCheckPendingRefund, + ReturnStageServiceOrderPendingRefund, + ReturnStageRejected + } = AFTER_ORDER_STATUS + + //是否显示地址 + const showAddress = useMemo(() => { + return stage != ReturnStageApplying.value + }, []) + + //上传物流 + const upLogistics = useMemo(() => { + return stage == ReturnStageWaitCheck.value + }, [stage]) + + //查看物流 + const showLogistics = useMemo(() => { + return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value) + }, [stage]) + + return ( - - - - 请按以下退货地址寄回货物并提供退货物流信息 - - - - - - {return_address} - - - 管理员 - {return_phone} - {/* - 上传物流 - */} + <> + {showAddress&& + + + 请按以下退货地址寄回货物并提供退货物流信息 + + + + + + {return_address} + + + 管理员 + {return_phone} + {upLogistics&& onLogistics?.(1)}> + 上传物流 + } + {showLogistics&& onLogistics?.(2)}> + 查看物流 + } + - - + } + ) }) \ No newline at end of file diff --git a/src/pages/salesAfter/components/applyRecord/index.module.scss b/src/pages/salesAfter/components/applyRecord/index.module.scss new file mode 100644 index 0000000..ad1916d --- /dev/null +++ b/src/pages/salesAfter/components/applyRecord/index.module.scss @@ -0,0 +1,146 @@ +.apply_record_scroll{ + height: 70vh; +} +.apply_record_main{ + margin-top: 20px; + padding: 0 30px; + .kind_number{ + width: 100%; + padding: 20px; + box-sizing: border-box; + text{ + background-color: #F6F6F6; + border-radius: 10px; + font-size: $font_size_medium; + padding: 5px 0; + text-align: center; + width: 100%; + display: block; + color: $color_font_three; + } + } + .orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .orders_return_title{ + font-size: 28px; + font-weight: 700; + padding-bottom: 20px; + } + .order_list{ + &:nth-child(n+2) { + margin-top: 45px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_total{ + padding-top: 30px; + display: flex; + justify-content: space-between; + text{ + &:nth-child(1) { + font-size: 28px; + font-weight: 700; + } + &:nth-child(2) { + font-size: 32px; + font-weight: 700; + color: #007AFF; + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } + } +} + diff --git a/src/pages/salesAfter/components/applyRecord/index.tsx b/src/pages/salesAfter/components/applyRecord/index.tsx new file mode 100644 index 0000000..2d48da6 --- /dev/null +++ b/src/pages/salesAfter/components/applyRecord/index.tsx @@ -0,0 +1,124 @@ +import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder"; +import { formatHashTag, formatPriceDiv } from "@/common/fotmat"; +import LabAndImg from "@/components/LabAndImg"; +import Popup from "@/components/popup"; +import { ScrollView, Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useMemo, useState } from "react"; +import styles from './index.module.scss' + +type Param = { + show?: true|false, + onClose?: () => void, + onSubmit?: () => void, + id?: number +} +export default memo(({show, onClose, onSubmit, id}:Param) => { + useEffect(() => { + if(show && id) getSaleOrderPreView() + }, [show, id]) + + //获取订单详情 + const [orderDetail, setOrderDetail] = useState() //获取到的原始数据 + const {fetchData: saleOrderOrderDetailData} = SaleOrderOrderDetailApi() + const getSaleOrderPreView = async () => { + if(id) { + let res = await saleOrderOrderDetailData({id: id}) + setOrderDetail(res.data) + } + Taro.stopPullDownRefresh() + } + //格式化数据格式 + const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据 + const formatData = () => { + setFormatDetailOrder({ + estimate_amount: orderDetail.estimate_amount, //预估金额 + sale_mode: orderDetail.sale_mode, + sale_mode_name: orderDetail.sale_mode_name, + total_colors: orderDetail.total_colors, //总颜色数量 + total_number: orderDetail.total_number, //总数量 + total_fabrics: orderDetail.total_fabrics, //面料数量 + unit: orderDetail.sale_mode == 0?'条':'m', //单位 + list: orderDetail.product_list, + stage: orderDetail.stage, //订单状态 + type: orderDetail.type, //退货or退款 + total_sale_price: orderDetail.total_sale_price, //销售金额 + total_should_collect_money: orderDetail.total_should_collect_money, //应收金额 + total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠 + actual_amount: orderDetail.actual_amount, //实付金额 + the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态 + }) + } + + //监听获取到的数据 + useEffect(() => { + if(orderDetail) + formatData() + }, [orderDetail]) + + //对应数量 + const formatCount = useCallback((item) => { + return formatDetailOrder?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [formatDetailOrder]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (formatDetailOrder?.sale_mode == 1?'m':'kg') + }, [formatDetailOrder]) + //数量格式 + const numText = useMemo(() => { + if(formatDetailOrder) + return `${formatDetailOrder?.total_fabrics}种面料,${formatDetailOrder?.total_colors}种颜色,共${formatDetailOrder?.total_number}${formatDetailOrder?.unit}` + }, [formatDetailOrder]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + return ( + <> + + {formatDetailOrder&& + {numText} + + + { + formatDetailOrder?.list?.map(item => { + return + + {formatDetailOrder.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + ¥{standardPrice(colorItem.sale_price)} + + + ×{formatCount(colorItem)}{formatDetailOrder.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + + 申请条数 + ×{orderDetail?.total_number} + + + + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index b5e7a52..2cc8d3a 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -45,18 +45,18 @@ export default memo(({order, comfirm = false}:Param) => { return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` }, [order]) - const { - SaleOrderStatusBooking, // 待接单 - SaleOrderStatusArranging, // 配布中 - SaleOrderStatusArranged, // 已配布 - SaleOrderStatusWaitingPayment, // 待付款 - SaleOrderStatusWaitingDelivery, // 待发货 - SaleOrderStatusWaitingReceipt, // 待收货 - SaleOrderStatusAlreadyReceipt, // 已收货 - SaleOrderStatusComplete, // 已完成 - SaleOrderStatusRefund, // 已退款 - SaleOrderStatusCancel, // 已取消 - } = ORDER_STATUS + // const { + // SaleOrderStatusBooking, // 待接单 + // SaleOrderStatusArranging, // 配布中 + // SaleOrderStatusArranged, // 已配布 + // SaleOrderStatusWaitingPayment, // 待付款 + // SaleOrderStatusWaitingDelivery, // 待发货 + // SaleOrderStatusWaitingReceipt, // 待收货 + // SaleOrderStatusAlreadyReceipt, // 已收货 + // SaleOrderStatusComplete, // 已完成 + // SaleOrderStatusRefund, // 已退款 + // SaleOrderStatusCancel, // 已取消 + // } = ORDER_STATUS //金额列表枚举 const priceList = [ diff --git a/src/pages/salesAfter/components/returnLogistics/index.module.scss b/src/pages/salesAfter/components/returnLogistics/index.module.scss new file mode 100644 index 0000000..1a22287 --- /dev/null +++ b/src/pages/salesAfter/components/returnLogistics/index.module.scss @@ -0,0 +1,35 @@ + +.logistics_main{ + padding: 20px 30px; + box-sizing: border-box; + .logistics_image{ + display: flex; + .title_desc{ + font-size: 28px; + font-weight: 700; + padding-top: 50px; + box-sizing: border-box; + } + .upload_image{ + flex:1; + } + } + .logistics_desc{ + margin-top: 50px; + } + .btns_two{ + display: flex; + height: 82px; + font-size: $font_size_big; + border-radius: 40px; + margin-top: 50px; + .verify_btn{ + flex:1; + border-radius: 40px; + background: #007aff; + text-align: center; + line-height: 82px; + color: #fff; + } + } +} diff --git a/src/pages/salesAfter/components/returnLogistics/index.tsx b/src/pages/salesAfter/components/returnLogistics/index.tsx new file mode 100644 index 0000000..3d6b19f --- /dev/null +++ b/src/pages/salesAfter/components/returnLogistics/index.tsx @@ -0,0 +1,70 @@ +import Popup from "@/components/popup"; +import { Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useRef, useState } from "react"; +import UploadImage from "@/components/uploadImage" +import styles from './index.module.scss' +import TextareaEnhance from "@/components/textareaEnhance"; +import { ReturnApplyLogisticsApi } from "@/api/salesAfterOrder"; +import { alert } from "@/common/common"; + +type Param = { + show?: true|false, + onClose?: () => void, + onSubmit?: () => void, + id?: number //订单id +} +export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => { + //需要提交的数据 + const submitData = useRef({ + accessory_url: [], + remark: '', + id: 0 + }) + useEffect(() => { + if(id) submitData.current.id = id + }, [id]) + + //获取图片列表 + const getImageList = useCallback((list) => { + submitData.current.accessory_url = list + }, []) + + //备注 + const getOtherReason = useCallback((val) => { + submitData.current.remark = val + }, []) + + //确定 + const {fetchData} = ReturnApplyLogisticsApi() + const onSubmitEven = async () => { + if(!id) return alert.error('参数有误') + if(submitData.current.accessory_url.length <= 0) return alert.error('请上传附件') + let res = await fetchData(submitData.current) + if(res.success) { + alert.success('上传成功') + } else { + alert.error('上传失败') + } + } + + return ( + <> + + + + 上传附件: + + + + + + + + + onSubmitEven()}>保存 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 0e396d2..2796f66 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -15,9 +15,11 @@ import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState, memo } from "react"; import AddressInfoDetail from "./components/addressInfoDetail"; +import ApplyRecord from "./components/applyRecord"; import ContentBox from "./components/contentBox"; import KindList from "./components/kindList"; import OrderState from "./components/orderState"; +import ReturnLogistics from "./components/returnLogistics"; import styles from './index.module.scss' export default () => { @@ -73,13 +75,7 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - if(val == 1) { - //取消订单 - getSaleOrderPreView() - } - if(val == 2) { - - } + }, [orderDetail]) //页面下拉刷新 @@ -102,16 +98,42 @@ import styles from './index.module.scss' //订单状态枚举 const {SaleOrderStatusCancel} = ORDER_STATUS + //物流显示 + const [logisticsShow, setLogisticsShow] = useState(false) + const onShowLogistics = useCallback((val) => { + if(val == 1) { + setLogisticsShow(true) + } else { + const list = orderDetail?.fabric_piece_accessory_url.map(item => { + return formatImgUrl(item) + }) + Taro.previewImage({ + current: list[0], // 当前显示 + urls: list // 需要预览的图片http链接列表 + }) + } + }, [orderDetail]) + const onCloseLogistics = useCallback(() => setLogisticsShow(false), []) + //物流成功上传 + const logisticsSuccess = useCallback(() => { + getSaleOrderPreView() + }, []) + + //显示生气记录 + const [applyRecord, setApplyRecord] = useState(false) + return ( - + {(orderDetail?.status != SaleOrderStatusCancel.value)&& } + + setApplyRecord(false)}/> ) @@ -145,12 +167,18 @@ import styles from './index.module.scss' clipboardData(orderInfo?.order_no)}>复制 + + {orderInfo?.return_reason_name} + {orderInfo?.return_explain_name} {orderInfo?.return_remark} + + {orderInfo?.goods_status_name} + {formatDateTime(orderInfo?.apply_time)} @@ -158,12 +186,20 @@ import styles from './index.module.scss' ) }) - const AfterSalePricture = memo(({urls}:{urls: string[]}) => { + const AfterSalePricture = memo(({urls = []}:{urls: string[]}) => { + + const showList = useMemo(() => { + let res = urls.map(item => { + return formatImgUrl(item) + }) + return res + }, [urls]) + //预览图片 const showImage = () => { Taro.previewImage({ - current: formatImgUrl(''), // 当前显示 - urls: [formatImgUrl('')] // 需要预览的图片http链接列表 + current: showList[0], // 当前显示 + urls: showList // 需要预览的图片http链接列表 }) } return ( diff --git a/src/pages/salesAfterList/components/returnLogistics/index.module.scss b/src/pages/salesAfterList/components/returnLogistics/index.module.scss new file mode 100644 index 0000000..1a22287 --- /dev/null +++ b/src/pages/salesAfterList/components/returnLogistics/index.module.scss @@ -0,0 +1,35 @@ + +.logistics_main{ + padding: 20px 30px; + box-sizing: border-box; + .logistics_image{ + display: flex; + .title_desc{ + font-size: 28px; + font-weight: 700; + padding-top: 50px; + box-sizing: border-box; + } + .upload_image{ + flex:1; + } + } + .logistics_desc{ + margin-top: 50px; + } + .btns_two{ + display: flex; + height: 82px; + font-size: $font_size_big; + border-radius: 40px; + margin-top: 50px; + .verify_btn{ + flex:1; + border-radius: 40px; + background: #007aff; + text-align: center; + line-height: 82px; + color: #fff; + } + } +} diff --git a/src/pages/salesAfterList/components/returnLogistics/index.tsx b/src/pages/salesAfterList/components/returnLogistics/index.tsx new file mode 100644 index 0000000..3d6b19f --- /dev/null +++ b/src/pages/salesAfterList/components/returnLogistics/index.tsx @@ -0,0 +1,70 @@ +import Popup from "@/components/popup"; +import { Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useRef, useState } from "react"; +import UploadImage from "@/components/uploadImage" +import styles from './index.module.scss' +import TextareaEnhance from "@/components/textareaEnhance"; +import { ReturnApplyLogisticsApi } from "@/api/salesAfterOrder"; +import { alert } from "@/common/common"; + +type Param = { + show?: true|false, + onClose?: () => void, + onSubmit?: () => void, + id?: number //订单id +} +export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => { + //需要提交的数据 + const submitData = useRef({ + accessory_url: [], + remark: '', + id: 0 + }) + useEffect(() => { + if(id) submitData.current.id = id + }, [id]) + + //获取图片列表 + const getImageList = useCallback((list) => { + submitData.current.accessory_url = list + }, []) + + //备注 + const getOtherReason = useCallback((val) => { + submitData.current.remark = val + }, []) + + //确定 + const {fetchData} = ReturnApplyLogisticsApi() + const onSubmitEven = async () => { + if(!id) return alert.error('参数有误') + if(submitData.current.accessory_url.length <= 0) return alert.error('请上传附件') + let res = await fetchData(submitData.current) + if(res.success) { + alert.success('上传成功') + } else { + alert.error('上传失败') + } + } + + return ( + <> + + + + 上传附件: + + + + + + + + + onSubmitEven()}>保存 + + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfterList/index.tsx b/src/pages/salesAfterList/index.tsx index 53430b9..9c4f25e 100644 --- a/src/pages/salesAfterList/index.tsx +++ b/src/pages/salesAfterList/index.tsx @@ -13,6 +13,7 @@ import OrderStatusList from "./components/orderStatusList" import Payment from "../order/components/payment" import { AFTER_ORDER_STATUS } from "@/common/enum" import { GetSaleOrderListApi } from "@/api/salesAfterOrder" +import ReturnLogistics from "./components/returnLogistics" export default () => { const {checkLogin} = useLogin() @@ -97,30 +98,14 @@ export default () => { //监听点击的按钮 const clickOrderBtn = useCallback(({status, orderInfo}) => { if(status == 2) { - //去支付 - setPayOrderInfo({orderId:orderInfo.should_collect_order_id, payment_method:orderInfo.payment_method}) - toPay() - } else { - getOrderList() + //退货物流 + } }, [orderData]) - - //去付款 - const [payOrderInfo, setPayOrderInfo] = useState() - const [payMentShow, setPayMentShow] = useState(false) - const toPay = () => { - setPayMentShow(true) - } - //关闭支付弹窗 - const closePayShow = useCallback(() => { - setPayMentShow(() => false) - }, []) - //支付成功 - const onPaySuccess = useCallback(() => { - getOrderList() - closePayShow() - }, []) + //物流显示 + const [logisticsShow, setLogisticsShow] = useState(false) + const onCloseLogistics = useCallback(() => setLogisticsShow(false), []) return ( @@ -135,8 +120,8 @@ export default () => { return })} + - ) } From 45985c5b72516159a2a1713c747b0ffabe7ff7ff Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 22 Jun 2022 10:58:39 +0800 Subject: [PATCH 34/47] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8Ev3=5F?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=94=AE=E5=90=8E=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/order/components/remark/index.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/order/components/remark/index.tsx b/src/pages/order/components/remark/index.tsx index ce82f0f..11d870f 100644 --- a/src/pages/order/components/remark/index.tsx +++ b/src/pages/order/components/remark/index.tsx @@ -19,8 +19,7 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => { getDesc(defaultValue) }, [defaultValue]) - const getDesc = useCallback((e) => { - let value = e.detail.value + const getDesc = useCallback((value) => { let res = value if(value.length > descData.count) { res = value.slice(0, descData.count) @@ -35,7 +34,7 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => { 编辑备注 - + {descData.number}/{descData.count} setSave()}>保存 From fab3cd8b86aa423973df372843f4e8d58543f193 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 22 Jun 2022 14:17:34 +0800 Subject: [PATCH 35/47] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=95=B0=E9=87=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 +- src/components/counter/index.tsx | 2 +- src/components/shopCart/index copy.tsx | 275 +++++++++++++++++++++++++ src/components/shopCart/index.tsx | 38 +++- 4 files changed, 308 insertions(+), 11 deletions(-) create mode 100644 src/components/shopCart/index copy.tsx diff --git a/src/common/constant.js b/src/common/constant.js index 42b4b0b..8e897bc 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.5:40001/lymarket` // 王霞 -export const BASE_URL = `http://192.168.1.224:50002/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/components/counter/index.tsx b/src/components/counter/index.tsx index 20472c3..37c1e59 100644 --- a/src/components/counter/index.tsx +++ b/src/components/counter/index.tsx @@ -28,7 +28,7 @@ export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, const minus = () => { let {count} = value let num_res = Big(count).minus(step).toNumber() - num_res = num_res < minNum?0:num_res + num_res = num_res < minNum?minNum:num_res setValue({...value, count:num_res}) onChange?.(parseFloat(num_res)) onClickBtn?.(parseFloat(num_res)) diff --git a/src/components/shopCart/index copy.tsx b/src/components/shopCart/index copy.tsx new file mode 100644 index 0000000..504abbd --- /dev/null +++ b/src/components/shopCart/index copy.tsx @@ -0,0 +1,275 @@ +import {Image, ScrollView, View } from "@tarojs/components" +import Popup from "@/components/popup" +import classnames from "classnames"; +import MCheckbox from "@/components/checkbox"; +import LoadingCard from "@/components/loadingCard"; +import InfiniteScroll from "@/components/infiniteScroll"; +import styles from "./index.module.scss" +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import Taro from "@tarojs/taro"; +import { alert, goLink } from "@/common/common"; +import {GetShoppingCartApi, DelShoppingCartApi} from "@/api/shopCart" +import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; +import { setParam } from "@/common/system"; +import { debounce } from "@/common/util"; + +type param = { + show?: true|false, + onClose?: () => void +} +export default ({show = false, onClose}: param) => { + const selectList = [ + // {value:-1, title:'不限', unit:'', eunit:''}, + {value:0, title:'大货', unit:'件', eunit:'kg'}, + {value:1,title:'剪板', unit:'米', eunit:'m'}, + {value:2,title:'散剪', unit:'米', eunit:'kg'}, + + ] + + const [selectIndex, setSelectIndex] = useState(0) + const selectProduct = (index:number) => { + setSelectIndex(index) + } + + useEffect(() => { + resetList() + setSelectStatus(true) + }, [selectIndex]) + + //重置勾选数据 + const resetList = () => { + list?.map(item => { + if(selectIndex == item.sale_mode || selectIndex == -1) { + item.select = true + } else { + item.select = false + } + }) + setList([...list]) + } + + //获取数据 + const [list, setList] = useState([]) + const [loading, setLoading] = useState(false) + const {fetchData} = GetShoppingCartApi() + const getShoppingCart = async () => { + setLoading(true) + const {data} = await fetchData() + let color_list = data.color_list||[] + color_list.reverse() + initList(color_list) + setList(color_list) + setLoading(false) + } + + //初始化全部数据 + const initList = (color_list) => { + color_list?.map(item => { + if(selectIndex == item.sale_mode) item.select = true + }) + } + + //显示是展示数据 + useEffect(() => { + if(!show) { + setList([]) + setSelectIndex(0) + } else { + getShoppingCart() + } + }, [show]) + + useEffect(() => { + return () => { + setList([]) + } + }, []) + + const [showPopup, setShowPopup] = useState(false) + useEffect(() => { + setShowPopup(show) + }, [show]) + + //全选反选 + const [selectStatus, setSelectStatus] = useState(false) + const selectAll = () => { + list.map(item => { + if(selectIndex == item.sale_mode || selectIndex == -1) + item.select = !selectStatus + }) + setSelectStatus(!selectStatus) + setList([...list]) + } + + //checkbox选中回调 + const selectCallBack = (item) => { + item.select = true + checkSelect() + setList([...list]) + } + + //checkbox选中判断是否全部选中,全部选中后是全选,否则反选 + const checkSelect = () => { + let list_count = 0 + let select_count = 0 + list?.map(item => { + if(selectIndex == -1 || selectIndex == item.sale_mode) { + list_count ++ + if(item.select) select_count++ + } + }) + setSelectStatus(select_count == list_count) + } + + //checkbox关闭回调 + const colseCallBack = (item) => { + item.select = false + checkSelect() + setList([...list]) + } + + //popup关闭 + const closePopup = () => { + onClose?.() + setShowPopup(false) + } + + //删除购物车内容 + const {fetchData:delShopFetchData} = DelShoppingCartApi() + const delSelect = () => { + Taro.showModal({ + content: '删除所选商品?', + success: async function (res) { + if (res.confirm) { + getSelectId() + const res = await delShopFetchData({id:selectIds.current}) + if(res.success) { + getShoppingCart() + Taro.showToast({ + title: '成功', + icon: 'success', + }) + } else { + Taro.showToast({ + title: res.msg, + icon: 'none', + }) + } + + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } + + //获取面料选中的id + const selectIds = useRef([]) + const getSelectId = () => { + selectIds.current = [] + list?.map(item => { + if(selectIndex == -1 || selectIndex == item.sale_mode) { + item.select&&selectIds.current.push(item.id) + } + }) + } + + //格式化金额 + const formatPirce = useCallback((price) => { + return Number(formatPriceDiv(price)) + }, []) + + //格式化数量 + const formatCount = useCallback((item) => { + return item.sale_mode == 0? item.roll + '件': (item.length/100) + 'm' + }, []) + + //预估金额 + const estimatePrice = useMemo(() => { + let count = 0 + list.map(item => { + if(item.select) count += item.estimate_amount + }) + return Number(formatPriceDiv(count)) + },[list]) + + //去结算 + const orderDetail = debounce(() => { + getSelectId() + if(selectIds.current.length == 0) { + alert.error('请选择面料') + } else { + let ids = selectIds.current.join('-') + setParam({ids, sale_mode:selectIndex}) + closePopup() + goLink('/pages/order/comfirm') + } + }, 500) + + return ( + + closePopup()} > + + + {!selectStatus?'全选':'反选'} + + + 删除所选 + + + + {selectList.map((item) => { + return selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title} + })} + + + {loading&&} + {!loading&&list?.length > 0&& + + {list?.map((item, index) => { + return + + selectCallBack(item)} onClose={() => colseCallBack(item)}/> + + + + + + {formatHashTag(item.product_code, item.product_name)} + {item.product_color_code +' ' + item.product_color_name} + {item.sale_mode_name} + + + {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} + ×{formatCount(item)} + + + })} + + } + {!loading&&list?.length == 0 && + 暂未选择商品 + 去选购 + } + + + + + + + + + {estimatePrice} + 预估金额 + + orderDetail()}> + 去结算 + + + + + + + ) +} + diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 504abbd..d76c056 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -12,6 +12,7 @@ import {GetShoppingCartApi, DelShoppingCartApi} from "@/api/shopCart" import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import { setParam } from "@/common/system"; import { debounce } from "@/common/util"; +import Counter from "../counter"; type param = { show?: true|false, @@ -19,11 +20,9 @@ type param = { } export default ({show = false, onClose}: param) => { const selectList = [ - // {value:-1, title:'不限', unit:'', eunit:''}, - {value:0, title:'大货', unit:'件', eunit:'kg'}, - {value:1,title:'剪板', unit:'米', eunit:'m'}, - {value:2,title:'散剪', unit:'米', eunit:'kg'}, - + {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:5, maxNum:100000, defaultNum:10}, ] const [selectIndex, setSelectIndex] = useState(0) @@ -56,7 +55,6 @@ export default ({show = false, onClose}: param) => { setLoading(true) const {data} = await fetchData() let color_list = data.color_list||[] - color_list.reverse() initList(color_list) setList(color_list) setLoading(false) @@ -66,6 +64,7 @@ export default ({show = false, onClose}: param) => { const initList = (color_list) => { color_list?.map(item => { if(selectIndex == item.sale_mode) item.select = true + item.count = formatCount(item) }) } @@ -181,7 +180,13 @@ export default ({show = false, onClose}: param) => { //格式化数量 const formatCount = useCallback((item) => { - return item.sale_mode == 0? item.roll + '件': (item.length/100) + 'm' + console.log('item:::',item) + return item.sale_mode == 0? item.roll : (item.length/100) + }, []) + + //格式化单位 + const formatUnit = useCallback((item) => { + return item.sale_mode == 0? '条':'米' }, []) //预估金额 @@ -205,6 +210,13 @@ export default ({show = false, onClose}: param) => { goLink('/pages/order/comfirm') } }, 500) + + //计数组件 + const getInputValue = (num, item) => { + item.count = parseFloat(num) + setList([...list]) + } + return ( @@ -241,7 +253,17 @@ export default ({show = false, onClose}: param) => { {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} - ×{formatCount(item)} + {/* ×{formatCount(item)} */} + getInputValue(e, item)} + defaultNum={item.count} + step={selectList[selectIndex].step} + digits={selectList[selectIndex].digits} + onClickBtn={(e) => getInputValue(e, item)} + unit={formatUnit(item)} + minNum={selectList[selectIndex].minNum} + maxNum={selectList[selectIndex].maxNum} + /> })} From b82dad781af167720f657eed36247e5c19f13271 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 22 Jun 2022 20:34:24 +0800 Subject: [PATCH 36/47] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=95=B0=E9=87=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shopCart.ts | 11 +++ src/app.config.ts | 6 ++ src/common/constant.js | 4 +- src/components/counter/index.tsx | 8 ++- src/components/orderBtns/index.tsx | 2 + src/components/shopCart/index.module.scss | 14 ++++ src/components/shopCart/index.tsx | 69 ++++++++++++------- src/pages/collection/index.config.ts | 4 ++ src/pages/collection/index.module.scss | 0 src/pages/collection/index.tsx | 12 ++++ .../details/components/orderCount/index.tsx | 2 +- .../components/addressInfoDetail/index.tsx | 21 ++++-- src/pages/order/index.tsx | 43 +++++++++++- .../components/addressInfoDetail/index.tsx | 2 +- src/use/useHttp.ts | 4 +- 15 files changed, 166 insertions(+), 36 deletions(-) create mode 100644 src/pages/collection/index.config.ts create mode 100644 src/pages/collection/index.module.scss create mode 100644 src/pages/collection/index.tsx diff --git a/src/api/shopCart.ts b/src/api/shopCart.ts index 87e0d32..291ab60 100644 --- a/src/api/shopCart.ts +++ b/src/api/shopCart.ts @@ -31,4 +31,15 @@ export const DelShoppingCartApi = () => { url: `/v1/mall/shoppingCart/productColor`, method: "delete", }) +} + +/** + * 修改购物车数量 + * @returns +*/ +export const UpdateShoppingCartApi = () => { + return useRequest({ + url: `/v1/mall/shoppingCart/productColor`, + method: "put", + }) } \ No newline at end of file diff --git a/src/app.config.ts b/src/app.config.ts index 27b804e..e735150 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -171,6 +171,12 @@ export default { pages: [ "index", ] + }, + { + root: "pages/collection", + pages: [ + "index", + ] } ] } diff --git a/src/common/constant.js b/src/common/constant.js index 8e897bc..42b4b0b 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.5:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.224:50002/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/components/counter/index.tsx b/src/components/counter/index.tsx index 37c1e59..9ff7d87 100644 --- a/src/components/counter/index.tsx +++ b/src/components/counter/index.tsx @@ -11,12 +11,14 @@ type params = { onChange?:(val:number) => void, onBlue?:(val:number) => void, //失去焦点触发 onClickBtn?:(val:number) => void, - unit?: string + unit?: string, + disable?: true|false, //是否禁用 } -export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = ''}: params) => { +export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = '', disable = false}: params) => { const [value, setValue] = useState({count:defaultNum}) const onPlus = () => { + if(disable) return false let {count} = value let num_res = Big(count).add(step).toNumber() num_res = num_res >= maxNum?maxNum:num_res @@ -26,6 +28,7 @@ export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, onClickBtn?.(parseFloat(num_res)) } const minus = () => { + if(disable) return false let {count} = value let num_res = Big(count).minus(step).toNumber() num_res = num_res < minNum?minNum:num_res @@ -102,6 +105,7 @@ export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, onInput={onInputEven} onBlur={onBluerEven} type='digit' + disabled={disable} /> {unit} diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index c1f23b2..871f2a2 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -6,6 +6,7 @@ import Taro from "@tarojs/taro" import {useRef, memo, useState, useMemo } from "react" import classnames from "classnames"; import styles from './index.module.scss' +import { AddShoppingCartApi } from "@/api/shopCart" type Param = { orderInfo: { @@ -180,6 +181,7 @@ export default memo(({orderInfo, onClick}:Param) => { }) } + //显示更多按钮 const [showMore, setShowMore] = useState(false) const styleTop = useMemo(() => { diff --git a/src/components/shopCart/index.module.scss b/src/components/shopCart/index.module.scss index 43de2c1..008bf06 100644 --- a/src/components/shopCart/index.module.scss +++ b/src/components/shopCart/index.module.scss @@ -17,6 +17,11 @@ margin-right: 10px; } } + .count_all{ + font-size: 22px; + color: #ABABAB; + padding: 30px 20px; + } .search{ display: flex; justify-content: space-between; @@ -104,6 +109,15 @@ flex-direction: column; justify-content: space-between; align-items: flex-end; + .btn_count{ + width: 235px; + height: 64px; + background-color: #ECF5FF; + border-radius: 40px 0px 16px 0px; + padding: 0 20px; + display: flex; + align-items: center; + } .price{ font-size: $font_size; font-weight: 700; diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index d76c056..497e587 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -8,7 +8,7 @@ import styles from "./index.module.scss" import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import Taro from "@tarojs/taro"; import { alert, goLink } from "@/common/common"; -import {GetShoppingCartApi, DelShoppingCartApi} from "@/api/shopCart" +import {GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi} from "@/api/shopCart" import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import { setParam } from "@/common/system"; import { debounce } from "@/common/util"; @@ -189,14 +189,24 @@ export default ({show = false, onClose}: param) => { return item.sale_mode == 0? '条':'米' }, []) - //预估金额 + //预估金额和总条数 const estimatePrice = useMemo(() => { - let count = 0 + let estimate_amount = 0 + let product_list = new Set() //面料 + let color_count = 0 //颜色数量 + let all_count = 0 //总数量 list.map(item => { - if(item.select) count += item.estimate_amount + if(item.select) { + estimate_amount += item.estimate_amount + product_list.add(item.product_id) + color_count++ + all_count += item.sale_mode == 0?item.roll: (item.length) + } }) - return Number(formatPriceDiv(count)) + let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米' + return {price: Number(formatPriceDiv(estimate_amount)), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count} },[list]) + //去结算 const orderDetail = debounce(() => { @@ -205,18 +215,27 @@ export default ({show = false, onClose}: param) => { alert.error('请选择面料') } else { let ids = selectIds.current.join('-') - setParam({ids, sale_mode:selectIndex}) + setParam({ids, sale_mode:selectIndex}) //临时存储 closePopup() goLink('/pages/order/comfirm') } }, 500) - //计数组件 - const getInputValue = (num, item) => { - item.count = parseFloat(num) - setList([...list]) + //计数组件-当后端修改完成才修改前端显示 + const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi() + const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false) + const getInputValue = async (num, item) => { + let roll = item.sale_mode == 0?parseFloat(num):0 + let length = item.sale_mode != 0?(parseFloat(num)*100):0 + setUpdateShoppingCartLoading(() => true) + let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length}) + setUpdateShoppingCartLoading(() => false) + if(res.success) { + item.count = parseFloat(num) + setList([...list]) + } + } - return ( @@ -229,6 +248,7 @@ export default ({show = false, onClose}: param) => { 删除所选 + {estimatePrice.countText} {selectList.map((item) => { return selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title} @@ -254,16 +274,19 @@ export default ({show = false, onClose}: param) => { {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} {/* ×{formatCount(item)} */} - getInputValue(e, item)} - defaultNum={item.count} - step={selectList[selectIndex].step} - digits={selectList[selectIndex].digits} - onClickBtn={(e) => getInputValue(e, item)} - unit={formatUnit(item)} - minNum={selectList[selectIndex].minNum} - maxNum={selectList[selectIndex].maxNum} - /> + + getInputValue(e, item)} + defaultNum={item.count} + step={selectList[selectIndex].step} + digits={selectList[selectIndex].digits} + onClickBtn={(e) => getInputValue(e, item)} + unit={formatUnit(item)} + minNum={selectList[selectIndex].minNum} + maxNum={selectList[selectIndex].maxNum} + disable={UpdateShoppingCartLoading} + /> + })} @@ -281,11 +304,11 @@ export default ({show = false, onClose}: param) => { - {estimatePrice} + {estimatePrice.price} 预估金额 orderDetail()}> - 去结算 + 去结算({estimatePrice.color_count}) diff --git a/src/pages/collection/index.config.ts b/src/pages/collection/index.config.ts new file mode 100644 index 0000000..a316ea6 --- /dev/null +++ b/src/pages/collection/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '我的收藏', + enableShareAppMessage: true, +} diff --git a/src/pages/collection/index.module.scss b/src/pages/collection/index.module.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx new file mode 100644 index 0000000..67a9d9f --- /dev/null +++ b/src/pages/collection/index.tsx @@ -0,0 +1,12 @@ +import Search from "@/components/search" +import { View } from "@tarojs/components" +import styles from './index.module.scss' +export default () => { + return ( + + + console.log(e)} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} /> + + + ) + } \ No newline at end of file diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index ea454ec..78166e7 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -296,7 +296,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param) // } void, //选择地址 - defaultValue?: AddressInfoParam|null, //默认值 disabled?: false|true, //true禁用后只用于展示 onChangeShipmentMode?: (val: number) => void, //返回收货方式 status?: 1|2, //1确认订单时使用, 2订单流程 @@ -35,7 +34,7 @@ type Param = { } } -export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2}: Param, ref) => { +export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false}: Param, ref) => { const [addressInfo, setAddressInfo] = useState() @@ -46,6 +45,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat } }, [orderInfo]) + //地址格式 const formatAddress = useMemo(() => { if(addressInfo?.province_name) { @@ -58,7 +58,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) const changeShow = () => { - if(receivingStatus == 2 && !logisticsShow) + if(receivingStatus == 2 && !logisticsShow && !disabledSelect) setShowAddressList(() => true) } @@ -72,6 +72,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() const onReceivingStatus = (value, e) => { e.stopPropagation() + if(!disabledSelect) return false changeReceivingStatus(value) } const changeReceivingStatus = debounce(async (value) => { @@ -123,9 +124,21 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat SaleOrderStatusAlreadyReceipt, SaleOrderStatusComplete, SaleOrderStatusRefund, - SaleOrderStatusCancel + SaleOrderStatusCancel, } = ORDER_STATUS + //禁用 + const disabledSelect = useMemo(() => { + let statusList = [ + SaleOrderStatusWaitingReceipt.value, + SaleOrderStatusAlreadyReceipt.value, + SaleOrderStatusComplete.value, + SaleOrderStatusRefund.value, + SaleOrderStatusCancel.value, + ] + return (statusList.includes(orderInfo?.status!)||disabled) + }, [orderInfo, disabled]) + //根据订单状态判断是否显示物流 const logisticsShowList = [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value] const logisticsShow = useMemo(() => { diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index e1e3b45..e706a52 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -4,12 +4,14 @@ import { CancelOrderApi } from "@/api/order"; import { GetOrderPayApi } from "@/api/orderPay"; +import { AddShoppingCartApi } from "@/api/shopCart"; import { alert, goLink } from "@/common/common"; import { ORDER_STATUS } from "@/common/enum"; import { formatDateTime, formatPriceDiv } from "@/common/fotmat"; import OrderBtns from "@/components/orderBtns"; import Popup from "@/components/popup"; import SearchInput from "@/components/searchInput"; +import ShopCart from "@/components/shopCart"; import { Text, Textarea, View } from "@tarojs/components" import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; @@ -97,7 +99,8 @@ import styles from './index.module.scss' name: orderDetail?.target_user_name, phone: orderDetail?.target_user_phone, shipment_mode: orderDetail?.shipment_mode, - id: orderDetail?.id + id: orderDetail?.id, + sale_mode: orderDetail?.sale_mode, } }, [orderDetail]) @@ -152,6 +155,9 @@ import styles from './index.module.scss' toPay() } else if(val == 3) { setRefundShow(true) + } else if(val == 7) { + //再购 + addShopCart() } }, [orderDetail]) @@ -199,6 +205,40 @@ import styles from './index.module.scss' setRefundShow(false) }, []) + + + //添加购物车 + const [showCart, setShowCart] = useState(false) + const {fetchData:addFetchData} = AddShoppingCartApi() + const addShopCart = async () => { + let color_list:{product_color_id: number, roll?: number, length?: number}[] = [] + orderDetail?.product_list.map(pitem => { + pitem?.product_colors.map(citem => { + if(orderDetail?.sale_mode == 0) { + return color_list.push({product_color_id: citem.id, roll: citem.roll}) + } else { + return color_list.push({product_color_id: citem.id, length: citem.length}) + } + }) + }) + const state = await addFetchData({ + sale_mode: orderDetail?.sale_mode, + color_list + }) + if(state.success) { + Taro.showToast({ + title:'已加入购物车' + }) + setShowCart(true) + } else { + Taro.showToast({ + icon:'none', + title: state.msg + }) + } + + } + return ( @@ -238,6 +278,7 @@ import styles from './index.module.scss' + setShowCart(false)}/> ) diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index d8e8b70..db4d5f3 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -25,7 +25,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage //是否显示地址 const showAddress = useMemo(() => { return stage != ReturnStageApplying.value - }, []) + }, [stage]) //上传物流 const upLogistics = useMemo(() => { diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 2663ab8..2f38afc 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -110,7 +110,7 @@ export const useRequest = (options:option = { success: false, // 请求是否成功 data: {}, msg: '', - loading: true, + loading: false, error: null, query: {}, filter: null, @@ -127,7 +127,7 @@ export const useRequest = (options:option = { const {login} = useLoginRequest() useEffect(() => { - console.log('变化::', state.loading) + console.log('变化1::', state.loading) }, [state.loading]) // 请求函数 const fetchData = async (sub_options?:any) => { From fe0d7c7432a6da49f0bf49275bd13ed1e400192d Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 23 Jun 2022 10:48:36 +0800 Subject: [PATCH 37/47] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=95=B0=E9=87=8F=E7=BB=84=E4=BB=B6=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/components/addressInfoDetail/index.tsx | 15 ++------------- src/pages/order/index.tsx | 1 + 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index 86ceb2d..46cc399 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -58,7 +58,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) const changeShow = () => { - if(receivingStatus == 2 && !logisticsShow && !disabledSelect) + if(receivingStatus == 2 && !logisticsShow) setShowAddressList(() => true) } @@ -72,7 +72,6 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() const onReceivingStatus = (value, e) => { e.stopPropagation() - if(!disabledSelect) return false changeReceivingStatus(value) } const changeReceivingStatus = debounce(async (value) => { @@ -127,21 +126,11 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat SaleOrderStatusCancel, } = ORDER_STATUS - //禁用 - const disabledSelect = useMemo(() => { - let statusList = [ - SaleOrderStatusWaitingReceipt.value, - SaleOrderStatusAlreadyReceipt.value, - SaleOrderStatusComplete.value, - SaleOrderStatusRefund.value, - SaleOrderStatusCancel.value, - ] - return (statusList.includes(orderInfo?.status!)||disabled) - }, [orderInfo, disabled]) //根据订单状态判断是否显示物流 const logisticsShowList = [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value] const logisticsShow = useMemo(() => { + console.log('aa:',orderInfo?.status) return logisticsShowList.includes(orderInfo?.status as number) }, [orderInfo]) diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index e706a52..388a4e2 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -101,6 +101,7 @@ import styles from './index.module.scss' shipment_mode: orderDetail?.shipment_mode, id: orderDetail?.id, sale_mode: orderDetail?.sale_mode, + status: orderDetail?.status } }, [orderDetail]) From 7c758f6896f58bc894d806643cbd19a8dc0bb661 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 23 Jun 2022 11:36:51 +0800 Subject: [PATCH 38/47] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shopCart/index.tsx | 4 +++- .../components/addressInfoDetail/index.tsx | 6 +++--- src/pages/order/index.tsx | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 497e587..2af1202 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -136,11 +136,13 @@ export default ({show = false, onClose}: param) => { //删除购物车内容 const {fetchData:delShopFetchData} = DelShoppingCartApi() const delSelect = () => { + getSelectId() + if(selectIds.current.length <= 0) return alert.none('请选择要删除的面料!') Taro.showModal({ content: '删除所选商品?', success: async function (res) { if (res.confirm) { - getSelectId() + const res = await delShopFetchData({id:selectIds.current}) if(res.success) { getShoppingCart() diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index 46cc399..f7194be 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -22,6 +22,7 @@ type Param = { onSelect?: (val:any) => void, //选择地址 disabled?: false|true, //true禁用后只用于展示 onChangeShipmentMode?: (val: number) => void, //返回收货方式 + onLogistics?: () => void, //查看物流 status?: 1|2, //1确认订单时使用, 2订单流程 orderInfo?: { id?: number //订单id @@ -34,9 +35,8 @@ type Param = { } } -export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false}: Param, ref) => { +export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics}: Param, ref) => { - const [addressInfo, setAddressInfo] = useState() useEffect(() => { if(orderInfo) { @@ -155,7 +155,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat || - + 查看物流 } diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 388a4e2..fae2191 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -7,7 +7,7 @@ import { GetOrderPayApi } from "@/api/orderPay"; import { AddShoppingCartApi } from "@/api/shopCart"; import { alert, goLink } from "@/common/common"; import { ORDER_STATUS } from "@/common/enum"; -import { formatDateTime, formatPriceDiv } from "@/common/fotmat"; +import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import OrderBtns from "@/components/orderBtns"; import Popup from "@/components/popup"; import SearchInput from "@/components/searchInput"; @@ -206,7 +206,16 @@ import styles from './index.module.scss' setRefundShow(false) }, []) - + //查看物流 + const getLogistics = useCallback(() => { + const list = orderDetail?.delivery_appendix_url.map(item => { + return formatImgUrl(item) + }) + Taro.previewImage({ + current: list[0], // 当前显示 + urls: list // 需要预览的图片http链接列表 + }) + }, [orderDetail]) //添加购物车 const [showCart, setShowCart] = useState(false) @@ -243,8 +252,8 @@ import styles from './index.module.scss' return ( - - + + From f6f2ce9e9509a6931c5818e64d030141db173f7c Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Thu, 23 Jun 2022 16:56:25 +0800 Subject: [PATCH 39/47] =?UTF-8?q?--=E4=BC=81=E4=B8=9A=E8=AE=A4=E8=AF=8150%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/certification.ts | 34 +++ src/common/constant.js | 4 +- .../FromListCertification/index.scss | 10 +- .../FromListCertification/index.tsx | 9 +- .../components/SelectEnterpriseType.scss | 22 ++ .../components/SelectEnterpriseType.tsx | 56 +++++ src/pages/certification/index.scss | 15 +- src/pages/certification/index.tsx | 206 +++++++++++------- src/pages/userEdit/components/ModifyModal.tsx | 22 +- 9 files changed, 281 insertions(+), 97 deletions(-) create mode 100644 src/api/certification.ts create mode 100644 src/pages/certification/components/SelectEnterpriseType.scss create mode 100644 src/pages/certification/components/SelectEnterpriseType.tsx diff --git a/src/api/certification.ts b/src/api/certification.ts new file mode 100644 index 0000000..02e6d60 --- /dev/null +++ b/src/api/certification.ts @@ -0,0 +1,34 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 企业认证信息获取 + * @returns + */ + export const certificationDetailApi = () => { + return useRequest({ + url: `/v1/mall/company/authentication`, + method: "get", + }) +} + +/** + * 企业认证信息提交 + * @returns + */ + export const certificationSaveApi = () => { + return useRequest({ + url: `/v1/mall/company/authentication`, + method: "put", + }) +} + +/** + * 企业认证类型枚举列表 + * @returns + */ + export const certificationTypeListApi = () => { + return useRequest({ + url: `/v1/mall/enum/companyAuthenticationType`, + method: "get", + }) +} \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index 35b004c..2f4fa08 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,11 +5,11 @@ // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -// export const BASE_URL = `http://192.168.1.30:40001/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 = `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.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` // 杰 diff --git a/src/components/FromListCertification/index.scss b/src/components/FromListCertification/index.scss index fc0ed5a..b2e4f71 100644 --- a/src/components/FromListCertification/index.scss +++ b/src/components/FromListCertification/index.scss @@ -9,9 +9,9 @@ font-size: 28px; font-weight: 400; color: #000000; - margin-top: 20px; - width: 150px; + width: 200px; border-right: 1px solid #F0F0F0; + display: flex;align-items: center; } .From-list-certification-label-required::before{ content: "*"; @@ -19,12 +19,12 @@ font-size: 28px; } .From-list-certification-right{ - width: 506px; + min-width: 100px; + flex: 1; font-size: 26px; font-weight: 400; } .From-list-certification-right-meet{ - width: 506px; min-height: 45px; border-radius: 20px; box-sizing: border-box; @@ -69,6 +69,8 @@ } .From-list-certification-right-placeholder{ color: #ababab; + text-overflow: ellipsis;overflow: hidden;white-space: nowrap; + width: 100%; } .From-list-certification-right-enter .icon-a-moreback{ font-size: 28px; diff --git a/src/components/FromListCertification/index.tsx b/src/components/FromListCertification/index.tsx index 3017860..333fdc6 100644 --- a/src/components/FromListCertification/index.tsx +++ b/src/components/FromListCertification/index.tsx @@ -14,12 +14,13 @@ interface ListParams{ style?: object, //整行样式 labelStyle?: object, // label样式 contentStyle?: object, - required?: boolean + required?: boolean, + showIcon?: boolean, // 是否显示右边的箭头,type=select } // 表单列表 const FromList = memo((props:ListParams)=>{ - const {type="input",value="",style={},labelStyle={},contentStyle={},required=false} = props; + const {type="input",value="",style={},labelStyle={},contentStyle={},required=false,showIcon=true} = props; return ( @@ -44,7 +45,9 @@ const FromList = memo((props:ListParams)=>{ {props.placeholder} } - + + {showIcon&&} + } diff --git a/src/pages/certification/components/SelectEnterpriseType.scss b/src/pages/certification/components/SelectEnterpriseType.scss new file mode 100644 index 0000000..f18cf81 --- /dev/null +++ b/src/pages/certification/components/SelectEnterpriseType.scss @@ -0,0 +1,22 @@ +.select-enterprise-type{ + .select-enterprise-type-btn{ + color: #ABABAB; + font-size: 28px; + padding: 20px; + display: flex;justify-content: space-between; + border-bottom: 1rpx solid #eaeaea; + } + .select-enterprise-type-content{ + padding: 0 20px; + padding-bottom: 120px; + } + .select-enterprise-type-content view{ + padding: 20px 0; + font-size: 28px; + display: flex;justify-content: space-between; + } + .select-enterprise-type-content view text:last-child{ + color: #007AFF; + font-size: 35px; + } +} \ No newline at end of file diff --git a/src/pages/certification/components/SelectEnterpriseType.tsx b/src/pages/certification/components/SelectEnterpriseType.tsx new file mode 100644 index 0000000..acf9598 --- /dev/null +++ b/src/pages/certification/components/SelectEnterpriseType.tsx @@ -0,0 +1,56 @@ +import { Text, View } from "@tarojs/components" +import Popup from "@/components/popup"; +import "./SelectEnterpriseType.scss" +import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; +import {certificationTypeListApi} from "@/api/certification" + +interface Params{ + confirm?: (selected:any)=>void, // 确定 +} + +export default forwardRef((props: Params, ref)=>{ + const [modalShow, setModalShow] = useState(false) + // 获取认证信息 + const {fetchData, state} = certificationTypeListApi(); + useEffect(()=>{ + fetchData(); + }, []) + const [selected, setSelected] = useState({}); + // 确定 + const handleSelect = (item)=>{ + setSelected(item); + } + // 设置弹窗是否显示 + const setShow = (ev)=>{ + setModalShow(ev); + } + useImperativeHandle(ref,()=>({ + setShow + })) + // 确定 + const handleConfirm = ()=>{ + props.confirm&&props.confirm(selected); + setModalShow(false); + } + + return ( + + setModalShow(false)}> + + setModalShow(false)}>取消 + 确定 + + + { + state.data?.list?.map((item,index)=>{ + return handleSelect(item)} key={index}> + {item.name} + {item.id==(selected as any).id?:} + + }) + } + + + + ) +}) diff --git a/src/pages/certification/index.scss b/src/pages/certification/index.scss index 441d16b..a6c7bcf 100644 --- a/src/pages/certification/index.scss +++ b/src/pages/certification/index.scss @@ -16,6 +16,7 @@ margin-left: 30px; padding-top: 40px; color: #000000; + padding-bottom: 20px; // border-top: 18px solid #F0F0F0; } .certification-upload{ @@ -38,6 +39,10 @@ .certification-upload-no{ display: flex;flex-direction: column;align-items: center; } + .certification-upload image{ + position: absolute;width: 100%;height: 100%; + object-fit: cover;border-radius: 30px; + } .certification-upload-no-icon{ width: 104px; height: 104px; @@ -56,10 +61,11 @@ } .certification-button{ position: absolute;bottom: -10px;left: -10px;right: -10px; - background-color: #858A8F; + background-color: rgba(0,0,0,0.65); display: flex; height: 86px; border-radius: 0 0 30px 30px; + z-index: 1; } .certification-button view{ flex: 1; @@ -79,6 +85,7 @@ position: fixed;bottom: 0;left: 0;right: 0; width: 100%; display: flex;align-items: center;justify-content: center; + z-index: 2; } .certification-footer-button{ width: 696px; @@ -90,12 +97,16 @@ box-sizing: border-box; overflow: hidden; } - .certification-footer-button view{ + .certification-footer-button view,.certification-footer-button navigator{ flex: 1; display: flex;align-items: center;justify-content: center; font-size: 32px; font-weight: 400; color: #007aff; + border: 0;border-radius: none; + } + .certification-footer-button navigator::after{ + border: 0;border-radius: none; } .certification-footer-button view:last-child{ color: white; diff --git a/src/pages/certification/index.tsx b/src/pages/certification/index.tsx index 0d0767d..b468626 100644 --- a/src/pages/certification/index.tsx +++ b/src/pages/certification/index.tsx @@ -1,72 +1,73 @@ import FromListCertification from "@/components/FromListCertification" -import { Button, Input, Text, Textarea, View } from "@tarojs/components" +import { Button, Image, Input, NavigationBar, Navigator, Text, Textarea, View } from "@tarojs/components" import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro" -import {weightAddApi, weightDetailApi,weightEditApi} from "@/api/weightList" -import { useEffect, useState } from "react" +import {certificationSaveApi, certificationDetailApi} from "@/api/certification" +import { useEffect, useRef, useState } from "react" import { alert, retrieval } from "@/common/common" import "./index.scss" +import useUploadCDNImg from "@/use/useUploadImage"; import Message from "@/components/Message" +import { IMG_CND_Prefix } from "@/common/constant"; +import SelectEnterpriseType from "./components/SelectEnterpriseType" export default ()=>{ - const {type,id} = useRouter().params; useEffect(()=>{ - if(type=="add"){ - setNavigationBarTitle({title:"添加码单信息"}) - }else{ - initalFormData(); - setNavigationBarTitle({title:"修改码单信息"}) - } + initalFormData(); },[]); - // 获取编辑码单信息 - const {fetchData: getFromData} = weightDetailApi() + // 获取认证信息 + const {fetchData: getFromData} = certificationDetailApi() const initalFormData = async ()=>{ - const detail = await getFromData({id}); + const detail = await getFromData(); setFormData({ - title: detail.data.title, - purchaser_name: detail.data.purchaser_name, - phone: detail.data.phone, - is_default: detail.data.is_default, - id: detail.data.id, - }) + ...detail.data??{}, + legal_person_identity_url: detail?.data?.legal_person_identity_url??[], + // business_license_url: "https://test.cdn.zzfzyc.com/mall/827082e888860dd9da10f0fbb0ac3cf023081456.png" + } as any) } // 保存 const [formData, setFormData] = useState({ - title: "", - purchaser_name: "", - phone: "", - is_default: false, - id: 0 - }) + authentication_type: 0, + authentication_type_name: "", + business_license_url: "", + legal_person: "", + legal_person_identity: "", + legal_person_identity_url: [], + name: "" + }); const rules = { - title: [{ - message: "请输入抬头" + authentication_type: [{ + message: "请选择认证类型" }], - purchaser_name: [{ - message: "请输入客户名称" + name: [{ + message: "请输入企业名称" + }], + business_license_url: [{ + message: "请上传营业执照" + }], + legal_person: [{ + message: "请输入法人名称" + }], + // legal_person_identity: [{ + // message: "请输入正确法人身份证", + // regex: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ + // }], + legal_person_identity_url: [{ + message: "请上传法人身份证", + validator: (value:any, rule:any)=>{ + if(!value[0]||!value[1]){ + return true; + } + return false; + } }], - phone: [{ - message: "请输入正确的电话号码", regex: /^1[3|5|6|9|2|8|7]\d{9}$/ - }] } - const {fetchData} = weightAddApi() - const {fetchData: editFetch} = weightEditApi() + const {fetchData} = certificationSaveApi() const handleSave = ()=>{ retrieval(formData, rules).then(async ()=>{ - const result = type=="add"?await fetchData({ - title: formData.title, - purchaser_name: formData.purchaser_name, - phone: formData.phone, - is_default: formData.is_default, - }):await editFetch({ - title: formData.title, - purchaser_name: formData.purchaser_name, - phone: formData.phone, - is_default: formData.is_default, - id: formData.id - }); + const result = await fetchData({...formData}) if(result.success){ - Taro.eventCenter.trigger("weightList:refresh"); + // Taro.eventCenter.trigger("weightList:refresh"); Taro.navigateBack(); alert.success("保存成功"); }else{ @@ -83,51 +84,106 @@ export default ()=>{ retrieval(formData).then(()=>setHozon(true)).catch(()=>setHozon(false)) } },[formData]) + // 选择类型弹窗显示 + const selectTypeRef= useRef(null) + const handleSelectTypeModalShow = ()=>{ + (selectTypeRef.current as any).setShow(true) + } + // 选择类型确定 + const handleSelectTypeConfirm = (item)=>{ + setFormData({ + ...formData, + authentication_type: item.id, + authentication_type_name: item.name + }); + } + // 上传图片 + const {getWxPhoto} = useUploadCDNImg(); + const handleUploadImage = async (text: any)=>{ + let result = await getWxPhoto('mall'); + if(text=="business_license_url"){ + formData.business_license_url = IMG_CND_Prefix+(result as any).url; + }else{ + formData.legal_person_identity_url[text]=IMG_CND_Prefix+(result as any).url as never; + } + setFormData({...formData}); + } + // 查看图片 + const handleViewImage = (event,url)=>{ + event.stopPropagation(); + Taro.previewImage({ + current: url, + urls: [url] + }) + } return ( - + {/* */} 企业认证 - setFormData({...formData,title:ev.detail.value})} - value={formData["title"]} label="认证类型" placeholder="企业认证"/> - setFormData({...formData,title:ev.detail.value})} value={formData["title"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required/> - setFormData({...formData,title:ev.detail.value})} value={formData["title"]} label="企业营业" placeholder="注册号、统一社会信用代码、组织机构代码" required/> - - {/* 营业执照正面 - - 查看证件 - 重新上传 - */} + + + setFormData({...formData,name:ev.detail.value})} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required/> + + handleUploadImage("business_license_url")} className="certification-upload"> + {(formData as any)?.business_license_url? + <> + 营业执照正面 + + handleViewImage(e,(formData as any)?.business_license_url)}>查看证件 + 重新上传 + + + : + - 上传营业执照下面 + 上传营业执照正面 + } 法人认证 - setFormData({...formData,title:ev.detail.value})} value={formData["title"]} label="法人代表" placeholder="填写法人名称" required/> - setFormData({...formData,title:ev.detail.value})} value={formData["title"]} label="法人身份" placeholder="填写法人代表身份证号" required/> - - 身份证正面 - - 查看证件 - 重新上传 - + setFormData({...formData,legal_person:ev.detail.value})} value={formData["legal_person"]} label="法人代表" placeholder="填写法人名称" required/> + setFormData({...formData,legal_person_identity:ev.detail.value})} value={formData["legal_person_identity"]} label="法人身份" placeholder="填写法人代表身份证号" required/> + handleUploadImage(0)} className="certification-upload"> + {(formData as any)?.legal_person_identity_url[0]? + <> + 营业执照正面 + + handleViewImage(e,(formData as any)?.legal_person_identity_url[0])}>查看证件 + 重新上传 + + + : + + + + 上传身份证正面 + + } - - 身份证反面 - - 查看证件 - 重新上传 - + handleUploadImage(1)} className="certification-upload"> + {(formData as any)?.legal_person_identity_url[1]? + <> + 营业执照正面 + + handleViewImage(e,(formData as any)?.legal_person_identity_url[1])}>查看证件 + 重新上传 + + + : + + + + 上传身份证正面 + + } - 取消 - 提交 + 取消 + 提交 diff --git a/src/pages/userEdit/components/ModifyModal.tsx b/src/pages/userEdit/components/ModifyModal.tsx index 0e51ac1..22c9db5 100644 --- a/src/pages/userEdit/components/ModifyModal.tsx +++ b/src/pages/userEdit/components/ModifyModal.tsx @@ -33,17 +33,17 @@ export default memo(forwardRef((props:any,ref)=>{ useImperativeHandle(ref, ()=>({setModalShow})) return ( setModalShow(false)} title={title} show={modalShow}> - - -