Commit 74ac879dca03868384e3015dc5cbf17382df5ae2

Authored by 史婷婷
1 parent 2a807f08

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

@@ -5,12 +5,14 @@ @@ -5,12 +5,14 @@
5 <view class="section"> 5 <view class="section">
6 <text class="row company">{{ form.customerName }}</text> 6 <text class="row company">{{ form.customerName }}</text>
7 <view :class="['status', `status_${form.status}`]" /> 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 <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view> 10 <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
10 <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view> 11 <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view>
11 <view class="row"><text class="label">区域</text><text class="value">{{ form.regionName }}</text></view> 12 <view class="row"><text class="label">区域</text><text class="value">{{ form.regionName }}</text></view>
12 <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryType }}</text></view> 13 <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryType }}</text></view>
13 <view class="row"><text class="label">目的地</text><text class="value">{{ form.destination }}</text></view> 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 </view> 16 </view>
15 17
16 <!-- 产品 --> 18 <!-- 产品 -->
@@ -41,6 +43,36 @@ @@ -41,6 +43,36 @@
41 </view> 43 </view>
42 </view> 44 </view>
43 </uni-popup> 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 <uni-popup ref="applyDelayPopup" type="bottom" :mask-click="false"> 77 <uni-popup ref="applyDelayPopup" type="bottom" :mask-click="false">
46 <view class="dialog"> 78 <view class="dialog">
@@ -136,7 +168,7 @@ @@ -136,7 +168,7 @@
136 </template> 168 </template>
137 169
138 <script> 170 <script>
139 -import { getDetailApi, saveSignInTicket, checkApi, splitDataApi } from '@/api/invoice.js' 171 +import { getDetailApi, saveSignInTicket, checkApi, splitDataApi, updateApi } from '@/api/invoice.js'
140 import Product from './product.vue' 172 import Product from './product.vue'
141 import DetailButtons from '@/components/detail-buttons/index.vue' 173 import DetailButtons from '@/components/detail-buttons/index.vue'
142 import FileUpload from '@/components/file-upload/index.vue' 174 import FileUpload from '@/components/file-upload/index.vue'
@@ -154,12 +186,18 @@ export default { @@ -154,12 +186,18 @@ export default {
154 // { text: '编辑', visible: true, variant: 'outline', event: 'edit' }, 186 // { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
155 { text: '填写实发数', visible: true, variant: 'outline', event: 'fill' }, 187 { text: '填写实发数', visible: true, variant: 'outline', event: 'fill' },
156 { text: '上传签收单据', visible: true, variant: 'primary', event: 'upload' }, 188 { text: '上传签收单据', visible: true, variant: 'primary', event: 'upload' },
  189 + { text: '填写日期', visible: true, variant: 'primary', event: 'fillDate' },
157 ], 190 ],
158 uploadFile: { id: '', name: '' }, 191 uploadFile: { id: '', name: '' },
159 applyDelayForm: {}, 192 applyDelayForm: {},
160 splitForm: { 193 splitForm: {
161 initItem: {}, 194 initItem: {},
162 }, 195 },
  196 + fillDateForm: {
  197 + id: '',
  198 + shipmentsDate: '',
  199 + newShipmentDate: '',
  200 + },
