li.shaoyi 3 rokov pred
rodič
commit
b7aa9cbc6d

+ 2 - 1
src/business/common/index.ts

@@ -23,13 +23,14 @@ export function logout(callback?: () => void) {
 export async function initBaseData(callback?: () => void) {
     checkTokenLoop()
 
-    const { userStore, futuresStore, menuStore, performanceStore, accountStore, favoriteStore } = useStore()
+    const { userStore, futuresStore, menuStore, performanceStore, accountStore, favoriteStore, exrateStore } = useStore()
     const asyncTask = [
         userStore.getUserData(),
         menuStore.getUserMenuList(),
         futuresStore.getGoodsList(),
         performanceStore.getPerformanceTemplateList(),
         performanceStore.getPerformanceStepTypeList(),
+        exrateStore.getExrateList(),
         //tableColumnStore.getTableColumnList(),
     ]
 

+ 1 - 30
src/business/goods/index.ts

@@ -6,7 +6,6 @@ import { formatDecimal } from '@/filters'
 import { ClientType } from '@/constants/client'
 import { Market } from '@/constants/market'
 import { queryWarehouseInfo } from '@/services/api/warehouse'
-import { queryMyFavorite } from '@/services/api/favorite'
 import { addDiamond, queryDiamondList, queryDiamondDetails, goodsFavoriteOperate, receiptZSOutApply } from '@/services/api/goods'
 import { useLoginStore } from '@/stores'
 import {
@@ -125,24 +124,12 @@ export function useDiamond() {
 
 // 钻石详情相关
 export function useDiamondDetails(goodsno: string) {
-    const { getUserId } = useLoginStore()
     const loading = shallowRef(false)
     const details = shallowRef<Ermcp.DiamondDetailsRsp>()
-    const favoriteList = shallowRef<Ermcp.MyFavoriteRsp[]>([]) // 我的收藏列表
-
-    // 是否显示收藏
-    const showFavorite = computed(() => {
-        const favorites = favoriteList.value
-        // 判断该是否已收藏过
-        if (favorites.length && favorites.every((e) => e.goodsno !== details.value?.goodsno)) {
-            return true
-        }
-        return false
-    })
 
     const getDiamondDetails = async () => {
         loading.value = true
-        const task1 = queryDiamondDetails({
+        return queryDiamondDetails({
             data: {
                 goodsno,
             },
@@ -153,27 +140,11 @@ export function useDiamondDetails(goodsno: string) {
                 loading.value = false
             }
         })
-
-        const task2 = queryMyFavorite({
-            data: {
-                userid: getUserId(),
-            },
-            success: (res) => {
-                favoriteList.value = res.data
-            }
-        })
-
-        try {
-            return await Promise.all([task1, task2])
-        } finally {
-            loading.value = false
-        }
     }
 
     return {
         loading,
         details,
-        showFavorite,
         getDiamondDetails,
     }
 }

+ 12 - 10
src/business/trade/desting.ts

@@ -118,16 +118,18 @@ export function useSellOrderBargain(selectedRow: Ermcp.BuyOrderRsp) {
     })
 
     const columns = shallowRef<Ermcp.TableColumn[]>([
-        { prop: 'goodsno', label: '商品编号', show: true, },
-        { prop: 'price', label: '总价', show: true, },
-        { prop: 'weight', label: '总重量', show: true, },
-        { prop: 'weightavg', label: '平均单颗重量', show: true, },
-        { prop: 'priceper', label: '克拉单位', show: true, },
-        { prop: 'ftotalqty', label: '库存重量', show: true, },
-        { prop: 'remainqty', label: '剩余重量', show: true, },
-        { prop: 'zsshapetypedisplay', label: '形状', show: true, width: 200, },
-        { prop: 'zscolortype', label: '颜色', show: true, },
-        { prop: 'zsclaritytype', label: '净度', show: true, }
+        { prop: 'warehousenamedisplay', label: '仓库', show: true },
+        { prop: 'zsshapetypedisplay', label: '形状', width: 200, show: true },
+        { prop: 'zscolortype1display', label: '颜色', show: true },
+        { prop: 'zsclaritytype1display', label: '净度', show: true },
+        { prop: 'zscuttype1display', label: '切工', show: true },
+        { prop: 'zspolishtype1display', label: '抛光', show: true },
+        { prop: 'zssymmetrytype1display', label: '对称', show: true },
+        { prop: 'zsfluorescencetype1display', label: '荧光', show: true },
+        { prop: 'sizedisplay', label: '尺寸', show: true },
+        { prop: 'price', label: '价格', show: true },
+        { prop: 'weight', label: '克拉重量', show: true },
+        { prop: 'priceper', label: '克拉单价', show: true },
     ])
 
     const formSubmit = () => {

+ 17 - 79
src/business/trade/listing.ts

@@ -112,15 +112,28 @@ export function useSellOrderListing(selectedRow?: Ermcp.MyWRPositionRsp) {
     const { getUserId, getFirstAccountId } = useLoginStore()
     const { dataList } = useDataTable<Ermcp.MyWRPositionRsp>()
     const { zscategory, wrstandardid = 0, ladingbillid = '0', subnum = 0, ftotalqty = 0, ffreezeqty = 0 } = selectedRow ?? {}
-
     const submitLoading = shallowRef(false)
     const tableLoading = shallowRef(false)
-    const columns = shallowRef<Ermcp.TableColumn[]>([])
+    const selectedCategoryId = shallowRef(zscategory ?? Category.Diamond)
+
     const categoryList = [
         { label: '单颗裸钻', value: Category.Diamond },
         { label: '单颗彩钻', value: Category.Fancy }
     ]
-    const selectedCategoryId = shallowRef(zscategory ?? Category.Diamond)
+
+    const columns = shallowRef<Ermcp.TableColumn[]>([
+        { prop: 'warehousenamedisplay', label: '仓库', show: true },
+        { prop: 'zsshapetypedisplay', label: '形状', width: 200, show: true },
+        { prop: 'zscolortype1display', label: '颜色', show: true },
+        { prop: 'zsclaritytype1display', label: '净度', show: true },
+        { prop: 'zscuttype1display', label: '切工', show: true },
+        { prop: 'zspolishtype1display', label: '抛光', show: true },
+        { prop: 'zssymmetrytype1display', label: '对称', show: true },
+        { prop: 'zsfluorescencetype1display', label: '荧光', show: true },
+        { prop: 'sizedisplay', label: '尺寸', show: true },
+        { prop: 'price', label: '价格', show: true },
+        { prop: 'weight', label: '克拉重量', show: true },
+    ])
 
     const formData = reactive<Proto.ZSSellOrderListingReq>({
         Header: {
@@ -159,81 +172,6 @@ export function useSellOrderListing(selectedRow?: Ermcp.MyWRPositionRsp) {
         })
     }
 
-    // 切换商品分类
-    const categoryChange = () => {
-        switch (selectedCategoryId.value) {
-            case Category.Diamonds: {
-                columns.value = [
-                    { prop: 'goodsno', label: '商品编号', show: true, },
-                    { prop: 'price', label: '总价', show: true, },
-                    { prop: 'weight', label: '总重量', show: true, },
-                    { prop: 'weightavg', label: '平均单颗重量', show: true, },
-                    { prop: 'priceper', label: '克拉单位', show: true, },
-                    { prop: 'ftotalqty', label: '库存重量', show: true, },
-                    { prop: 'remainqty', label: '剩余重量', show: true, },
-                    { prop: 'zsshapetypedisplay', label: '形状', show: true, width: 200, },
-                    { prop: 'zscolortype', label: '颜色', show: true, },
-                    { prop: 'zsclaritytype', label: '净度', show: true, }
-                ]
-                break
-            }
-            case Category.Diamond: {
-                columns.value = [
-                    { prop: 'goodsno', label: '商品编号', show: true, },
-                    { prop: 'price', label: '价格', show: true, },
-                    { prop: 'weight', label: '克拉重量', show: true, },
-                    { prop: 'priceper', label: '克拉单位', show: true, },
-                    { prop: 'zsshapetypedisplay', label: '形状', width: 200, show: true, },
-                    { prop: 'zscolortype1display', label: '颜色', show: true, },
-                    { prop: 'zsclaritytype1display', label: '净度', show: true, }
-                ]
-                break
-            }
-            case Category.Rough: {
-                columns.value = [
-                    { prop: 'goodsno', label: '商品编号', show: true, },
-                    { prop: 'price', label: '总价', show: true, },
-                    { prop: 'weight', label: '总重量', show: true, },
-                    { prop: 'weightavg', label: '平均单颗重量', show: true, },
-                    { prop: 'priceper', label: '克拉单位', show: true, },
-                    { prop: 'ftotalqty', label: '库存重量', show: true, },
-                    { prop: 'remainqty', label: '剩余重量', show: true, },
-                    { prop: 'zscrystaltypedisplay', label: '晶型', width: 200, show: true, },
-                    { prop: 'zscolortype', label: '颜色', show: true, },
-                    { prop: 'zsclaritytype', label: '净度', show: true, }
-                ]
-                break
-            }
-            case Category.Jewelry: {
-                columns.value = [
-                    { prop: 'goodsno', label: '商品编号', show: true, },
-                    { prop: 'price', label: '价格', show: true, },
-                    { prop: 'weight', label: '主石重量', show: true, },
-                    { prop: 'priceper', label: '克拉单位', show: true, },
-                    { prop: 'zsstyletypedisplay', label: '款式', width: 200, show: true, },
-                    { prop: 'zsstyletypedisplay', label: '主石形状', width: 200, show: true, },
-                    { prop: 'zsclaritytype1display', label: '主石净度', show: true, },
-                    { prop: 'zscuttype1display', label: '主石切工', show: true, },
-                    { prop: 'zssymmetrytype1display', label: '主石对称度', show: true, }
-                ]
-                break
-            }
-            case Category.Fancy: {
-                columns.value = [
-                    { prop: 'goodsno', label: '商品编号', show: true, },
-                    { prop: 'price', label: '价格', show: true, },
-                    { prop: 'weight', label: '克拉重量', show: true, },
-                    { prop: 'priceper', label: '克拉单位', show: true, },
-                    { prop: 'zsshapetypedisplay', label: '形状', width: 200, show: true, },
-                    { prop: 'zsczcolortype', label: '颜色', width: 200, show: true, },
-                    { prop: 'zsclaritytype1display', label: '净度', show: true, }
-                ]
-                break
-            }
-        }
-        getDiamondList()
-    }
-
     const formSubmit = () => {
         submitLoading.value = true
         return zsSellOrderListing({
@@ -256,7 +194,7 @@ export function useSellOrderListing(selectedRow?: Ermcp.MyWRPositionRsp) {
         columns,
         categoryList,
         selectedCategoryId,
-        categoryChange,
+        getDiamondList,
         formSubmit,
     }
 }

+ 8 - 0
src/constants/diamond.ts

@@ -16,6 +16,14 @@ export enum Category {
 }
 
 /**
+ * 货币类型
+ */
+export enum CurrencyType {
+    CNY = 1, // 人民币
+    USD = 2, // 美元
+}
+
+/**
  * 获取钻石分类列表
  * @returns 
  */

+ 1 - 1
src/filters/index.ts

@@ -46,7 +46,7 @@ export function handleNumberValue(value: number, suffix = '') {
  * @param round 是否四舍五入
  * @returns 
  */
-export function formatDecimal(value: number, decimal = 2, round = true) {
+export function formatDecimal(value: number | string, decimal = 2, round = true) {
     const val = Number(value)
     if (decimal <= 0) {
         if (round) {

+ 5 - 3
src/hooks/component/index.ts

@@ -4,7 +4,7 @@ import { ref } from 'vue'
  * @param callback 组件关闭时的回调
  * @returns 
  */
-export function useComponent(callback?: () => void) {
+export function useComponent(callback?: (componentName?: string) => void) {
     // 组件名
     const componentId = ref<string>();
 
@@ -26,11 +26,13 @@ export function useComponent(callback?: () => void) {
      * @param isCallback 
      */
     const closeComponent = (isCallback?: boolean) => {
-        console.log('关闭组件:' + componentId.value?.toString());
+        const componentName = componentId.value
         componentId.value = undefined;
+        console.log('关闭组件:' + componentName);
+
         // 是否刷新数据
         if (isCallback && callback) {
-            callback();
+            callback(componentName);
         }
     }
 

+ 7 - 6
src/packages/pc/views/favorite/main/components/cancel/index.vue

@@ -1,9 +1,9 @@
 <!-- 我的收藏-取消 -->
 <template>
-    <app-drawer title="提示" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="提示" v-model:show="show" :loading="loading">
         <div style="font-size:16px;text-align:center">是否删除该收藏?</div>
         <template #footer>
-            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button @click="onCancel" plain>取消</el-button>
             <el-button type="primary" @click="onSubmit">确认</el-button>
         </template>
     </app-drawer>
@@ -13,6 +13,7 @@
 import { shallowRef, PropType } from 'vue'
 import { ElMessage } from 'element-plus'
 import { useDiamondFavorite } from '@/business/goods'
+import { useFavoriteStore } from '@/stores'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
 const props = defineProps({
@@ -23,18 +24,18 @@ const props = defineProps({
 })
 
 const { loading, formSubmit } = useDiamondFavorite(props.selectedRow)
+const { getFavoriteList } = useFavoriteStore()
 const show = shallowRef(true)
-const refresh = shallowRef(false)
 
-const onCancel = (isRefresh = false) => {
+const onCancel = () => {
     show.value = false
-    refresh.value = isRefresh
 }
 
 const onSubmit = () => {
     formSubmit(2).then(() => {
         ElMessage.success('提交成功')
-        onCancel(true)
+        getFavoriteList()
+        onCancel()
     }).catch((err) => {
         ElMessage.error('提交失败:' + err)
     })

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

@@ -60,7 +60,7 @@ const props = defineProps({
 const { dataList, columns, getPlanStepList } = usePerformancePlanStep(props.selectedRow.performanceplanid)
 const currentStepIndex = computed(() => dataList.value.findIndex((e) => e.performancestepid === props.selectedRow.curstepid)) // 当前步骤索引位置
 
-const rowStyle = ({ row, rowIndex }: { row: Ermcp.WrPerformancePlanStepRsp, rowIndex: number }) => {
+const rowStyle = ({ rowIndex }: { rowIndex: number }) => {
     if (currentStepIndex.value > rowIndex) {
         return {
             color: 'green'

+ 20 - 2
src/packages/pc/views/trade/buy/components/delisting/index.vue

@@ -1,13 +1,24 @@
+<!-- 挂牌大厅-求购大厅-详情-我的摘牌 -->
 <template>
     <h3>我的摘牌</h3>
     <app-table :data="dataList" :columns="columns" :show-header="false" selection-type="single" border
-        @select="onTableSelect" />
+        @select="onTableSelect">
+        <!-- 价格 -->
+        <template #price="{ row }">
+            {{ row.zscurrencytypedisplayunit + formatDecimal(row.price) }}
+        </template>
+        <!-- 克拉单价 -->
+        <template #priceper="{ row }">
+            {{ row.zscurrencytypedisplayunit + formatDecimal(row.priceper) }}
+        </template>
+    </app-table>
     <el-form ref="formRef" label-width="80px" :model="formData" :rules="formRules" v-if="dataList.length"
         style="width:460px">
         <el-form-item label="价格(¥)" prop="ApplyPrice">
             <div class="el-form-item--col">
                 <el-input type="number" placeholder="请输入" v-model.number="formData.ApplyPrice" />
-                <span style="white-space:nowrap;">汇率:6.7500</span>
+                <span style="white-space:nowrap;"
+                    v-if="selectedGoods && selectedGoods.zscurrencytype !== CurrencyType.CNY">汇率:{{getExrate(selectedGoods.zscurrencytype)}}</span>
             </div>
         </el-form-item>
         <el-form-item label="备注" prop="ApplyRemark">
@@ -24,7 +35,10 @@ import { ref, PropType } from 'vue'
 import Long from 'long'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
+import { formatDecimal } from '@/filters'
+import { CurrencyType } from '@/constants/diamond'
 import { useSellOrderBargain } from '@/business/trade/desting'
+import { useExrateStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
 
 const props = defineProps({
@@ -34,7 +48,9 @@ const props = defineProps({
     }
 })
 
+const { getExrate } = useExrateStore()
 const { loading, dataList, columns, formData, formSubmit, getDiamondList } = useSellOrderBargain(props.selectedRow)
+const selectedGoods = ref<Ermcp.MyWRPositionRsp>() // 当前选中的商品
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -45,11 +61,13 @@ const formRules: FormRules = {
 const onTableSelect = (rows: Ermcp.MyWRPositionRsp[]) => {
     const row = rows[0]
     if (row) {
+        selectedGoods.value = row
         formData.WRStandardID = row.wrstandardid
         formData.LadingBillID = Long.fromString(row.ladingbillid)
         formData.ApplyQty = row.weight
         formData.SubNum = row.subnum
     } else {
+        selectedGoods.value = undefined
         formData.WRStandardID = 0
     }
 }

+ 7 - 18
src/packages/pc/views/trade/sale/components/add/index.vue

@@ -3,7 +3,7 @@
     <app-drawer title="我要出售" :width="960" v-model:show="show" :loading="submitLoading" :refresh="refresh">
         <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
             <el-form-item label="商品分类" prop="ZSCategory">
-                <el-select v-model="selectedCategoryId" :disabled="tableLoading" @change="categoryChange">
+                <el-select v-model="selectedCategoryId" :disabled="tableLoading" @change="getDiamondList">
                     <el-option :label="item.label" :value="item.value" v-for="(item, index) in categoryList"
                         :key="index" />
                 </el-select>
@@ -14,21 +14,9 @@
         </el-form>
         <app-table :data="dataList" :columns="columns" :max-height="400" :show-header="false" :loading="tableLoading"
             selection-type="single" border @select="onTableSelect">
-            <!-- 剩余数量 -->
-            <template #remainqty="{ row }">
-                {{ row.ftotalqty - row.ffreezeqty }}
-            </template>
-            <!-- 颜色 -->
-            <template #zscolortype="{ row }">
-                {{ [row.zscolortype1display, row.zscolortype2display].join('-') }}
-            </template>
-            <!-- 净度 -->
-            <template #zsclaritytype="{ row }">
-                {{ [row.zsclaritytype1display, row.zsclaritytype2display].join('-') }}
-            </template>
-            <!-- 彩钻颜色 -->
-            <template #zsczcolortype="{ row }">
-                {{ [row.zsczcolor1typedisplay, row.zsczcolor2typedisplay, row.zsczcolor3typedisplay].join('-') }}
+            <!-- 价格 -->
+            <template #price="{ row }">
+                {{ row.zscurrencytypedisplayunit + formatDecimal(row.price) }}
             </template>
         </app-table>
         <template #footer>
@@ -43,6 +31,7 @@ import { ref, defineAsyncComponent } from 'vue'
 import Long from 'long'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
+import { formatDecimal } from '@/filters'
 import { useSellOrderListing } from '@/business/trade/listing'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
@@ -51,7 +40,7 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const { tableLoading, submitLoading, formData, dataList, columns, selectedCategoryId, categoryList, categoryChange, formSubmit } = useSellOrderListing()
+const { tableLoading, submitLoading, formData, dataList, columns, selectedCategoryId, categoryList, getDiamondList, formSubmit } = useSellOrderListing()
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()
@@ -105,5 +94,5 @@ const onSubmit = () => {
     })
 }
 
-categoryChange()
+getDiamondList()
 </script>

+ 6 - 2
src/packages/pc/views/warehousing/goods/components/bargain/index.vue

@@ -5,7 +5,8 @@
             <el-form-item label="价格" prop="ApplyPrice">
                 <div class="el-form-item--col">
                     <el-input type="number" placeholder="请输入" v-model.number="formData.ApplyPrice" />
-                    <span style="white-space:nowrap;">汇率:6.7500</span>
+                    <span style="white-space:nowrap;"
+                        v-if="selectedRow.zscurrencytype !== CurrencyType.CNY">汇率:{{getExrate(selectedRow.zscurrencytype)}}</span>
                 </div>
             </el-form-item>
             <el-form-item label="备注" prop="ApplyRemark">
@@ -23,16 +24,19 @@
 import { ref, PropType } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
+import { CurrencyType } from '@/constants/diamond'
+import { useExrateStore } from '@/stores'
 import { useBuyOrderBargain } from '@/business/trade/desting'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
 const props = defineProps({
     selectedRow: {
         type: Object as PropType<Ermcp.DiamondDetailsRsp>,
-        default: () => ({})
+        required: true
     }
 })
 
+const { getExrate } = useExrateStore()
 const { loading, formData, formSubmit } = useBuyOrderBargain(props.selectedRow)
 const formRef = ref<FormInstance>()
 const show = ref(true)

+ 1 - 1
src/packages/pc/views/warehousing/goods/components/buy/index.vue

@@ -18,7 +18,7 @@ import AppDrawer from '@pc/components/base/drawer/index.vue'
 const props = defineProps({
     selectedRow: {
         type: Object as PropType<Ermcp.DiamondDetailsRsp>,
-        default: () => ({})
+        required: true
     }
 })
 

+ 37 - 18
src/packages/pc/views/warehousing/goods/components/details/index.vue

@@ -4,10 +4,10 @@
         <app-view class="app-details" v-bind="$attrs">
             <template #header>
                 <div v-if="details">
-                    <el-button @click="$emit('closed')">返回</el-button>
+                    <el-button @click="emit('closed')">返回</el-button>
                     <template v-if="showButton && details.wrtradeorderid">
-                        <!--摘牌成功后关闭详情页同时刷新列表页-->
-                        <el-button type="primary" @click="openComponent('favorite')" v-if="showFavorite">收藏</el-button>
+                        <el-button type="primary" @click="openComponent('favorite')"
+                            v-if="!hasFavorite(details.goodsno)">收藏</el-button>
                         <el-button type="primary" @click="openComponent('buy')">立即购买</el-button>
                         <el-button type="primary" @click="openComponent('bargain')">询价申请</el-button>
                     </template>
@@ -28,37 +28,43 @@
                                 </tr>
                                 <tr>
                                     <td>克拉重量</td>
-                                    <td>{{details.weight}}</td>
+                                    <td>{{details.weight}}克拉</td>
                                 </tr>
                                 <tr>
                                     <td>价格</td>
-                                    <td>{{details.price}}</td>
+                                    <td>{{ details.zscurrencytypedisplayunit + formatDecimal(details.price) }}</td>
                                 </tr>
                                 <tr>
                                     <td>克拉单价</td>
-                                    <td>{{details.priceper}}</td>
+                                    <td>{{ details.zscurrencytypedisplayunit + formatDecimal(details.priceper) }}</td>
                                 </tr>
                                 <tr>
                                     <td>市场价</td>
-                                    <td>{{details.marketprice}}</td>
+                                    <td>{{ details.zscurrencytypedisplayunit + formatDecimal(details.marketprice) }}
+                                    </td>
                                 </tr>
-                                <tr>
-                                    <td>汇率</td>
-                                    <td></td>
+                                <tr v-if="details.zscurrencytype !== CurrencyType.CNY">
+                                    <td>{{exchangeRate(details.zscurrencytype,details.price)}}</td>
+                                    <td>汇率:{{getExrate(details.zscurrencytype)}}</td>
                                 </tr>
                                 <tr>
                                     <td>卖家名称</td>
-                                    <td></td>
+                                    <td>{{details.sellusername}}</td>
+                                </tr>
+                                <tr>
+                                    <td>联系电话</td>
+                                    <td>{{details.mobile}}</td>
                                 </tr>
                                 <tr>
                                     <td>仓库地址</td>
-                                    <td></td>
+                                    <td>{{[details.provincename, details.cityname, details.districtname,
+                                    details.address].join(' ')}}</td>
                                 </tr>
                             </tbody>
                         </table>
                     </div>
                 </div>
-                <div class="rule" style="margin-bottom:48px">
+                <div class="rule" style="margin-bottom:48px" v-if="details.performancetemplateid !== 0">
                     <h1>履约规则</h1>
                     {{details.performancetemplateid}}
                 </div>
@@ -96,7 +102,7 @@
                             </tr>
                             <tr>
                                 <td>尺寸</td>
-                                <td>{{details.size1}}</td>
+                                <td>{{details.sizedisplay}}</td>
                             </tr>
                             <tr>
                                 <td>证书类型</td>
@@ -118,7 +124,9 @@
 
 <script lang="ts" setup>
 import { computed, PropType, defineAsyncComponent } from 'vue'
-import { useLoginStore } from '@/stores'
+import { formatDecimal } from '@/filters'
+import { CurrencyType } from '@/constants/diamond'
+import { useLoginStore, useFavoriteStore, useExrateStore } from '@/stores'
 import { useComponent } from '@/hooks/component'
 import { useDiamondDetails } from '@/business/goods'
 
@@ -135,13 +143,24 @@ const props = defineProps({
     },
     selectedRow: {
         type: Object as PropType<{ goodsno: string }>,
-        default: () => ({})
+        required: true
     },
 })
 
+const emit = defineEmits(['closed'])
 const { getUserId } = useLoginStore()
-const { details, showFavorite, getDiamondDetails } = useDiamondDetails(props.selectedRow.goodsno)
-const { componentId, openComponent, closeComponent } = useComponent(getDiamondDetails)
+const { getExrate, exchangeRate } = useExrateStore()
+const { hasFavorite } = useFavoriteStore()
+const { details, getDiamondDetails } = useDiamondDetails(props.selectedRow.goodsno)
+
+const { componentId, openComponent, closeComponent } = useComponent((componentName) => {
+    if (componentName === 'buy') {
+        // 摘牌成功后关闭详情页同时刷新列表页
+        emit('closed', true)
+    } else {
+        getDiamondDetails()
+    }
+})
 
 // 不能购买自己上架的商品
 const showButton = computed(() => {

+ 7 - 6
src/packages/pc/views/warehousing/goods/components/favorite/index.vue

@@ -1,8 +1,8 @@
 <template>
-    <app-drawer title="提示" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="提示" v-model:show="show" :loading="loading">
         <div style="font-size:16px;text-align:center">是否收藏该商品?</div>
         <template #footer>
-            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button @click="onCancel" plain>取消</el-button>
             <el-button type="primary" @click="onSubmit">确认</el-button>
         </template>
     </app-drawer>
@@ -12,6 +12,7 @@
 import { shallowRef, PropType } from 'vue'
 import { ElMessage } from 'element-plus'
 import { useDiamondFavorite } from '@/business/goods'
+import { useFavoriteStore } from '@/stores'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
 const props = defineProps({
@@ -22,18 +23,18 @@ const props = defineProps({
 })
 
 const { loading, formSubmit } = useDiamondFavorite(props.selectedRow)
+const { getFavoriteList } = useFavoriteStore()
 const show = shallowRef(true)
-const refresh = shallowRef(false)
 
-const onCancel = (isRefresh = false) => {
+const onCancel = () => {
     show.value = false
-    refresh.value = isRefresh
 }
 
 const onSubmit = () => {
     formSubmit(1).then(() => {
         ElMessage.success('提交成功')
-        onCancel(true)
+        getFavoriteList()
+        onCancel()
     }).catch((err) => {
         ElMessage.error('提交失败:' + err)
     })

+ 1 - 1
src/services/api/common/index.ts

@@ -60,7 +60,7 @@ export function deleteNewFuncmenu(params: HttpRequest<{ req: Partial<Ermcp.NewFu
 /**
  * 查询汇率信息
  */
-export function queryRates(params: HttpRequest<{ req: Ermcp.RatesReq, rsp: Ermcp.RatesRsp }>) {
+export function queryRates(params: HttpRequest<{ req: Ermcp.RatesReq, rsp: Ermcp.RatesRsp[] }>) {
     return httpRequest('/Common/QueryRates', 'get', params);
 }
 

+ 3 - 0
src/stores/index.ts

@@ -10,6 +10,7 @@ import { useErrorInfoStore } from './modules/errorInfo'
 import { useFavoriteStore } from './modules/favorite'
 import { useTableColumnStore } from './modules/tableColumn'
 import { usePerformanceStore } from './modules/performance'
+import { useExrateStore } from './modules/exrate'
 
 export {
     useLoginStore,
@@ -24,6 +25,7 @@ export {
     useFavoriteStore,
     useTableColumnStore,
     usePerformanceStore,
+    useExrateStore,
 }
 
 export function useStore() {
@@ -40,5 +42,6 @@ export function useStore() {
         favoriteStore: useFavoriteStore(),
         tableColumnStore: useTableColumnStore(),
         performanceStore: usePerformanceStore(),
+        exrateStore: useExrateStore(),
     }
 }

+ 59 - 0
src/stores/modules/exrate.ts

@@ -0,0 +1,59 @@
+import { toRefs, shallowReadonly } from 'vue'
+import { getCurrencyTypeInfo, CurrencyType } from '@/constants/diamond'
+import { queryRates } from '@/services/api/common'
+import { VueStore } from '../base'
+
+interface StoreState {
+    loading: boolean;
+    exrateList: Ermcp.RatesRsp[]; // 汇率列表
+}
+
+/**
+ * 汇率存储类
+ */
+const store = new (class extends VueStore<StoreState>{
+    constructor() {
+        const state: StoreState = {
+            loading: false,
+            exrateList: [],
+        }
+        super(state)
+    }
+
+    actions = {
+        /** 获取汇率列表 */
+        getExrateList: () => {
+            this.state.loading = true
+            return queryRates({
+                success: (res) => {
+                    this.state.exrateList = res.data
+                },
+                complete: () => {
+                    this.state.loading = false
+                }
+            })
+        },
+        /** 获取币种汇率 */
+        getExrate: (currencyId: number) => {
+            const exrate = this.state.exrateList.find((e) => e.oricurrencyid === currencyId)
+            return exrate?.exchangerate ?? 0
+        },
+        /** 汇率转换 */
+        exchangeRate: (currencyId: number, currencyValue: number, prefix = true) => {
+            const exrate = this.actions.getExrate(currencyId)
+            const currency = getCurrencyTypeInfo(currencyId)
+            const cny = getCurrencyTypeInfo(CurrencyType.CNY) // 人民币
+            const unit = prefix && exrate ? cny?.param2 : currency?.param2 // 币种单位符号
+
+            return unit + (exrate ? currencyValue * exrate : currencyValue).toFixed(2)
+        }
+    }
+})
+
+export function useExrateStore() {
+    return shallowReadonly({
+        ...toRefs(store.state),
+        ...store.actions,
+        ...store.methods,
+    })
+}

+ 2 - 2
src/types/ermcp/common.d.ts

@@ -18,8 +18,8 @@ declare namespace Ermcp {
     interface RatesReq {
         page?: number; // 页码
         pagesize?: number; // 每页条数
-        oricurrencyid: number; // 源币种ID
-        descurrencyid: number; // 目标币种ID
+        oricurrencyid?: number; // 源币种ID
+        descurrencyid?: number; // 目标币种ID
     }
 
     /** 查询汇率信息 响应 */

+ 6 - 0
src/types/ermcp/goods.d.ts

@@ -107,8 +107,12 @@ declare namespace Ermcp {
 
     /** 获取钻石详情响应 */
     interface DiamondDetailsRsp {
+        address: string; // 详细地址
         cerno: string; // 证书编号 - 类型:2,4,5
+        cityname: string; // 城市名称
+        countryname: string; // 国家名称
         cpcertno: string; // 金伯利证书编号 - 类型:3
+        districtname: string; // 地区名称
         goodsno: string; // 商品编号
         imagepath: string; // 商品照片(相对地址)
         isvalid: number; // 是否有效 - 0:无效 1:有效
@@ -120,6 +124,7 @@ declare namespace Ermcp {
         performancetemplateid: number; // 履约计划模板ID
         price: number; // 总价(价格) - 类型:1,2,3,4,5
         priceper: string; // 克拉单价 - 类型:1,2,3,5
+        provincename: string; // 省名称
         remainqty: number; // 剩余重量
         remark: string; // 备注
         sellusername: string; // 账户名称(机构名称)
@@ -127,6 +132,7 @@ declare namespace Ermcp {
         size1: string; // 尺寸1 - 类型:2,4,5
         size2: string; // 尺寸2 - 类型:2,4,5
         size3: string; // 尺寸3 - 类型:2,4,5
+        sizedisplay: string; // 尺寸
         stonedesc: string; // 配石描述 - 类型:4
         userid: number; // 用户ID
         warehouseid: number; // 仓库ID