Преглед изворни кода

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/MTP2.0_WEB

marymelisa пре 4 година
родитељ
комит
1407e72599

+ 2 - 2
src/common/methods/format/index.ts

@@ -1,5 +1,5 @@
 import { serviceURL } from '@/services/request/index';
-import moment from 'moment';
+import moment, { Moment } from 'moment';
 
 function getMtpUlr(): string {
     return serviceURL.openApiUrl.replace('/mtp2-onlineopen', '/mtp2manage');
@@ -64,7 +64,7 @@ type TIME = 's' | 'm' | 'd'
  * @param type 's' => 格式: YYYY-MM-DD HH:mm:ss ;  'm'  => 格式: YYYY-MM-DD HH:mm ;  'd' => 'YYYY-MM-DD'
  * @returns 
  */
-export function formatTime(value: string | Date, type: TIME) {
+export function formatTime(value: string | Date | Moment, type: TIME) {
     let str = 'YYYY-MM-DD HH:mm:ss';
     if (type === 'd') {
         str = 'YYYY-MM-DD'

+ 17 - 2
src/views/information/spot-contract/components/add/index.vue

@@ -421,6 +421,7 @@ import { getGoodsList } from '@/services/bus/goods';
 import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from './interface';
+import { formatTime } from '@/common/methods/format';
 import moment from 'moment';
 
 export default defineComponent({
@@ -468,8 +469,22 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
-                    console.log('deliveryDate', moment(deliveryDate.value[0], 'YYYY/MM/DD'));
-                    console.log('priceDate', priceDate);
+
+                    // 交收期
+                    const dDate = deliveryDate.value;
+                    if (dDate.length) {
+                        const DeliveryStartDate = formatTime(dDate[0], 'd') + '00:00:00';
+                        const DeliveryEndDate = formatTime(dDate[1], 'd') + '00:00:00';
+                        Object.assign(param, { DeliveryStartDate, DeliveryEndDate });
+                    }
+
+                    // 点价期
+                    const pDate = priceDate.value;
+                    if (pDate.length && param.PriceType !== 1) {
+                        const StartDate = formatTime(dDate[0], 'd') + '00:00:00';
+                        const EndDate = formatTime(dDate[1], 'd') + '00:00:00';
+                        Object.assign(param, { StartDate, EndDate });
+                    }
                     console.log('values', formState);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {