This commit is contained in:
mkm 2024-08-16 17:51:24 +08:00
parent 1e467bf57a
commit 231625f3fd
10 changed files with 329 additions and 99 deletions

View File

@ -6,6 +6,6 @@ VITE_NOW_TYPE = 'dist'
# VITE_APP_BASE_URL='http://192.168.1.10:8546' # VITE_APP_BASE_URL='http://192.168.1.10:8546'
# VITE_APP_BASE_URL='https://test-multi-store.lihaink.cn' # VITE_APP_BASE_URL='https://test-multi-store.lihaink.cn'
# VITE_APP_BASE_URL='https://multi-store.lihaink.cn' # VITE_APP_BASE_URL='https://multi-store.lihaink.cn'
VITE_APP_BASE_URL='http://192.168.1.7:8545' VITE_APP_BASE_URL='http://192.168.1.22:8545'
# VITE_APP_BASE_URL='https://ceshi-multi-store.lihaink.cn' # VITE_APP_BASE_URL='https://ceshi-multi-store.lihaink.cn'

View File

@ -8,6 +8,10 @@ export function apiPurchaseOrderLists(params: any) {
export function apiPurchaseOrderInfoLists(params: any) { export function apiPurchaseOrderInfoLists(params: any) {
return request.get({ url: '/purchase_order/purchaseorder/info_lists', params }) return request.get({ url: '/purchase_order/purchaseorder/info_lists', params })
} }
// 采购订单详情列表
export function apiPurchaseStoreOrderLists(params: any) {
return request.get({ url: '/purchase_order/purchaseorder/order_lists', params })
}
// 添加采购订单 // 添加采购订单
export function apiPurchaseOrderAdd(params: any) { export function apiPurchaseOrderAdd(params: any) {

View File

@ -0,0 +1,192 @@
<template>
<div>
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="订单号" prop="order_id">
<el-input
class="w-[280px]"
v-model="queryParams.order_id"
@keydown.enter="resetPage"
clearable
placeholder="请输入订单号"
/>
</el-form-item>
<el-form-item label="门店" prop="store_id">
<el-select
v-model="queryParams.store_id"
filterable
remote
reserve-keyword
placeholder="输入门店名称搜索"
remote-show-suffix
:remote-method="remoteMethod"
:loading="storeloading"
style="width: 240px"
@change="resetPage"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="日期" prop="order_id">
<el-date-picker
v-model="startEndTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
unlink-panels
@change="changeStartEndTime"
/>
</el-form-item>
<el-form-item label="支付方式" prop="pay_type">
<el-select
class="w-[280px]"
v-model="queryParams.pay_type"
placeholder="请选择支付方式"
@change="resetPage"
>
<el-option
:label="item.name"
:value="item.value"
v-for="item in dictData.pay_type"
:key="item.value"
/>
</el-select>
</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>
<div class="mt-4" v-loading="pager.loading">
<el-table :data="pager.lists" @selection-change="handleSelectionChange" :height="300">
<el-table-column type="selection" width="55" />
<el-table-column label="订单ID" prop="id" show-overflow-tooltip />
<el-table-column label="订单号" prop="order_id" show-overflow-tooltip />
<el-table-column label="门店" prop="store_name" show-overflow-tooltip />
<el-table-column label="用户" prop="nickname" show-overflow-tooltip />
<el-table-column label="实际支付金额" prop="pay_price" show-overflow-tooltip />
<el-table-column label="订单状态" prop="status_name">
<template #default="{ row }">
<div v-if="row.refund_status == 2">
<el-tag type="danger">已退款</el-tag>
</div>
<div v-else>
<el-tag v-if="row.status_name == '待收货'" type="success">{{
row.status_name
}}</el-tag>
<el-tag
v-else-if="
row.status_name == '已收货' || row.status_name == '已完成'
"
type="info"
>{{ row.status_name }}</el-tag
>
<el-tag
v-else-if="
row.status_name == '待发货' || row.status_name == '待核销'
"
type="warning"
>{{ row.status_name }}</el-tag
>
<el-tag v-else type="danger">{{ row.status_name }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="支付方式" prop="pay_type" show-overflow-tooltip>
<template #default="{ row }">
<dict-value :options="dictData.pay_type" :value="row.pay_type"></dict-value>
</template>
</el-table-column>
<el-table-column label="支付时间" prop="pay_time" show-overflow-tooltip />
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<el-button class="w-full mt-4" type="primary" @click="bindStore">添加订单</el-button>
</div>
</template>
<script lang="ts" setup name="systemStoreLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreOrderLists } from '@/api/store_order'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import { ElMessage } from 'element-plus'
import { apiSystemStoreLists } from '@/api/system_store'
import moment from 'moment'
const props = defineProps<{
store_id: string
}>()
//
const queryParams = reactive({
order_id: '',
pay_type: '',
store_id: '',
start_time: '',
end_time: '',
is_merge: 0
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
const storeloading = ref(false)
const storeList = ref([])
const remoteMethod = (e = '') => {
storeloading.value = true
apiSystemStoreLists({
name: e,
page_size: 50
})
.then((res) => {
storeList.value = res.lists
setTimeout(() => {
storeloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
storeloading.value = false
}, 300)
})
}
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiStoreOrderLists,
params: queryParams
})
getLists()
const startEndTime = ref([])
const changeStartEndTime = () => {
if (startEndTime.value[0] && startEndTime.value[1]) {
queryParams.start_time = moment(startEndTime.value[0]).format('YYYY-MM-DD') + ' 00:00:00'
queryParams.end_time = moment(startEndTime.value[1]).format('YYYY-MM-DD') + ' 23:59:59'
} else {
queryParams.start_time = ''
queryParams.end_time = ''
}
getLists()
}
const emits = defineEmits(['onBindOrder'])
//
const bindStore = () => {
const list = pager.lists.filter((item) => selectData.value.includes(item.id))
if (!list.length) return ElMessage.error('请先选择订单')
emits('onBindOrder', list)
}
</script>

View File

@ -1,19 +1,19 @@
<template> <template>
<el-drawer v-model="showDialog" title="订单详情" :size="1000"> <el-drawer v-model="showDialog" title="订单详情" :size="1000">
<div class="flex items-center justify-between"> <!-- <div class="flex items-center justify-between">
<div>门店{{ formData.system_store }}</div> <div>门店{{ formData.system_store }}</div>
</div> </div> -->
<div class="flex items-center justify-between mt-3"> <div class="flex items-center justify-between mt-3">
<div>订单编号{{ formData.order_id }}</div> <div>订单编号{{ formData.order_id }}</div>
</div> </div>
<div class="flex items-center justify-between m-4"> <div class="flex items-center justify-between m-4">
<div class="flex flex-col"> <div class="flex flex-col">
<div style="color: gray">订单状态</div> <div style="color: gray">订单状态</div>
<div style="color: black">{{ formData.storage_name }}</div> <div style="color: black">{{ formData.status_name }}</div>
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<div style="color: gray">实际支付</div> <div style="color: gray">实际支付</div>
<div style="color: black">{{ formData.money }}</div> <div style="color: black">{{ formData.pay_price }}</div>
</div> </div>
<div class="flex flex-col flex-2"> <div class="flex flex-col flex-2">
<div style="color: gray">时间</div> <div style="color: gray">时间</div>
@ -31,8 +31,7 @@
<script lang="ts" setup name="storeOrderDETAILS"> <script lang="ts" setup name="storeOrderDETAILS">
import { ElMessage, type FormInstance } from 'element-plus' import { ElMessage, type FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { apiPurchaseOrderDetail } from '@/api/purchase_order' import { apiStoreOrderDetail } from '@/api/store_order'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import moment from 'moment' import moment from 'moment'
import storeTable from './storeTable.vue' import storeTable from './storeTable.vue'
@ -66,7 +65,7 @@ const getDetail = async (row: Record<string, any>) => {
handleClick({ handleClick({
paneName: activeName.value paneName: activeName.value
}) })
const data = await apiPurchaseOrderDetail({ const data = await apiStoreOrderDetail({
id: row.id id: row.id
}) })
setFormData(data) setFormData(data)

View File

@ -133,7 +133,7 @@ const warehouseRef = shallowRef<InstanceType<typeof warehouseEditPopup>>()
const route = useRoute() const route = useRoute()
const queryParams = reactive({ const queryParams = reactive({
id: route.query.id, order_id: route.query.id,
is_adopt: '', is_adopt: '',
is_mer: 1 is_mer: 1
}) })

View File

@ -2,12 +2,12 @@
<div> <div>
<el-table :data="pager.lists" border style="width: 100%"> <el-table :data="pager.lists" border style="width: 100%">
<el-table-column prop="id" label="ID" width="120" /> <el-table-column prop="id" label="ID" width="120" />
<el-table-column label="门店" prop="system_store" show-overflow-tooltip /> <el-table-column label="门店" prop="store_name" show-overflow-tooltip />
<el-table-column label="单据编号" prop="order_id" show-overflow-tooltip /> <el-table-column label="单据编号" prop="order_id" show-overflow-tooltip />
<el-table-column label="单据金额" prop="total" 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="deduction_price" show-overflow-tooltip /> -->
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip /> <el-table-column label="总金额" prop="total_price" show-overflow-tooltip />
<el-table-column label="实收金额" prop="money" show-overflow-tooltip /> <el-table-column label="支付金额" prop="pay_price" show-overflow-tooltip />
<!-- <el-table-column label="单据时间" prop="create_time" show-overflow-tooltip /> --> <!-- <el-table-column label="单据时间" prop="create_time" show-overflow-tooltip /> -->
<el-table-column label="操作" fixed="right"> <el-table-column label="操作" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
@ -37,7 +37,7 @@
<script lang="ts" setup name="subOrder"> <script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiPurchaseOrderLists } from '@/api/purchase_order' import { apiPurchaseStoreOrderLists } from '@/api/purchase_order'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import DetailsPopup from './details.vue' import DetailsPopup from './details.vue'
@ -48,12 +48,12 @@ const detailsRef = shallowRef<InstanceType<typeof DetailsPopup>>()
const route = useRoute() const route = useRoute()
const queryParams = reactive({ const queryParams = reactive({
o_id: route.query.id, id: route.query.id,
is_mer: 1 is_mer: 1
}) })
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiPurchaseOrderLists, fetchFun: apiPurchaseStoreOrderLists,
params: queryParams params: queryParams
}) })

View File

@ -25,7 +25,7 @@
<el-table-column prop="store_name" label="商品名称" /> <el-table-column prop="store_name" label="商品名称" />
<el-table-column prop="unit_name" label="单位" /> <el-table-column prop="unit_name" label="单位" />
<el-table-column prop="store_info" label="规格" /> <el-table-column prop="store_info" label="规格" />
<el-table-column prop="cart_num" label="数量" /> <el-table-column prop="need_num" label="数量" />
<el-table-column prop="price" label="单价(元)" /> <el-table-column prop="price" label="单价(元)" />
<el-table-column prop="total_price" label="总价" /> <el-table-column prop="total_price" label="总价" />
</el-table> </el-table>
@ -51,6 +51,7 @@
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiPurchaseOrderDetail, apiPurchaseOrderInfoLists } from '@/api/purchase_order' import { apiPurchaseOrderDetail, apiPurchaseOrderInfoLists } from '@/api/purchase_order'
import { apiPurchaseProductOfferLists } from '@/api/purchase_product_offer'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import subOrder from './component/subOrder.vue' import subOrder from './component/subOrder.vue'
import goodsOffer from './component/goodsOffer.vue' import goodsOffer from './component/goodsOffer.vue'
@ -86,13 +87,13 @@ const tabChange = (type: any) => {
// //
const queryParams = reactive({ const queryParams = reactive({
oid: route.query.id order_id: route.query.id
}) })
// //
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiPurchaseOrderInfoLists, fetchFun: apiPurchaseProductOfferLists,
params: queryParams params: queryParams
}) })
getLists() getLists()

