Handy_Cao 2 سال پیش
والد
کامیت
39e4618b30

+ 44 - 22
src/packages/mobile/views/order/performance/components/detail/Index.vue

@@ -26,9 +26,15 @@
 
                 </CellGroup>
             </div>
+            <Form ref="formRef" class="g-form__container" @submit="toConfirm">
+                <Dialog :title="dialogTitle" v-model:show="show" show-cancel-button @confirm ="toConfirm" @cancel="show=false">
+                    <Field name="DelayDays" v-model="formData.delaydays" type="number" v-if="showDays" label="延期天数" :rules="formRules.delaydays" placeholder="请输入延期天数" />
+                    <Field name="Remark" label="备注" v-model="remark" :rules="formRules.remark" placeholder="请输入备注信息" />
+                </Dialog>
+            </Form>
             <template #footer>
-                <Button type="danger" block round @click="delay">延期申请</Button>
-                <Button type="info" block round @click="confirm">立即执行</Button>
+                <Button type="primary" v-if="selectedRow.buyorsell===selectedRow.executeside-1" block round @click="showConfirm(true)">延期申请</Button>
+                <Button type="warning" v-if="selectedRow.buyorsell===selectedRow.executeside-1" block round @click="showConfirm(false)">立即执行</Button>
             </template>
         </app-view>
     </app-modal>
@@ -36,8 +42,8 @@
 
 <script lang="ts" setup>
 import { shallowRef, PropType } from 'vue'
-import { CellGroup, Cell, Button } from 'vant'
-import { dialog, fullloading } from '@/utils/vant'
+import { CellGroup, Cell, Button, Dialog, Field, FieldRule, Form, FormInstance } from 'vant'
+import { fullloading } from '@/utils/vant'
 import { formatDate, formatDecimal } from '@/filters'
 import { usePerformanceDelayApply, usePerformanceManualConfirm } from '@/business/performance'
 import { queryWrPerformancePlanStep } from '@/services/api/performance'
@@ -48,7 +54,8 @@ import { useRequest } from '@/hooks/request'
 const showModal = shallowRef(true)
 // 是否刷新父组件数据
 const refresh = shallowRef(false)
-const { formData, formSubmit } = usePerformanceDelayApply()
+const { formData, formSubmit} = usePerformanceDelayApply()
+const formRef = shallowRef<FormInstance>()
 
 const props = defineProps({
     selectedRow: {
@@ -60,6 +67,22 @@ const props = defineProps({
 const { confirmFormData, confirmSubmit } = usePerformanceManualConfirm(props.selectedRow.buyaccountid)
 const datelist = shallowRef<Model.WrPerformancePlanStep[]>([])
 const error = shallowRef(false)
+const show = shallowRef(false)
+const showDays = shallowRef(false)
+const remark = shallowRef('')
+const dialogTitle = shallowRef('是否要手动执行步骤?')
+
+// 表单验证规则
+const formRules: { [key in keyof Proto.PerformanceDelayApplyReq | 'remark' ]?: FieldRule[] } = {
+    delaydays: [{
+        required: true,
+        message: '请输入延期天数'
+    }],
+    remark: [{
+        required: true,
+        message: '请输入备注信息'
+    }],
+}
 
 const { loading } = useRequest(queryWrPerformancePlanStep, {
     params: {
@@ -73,14 +96,19 @@ const { loading } = useRequest(queryWrPerformancePlanStep, {
     }
 })
 
-const delay = () => {
-    dialog({
-        message: '确认要延期申请吗?',
-        showCancelButton: true,
-    }).then(() => {
-        /// 市场ID
-        formData.value.PerformancePlanStepID = Number(props.selectedRow.curstepid)
+const showConfirm = (showDelay: boolean) => {
+    dialogTitle.value = showDelay ? '确定要延期申请吗?' : '是否要手动执行步骤?'
+    showDays.value = showDelay
+    show.value = true
+}
 
+const toConfirm = () => {
+    const { curstepid } = props.selectedRow
+    console.log(props.selectedRow)
+    if (showDays.value === true) { /// 延期
+        /// 市场ID
+        formData.value.PerformancePlanStepID = curstepid
+        formData.value.applyremark = remark.value
         /// loding....
         fullloading((hideLoading) => {
             formSubmit().then(() => {
@@ -90,16 +118,10 @@ const delay = () => {
                 hideLoading(err, 'fail')
             })
         })
-    })
-}
-
-const confirm = () => {
-    dialog({
-        message: '确认要立即执行吗?',
-        showCancelButton: true,
-    }).then(() => {
+    } else { /// 手动确认
         /// PerformancePlanStepID
-        confirmFormData.value.PerformancePlanStepID = Number(props.selectedRow.curstepid)
+        confirmFormData.value.PerformancePlanStepID = curstepid
+        confirmFormData.value.StepRemark = remark.value
         /// loding....
         fullloading((hideLoading) => {
             confirmSubmit().then(() => {
@@ -109,7 +131,7 @@ const confirm = () => {
                 hideLoading(err, 'fail')
             })
         })
-    })
+    }
 }
 
 /// 关闭弹窗

+ 1 - 2
src/packages/mobile/views/order/performance/components/modify/Index.vue

@@ -9,7 +9,7 @@
                 <CellGroup title="履约信息">
                     <Field name="ContactInfo" v-model="formData.ContactInfo" autosize label="联络信息" type="textarea"
                         placeholder="请输入联络信息" />
-                    <Field name="ReceiveInfo" v-model="formData.ContactInfo" autosize label="联络信息" type="textarea"
+                    <Field name="ReceiveInfo" v-model="formData.ContactInfo" autosize label="收货地址" type="textarea"
                         placeholder="请输入收货地址">
                         <template #button>
                             <Button icon="plus" size="small" type="primary" />
@@ -35,7 +35,6 @@ import { shallowRef, PropType } from 'vue'
 import { CellGroup, Button, Field, Form, FormInstance } from 'vant'
 import { dialog, fullloading } from '@/utils/vant'
 import { usePerformanceModifyContact } from '@/business/performance'
-
 import AppModal from '@/components/base/modal/index.vue'
 
 const showModal = shallowRef(true)

+ 2 - 0
src/types/model/performance.d.ts

@@ -55,6 +55,8 @@ declare namespace Model {
         enddate: string
         /// 单位名称
         enumdicname: string
+        /// 步骤执行方 - 1:买方 2:卖方
+        executeside: number
         /// 运费
         expressfee: number
         /// 是否确认运费 - 0:无 1:买方确认 2:卖方确认

+ 2 - 2
src/types/proto/performance.d.ts

@@ -33,7 +33,7 @@ declare global {
             /// MessageHead 消息头
             Header?: IMessageHead;
             /// uint64 履约计划步骤ID
-            PerformancePlanStepID?: number;
+            PerformancePlanStepID?: string;
             /// uint32 申请延期天数
             delaydays?: number;
             /// uint64 申请人
@@ -59,7 +59,7 @@ declare global {
             /// MessageHead 消息头
             Header?: IMessageHead;
             /// uint64 履约计划步骤ID
-            PerformancePlanStepID?: number;
+            PerformancePlanStepID?: string;
             /// double 溢短金额
             OverShortAmount?: number;
             /// uint32 履约步骤执行方 1买方 2 卖方