This commit is contained in:
zmj 2024-05-16 17:19:58 +08:00
parent 987d380d63
commit 1f12492c0c
8 changed files with 660 additions and 4 deletions

View File

@ -1,5 +1,5 @@
NODE_ENV = 'development' NODE_ENV = 'development'
VITE_NOW_TYPE = 'dist' VITE_NOW_TYPE = 'dist'
# Base API # Base API
VITE_APP_BASE_URL='http://192.168.1.22:8546' # VITE_APP_BASE_URL='http://192.168.1.22:8546'
# VITE_APP_BASE_URL='https://erp.lihaink.cn' VITE_APP_BASE_URL='https://erp.lihaink.cn'

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory, RouterView, type RouteRecordRaw } from 'vue-router' import { createRouter, createWebHistory,createWebHashHistory, RouterView, type RouteRecordRaw } from 'vue-router'
import { MenuEnum } from '@/enums/appEnums' import { MenuEnum } from '@/enums/appEnums'
import { isExternal } from '@/utils/validate' import { isExternal } from '@/utils/validate'
import { constantRoutes, INDEX_ROUTE_NAME, LAYOUT } from './routes' import { constantRoutes, INDEX_ROUTE_NAME, LAYOUT } from './routes'
@ -103,7 +103,7 @@ export function resetRouter() {
} }
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHashHistory(import.meta.env.BASE_URL),
routes: constantRoutes routes: constantRoutes
}) })

View File

@ -0,0 +1,25 @@
<template>
<el-drawer
v-model="drawer"
title="I am the title"
>
<span>Hi, there!</span>
</el-drawer>
</template>
<script lang="ts" setup name="goodList">
import { usePaging } from "@/hooks/usePaging";
import {
apiOpurchaseclassGoodsOfferList,
apiOpurchaseclassGoodsOfferUpdate,
} from "@/api/opurchaseclass";
const drawer = ref(false);
const form = ref({});
const setForm = (data: any) => {
console.log(data);
}
</script>

View File

@ -0,0 +1,188 @@
<template>
<div>
<div>
<el-radio-group
v-model="queryParams.is_adopt"
size="small"
@change="changeType"
>
<el-radio-button label="全部" value="" />
<el-radio-button label="未采纳" value="0" />
<el-radio-button label="已采纳" value="1" />
</el-radio-group>
</div>
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="120" />
<!-- <el-table-column prop="order_id" label="采购订单id" width="120" /> -->
<el-table-column
label="商品名称"
prop="goods_name"
show-overflow-tooltip
width="220"
/>
<el-table-column
label="需求数量"
prop="need_num"
show-overflow-tooltip
width="100"
/>
<el-table-column
label="单位"
prop="unit_name"
width="80"
show-overflow-tooltip
/>
<el-table-column
label="供应商"
prop="supplier_name"
show-overflow-tooltip
width="160"
/>
<el-table-column
label="提供数量"
prop="nums"
show-overflow-tooltip
width="100"
/>
<el-table-column label="报价" prop="price" show-overflow-tooltip />
<el-table-column label="是否采纳报价" prop="is_adopt" width="120">
<template #default="{ row }">
<el-tag v-if="row.is_adopt === 1" type="success">已采纳</el-tag>
<el-tag v-else type="info">未采纳</el-tag>
</template>
</el-table-column>
<el-table-column
label="更新时间"
prop="update_time"
show-overflow-tooltip
width="160"
/>
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
v-if="row.is_adopt === 0 && row.price > 0"
size="small"
@click="offerGood(row, 0)"
>采纳</el-button
>
<span v-if="row.is_storage">已入库</span>
<el-button
type="success"
v-else-if="row.is_adopt === 1 && row.price > 0"
size="small"
@click="offerGood(row, 1)"
>入库</el-button
>
<span
v-if="row.is_adopt === 0 && row.price == 0"
style="color: #e6a23c"
>等待供应商报价</span
>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<el-dialog v-model="dialogVisible" title="入库" width="600">
<el-descriptions class="margin-top" :column="1" border>
<el-descriptions-item label="供应商名称">
{{ updateInfo.supplier_name }}
</el-descriptions-item>
<el-descriptions-item label="商品名称">
{{ updateInfo.goods_name }}
</el-descriptions-item>
<el-descriptions-item label="商品报价">
¥ {{ updateInfo.price }} / {{ updateInfo.unit_name }}
</el-descriptions-item>
<el-descriptions-item label="应入库数量">
{{ updateInfo.q_nums }}
</el-descriptions-item>
<el-descriptions-item label="实际入库数量">
<el-input-number v-model="updateInfo.nums" :step="1" :min="1" />
</el-descriptions-item>
<el-descriptions-item label="备注">
<el-input v-model="updateInfo.notes" type="textarea" placeholder="请输入备注"></el-input>
</el-descriptions-item>
</el-descriptions>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="goodsOfferUpdate">
确认
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from "@/hooks/usePaging";
import {
apiOpurchaseclassGoodsOfferList,
apiOpurchaseclassGoodsOfferUpdate,
} from "@/api/opurchaseclass";
import { useRoute } from "vue-router";
const route = useRoute();
const queryParams = reactive({
id: route.query.id,
is_adopt: "",
});
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOpurchaseclassGoodsOfferList,
params: queryParams,
});
defineExpose({
getLists,
});
const changeType = (e: any) => {
queryParams.is_adopt = e;
getLists();
};
const dialogVisible = ref(false);
const updateInfo = ref({
id: "",
type: 0,
notes: "", //
nums: 0,//
q_nums: 0, //
});
const offerGood = (row: any, type: number) => {
//type:0 1
updateInfo.value = Object.assign(
{
id: "",
type: type,
notes: "", //
nums: 0,
},
row
);
if(type==0) return goodsOfferUpdate(); // ,
updateInfo.value.q_nums = row.nums;
dialogVisible.value = true;
};
const goodsOfferUpdate = () => {
apiOpurchaseclassGoodsOfferUpdate({
id: updateInfo.value.id,
type: updateInfo.value.type,
notes: updateInfo.value.notes, //
nums: updateInfo.value.nums,
}).then((res) => {
getLists();
dialogVisible.value = false;
});
};
</script>

