Commit 30399c1bf13f798e3438f698a16dbac010706a7c

Authored by 史婷婷
1 parent bbfcf68d

feat: 规格变更单-详情

... ... @@ -4,9 +4,7 @@
4 4 <view class="detail-page">
5 5 <view class="section">
6 6 <text class="row company">{{ form.orderNo }}</text>
7   - <view :class="['status', `status_${form.status}`]" />
8   - <view class="row"><text class="label">审核状态</text><text class="value act">{{ getDicName('AUDIT_STATUS',
9   - form.examineStatus, dicOptions.AUDIT_STATUS) }}</text></view>
  7 + <view :class="['status', `status_${form.examineStatus}`]" />
10 8 <view class="row"><text class="label">供货单位</text><text class="value">{{ getDicName('SUPPLIER',
11 9 form.supplyUnit, dicOptions.SUPPLIER) }}</text></view>
12 10 <view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text>
... ... @@ -17,9 +15,14 @@
17 15 <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryMethod }}</text></view>
18 16 </view>
19 17
20   - <!-- 产品 -->
  18 + <!-- 产品-变更前 -->
21 19 <view class="mgb10">
22   - <Product mode="view" :options="genderOptions" :list="form.purchaseOrderLineList" :totalQuantity="form.totalQuantity || 0" />
  20 + <Product title="变更前" mode="view" :options="genderOptions" :list="form.beforeChangeSpecList" :totalQuantity="form.totalQuantity || 0" />
  21 + </view>
  22 +
  23 + <!-- 产品-变更后 -->
  24 + <view class="mgb10">
  25 + <Product title="变更后" mode="view" :options="genderOptions" :list="form.afterChangeSpecList" :totalQuantity="form.afterTotalQuantity || 0" />
23 26 </view>
24 27
25 28 <view class="section">
... ... @@ -52,7 +55,7 @@
52 55 </template>
53 56
54 57 <script>
55   -import { getDetailApi, cancelApi } from '@/api/change_list.js'
  58 +import { getDetailApi, cancelApi, confirmApi } from '@/api/change_list.js'
