diff --git a/config/index.js b/config/index.js index eeaacd9..d68f13d 100644 --- a/config/index.js +++ b/config/index.js @@ -11,6 +11,7 @@ const config = { outputRoot: 'dist', plugins: [], defineConstants: { + CURRENT_ENV: JSON.stringify(process.env.NODE_ENV) }, copy: { patterns: [ diff --git a/src/api/material.ts b/src/api/material.ts index 1b47f30..a777a95 100644 --- a/src/api/material.ts +++ b/src/api/material.ts @@ -45,3 +45,13 @@ export const GetProductDetailApi = () => { }) } +/** + * 根据LAB匹配色卡基础资料 + * @returns +*/ +export const GetLabProductApi = () => { + return useRequest({ + url: `/v1/mall/product/color/absorb/match`, + method: "get", + }) +} diff --git a/src/api/order.ts b/src/api/order.ts index 2fd72f8..10318d3 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -3,7 +3,7 @@ import { useRequest } from "@/use/useHttp" /** * 下单现货销售单 */ - export const SaleOrderApi = () => { +export const SaleOrderApi = () => { return useRequest({ url: `/v1/mall/saleOrder`, method: "post", @@ -18,4 +18,45 @@ import { useRequest } from "@/use/useHttp" url: `/v1/mall/saleOrder/preView`, method: "put", }) +} + +/** + * 获取销售单详情 + */ + export const GetSaleOrderDetailApi = () => { + return useRequest({ + url: `/v1/mall/saleOrder`, + method: "get", + }) +} + + +/** + * 修改销售单备注 + */ + export const EditSaleOrderRemarkApi = () => { + return useRequest({ + url: `/v1/mall/saleOrder/remark`, + method: "put", + }) +} + +/** + * 修改销售单地址 + */ + export const EditSaleOrderAddressApi = () => { + return useRequest({ + url: `/v1/mall/saleOrder/address`, + method: "put", + }) +} + +/** + * 修改销售单收货方法 + */ + export const EditSaleOrderShipmentModeApi = () => { + return useRequest({ + url: `/v1/mall/saleOrder/shipmentMode`, + method: "put", + }) } \ No newline at end of file diff --git a/src/api/search.ts b/src/api/search.ts index 9f91366..5b0f296 100644 --- a/src/api/search.ts +++ b/src/api/search.ts @@ -3,9 +3,31 @@ import { useRequest } from "@/use/useHttp" /** * 获取热门搜索 */ - export const getHotSearchApi = () => { + export const GetHotSearchApi = () => { return useRequest({ - url: `/v1/mall/hotSearch`, + url: `/v1/mall/hotSearch/list`, method: "get", }) +} + + +/** + * 获取历史搜索 + */ + export const GetSearchHistoryApi = () => { + return useRequest({ + url: `/v1/mall/searchHistory/list`, + method: "get", + }) +} + + +/** + * 添加搜索关键字 + */ + export const AddSearchHistoryApi = () => { + return useRequest({ + url: `/v1/mall/searchHistory`, + method: "post", + }) } \ No newline at end of file diff --git a/src/api/subjectMaterial.ts b/src/api/subjectMaterial.ts new file mode 100644 index 0000000..78a9cd1 --- /dev/null +++ b/src/api/subjectMaterial.ts @@ -0,0 +1,13 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 获取专题列表 + * @returns +*/ +export const GetSubjectList = () => { + return useRequest({ + url: `/v1/mall/subject/list`, + method: "get", + }) +} + diff --git a/src/app.config.ts b/src/app.config.ts index c9abe95..9c67410 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -45,7 +45,7 @@ export default { { root: "pages/details", pages: [ - "index" + "index", ] }, { @@ -95,7 +95,26 @@ export default { { root: "pages/order", pages: [ - "index" + "index", + "comfirm" + ] + }, + { + root: "pages/editOrder", + pages: [ + "index", + ] + }, + { + root: "pages/orderList", + pages: [ + "index", + ] + }, + { + root: "pages/subjectList", + pages: [ + "index", ] } ] diff --git a/src/common/client.js b/src/common/client.js index 0aefa83..e69de29 100644 --- a/src/common/client.js +++ b/src/common/client.js @@ -1,17 +0,0 @@ -import Taro from "@tarojs/taro"; - - -/** - * 设置 客户 本地存储 - * @param {Object} clientInfo - */ -export const setClient = (clientInfo) => { - Taro.setStorageSync('client', clientInfo) -} - -/** - * 返回 客户 本地存储 - */ -export const getClient = () => { - Taro.getStorageSync('client') || null -} diff --git a/src/common/constant.js b/src/common/constant.js index b856a54..734263a 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,10 +5,10 @@ // 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 = `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.4:40001/lymarket` // 王霞 // export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 // CDN @@ -16,12 +16,17 @@ export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 export const GET_UPLOAD_SIGN = `/upyun/getsign` // 请求签名 url export const UPLOAD_CDN_URL = `https://v0.api.upyun.com/` -// 前缀 -export const IMG_CND_Prefix = "http://test.cdn.zzfzyc.com" +// cdn +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 || ''}`; //appid -export const WX_APPID = 'wx68d92d7cbf0b6963' \ No newline at end of file +export const WX_APPID = 'wx68d92d7cbf0b6963' + +//场景值 +export const SCENE = { + SearchScene : 0 //商城面料搜索 +} \ No newline at end of file diff --git a/src/common/enum.ts b/src/common/enum.ts new file mode 100644 index 0000000..df57d45 --- /dev/null +++ b/src/common/enum.ts @@ -0,0 +1,7 @@ +export const ORDER_STATUS = { + 0:{value:0, label:'申请中'}, + 1:{value:1, label:'配布中'}, + 2:{value:2, label:'待发货'}, + 3:{value:3, label:'已发货'}, + 4:{value:4, label:'已完成'} +} \ No newline at end of file diff --git a/src/common/fotmat.js b/src/common/fotmat.js index 3cff723..2176a51 100644 --- a/src/common/fotmat.js +++ b/src/common/fotmat.js @@ -141,6 +141,6 @@ export const toDecimal2 = (x) => { * @param {*} url * @returns */ -export const formatImgUrl = (url) => { - return IMG_CND_Prefix + url +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 diff --git a/src/common/system.js b/src/common/system.ts similarity index 66% rename from src/common/system.js rename to src/common/system.ts index 12e2036..1d99ae5 100644 --- a/src/common/system.js +++ b/src/common/system.ts @@ -32,3 +32,19 @@ export const getAccountInfo = () => { const result = Taro.getStorageSync('accountInfo') return result ? JSON.parse(result) : null } + +/** + * 设置 参数本地存储 + * @param {Object} info + */ +export const setParam = (info:Object) => { + Taro.setStorageSync('params', JSON.stringify(info)) +} + +/** + * 返回 参数本地存储 + */ +export const getParam = () => { + const res = Taro.getStorageSync('params') || null + return res?JSON.parse(res):null +} diff --git a/src/common/util.js b/src/common/util.ts similarity index 74% rename from src/common/util.js rename to src/common/util.ts index 6c131c9..15f5d6b 100644 --- a/src/common/util.js +++ b/src/common/util.ts @@ -5,7 +5,7 @@ * @returns */ export const debounce = (fn, delay) => { - let timer = null; + let timer:any = null; return (...param) => { if (timer) clearTimeout(timer); timer = setTimeout(() => { @@ -90,4 +90,17 @@ export const throttle = (fn, delay) => { */ export const screenshot = (url, suffix="!w200")=>{ return url+suffix; + } + + //获取数据加载状态 //0:数据从无到有加载数据,1,没有任何数据, 2:下拉加载,3:下拉没有数据 + export const dataLoadingStatus = ({list = [], total = 0, status = false}:{list:any[], total:number, status:true|false}) => { + if(list.length == 0 && status) { + return 0 + } else if (list.length == 0 && !status) { + return 1 + } else if (list.length < total) { + return 2 + } else { + return 3 + } } \ No newline at end of file diff --git a/src/components/filter/index.module.scss b/src/components/filter/index.module.scss index 599cdd0..48538c0 100644 --- a/src/components/filter/index.module.scss +++ b/src/components/filter/index.module.scss @@ -31,7 +31,7 @@ grid-template-columns: repeat(3, 165.75px); justify-content: space-between; .btn_item{ - width: 165.75px; + // width: 165.75px; height: 69.2px; background: #f0f0f0; border-radius: 34px; @@ -54,7 +54,7 @@ // justify-content: space-between; align-items: center; .btn_width { - width: 220px; + flex:1; height: 70px; background: #f0f0f0; border-radius: 50px; diff --git a/src/components/filter/index.tsx b/src/components/filter/index.tsx index d64ab87..b05ae35 100644 --- a/src/components/filter/index.tsx +++ b/src/components/filter/index.tsx @@ -1,101 +1,105 @@ +import { GetProductKindListApi } from "@/api/material"; import Popup, {Params as PopuParams} from "@/components/popup" import { Input, ScrollView, Text, Textarea, View } from "@tarojs/components" +import { useDidShow } from "@tarojs/taro"; import classnames from "classnames"; -import { useEffect, useState } from "react"; +import { memo, useEffect, useRef, useState } from "react"; import styles from './index.module.scss' type params = { - onFiltr?: (val:object) => void + onFiltr?: (val:object) => void //确定搜索 + onRest?: (val:Object) => void //重置 } & PopuParams -export default ({onClose, onFiltr, show = false}:params) => { - const [filterObj, setFilterObj] = useState({ - series: '', - minWidth: '', - maxWidth: '', - minWeight: '', - maxWeight: '', - element: '' +export default memo(({onClose, onFiltr, show = false, onRest}:params) => { + //搜索条件 + const [filterObj, setFilterObj] = useState({ + seriesName: '', + seriesId: '', + width: '', + weight: '', + element: '', }) + + const selectFieldValue = useRef({width:'幅宽', weight:'克重', element:'成分', seriesName:'系列'}) + + //获取系列 + const {fetchData: kindFetchData} = GetProductKindListApi() + const [kindList, setKindList] = useState([]) + const getCategoryList = async () => { + let {data} = await kindFetchData() + setKindList(data.list) + } + + useEffect(() => { + show&&getCategoryList() + }, [show]) + + //切换系列 + const changeKind = (e) => { + setFilterObj({...filterObj, seriesId:e.id, seriesName: e.name}) + } + const onCloseEven = () => { onClose?.() } - const onRest = () => { - console.log('12123') - setFilterObj({ - series: '', - minWidth: '', - maxWidth: '', - minWeight: '', - maxWeight: '', - element: '' - }) - } - useEffect(() => { - console.log(filterObj) - }, [filterObj]) - const onVerify = () => { - console.log(filterObj) - onFiltr?.(filterObj) - } - - const setNumber = (e, field) => { - console.log(e) - let num = parseFloat(e.detail.value) - if(isNaN(num)) { - filterObj[field] = null - } else { - filterObj[field] = parseFloat(num.toFixed(2)) + //重置数据 + const onRestEven = () => { + let res = { + seriesName: '', + seriesId: '', + width: '', + weight: '', + element: '', } + setFilterObj(res) + onFiltr?.(filterObj) + onClose?.() + } + + //提交搜索 + const onVerify = () => { + onFiltr?.({data:filterObj, field: selectFieldValue.current}) + onClose?.() + } + + //获取幅宽或克重输入值或成分 + const setFieldData = (e, field) => { + filterObj[field] = e.detail.value setFilterObj({...filterObj}) } - const setElement = (e) => { - let res = e.detail.value - setFilterObj({...filterObj, element:res}) - } return ( - onCloseEven()} showIconButton={true}> 全部筛选 - 系列 - 不限 - 不限 - 不限 - 不限 - 不限 - 不限 + {kindList.map(item => changeKind(item)} className={classnames(styles.btn_item, (filterObj.seriesId == item.id)&&styles.select_btn_item)}>{item.name})} 幅宽 - setNumber(e,'minWidth')} placeholder="自定义最低值" placeholderStyle="font-size: 26rpx"/> - - setNumber(e,'maxWidth')} placeholder="自定义最高值" placeholderStyle="font-size: 26rpx"/> + setFieldData(e,'width')} placeholder="请输入幅宽" placeholderStyle="font-size: 26rpx"/> cm 克重 - setNumber(e,'minWeight')} placeholder="自定义最低值" placeholderStyle="font-size: 26rpx"/> - - setNumber(e,'maxWeight')} placeholder="自定义最高值" placeholderStyle="font-size: 26rpx"/> - g + setFieldData(e,'weight')} placeholder="请输入克重" placeholderStyle="font-size: 26rpx"/> + kg 成分 -