View File

@ -4,56 +4,78 @@
ref="popupRef" ref="popupRef"
:title="popupTitle" :title="popupTitle"
:async="true" :async="true"
width="550px" width="1200px"
@confirm="handleSubmit" @confirm="handleSubmit"
@close="handleClose" @close="handleClose"
> >
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="所属商户" prop="store_id"> <div class="flex-1 w-full">
<el-input v-model="formData.store_id" clearable placeholder="请输入所属商户" :readonly="false"/> <div class="mb-2">
</el-form-item> <el-button type="primary" @click="showOrder = true">添加订单</el-button>
<el-form-item label="零售订单id" prop="order_arr"> </div>
<el-input v-model="formData.order_arr" clearable placeholder="请输入零售订单id" :readonly="false"/> <el-table :data="orderList">
</el-form-item> <el-table-column label="订单ID" prop="id" show-overflow-tooltip />
<el-form-item label="单据编号" prop="order_id">
<el-input v-model="formData.order_id" clearable placeholder="请输入单据编号" :readonly="false"/> <el-table-column
</el-form-item> label="订单编号"
<el-form-item label="单据金额" prop="total"> prop="order_id"
<el-input v-model="formData.total" clearable placeholder="请输入单据金额" :readonly="false"/> min-width="200"
</el-form-item> show-overflow-tooltip
<el-form-item label="实际金额" prop="actual"> />
<el-input v-model="formData.actual" clearable placeholder="请输入实际金额" :readonly="false"/> <el-table-column
</el-form-item> label="门店"
<el-form-item label="实收金额" prop="money"> prop="store_name"
<el-input v-model="formData.money" clearable placeholder="请输入实收金额" :readonly="false"/> min-width="80"
</el-form-item> show-overflow-tooltip
<el-form-item label="是否支付" prop="paid"> />
<el-input v-model="formData.paid" clearable placeholder="请输入是否支付" :readonly="false"/> <el-table-column
</el-form-item> label="用户"
<el-form-item label="单据附件" prop="file"> prop="nickname"
<el-input v-model="formData.file" clearable placeholder="请输入单据附件" :readonly="false"/> min-width="80"
</el-form-item> show-overflow-tooltip
<el-form-item label="备注信息" prop="data"> />
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="false"/> <el-table-column
</el-form-item> label="支付金额"
<el-form-item label="是否采购" prop="is_opurchase"> prop="pay_price"
<el-input v-model="formData.is_opurchase" clearable placeholder="请输入是否采购" :readonly="false"/> min-width="80"
</el-form-item> show-overflow-tooltip
<el-form-item label="类型" prop="is_mer"> />
<el-input v-model="formData.is_mer" clearable placeholder="请输入类型" :readonly="false"/> <el-table-column
</el-form-item> label="创建时间"
<el-form-item label="入库状态" prop="storage"> prop="create_time"
<el-input v-model="formData.storage" clearable placeholder="请输入入库状态" :readonly="false"/> min-width="80"
</el-form-item> show-overflow-tooltip
/>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['system_store.system_store/delete']"
type="danger"
link
@click="handleDeleteProdut(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form> </el-form>
</popup> </popup>
<el-dialog v-model="showOrder" title="选择订单" width="70%">
<order-pop @onBindOrder="onBindOrder"></order-pop>
</el-dialog>
</div> </div>
</template> </template>
<script lang="ts" setup name="purchaseOrderEdit"> <script lang="ts" setup name="purchaseOrderEdit">
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { apiPurchaseOrderAdd, apiPurchaseOrderEdit, apiPurchaseOrderDetail } from '@/api/purchase_order' import {
apiPurchaseOrderAdd,
apiPurchaseOrderEdit,
apiPurchaseOrderDetail
} from '@/api/purchase_order'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue' import type { PropType } from 'vue'
defineProps({ defineProps({
@ -67,7 +89,6 @@ const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add') const mode = ref('add')
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑采购订单' : '新增采购订单' return mode.value == 'edit' ? '编辑采购订单' : '新增采购订单'
@ -87,25 +108,42 @@ const formData = reactive({
data: '', data: '',
is_opurchase: '', is_opurchase: '',
is_mer: '', is_mer: '',
storage: '', storage: ''
}) })
const showOrder = ref(false) //
//
const orderList = ref([])
//
const handleDeleteProdut = (id: number) => {
orderList.value = orderList.value.filter((item: any) => item.id !== id)
}
//
const onBindOrder = (e: any[]) => {
e.forEach((item: any) => {
if (!orderList.value.find((t: any) => t.id == item.id)) {
orderList.value.push(item)
}
})
showOrder.value = false
}
// //
const formRules = reactive<any>({ const formRules = reactive<any>({
store_id: [{ store_id: [
{
required: true, required: true,
message: '请输入所属商户', message: '请输入所属商户',
trigger: ['blur'] trigger: ['blur']
}], }
order_id: [{ ],
order_id: [
{
required: true, required: true,
message: '请输入单据编号', message: '请输入单据编号',
trigger: ['blur'] trigger: ['blur']
}] }
]
}) })
// //
const setFormData = async (data: Record<any, any>) => { const setFormData = async (data: Record<any, any>) => {
for (const key in formData) { for (const key in formData) {
@ -114,8 +152,6 @@ const setFormData = async (data: Record<any, any>) => {
formData[key] = data[key] formData[key] = data[key]
} }
} }
} }
const getDetail = async (row: Record<string, any>) => { const getDetail = async (row: Record<string, any>) => {
@ -125,14 +161,16 @@ const getDetail = async (row: Record<string, any>) => {
setFormData(data) setFormData(data)
} }
// //
const handleSubmit = async () => { const handleSubmit = async () => {
await formRef.value?.validate() const order_arr = orderList.value.map((item: any) => {
const data = { ...formData, } return {
mode.value == 'edit' oid: item.id,
? await apiPurchaseOrderEdit(data) order_id: item.order_id,
: await apiPurchaseOrderAdd(data) store_id: item.store_id
}
})
mode.value == (await apiPurchaseOrderAdd(order_arr))
popupRef.value?.close() popupRef.value?.close()
emit('success') emit('success')
} }
@ -148,8 +186,6 @@ const handleClose = () => {
emit('close') emit('close')
} }
defineExpose({ defineExpose({
open, open,
setFormData, setFormData,

View File

@ -60,7 +60,7 @@
</el-form> </el-form>
</el-card> </el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never"> <el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button <!-- <el-button
v-perms="['purchase_order.purchase_order/add']" v-perms="['purchase_order.purchase_order/add']"
type="primary" type="primary"
@click="submitOrder" @click="submitOrder"
@ -70,15 +70,21 @@
</template> </template>
提交今日商户采购订单 提交今日商户采购订单
</el-button> </el-button>
<el-button <el-button v-perms="['purchase_order.purchase_order/add']" type="primary" @click="submitPlatformOrder">
v-perms="['purchase_order.purchase_order/add']"
type="primary"
@click="submitPlatformOrder"
>
<template #icon> <template #icon>
<icon name="el-icon-Plus" /> <icon name="el-icon-Plus" />
</template> </template>
生成今日平台采购订单 生成今日平台采购订单
</el-button> -->
<el-button
v-perms="['purchase_order.purchase_order/add']"
type="primary"
@click="handleAdd"
>
<template #icon>
<icon name="el-icon-Plus" />
</template>
生成采购订单
</el-button> </el-button>
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
@ -182,16 +188,10 @@ const { pager, getLists, resetParams, resetPage } = usePaging({
}) })
// //
// const handleAdd = async () => {
const submitOrder = async () => { showEdit.value = true
apiPurchaseOrderAdd().then((res) => { await nextTick()
ElMessage.success('提交成功') editRef.value?.open('add')
})
}
const submitPlatformOrder = async () => {
apiPurchaseOrderPlatform().then((res) => {
ElMessage.success('提交成功')
})
} }
const handleDetail = async (data: any) => { const handleDetail = async (data: any) => {

View File

@ -12,7 +12,6 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="门店" prop="store_id"> <el-form-item label="门店" prop="store_id">
<!-- <el-input class="w-[280px]" v-model="queryParams.store_name" clearable placeholder="请输入门店id" /> -->
<el-select <el-select
v-model="queryParams.store_id" v-model="queryParams.store_id"
filterable filterable
@ -46,7 +45,6 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="支付方式" prop="pay_type"> <el-form-item label="支付方式" prop="pay_type">
<!-- <el-input class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请输入支付方式" /> -->
<el-select <el-select
class="w-[280px]" class="w-[280px]"
v-model="queryParams.pay_type" v-model="queryParams.pay_type"