修改预订单商品价格

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 { ElMessage } from 'element-plus'
import { defineProps } from 'vue';
const props = defineProps({
userId: Number
});
//
const queryParams = reactive({
store_name: '',
product_type: 0,
is_warehouse: 1
is_warehouse: 1,
user_id: props.userId
})
//

View File

@ -12,21 +12,25 @@
<el-row>
<el-col :span="4">
<el-form-item label="用户" prop="nickname">
<el-input v-model="formData.nickname" type="input" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="电话" prop="phone">
<el-input v-model="formData.phone" type="input" />
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="地址" prop="address">
<el-input
v-model="formData.address"
type="input"
style="width: 400px"
/>
<el-select
v-model="formData.user_id"
filterable
remote
reserve-keyword
placeholder="输入用户名称搜索"
remote-show-suffix
:remote-method="remoteMethodUser"
:loading="userloading"
style="width: 220px"
@change="resetUserId"
>
<el-option
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-col>
</el-row>
@ -146,7 +150,7 @@
<el-form-item label="商品" prop="product_id" class="w-full">
<div class="flex-1 w-full">
<div class="mb-2">
<el-button type="primary" @click="showProduct = true"
<el-button type="primary" @click="showProductModal()"
>添加商品</el-button
>
</div>
@ -311,7 +315,7 @@
</el-form>
</div>
<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-card>
<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 { apiSystemStoreLists } from '@/api/system_store'
import { apiStoreProductDetail, apiStoreProductLists } from '@/api/store_product'
import { apiUserLists } from '@/api/user'
import feedback from '@/utils/feedback'
defineProps({
dictData: {
@ -364,9 +370,6 @@ const formData = reactive({
total_price: 0,
order_type: 1,
store_id: '',
nickname: '',
phone: '',
address: '',
arrival_time: '',
purpose: '',
tables: 0,
@ -379,7 +382,8 @@ const formData = reactive({
transporter: '',
system_store_name: '',
regional_manager: '张波',
mark: ''
mark: '',
user_id: ''
})
const enterProduct = async (e: any) => {
const data = await apiStoreProductDetail({ id: e.id })
@ -387,8 +391,6 @@ const enterProduct = async (e: any) => {
}
const setData = (e: any, data: any) => {
console.log(e)
console.log(data)
e.id = data.id
e.image = data.image
e.marques = data.marques
@ -477,7 +479,11 @@ const dialogProductLists = ref([])
const dialogProductShow = ref(false)
const dialogProductData = ref()
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) => {
if (res.count == 1) {
const data = res.lists[0]
@ -592,27 +598,13 @@ const moveFocus = (event: any, index: number, key: string) => {
}
//
const formRules = reactive<any>({
nickname: [
user_id: [
{
required: true,
message: '请输入采购用户',
trigger: ['blur']
}
],
phone: [
{
required: true,
message: '请输入采购用户手机号',
trigger: ['blur']
}
],
address: [
{
required: true,
message: '请输入采购用户地址',
trigger: ['blur']
}
],
arrival_time: [
{
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>

View File

@ -31,9 +31,14 @@
<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="预订单id" prop="bhoid" show-overflow-tooltip />
<el-table-column label="采购源id" prop="offer_id" show-overflow-tooltip />
<el-table-column label="溯源" width="150">
<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_info" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image