Commit 313c51be by liuliufashi

sb

parent a14b4d5c
......@@ -55,7 +55,7 @@
:label-col="{ span: 2 }">
<div style="width:100%;display: flex;align-items: center;">
<a-select v-model:value="formState.sub" mode="multiple" style="width: 100%" placeholder="请选择商品" @focus="handleChanges" @search="handleChanges" @select="onSelect" @popupScroll="popupScroll">
<a-select-option v-for="item in optionss" :itemKey="item" :value="item.goodsid" :label="item.goodsid">
<a-select-option v-for="item,index in optionss" :itemKey="item" :value="item.subject" :label="item.goodsid" :key="index">
{{item.subject}}
</a-select-option>
</a-select>
......@@ -132,6 +132,7 @@ const plainOptions = [
{ label: "免费", value: true },
{ label: "收费", value: true },
];
const subs = ref<any>([])
const props = defineProps();
const emit = defineEmits(['onBack']);
let content = ref("");
......@@ -217,7 +218,7 @@ const formState = reactive<FormState>({
picurl: "",
markingprice: "",
price: "",
sub: []
sub: [],
});
const optionss = ref([])
const rulesRef = reactive({
......@@ -299,6 +300,7 @@ const handleChanges = async(value: any) => {
const onSelect =(value:any, option:any)=>{
console.log(value,option,'option');
console.log(formState.sub,'formState');
subs.value.push({label:option.label,value:option.value})
}
const beforeUpload: UploadProps['beforeUpload'] = file => {
if (!(file.type.includes('png') || file.type.includes('jpeg') || file.type.includes('jpg'))) {
......@@ -315,6 +317,11 @@ const onSubmit = () => {
.then(async () => {
const fromData:any = toRaw(formState)
const uid = getUid()
const list = subs.value.filter((element:any,index:any) => {
if(element.value == formState.sub[index]){
return element.label
}
})
const prarms = {
body: fromData.body,
remember: fromData.remember,
......@@ -325,7 +332,7 @@ const onSubmit = () => {
markingprice:fromData.markingprice*100,
price:fromData.price*100,
picurl:fromData.picurl,
sub:fromData.sub
sub:list.map((item:any)=>{return item.label})
}
const data: any = await onCreateGoods(JSON.stringify(prarms))
if (data.state === 1) {
......@@ -378,6 +385,7 @@ watch(isEditfileList, (newVal:any) => {
defineExpose({
subs,
optionss,
plainOptions,
value,
......
......@@ -134,15 +134,15 @@
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, onMounted, watch, toRaw } from "vue";
import { ref, reactive, defineExpose, onMounted, watch, toRaw} from "vue";
import { LeftOutlined } from "@ant-design/icons-vue";
import GoodsBags from "./components/goods/index.vue";
import GoodsBagSubs from "./components/goodsubs/index.vue";
import { onSelectGoods, onUpdateGoods,onFindbyLikeName } from "@/api/index";
import { getUid } from "@/utils/userInfo";
import { Form, message, Upload, UploadProps } from 'ant-design-vue';
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css';
import GoodsBags from "./components/goods/index.vue";
import GoodsBagSubs from "./components/goodsubs/index.vue";
const useForm = Form.useForm;
const myQuillEditor = ref<any>(null);
......@@ -230,7 +230,7 @@ let options = reactive({
});
const optionss = ref([])
const previewTitle = ref("");
const list = ref<Array<Object>>([]);
const list = ref<any>([]);
const value = ref<string>("");
const status = ref<string>("0");
const previewImage = ref("");
......@@ -294,8 +294,9 @@ const onSearch = async (e:any) => {
strtus: e.target.value,
uid,
}
const data = await onSelectGoods(prarms);
const data:any = await onSelectGoods(prarms);
list.value = data.data;
pagination.value.total =data.count
};
const tableChange=async(e:any)=>{
......@@ -315,25 +316,22 @@ const tableChange=async(e:any)=>{
}
const onSearchName = async (e:any) => {
const uid = getUid();
const params = {
name: value.value,
size:10,
page:1,
uid,
};
console.log(params,'params');
const data = await onFindbyLikeName(params);
list.value = data.data.goods;
};
const onGoods = (e: Number) => {
const onGoods = (e: any) => {
propsData.isCad = e;
isShowGoods.value = true;
};
const onBack = async (e: Number) => {
isShowGoods.value = !isShowGoods.value;
await onSearch({target:{value:'3'}})
// await onSearch({target:{value:'3'}})
};
const onEdit = (e: any) => {
visible.value = !visible.value;
......@@ -388,8 +386,10 @@ const init = async () => {
strtus: 0,
uid,
}
const data = await onSelectGoods(prarms);
const data:any = await onSelectGoods(prarms);
list.value = data.data.goods;
pagination.value.total =data.count
};
const textChange = (e: any) => {
textarea.value = e
......
......@@ -5,9 +5,19 @@
<div class="header-right">
<bell-outlined />
</div>
<div class="header-right">
<RadarChartOutlined /><span>{{ info.name }}</span>
</div>
<a-dropdown>
<template #overlay>
<a-menu @click="handleMenuClick">
<a-menu-item key="1">
<UserOutlined />
退出登录
</a-menu-item>
</a-menu>
</template>
<div class="header-right">
<RadarChartOutlined /><span>{{ info.name }}</span>
</div>
</a-dropdown>
<div class="header-right">
<DashOutlined />
</div>
......@@ -20,7 +30,7 @@
style="background: #ebebeb"
>
<a-menu-item
v-for="item,index in store.state.routerList"
v-for="item,index in list"
:key="item"
@click="goNewPage(item,index)"
>
......@@ -58,6 +68,7 @@ import {
RadarChartOutlined,
DashOutlined,
} from "@ant-design/icons-vue";
import type { MenuProps } from 'ant-design-vue';
import { getRouters } from "@/api/index";
interface FormUser {
name: String;
......@@ -68,9 +79,10 @@ const router = useRouter();
const store = useStore();
const indexItem = ref<any>(0)
const selectedKeys = ref<string[]>(["1"])
const list = ref<any>()
const info = reactive<FormUser>(store.getters.getUserInfo);
const goNewPage = (e: any,index:any) => {
// indexItem.value = index
indexItem.value = index
const { path } = e;
router.push({
path,
......@@ -78,21 +90,66 @@ const goNewPage = (e: any,index:any) => {
}
});
};
const setRoutet = (list: any) => {
store.commit("setRoutet", list);
};
onMounted(async() => {
const list: any = await getRouters();
const newList:any = router.options.routes[2].children
setRoutet(newList.splice(1,4));
// onSetRouter(list.data)
const handleMenuClick: MenuProps['onClick'] = e => {
console.log('click', e);
if(e.key == '1'){
router.replace({
path:'/login'
})
}
};
onMounted(() => {
const newList:any = [
{
path: '/home/paybind',
name: 'PayBind',
meta:{
icon:'icon-fencengpeizhi'
},
component: ()=>import('@/views/pay-bind/index.vue')
},
{
path: '/home/goodscabinet',
name: '商品橱柜',
meta:{
icon:'icon-shangpin'
},
component: ()=>import('@/views/goods-cabinet/index.vue')
},
{
path: '/home/paylist',
name: '支付链接',
meta:{
icon:'icon-zhifubao'
},
component: ()=>import('@/views/pay-list/index.vue')
},
{
path: '/home/payconfig',
name: '支付配置',
meta:{
icon:'icon-fencengpeizhi'
},
component: ()=>import('@/views/pay-config/index.vue')
},
{
path: '/home/payinfo',
name: '订单详情',
meta:{
icon:'icon-gouwuchekong'
},
component: ()=>import('@/views/pay-info/index.vue')
},
]
list.value = newList.splice(1,4)
return list
});
defineExpose({
selectedKeys,
openKeys: ref<string[]>(["sub1"]),
goNewPage,
setRoutet,
handleMenuClick,
info,
store,
});
......
......@@ -6,8 +6,8 @@
<a-form-item label="选择商品" name="subject" :rules="rulesRef.subject" :label-col="{ span: 2 }"
labelAlign="left">
<div style="width:100%;display: flex;align-items: center;">
<a-select v-model:value="formState.subject" :default-active-first-option="false" mode="multiple" style="width: 100%" placeholder="请选择商品" @search="onSubSearch" @select="onSelectss" @popupScroll="popupScroll">
<a-select-option v-for="item,index in optionss.list" :itemKey="item" :value="item.goodsid" :label="index" >
<a-select v-model:value="formState.subject" :default-active-first-option="false" mode="multiple" style="width: 100%" placeholder="请选择商品" @search="onSubSearch" @change="onSubSearch" @select="onSelectss" @popupScroll="popupScroll">
<a-select-option v-for="(item,index) in optionss.list" :itemKey="item" :value="item.subject" :label="index" :key="index" >
{{item.subject}}
</a-select-option>
</a-select>
......
......@@ -63,7 +63,7 @@
<a-form-item label="选择商品" name="subject" :label-col="{ span: 2 }" labelAlign="left">
<div style="width:100%;display: flex;align-items: center;">
<a-select v-model:value="formState.subject" mode="multiple" style="width: 100%" placeholder="请选择商品" @focus="onSubSearch" @search="onSubSearch" @select="onSelect" @popupScroll="popupScroll">
<a-select-option v-for="item,index in listArray" :itemKey="item" :value="item.goodsid" :label="index" >
<a-select-option v-for="item,index in listArray" :itemKey="item" :value="item.subject" :label="index" :key="index">
<span>{{item.subject}}</span>
</a-select-option>
</a-select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment