huangbin 4 tahun lalu
induk
melakukan
f7e9c4a45b

+ 1 - 0
src/common/constants/EnumKey.ts

@@ -7,4 +7,5 @@ export interface EnumKey {
     goodsunit: string; // 单位
     warehouseinfoType: string; // 仓库类型
     paycurrency: string; // 币种
+    spotContractType: string; // 套保计划类型
 }

+ 7 - 0
src/common/constants/enumsList.ts

@@ -37,3 +37,10 @@ export function getWarehouseTypeEnumList(): AllEnums[] {
 export function getPayCurrencyTypeEnumList(): AllEnums[] {
     return getItemEnumList('paycurrency')
 }
+
+/**
+ *获取套保计划类型枚举列表
+ */
+export function getSpotContractTypeEnumList(): AllEnums[] {
+    return getItemEnumList('spotContractType')
+}

+ 4 - 54
src/common/constants/enumsName.ts

@@ -1,5 +1,4 @@
 import { getItemEnumName } from '@/services/bus/allEnum';
-import { CardType } from './index';
 
 
 /**
@@ -31,6 +30,7 @@ export function getGoodsUnitEnumItemName(enumdicid: number): string {
 export function getWarehouseTypeEnumItemName(enumdicid: number): string {
     return getItemEnumName('warehouseinfoType', enumdicid)
 }
+
 /**
  *获取币种类型枚举名称
  */
@@ -38,59 +38,9 @@ export function getPayCurrencyTypeEnumItemName(enumdicid: number): string {
     return getItemEnumName('paycurrency', enumdicid)
 }
 
-
 /**
- * 获取证件类型名称
+ *获取套保计划类型枚举名称
  */
-export function getCardType(cardType: number) {
-    switch (cardType) {
-        case CardType.IDCARD:
-            return '身份证';
-        case CardType.HMPASSPORT:
-            return '港澳通行证';
-        case CardType.ORGANIZATION:
-            return '组织机构代码证';
-        case CardType.DRIVERLICENCE:
-            return '驾驶证';
-        case CardType.BUSINESSLICENSE:
-            return '营业执照';
-        case CardType.OFFICERCERTIFICATE:
-            return '军官证';
-        case CardType.ARMYCIVILIANCADRES:
-            return '解放军文职干部证';
-        case CardType.POLICEID:
-            return '警官证';
-        case CardType.ARMYSOLDIERSCERTIFICATE:
-            return '解放军士兵证';
-        case CardType.RESIDENCEBOOKLET:
-            return '户口簿';
-        case CardType.TEMPORARYIDCARD:
-            return '临时身份证';
-        case CardType.FOREIGNPASSPORT:
-            return '(外国)护照';
-        case CardType.CHINESEPASSPORT:
-            return '(中国)护照';
-        case CardType.ARMEDPOLICECIVILIANCADRES:
-            return '武警文职干部证';
-        case CardType.ARMEDPOLICECERTIFICATE:
-            return '武警士兵证';
-        case CardType.OVERSEASCUSTOMERNUMBER:
-            return '海外客户编号';
-        case CardType.STUDENTCARD:
-            return '学员证';
-        case CardType.RETIREMENTCERTIFICATE:
-            return '退休证';
-        case CardType.BUSINESSLICENSETOPUBLIC:
-            return '对公营业执照号码';
-        case CardType.TAIWANGPASSPORT:
-            return '台湾通行证';
-        case CardType.UNIFIEDSOCIALCREDITCODE:
-            return '统一社会信用代码';
-        case CardType.OTHER_PERSON:
-            return '个人其他类证件';
-        case CardType.OTHER_ORG:
-            return '非个人其他类证件';
-    }
+export function getSpotContractTypeEnumItemName(enumdicid: number): string {
+    return getItemEnumName('spotContractType', enumdicid)
 }
-
-

+ 19 - 0
src/utils/objHandle/index.ts

@@ -38,3 +38,22 @@ export function mergeTwoObj(a: any, b: any, callBack?: Function) {
     });
     Object.assign(a, obj);
 }
+
+/**
+ * 对象转二进制数组
+ * @param data 
+ * @returns 
+ */
+export function objectToUint8Array(data: object): Uint8Array {
+    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 base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');
+    const rawData = window.atob(base64);
+    const outputArray = new Uint8Array(rawData.length);
+    for (let i = 0; i < rawData.length; ++i) {
+        outputArray[i] = rawData.charCodeAt(i);
+    }
+    return outputArray;
+}

