Commit 25781bcb205b37b0345e3d21d7ad20b687e77eee
Merge branch 'cjerp-1.0' of http://gitlab.qgutech.com/zhuyuanliang/erp-mobile into cjerp-1.0
Showing
2 changed files
with
704 additions
and
2 deletions
| @@ -73,15 +73,18 @@ | @@ -73,15 +73,18 @@ | ||
| 73 | </view> | 73 | </view> |
| 74 | </view> | 74 | </view> |
| 75 | </scroll-view> | 75 | </scroll-view> |
| 76 | + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> | ||
| 76 | </view> | 77 | </view> |
| 77 | </template> | 78 | </template> |
| 78 | 79 | ||
| 79 | <script> | 80 | <script> |
| 80 | import { getContractApi } from '@/api/contract' | 81 | import { getContractApi } from '@/api/contract' |
| 81 | import ProductRel from './productRel.vue' | 82 | import ProductRel from './productRel.vue' |
| 83 | +import DetailButtons from '@/components/detail-buttons/index.vue' | ||
| 84 | + | ||
| 82 | export default { | 85 | export default { |
| 83 | name: 'ContractRetailDetail', | 86 | name: 'ContractRetailDetail', |
| 84 | - components: { ProductRel }, | 87 | + components: { ProductRel, DetailButtons }, |
| 85 | data() { | 88 | data() { |
| 86 | return { | 89 | return { |
| 87 | id: '', | 90 | id: '', |
| @@ -119,15 +122,77 @@ export default { | @@ -119,15 +122,77 @@ export default { | ||
| 119 | component: '', | 122 | component: '', |
| 120 | packaging: '' | 123 | packaging: '' |
| 121 | }, | 124 | }, |
| 122 | - productList: [] | 125 | + productList: [], |
| 126 | + buttons: [{ | ||
| 127 | + text: '编辑', | ||
| 128 | + visible: true, | ||
| 129 | + variant: 'outline', | ||
| 130 | + event: 'edit', | ||
| 131 | + }, | ||
| 132 | + { | ||
| 133 | + text: '删除', | ||
| 134 | + visible: true, | ||
| 135 | + variant: 'outline', | ||
| 136 | + event: 'delete', | ||
| 137 | + style: { | ||
| 138 | + color: '#D54941', | ||
| 139 | + border: '1px solid #D54941' | ||
| 140 | + } | ||
| 141 | + }, | ||
| 142 | + { | ||
| 143 | + text: '上传合同附件', | ||
| 144 | + visible: true, | ||
| 145 | + variant: 'outline', | ||
| 146 | + event: 'upload' | ||
| 147 | + }, | ||
| 148 | + { | ||
| 149 | + text: '审核', | ||
| 150 | + visible: true, | ||
| 151 | + variant: 'primary', | ||
| 152 | + event: 'audit' | ||
| 153 | + }, | ||
| 154 | + { | ||
| 155 | + text: '审核详情', | ||
| 156 | + visible: true, | ||
| 157 | + variant: 'primary', | ||
| 158 | + event: 'auditDetail' | ||
| 159 | + }, | ||
| 160 | + ], | ||
| 123 | } | 161 | } |
| 124 | }, | 162 | }, |
| 163 | + computed: { | ||
| 164 | + displayButtons() { | ||
| 165 | + const s = this.detail && this.detail.status || '' | ||
| 166 | + const t = this.detail.standardApproved || '' | ||
| 167 | + return [ | ||
| 168 | + { ...this.buttons[0]}, | ||
| 169 | + // { ...this.buttons[0], visible: (s === 'DRAFT') }, | ||
| 170 | + { ...this.buttons[1], visible: (s === 'DRAFT') }, | ||
| 171 | + { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS') }, | ||
| 172 | + { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') }, | ||
| 173 | + { ...this.buttons[4], visible: (s === 'STANDARD') } | ||
| 174 | + ] | ||
| 175 | + } | ||
| 176 | + }, | ||
| 125 | onLoad(options) { | 177 | onLoad(options) { |
| 126 | const id = options && options.id ? options.id : '' | 178 | const id = options && options.id ? options.id : '' |
| 127 | this.id = id | 179 | this.id = id |
| 128 | this.loadDetail() | 180 | this.loadDetail() |
| 129 | }, | 181 | }, |
| 130 | methods: { | 182 | methods: { |
| 183 | + onEdit() { | ||
| 184 | + const id = this.detail.id || this.detail.code || '' | ||
| 185 | + const query = id ? ('?id=' + encodeURIComponent(id)) : '' | ||
| 186 | + uni.navigateTo({ | ||
| 187 | + url: '/pages/contract_retail/modify' + query | ||
| 188 | + }) | ||
| 189 | + }, | ||
| 190 | + handleButtonClick(btn) { | ||
| 191 | + if (!btn || btn.disabled) return | ||
| 192 | + if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) | ||
| 193 | + const e = btn.event || '' | ||
| 194 | + if (e === 'edit') return this.onEdit(btn && btn.params) | ||
| 195 | + }, | ||
| 131 | async loadDetail() { | 196 | async loadDetail() { |
| 132 | if (!this.id) return | 197 | if (!this.id) return |
| 133 | try { | 198 | try { |
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <uni-list> | ||
| 5 | + <uni-list-item title="编号"> | ||
| 6 | + <template v-slot:footer> | ||
| 7 | + <uni-easyinput v-model="form.code" :inputBorder="false" disabled /> | ||
| 8 | + </template> | ||
| 9 | + </uni-list-item> | ||
| 10 | + | ||
| 11 | + <uni-list-item class="select-item" :class="form.supplier ? 'is-filled' : 'is-empty'" clickable | ||
| 12 | + @click="openSheet('supplier')" :rightText="displayLabel('supplierName')" showArrow> | ||
| 13 | + <template v-slot:body> | ||
| 14 | + <view class="item-title"><text class="required">*</text><text>供方</text></view> | ||
| 15 | + </template> | ||
| 16 | + </uni-list-item> | ||
| 17 | + | ||
| 18 | + <uni-list-item class="select-item" :class="form.buyer ? 'is-filled' : 'is-empty'" clickable | ||
| 19 | + @click="openRelate('buyer')" :rightText="form.buyerName || '请选择需方'" showArrow> | ||
| 20 | + <template v-slot:body> | ||
| 21 | + <view class="item-title"><text class="required">*</text><text>需方</text></view> | ||
| 22 | + </template> | ||
| 23 | + </uni-list-item> | ||
| 24 | + | ||
| 25 | + <uni-list-item title="订货日期"> | ||
| 26 | + <template v-slot:footer> | ||
| 27 | + <uni-datetime-picker type="date" v-model="form.orderDate" /> | ||
| 28 | + </template> | ||
| 29 | + </uni-list-item> | ||
| 30 | + | ||
| 31 | + <uni-list-item title="单位"> | ||
| 32 | + <template v-slot:footer> | ||
| 33 | + <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> | ||
| 34 | + </template> | ||
| 35 | + </uni-list-item> | ||
| 36 | + | ||
| 37 | + <!-- <ProductRel mode="add" :orderDateBase="form.orderDate" v-model="productLineList" @change="onProductsChange" :options="productList" /> --> | ||
| 38 | + | ||
| 39 | + <uni-list-item title="合计人民币金额(大写)"> | ||
| 40 | + <template v-slot:footer> | ||
| 41 | + <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" | ||
| 42 | + disabled /> | ||
| 43 | + </template> | ||
| 44 | + </uni-list-item> | ||
| 45 | + <uni-list-item title="交付定金、数额、时间"> | ||
| 46 | + <template v-slot:footer> | ||
| 47 | + <uni-easyinput v-model="form.depositInfo" placeholder="请输入交付定金、数额、时间" :inputBorder="false" /> | ||
| 48 | + </template> | ||
| 49 | + </uni-list-item> | ||
| 50 | + <uni-list-item title="包装要求"> | ||
| 51 | + <template v-slot:footer> | ||
| 52 | + <uni-easyinput v-model="form.packagingRequirements" placeholder="请输入包装要求" | ||
| 53 | + :inputBorder="false" /> | ||
| 54 | + </template> | ||
| 55 | + </uni-list-item> | ||
| 56 | + <uni-list-item title="付款方式、付款期限"> | ||
| 57 | + <template v-slot:footer> | ||
| 58 | + <uni-easyinput v-model="form.paymentTerms" placeholder="请输入付款方式、付款期限" :inputBorder="false" /> | ||
| 59 | + </template> | ||
| 60 | + </uni-list-item> | ||
| 61 | + <uni-list-item title="运输方式"> | ||
| 62 | + <template v-slot:footer> | ||
| 63 | + <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> | ||
| 64 | + </template> | ||
| 65 | + </uni-list-item> | ||
| 66 | + <uni-list-item title="目的地"> | ||
| 67 | + <template v-slot:footer> | ||
| 68 | + <uni-easyinput v-model="form.destinationId" placeholder="请输入目的地" :inputBorder="false" /> | ||
| 69 | + </template> | ||
| 70 | + </uni-list-item> | ||
| 71 | + | ||
| 72 | + <uni-list-item class="select-item" :class="form.includesPackagingFeeName ? 'is-filled' : 'is-empty'" | ||
| 73 | + clickable @click="openSheet('includesPackagingFee')" | ||
| 74 | + :rightText="form.includesPackagingFeeName || '请选择'" showArrow> | ||
| 75 | + <template v-slot:body> | ||
| 76 | + <view class="item-title"><text>单价中是否已包含包装费</text></view> | ||
| 77 | + </template> | ||
| 78 | + </uni-list-item> | ||
| 79 | + <uni-list-item class="select-item" :class="form.includesTransportFeeName ? 'is-filled' : 'is-empty'" | ||
| 80 | + clickable @click="openSheet('includesTransportFee')" | ||
| 81 | + :rightText="form.includesTransportFeeName || '请选择'" showArrow> | ||
| 82 | + <template v-slot:body> | ||
| 83 | + <view class="item-title"><text>单价中是否已包含运费</text></view> | ||
| 84 | + </template> | ||
| 85 | + </uni-list-item> | ||
| 86 | + <uni-list-item title="需方指定收货人"> | ||
| 87 | + <template v-slot:footer> | ||
| 88 | + <uni-easyinput v-model="form.designatedConsignee" placeholder="请输入需方指定收货人" | ||
| 89 | + :inputBorder="false" /> | ||
| 90 | + </template> | ||
| 91 | + </uni-list-item> | ||
| 92 | + | ||
| 93 | + <view class="group"> | ||
| 94 | + <view class="group-title">特别条款要求</view> | ||
| 95 | + <view class="radio-list"> | ||
| 96 | + <view v-for="(opt, i) in specialTermsList" :key="'cr-' + i" class="radio-item" | ||
| 97 | + @click="onRadioSelect('specialTerms', 'specialTermsName', opt)"> | ||
| 98 | + <view :class="['radio', { checked: form.specialTerms === opt.value }]" /> | ||
| 99 | + <text class="label">{{ opt.label }}</text> | ||
| 100 | + </view> | ||
| 101 | + </view> | ||
| 102 | + </view> | ||
| 103 | + <view class="group"> | ||
| 104 | + <view class="group-title">执行标准</view> | ||
| 105 | + <view class="radio-list"> | ||
| 106 | + <view v-for="(opt, i) in executionStandardList" :key="'es-' + i" class="radio-item" | ||
| 107 | + @click="onRadioSelect('executionStandard', 'executionStandardName', opt)"> | ||
| 108 | + <view :class="['radio', { checked: form.executionStandard === opt.value }]" /> | ||
| 109 | + <text class="label">{{ opt.label }}</text> | ||
| 110 | + </view> | ||
| 111 | + </view> | ||
| 112 | + </view> | ||
| 113 | + <uni-list-item v-if="form.executionStandard === 'OTHER'" title="其他"> | ||
| 114 | + <template v-slot:footer> | ||
| 115 | + <uni-easyinput v-model="form.executionStandardRemarks" placeholder="请输入其他标准备注" | ||
| 116 | + :inputBorder="false" /> | ||
| 117 | + </template> | ||
| 118 | + </uni-list-item> | ||
| 119 | + <uni-list-item title="特别说明"> | ||
| 120 | + <template v-slot:footer> | ||
| 121 | + <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> | ||
| 122 | + </template> | ||
| 123 | + </uni-list-item> | ||
| 124 | + <uni-list-item title="备注"> | ||
| 125 | + <template v-slot:footer> | ||
| 126 | + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | ||
| 127 | + </template> | ||
| 128 | + </uni-list-item> | ||
| 129 | + | ||
| 130 | + <view class="quality"> | ||
| 131 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 132 | + <text class="title">具体质量要求</text> | ||
| 133 | + </view> | ||
| 134 | + <uni-list-item title="件重条头"> | ||
| 135 | + <template v-slot:footer> | ||
| 136 | + <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | ||
| 137 | + </template> | ||
| 138 | + </uni-list-item> | ||
| 139 | + <uni-list-item title="表面"> | ||
| 140 | + <template v-slot:footer> | ||
| 141 | + <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | ||
| 142 | + </template> | ||
| 143 | + </uni-list-item> | ||
| 144 | + <uni-list-item title="公差"> | ||
| 145 | + <template v-slot:footer> | ||
| 146 | + <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | ||
| 147 | + </template> | ||
| 148 | + </uni-list-item> | ||
| 149 | + <uni-list-item title="性能"> | ||
| 150 | + <template v-slot:footer> | ||
| 151 | + <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | ||
| 152 | + </template> | ||
| 153 | + </uni-list-item> | ||
| 154 | + <uni-list-item title="成分"> | ||
| 155 | + <template v-slot:footer> | ||
| 156 | + <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | ||
| 157 | + </template> | ||
| 158 | + </uni-list-item> | ||
| 159 | + <uni-list-item title="包装"> | ||
| 160 | + <template v-slot:footer> | ||
| 161 | + <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | ||
| 162 | + </template> | ||
| 163 | + </uni-list-item> | ||
| 164 | + </uni-list> | ||
| 165 | + </scroll-view> | ||
| 166 | + <view class="footer"> | ||
| 167 | + <div class="total"> | ||
| 168 | + <div class="total-text">合计</div> | ||
| 169 | + <div class="total-item"> | ||
| 170 | + <div class="total-item-text">数量</div> | ||
| 171 | + <div class="total-item-price">{{ (sumQuantity || 0).toFixed(2) }}t</div> | ||
| 172 | + </div> | ||
| 173 | + <div class="total-item"> | ||
| 174 | + <div class="total-item-text">不含税金额</div> | ||
| 175 | + <div class="total-item-price text-red">¥{{ (sumAmountExcl || 0).toFixed(2) }}</div> | ||
| 176 | + </div> | ||
| 177 | + <div class="total-item"> | ||
| 178 | + <div class="total-item-text">总金额</div> | ||
| 179 | + <div class="total-item-price text-red">¥{{ (sumTotal || 0).toFixed(2) }}</div> | ||
| 180 | + </div> | ||
| 181 | + </div> | ||
| 182 | + <button class="btn submit" type="primary" @click="onSubmit">保存</button> | ||
| 183 | + </view> | ||
| 184 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" | ||
| 185 | + v-model="sheet.value" @confirm="onSheetConfirm" /> | ||
| 186 | + <RelateSelectSheet :visible.sync="relate.visible" :title="relate.title" :source="relate.source" | ||
| 187 | + :display-fields="relate.display" :multiple="relate.multiple" :row-key="relate.rowKey" | ||
| 188 | + :selectedKeys.sync="relate.selectedKeys" @confirm="onRelateConfirm" /> | ||
| 189 | + </view> | ||
| 190 | +</template> | ||
| 191 | + | ||
| 192 | +<script> | ||
| 193 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 194 | +import RelateSelectSheet from '@/components/relate-select/index.vue' | ||
| 195 | +import ProductRel from './productRel.vue' | ||
| 196 | +import { getContractApi } from '@/api/contract' | ||
| 197 | +import { getDicByCodes } from '@/utils/dic' | ||
| 198 | +import { formatCurrencyToChinese } from '@/utils/common' | ||
| 199 | + | ||
| 200 | +export default { | ||
| 201 | + name: 'ModifyContractRetail', | ||
| 202 | + components: { SingleSelectSheet, RelateSelectSheet, ProductRel }, | ||
| 203 | + data() { | ||
| 204 | + return { | ||
| 205 | + id: '', | ||
| 206 | + form: { | ||
| 207 | + id: '', | ||
| 208 | + code: '', | ||
| 209 | + supplier: '', | ||
| 210 | + supplierName: '', | ||
| 211 | + buyer: '', | ||
| 212 | + buyerName: '', | ||
| 213 | + orderDate: '', | ||
| 214 | + designatedConsignee: '', | ||
| 215 | + specialTerms: '', | ||
| 216 | + specialTermsName: '', | ||
| 217 | + executionStandard: '', | ||
| 218 | + executionStandardName: '', | ||
| 219 | + executionStandardRemarks: '', | ||
| 220 | + includesPackagingFee: false, | ||
| 221 | + includesPackagingFeeName: '', | ||
| 222 | + includesTransportFee: false, | ||
| 223 | + includesTransportFeeName: '', | ||
| 224 | + unit: '元、公斤、元/公斤', | ||
| 225 | + totalAmountCapital: '', | ||
| 226 | + depositInfo: '', | ||
| 227 | + packagingRequirements: '', | ||
| 228 | + paymentTerms: '', | ||
| 229 | + transportMode: '', | ||
| 230 | + destinationId: '', | ||
| 231 | + specialInstructions: '', | ||
| 232 | + remarks: '', | ||
| 233 | + pieceWeightHead: '', | ||
| 234 | + surface: '', | ||
| 235 | + tolerance: '', | ||
| 236 | + performance: '', | ||
| 237 | + component: '', | ||
| 238 | + packaging: '' | ||
| 239 | + }, | ||
| 240 | + supplierList: [], | ||
| 241 | + specialTermsList: [], | ||
| 242 | + executionStandardList: [], | ||
| 243 | + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }], | ||
| 244 | + sheet: { visible: false, title: '请选择', field: '', options: [], value: '' }, | ||
| 245 | + relate: { visible: false, title: '选择', source: '', display: [], multiple: false, rowKey: 'id', selectedKeys: [], fieldKey: '' }, | ||
| 246 | + sumQuantity: 0, | ||
| 247 | + sumAmountExcl: 0, | ||
| 248 | + sumTotal: 0, | ||
| 249 | + productLineList: [], | ||
| 250 | + productList: [] | ||
| 251 | + } | ||
| 252 | + }, | ||
| 253 | + onLoad(query) { | ||
| 254 | + this.id = (query && query.id) ? query.id : '' | ||
| 255 | + }, | ||
| 256 | + created() { | ||
| 257 | + this.loadSuppliers() | ||
| 258 | + this.loadExtraOptions() | ||
| 259 | + this.loadDetail() | ||
| 260 | + }, | ||
| 261 | + methods: { | ||
| 262 | + async loadDetail() { | ||
| 263 | + if (!this.id) return | ||
| 264 | + try { | ||
| 265 | + const res = await getContractApi(this.id) | ||
| 266 | + const data = res && res.data ? res.data : {} | ||
| 267 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 268 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 269 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 270 | + this.form = { | ||
| 271 | + ...this.form, | ||
| 272 | + id: m.id || '', | ||
| 273 | + code: m.code || '', | ||
| 274 | + supplier: m.supplier || '', | ||
| 275 | + supplierName: m.supplierName || '', | ||
| 276 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 277 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 278 | + orderDate: m.orderDate || '', | ||
| 279 | + designatedConsignee: m.designatedConsignee || '', | ||
| 280 | + specialTerms: m.specialTerms || '', | ||
| 281 | + specialTermsName: m.specialTermsName || '', | ||
| 282 | + executionStandard: m.executionStandard || '', | ||
| 283 | + executionStandardName: m.executionStandardName || '', | ||
| 284 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 285 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 286 | + includesPackagingFeeName, | ||
| 287 | + includesTransportFee: !!m.includesTransportFee, | ||
| 288 | + includesTransportFeeName, | ||
| 289 | + unit: m.unit || this.form.unit, | ||
| 290 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 291 | + depositInfo: m.depositInfo || '', | ||
| 292 | + packagingRequirements: m.packagingRequirements || '', | ||
| 293 | + paymentTerms: m.paymentTerms || '', | ||
| 294 | + transportMode: m.transportMode || '', | ||
| 295 | + destinationId: m.destinationId || '', | ||
| 296 | + specialInstructions: m.specialInstructions || '', | ||
| 297 | + remarks: m.remarks || '', | ||
| 298 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 299 | + surface: m.surface || '', | ||
| 300 | + tolerance: m.tolerance || '', | ||
| 301 | + performance: m.performance || '', | ||
| 302 | + component: m.component || '', | ||
| 303 | + packaging: m.packaging || '' | ||
| 304 | + } | ||
| 305 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 306 | + this.productLineList = lines | ||
| 307 | + this.onProductsChange(lines) | ||
| 308 | + } catch (e) { } | ||
| 309 | + }, | ||
| 310 | + onProductsChange(products) { | ||
| 311 | + const list = Array.isArray(products) ? products : [] | ||
| 312 | + const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) | ||
| 313 | + const sumE = list.reduce((acc, it) => acc + (parseFloat(it.amountExcludingTax) || 0), 0) | ||
| 314 | + const sumT = list.reduce((acc, it) => acc + (parseFloat(it.totalAmount) || 0), 0) | ||
| 315 | + this.sumQuantity = sumQ | ||
| 316 | + this.sumAmountExcl = sumE | ||
| 317 | + this.sumTotal = sumT | ||
| 318 | + this.form.totalAmountCapital = formatCurrencyToChinese(sumT) | ||
| 319 | + }, | ||
| 320 | + async loadSuppliers() { | ||
| 321 | + try { | ||
| 322 | + const results = await getDicByCodes(['SUPPLIER']) | ||
| 323 | + const items = results && results.SUPPLIER && results.SUPPLIER.data ? results.SUPPLIER.data : [] | ||
| 324 | + this.supplierList = items.map(it => ({ label: it.name, value: it.code })) | ||
| 325 | + } catch (e) { this.supplierList = [] } | ||
| 326 | + }, | ||
| 327 | + async loadExtraOptions() { | ||
| 328 | + try { | ||
| 329 | + const results = await getDicByCodes(['CONDITIONS_REQUIRED', 'APPLICABLE_STANDARD', 'CONTRACT_PRODUCT']) | ||
| 330 | + const c1 = results && results.CONDITIONS_REQUIRED && results.CONDITIONS_REQUIRED.data ? results.CONDITIONS_REQUIRED.data : [] | ||
| 331 | + const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] | ||
| 332 | + const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] | ||
| 333 | + this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) | ||
| 334 | + this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) | ||
| 335 | + this.productList = c3.map(it => ({ label: it.name, value: it.code })) | ||
| 336 | + } catch (e) { | ||
| 337 | + this.specialTermsList = [] | ||
| 338 | + this.executionStandardList = [] | ||
| 339 | + this.productList = [] | ||
| 340 | + } | ||
| 341 | + }, | ||
| 342 | + displayLabel(field) { | ||
| 343 | + const m = this.form | ||
| 344 | + const map = { supplierName: '请选择供方' } | ||
| 345 | + const val = m[field] | ||
| 346 | + return val ? String(val) : map[field] | ||
| 347 | + }, | ||
| 348 | + openSheet(field) { | ||
| 349 | + const setSheet = (title, options) => { | ||
| 350 | + const current = this.form[field] | ||
| 351 | + const match = (options || []).find(o => String(o.label) === String(current) || String(o.value) === String(current)) | ||
| 352 | + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' } | ||
| 353 | + } | ||
| 354 | + if (field === 'supplier') setSheet('供方', this.supplierList) | ||
| 355 | + if (field === 'includesPackagingFee') setSheet('单价中是否已包含包装费', this.yesNoList) | ||
| 356 | + if (field === 'includesTransportFee') setSheet('单价中是否已包含运费', this.yesNoList) | ||
| 357 | + }, | ||
| 358 | + onSheetConfirm({ value, label }) { | ||
| 359 | + const field = this.sheet.field | ||
| 360 | + if (!field) return | ||
| 361 | + const v = (value === undefined || value === null) ? '' : value | ||
| 362 | + this.form[field] = v | ||
| 363 | + this.form[field + 'Name'] = label || '' | ||
| 364 | + }, | ||
| 365 | + openRelate(fieldKey) { | ||
| 366 | + let config = {} | ||
| 367 | + if (fieldKey === 'buyer') { | ||
| 368 | + config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } | ||
| 369 | + } | ||
| 370 | + const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] | ||
| 371 | + this.sheet.visible = false | ||
| 372 | + this.relate = { ...this.relate, title: config.title, source: config.source, display: config.display, multiple: config.multiple, rowKey: config.rowKey, selectedKeys, fieldKey } | ||
| 373 | + this.$nextTick(() => { this.relate.visible = true }) | ||
| 374 | + }, | ||
| 375 | + onRelateConfirm({ items }) { | ||
| 376 | + const _fieldKey = this.relate.fieldKey | ||
| 377 | + const first = (items && items.length > 0) ? items[0] : null | ||
| 378 | + this.form[_fieldKey] = (first && first.id) ? first.id : '' | ||
| 379 | + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' | ||
| 380 | + }, | ||
| 381 | + onRadioSelect(field, nameField, opt) { | ||
| 382 | + const val = opt && opt.value != null ? opt.value : '' | ||
| 383 | + const label = opt && opt.label != null ? opt.label : '' | ||
| 384 | + this.form[field] = val | ||
| 385 | + this.form[nameField] = label | ||
| 386 | + if (field === 'executionStandard' && val !== 'OTHER') { | ||
| 387 | + this.form.executionStandardRemarks = '' | ||
| 388 | + } | ||
| 389 | + }, | ||
| 390 | + async onSubmit() { | ||
| 391 | + uni.showToast({ title: '暂未接入保存接口', icon: 'none' }) | ||
| 392 | + } | ||
| 393 | + } | ||
| 394 | +} | ||
| 395 | +</script> | ||
| 396 | + | ||
| 397 | +<style lang="scss" scoped> | ||
| 398 | +.total { | ||
| 399 | + .total-text { | ||
| 400 | + font-weight: 600; | ||
| 401 | + font-size: 32rpx; | ||
| 402 | + color: rgba(0, 0, 0, 0.9); | ||
| 403 | + padding-bottom: 28rpx; | ||
| 404 | + border-bottom: 2rpx solid #E7E7E7; | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + .total-item { | ||
| 408 | + display: flex; | ||
| 409 | + align-items: center; | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + .total-item-text { | ||
| 413 | + font-weight: 400; | ||
| 414 | + font-size: 28rpx; | ||
| 415 | + color: rgba(0, 0, 0, 0.6); | ||
| 416 | + line-height: 32rpx; | ||
| 417 | + width: 240rpx; | ||
| 418 | + padding: 24rpx 0; | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + .total-item-price { | ||
| 422 | + font-weight: 600; | ||
| 423 | + font-size: 32rpx; | ||
| 424 | + color: rgba(0, 0, 0, 0.9); | ||
| 425 | + line-height: 32rpx; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + .text-red { | ||
| 429 | + color: #D54941; | ||
| 430 | + } | ||
| 431 | +} | ||
| 432 | + | ||
| 433 | +.page { | ||
| 434 | + display: flex; | ||
| 435 | + flex-direction: column; | ||
| 436 | + height: 100%; | ||
| 437 | +} | ||
| 438 | + | ||
| 439 | +.scroll { | ||
| 440 | + flex: 1; | ||
| 441 | + padding: 12rpx 0 480rpx !important; | ||
| 442 | +} | ||
| 443 | + | ||
| 444 | +.footer { | ||
| 445 | + z-index: 2; | ||
| 446 | + position: fixed; | ||
| 447 | + left: 0; | ||
| 448 | + right: 0; | ||
| 449 | + bottom: 0; | ||
| 450 | + padding: 32rpx; | ||
| 451 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 452 | + background: #fff; | ||
| 453 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 454 | +} | ||
| 455 | + | ||
| 456 | +.footer .btn { | ||
| 457 | + height: 80rpx; | ||
| 458 | + line-height: 80rpx; | ||
| 459 | + border-radius: 12rpx; | ||
| 460 | + font-size: 32rpx; | ||
| 461 | +} | ||
| 462 | + | ||
| 463 | +.footer .submit { | ||
| 464 | + background: $theme-primary; | ||
| 465 | + color: #fff; | ||
| 466 | +} | ||
| 467 | + | ||
| 468 | +.group { | ||
| 469 | + background: #fff; | ||
| 470 | + padding: 24rpx 32rpx; | ||
| 471 | + margin-bottom: 20rpx; | ||
| 472 | +} | ||
| 473 | + | ||
| 474 | +.group-title { | ||
| 475 | + color: rgba(0, 0, 0, 0.9); | ||
| 476 | + font-size: 32rpx; | ||
| 477 | + padding-bottom: 16rpx; | ||
| 478 | +} | ||
| 479 | + | ||
| 480 | +.radio-list { | ||
| 481 | + display: flex; | ||
| 482 | + flex-direction: column; | ||
| 483 | +} | ||
| 484 | +.quality { | ||
| 485 | + background-color: #fff; | ||
| 486 | + display: flex; | ||
| 487 | + align-items: center; | ||
| 488 | + padding: 24rpx 32rpx; | ||
| 489 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 490 | + margin-top: 20rpx; | ||
| 491 | + | ||
| 492 | + .title { | ||
| 493 | + font-size: 32rpx; | ||
| 494 | + color: rgba(0, 0, 0, 0.9); | ||
| 495 | + font-weight: 600; | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + .opCollapse { | ||
| 499 | + color: rgba(0, 0, 0, 0.6); | ||
| 500 | + width: 24rpx; | ||
| 501 | + height: 24rpx; | ||
| 502 | + margin-right: 16rpx; | ||
| 503 | + margin-top: 8rpx; | ||
| 504 | + } | ||
| 505 | +} | ||
| 506 | + | ||
| 507 | +.radio-item { | ||
| 508 | + display: flex; | ||
| 509 | + align-items: center; | ||
| 510 | + padding: 24rpx 0; | ||
| 511 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 512 | +} | ||
| 513 | + | ||
| 514 | +.radio-item:last-child { | ||
| 515 | + border-bottom: none; | ||
| 516 | +} | ||
| 517 | + | ||
| 518 | +.radio { | ||
| 519 | + width: 32rpx; | ||
| 520 | + height: 32rpx; | ||
| 521 | + border-radius: 50%; | ||
| 522 | + border: 2rpx solid #DCDCDC; | ||
| 523 | + margin-right: 20rpx; | ||
| 524 | + box-sizing: border-box; | ||
| 525 | +} | ||
| 526 | + | ||
| 527 | +.radio.checked { | ||
| 528 | + background: $theme-primary; | ||
| 529 | + border-color: $theme-primary; | ||
| 530 | +} | ||
| 531 | + | ||
| 532 | +.radio-item .label { | ||
| 533 | + font-size: 32rpx; | ||
| 534 | + color: rgba(0, 0, 0, 0.9); | ||
| 535 | +} | ||
| 536 | + | ||
| 537 | +::v-deep .uni-list { | ||
| 538 | + background: transparent; | ||
| 539 | +} | ||
| 540 | + | ||
| 541 | +::v-deep .uni-list .uni-easyinput .uni-input-input { | ||
| 542 | + color: rgba(0, 0, 0, 0.9); | ||
| 543 | +} | ||
| 544 | + | ||
| 545 | +::v-deep .uni-list .uni-input-placeholder { | ||
| 546 | + z-index: 1; | ||
| 547 | +} | ||
| 548 | + | ||
| 549 | +::v-deep .uni-list .uni-input-input { | ||
| 550 | + background-color: #ffffff; | ||
| 551 | +} | ||
| 552 | + | ||
| 553 | +::v-deep .uni-list-item__extra-text { | ||
| 554 | + font-size: 32rpx; | ||
| 555 | +} | ||
| 556 | + | ||
| 557 | +::v-deep .uni-list-item__content-title { | ||
| 558 | + font-size: 32rpx; | ||
| 559 | + color: rgba(0, 0, 0, 0.9); | ||
| 560 | +} | ||
| 561 | + | ||
| 562 | +::v-deep .uni-list-item__container { | ||
| 563 | + padding: 32rpx; | ||
| 564 | +} | ||
| 565 | + | ||
| 566 | +::v-deep .uni-list-item__container .uni-easyinput__placeholder-class { | ||
| 567 | + font-size: 32rpx; | ||
| 568 | + color: rgba(0, 0, 0, 0.4); | ||
| 569 | +} | ||
| 570 | + | ||
| 571 | +::v-deep .uni-list-item__container .uni-easyinput__content { | ||
| 572 | + border: none; | ||
| 573 | + background-color: #ffffff !important; | ||
| 574 | +} | ||
| 575 | + | ||
| 576 | +::v-deep .uni-list-item__container .uni-easyinput__content-input { | ||
| 577 | + padding-left: 0 !important; | ||
| 578 | + height: 48rpx; | ||
| 579 | + line-height: 48rpx; | ||
| 580 | + font-size: 32rpx; | ||
| 581 | +} | ||
| 582 | + | ||
| 583 | +::v-deep .uni-list-item__container .uni-easyinput__content .content-clear-icon { | ||
| 584 | + font-size: 44rpx !important; | ||
| 585 | +} | ||
| 586 | + | ||
| 587 | +::v-deep .uni-list-item__container .item-title, | ||
| 588 | +::v-deep .uni-list-item__container .uni-list-item__content { | ||
| 589 | + flex: none; | ||
| 590 | + min-height: 48rpx; | ||
| 591 | + line-height: 48rpx; | ||
| 592 | + font-size: 32rpx; | ||
| 593 | + position: relative; | ||
| 594 | + width: 162rpx; | ||
| 595 | + margin-right: 32rpx; | ||
| 596 | + color: rgba(0, 0, 0, 0.9); | ||
| 597 | +} | ||
| 598 | + | ||
| 599 | +::v-deep .uni-list-item__container .item-title .required { | ||
| 600 | + color: red; | ||
| 601 | + position: absolute; | ||
| 602 | + top: 50%; | ||
| 603 | + transform: translateY(-50%); | ||
| 604 | + left: -16rpx; | ||
| 605 | +} | ||
| 606 | + | ||
| 607 | +::v-deep .uni-list-item.select-item.is-empty .uni-list-item__extra-text { | ||
| 608 | + color: rgba(0, 0, 0, 0.4) !important; | ||
| 609 | +} | ||
| 610 | + | ||
| 611 | +::v-deep .uni-list-item.select-item.is-filled .uni-list-item__extra-text { | ||
| 612 | + color: rgba(0, 0, 0, 0.9) !important; | ||
| 613 | +} | ||
| 614 | +::v-deep .uni-easyinput { | ||
| 615 | + &__placeholder-class { | ||
| 616 | + font-size: 32rpx; | ||
| 617 | + color: rgba(0, 0, 0, 0.4); | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + &__content { | ||
| 621 | + border: none; | ||
| 622 | + background-color: #ffffff !important; | ||
| 623 | + height: 100%; | ||
| 624 | + &-input { | ||
| 625 | + padding-left: 0 !important; | ||
| 626 | + height: 48rpx; | ||
| 627 | + line-height: 48rpx; | ||
| 628 | + font-size: 32rpx; | ||
| 629 | + } | ||
| 630 | + | ||
| 631 | + .content-clear-icon { | ||
| 632 | + font-size: 44rpx !important; | ||
| 633 | + } | ||
| 634 | + } | ||
| 635 | + } | ||
| 636 | + | ||
| 637 | +</style> |