feat: 收银台

pull/12/head
xingyu 2023-05-11 14:42:59 +08:00
parent aede08cbba
commit 5ecc18901a
5 changed files with 193 additions and 208 deletions

View File

@ -20,44 +20,34 @@
</a> </a>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts" setup name="RuleProps">
import { ref, defineComponent } from 'vue' import { ref } from 'vue'
import { remove } from '../../../utils' import { remove } from '../../../utils'
import { useFormDesignState } from '../../../hooks/useFormDesignState' import { useFormDesignState } from '../../../hooks/useFormDesignState'
import { isArray } from 'lodash-es' import { isArray } from 'lodash-es'
import { Form, FormItem, AutoComplete, Input } from 'ant-design-vue' import { Form, FormItem, AutoComplete, Input } from 'ant-design-vue'
import Icon from '@/components/Icon' import { Icon } from '@/components/Icon'
export default defineComponent({ //
name: 'RuleProps', const { formConfig } = useFormDesignState()
components: { // currentItem
Form, /**
FormItem,
AutoComplete,
Input,
Icon
},
setup() {
//
const { formConfig } = useFormDesignState()
// currentItem
/**
* 添加正则校验判断当前组件的rules是不是数组如果不是数组使用set方法重置成数组然后添加正则校验 * 添加正则校验判断当前组件的rules是不是数组如果不是数组使用set方法重置成数组然后添加正则校验
*/ */
const addRules = () => { const addRules = () => {
if (!isArray(formConfig.value.currentItem!.rules)) formConfig.value.currentItem!['rules'] = [] if (!isArray(formConfig.value.currentItem!.rules)) formConfig.value.currentItem!['rules'] = []
formConfig.value.currentItem!.rules?.push({ pattern: '', message: '' }) formConfig.value.currentItem!.rules?.push({ pattern: '', message: '' })
} }
/** /**
* 删除正则校验当正则规则为0时删除rules属性 * 删除正则校验当正则规则为0时删除rules属性
* @param index {number} 需要删除的规则下标 * @param index {number} 需要删除的规则下标
*/ */
const removeRule = (index: number) => { const removeRule = (index: number) => {
remove(formConfig.value.currentItem!.rules as Array<any>, index) remove(formConfig.value.currentItem!.rules as Array<any>, index)
if (formConfig.value.currentItem!.rules?.length === 0) delete formConfig.value.currentItem!['rules'] if (formConfig.value.currentItem!.rules?.length === 0) delete formConfig.value.currentItem!['rules']
} }
const patternDataSource = ref([ const patternDataSource = ref([
{ {
value: '/^(?:(?:\\+|00)86)?1[3-9]\\d{9}$/', value: '/^(?:(?:\\+|00)86)?1[3-9]\\d{9}$/',
text: '手机号码' text: '手机号码'
@ -125,13 +115,11 @@ export default defineComponent({
text: '车牌号(新能源)' text: '车牌号(新能源)'
}, },
{ {
value: value: '/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/',
'/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/',
text: '车牌号(非新能源)' text: '车牌号(非新能源)'
}, },
{ {
value: value: '/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/',
'/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/',
text: '车牌号(新能源+非新能源)' text: '车牌号(新能源+非新能源)'
}, },
{ {
@ -226,11 +214,7 @@ export default defineComponent({
value: '/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$/', value: '/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$/',
text: 'email(支持中文邮箱)' text: 'email(支持中文邮箱)'
} }
]) ])
return { addRules, removeRule, formConfig, patternDataSource }
}
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,5 +1,5 @@
import { DictTag } from '@/components/DictTag' import { DictTag } from '@/components/DictTag'
import Icon from '@/components/Icon' import { Icon } from '@/components/Icon'
import { Button, Tag } from 'ant-design-vue' import { Button, Tag } from 'ant-design-vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { h } from 'vue' import { h } from 'vue'

View File

@ -33,7 +33,7 @@ import { Image } from 'ant-design-vue';
</template> </template>
<script lang="ts" setup name="WxLocation"> <script lang="ts" setup name="WxLocation">
import { Image } from 'ant-design-vue' import { Image } from 'ant-design-vue'
import Icon from '@/components/Icon' import { Icon } from '@/components/Icon'
const props = defineProps({ const props = defineProps({
locationX: { locationX: {

View File

@ -3,7 +3,7 @@
<template #headerContent> <template #headerContent>
请选择公众号 请选择公众号
<div :class="`${prefixCls}__link`"> <div :class="`${prefixCls}__link`">
<Select :value="queryParams.accountId" style="width: 200px" @change="getList"> <Select :value="queryParams.accountId as any" style="width: 200px" @change="getList">
<SelectOption v-for="item in accounts" :label="item.name" :value="parseInt(item.id)" :key="parseInt(item.id)" /> <SelectOption v-for="item in accounts" :label="item.name" :value="parseInt(item.id)" :key="parseInt(item.id)" />
</Select> </Select>
<!-- <a><Icon icon="bx:bx-paper-plane" color="#1890ff" /><span>开始</span></a> <!-- <a><Icon icon="bx:bx-paper-plane" color="#1890ff" /><span>开始</span></a>
@ -42,7 +42,7 @@
</PageWrapper> </PageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import Icon from '@/components/Icon' // import { Icon } from '@/components/Icon'
import { PageWrapper } from '@/components/Page' import { PageWrapper } from '@/components/Page'
import { Card, List, Image, Select, Pagination } from 'ant-design-vue' import { Card, List, Image, Select, Pagination } from 'ant-design-vue'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'

View File

@ -49,6 +49,7 @@
<script lang="ts" setup name="PayOrderSubmit"> <script lang="ts" setup name="PayOrderSubmit">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { Card, List } from 'ant-design-vue' import { Card, List } from 'ant-design-vue'
import { Icon } from '@/components/Icon'
import { Description } from '@/components/Description' import { Description } from '@/components/Description'
import { descSchema } from './submit.data' import { descSchema } from './submit.data'
import { getOrder, submitOrder } from '@/api/pay/order' import { getOrder, submitOrder } from '@/api/pay/order'