Commit e8cecdf946026830b76ddd24c73cfe059456549d
1 parent
eb46340f
feat: 外贸未锁规合同-xinz &编辑&查看-产品 是否为试样订单逻辑
Showing
1 changed file
with
39 additions
and
12 deletions
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | <view v-if="mode === 'add'" class="add-list"> | 16 | <view v-if="mode === 'add'" class="add-list"> |
| 17 | <view v-for="(item, idx) in items" :key="idx" class="block"> | 17 | <view v-for="(item, idx) in items" :key="idx" class="block"> |
| 18 | <uni-list v-show="item.collapsed"> | 18 | <uni-list v-show="item.collapsed"> |
| 19 | - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> | 19 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 20 | <template v-slot:body> | 20 | <template v-slot:body> |
| 21 | <view class="item-title"><text>产品名称</text></view> | 21 | <view class="item-title"><text>产品名称</text></view> |
| 22 | </template> | 22 | </template> |
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | </uni-list-item> | 33 | </uni-list-item> |
| 34 | </uni-list> | 34 | </uni-list> |
| 35 | <uni-list v-show="!item.collapsed"> | 35 | <uni-list v-show="!item.collapsed"> |
| 36 | - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> | 36 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 37 | <template v-slot:body> | 37 | <template v-slot:body> |
| 38 | <view class="item-title"><text>产品名称</text></view> | 38 | <view class="item-title"><text>产品名称</text></view> |
| 39 | </template> | 39 | </template> |
| @@ -137,6 +137,12 @@ | @@ -137,6 +137,12 @@ | ||
| 137 | <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> | 137 | <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> |
| 138 | </template> | 138 | </template> |
| 139 | </uni-list-item> | 139 | </uni-list-item> |
| 140 | + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable | ||
| 141 | + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow> | ||
| 142 | + <template v-slot:body> | ||
| 143 | + <view class="item-title"><text>是否为试样订单</text></view> | ||
| 144 | + </template> | ||
| 145 | + </uni-list-item> | ||
| 140 | </uni-list> | 146 | </uni-list> |
| 141 | <view class="block-ops"> | 147 | <view class="block-ops"> |
| 142 | <div class="del" @click="onRemove(idx)"> | 148 | <div class="del" @click="onRemove(idx)"> |
| @@ -191,6 +197,7 @@ | @@ -191,6 +197,7 @@ | ||
| 191 | <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) | 197 | <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) |
| 192 | }}</text></view> | 198 | }}</text></view> |
| 193 | <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> | 199 | <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> |
| 200 | + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view> | ||
| 194 | </view> | 201 | </view> |
| 195 | </view> | 202 | </view> |
| 196 | <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> | 203 | <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> |
| @@ -213,7 +220,7 @@ export default { | @@ -213,7 +220,7 @@ export default { | ||
| 213 | return { | 220 | return { |
| 214 | items: [], | 221 | items: [], |
| 215 | collapsedView: false, | 222 | collapsedView: false, |
| 216 | - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } | 223 | + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' } |
| 217 | } | 224 | } |
| 218 | }, | 225 | }, |
| 219 | computed: { | 226 | computed: { |
| @@ -262,7 +269,7 @@ export default { | @@ -262,7 +269,7 @@ export default { | ||
| 262 | }, | 269 | }, |
| 263 | methods: { | 270 | methods: { |
| 264 | defaultItem() { | 271 | defaultItem() { |
| 265 | - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '' } | 272 | + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '', sampleOrder: '' } |
| 266 | }, | 273 | }, |
| 267 | onNonNegativeInput(idx, field) { | 274 | onNonNegativeInput(idx, field) { |
| 268 | const it = this.items[idx] | 275 | const it = this.items[idx] |
| @@ -382,18 +389,38 @@ export default { | @@ -382,18 +389,38 @@ export default { | ||
| 382 | const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') | 389 | const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') |
| 383 | return [t, w, l].filter(Boolean).join(' × ') | 390 | return [t, w, l].filter(Boolean).join(' × ') |
| 384 | }, | 391 | }, |
| 385 | - openProductSheet(idx) { | ||
| 386 | - const opts = this.selectOptions | ||
| 387 | - const current = this.items[idx] && this.items[idx].productId | ||
| 388 | - const match = opts.find(o => o.value === current) | ||
| 389 | - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } | 392 | + openProductSheet(idx, mode = 'product') { |
| 393 | + let opts = [] | ||
| 394 | + let title = '' | ||
| 395 | + let value = '' | ||
| 396 | + const item = this.items[idx] | ||
| 397 | + | ||
| 398 | + if (mode === 'product') { | ||
| 399 | + opts = this.selectOptions | ||
| 400 | + const current = item && item.productId | ||
| 401 | + const match = opts.find(o => o.value === current) | ||
| 402 | + value = match ? match.value : '' | ||
| 403 | + title = '请选择产品' | ||
| 404 | + } else if (mode === 'sampleOrder') { | ||
| 405 | + opts = [{ label: '是', value: true }, { label: '否', value: false }] | ||
| 406 | + value = item.sampleOrder | ||
| 407 | + title = '是否为试样订单' | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode } | ||
| 390 | }, | 411 | }, |
| 391 | onProductConfirm({ value, label }) { | 412 | onProductConfirm({ value, label }) { |
| 392 | - const idx = this.sheet.idx | 413 | + const { idx, mode } = this.sheet |
| 393 | const it = this.items[idx] | 414 | const it = this.items[idx] |
| 394 | if (!it) { this.sheet.visible = false; return } | 415 | if (!it) { this.sheet.visible = false; return } |
| 395 | - it.productId = value | ||
| 396 | - it.productName = label || '' | 416 | + |
| 417 | + if (mode === 'product') { | ||
| 418 | + it.productId = value | ||
| 419 | + it.productName = label || '' | ||
| 420 | + } else if (mode === 'sampleOrder') { | ||
| 421 | + it.sampleOrder = value | ||
| 422 | + } | ||
| 423 | + | ||
| 397 | this.$set(this.items, idx, it) | 424 | this.$set(this.items, idx, it) |
| 398 | this.sheet.visible = false | 425 | this.sheet.visible = false |
| 399 | this.emitChange() | 426 | this.emitChange() |