Commit 3ebbbdd988b0f82295ab817993d0934da7952695

Authored by 史婷婷
1 parent d77880eb

feat: 经销未锁规合同-新增&编辑&查看-产品 是否为试样订单逻辑

... ... @@ -16,7 +16,7 @@
16 16 <view v-if="mode === 'add'" class="add-list">
17 17 <view v-for="(item, idx) in items" :key="idx" class="block">
18 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 20 <template v-slot:body>
21 21 <view class="item-title"><text>产品名称</text></view>
22 22 </template>
... ... @@ -33,7 +33,7 @@
33 33 </uni-list-item>
34 34 </uni-list>
35 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 37 <template v-slot:body>
38 38 <view class="item-title"><text>产品名称</text></view>
39 39 </template>
... ... @@ -132,6 +132,12 @@
132 132 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
133 133 </template>
134 134 </uni-list-item>
  135 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  136 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  137 + <template v-slot:body>
  138 + <view class="item-title"><text>是否为试样订单</text></view>
  139 + </template>
  140 + </uni-list-item>
135 141 </uni-list>
136 142 <view class="block-ops">
137 143 <div class="del" @click="onRemove(idx)">
... ... @@ -190,6 +196,7 @@
190 196 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
191 197 }}</text></view>
192 198 <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.sampleOrder ? '是' : '否' }}</text></view>
193 200 </view>
194 201 </view>
195 202 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
... ... @@ -212,7 +219,7 @@ export default {
212 219 return {
213 220 items: [],
214 221 collapsedView: false,
215   - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 }
  222 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' }
216 223 }
217 224 },
218 225 computed: {
... ... @@ -261,7 +268,7 @@ export default {
261 268 },
262 269 methods: {
263 270 defaultItem() {
264   - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }
  271 + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '', sampleOrder: '' }
265 272 },
266 273 onNonNegativeInput(idx, field) {
267 274 const it = this.items[idx]
... ... @@ -360,18 +367,38 @@ export default {
360 367 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
361 368 return [t, w, l].filter(Boolean).join(' × ')
362 369 },
363   - openProductSheet(idx) {
364   - const opts = this.selectOptions
365   - const current = this.items[idx] && this.items[idx].productId
366   - const match = opts.find(o => o.value === current)
367   - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' }
  370 + openProductSheet(idx, mode = 'product') {
  371 + let opts = []
  372 + let title = ''
  373 + let value = ''
  374 + const item = this.items[idx]
  375 +
  376 + if (mode === 'product') {
  377 + opts = this.selectOptions
  378 + const current = item && item.productId
  379 + const match = opts.find(o => o.value === current)
  380 + value = match ? match.value : ''
  381 + title = '请选择产品'
  382 + } else if (mode === 'sampleOrder') {
  383 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  384 + value = item.sampleOrder
  385 + title = '是否为试样订单'
  386 + }
  387 +
  388 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
368 389 },
369 390 onProductConfirm({ value, label }) {
370   - const idx = this.sheet.idx
  391 + const { idx, mode } = this.sheet
371 392 const it = this.items[idx]
372 393 if (!it) { this.sheet.visible = false; return }
373   - it.productId = value
374   - it.productName = label || ''
  394 +
  395 + if (mode === 'product') {
  396 + it.productId = value
  397 + it.productName = label || ''
  398 + } else if (mode === 'sampleOrder') {
  399 + it.sampleOrder = value
  400 + }
  401 +
375 402 this.$set(this.items, idx, it)
376 403 this.sheet.visible = false
377 404 this.emitChange()
... ... @@ -482,8 +509,8 @@ export default {
482 509
483 510 .opCollapse {
484 511 color: rgba(0, 0, 0, 0.6);
485   - width: 24rpx;
486   - height: 24rpx;
  512 + width: 32rpx;
  513 + height: 28rpx;
487 514 margin-right: 16rpx;
488 515 margin-top: 8rpx;
489 516 }
... ...