Showing
1 changed file
with
30 additions
and
26 deletions
| ... | ... | @@ -138,7 +138,7 @@ |
| 138 | 138 | <view class="view-total"> |
| 139 | 139 | <view class="head">合计</view> |
| 140 | 140 | <view class="row"> |
| 141 | - <text class="label">总数量</text><text class="value">{{ form.totalQuantity }}</text> | |
| 141 | + <text class="label">总数量</text><text class="value">{{ form.afterTotalQuantity }}</text> | |
| 142 | 142 | </view> |
| 143 | 143 | </view> |
| 144 | 144 | <button class="btn submit" type="primary" @click="onSubmit">提交</button> |
| ... | ... | @@ -162,35 +162,30 @@ export default { |
| 162 | 162 | return { |
| 163 | 163 | id: '', |
| 164 | 164 | form: { |
| 165 | - code: '', | |
| 166 | - supplier: '', | |
| 167 | - buyer: '', | |
| 168 | - // 默认当前日期 格式为 yyyy-MM-dd | |
| 165 | + orderId: '', | |
| 166 | + purchaseOrderId: '', | |
| 167 | + orderNo: '', | |
| 168 | + supplyUnit: '', | |
| 169 | + orderingUnit: '', | |
| 169 | 170 | orderDate: new Date().toISOString().substring(0, 10), |
| 170 | - unit: '', | |
| 171 | - totalQuantity: '', | |
| 172 | - totalAmountExcludingTax: '', | |
| 173 | - totalAmountIncludingTax: '', | |
| 174 | - totalAmountCapital: '', | |
| 175 | - depositInfo: '', | |
| 176 | - packagingRequirements: '', | |
| 177 | - paymentTerms: '', | |
| 178 | - transportMode: '', | |
| 179 | - destinationId: [], | |
| 180 | - includesPackagingFee: '', | |
| 181 | - includesTransportFee: '', | |
| 182 | - designatedConsignee: '', | |
| 183 | - specialTerms: '', | |
| 171 | + workshopId: '', | |
| 172 | + settlementTerms: '', | |
| 173 | + deliveryMethod: '', | |
| 174 | + priceListNo: '', | |
| 175 | + invoicingStatus: '', | |
| 176 | + shippingCost: '', | |
| 177 | + packagingFee: '', | |
| 184 | 178 | executionStandard: '', |
| 185 | 179 | executionStandardRemarks: '', |
| 186 | - specialInstructions: '', | |
| 187 | - remarks: '', | |
| 188 | - pieceWeightHead: '', | |
| 180 | + totalQuantity: '', | |
| 181 | + afterTotalQuantity: '', | |
| 182 | + pieceWeightHeader: '', | |
| 189 | 183 | surface: '', |
| 190 | 184 | tolerance: '', |
| 191 | 185 | performance: '', |
| 192 | - component: '', | |
| 186 | + element: '', | |
| 193 | 187 | packaging: '', |
| 188 | + remarks: '', | |
| 194 | 189 | }, |
| 195 | 190 | initPurchaseOrderLineList: [], |
| 196 | 191 | dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] }, |
| ... | ... | @@ -216,8 +211,9 @@ export default { |
| 216 | 211 | const res = await getDetailApi(id) |
| 217 | 212 | const m = res.data || {} |
| 218 | 213 | const next = { ...this.form, ...m } |
| 219 | - next.id = m.id || m.code || id | |
| 220 | - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] | |
| 214 | + next.id = m.id || m.code || id; | |
| 215 | + next.purchaseOrderId = m.orderId || ''; | |
| 216 | + next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : [] | |
| 221 | 217 | this.form = next; |
| 222 | 218 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 223 | 219 | this.refreshStandardName() |
| ... | ... | @@ -248,7 +244,10 @@ export default { |
| 248 | 244 | getDicName: getDicName, |
| 249 | 245 | async onSubmit() { |
| 250 | 246 | const payload = { ...this.form } |
| 247 | + payload.orderSpecList = payload.purchaseOrderLineList || []; | |
| 248 | + delete payload.purchaseOrderLineList | |
| 251 | 249 | console.log('onSubmit__payload', payload) |
| 250 | + return | |
| 252 | 251 | try { |
| 253 | 252 | await updateApi(payload) |
| 254 | 253 | uni.showToast({ title: '保存成功', icon: 'success' }) |
| ... | ... | @@ -259,7 +258,12 @@ export default { |
| 259 | 258 | }, |
| 260 | 259 | purchaseOrderLineListChange(data) { |
| 261 | 260 | const list = Array.isArray(data) ? data : [] |
| 262 | - this.form.purchaseOrderLineList = list; | |
| 261 | + this.form.purchaseOrderLineList = list | |
| 262 | + const sum = list.reduce((acc, it) => { | |
| 263 | + const v = Number(it && it.quantity) | |
| 264 | + return acc + (isNaN(v) ? 0 : v) | |
| 265 | + }, 0) | |
| 266 | + this.form.afterTotalQuantity = sum | |
| 263 | 267 | }, |
| 264 | 268 | } |
| 265 | 269 | } | ... | ... |