Commit 313c51be by liuliufashi

sb

parent a14b4d5c
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
:label-col="{ span: 2 }"> :label-col="{ span: 2 }">
<div style="width:100%;display: flex;align-items: center;"> <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 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}} {{item.subject}}
</a-select-option> </a-select-option>
</a-select> </a-select>
...@@ -132,6 +132,7 @@ const plainOptions = [ ...@@ -132,6 +132,7 @@ const plainOptions = [
{ label: "免费", value: true }, { label: "免费", value: true },
{ label: "收费", value: true }, { label: "收费", value: true },
]; ];
const subs = ref<any>([])
const props = defineProps(); const props = defineProps();
const emit = defineEmits(['onBack']); const emit = defineEmits(['onBack']);
let content = ref(""); let content = ref("");
...@@ -217,7 +218,7 @@ const formState = reactive<FormState>({ ...@@ -217,7 +218,7 @@ const formState = reactive<FormState>({
picurl: "", picurl: "",
markingprice: "", markingprice: "",
price: "", price: "",
sub: [] sub: [],
}); });
const optionss = ref([]) const optionss = ref([])
const rulesRef = reactive({ const rulesRef = reactive({
...@@ -299,6 +300,7 @@ const handleChanges = async(value: any) => { ...@@ -299,6 +300,7 @@ const handleChanges = async(value: any) => {
const onSelect =(value:any, option:any)=>{ const onSelect =(value:any, option:any)=>{
console.log(value,option,'option'); console.log(value,option,'option');
console.log(formState.sub,'formState'); console.log(formState.sub,'formState');
subs.value.push({label:option.label,value:option.value})
} }
const beforeUpload: UploadProps['beforeUpload'] = file => { const beforeUpload: UploadProps['beforeUpload'] = file => {
if (!(file.type.includes('png') || file.type.includes('jpeg') || file.type.includes('jpg'))) { if (!(file.type.includes('png') || file.type.includes('jpeg') || file.type.includes('jpg'))) {
...@@ -315,6 +317,11 @@ const onSubmit = () => { ...@@ -315,6 +317,11 @@ const onSubmit = () => {
.then(async () => { .then(async () => {
const fromData:any = toRaw(formState) const fromData:any = toRaw(formState)
const uid = getUid() const uid = getUid()
const list = subs.value.filter((element:any,index:any) => {
if(element.value == formState.sub[index]){
return element.label
}
})
const prarms = { const prarms = {
body: fromData.body, body: fromData.body,
remember: fromData.remember, remember: fromData.remember,
...@@ -325,7 +332,7 @@ const onSubmit = () => { ...@@ -325,7 +332,7 @@ const onSubmit = () => {
markingprice:fromData.markingprice*100, markingprice:fromData.markingprice*100,
price:fromData.price*100, price:fromData.price*100,
picurl:fromData.picurl, picurl:fromData.picurl,
sub:fromData.sub sub:list.map((item:any)=>{return item.label})
} }
const data: any = await onCreateGoods(JSON.stringify(prarms)) const data: any = await onCreateGoods(JSON.stringify(prarms))
if (data.state === 1) { if (data.state === 1) {
...@@ -378,6 +385,7 @@ watch(isEditfileList, (newVal:any) => { ...@@ -378,6 +385,7 @@ watch(isEditfileList, (newVal:any) => {
defineExpose({ defineExpose({
subs,
optionss, optionss,
plainOptions, plainOptions,
value, value,
......
...@@ -134,15 +134,15 @@ ...@@ -134,15 +134,15 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <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 { 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 { onSelectGoods, onUpdateGoods,onFindbyLikeName } from "@/api/index";
import { getUid } from "@/utils/userInfo"; import { getUid } from "@/utils/userInfo";
import { Form, message, Upload, UploadProps } from 'ant-design-vue'; import { Form, message, Upload, UploadProps } from 'ant-design-vue';
import { QuillEditor } from '@vueup/vue-quill' import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css'; 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 useForm = Form.useForm;
const myQuillEditor = ref<any>(null); const myQuillEditor = ref<any>(null);
...@@ -230,7 +230,7 @@ let options = reactive({ ...@@ -230,7 +230,7 @@ let options = reactive({
}); });
const optionss = ref([]) const optionss = ref([])
const previewTitle = ref(""); const previewTitle = ref("");
const list = ref<Array<Object>>([]); const list = ref<any>([]);
const value = ref<string>(""); const value = ref<string>("");
const status = ref<string>("0"); const status = ref<string>("0");
const previewImage = ref(""); const previewImage = ref("");
...@@ -294,8 +294,9 @@ const onSearch = async (e:any) => { ...@@ -294,8 +294,9 @@ const onSearch = async (e:any) => {
strtus: e.target.value, strtus: e.target.value,
uid, uid,
} }
const data = await onSelectGoods(prarms); const data:any = await onSelectGoods(prarms);
list.value = data.data; list.value = data.data;
pagination.value.total =data.count
}; };
const tableChange=async(e:any)=>{ const tableChange=async(e:any)=>{
...@@ -315,25 +316,22 @@ const tableChange=async(e:any)=>{ ...@@ -315,25 +316,22 @@ const tableChange=async(e:any)=>{
} }
const onSearchName = async (e:any) => { const onSearchName = async (e:any) => {
const uid = getUid(); const uid = getUid();
const params = { const params = {
name: value.value, name: value.value,
size:10, size:10,
page:1, page:1,
uid, uid,
}; };
console.log(params,'params');
const data = await onFindbyLikeName(params); const data = await onFindbyLikeName(params);
list.value = data.data.goods; list.value = data.data.goods;
}; };
const onGoods = (e: Number) => { const onGoods = (e: any) => {
propsData.isCad = e; propsData.isCad = e;
isShowGoods.value = true; isShowGoods.value = true;
}; };
const onBack = async (e: Number) => { const onBack = async (e: Number) => {
isShowGoods.value = !isShowGoods.value; isShowGoods.value = !isShowGoods.value;
await onSearch({target:{value:'3'}}) // await onSearch({target:{value:'3'}})
}; };
const onEdit = (e: any) => { const onEdit = (e: any) => {
visible.value = !visible.value; visible.value = !visible.value;
...@@ -388,8 +386,10 @@ const init = async () => { ...@@ -388,8 +386,10 @@ const init = async () => {
strtus: 0, strtus: 0,
uid, uid,
} }
const data = await onSelectGoods(prarms); const data:any = await onSelectGoods(prarms);
list.value = data.data.goods; list.value = data.data.goods;
pagination.value.total =data.count
}; };
const textChange = (e: any) => { const textChange = (e: any) => {
textarea.value = e textarea.value = e
......
...@@ -5,9 +5,19 @@ ...@@ -5,9 +5,19 @@
<div class="header-right"> <div class="header-right">
<bell-outlined /> <bell-outlined />
</div> </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"> <div class="header-right">
<RadarChartOutlined /><span>{{ info.name }}</span> <RadarChartOutlined /><span>{{ info.name }}</span>
</div> </div>
</a-dropdown>
<div class="header-right"> <div class="header-right">
<DashOutlined /> <DashOutlined />
</div> </div>
...@@ -20,7 +30,7 @@ ...@@ -20,7 +30,7 @@
style="background: #ebebeb" style="background: #ebebeb"
> >
<a-menu-item <a-menu-item
v-for="item,index in store.state.routerList" v-for="item,index in list"
:key="item" :key="item"
@click="goNewPage(item,index)" @click="goNewPage(item,index)"
> >
...@@ -58,6 +68,7 @@ import { ...@@ -58,6 +68,7 @@ import {
RadarChartOutlined, RadarChartOutlined,
DashOutlined, DashOutlined,
} from "@ant-design/icons-vue"; } from "@ant-design/icons-vue";
import type { MenuProps } from 'ant-design-vue';
import { getRouters } from "@/api/index"; import { getRouters } from "@/api/index";
interface FormUser { interface FormUser {
name: String; name: String;
...@@ -68,9 +79,10 @@ const router = useRouter(); ...@@ -68,9 +79,10 @@ const router = useRouter();
const store = useStore(); const store = useStore();
const indexItem = ref<any>(0) const indexItem = ref<any>(0)
const selectedKeys = ref<string[]>(["1"]) const selectedKeys = ref<string[]>(["1"])
const list = ref<any>()
const info = reactive<FormUser>(store.getters.getUserInfo); const info = reactive<FormUser>(store.getters.getUserInfo);
const goNewPage = (e: any,index:any) => { const goNewPage = (e: any,index:any) => {
// indexItem.value = index indexItem.value = index
const { path } = e; const { path } = e;
router.push({ router.push({
path, path,
...@@ -78,21 +90,66 @@ const goNewPage = (e: any,index:any) => { ...@@ -78,21 +90,66 @@ const goNewPage = (e: any,index:any) => {
} }
}); });
}; };
const setRoutet = (list: any) => {
store.commit("setRoutet", list);
};
onMounted(async() => { const handleMenuClick: MenuProps['onClick'] = e => {
const list: any = await getRouters(); console.log('click', e);
const newList:any = router.options.routes[2].children if(e.key == '1'){
setRoutet(newList.splice(1,4)); router.replace({
// onSetRouter(list.data) 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({ defineExpose({
selectedKeys, selectedKeys,
openKeys: ref<string[]>(["sub1"]), openKeys: ref<string[]>(["sub1"]),
goNewPage, goNewPage,
setRoutet, handleMenuClick,
info, info,
store, store,
}); });
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<a-form-item label="选择商品" name="subject" :rules="rulesRef.subject" :label-col="{ span: 2 }" <a-form-item label="选择商品" name="subject" :rules="rulesRef.subject" :label-col="{ span: 2 }"
labelAlign="left"> labelAlign="left">
<div style="width:100%;display: flex;align-items: center;"> <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 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.goodsid" :label="index" > <a-select-option v-for="(item,index) in optionss.list" :itemKey="item" :value="item.subject" :label="index" :key="index" >
{{item.subject}} {{item.subject}}
</a-select-option> </a-select-option>
</a-select> </a-select>
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<a-form-item label="选择商品" name="subject" :label-col="{ span: 2 }" labelAlign="left"> <a-form-item label="选择商品" name="subject" :label-col="{ span: 2 }" labelAlign="left">
<div style="width:100%;display: flex;align-items: center;"> <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 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> <span>{{item.subject}}</span>
</a-select-option> </a-select-option>
</a-select> </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