163 } 201 }
164 }, 202 },
165 computed: { 203 computed: {
@@ -168,8 +206,11 @@ export default { @@ -168,8 +206,11 @@ export default {
168 const e = String(m.status || '') 206 const e = String(m.status || '')
169 return { 207 return {
170 canEdit: e === 'UN_SHIPMENTS', 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 canUpload: e === 'SHIPMENTS', 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 displayButtons() { 216 displayButtons() {
@@ -178,7 +219,15 @@ export default { @@ -178,7 +219,15 @@ export default {
178 // { ...this.buttons[0], visible: f.canEdit && this.$auth.hasPermi('shipping-plan-manage:invoice:modify') }, 219 // { ...this.buttons[0], visible: f.canEdit && this.$auth.hasPermi('shipping-plan-manage:invoice:modify') },
179 { ...this.buttons[0], visible: f.canFill && this.$auth.hasPermi('shipping-plan-manage:invoice:fill') }, 220 { ...this.buttons[0], visible: f.canFill && this.$auth.hasPermi('shipping-plan-manage:invoice:fill') },
180 { ...this.buttons[1], visible: f.canUpload && this.$auth.hasPermi('shipping-plan-manage:invoice:upload') }, 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 onLoad(query) { 233 onLoad(query) {
@@ -200,6 +249,7 @@ export default { @@ -200,6 +249,7 @@ export default {
200 // edit: () => this.onEdit(), 249 // edit: () => this.onEdit(),
201 fill: () => this.onFill(), 250 fill: () => this.onFill(),
202 upload: () => this.onUpload(), 251 upload: () => this.onUpload(),
  252 + fillDate: () => this.onFillDate(),
203 } 253 }
204 const fn = map[btn.event] 254 const fn = map[btn.event]
205 if (typeof fn === 'function') fn() 255 if (typeof fn === 'function') fn()
@@ -221,6 +271,11 @@ export default { @@ -221,6 +271,11 @@ export default {
221 onUpload() { 271 onUpload() {
222 this.$refs.uploadPopup && this.$refs.uploadPopup.open() 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 downloadFile, 279 downloadFile,
225 closeUploadInfo() { 280 closeUploadInfo() {
226 this.uploadFile = { id: '', name: '' }; 281 this.uploadFile = { id: '', name: '' };
@@ -248,6 +303,31 @@ export default { @@ -248,6 +303,31 @@ export default {
248 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) 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 applyDelayFun(id) { 332 applyDelayFun(id) {
253 getShipmentPlanDetailApi(id).then(res => { 333 getShipmentPlanDetailApi(id).then(res => {
@@ -501,6 +581,7 @@ export default { @@ -501,6 +581,7 @@ export default {
501 padding: 12rpx 4rpx 24rpx; 581 padding: 12rpx 4rpx 24rpx;
502 max-height: 70vh; 582 max-height: 70vh;
503 overflow-y: auto; 583 overflow-y: auto;
  584 +
504 } 585 }
505 586
506 .split_body { 587 .split_body {
@@ -740,4 +821,11 @@ export default { @@ -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 </style> 831 </style>
@@ -2,6 +2,14 @@ @@ -2,6 +2,14 @@
2 <view class="page"> 2 <view class="page">
3 <scroll-view class="scroll" scroll-y> 3 <scroll-view class="scroll" scroll-y>
4 <uni-list> 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 <view class="section2"> 14 <view class="section2">
7 <!-- mode="add" 允许编辑 --> 15 <!-- mode="add" 允许编辑 -->
@@ -24,24 +32,36 @@ @@ -24,24 +32,36 @@
24 </view> 32 </view>
25 </view> 33 </view>
26 </uni-popup> 34 </uni-popup>
  35 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value"
  36 + @confirm="onSheetConfirm" />
27 </view> 37 </view>
28 </template> 38 </template>
29 39
30 <script> 40 <script>
31 import { listByShipmentOrderId, dataReplenishInput } from '@/api/invoice.js' 41 import { listByShipmentOrderId, dataReplenishInput } from '@/api/invoice.js'
32 import Product from './product.vue' 42 import Product from './product.vue'
  43 +import SingleSelectSheet from '@/components/single-select/index.vue'
33 44
34 export default { 45 export default {
35 name: 'InvoiceFill', 46 name: 'InvoiceFill',
36 - components: { Product }, 47 + components: { Product, SingleSelectSheet },
37 data() { 48 data() {
38 return { 49 return {
39 form: { 50 form: {
40 id: '', 51 id: '',
41 - detailList: [] 52 + detailList: [],
  53 + onTimeShipment: true
42 }, 54 },
43 initDetailList: [], 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 onLoad(query) { 67 onLoad(query) {
@@ -109,6 +129,17 @@ export default { @@ -109,6 +129,17 @@ export default {
109 this.$refs.confirmPopup && this.$refs.confirmPopup.close(); 129 this.$refs.confirmPopup && this.$refs.confirmPopup.close();
110 this.submitData(type); 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 async submitData(type) { 143 async submitData(type) {
113 this.loading = true; 144 this.loading = true;
114 const params = {}; 145 const params = {};
@@ -126,6 +157,7 @@ export default { @@ -126,6 +157,7 @@ export default {
126 params.id = this.form.id || ''; 157 params.id = this.form.id || '';
127 params.detailList = detailList; 158 params.detailList = detailList;
128 params.type = type || ''; 159 params.type = type || '';
  160 + params.onTimeShipment = this.form.onTimeShipment;
129 console.log(params); 161 console.log(params);
130 162
131 try { 163 try {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <view class="page"> 2 <view class="page">
3 <view class="dev-list-fixed"> 3 <view class="dev-list-fixed">
4 <view class="search-row"> 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 cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search" 6 cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search"
7 @input="onSearchInput" /> 7 @input="onSearchInput" />
8 <view class="tool-icons"> 8 <view class="tool-icons">
@@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
26 </view> 26 </view>
27 </view> 27 </view>
28 <view class="info-row"> 28 <view class="info-row">
  29 + <text>发货单编号</text><text>{{ item.code || '-' }}</text>
  30 + </view>
  31 + <view class="info-row">
29 <text>生产厂</text><text>{{ item.workshopName || '-' }}</text> 32 <text>生产厂</text><text>{{ item.workshopName || '-' }}</text>
30 </view> 33 </view>
31 <view class="info-row"> 34 <view class="info-row">
@@ -35,7 +38,10 @@ @@ -35,7 +38,10 @@
35 <text>交货方式</text><text>{{ item.deliveryType || '-' }}</text> 38 <text>交货方式</text><text>{{ item.deliveryType || '-' }}</text>
36 </view> 39 </view>
37 <view class="info-row"> 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 </view> 45 </view>
40 </view> 46 </view>
41 </template> 47 </template>
@@ -68,7 +74,7 @@ @@ -68,7 +74,7 @@
68 </view> 74 </view>
69 75
70 <view class="form-item"> 76 <view class="form-item">
71 - <view class="label">货日期</view> 77 + <view class="label">原发货日期</view>
72 <uni-datetime-picker type="daterange" v-model="model.dateRange" start="2023-01-01" @change="onDateChange($event, model)"/> 78 <uni-datetime-picker type="daterange" v-model="model.dateRange" start="2023-01-01" @change="onDateChange($event, model)"/>
73 </view> 79 </view>
74 </view> 80 </view>
@@ -132,7 +138,7 @@ export default { @@ -132,7 +138,7 @@ export default {
132 computed: { 138 computed: {
133 extraCombined() { 139 extraCombined() {
134 return { 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,7 +259,7 @@ export default {
253 delete params.dateRange 259 delete params.dateRange
254 } 260 }
255 if (this.searchKeywordDebounced) { 261 if (this.searchKeywordDebounced) {
256 - params.customerName = this.searchKeywordDebounced 262 + params.searchKey = this.searchKeywordDebounced
257 } 263 }
258 return queryApi(params) 264 return queryApi(params)
259 .then(res => { 265 .then(res => {