View File

@ -0,0 +1,67 @@
<template>
<div>
<el-table :data="pager.lists" border style="width: 100%;">
<el-table-column prop="id" label="ID" width="120" />
<el-table-column label="单据编号" prop="number" show-overflow-tooltip />
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
<el-table-column
label="抵扣金额"
prop="deduction_price"
show-overflow-tooltip
/>
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
<el-table-column label="实收金额" prop="money" show-overflow-tooltip />
<el-table-column
label="单据时间"
prop="create_time"
show-overflow-tooltip
/>
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button type="primary" @click="openDetail(row)" link>详情</el-button>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<detail ref="detailRef" v-if="showDetail" :dictData="dictData"
@close="showDetail = false"/>
</div>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from '@/hooks/useDictOptions'
import { apiOpurchaseclassSubOrders } from "@/api/opurchaseclass";
import { useRoute } from "vue-router";
import detail from "@/views/retail/cashierclass/detail.vue";
const route = useRoute();
const queryParams = reactive({
id: route.query.id,
});
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOpurchaseclassSubOrders,
params: queryParams,
});
defineExpose({
getLists
})
//
const { dictData } = useDictData('pay_type,auditing_type')
const showDetail = ref(false);
const detailRef = ref(null);
const openDetail = async (row: any) => {
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.getDetail(row)
}
</script>

View File

@ -0,0 +1,118 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-tabs v-model="activeName" class="demo-tabs" @tab-change="tabChange">
<el-tab-pane label="概况" name="detail">
<el-descriptions class="margin-top" :column="4" border>
<el-descriptions-item :span="4" label="单据编号">
{{ form.number }}
</el-descriptions-item>
<el-descriptions-item :span="2" label="单据金额">
{{ form.total }}
</el-descriptions-item>
<el-descriptions-item :span="2" label="抵扣金额">
{{ form.deduction_price }}
</el-descriptions-item>
<el-descriptions-item :span="2" label="实际金额">
{{ form.actual }}
</el-descriptions-item>
<el-descriptions-item :span="2" label="实收金额">
{{ form.money }}
</el-descriptions-item>
<el-descriptions-item label="所属商户">
{{ form.merchant_name }}
</el-descriptions-item>
</el-descriptions>
<el-table :data="form.goods_info" border style="width: 100%; margin-top: 20px">
<el-table-column prop="id" label="ID" width="120" />
<el-table-column prop="goods_name" label="商品名称" />
<el-table-column prop="price" label="单价(元)" />
<el-table-column prop="unit_name" label="单位" />
<el-table-column prop="nums" label="数量" />
<el-table-column prop="total" label="合计(元)" />
<el-table-column prop="nums_count" label="已采纳数量" />
</el-table>
</el-tab-pane>
<el-tab-pane label="子订单" name="order">
<subOrder ref="subOrderRef" />
</el-tab-pane>
<el-tab-pane label="报价列表" name="offer">
<goodsOffer ref="goodsOfferRef" />
</el-tab-pane>
<el-tab-pane label="未推送商品" name="notPushedGoods">
<el-button type="primary" @click="rePush">
重新推送
</el-button>
<el-table :data="pager.lists">
<el-table-column label="商品名称" prop="goods_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="单价(元)" prop="price" show-overflow-tooltip />
<el-table-column prop="nums" label="数量" />
<el-table-column prop="total" label="合计(元)" />
<el-table-column label="备注" prop="data" show-overflow-tooltip />
</el-table>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script lang="ts" setup name="opurchaseclassDetail">
import { usePaging } from "@/hooks/usePaging";
import {
apiOpurchaseclassLists,
apiOpurchaseclassDelete,
apiOpurchaseclassDetail,
} from "@/api/opurchaseclass";
import { useRoute } from "vue-router";
import subOrder from "./component/subOrder.vue";
import goodsOffer from "./component/goodsOffer.vue";
import { apiOpurchaseinfoListList, apicreateSupplierGoods } from "@/api/opurchaseclass";
const route = useRoute();
const form = ref({});
const activeName = ref("detail");
const activeMap = ref(
new Map([
["detail", true],
["order", false],
["offer", false],
["notPushedGoods", false],
])
);
const getDetail = async () => {
const data = await apiOpurchaseclassDetail({
id: route.query.id,
});
form.value = data;
};
getDetail();
const subOrderRef = ref(null);
const goodsOfferRef = ref(null);
const tabChange = (type: any) => {
if (!activeMap.value.get(type)) {
if (type == "order") subOrderRef.value?.getLists();
if (type == "offer") goodsOfferRef.value?.getLists();
activeMap.value.set(type, true);
}
};
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOpurchaseinfoListList,
params: { is_push: 0, id: route.query.id },
});
const rePush = async () => {
await apicreateSupplierGoods({ id: route.query.id })
getLists()
}
//
getLists()
</script>

View File

@ -0,0 +1,103 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="550px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="opurchaseclassEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiOpurchaseclassAdd, apiOpurchaseclassEdit, apiOpurchaseclassDetail } from '@/api/opurchaseclass'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑采购订单' : '新增采购订单'
})
//
const formData = reactive({
id: '',
})
//
const formRules = reactive<any>({
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiOpurchaseclassDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiOpurchaseclassEdit(data)
: await apiOpurchaseclassAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,155 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="所属商户" prop="merchant">
<el-input class="w-[280px]" v-model="queryParams.merchant" clearable placeholder="请输入所属商户" />
</el-form-item>
<el-form-item label="零售订单id" prop="order_arr">
<el-input class="w-[280px]" v-model="queryParams.order_arr" clearable placeholder="请输入零售订单id" />
</el-form-item>
<!-- <el-form-item label="单据编号" prop="number">
<el-input class="w-[280px]" v-model="queryParams.number" clearable placeholder="请输入单据编号" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<!-- <el-button v-perms="['operation.opurchaseclass/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['operation.opurchaseclass/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button> -->
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="ID" prop="id" show-overflow-tooltip />
<!-- <el-table-column label="所属商户" prop="merchant_name" show-overflow-tooltip /> -->
<!-- <el-table-column label="零售订单id" prop="order_arr" show-overflow-tooltip /> -->
<el-table-column label="购物车id" prop="cart_id" show-overflow-tooltip />
<el-table-column label="单据编号" prop="number" width="220" show-overflow-tooltip />
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
<el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip />
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
<el-table-column label="实收金额" prop="money" show-overflow-tooltip />
<el-table-column label="是否支付" prop="paid" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="handleDetail(row)">
详情
</el-button>
<!-- <el-button
v-perms="['operation.opurchaseclass/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['operation.opurchaseclass/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="opurchaseclassLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiOpurchaseclassLists, apiOpurchaseclassDelete } from '@/api/opurchaseclass'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
merchant: '',
order_arr: '',
number: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOpurchaseclassLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleDetail = async (data: any) => {
console.log(data);
router.push({
path: 'transDetail',
query: {
id: data.id
}
})
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiOpurchaseclassDelete({ id })
getLists()
}
getLists()
</script>