Commit bb240e75aa3e873f35001dd905365a151d70c647

Authored by 史婷婷
1 parent 3ebbbdd9

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.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.rawProductName || '请选择原材料名称'" showArrow>
  19 + <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.rawProductName || '请选择原材料名称'" 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.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.rawProductName || '请选择原材料名称'" showArrow>
  36 + <uni-list-item class="select-item" :class="item.rawProductName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.rawProductName || '请选择原材料名称'" showArrow>
37 37 <template v-slot:body>
38 38 <view class="item-title"><text>原材料名称</text></view>
39 39 </template>
... ... @@ -159,6 +159,12 @@
159 159 <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" />
160 160 </template>
161 161 </uni-list-item>
  162 + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable
  163 + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow>
  164 + <template v-slot:body>
  165 + <view class="item-title"><text>是否为试样订单</text></view>
  166 + </template>
  167 + </uni-list-item>
162 168 </uni-list>
163 169 <view class="block-ops">
164 170 <div class="del" @click="onRemove(idx)">
... ... @@ -218,6 +224,7 @@
218 224 <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
219 225 }}</text></view>
220 226 <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view>
  227 + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view>
221 228 </view>
222 229 </view>
223 230 <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" />
... ... @@ -305,7 +312,7 @@ export default {
305 312 },
306 313 methods: {
307 314 defaultItem() {
308   - return { productId:'', productName:'', productGrade:'', productStatus:'', rawProductId: '', rawProductName: '', rawProductGrade: '', industry: '',materialProductRatioRemarks:'', supplyTime: '存料加工', materialProductRatio: '', materialProductRatioName: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }
  315 + return { productId:'', productName:'', productGrade:'', productStatus:'', rawProductId: '', rawProductName: '', rawProductGrade: '', industry: '',materialProductRatioRemarks:'', supplyTime: '存料加工', materialProductRatio: '', materialProductRatioName: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '', sampleOrder: '' }
309 316 },
310 317 onNumberInput(idx, field) {
311 318 const it = this.items[idx]
... ... @@ -416,11 +423,25 @@ export default {
416 423 const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
417 424 return [t, w, l].filter(Boolean).join(' × ')
418 425 },
419   - openProductSheet(idx) {
420   - const opts = this.rawProductOptions
421   - const current = this.items[idx] && this.items[idx].rawProductId
422   - const match = opts.find(o => String(o.value) === String(current))
423   - this.sheet = { ...this.sheet, visible: true, title: '请选择原材料名称', options: opts, idx, value: match ? match.value : '', mode: 'product' }
  426 + openProductSheet(idx, mode = 'product') {
  427 + let opts = []
  428 + let title = ''
  429 + let value = ''
  430 + const item = this.items[idx]
  431 +
  432 + if (mode === 'product') {
  433 + opts = this.rawProductOptions
  434 + const current = item && item.rawProductId
  435 + const match = opts.find(o => String(o.value) === String(current))
  436 + value = match ? match.value : ''
  437 + title = '请选择原材料名称'
  438 + } else if (mode === 'sampleOrder') {
  439 + opts = [{ label: '是', value: true }, { label: '否', value: false }]
  440 + value = item.sampleOrder
  441 + title = '是否为试样订单'
  442 + }
  443 +
  444 + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode }
424 445 },
425 446 openProductGradeSheet(idx) {
426 447 const it = this.items[idx]
... ... @@ -468,6 +489,8 @@ export default {
468 489 } else if (this.sheet.mode === 'target') {
469 490 it.productId = value
470 491 it.productName = label || ''
  492 + } else if (this.sheet.mode === 'sampleOrder') {
  493 + it.sampleOrder = value
471 494 }
472 495 this.$set(this.items, idx, it)
473 496 this.sheet.visible = false
... ...