1
1
<template >
2
- <Dialog :title =" dialogTitle" v-model =" dialogVisible" width =" 1080 " >
2
+ <Dialog :title =" dialogTitle" v-model =" dialogVisible" width =" 1440 " >
3
3
<el-form
4
4
ref =" formRef"
5
5
:model =" formData"
25
25
/>
26
26
</el-form-item >
27
27
</el-col >
28
+ <el-col :span =" 8" >
29
+ <el-form-item label =" 关联订单" prop =" orderNo" >
30
+ <el-input v-model =" formData.orderNo" readonly >
31
+ <template #append >
32
+ <el-button @click =" openSaleOrderOutEnableList" >
33
+ <Icon icon =" ep:search" /> 选择
34
+ </el-button >
35
+ </template >
36
+ </el-input >
37
+ </el-form-item >
38
+ </el-col >
28
39
<el-col :span =" 8" >
29
40
<el-form-item label =" 客户" prop =" customerId" >
30
41
<el-select
44
55
</el-form-item >
45
56
</el-col >
46
57
<el-col :span =" 8" >
47
- <el-form-item label =" 关联订单" prop =" orderNo" >
48
- <el-input v-model =" formData.orderNo" readonly >
49
- <template #append >
50
- <el-button @click =" openSaleOrderOutEnableList" >
51
- <Icon icon =" ep:search" /> 选择
52
- </el-button >
53
- </template >
54
- </el-input >
58
+ <el-form-item label =" 销售人员" prop =" saleUserId" >
59
+ <el-select
60
+ v-model =" formData.saleUserId"
61
+ clearable
62
+ filterable
63
+ placeholder =" 请选择销售人员"
64
+ class =" !w-1/1"
65
+ >
66
+ <el-option
67
+ v-for =" item in userList"
68
+ :key =" item.id"
69
+ :label =" item.nickname"
70
+ :value =" item.id"
71
+ />
72
+ </el-select >
55
73
</el-form-item >
56
74
</el-col >
57
- <el-col :span =" 8 " >
75
+ <el-col :span =" 16 " >
58
76
<el-form-item label =" 备注" prop =" remark" >
59
77
<el-input
60
78
type =" textarea"
105
123
<el-input disabled v-model =" formData.totalPrice" :formatter =" erpPriceInputFormatter" />
106
124
</el-form-item >
107
125
</el-col >
126
+ <el-col :span =" 8" >
127
+ <el-form-item label =" 其它费用" prop =" otherPrice" >
128
+ <el-input-number
129
+ v-model =" formData.otherPrice"
130
+ controls-position =" right"
131
+ :min =" 0"
132
+ :precision =" 2"
133
+ placeholder =" 请输入其它费用"
134
+ class =" !w-1/1"
135
+ />
136
+ </el-form-item >
137
+ </el-col >
108
138
<el-col :span =" 8" >
109
139
<el-form-item label =" 结算账户" prop =" accountId" >
110
140
<el-select
124
154
</el-form-item >
125
155
</el-col >
126
156
<el-col :span =" 8" >
127
- <el-form-item label =" 收取订金 " prop =" depositPrice " >
157
+ <el-form-item label =" 本次收款 " prop =" payPrice " >
128
158
<el-input-number
129
- v-model =" formData.depositPrice "
159
+ v-model =" formData.payPrice "
130
160
controls-position =" right"
131
161
:min =" 0"
132
162
:precision =" 2"
133
- placeholder =" 请输入收取订金 "
163
+ placeholder =" 请输入本次收款 "
134
164
class =" !w-1/1"
135
165
/>
136
166
</el-form-item >
@@ -156,6 +186,7 @@ import { AccountApi, AccountVO } from '@/api/erp/finance/account'
156
186
import { erpPriceInputFormatter , erpPriceMultiply } from ' @/utils'
157
187
import SaleOrderOutEnableList from ' @/views/erp/sale/order/components/SaleOrderOutEnableList.vue'
158
188
import { SaleOrderVO } from ' @/api/erp/sale/order'
189
+ import * as UserApi from ' @/api/system/user'
159
190
160
191
/** ERP 销售出库表单 */
161
192
defineOptions ({ name: ' SaleOutForm' })
@@ -171,25 +202,29 @@ const formData = ref({
171
202
id: undefined ,
172
203
customerId: undefined ,
173
204
accountId: undefined ,
205
+ saleUserId: undefined ,
174
206
outTime: undefined ,
175
207
remark: undefined ,
176
208
fileUrl: ' ' ,
177
209
discountPercent: 0 ,
178
210
discountPrice: 0 ,
179
211
totalPrice: 0 ,
180
- depositPrice: 0 ,
212
+ otherPrice: 0 ,
213
+ payPrice: 0 ,
181
214
orderNo: undefined ,
182
215
items: [],
183
216
no: undefined // 出库单号,后端返回
184
217
})
185
218
const formRules = reactive ({
186
219
customerId: [{ required: true , message: ' 客户不能为空' , trigger: ' blur' }],
187
- outTime: [{ required: true , message: ' 出库时间不能为空' , trigger: ' blur' }]
220
+ outTime: [{ required: true , message: ' 出库时间不能为空' , trigger: ' blur' }],
221
+ payPrice: [{ required: true , message: ' 本次收款不能为空' , trigger: ' blur' }]
188
222
})
189
223
const disabled = computed (() => formType .value === ' detail' )
190
224
const formRef = ref () // 表单 Ref
191
225
const customerList = ref <CustomerVO []>([]) // 客户列表
192
226
const accountList = ref <AccountVO []>([]) // 账户列表
227
+ const userList = ref <UserApi .UserVO []>([]) // 用户列表
193
228
194
229
/** 子表的表单 */
195
230
const subTabsName = ref (' item' )
@@ -202,11 +237,17 @@ watch(
202
237
if (! val ) {
203
238
return
204
239
}
240
+ // 计算
205
241
const totalPrice = val .items .reduce ((prev , curr ) => prev + curr .totalPrice , 0 )
206
242
const discountPrice =
207
243
val .discountPercent != null ? erpPriceMultiply (totalPrice , val .discountPercent / 100.0 ) : 0
244
+ // debugger
245
+ // TODO 芋艿:这里有问题
246
+ const payPrice = totalPrice - discountPrice + val .otherPrice
247
+ // 赋值
208
248
formData .value .discountPrice = discountPrice
209
249
formData .value .totalPrice = totalPrice - discountPrice
250
+ formData .value .payPrice = payPrice
210
251
},
211
252
{ deep: true }
212
253
)
@@ -228,15 +269,14 @@ const open = async (type: string, id?: number) => {
228
269
}
229
270
// 加载客户列表
230
271
customerList .value = await CustomerApi .getCustomerSimpleList ()
272
+ // 加载用户列表
273
+ userList .value = await UserApi .getSimpleUserList ()
231
274
// 加载账户列表
232
275
accountList .value = await AccountApi .getAccountSimpleList ()
233
276
const defaultAccount = accountList .value .find ((item ) => item .defaultStatus )
234
277
if (defaultAccount ) {
235
278
formData .value .accountId = defaultAccount .id
236
279
}
237
-
238
- // TODO 芋艿:单独搞
239
- // saleOrderOutEnableListRef.value.open()
240
280
}
241
281
defineExpose ({ open }) // 提供 open 方法,用于打开弹窗
242
282
@@ -247,18 +287,17 @@ const openSaleOrderOutEnableList = () => {
247
287
}
248
288
249
289
const handleSaleOrderChange = (order : SaleOrderVO ) => {
250
- debugger
290
+ // 将订单设置到出库单
291
+ formData .value .orderId = order .id
251
292
formData .value .orderNo = order .no
252
- // formData.value.customerId = order.customerId
253
- // formData.value.accountId = order.accountId
254
- // formData.value.items = order.items.map((item) => {
255
- // return {
256
- // productId: item.productId,
257
- // count: item.count,
258
- // productPrice: item.productPrice,
259
- // taxPercent: item.taxPercent
260
- // }
261
- // })
293
+ formData .value .customerId = order .customerId
294
+ formData .value .accountId = order .accountId
295
+ formData .value .saleUserId = order .saleUserId
296
+ formData .value .discountPercent = order .discountPercent
297
+ formData .value .remark = order .remark
298
+ formData .value .fileUrl = order .fileUrl
299
+ // 将订单项设置到出库单项
300
+ formData .value .items = order .items .filter ((item ) => item .count > item .outCount )
262
301
}
263
302
264
303
/** 提交表单 */
@@ -292,13 +331,15 @@ const resetForm = () => {
292
331
id: undefined ,
293
332
customerId: undefined ,
294
333
accountId: undefined ,
334
+ saleUserId: undefined ,
295
335
outTime: undefined ,
296
336
remark: undefined ,
297
337
fileUrl: undefined ,
298
338
discountPercent: 0 ,
299
339
discountPrice: 0 ,
300
340
totalPrice: 0 ,
301
- depositPrice: 0 ,
341
+ otherPrice: 0 ,
342
+ payPrice: 0 ,
302
343
items: []
303
344
}
304
345
formRef .value ?.resetFields ()
0 commit comments