56 59 import Product from './product.vue'
57 60 import DetailButtons from '@/components/detail-buttons/index.vue'
58 61 import {
... ... @@ -76,7 +79,7 @@ export default {
76 79 { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
77 80 { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
78 81 { text: '审核', visible: true, variant: 'primary', event: 'audit' },
79   - { text: '申请发货', visible: true, variant: 'outline', event: 'shipmentApply' },
  82 + { text: '确认变更', visible: true, variant: 'outline', event: 'confirmChange' },
80 83 { text: '取消', visible: true, variant: 'outline', event: 'cancel', style: { color: 'rgba(0,0,0,0.9)', border: '1px solid #DCDCDC' } },
81 84 ],
82 85 dicOptions: {
... ... @@ -88,26 +91,25 @@ export default {
88 91 },
89 92 computed: {
90 93 statusFlags() {
91   - const s = String((this.form && this.form.status) || '')
92   - const e = String((this.form && this.form.examineStatus) || '')
93   - const d = (this.form && this.form.showExamine) || false
  94 + const m = this.form || {}
  95 + const e = String(m.examineStatus || '')
94 96 return {
95 97 isRefuse: e === 'REFUSE',
96 98 isAudit: e === 'AUDIT',
97   - canExamine: d,
98   - canDeliveryApply: s === 'ISSUED',
99   - contractCreateBy: this.form.contractCreateBy
  99 + canEdit: e === 'REFUSE' && !!m.changeCreateBy,
  100 + canAudit: e === 'AUDIT' && !!m.showExamine,
  101 + canCancel: e === 'REFUSE',
  102 + canConfirmChange: e === 'REFUSE' && !!m.output
100 103 }
101 104 },
102 105 displayButtons() {
103   - const f = this.statusFlags;
104   - console.log('displayButtons__f', f)
  106 + const f = this.statusFlags
105 107 return [
106   - { ...this.buttons[0], visible: f.isRefuse && f.contractCreateBy },
  108 + { ...this.buttons[0], visible: f.canEdit },
107 109 { ...this.buttons[1], visible: true },
108   - { ...this.buttons[2], visible: f.isAudit && f.canExamine },
109   - { ...this.buttons[3], visible: f.canDeliveryApply },
110   - { ...this.buttons[4], visible: f.isRefuse },
  110 + { ...this.buttons[2], visible: f.canAudit },
  111 + { ...this.buttons[3], visible: f.canConfirmChange },
  112 + { ...this.buttons[4], visible: f.canCancel },
111 113 ]
112 114 }
113 115 },
... ... @@ -134,7 +136,7 @@ export default {
134 136 edit: () => this.onEdit(),
135 137 auditDetail: () => this.onAuditDetail(),
136 138 audit: () => this.onAudit(),
137   - shipmentApply: () => this.onShipmentApply(),
  139 + confirmChange: () => this.onConfirmChange(),
138 140 cancel: () => this.onCancel(),
139 141 }
140 142 const fn = map[btn.event]
... ... @@ -158,10 +160,25 @@ export default {
158 160 uni.setStorageSync(CACHE_KEY, this.getBusinessId())
159 161 uni.navigateTo({ url: '/pages/flow/audit' })
160 162 },
161   - onShipmentApply() {
162   - const id = this.getBusinessId()
163   - const query = id ? ('?id=' + encodeURIComponent(id)) : ''
164   - uni.navigateTo({ url: '/pages/order_list/shipment_apply' + query })
  163 + onConfirmChange() {
  164 + const id = this.getBusinessId();
  165 + if (!id) return
  166 + uni.showModal({
  167 + title: '系统提示',
  168 + content: '是否确定确认变更?',
  169 + confirmText: '确定',
  170 + cancelText: '取消',
  171 + success: (res) => {
  172 + if (res && res.confirm) {
  173 + confirmApi(id).then(() => {
  174 + uni.showToast({ title: '已确认变更', icon: 'none' })
  175 + setTimeout(() => { uni.redirectTo({ url: '/pages/change_list/index' }) }, 300)
  176 + }).catch(() => {
  177 + uni.showToast({ title: '确认变更失败', icon: 'none' })
  178 + })
  179 + }
  180 + }
  181 + })
165 182 },
166 183 onCancel() {
167 184 const id = this.getBusinessId()
... ... @@ -183,18 +200,6 @@ export default {
183 200 }
184 201 })
185 202 },
186   - getCategoryClass(categoryName) {
187   - if (!categoryName) return ''
188   - if (categoryName.includes('A') || categoryName.includes('a')) {
189   - return 'category_A'
190   - } else if (categoryName.includes('B') || categoryName.includes('b')) {
191   - return 'category_B'
192   - } else if (categoryName.includes('C') || categoryName.includes('c')) {
193   - return 'category_C'
194   - } else if (categoryName.includes('D') || categoryName.includes('d')) {
195   - return 'category_D'
196   - }
197   - },
198 203 loadAllDicData() {
199 204 const dicCodes = ['AUDIT_STATUS', 'SUPPLIER', 'APPLICABLE_STANDARD']
200 205 return getDicByCodes(dicCodes).then(results => {
... ... @@ -246,29 +251,20 @@ export default {
246 251 background-size: 100% 100%;
247 252 background-position: center;
248 253
249   - // 已下发
250   - &_ISSUED {
251   - background-image: url('~@/static/images/order_list/status_ISSUED.png');
252   - }
253   -
254   - // 待发货
255   - &_WAIT {
256   - background-image: url('~@/static/images/order_list/status_WAIT.png');
  254 + &_AUDIT {
  255 + background-image: url('~@/static/images/dev_manage/status_1.png');
257 256 }
258 257
259   - // 部分发货
260   - &_TRANSIT {
261   - background-image: url('~@/static/images/order_list/status_TRANSIT.png');
  258 + &_PASS {
  259 + background-image: url('~@/static/images/dev_manage/status_2.png');
262 260 }
263 261
264   - // 发货完成
265   - &_SHIPPED {
266   - background-image: url('~@/static/images/order_list/status_SHIPPED.png');
  262 + &_REFUSE {
  263 + background-image: url('~@/static/images/dev_manage/status_3.png');
267 264 }
268 265
269   - // 已签收
270   - &_DELIVERED {
271   - background-image: url('~@/static/images/order_list/status_DELIVERED.png');
  266 + &_CANCEL {
  267 + background-image: url('~@/static/images/dev_manage/status_4.png');
272 268 }
273 269
274 270 }
... ...
... ... @@ -14,7 +14,7 @@
14 14 <CardList ref="cardRef" :fetchFn="fetchList" :query="query" :extra="extraParams" :enable-refresh="true"
15 15 :enable-load-more="true" row-key="id" @loaded="onLoaded" @error="onError">
16 16 <template v-slot="{ item }">
17   - <view class="card">
  17 + <view class="card" @click.stop="onCardClick(item)">
18 18 <view class="card-header">
19 19 <text class="title omit2">{{ item.orderingUnitName }}</text>
20 20 <text v-if="item.examineStatus" :class="['status', `status_${item.examineStatus}`]">{{ filterStatus(item.examineStatus)
... ... @@ -167,6 +167,14 @@ export default {
167 167 url: '/pages/change_list/add'
168 168 })
169 169 },
  170 + onCardClick(item) {
  171 + const id = (item && (item.id || item.code)) || ''
  172 + if (!id) return
  173 + const query = '?id=' + encodeURIComponent(id)
  174 + uni.navigateTo({
  175 + url: '/pages/change_list/detail' + query
  176 + })
  177 + },
170 178 }
171 179 }
172 180 </script>
... ...
... ... @@ -4,7 +4,7 @@
4 4 <!-- 新增&详情-产品 -->
5 5 <view class="header bp">
6 6 <image class="opCollapse" src="/static/images/title.png" />
7   - <text class="title">产品</text>
  7 + <text class="title">{{ title || '产品' }}</text>
8 8 <view class="ops">
9 9 <image v-if="mode === 'add'" class="opAdd" @click="onAdd" src="/static/images/plus.png" />
10 10 <view v-if="mode === 'view'" class="op1" @click="toggleViewCollapse">
... ...