Commit c7cd86ee6ea3c0b6932d172a846f6b6d59873fe6

Authored by 史婷婷
1 parent 3cd8e51b

feat: 发货单增加逻辑:原发货日期&实际发货日期&是否当日发货&填写实发数&填写日期

... ... @@ -5,12 +5,14 @@
5 5 <view class="section">
6 6 <text class="row company">{{ form.customerName }}</text>
7 7 <view :class="['status', `status_${form.status}`]" />
8   - <view class="row"><text class="label">发货日期</text><text class="value">{{ form.shipmentsDate }}</text></view>
  8 + <view class="row"><text class="label">原发货日期</text><text class="value">{{ form.shipmentsDate }}</text></view>
  9 + <view class="row"><text class="label">实际发货日期</text><text class="value">{{ form.newShipmentDate }}</text></view>
9 10 <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
10 11 <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view>
11 12 <view class="row"><text class="label">区域</text><text class="value">{{ form.regionName }}</text></view>
12 13 <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryType }}</text></view>
13 14 <view class="row"><text class="label">目的地</text><text class="value">{{ form.destination }}</text></view>
  15 + <view class="row"><text class="label">是否当日发货</text><text class="value">{{ form.onTimeShipment === true ? '是' : (form.onTimeShipment === false ? '否' : '') }}</text></view>
14 16 </view>
15 17
16 18 <!-- 产品 -->
... ... @@ -41,6 +43,36 @@
41 43 </view>
42 44 </view>
43 45 </uni-popup>
  46 + <!-- 填写日期 -->
  47 + <uni-popup ref="fillDatePopup" type="bottom" :mask-click="false">
  48 + <view class="dialog">
  49 + <view class="dialog_header">
  50 + <text>填写日期</text>
  51 + <view class="dialog_close" @click="closeFillDateInfo"></view>
  52 + </view>
  53 + <view class="dialog_body fill-data_body">
  54 + <uni-list>
  55 + <uni-list-item title="原发货日期">
  56 + <template v-slot:footer>
  57 + <view class="value">{{ fillDateForm.shipmentsDate }}</view>
  58 + </template>
  59 + </uni-list-item>
  60 + <uni-list-item>
  61 + <template v-slot:body>
  62 + <view class="item-title"><text class="required">*</text><text>实际发货日期</text></view>
  63 + </template>
  64 + <template v-slot:footer>
  65 + <uni-datetime-picker type="date" :start="todayDate"
  66 + v-model="fillDateForm.newShipmentDate" />
  67 + </template>
  68 + </uni-list-item>
  69 + </uni-list>
  70 + </view>
  71 + <view class="dialog_footer">
  72 + <button class="btn confirm" type="primary" @click="onFillDateSave">保存</button>
  73 + </view>
  74 + </view>
  75 + </uni-popup>
44 76 <!-- 申请延期 -->
45 77 <uni-popup ref="applyDelayPopup" type="bottom" :mask-click="false">
46 78 <view class="dialog">
... ... @@ -136,7 +168,7 @@
136 168 </template>
137 169
138 170 <script>
139   -import { getDetailApi, saveSignInTicket, checkApi, splitDataApi } from '@/api/invoice.js'
  171 +import { getDetailApi, saveSignInTicket, checkApi, splitDataApi, updateApi } from '@/api/invoice.js'
140 172 import Product from './product.vue'
141 173 import DetailButtons from '@/components/detail-buttons/index.vue'
142 174 import FileUpload from '@/components/file-upload/index.vue'
... ... @@ -154,12 +186,18 @@ export default {
154 186 // { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
155 187 { text: '填写实发数', visible: true, variant: 'outline', event: 'fill' },
156 188 { text: '上传签收单据', visible: true, variant: 'primary', event: 'upload' },
  189 + { text: '填写日期', visible: true, variant: 'primary', event: 'fillDate' },
157 190 ],
158 191 uploadFile: { id: '', name: '' },
159 192 applyDelayForm: {},
160 193 splitForm: {
161 194 initItem: {},
162 195 },
  196 + fillDateForm: {
  197 + id: '',
  198 + shipmentsDate: '',
  199 + newShipmentDate: '',
  200 + },
163 201 }
164 202 },
165 203 computed: {
... ... @@ -168,8 +206,11 @@ export default {
168 206 const e = String(m.status || '')
169 207 return {
170 208 canEdit: e === 'UN_SHIPMENTS',
171   - canFill: e === 'UN_SHIPMENTS',
  209 + // onTimeShipment 有值(true || false), 填写实发数按钮不显示
  210 + canFill: e === 'UN_SHIPMENTS' && (m.onTimeShipment !== false && m.onTimeShipment !== true),
172 211 canUpload: e === 'SHIPMENTS',
  212 + // canFillDate: e === 'UN_SHIPMENTS' && m.onTimeShipment === false && !m.newShipmentDate,
  213 + canFillDate: e === 'UN_SHIPMENTS' && m.onTimeShipment === false,
173 214 }
174 215 },
175 216 displayButtons() {
... ... @@ -178,7 +219,15 @@ export default {
178 219 // { ...this.buttons[0], visible: f.canEdit && this.$auth.hasPermi('shipping-plan-manage:invoice:modify') },
179 220 { ...this.buttons[0], visible: f.canFill && this.$auth.hasPermi('shipping-plan-manage:invoice:fill') },
180 221 { ...this.buttons[1], visible: f.canUpload && this.$auth.hasPermi('shipping-plan-manage:invoice:upload') },
  222 + { ...this.buttons[2], visible: f.canFillDate && this.$auth.hasPermi('shipping-plan-manage:invoice:fill-date') },
181 223 ]
  224 + },
  225 + todayDate() {
  226 + const now = new Date()
  227 + const y = now.getFullYear()
  228 + const m = String(now.getMonth() + 1).padStart(2, '0')
  229 + const d = String(now.getDate()).padStart(2, '0')
  230 + return `${y}-${m}-${d}`
182 231 }
183 232 },
184 233 onLoad(query) {
... ... @@ -200,6 +249,7 @@ export default {
200 249 // edit: () => this.onEdit(),
201 250 fill: () => this.onFill(),
202 251 upload: () => this.onUpload(),
  252 + fillDate: () => this.onFillDate(),
203 253 }
204 254 const fn = map[btn.event]
205 255 if (typeof fn === 'function') fn()
... ... @@ -221,6 +271,11 @@ export default {
221 271 onUpload() {
222 272 this.$refs.uploadPopup && this.$refs.uploadPopup.open()
223 273 },
  274 + onFillDate() {
  275 + this.fillDateForm.id = this.form.id;
  276 + this.fillDateForm.shipmentsDate = this.form.shipmentsDate;
  277 + this.$refs.fillDatePopup && this.$refs.fillDatePopup.open()
  278 + },
224 279 downloadFile,
225 280 closeUploadInfo() {
226 281 this.uploadFile = { id: '', name: '' };
... ... @@ -248,6 +303,31 @@ export default {
248 303 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
249 304 }
250 305 },
  306 + closeFillDateInfo() {
  307 + this.uploadFile = { id: '', name: '' };
  308 + this.$refs.fillDatePopup && this.$refs.fillDatePopup.close()
  309 + },
  310 + async onFillDateSave() {
  311 + console.log('onFillDateSave__this.fillDateForm', this.fillDateForm)
  312 + if (!this.fillDateForm.newShipmentDate) {
  313 + uni.showToast({
  314 + title: '请选择实际发货日期',
  315 + icon: 'none'
  316 + })
  317 + return
  318 + }
  319 + const params = {
  320 + id: this.fillDateForm.id,
  321 + newShipmentDate: this.fillDateForm.newShipmentDate,
  322 + }
  323 + try {
  324 + await updateApi(params)
  325 + uni.showToast({ title: '保存成功', icon: 'success' })
  326 + setTimeout(() => { uni.redirectTo({ url: '/pages/invoice/index' }) }, 300)
  327 + } catch (e) {
  328 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  329 + }
  330 + },
251 331 // 申请延期
252 332 applyDelayFun(id) {
253 333 getShipmentPlanDetailApi(id).then(res => {
... ... @@ -501,6 +581,7 @@ export default {
501 581 padding: 12rpx 4rpx 24rpx;
502 582 max-height: 70vh;
503 583 overflow-y: auto;
  584 +
504 585 }
505 586
506 587 .split_body {
... ... @@ -740,4 +821,11 @@ export default {
740 821 }
741 822 }
742 823 }
  824 +.fill-data_body {
  825 + ::v-deep .uni-list-item {
  826 + &__container {
  827 + align-items: center;
  828 + }
  829 + }
  830 +}
743 831 </style>
... ...
... ... @@ -2,6 +2,14 @@
2 2 <view class="page">
3 3 <scroll-view class="scroll" scroll-y>
4 4 <uni-list>
  5 + <view class="section">
  6 + <uni-list-item class="select-item" :class="form.onTimeShipment != null ? 'is-filled' : 'is-empty'" clickable
  7 + @click="openShipmentSheet" :rightText="onTimeShipmentText" showArrow>
  8 + <template v-slot:body>
  9 + <view class="item-title"><text>是否当日发货</text></view>
  10 + </template>
  11 + </uni-list-item>
  12 + </view>
5 13 <!-- 产品 -->
6 14 <view class="section2">
7 15 <!-- mode="add" 允许编辑 -->
... ... @@ -24,24 +32,36 @@
24 32 </view>
25 33 </view>
26 34 </uni-popup>
  35 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value"
  36 + @confirm="onSheetConfirm" />
27 37 </view>
28 38 </template>
29 39
30 40 <script>
31 41 import { listByShipmentOrderId, dataReplenishInput } from '@/api/invoice.js'
32 42 import Product from './product.vue'
  43 +import SingleSelectSheet from '@/components/single-select/index.vue'
33 44
34 45 export default {
35 46 name: 'InvoiceFill',
36   - components: { Product },
  47 + components: { Product, SingleSelectSheet },
37 48 data() {
38 49 return {
39 50 form: {
40 51 id: '',
41   - detailList: []
  52 + detailList: [],
  53 + onTimeShipment: true
42 54 },
43 55 initDetailList: [],
44   - customerName: ''
  56 + customerName: '',
  57 + sheet: { visible: false, title: '请选择', options: [], value: '' }
  58 + }
  59 + },
  60 + computed: {
  61 + onTimeShipmentText() {
  62 + if (this.form.onTimeShipment === true) return '是'
  63 + if (this.form.onTimeShipment === false) return '否'
  64 + return '请选择'
45 65 }
46 66 },
47 67 onLoad(query) {
... ... @@ -109,6 +129,17 @@ export default {
109 129 this.$refs.confirmPopup && this.$refs.confirmPopup.close();
110 130 this.submitData(type);
111 131 },
  132 + openShipmentSheet() {
  133 + this.sheet = {
  134 + visible: true,
  135 + title: '是否当日发货',
  136 + options: [{ label: '是', value: true }, { label: '否', value: false }],
  137 + value: this.form.onTimeShipment
  138 + }
  139 + },
  140 + onSheetConfirm({ value }) {
  141 + this.form.onTimeShipment = value
  142 + },
112 143 async submitData(type) {
113 144 this.loading = true;
114 145 const params = {};
... ... @@ -126,6 +157,7 @@ export default {
126 157 params.id = this.form.id || '';
127 158 params.detailList = detailList;
128 159 params.type = type || '';
  160 + params.onTimeShipment = this.form.onTimeShipment;
129 161 console.log(params);
130 162
131 163 try {
... ...
... ... @@ -2,7 +2,7 @@
2 2 <view class="page">
3 3 <view class="dev-list-fixed">
4 4 <view class="search-row">
5   - <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入购货单位" clearButton="auto"
  5 + <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入购货单位或者发货单编号" clearButton="auto"
6 6 cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search"
7 7 @input="onSearchInput" />
8 8 <view class="tool-icons">
... ... @@ -26,6 +26,9 @@
26 26 </view>
27 27 </view>
28 28 <view class="info-row">
  29 + <text>发货单编号</text><text>{{ item.code || '-' }}</text>
  30 + </view>
  31 + <view class="info-row">
29 32 <text>生产厂</text><text>{{ item.workshopName || '-' }}</text>
30 33 </view>
31 34 <view class="info-row">
... ... @@ -35,7 +38,10 @@
35 38 <text>交货方式</text><text>{{ item.deliveryType || '-' }}</text>
36 39 </view>
37 40 <view class="info-row">
38   - <text>发货日期</text><text>{{ item.shipmentsDate || '-' }}</text>
  41 + <text>是否当日发货</text><text>{{ item.onTimeShipment === true ? '是' : (item.onTimeShipment === false ? '否' : '-') || '-' }}</text>
  42 + </view>
  43 + <view class="info-row">
  44 + <text>原发货日期</text><text>{{ item.shipmentsDate || '-' }}</text>
39 45 </view>
40 46 </view>
41 47 </template>
... ... @@ -68,7 +74,7 @@
68 74 </view>
69 75
70 76 <view class="form-item">
71   - <view class="label">货日期</view>
  77 + <view class="label">原发货日期</view>
72 78 <uni-datetime-picker type="daterange" v-model="model.dateRange" start="2023-01-01" @change="onDateChange($event, model)"/>
73 79 </view>
74 80 </view>
... ... @@ -132,7 +138,7 @@ export default {
132 138 computed: {
133 139 extraCombined() {
134 140 return {
135   - customerName: this.searchKeywordDebounced || undefined
  141 + searchKey: this.searchKeywordDebounced || undefined
136 142 }
137 143 }
138 144 },
... ... @@ -253,7 +259,7 @@ export default {
253 259 delete params.dateRange
254 260 }
255 261 if (this.searchKeywordDebounced) {
256   - params.customerName = this.searchKeywordDebounced
  262 + params.searchKey = this.searchKeywordDebounced
257 263 }
258 264 return queryApi(params)
259 265 .then(res => {
... ...