+ 64 - 47
src/views/business/plan/components/add/index.vue

@@ -8,8 +8,8 @@
     <template #footer>
       <a-button key="submit"
                 class="cancelBtn"
-                    @click="cancel">保存草稿
-          </a-button>
+                @click="cancel">保存草稿
+      </a-button>
       <a-button key="submit"
                 type="primary"
                 :loading="loading"
@@ -24,55 +24,60 @@
             <a-select class="inlineFormSelect"
                       style="width: 200px"
                       placeholder="请选择计划类型">
-              <a-select-option value="1">
-                客户一
+              <a-select-option v-for="item in planTye"
+                               :value="item.enumitemname"
+                               :key="item.autoid">
+                {{item.enumdicname}}
               </a-select-option>
-              <a-select-option value="2">
-                客户二
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="计划名称"
+                       name="">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     placeholder="请输入计划名称" />
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="现货品种"
+                       name="">
+            <a-select class="inlineFormSelect"
+                      style="width: 200px"
+                      placeholder="请选择现货品种">
+              <a-select-option v-for="item in DGList"
+                               :value="item.data.deliverygoodsid"
+                               :key="item.data.deliverygoodsid">
+                {{item.data.deliverygoodsname}}
               </a-select-option>
             </a-select>
           </a-form-item>
         </a-col>
-          <a-col :span="12">
-            <a-form-item label="计划名称"
-                         name="">
-              <a-input class="dialogInput"
-                       style="width: 200px"
-                       placeholder="请输入计划名称" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="现货品种"
-                         name="">
-              <a-input class="dialogInput"
-                       style="width: 200px"
-                       placeholder="请输入现货品种" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="标仓系数"
-                         name="">
-              <span class="white">1</span>
-            </a-form-item>
-          </a-col>
-          <a-col :span="24">
-            <a-form-item label="计划量"
-                         class="relative"
-                         name="">
-             <a-input class="dialogInput" 
-                      style="width: 200px" 
-                      placeholder="请输入计划量" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="24">
-            <a-form-item label="备注"
-                         class="relative"
-                         name="">
-             <a-input class="dialogInput" 
-                      style="width: 636px" 
-                      placeholder="请输入备注" />
-            </a-form-item>
-          </a-col>
+        <a-col :span="12">
+          <a-form-item label="标仓系数"
+                       name="">
+            <span class="white">1</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-item label="计划量"
+                       class="relative"
+                       name="">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     placeholder="请输入计划量" />
+          </a-form-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-item label="备注"
+                       class="relative"
+                       name="">
+            <a-input class="dialogInput"
+                     style="width: 636px"
+                     placeholder="请输入备注" />
+          </a-form-item>
+        </a-col>
       </a-row>
     </a-form>
   </a-modal>
@@ -82,22 +87,34 @@
 import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
+import { getSpotContractTypeEnumList } from '@/common/constants/enumsList';
+import { AllEnums } from '@/services/go/commonService/interface';
+import { getAllEnum } from '@/services/bus/allEnum';
+import { getMiddleGoodsD } from '../setup';
 
 export default defineComponent({
     name: 'add-custom',
     components: {},
     setup() {
         const { visible, cancel } = closeModal('plan_btn_add');
+        const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
+        // const arr = getAllEnum().filter((e) => e.enumdicname === '销售');
+        // console.log('arr', arr);
+        const { DGList, getDG } = getMiddleGoodsD();
         const loading = ref<boolean>(false);
         function submit() {
             cancel();
         }
-        initData(() => {});
+        initData(() => {
+            getDG();
+        });
         return {
             visible,
             cancel,
             submit,
             loading,
+            planTye,
+            DGList,
         };
     },
 });

+ 18 - 4
src/views/business/plan/components/setup.ts

@@ -1,8 +1,11 @@
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
+import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { ErmcpDeliveryGoodsDetailEx } from "@/services/go/ermcp/goodsInfo/interface";
 import { hedgePlanReq, oldHedgePlanReq } from "@/services/proto/hedgeplan";
 import { ErmcpHedgePlanReq, HedgePlanOperateReq } from "@/services/proto/hedgeplan/interface";
 import { deletePlanSign, hedgePlanSign } from "@/views/business/plan/setup";
-import { Ref } from "vue";
+import { message } from "ant-design-vue";
+import { ref, Ref } from "vue";
 
 
 /**
@@ -37,9 +40,20 @@ export function handleForm() {
 }
 
 /**
- * 
- * @param contracttype 获取
+ * 获取现货品种和品类数据
  */
-export function getContractType(contracttype: number) {
+export function getMiddleGoodsD() {
+    // 现货品种列表
+    const DGList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
+    // 获取品种数据
+    function getDG() {
+        QueryDeliveryGoodsDetail().then(res => {
+            DGList.value = res.filter(e => e.data.isvalid === 1)
+        }).catch(err => message.error(err))
+    }
+    // 选中品种数据
+    function chooseMG(id: number) {
 
+    }
+    return { DGList, getDG }
 }

+ 159 - 157
src/views/business/purchase/components/funds/index.vue

@@ -1,143 +1,157 @@
 <template>
-    <!-- 款项登记-->
-    <a-modal class="commonModal paddingDialog funds"
-             :title="selectedRow.contracttype===1? '采购合同-款项登记': '销售合同-款项登记'"
-             v-model:visible="visible"
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <a-button key="submit"
-                      class="cancelBtn"
-                      @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="定价.
+  <!-- 款项登记-->
+  <a-modal class="commonModal paddingDialog funds"
+           :title="selectedRow.contracttype===1? '采购合同-款项登记': '销售合同-款项登记'"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                class="cancelBtn"
+                @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 class="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>
+              <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 class="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-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" class="relative">
-                            <a-input-number class="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
-                            <div class="tip">
-                                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
-                                <a class="blue ml10" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
-                            </div>
-                        </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) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="点价数量"
+                         name="PricedQty"
+                         class="relative">
+              <a-input-number class="dialogInput"
+                              style="width: 200px"
+                              v-model:value="formState.PricedQty"
+                              :min="0"
+                              :max="selectedRow.unpricedqty"
+                              placeholder="请输入点价数量" />
+              <div class="tip">
+                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
+                <a class="blue ml10"
+                   @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
+              </div>
+            </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>
+        <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, 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 { 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';
+import { objectToUint8Array } from '@/utils/objHandle';
 
 export default defineComponent({
     name: 'purchase_pending_funds',
@@ -149,21 +163,8 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const {visible, cancel} = closeModal('purchase_pending_funds');
+        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) => {
@@ -176,28 +177,29 @@ export default defineComponent({
         const formStateRules = {
             PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
             PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
-        }
+        };
         function submit() {
             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();
+                        DetailJson: objectToUint8Array(formState), // bytes 明细JSON {}
+                    },
                 })
+                    .then(() => {
+                        message.success('登记成功!');
+                        loading.value = false;
+                        cancel();
+                    })
+                    .catch((err) => {
+                        message.error(err);
+                        loading.value = false;
+                        cancel();
+                    });
             });
         }
 

+ 159 - 157
src/views/business/purchase/components/invoice/index.vue

@@ -1,143 +1,157 @@
 <template>
-    <!-- 发票登记-->
-    <a-modal class="commonModal paddingDialog invoice"
-             :title="selectedRow.contracttype===1? '采购合同-发票登记': '销售合同-发票登记'"
-             v-model:visible="visible"
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <a-button key="submit"
-                      class="cancelBtn"
-                      @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="定价.
+  <!-- 发票登记-->
+  <a-modal class="commonModal paddingDialog invoice"
+           :title="selectedRow.contracttype===1? '采购合同-发票登记': '销售合同-发票登记'"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                class="cancelBtn"
+                @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 class="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>
+              <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 class="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-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" class="relative">
-                            <a-input-number class="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
-                            <div class="tip">
-                                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
-                                <a class="blue ml10" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
-                            </div>
-                        </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) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="点价数量"
+                         name="PricedQty"
+                         class="relative">
+              <a-input-number class="dialogInput"
+                              style="width: 200px"
+                              v-model:value="formState.PricedQty"
+                              :min="0"
+                              :max="selectedRow.unpricedqty"
+                              placeholder="请输入点价数量" />
+              <div class="tip">
+                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
+                <a class="blue ml10"
+                   @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
+              </div>
+            </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>
+        <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, 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 { 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';
+import { objectToUint8Array } from '@/utils/objHandle';
 
 export default defineComponent({
     name: 'purchase_pending_invoice',
@@ -149,21 +163,8 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const {visible, cancel} = closeModal('purchase_pending_invoice');
+        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) => {
@@ -176,28 +177,29 @@ export default defineComponent({
         const formStateRules = {
             PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
             PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
-        }
+        };
         function submit() {
             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();
+                        DetailJson: objectToUint8Array(formState), // bytes 明细JSON {}
+                    },
                 })
+                    .then(() => {
+                        message.success('登记成功!');
+                        loading.value = false;
+                        cancel();
+                    })
+                    .catch((err) => {
+                        message.error(err);
+                        loading.value = false;
+                        cancel();
+                    });
             });
         }
 

+ 159 - 157
src/views/business/purchase/components/settlement/index.vue

@@ -1,143 +1,157 @@
 <template>
-    <!-- 交收登记-->
-    <a-modal class="commonModal paddingDialog settlement"
-             :title="selectedRow.contracttype===1? '采购合同-交收登记': '销售合同-交收登记'"
-             v-model:visible="visible"
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <a-button key="submit"
-                      class="cancelBtn"
-                      @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="定价.
+  <!-- 交收登记-->
+  <a-modal class="commonModal paddingDialog settlement"
+           :title="selectedRow.contracttype===1? '采购合同-交收登记': '销售合同-交收登记'"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                class="cancelBtn"
+                @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 class="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>
+              <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 class="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-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="点价数量" class="relative" name="PricedQty">
-                            <a-input-number class="dialogInput"  style="width: 200px" v-model:value="formState.PricedQty" :min="0" :max="selectedRow.unpricedqty" placeholder="请输入点价数量"/>
-                            <div class="tip">
-                                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
-                                <a class="blue ml10" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
-                            </div>
-                        </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) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="点价数量"
+                         class="relative"
+                         name="PricedQty">
+              <a-input-number class="dialogInput"
+                              style="width: 200px"
+                              v-model:value="formState.PricedQty"
+                              :min="0"
+                              :max="selectedRow.unpricedqty"
+                              placeholder="请输入点价数量" />
+              <div class="tip">
+                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
+                <a class="blue ml10"
+                   @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
+              </div>
+            </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>
+        <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, 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 { 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';
+import { objectToUint8Array } from '@/utils/objHandle';
 
 export default defineComponent({
     name: 'purchase_pending_settlement',
@@ -149,21 +163,8 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const {visible, cancel} = closeModal('purchase_pending_settlement');
+        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) => {
@@ -176,28 +177,29 @@ export default defineComponent({
         const formStateRules = {
             PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
             PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
-        }
+        };
         function submit() {
             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();
+                        DetailJson: objectToUint8Array(formState), // bytes 明细JSON {}
+                    },
                 })
+                    .then(() => {
+                        message.success('登记成功!');
+                        loading.value = false;
+                        cancel();
+                    })
+                    .catch((err) => {
+                        message.error(err);
+                        loading.value = false;
+                        cancel();
+                    });
             });
         }
 

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

@@ -123,8 +123,9 @@
                               :max="selectedRow.unpricedqty"
                               placeholder="请输入点价数量" />
               <div class="tip">
-                  <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}}</span> </span>
-                  <a class="blue ml10" @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
+                <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}}</span> </span>
+                <a class="blue ml10"
+                   @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
               </div>
             </a-form-item>
           </a-col>
@@ -151,6 +152,7 @@ import { getPriceTypeName } from '@/views/business/purchase/setup';
 import { operationContractReq } from '@/services/proto/contract';
 import { message } from 'ant-design-vue';
 import Long from 'long';
+import { objectToUint8Array } from '@/utils/objHandle';
 
 export default defineComponent({
     name: 'purchase_pending_someprice',
@@ -164,19 +166,6 @@ export default defineComponent({
     setup(props) {
         const { visible, cancel } = closeModal('purchase_pending_someprice');
         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) => {
@@ -194,7 +183,6 @@ export default defineComponent({
             const wrapEl = unref(formRef);
             wrapEl.validate().then(() => {
                 loading.value = true;
-                console.log(objectToUint8Array(formState));
                 operationContractReq({
                     OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
                     Info: {