diff --git a/project.private.config.json b/project.private.config.json index a8be625..c96a9a8 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -107,13 +107,6 @@ "launchMode": "default", "scene": null }, - { - "name": "", - "pathName": "pages/submitOrder/index", - "query": "", - "launchMode": "default", - "scene": null - }, { "name": "", "pathName": "pages/refundPage/index", diff --git a/src/api/order.ts b/src/api/order.ts index 3c2caa9..41a125b 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -179,3 +179,18 @@ export const mpenumrefundExplainone = () => { method: "get", }) } + +//提交订单 +export const mpsaleOrderpost = () => { + return useRequest({ + url: `/v1/mp/saleOrder`, + method: "post", + }) +} +//修改销售单物流方式 +export const mpsaleOrdershipmentMode = () => { + return useRequest({ + url: `/v1/mp/saleOrder/shipmentMode`, + method: "put", + }) +} diff --git a/src/common/constant.js b/src/common/constant.js index c7f5b9b..a0ac6bd 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -1,4 +1,4 @@ -export const BASE_URL = CURRENT_BASE_URL +// export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` @@ -12,7 +12,7 @@ export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华 diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index 08fbecd..fbd8dd7 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -5,6 +5,7 @@ import "./index.scss" import { mppurchaseraddresslist } from "@/api/addressList" import { alert } from "@/common/common" import Taro, { showModal, useDidShow, useRouter } from "@tarojs/taro" +import IconFont from '@/components/iconfont/iconfont' import { mpsaleOrderaddress } from '@/api/order' interface Params { refresherEnabled?: boolean,//是否开启刷新 @@ -58,7 +59,8 @@ const AddressList = memo((props: Params) => { // 列表选择 const { fetchData: selectFetch } = mpsaleOrderaddress() const handleSelect = async (item: any, index: number) => { - if (router.params.orderId) { + if (router.params.orderId && router.params.orderId != '-100') { + console.log(typeof (router.params.orderId) != 'undefined', 'router.params.orderId') Taro.showLoading({ title: '请稍等...', mask: true @@ -80,6 +82,15 @@ const AddressList = memo((props: Params) => { icon: 'error' }) } + } else { + let pages = Taro.getCurrentPages(); // 获取当前的页面栈 + let prevPage = pages[pages.length - 2]; + prevPage.setData({ //设置上一个页面的值 + addressObj: item + }); + Taro.navigateBack({ + delta: 1 + }) } @@ -117,7 +128,8 @@ const AddressList = memo((props: Params) => { } e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${Number(router.params.purchaser_id)}`} hoverClass="none" className="address-edit"> - + {/* */} + diff --git a/src/components/search/index.tsx b/src/components/search/index.tsx index 6c5c8a0..7831615 100644 --- a/src/components/search/index.tsx +++ b/src/components/search/index.tsx @@ -111,7 +111,7 @@ export default memo( handScan?.() }}> } diff --git a/src/pages/newCollection/index.tsx b/src/pages/newCollection/index.tsx index 368cb65..3e0812a 100644 --- a/src/pages/newCollection/index.tsx +++ b/src/pages/newCollection/index.tsx @@ -14,6 +14,7 @@ import { } from "@/api/newCollection" import TimePicker from "@/components/timePicker" import dayjs from 'dayjs' +import IconFont from '@/components/iconfont/iconfont' export default () => { let myDate = new Date(); @@ -231,7 +232,8 @@ export default () => { { setSelectPopup(true) }}> - + + {/* */} 筛选 @@ -275,9 +277,15 @@ export default () => { } { setShowTime(true) }}>{timeArea} - { + + { + timeArea == '自定义起始时间' && + + } + + {/* { timeArea == '自定义起始时间' && - } + } */} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 2e64946..92136de 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -22,6 +22,7 @@ import { } from '@/api/order' import PayPopup from './components/PayPopup' import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' +import IconFont from '@/components/iconfont/iconfont' interface filterObj { purchaser_id?: string | number, clientName?: string, @@ -597,7 +598,8 @@ export default () => { handScan()} showScan placeholder='搜索商品/名称/颜色/订单号' showBtn={false} changeOnSearch={getSearchData} debounceTime={300}> showSelctPopup()}> - + + {/* */} 筛选 diff --git a/src/pages/orderDetails/components/addressDetailBox/index.tsx b/src/pages/orderDetails/components/addressDetailBox/index.tsx index 08d7249..6901334 100644 --- a/src/pages/orderDetails/components/addressDetailBox/index.tsx +++ b/src/pages/orderDetails/components/addressDetailBox/index.tsx @@ -2,7 +2,7 @@ import { Image, Text, View } from "@tarojs/components"; import { memo, useEffect, useMemo, useRef, useState } from "react"; import classnames from "classnames"; import styles from './index.module.scss' - +import IconFont from '@/components/iconfont/iconfont' interface propsObj { receivingStatus: Number | null, onReceivingStatus?: (any, Number) => void, @@ -45,11 +45,14 @@ export default memo((props: propsObj) => { navSelect?.(obj)}> - + + {/* */} {addressInfo} { - receivingStatus !== 1 && + receivingStatus !== 1 && + + // } diff --git a/src/pages/orderDetails/index.tsx b/src/pages/orderDetails/index.tsx index f7c2b1a..ff881f7 100644 --- a/src/pages/orderDetails/index.tsx +++ b/src/pages/orderDetails/index.tsx @@ -23,12 +23,13 @@ import { mpsaleOrdercancel, GetPayCode, mpsaleOrderaddress, + mpsaleOrdershipmentMode, mpsaleOrderreceive } from '@/api/order' import { alert, goLink } from '@/common/common' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' import PayPopup from '../order/components/PayPopup' - +import IconFont from '@/components/iconfont/iconfont' export default () => { const router = useRouter() // useEffect(() => { @@ -46,7 +47,7 @@ export default () => { //收货方法,1:自提,2物流 const [receivingStatus, setReceivingStatus] = useState(null) //切换自提或者物流 - const { fetchData: selectFetch } = mpsaleOrderaddress() + const { fetchData: selectFetch } = mpsaleOrdershipmentMode() const onReceivingStatus = debounce(async (e, value) => { if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) { alert.error('不允许更改') @@ -69,10 +70,11 @@ export default () => { icon: 'success' }) setReceivingStatus(value) + getDetail() } else { Taro.hideLoading() Taro.showToast({ - title: res.msg, + title: '请先去新增地址', icon: 'error' }) } @@ -595,21 +597,22 @@ export default () => { 合计金额 - + {formatPriceDiv(infoObj.total_should_collect_money)} 实付金额 - + {formatPriceDiv(infoObj.actual_amount)} 待付金额 - + {/* */} + {formatPriceDiv(infoObj.wait_pay_amount)} diff --git a/src/pages/refundPage/index.tsx b/src/pages/refundPage/index.tsx index 04afb07..3c67025 100644 --- a/src/pages/refundPage/index.tsx +++ b/src/pages/refundPage/index.tsx @@ -17,9 +17,38 @@ import { import Tabs from "./components/tabs" import TimePicker from "@/components/timePicker" import dayjs from 'dayjs' +import IconFont from '@/components/iconfont/iconfont' export default () => { + //页码和页数 + const [searchField, setSearchField] = useState< + { + status: number | unknown; + page: number; + size: number; + name: string; + sale_mode: number | string; + stage: number | string; + return_type: number | string; + sale_start_time: number | string; + sale_end_time: number | string; + }>({ + status: 1, + page: 1, + size: 10, + name: '', + sale_mode: '不限', + stage: '不限', + return_type: '不限', + sale_start_time: '', + sale_end_time: '' + }) + const pageNum = useRef({ size: searchField.size, page: searchField.page }) + //监听筛选条件变化 + useEffect(() => { + getOrderList() + }, [searchField.size, searchField.name]) //获取订单列表 const { fetchData: listFetchData, state: orderState } = mpreturnApplyOrderlist() @@ -35,36 +64,9 @@ export default () => { setRefresherTriggeredStatus(() => false) } - //页码和页数 - const [searchField, setSearchField] = useState< - { - status: number | unknown; - page: number; - size: number; - name: string; - sale_mode: number | string; - stage: number | string; - return_type: number | string; - saleStartTime: number | string; - saleEndTime: number | string; - }>({ - status: 1, - page: 1, - size: 10, - name: '', - sale_mode: '不限', - stage: '不限', - return_type: '不限', - saleStartTime: '', - saleEndTime: '' - }) - const pageNum = useRef({ size: searchField.size, page: searchField.page }) - //监听筛选条件变化 - useEffect(() => { - getOrderList() - }, [searchField]) + //输入了搜索关键字 const getSearchData = useCallback((e) => { @@ -136,7 +138,7 @@ export default () => { return it }) setModeList([...modeList]) - setSearchField((e) => ({ ...e, sale_mode: item.id })) + setSearchField((e) => ({ ...e, sale_mode: item.id, })) } useEffect(() => { getStagelist() @@ -172,7 +174,7 @@ export default () => { return it }) setStageList([...stageList]) - setSearchField((val) => ({ ...val, size: 10, stage: item.id })) + setSearchField((val) => ({ ...val, stage: item.id })) } @@ -203,7 +205,7 @@ export default () => { return it }) setTypeList([...typeList]) - setSearchField((val) => ({ ...val, size: 10, return_type: item.id })) + setSearchField((val) => ({ ...val, return_type: item.id })) } //是否不允许确认筛选 @@ -211,8 +213,8 @@ export default () => { if (searchField.stage !== '不限' || searchField.sale_mode !== '不限' || searchField.return_type !== '不限' || - searchField.saleStartTime !== '' || - searchField.saleEndTime !== '' + searchField.sale_start_time !== '' || + searchField.sale_end_time !== '' ) { return false } else { @@ -234,10 +236,11 @@ export default () => { sale_mode: '不限', stage: '不限', return_type: '不限', - saleStartTime: '', - saleEndTime: '', + sale_start_time: '', + sale_end_time: '', })) setStart(myDate.toLocaleDateString()) + getOrderList() setEnd('') } @@ -267,11 +270,11 @@ export default () => { start: '', end: '' } - obj.start = myDate?.toLocaleDateString() + ' ' + '00:00:00' - obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00` + obj.start = `${dayjs(new Date(myDate?.toLocaleDateString() + ' ' + '00:00:00',)).format('YYYY-MM-DD')} 00:00:00`, + obj.end = `${dayjs(new Date(obj?.start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00` eq.value = obj } - setSearchField((val) => ({ ...val, saleStartTime: eq?.value?.start, saleEndTime: eq?.value?.end })) + setSearchField((val) => ({ ...val, sale_start_time: eq?.value?.start, sale_end_time: eq?.value?.end, size: 10 })) setStart(eq?.value?.start) setEnd(eq?.value?.end) setShowTime(false) @@ -285,17 +288,26 @@ export default () => { } }, [end]) + const handSure = () => { + pageNum.current.page = 1 + setSearchField((val) => ({ ...val, size: 10 })) + setshowPopup?.(false) + getOrderList() + } + useEffect(() => { setSearchField(searchField) - console.log(searchField, 9999) }, [searchField]) + + return ( <> showSelctPopup()}> - + + {/* */} 筛选 @@ -362,9 +374,12 @@ export default () => { 售后时间 { setShowTime(true) }}>{timeArea} - { - timeArea == '自定义起始时间' && - } + + { + timeArea == '自定义起始时间' && + + } + @@ -372,7 +387,7 @@ export default () => { - + {/* */} diff --git a/src/pages/shopping/index.tsx b/src/pages/shopping/index.tsx index ba4f4c6..780e741 100644 --- a/src/pages/shopping/index.tsx +++ b/src/pages/shopping/index.tsx @@ -45,7 +45,7 @@ export const Shopping: FC = memo(() => { ) }) -interface InternalContainer {} +interface InternalContainer { } const ShoppingCartContainer: FC = () => { const { isManageStatus, setManageStatus, selectedAmount, currentCheckedPurchaserId, currentCheckedSaleMode, colorStore, setColorStore } = useShoppingContext() @@ -75,7 +75,7 @@ const ShoppingCartContainer: FC = () => { }, [shoppingCartData, state]) useDidShow(() => { - ;(async () => { + ; (async () => { await fetchData() let query = Taro.createSelectorQuery() console.log('query', query) @@ -104,11 +104,11 @@ const ShoppingCartContainer: FC = () => { goLink('/pages/submitOrder/index', { purchaser_id: currentCheckedPurchaserId, sale_mode: currentCheckedSaleMode, - shopping_cart_product_color_list: Object.values(targetGoodsKind).map((item: Goods) => { + shopping_cart_product_color_list: JSON.stringify(Object.values(targetGoodsKind).map((item: Goods) => { if (item.checked) { return item.id } - }), + })) }) } @@ -139,7 +139,7 @@ const ShoppingCartContainer: FC = () => { const handleSelectAllCheckbox = (isSelectAll: boolean) => { console.log('handleSelectAllCheckbox', isSelectAll) const tempObject = colorStore - Object.entries(colorStore).forEach(([key,value])=>{ + Object.entries(colorStore).forEach(([key, value]) => { tempObject[key] = { ...value, checked: isSelectAll, diff --git a/src/pages/submitOrder/index.tsx b/src/pages/submitOrder/index.tsx index 168e48f..53016b8 100644 --- a/src/pages/submitOrder/index.tsx +++ b/src/pages/submitOrder/index.tsx @@ -9,35 +9,45 @@ import Popup from '@/components/popup' import { debounce } from '@/common/util' import { mpsaleOrderpreView, - mpsaleOrderput, - mpsaleOrderaddress + mpsaleOrderpost, } from '@/api/order' import { alert } from '@/common/common' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' - +import IconFont from '@/components/iconfont/iconfont' export default () => { const router: any = useRouter() - + const [infoObj, setInfoObj] = useState({}) useDidShow(() => { - getDetail() - }) - //页面下拉刷新 - usePullDownRefresh(() => { - getDetail() - }) + //获取选择的客户 + let pages = Taro.getCurrentPages(); + let currPage = pages[pages.length - 1]; // 获取当前页面 + + setInfoObj({ + ...infoObj, + province_name: currPage.data.addressObj.province_name, + address_id: currPage.data.addressObj.id, + city_name: currPage.data.addressObj.city_name, + district_name: currPage.data.addressObj.district_name, + target_user_name: currPage.data.addressObj.name, + purchaser_phone: currPage.data.addressObj.phone, + }) + }) + useEffect(() => { + getDetail() + }, []) + + useEffect(() => { + setInfoObj(infoObj) + console.log(infoObj, 66666) + }, [infoObj]) //收货方法,1:自提,2物流 - const [receivingStatus, setReceivingStatus] = useState(null) + const [receivingStatus, setReceivingStatus] = useState(null) //切换自提或者物流 - const { fetchData: selectFetch } = mpsaleOrderaddress() const onReceivingStatus = debounce(async (e, value) => { - if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) { - alert.error('不允许更改') - return false - } e.stopPropagation() - if (receivingStatus === value) { + if (receivingStatus == value) { alert.error('不能选择相同的方式') return false } @@ -45,57 +55,37 @@ export default () => { title: '请稍等...', mask: true }) - const res = await selectFetch({ id: Number(infoObj.id), shipment_mode: value }) - if (res.msg === 'success') { - Taro.hideLoading() - Taro.showToast({ - title: '成功', - icon: 'success' - }) - setReceivingStatus(value) - } else { - Taro.hideLoading() - Taro.showToast({ - title: res.msg, - icon: 'error' - }) - } + setReceivingStatus(value) + Taro.hideLoading() }, 300) const { fetchData: infoFetch } = mpsaleOrderpreView() - const [infoObj, setInfoObj] = useState({}) //获取订单详情 const getDetail = async () => { + let arr: any[] = [] + arr = JSON.parse(decodeURIComponent(router.params.shopping_cart_product_color_list)) let list: any[] = [] - router.params?.shopping_cart_product_color_list?.forEach(item => { + arr?.forEach(item => { list.push({ - shopping_cart_product_color_id: item.shopping_cart_product_color_id, + shopping_cart_product_color_id: item, sale_price: 0 }) }) const query = { - purchaser_id: router.params.purchaser_id, - sale_mode: router.params.sale_mode, + purchaser_id: Number(router.params.purchaser_id), + sale_mode: Number(router.params.sale_mode), shopping_cart_product_color_list: list } const res = await infoFetch(query) setInfoObj(res.data) - setReceivingStatus(res.data.shipment_mode) + setReceivingStatus(1) } //备注操作 const [showDesc, setShowDesc] = useState(false) - const { fetchData: remarkFetch } = mpsaleOrderput() const getRemark = useCallback(async (e) => { - const res = await remarkFetch({ remark: e, id: Number(router.params.id) }) - if (res.msg === 'success') { - Taro.showToast({ - title: '成功', - icon: 'success' - }) - setShowDesc(false) - getDetail() - } + setShowDesc(false) + setInfoObj((val) => ({ ...val, remark: e })) }, []) @@ -103,10 +93,65 @@ export default () => { const handSelect = (obj) => { Taro.navigateTo({ - url: '/pages/addressManager/index?orderId=' + obj.id + '&purchaser_id=' + obj.purchaser_id + url: '/pages/addressManager/index?orderId=' + '-100' + '&purchaser_id=' + router.params.purchaser_id }) } + //提交订单 + const { fetchData: postFetch } = mpsaleOrderpost() + const handSure = () => { + if (receivingStatus == 2 && !infoObj.address_id) { + return alert.error('请选择地址') + } + let list: any[] = [] + infoObj.product_list.forEach(item => { + item.product_colors.forEach(it => { + list.push({ + sale_price: it.sale_price, + shopping_cart_product_color_id: Number(it.id) + }) + }) + }) + let query = { + address_id: Number(infoObj.address_id) ? Number(infoObj.address_id) : 0, + list: list, + physical_warehouse: infoObj.physical_warehouse, + purchaser_id: Number(router.params.purchaser_id), + remark: infoObj.remark, + sale_mode: infoObj.sale_mode, + shipment_mode: receivingStatus + } + Taro.showModal({ + content: "确认提交吗?", + confirmText: "确认", + cancelText: "取消", + success: async function (res) { + if (res.confirm) { + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + const res = await postFetch(query) + if (res?.msg === 'success') { + Taro.showToast({ + title: '成功' + }) + Taro.hideLoading() + Taro.redirectTo({ + url: '/pages/orderDetails/index?id=' + res.data.id + }) + } else { + Taro.hideLoading() + Taro.showToast({ + title: res?.msg, + icon: 'error' + }) + } + } + + } + }) + } return ( { modeName={infoObj.sale_mode_name} > - {infoObj.purchaser_name} - {infoObj.purchaser_phone} + {router.params.purchaser_name} + {/* {infoObj.purchaser_phone} */} - {infoObj.total_fabrics} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'} + {/* {infoObj.product_list?.length} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'} */} 合计金额 - + + {/* */} - {formatPriceDiv(infoObj.total_should_collect_money)} + {formatPriceDiv(infoObj.estimate_amount)} `} clickNode={() => setShowDesc(true)}> @@ -147,11 +193,11 @@ export default () => { 预估金额: - ¥3564.00 + ¥{formatPriceDiv(infoObj.estimate_amount)} - 3 种面料,3 种颜色,共 3 M + {infoObj.product_list?.length} 种面料,{infoObj.total_colors} 种颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'} - 提交订单 + handSure()}>提交订单 ) @@ -219,12 +265,12 @@ const GoodsItem = memo((porps: PropGoods) => { - {it.code}# {it.name} + {it.code} {it.name} x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'} ¥{it.sale_price / 100}/{obj?.sale_mode === 0 ? '条' : 'm'} - ¥{formatPriceDiv(it.total_sale_price)} + ¥{formatPriceDiv(it.estimate_amount)}