li.shaoyi 3 年之前
父節點
當前提交
72b41e505e

+ 84 - 3
src/business/order/index.ts

@@ -1,6 +1,7 @@
 import { shallowRef, reactive } from 'vue'
 import { useDataTable } from '@/hooks/datatable'
 import { getTableColumns } from '@/business/table'
+import { getReceiptTypeName } from '@/constants/receipt'
 import { queryMyPerformance, performanceManualConfirm, performanceDelayApply, performanceContractedApply, performanceModifyContact } from '@/services/api/order'
 import { sessionData } from '@/stores'
 import { BuyOrSell } from '@/constants/order'
@@ -114,12 +115,12 @@ export function usePerformanceDelay(selectedRow: Ermcp.MyPerformancRsp) {
 
 // 履约违约申请
 export function usePerformanceContracted(selectedRow: Ermcp.MyPerformancRsp) {
-    const { UserID } = sessionData.getValue('loginInfo')
+    const { UserID, AccountIDs } = sessionData.getValue('loginInfo')
     const loading = shallowRef(false)
 
     const formData = reactive<Proto.PerformanceContractedApplyReq>({
-        PerformancePlanID: Long.fromString(selectedRow.curstepid), // uint64 履约计划ID
-        BreachType: 0, // uint32 违约方类型
+        PerformancePlanID: Long.fromString(selectedRow.performanceplanid), // uint64 履约计划ID
+        BreachType: selectedRow.buyaccountid === AccountIDs[0] ? 2 : 1, // uint32 违约方类型
         Applicant: UserID, // uint64 违约申请人
     })
 
@@ -138,4 +139,84 @@ export function usePerformanceContracted(selectedRow: Ermcp.MyPerformancRsp) {
         formData,
         formSubmit
     }
+}
+
+// 履约修改联络信息
+export function usePerformanceModify(selectedRow: Ermcp.MyPerformancRsp) {
+    const { AccountIDs } = sessionData.getValue('loginInfo')
+    const loading = shallowRef(false)
+    const formData = reactive<{ address?: Ermcp.UserReceiveInfoRsp, invoice?: Ermcp.WrUserReceiptInfoRsp, contactInfo?: string }>({})
+
+    const formSubmit = () => {
+        loading.value = true
+
+        const jsonParam = {
+            ContactInfo: formData.contactInfo,
+            ReceiveInfo: '',
+            ReceiptInfo: ''
+        }
+
+        if (formData.address) {
+            const { provincename, cityname, districtname, address } = formData.address
+            jsonParam.ReceiveInfo = [provincename, cityname, districtname, address].join(' ')
+        }
+
+        if (formData.invoice) {
+            Object.entries(formData.invoice).forEach(([key, value]) => {
+                if (value !== '') {
+                    switch (key) {
+                        case 'receipttype': {
+                            jsonParam.ReceiptInfo += '发票类型:' + getReceiptTypeName(Number(value)) + '\n'
+                            break
+                        }
+                        case 'username': {
+                            jsonParam.ReceiptInfo += '户名:' + value + '\n'
+                            break
+                        }
+                        case 'address': {
+                            jsonParam.ReceiptInfo += '地址:' + value + '\n'
+                            break
+                        }
+                        case 'contactinfo': {
+                            jsonParam.ReceiptInfo += '联系方式:' + value + '\n'
+                            break
+                        }
+                        case 'idnum': {
+                            jsonParam.ReceiptInfo += '身份证号码:' + value + '\n'
+                            break
+                        }
+                        case 'receiptaccount': {
+                            jsonParam.ReceiptInfo += '发票帐号:' + value + '\n'
+                            break
+                        }
+                        case 'receiptbank': {
+                            jsonParam.ReceiptInfo += '发票开户行:' + value + '\n'
+                            break
+                        }
+                        case 'taxpayerid': {
+                            jsonParam.ReceiptInfo += '纳税人识别号:' + value + '\n'
+                            break
+                        }
+                    }
+                }
+            })
+        }
+
+        return performanceModifyContact({
+            data: {
+                PerformancePlanID: Long.fromString(selectedRow.performanceplanid), // uint64 履约计划ID
+                AccountID: AccountIDs[0], // uint64 账号
+                ContactInfo: JSON.stringify(jsonParam), // string 联络信息
+            },
+            complete: () => {
+                loading.value = false
+            }
+        })
+    }
+
+    return {
+        loading,
+        formData,
+        formSubmit
+    }
 }

+ 3 - 3
src/business/table/index.ts

@@ -221,11 +221,11 @@ const pcTableColumnMap = new Map<TableColumnKey, Ermcp.TableColumn[]>([
         { prop: 'sizedisplay', label: '尺寸' },
         { prop: 'zspolishtype1display', label: '重量' },
         { prop: 'price', label: '价格' },
-        { prop: 'matchusername', label: '对手方' },
-        { prop: 'paidamount', label: '已付金额' },
+        { prop: 'accountname', label: '对手方' },
+        { prop: 'paidamount', label: '已付/已付金额' },
         { prop: 'freezeamountremain', label: '履约剩余冻结' },
         { prop: 'performancestatus', label: '履约状态' },
-        { prop: 'curstepid', label: '当前步骤' },
+        { prop: 'steptypeid', label: '当前步骤' },
         { prop: 'remaindays', label: '剩余天数' },
         { prop: 'operate', label: '操作', width: 380 }
     ]],

+ 14 - 0
src/constants/order.ts

@@ -51,4 +51,18 @@ export function getApplyStatusList() {
  */
 export function getApplyStatusName(value: number) {
     return getEnumTypeName(getApplyStatusList(), value)
+}
+
+/**
+ * 履约步骤类型
+ */
+export enum StepType {
+    Payment = 1, // 买方支付
+    Receive = 2, // 卖方收款
+    Pickup = 3, // 买方自提
+    SendGoods = 4, // 卖方发货
+    ConfirmGoods = 5, // 买方确认货
+    SendInvoice = 6, // 卖方发票
+    ConfirmInvoice = 7, // 买方确认票
+    WRMove = 8, // 仓单转移
 }

+ 28 - 0
src/constants/receipt.ts

@@ -0,0 +1,28 @@
+import { getEnumTypeName } from './index'
+
+/**
+ * 发票类型
+ */
+export enum ReceiptType {
+    Consumer = 1, // 个人
+    Company = 2, // 企业
+}
+
+/**
+ * 获取发票类型列表
+ * @returns 
+ */
+export function getReceiptTypeList() {
+    return [
+        { label: '个人', value: ReceiptType.Consumer },
+        { label: '企业', value: ReceiptType.Company },
+    ]
+}
+
+/**
+ * 获取发票类型名称
+ * @returns 
+ */
+export function getReceiptTypeName(value: number) {
+    return getEnumTypeName(getReceiptTypeList(), value)
+}

+ 3 - 0
src/packages/pc/components/modules/address/index.less

@@ -0,0 +1,3 @@
+.app-address {
+    width: 100%;
+}

+ 45 - 0
src/packages/pc/components/modules/address/index.vue

@@ -0,0 +1,45 @@
+<template>
+    <el-select class="app-address" value-key="autoid" :placeholder="placeholder" v-model="selectedItem"
+        @change="onChange" @clear="onChange" clearable>
+        <el-option class="app-address-item" v-for="(item, i) in dataList" :key="i"
+            :label="[item.provincename, item.cityname, item.districtname, item.address].join(' ')" :value="item" />
+    </el-select>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { queryUserReceiveInfo } from '@/services/api/user'
+import { sessionData } from '@/stores'
+
+const props = defineProps({
+    modelValue: Number,
+    placeholder: {
+        type: String,
+        default: '请选择'
+    }
+})
+
+const emit = defineEmits(['update:modelValue', 'change'])
+
+const dataList = shallowRef<Ermcp.UserReceiveInfoRsp[]>([])
+const selectedItem = shallowRef<Ermcp.UserReceiveInfoRsp>()
+
+const onChange = (item?: Ermcp.UserReceiveInfoRsp) => {
+    emit('update:modelValue', item?.autoid)
+    emit('change', item)
+}
+
+queryUserReceiveInfo({
+    data: {
+        userid: sessionData.getLoginInfo('UserID')
+    },
+    success: (res) => {
+        dataList.value = res.data
+        selectedItem.value = res.data.find((e) => e.autoid === props.modelValue)
+    }
+})
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 3 - 0
src/packages/pc/components/modules/invoice/index.less

@@ -0,0 +1,3 @@
+.app-invoice {
+    width: 100%;
+}

+ 46 - 0
src/packages/pc/components/modules/invoice/index.vue

@@ -0,0 +1,46 @@
+<template>
+    <el-select class="app-invoice" value-key="autoid" :placeholder="placeholder" v-model="selectedItem"
+        @change="onChange" @clear="onChange" clearable>
+        <el-option class="app-invoice-item" v-for="(item, i) in dataList" :key="i"
+            :label="[getReceiptTypeName(item.receipttype), item.username].join(' ')" :value="item" />
+    </el-select>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { getReceiptTypeName } from '@/constants/receipt'
+import { queryWrUserReceiptInfo } from '@/services/api/user'
+import { sessionData } from '@/stores'
+
+const props = defineProps({
+    modelValue: Number,
+    placeholder: {
+        type: String,
+        default: '请选择'
+    }
+})
+
+const emit = defineEmits(['update:modelValue', 'change'])
+
+const dataList = shallowRef<Ermcp.WrUserReceiptInfoRsp[]>([])
+const selectedItem = shallowRef<Ermcp.WrUserReceiptInfoRsp>()
+
+const onChange = (item?: Ermcp.WrUserReceiptInfoRsp) => {
+    emit('update:modelValue', item?.autoid)
+    emit('change', item)
+}
+
+queryWrUserReceiptInfo({
+    data: {
+        userid: sessionData.getLoginInfo('UserID')
+    },
+    success: (res) => {
+        dataList.value = res.data
+        selectedItem.value = res.data.find((e) => e.autoid === props.modelValue)
+    }
+})
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 5 - 0
src/packages/pc/views/mine/invoice/index.vue

@@ -5,6 +5,10 @@
             <template #header>
                 <app-auth-operation :menus="['add']" @closed="getUserInvoiceList" />
             </template>
+            <!-- 发票类型 -->
+            <template #receipttype="{ value }">
+                {{ getReceiptTypeName(value) }}
+            </template>
             <template #operate="{ row }">
                 <app-auth-operation :menus="['edit', 'delete']" :options="{ selectedRow: row }"
                     @closed="getUserInvoiceList" />
@@ -20,6 +24,7 @@
 <script lang="ts" setup>
 import { ElMessage } from 'element-plus'
 import { useInvoice } from '@/business/user'
+import { getReceiptTypeName } from '@/constants/receipt'
 import AppAuthOperation from '@pc/components/modules/auth-operation/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
 import AppPagination from '@pc/components/base/pagination/index.vue'

+ 1 - 1
src/packages/pc/views/order/main/components/contracted/index.vue

@@ -6,7 +6,7 @@
                 <span>{{ selectedRow.relatedorderid }}</span>
             </el-form-item>
             <el-form-item label="当前步骤">
-                <span>{{ selectedRow.curstepid }}</span>
+                <span>{{ selectedRow.steptypeid }}</span>
             </el-form-item>
             <el-form-item label="备注" prop="ApplyRemark">
                 <el-input type="textarea" :rows="3" v-model="formData.ApplyRemark" />

+ 1 - 1
src/packages/pc/views/order/main/components/delay/index.vue

@@ -6,7 +6,7 @@
                 <span>{{ selectedRow.relatedorderid }}</span>
             </el-form-item>
             <el-form-item label="当前步骤">
-                <span>{{ selectedRow.curstepid }}</span>
+                <span>{{ selectedRow.steptypeid }}</span>
             </el-form-item>
             <el-form-item label="申请延期天数" prop="delaydays">
                 <el-input type="number" placeholder="请输入" v-model.number="formData.delaydays" />

+ 19 - 10
src/packages/pc/views/order/main/components/edit/index.vue

@@ -5,14 +5,14 @@
             <el-form-item label="履约计划">
                 <span>{{ selectedRow.curstepid }}</span>
             </el-form-item>
-            <el-form-item label="联络信息" prop="ApplyRemark">
-                <el-input type="textarea" :rows="3" v-model="formData.ApplyRemark" />
+            <el-form-item label="联络信息">
+                <el-input type="textarea" :rows="3" v-model="formData.contactInfo" />
             </el-form-item>
-            <el-form-item label="收货地址" prop="ApplyRemark">
-                <el-input type="textarea" :rows="3" v-model="formData.ApplyRemark" />
+            <el-form-item label="收货地址">
+                <app-address @change="addressChange" />
             </el-form-item>
-            <el-form-item label="发票信息" prop="ApplyRemark">
-                <el-input type="textarea" :rows="3" v-model="formData.ApplyRemark" />
+            <el-form-item label="发票信息">
+                <app-invoice @change="invoiceChange" />
             </el-form-item>
         </el-form>
         <template #footer>
@@ -26,8 +26,10 @@
 import { ref, PropType } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
-import { usePerformanceContracted } from '@/business/order'
+import { usePerformanceModify } from '@/business/order'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
+import AppAddress from '@pc/components/modules/address/index.vue'
+import AppInvoice from '@pc/components/modules/invoice/index.vue'
 
 const props = defineProps({
     selectedRow: {
@@ -36,13 +38,20 @@ const props = defineProps({
     }
 })
 
-const { loading, formData, formSubmit } = usePerformanceContracted(props.selectedRow)
+const { loading, formData, formSubmit } = usePerformanceModify(props.selectedRow)
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()
+const formRules: FormRules = {}
 
-const formRules: FormRules = {
-    ApplyRemark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
+// 选择地址
+const addressChange = (item?: Ermcp.UserReceiveInfoRsp) => {
+    formData.address = item
+}
+
+// 选择发票
+const invoiceChange = (item?: Ermcp.WrUserReceiptInfoRsp) => {
+    formData.invoice = item
 }
 
 const onCancel = (isRefresh = false) => {

+ 18 - 0
src/packages/pc/views/order/main/index.vue

@@ -5,6 +5,14 @@
             <app-filter v-bind="{ inputList, buttonList }" :loading="loading" />
         </template>
         <app-table :data="dataList" v-model:columns="columns" :loading="loading">
+            <!-- 已付金额 -->
+            <template #paidamount="{ row }">
+                {{ row.buyorsell === BuyOrSell.Buy ? row.buypaidamount : row.sellreceivedamount }}
+            </template>
+            <!-- 履约剩余冻结 -->
+            <template #freezeamountremain="{ row }">
+                {{ row.buyorsell === BuyOrSell.Buy ? row.buyerfreezeamountremain : row.sellerfreezeamountremain }}
+            </template>
             <!-- 操作 -->
             <template #operate="{ row }">
                 <app-auth-operation :options="{ selectedRow: row }" @closed="getPerformanceList" />
@@ -42,5 +50,15 @@ const buyorsell = (() => {
 
 const { loading, dataList, columns, total, pageIndex, pageSize, inputList, buttonList, getPerformanceList } = usePerformance(buyorsell)
 
+columns.value.forEach((e) => {
+    if (e.prop === 'paidamount') {
+        if (buyorsell === BuyOrSell.Buy) {
+            e.label = '已付金额'
+        } else {
+            e.label = '已收金额'
+        }
+    }
+})
+
 getPerformanceList().catch((err) => ElMessage.error(err))
 </script>

+ 2 - 3
src/packages/pc/views/warehousing/goods/index.vue

@@ -44,13 +44,12 @@ import AppFilter from '@pc/components/base/table-filter/index.vue'
 
 const { loading, dataList, total, pageIndex, pageSize, columns, selectList, inputList, buttonList, getDiamondList } = useDiamond()
 const headerButtons = ['add', 'sell']
-const tableButtons = ['details', 'put', 'pull', 'delete']
 
 const handleTableButtons = (row: Ermcp.MyWRPositionRsp) => {
     if (row.marketflag === 1) {
-        return tableButtons.filter((code) => code !== 'put')
+        return ['details', 'pull']
     }
-    return tableButtons.filter((code) => code !== 'pull')
+    return ['details', 'put', 'delete']
 }
 
 getDiamondList().catch((err) => ElMessage.error(err))

+ 7 - 0
src/services/api/performance/index.ts

@@ -6,4 +6,11 @@ import { HttpRequest } from '@/services/http/interface'
  */
 export function queryPermancePlanTmp(params: HttpRequest<{ req: Ermcp.PermancePlanTmpReq, rsp: Ermcp.PermancePlanTmpRsp[] }>) {
     return httpRequest('/WrTrade2/QueryPermancePlanTmp', 'get', params);
+}
+
+/**
+ * 查询履约步骤枚举
+ */
+export function queryWrPerformanceStepType(params: HttpRequest<{ rsp: Ermcp.WrPerformanceStepTypeRsp[] }>) {
+    return httpRequest('/WrTrade2/QueryWrPerformanceStepType', 'get', params);
 }

+ 2 - 1
src/stores/modules/storage.ts

@@ -25,7 +25,8 @@ const initData: Store.GlobalStorage = {
     userMenus: [],
     allEnums: [],
     tableColumns: [],
-    errorInfos: []
+    errorInfos: [],
+    performanceStepTypes: [],
 }
 
 /**

+ 7 - 0
src/types/ermcp/performance.d.ts

@@ -39,4 +39,11 @@ declare namespace Ermcp {
         stepvalue: number;//步骤值
         templateid: number;//履约计划模板ID
     }
+
+    /** 查询履约步骤枚举 响应 */
+    interface WrPerformanceStepTypeRsp {
+        canauto: number; // 能否自动确认 - 0:不可自动确认 1:可自动确认 (可设置自动确认步骤: 1:买方支付 3:买方自提 5:买方确认货 7:买方确认票)
+        steptypeid: number; // 步骤类型ID - 1:买方支付 2:卖方收款 3:买方自提 4:卖方发货 5:买方确认货 6:卖方发票 7:买方确认票 8:仓单转移
+        steptypename: string; // 步骤类型名称
+    }
 }

+ 1 - 0
src/types/ermcp/trade.d.ts

@@ -545,6 +545,7 @@ declare namespace Ermcp {
     interface MyPerformancRsp {
         accountname: string; // useraccount
         amount: number; // 履约金额
+        buyaccountid: number; // 买方账号
         buyerfreezeamount: number; // 买方履约前冻结资金
         buyerfreezeamountremain: number; // 买方履约前冻结资金剩余
         buyerinfo: string; // 买方联系信息 - 存JSON字符串, 根据枚举‘BuyerContactInfo’,显示\隐藏字段,若数据不为JSON,则直接显示{ "ContactInfo": "xxxxxxxx", "ReceiveInfo": "xxxxxxxxx", "ReceiptInfo": "xxxxxxxxxxxx"}

+ 1 - 1
src/types/proto/order.d.ts

@@ -61,7 +61,7 @@ declare global {
         /** 履约修改联络信息请求 */
         interface PerformanceModifyContactReq {
             Header?: IMessageHead;
-            PerformancePlanID: number; // uint64 履约计划ID
+            PerformancePlanID: Long; // uint64 履约计划ID
             AccountID: number; // uint64 账号
             ContactInfo: string; // string 联络信息
         }

+ 1 - 0
src/types/store/globalStorage.d.ts

@@ -12,6 +12,7 @@ declare global {
             allEnums: Ermcp.EnumRsp[]; // 所有枚举
             tableColumns: Ermcp.TableDefineRsp[];
             errorInfos: Ermcp.ErrorInfosRsp[];
+            performanceStepTypes: Ermcp.WrPerformanceStepTypeRsp[];
         }
     }
 }