diff --git a/src/api/codeManage.ts b/src/api/codeManage.ts index 5726cb9..1d99fee 100644 --- a/src/api/codeManage.ts +++ b/src/api/codeManage.ts @@ -65,3 +65,14 @@ export const CustomPrintCalculationApi = () => { method: 'post', }) } + +/** + * 删除自定义码单 + * @returns + */ +export const DeleteCustomCodeApi = () => { + return useRequest({ + url: '/v1/mall/customPrint', + method: 'delete', + }) +} diff --git a/src/pages/codeSetting/components/bottomBtn/index.module.scss b/src/pages/codeSetting/components/bottomBtn/index.module.scss index 5b64847..13d43f0 100644 --- a/src/pages/codeSetting/components/bottomBtn/index.module.scss +++ b/src/pages/codeSetting/components/bottomBtn/index.module.scss @@ -21,4 +21,8 @@ margin-right: 24px; } } + .del_btn { + color: #e9546aff; + border: 1px solid #e9546aff; + } } diff --git a/src/pages/codeSetting/components/bottomBtn/index.tsx b/src/pages/codeSetting/components/bottomBtn/index.tsx index fc9c354..6c14981 100644 --- a/src/pages/codeSetting/components/bottomBtn/index.tsx +++ b/src/pages/codeSetting/components/bottomBtn/index.tsx @@ -1,15 +1,17 @@ import { View } from '@tarojs/components' +import classNames from 'classnames' import styles from './index.module.scss' export type BottomItem = 'del'|'preview'|'save' interface Param { onClick?: (val: BottomItem) => void + delStatus: boolean } export default (props: Param) => { - const { onClick } = props + const { onClick, delStatus } = props return - onClick?.('del')}>删除码单 + {delStatus && onClick?.('del')}>删除码单} onClick?.('preview')}>预览码单 onClick?.('save')}>保存码单 diff --git a/src/pages/codeSetting/components/colorItemSetting/colorBlock/index.tsx b/src/pages/codeSetting/components/colorItemSetting/colorBlock/index.tsx index 56fedd6..28509a4 100644 --- a/src/pages/codeSetting/components/colorItemSetting/colorBlock/index.tsx +++ b/src/pages/codeSetting/components/colorItemSetting/colorBlock/index.tsx @@ -73,7 +73,7 @@ const Index = memo((props: IndexParam) => { } }, [colorInfo]) return - + }) diff --git a/src/pages/codeSetting/components/colorItemSetting/index.module.scss b/src/pages/codeSetting/components/colorItemSetting/index.module.scss index 9d8cd24..5e0e10e 100644 --- a/src/pages/codeSetting/components/colorItemSetting/index.module.scss +++ b/src/pages/codeSetting/components/colorItemSetting/index.module.scss @@ -18,7 +18,7 @@ .product_title { margin-right: 8px; @include common_ellipsis(); - width: 380px; + max-width: 380px; } .mode_status { width: 60px; diff --git a/src/pages/codeSetting/components/main/index.tsx b/src/pages/codeSetting/components/main/index.tsx index 729efbd..b7e69e4 100644 --- a/src/pages/codeSetting/components/main/index.tsx +++ b/src/pages/codeSetting/components/main/index.tsx @@ -1,5 +1,5 @@ import { Text, View } from '@tarojs/components' -import { useDidShow, useRouter } from '@tarojs/taro' +import Taro, { useDidShow, useRouter } from '@tarojs/taro' import { useCallback, useEffect, useMemo, useRef, useState, useTransition } from 'react' import PayeeHead from '../payeeHead' import type { CompanyItem } from '../payeeHead' @@ -10,7 +10,7 @@ import ProductSetting from '../productSetting' import ColorSetting from '../colorSetting' import styles from './index.module.scss' import SelectList from '@/components/selectList' -import { CreateCustomCodeApi, CustomPrintCalculationApi, GetCustomCodeDetailApi, GetCustomCodeInitApi, UpdateCustomCodeApi } from '@/api/codeManage' +import { CreateCustomCodeApi, CustomPrintCalculationApi, DeleteCustomCodeApi, GetCustomCodeDetailApi, GetCustomCodeInitApi, UpdateCustomCodeApi } from '@/api/codeManage' import { formatPriceDiv, formatWeightDiv } from '@/common/fotmat' import { useCurrenCode } from '@/context/ContextCodeSetting' import { alert } from '@/common/common' @@ -125,6 +125,9 @@ export default () => { alert.success('保存成功!') } } + else if (type === 'del') { + deleteCode() + } })() } @@ -155,6 +158,26 @@ export default () => { } } + // 删除码单 + const { fetchData: delFetchData } = DeleteCustomCodeApi() + const deleteCode = async() => { + Taro.showModal({ + title: '确定删除该码单?', + async success(res) { + if (res.confirm) { + const res = await delFetchData({ id: submit_ids.current.custom_print_id }) + if (res.success) { + alert.success('删除成功') + Taro.navigateBack() + } + } + else if (res.cancel) { + console.log('用户点击取消') + } + }, + }) + } + return @@ -203,7 +226,7 @@ export default () => { } - + } diff --git a/src/pages/codeSetting/components/productItem/index.tsx b/src/pages/codeSetting/components/productItem/index.tsx index d5a603c..89799ca 100644 --- a/src/pages/codeSetting/components/productItem/index.tsx +++ b/src/pages/codeSetting/components/productItem/index.tsx @@ -11,6 +11,7 @@ import type { adjustType } from '@/common/enum' interface Param { codeItem: any + settingColorStatus?: boolean } type IndexParam = { @@ -20,7 +21,7 @@ type IndexParam = { } & Param export default (props: Param) => { - const { codeItem } = props + const { codeItem, settingColorStatus = false } = props const { dispatch, productData } = useCurrenCode() const index = codeItem.index_str.split('_') const getNewName = useCallback((name) => { @@ -36,9 +37,7 @@ export default (props: Param) => { dispatch({ type: 'updateColorData', data: { ...productData.color_item_data } }) } }, [codeItem]) - const settingColorStatus = useMemo(() => { - return !!productData.color_item_data - }, [productData.color_item_data]) + return <> diff --git a/src/pages/salesAfter/salesAfterList/components/order/index.module.scss b/src/pages/salesAfter/salesAfterList/components/order/index.module.scss index be8d9a6..1978622 100644 --- a/src/pages/salesAfter/salesAfterList/components/order/index.module.scss +++ b/src/pages/salesAfter/salesAfterList/components/order/index.module.scss @@ -1,184 +1,182 @@ -.order_item{ - background-color: #fff; - border-radius: 20px; - padding: 20px; - box-sizing: border-box; - .header{ +.order_item { + background-color: #fff; + border-radius: 20px; + padding: 20px; + box-sizing: border-box; + .header { + display: flex; + align-items: center; + .user { + display: flex; + align-items: center; + .name { + color: #000; + font-weight: 700; + margin-left: 15px; + font-size: $font_size; + width: 100px; + @include common_ellipsis(); + } + image { + width: 70px; + height: 70px; + border-radius: 50%; + } + } + .order_con { + padding-left: 15px; + width: 100%; + .name { + color: #000; + font-weight: 700; + font-size: $font_size; + } + .order_num { + flex: 1; + font-size: $font_size_medium; + color: $color_font_one; + padding-right: 10px; display: flex; + justify-content: flex-start; align-items: center; - .user{ - display: flex; - align-items: center; - .name { - color: #000; - font-weight: 700; - margin-left: 15px; - font-size: $font_size; - width: 100px; - @include common_ellipsis(); - } - image{ - width: 70px; - height: 70px; - border-radius: 50%; - } + .order_num_con { + flex: 1; } - .order_con { - padding-left: 15px; - width: 100%; - .name { - color: #000; - font-weight: 700; - font-size: $font_size; - } - .order_num { - flex: 1; - font-size: $font_size_medium; - color: $color_font_one; - padding-right: 10px; - display: flex; - justify-content: flex-start; - align-items: center; - .order_num_con{ - flex:1; - } - .miconfont { - font-size: 20px; - } - } - } - .tag{ - font-size: $font_size_min; - padding: 5px 15px; - background-color: $color_main; - color: #fff; - border-radius: 0px 20px 0px 20px; + .miconfont { + font-size: 20px; } + } } - .product_title{ - display: flex; - align-items: center; - padding: 35px 0; - .product_tag{ - background-color: #CDE5FF; - font-size: $font_size_min; - padding: 5px 10px; - color: $color_main; - border-radius: 6px; - } - .product_name{ - flex:1; - font-size: $font_size; - font-weight: 700; - padding: 0 20px; - @include common_ellipsis() - } - .product_status{ - font-size: $font_size; - color: $color_main; - } + .tag { + font-size: $font_size_min; + padding: 5px 15px; + background-color: $color_main; + color: #fff; + border-radius: 0px 20px 0px 20px; } - .product_list{ - display: flex; - .image{ - width: 126px; - height: 126px; - border-radius: 20px ; - position: relative; - image{ - width: 100%; - height: 100%; - border-radius: 20px ; - } - .color_num { - background: rgba(0,0,0, 0.5); - border-radius: 36px 0px 20px 0px; - font-size: $font_size_min; - color: #fff; - position: absolute; - right:0; - bottom:0; - padding: 5px 10px 5px 15px; - box-sizing: border-box; - } - } - .color_list{ - flex:1; - padding-left: 30px; - .color_item{ - display: flex; - justify-content: space-between; - font-size: $font_size_min; - color: $color_font_three; - align-items: center; - margin-bottom: 20px; - .color_title{ - font-weight: 700; - font-size: $font_size; - color: #000; - } - .color_more{ - color: $color_font_three; - } - } - } - + } + .product_title { + display: flex; + align-items: center; + padding: 35px 0; + .product_tag { + background-color: #cde5ff; + font-size: $font_size_min; + padding: 5px 10px; + color: $color_main; + border-radius: 6px; } - .color_count_num{ + .product_name { + flex: 1; + font-size: $font_size; + font-weight: 700; + padding: 0 20px; + @include common_ellipsis(); + } + .product_status { + font-size: $font_size; + color: $color_main; + } + } + .product_list { + display: flex; + .image { + width: 126px; + height: 126px; + border-radius: 20px; + position: relative; + image { + width: 100%; + height: 100%; + border-radius: 20px; + } + .color_num { + background: rgba(0, 0, 0, 0.5); + border-radius: 36px 0px 20px 0px; font-size: $font_size_min; - color: $color_font_two; - background-color: #F6F6F6; - border-radius: 10px; - padding: 10px 22px; - margin-top: 20px; + color: #fff; + position: absolute; + right: 0; + bottom: 0; + padding: 5px 10px 5px 15px; + box-sizing: border-box; + } + } + .color_list { + flex: 1; + padding-left: 30px; + .color_item { display: flex; justify-content: space-between; - .refund_amount{ - font-size: 30rpx; - color: #007AFF; - text{ - &:nth-child(1) { - font-size: 23px; - } - } - } - } - .order_number{ - display: flex; - background-color: #F6F6F6; - padding: 20px; - margin: 20px 0; + font-size: $font_size_min; + color: $color_font_three; align-items: center; - font-size: $font_size_medium; - border-radius: 10px; - text{ - &:nth-child(1) { - - font-weight: 700; - color: $color_font_three; - border-right: 2px solid #CCCCCC; - padding-right: 20px; - } - &:nth-child(2) { - padding-left: 20px; - color: $color_font_one; - } + margin-bottom: 20px; + .color_title { + font-weight: 700; + font-size: $font_size; + color: #000; } - } - .inspection{ - height: 82px; - background-color: #F6F6F6; - border-radius: 10px; - padding: 0 20px; - box-sizing: border-box; - color: #007AFF; - display: flex; - align-items: center; - margin: 20px 0; - font-size: 28px; - .miconfont{ - font-size: 50px; - margin-right: 20px; + .color_more { + color: $color_font_three; } + } } -} \ No newline at end of file + } + .color_count_num { + font-size: $font_size_min; + color: $color_font_two; + background-color: #f6f6f6; + border-radius: 10px; + padding: 10px 22px; + margin-top: 20px; + display: flex; + justify-content: space-between; + .refund_amount { + font-size: 30rpx; + color: #007aff; + text { + &:nth-child(1) { + font-size: 23px; + } + } + } + } + .order_number { + display: flex; + background-color: #f6f6f6; + padding: 20px; + margin: 20px 0; + align-items: center; + font-size: $font_size_medium; + border-radius: 10px; + text { + &:nth-child(1) { + font-weight: 700; + color: $color_font_three; + border-right: 2px solid #cccccc; + padding-right: 20px; + } + &:nth-child(2) { + padding-left: 20px; + color: $color_font_one; + } + } + } + .inspection { + height: 82px; + background-color: #f6f6f6; + border-radius: 10px; + padding: 0 20px; + box-sizing: border-box; + color: #007aff; + display: flex; + align-items: center; + margin: 20px 0; + font-size: 28px; + .miconfont { + font-size: 50px; + margin-right: 20px; + } + } +} diff --git a/src/reducers/codeData.ts b/src/reducers/codeData.ts index d71a31b..9b929e2 100644 --- a/src/reducers/codeData.ts +++ b/src/reducers/codeData.ts @@ -72,7 +72,7 @@ export default function counter(state = INIT_USER, action: Action) { case 'setColorData': return { ...state, color_item_data: JSON.parse(JSON.stringify(data)) } case 'updateColorData': - return { ...state, color_item_data: data } + return onUpdateColorData(state, action) case 'setPurchaserFormTitle': return onUpdatePurchaserFormTitle(state, action) default: @@ -203,3 +203,9 @@ const onUpdatePurchaserFormTitle = (state, action) => { state.admin_data.purchaser_form_title_id = data.id return { ...state, purchaser_form_title: data } } + +// 修改颜色数据 +const onUpdateColorData = (state, action: Action) => { + const { data, update_status } = action + return { ...state, color_item_data: data, update_status } +}