修改预订单商品价格

This commit is contained in:
DESKTOP-GMUNQ1B\Administrator 2024-12-05 17:46:31 +08:00
parent 39e5e29678
commit 40e8d61336
3 changed files with 77 additions and 42 deletions

View File

@ -73,12 +73,18 @@ import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreProductLists } from '@/api/store_product' import { apiStoreProductLists } from '@/api/store_product'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { defineProps } from 'vue';
const props = defineProps({
userId: Number
});
// //
const queryParams = reactive({ const queryParams = reactive({
store_name: '', store_name: '',
product_type: 0, product_type: 0,
is_warehouse: 1 is_warehouse: 1,
user_id: props.userId
}) })
// //

View File

@ -12,21 +12,25 @@
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="用户" prop="nickname"> <el-form-item label="用户" prop="nickname">
<el-input v-model="formData.nickname" type="input" /> <el-select
</el-form-item> v-model="formData.user_id"
</el-col> filterable
<el-col :span="4"> remote
<el-form-item label="电话" prop="phone"> reserve-keyword
<el-input v-model="formData.phone" type="input" /> placeholder="输入用户名称搜索"
</el-form-item> remote-show-suffix
</el-col> :remote-method="remoteMethodUser"
<el-col :span="16"> :loading="userloading"
<el-form-item label="地址" prop="address"> style="width: 220px"
<el-input @change="resetUserId"
v-model="formData.address" >
type="input" <el-option
style="width: 400px" v-for="item in userList"
/> :key="item.id"
:label="`${item.real_name}|${item.mobile} (ID:${item.id})`"
:value="item.id"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -146,7 +150,7 @@
<el-form-item label="商品" prop="product_id" class="w-full"> <el-form-item label="商品" prop="product_id" class="w-full">
<div class="flex-1 w-full"> <div class="flex-1 w-full">
<div class="mb-2"> <div class="mb-2">
<el-button type="primary" @click="showProduct = true" <el-button type="primary" @click="showProductModal()"
>添加商品</el-button >添加商品</el-button
> >
</div> </div>
@ -311,7 +315,7 @@
</el-form> </el-form>
</div> </div>
<el-dialog v-model="showProduct" title="选择商品" width="70%"> <el-dialog v-model="showProduct" title="选择商品" width="70%">
<product-warehouse-pop @onBindStore="onBindProduct"></product-warehouse-pop> <product-warehouse-pop :key="productModalKey" :userId="formData.user_id" @onBindStore="onBindProduct"></product-warehouse-pop>
</el-dialog> </el-dialog>
</el-card> </el-card>
<el-dialog v-model="dialogProductShow" title="选择商品" width="1200"> <el-dialog v-model="dialogProductShow" title="选择商品" width="1200">
@ -347,6 +351,8 @@ import { useRouter, useRoute } from 'vue-router'
import { apiBeforehandOrderAdd } from '@/api/beforehand_order' import { apiBeforehandOrderAdd } from '@/api/beforehand_order'
import { apiSystemStoreLists } from '@/api/system_store' import { apiSystemStoreLists } from '@/api/system_store'
import { apiStoreProductDetail, apiStoreProductLists } from '@/api/store_product' import { apiStoreProductDetail, apiStoreProductLists } from '@/api/store_product'
import { apiUserLists } from '@/api/user'
import feedback from '@/utils/feedback'
defineProps({ defineProps({
dictData: { dictData: {
@ -364,9 +370,6 @@ const formData = reactive({
total_price: 0, total_price: 0,
order_type: 1, order_type: 1,
store_id: '', store_id: '',
nickname: '',
phone: '',
address: '',
arrival_time: '', arrival_time: '',
purpose: '', purpose: '',
tables: 0, tables: 0,
@ -379,7 +382,8 @@ const formData = reactive({
transporter: '', transporter: '',
system_store_name: '', system_store_name: '',
regional_manager: '张波', regional_manager: '张波',
mark: '' mark: '',
user_id: ''
}) })
const enterProduct = async (e: any) => { const enterProduct = async (e: any) => {
const data = await apiStoreProductDetail({ id: e.id }) const data = await apiStoreProductDetail({ id: e.id })
@ -387,8 +391,6 @@ const enterProduct = async (e: any) => {
} }
const setData = (e: any, data: any) => { const setData = (e: any, data: any) => {
console.log(e)
console.log(data)
e.id = data.id e.id = data.id
e.image = data.image e.image = data.image
e.marques = data.marques e.marques = data.marques
@ -477,7 +479,11 @@ const dialogProductLists = ref([])
const dialogProductShow = ref(false) const dialogProductShow = ref(false)
const dialogProductData = ref() const dialogProductData = ref()
const enterStoreName = (e: any) => { const enterStoreName = (e: any) => {
apiStoreProductLists({ store_name: e.store_name, product_type: 0, is_warehouse: 1 }).then( if (formData.user_id == '') {
feedback.alertError('请先选择用户')
return
}
apiStoreProductLists({ store_name: e.store_name, product_type: 0, is_warehouse: 1, user_id: formData.user_id }).then(
(res) => { (res) => {
if (res.count == 1) { if (res.count == 1) {
const data = res.lists[0] const data = res.lists[0]
@ -592,27 +598,13 @@ const moveFocus = (event: any, index: number, key: string) => {
} }
// //
const formRules = reactive<any>({ const formRules = reactive<any>({
nickname: [ user_id: [
{ {
required: true, required: true,
message: '请输入采购用户', message: '请输入采购用户',
trigger: ['blur'] trigger: ['blur']
} }
], ],
phone: [
{
required: true,
message: '请输入采购用户手机号',
trigger: ['blur']
}
],
address: [
{
required: true,
message: '请输入采购用户地址',
trigger: ['blur']
}
],
arrival_time: [ arrival_time: [
{ {
required: true, required: true,
@ -698,4 +690,36 @@ const formRules = reactive<any>({
} }
] ]
}) })
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
apiUserLists({
nickname: e,
page_size: 10
})
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
const showProductModal = () => {
if (formData.user_id == '') {
feedback.alertError('请先选择用户')
return
}
showProduct.value = true
}
const productModalKey = ref(0)
const resetUserId = (e) => {
productModalKey.value++
}
</script> </script>

View File

@ -31,9 +31,14 @@
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="id" prop="id" show-overflow-tooltip /> <el-table-column label="id" prop="id" show-overflow-tooltip />
<el-table-column label="预订单id" prop="bhoid" show-overflow-tooltip /> <el-table-column label="溯源" width="150">
<el-table-column label="采购源id" prop="offer_id" show-overflow-tooltip /> <template #default="{ row }">
<div>预订单id: {{row.bhoid}}</div>
<div>采购源id: {{row.offer_id}}</div>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip /> <el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="规格" prop="store_info" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" width="120"> <el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }"> <template #default="{ row }">
<el-image <el-image