Administrator 4 gadi atpakaļ
vecāks
revīzija
3a8ca0bad5

+ 194 - 22
src/views/business/purchase/components/funds/index.vue

@@ -1,42 +1,214 @@
 <template>
-  <!-- 款项登记-->
-  <a-modal class="custom-detail"
-           title="款项登记"
-           v-model:visible="visible"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">关闭</a-button>
-    </template>
+    <!-- 款项登记-->
+    <a-modal class="custom-detail add-custom "
+             :title="selectedRow.contracttype===1? '采购合同-款项登记': '销售合同-款项登记'"
+             v-model:visible="visible"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      type="primary"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                    type="primary"
+                    :loading="loading"
+                    @click="submit">款项登记
+            </a-button>
+        </template>
+        <fieldset class="formFieldSet">
+            <legend>合同基本信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同编号">
+                            <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="定价.
+                        类型">
+                            <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item :label="selectedRow.contracttype===1? '采购方': '销售方'">
+                            <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="现货品种">
+                            <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同签署量">
+                            <span class="white">{{ formatValue(selectedRow.qty + selectedRow.enumdicname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="合同暂定价">
+                            <span class="white">{{ formatValue(selectedRow.price) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价合约">
+                            <span class="white">{{ formatValue(selectedRow.goodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>已登记信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="已定价量">
+                            <span class="white">{{ selectedRow.pricedqty + selectedRow.enumdicname }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="已点均价">
+                            <span class="white">{{ formatValue(selectedRow.pricedavg) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>本次点价信息</legend>
+            <a-form class="inlineForm"
+                        ref="formRef"
+                        :model="formState"
+                        :rules="formStateRules">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价价格"  name="PricedPrice">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedPrice" :min="0" placeholder="请输入点价价格"/>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="升贴水">
+                            <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
 
-  </a-modal>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="商品价格">
+                            <span class="white">{{ Number(selectedRow.pricemove) + Number(formState.PricedPrice) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="点价数量" name="PricedQty">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
+                            <span class="white">未定价量{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span>
+                            <span class="white" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价金额">
+                            <span class="white">{{( Number(selectedRow.pricemove) + Number(formState.PricedPrice)) * formState.PricedQty }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, reactive, ref,unref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {formatValue} from "@/common/methods";
+import {Ermcp3SellBuyContract} from "@/services/go/ermcp/purchase/interface";
+import {getPriceTypeName} from "@/views/business/purchase/setup";
+import { operationContractReq } from '@/services/proto/contract';
+import { message } from 'ant-design-vue';
 
 export default defineComponent({
     name: 'purchase_pending_funds',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('purchase_pending_funds');
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3SellBuyContract>,
+            default: {},
+        },
+    },
+    setup(props) {
+        const {visible, cancel} = closeModal('purchase_pending_funds');
         const loading = ref<boolean>(false);
+        function objectToUint8Array(data: object) {
+            const encode = encodeURI(JSON.stringify(data));// 对字符串进行编码
+            const base64String = btoa(encode);// 对编码的字符串转化base64
+            const padding = '='.repeat((4 - base64String.length % 4) % 4);
+            const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/');
+            const rawData = window.atob(base64);
+            const outputArray = new Uint8Array(rawData.length);
+            for (var i = 0; i < rawData.length; ++i) {
+                outputArray[i] = rawData.charCodeAt(i);
+            }
+            return outputArray;
+        }
+
+        const formRef = ref();
+        const formState = reactive({ PricedPrice: 0, PricedQty: 0 });
+        const numberIstrue = (rule: any, value: any) => {
+            if (!value) {
+                return Promise.reject(new Error('请输入正确的值'));
+            } else {
+                return Promise.resolve();
+            }
+        };
+        const formStateRules = {
+            PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+            PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+        }
         function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            const wrapEl = unref(formRef);
+            wrapEl.validate().then(() => {
+                loading.value = true;
+                console.log(objectToUint8Array(formState));
+                operationContractReq({
+                    OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
+                    Info: {
+                        OperateApplyType: 1, // uint32 操作申请类型-1:点价2:结算3:款项4:发票
+                        RelatedID: 1, // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+                        DetailJson : objectToUint8Array(formState), // bytes 明细JSON {}
+                    }
+                }).then(()=>{
+                    message.success('登记成功!')
+                    loading.value = false;
+                    cancel();
+                }).catch(err=>{
+                    message.error(err)
+                    loading.value = false;
+                    cancel();
+                })
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
+            formRef,
+            formState,
+            formatValue,
+            formStateRules,
+            getPriceTypeName,
         };
     },
 });

+ 194 - 22
src/views/business/purchase/components/invoice/index.vue

@@ -1,42 +1,214 @@
 <template>
-  <!-- 发票登记-->
-  <a-modal class="custom-detail"
-           title="发票登记"
-           v-model:visible="visible"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">关闭</a-button>
-    </template>
+    <!-- 发票登记-->
+    <a-modal class="custom-detail add-custom "
+             :title="selectedRow.contracttype===1? '采购合同-发票登记': '销售合同-发票登记'"
+             v-model:visible="visible"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      type="primary"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                    type="primary"
+                    :loading="loading"
+                    @click="submit">发票登记
+            </a-button>
+        </template>
+        <fieldset class="formFieldSet">
+            <legend>合同基本信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同编号">
+                            <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="定价.
+                        类型">
+                            <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item :label="selectedRow.contracttype===1? '采购方': '销售方'">
+                            <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="现货品种">
+                            <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同签署量">
+                            <span class="white">{{ formatValue(selectedRow.qty + selectedRow.enumdicname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="合同暂定价">
+                            <span class="white">{{ formatValue(selectedRow.price) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价合约">
+                            <span class="white">{{ formatValue(selectedRow.goodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>已登记信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="已定价量">
+                            <span class="white">{{ selectedRow.pricedqty + selectedRow.enumdicname }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="已点均价">
+                            <span class="white">{{ formatValue(selectedRow.pricedavg) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>本次点价信息</legend>
+            <a-form class="inlineForm"
+                        ref="formRef"
+                        :model="formState"
+                        :rules="formStateRules">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价价格"  name="PricedPrice">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedPrice" :min="0" placeholder="请输入点价价格"/>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="升贴水">
+                            <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
 
-  </a-modal>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="商品价格">
+                            <span class="white">{{ Number(selectedRow.pricemove) + Number(formState.PricedPrice) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="点价数量" name="PricedQty">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
+                            <span class="white">未定价量{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span>
+                            <span class="white" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价金额">
+                            <span class="white">{{( Number(selectedRow.pricemove) + Number(formState.PricedPrice)) * formState.PricedQty }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, reactive, ref,unref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {formatValue} from "@/common/methods";
+import {Ermcp3SellBuyContract} from "@/services/go/ermcp/purchase/interface";
+import {getPriceTypeName} from "@/views/business/purchase/setup";
+import { operationContractReq } from '@/services/proto/contract';
+import { message } from 'ant-design-vue';
 
 export default defineComponent({
     name: 'purchase_pending_invoice',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('purchase_pending_invoice');
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3SellBuyContract>,
+            default: {},
+        },
+    },
+    setup(props) {
+        const {visible, cancel} = closeModal('purchase_pending_invoice');
         const loading = ref<boolean>(false);
+        function objectToUint8Array(data: object) {
+            const encode = encodeURI(JSON.stringify(data));// 对字符串进行编码
+            const base64String = btoa(encode);// 对编码的字符串转化base64
+            const padding = '='.repeat((4 - base64String.length % 4) % 4);
+            const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/');
+            const rawData = window.atob(base64);
+            const outputArray = new Uint8Array(rawData.length);
+            for (var i = 0; i < rawData.length; ++i) {
+                outputArray[i] = rawData.charCodeAt(i);
+            }
+            return outputArray;
+        }
+
+        const formRef = ref();
+        const formState = reactive({ PricedPrice: 0, PricedQty: 0 });
+        const numberIstrue = (rule: any, value: any) => {
+            if (!value) {
+                return Promise.reject(new Error('请输入正确的值'));
+            } else {
+                return Promise.resolve();
+            }
+        };
+        const formStateRules = {
+            PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+            PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+        }
         function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            const wrapEl = unref(formRef);
+            wrapEl.validate().then(() => {
+                loading.value = true;
+                console.log(objectToUint8Array(formState));
+                operationContractReq({
+                    OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
+                    Info: {
+                        OperateApplyType: 1, // uint32 操作申请类型-1:点价2:结算3:款项4:发票
+                        RelatedID: 1, // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+                        DetailJson : objectToUint8Array(formState), // bytes 明细JSON {}
+                    }
+                }).then(()=>{
+                    message.success('登记成功!')
+                    loading.value = false;
+                    cancel();
+                }).catch(err=>{
+                    message.error(err)
+                    loading.value = false;
+                    cancel();
+                })
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
+            formRef,
+            formState,
+            formatValue,
+            formStateRules,
+            getPriceTypeName,
         };
     },
 });

+ 194 - 24
src/views/business/purchase/components/settlement/index.vue

@@ -1,42 +1,214 @@
 <template>
-  <!-- 交收登记-->
-  <a-modal class="custom-detail"
-           title="交收登记"
-           v-model:visible="visible"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">关闭</a-button>
-    </template>
+    <!-- 交收登记-->
+    <a-modal class="custom-detail add-custom "
+             :title="selectedRow.contracttype===1? '采购合同-交收登记': '销售合同-交收登记'"
+             v-model:visible="visible"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      type="primary"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                    type="primary"
+                    :loading="loading"
+                    @click="submit">交收登记
+            </a-button>
+        </template>
+        <fieldset class="formFieldSet">
+            <legend>合同基本信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同编号">
+                            <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="定价.
+                        类型">
+                            <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item :label="selectedRow.contracttype===1? '采购方': '销售方'">
+                            <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="现货品种">
+                            <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="合同签署量">
+                            <span class="white">{{ formatValue(selectedRow.qty + selectedRow.enumdicname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="合同暂定价">
+                            <span class="white">{{ formatValue(selectedRow.price) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价合约">
+                            <span class="white">{{ formatValue(selectedRow.goodsname) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>已登记信息</legend>
+            <a-form class="inlineForm">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="已定价量">
+                            <span class="white">{{ selectedRow.pricedqty + selectedRow.enumdicname }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="已点均价">
+                            <span class="white">{{ formatValue(selectedRow.pricedavg) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+        <fieldset class="formFieldSet">
+            <legend>本次点价信息</legend>
+            <a-form class="inlineForm"
+                        ref="formRef"
+                        :model="formState"
+                        :rules="formStateRules">
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价价格"  name="PricedPrice">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedPrice" :min="0" placeholder="请输入点价价格"/>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="升贴水">
+                            <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
 
-  </a-modal>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="商品价格">
+                            <span class="white">{{ Number(selectedRow.pricemove) + Number(formState.PricedPrice) }}</span>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="点价数量" name="PricedQty">
+                            <a-input-number id="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
+                            <span class="white">未定价量{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span>
+                            <span class="white" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="点价金额">
+                            <span class="white">{{( Number(selectedRow.pricemove) + Number(formState.PricedPrice)) * formState.PricedQty }}</span>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
+        </fieldset>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, reactive, ref,unref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {formatValue} from "@/common/methods";
+import {Ermcp3SellBuyContract} from "@/services/go/ermcp/purchase/interface";
+import {getPriceTypeName} from "@/views/business/purchase/setup";
+import { operationContractReq } from '@/services/proto/contract';
+import { message } from 'ant-design-vue';
 
 export default defineComponent({
     name: 'purchase_pending_settlement',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('purchase_pending_settlement');
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3SellBuyContract>,
+            default: {},
+        },
+    },
+    setup(props) {
+        const {visible, cancel} = closeModal('purchase_pending_settlement');
         const loading = ref<boolean>(false);
+        function objectToUint8Array(data: object) {
+            const encode = encodeURI(JSON.stringify(data));// 对字符串进行编码
+            const base64String = btoa(encode);// 对编码的字符串转化base64
+            const padding = '='.repeat((4 - base64String.length % 4) % 4);
+            const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/');
+            const rawData = window.atob(base64);
+            const outputArray = new Uint8Array(rawData.length);
+            for (var i = 0; i < rawData.length; ++i) {
+                outputArray[i] = rawData.charCodeAt(i);
+            }
+            return outputArray;
+        }
+
+        const formRef = ref();
+        const formState = reactive({ PricedPrice: 0, PricedQty: 0 });
+        const numberIstrue = (rule: any, value: any) => {
+            if (!value) {
+                return Promise.reject(new Error('请输入正确的值'));
+            } else {
+                return Promise.resolve();
+            }
+        };
+        const formStateRules = {
+            PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+            PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
+        }
         function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            const wrapEl = unref(formRef);
+            wrapEl.validate().then(() => {
+                loading.value = true;
+                console.log(objectToUint8Array(formState));
+                operationContractReq({
+                    OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
+                    Info: {
+                        OperateApplyType: 1, // uint32 操作申请类型-1:点价2:结算3:款项4:发票
+                        RelatedID: 1, // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+                        DetailJson : objectToUint8Array(formState), // bytes 明细JSON {}
+                    }
+                }).then(()=>{
+                    message.success('登记成功!')
+                    loading.value = false;
+                    cancel();
+                }).catch(err=>{
+                    message.error(err)
+                    loading.value = false;
+                    cancel();
+                })
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
+            formRef,
+            formState,
+            formatValue,
+            formStateRules,
+            getPriceTypeName,
         };
     },
 });
@@ -44,5 +216,3 @@ export default defineComponent({
 
 <style lang="less">
 </style>;
-
-

+ 5 - 5
src/views/business/purchase/components/someprice/index.vue

@@ -1,7 +1,7 @@
 <template>
-    <!-- 采购合同详情-->
+    <!-- 交收登记-->
     <a-modal class="custom-detail add-custom "
-             :title="selectedRow.contracttype===1? '采购合同-点价登记': '销售合同-点价登记'"
+             :title="selectedRow.contracttype===1? '采购合同-交收登记': '销售合同-交收登记'"
              v-model:visible="visible"
              @cancel="cancel"
              width="890px">
@@ -13,7 +13,7 @@
             <a-button key="submit"
                     type="primary"
                     :loading="loading"
-                    @click="submit">点价登记
+                    @click="submit">交收登记
             </a-button>
         </template>
         <fieldset class="formFieldSet">
@@ -138,7 +138,7 @@ import { operationContractReq } from '@/services/proto/contract';
 import { message } from 'ant-design-vue';
 
 export default defineComponent({
-    name: 'purchase_pending_someprice',
+    name: 'purchase_pending_settlement',
     components: {},
     props: {
         selectedRow: {
@@ -147,7 +147,7 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const {visible, cancel} = closeModal('purchase_pending_someprice');
+        const {visible, cancel} = closeModal('purchase_pending_settlement');
         const loading = ref<boolean>(false);
         function objectToUint8Array(data: object) {
             const encode = encodeURI(JSON.stringify(data));// 对字符串进行编码

+ 6 - 6
src/views/business/purchase/list/all/index.vue

@@ -26,17 +26,17 @@
       </a-table>
     </contextMenu>
     <!-- 详情 -->
-    <Detail />
+    <Detail  :selectedRow="selectedRow"/>
     <!-- 采购点价登记 -->
-    <SomePrice />
+    <SomePrice  :selectedRow="selectedRow"/>
     <!-- 交收登记 -->
-    <Settlement />
+    <Settlement  :selectedRow="selectedRow"/>
     <!-- 款项登记 -->
-    <Funds />
+    <Funds  :selectedRow="selectedRow"/>
     <!-- 发票登记 -->
-    <Invoice />
+    <Invoice  :selectedRow="selectedRow"/>
     <!-- 入库登记 -->
-    <Storage />
+    <Storage  :selectedRow="selectedRow"/>
   </div>
 </template>