li.shaoyi 3 år sedan
förälder
incheckning
c8cad77b42

+ 81 - 13
src/business/order/index.ts

@@ -3,6 +3,7 @@ import { v4 } from 'uuid'
 import { ClientType } from '@/constants/enum/client'
 import { useDataTable } from '@/hooks/datatable'
 import { Market } from '@/constants/enum/market'
+import { queryDiamondList } from '@/services/api/goods'
 import { zsBuyOrderListing, zsSellOrderListing, queryBuyOrder, querySellOrder, queryMyBuyOrder, queryMySellOrder } from '@/services/api/order'
 import { sessionData } from '@/stores'
 import {
@@ -60,11 +61,13 @@ export function useBuyOrder() {
         {
             prop: 'validtime',
             label: '有效日期',
+            width: 180,
             show: true,
         },
         {
             prop: 'ordertime',
             label: '委托时间',
+            width: 180,
             show: true,
         },
         {
@@ -233,7 +236,7 @@ export function useSellOrder() {
             show: true,
         },
         {
-            prop: 'zscategory',
+            prop: 'zscategorydisplay',
             label: '商品分类',
             show: true,
         },
@@ -265,6 +268,7 @@ export function useSellOrder() {
         {
             prop: 'ordertime',
             label: '委托时间',
+            width: 180,
             show: true,
         },
         {
@@ -346,10 +350,12 @@ export function useSellOrder() {
  * @returns 
  */
 export function useSellOrderForm() {
+    const { dataList } = useDataTable<Ermcp.MyWRPositionRsp>()
     const { UserID, AccountIDs } = sessionData.getValue('loginInfo')
     const loading = shallowRef(false)
-    const categoryList = getCategoryList()
+    const categoryList = getCategoryList() // 分类列表
     const selectedCategoryId = shallowRef(Category.Diamonds)
+
     const formItem = reactive<Proto.ZSSellOrderListingReq>({
         Header: {
             AccountID: AccountIDs[0],
@@ -370,6 +376,60 @@ export function useSellOrderForm() {
         MarketID: Market.GZ,
     })
 
+    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,
+        }
+    ])
+
     const formSubmit = () => {
         loading.value = true
         return zsSellOrderListing({
@@ -380,9 +440,24 @@ export function useSellOrderForm() {
         })
     }
 
+    queryDiamondList({
+        data: {
+            wruserid: UserID,
+            zscategory: Category.Diamonds,
+        },
+        success: (res) => {
+            dataList.value = res.data.filter((e) => e.ftotalqty - e.ffreezeqty > 0)
+        },
+        fail: () => {
+            dataList.value = []
+        },
+    })
+
     return {
         loading,
         formItem,
+        dataList,
+        columns,
         categoryList,
         selectedCategoryId,
         formSubmit,
@@ -404,12 +479,7 @@ export function useSaleOrder() {
             show: true,
         },
         {
-            prop: 'buyusername',
-            label: '挂牌会员',
-            show: true,
-        },
-        {
-            prop: 'zscategory',
+            prop: 'zscategorydisplay',
             label: '商品分类',
             show: true,
         },
@@ -441,6 +511,7 @@ export function useSaleOrder() {
         {
             prop: 'ordertime',
             label: '委托时间',
+            width: 180,
             show: true,
         },
         {
@@ -526,11 +597,6 @@ export function usePurchaseOrder() {
             show: true,
         },
         {
-            prop: 'buyusername',
-            label: '会员',
-            show: true,
-        },
-        {
             prop: 'zscategorydisplay',
             label: '商品分类',
             show: true,
@@ -548,11 +614,13 @@ export function usePurchaseOrder() {
         {
             prop: 'validtime',
             label: '有效日期',
+            width: 180,
             show: true,
         },
         {
             prop: 'ordertime',
             label: '委托时间',
+            width: 180,
             show: true,
         },
         {

+ 0 - 1
src/components/base/modal/index.less

@@ -31,7 +31,6 @@
     &__container {
         max-width : 100vw;
         max-height: 100vh;
-        overflow  : auto;
     }
 
     /* 全屏 */

+ 4 - 0
src/packages/pc/components/base/table/index.less

@@ -45,6 +45,10 @@
         td.el-table__cell {
             padding: 8px 0;
 
+            &.radio .el-radio__label {
+                display: none;
+            }
+
             .el-table__placeholder:empty {
                 display: none;
             }

+ 24 - 1
src/packages/pc/components/base/table/index.vue

@@ -20,6 +20,16 @@
           </template>
         </el-table-column>
         <!-- 数据列 -->
+        <template v-if="selectionType === 'checkbox'">
+
+        </template>
+        <el-table-column class-name="radio" align="center" width="55" v-if="selectionType === 'radio'">
+          <template #default="{ $index }">
+            <el-radio v-model="tableRadio" :label="$index" @change="radioChange">
+              <i />
+            </el-radio>
+          </template>
+        </el-table-column>
         <template v-for="(item, index) in columns" :key="index">
           <el-table-column :class-name="item.className" :align="item.align ?? 'center'" :min-width="120"
             :width="item.width" :label="item.label" :prop="item.prop" :fixed="item.fixed || false"
@@ -51,7 +61,7 @@ export default defineComponent({
   components: {
     AppTableSetting
   },
-  emits: ['refresh', 'update:columns'],
+  emits: ['refresh', 'update:columns', 'radioChange'],
   props: {
     columns: {
       type: Array as PropType<Ermcp.TableColumn[]>,
@@ -65,20 +75,33 @@ export default defineComponent({
       type: Boolean,
       default: false
     },
+    // 选择列类型
+    selectionType: {
+      type: String as PropType<'none' | 'checkbox' | 'radio'>,
+      default: 'none'
+    }
   },
   setup(props, { emit, expose }) {
     const tableRef = shallowRef()
+    const tableRadio = shallowRef()
     const showTableSetting = shallowRef(false)
     const refresh = () => emit('refresh')
     const updateColumn = (value: Ermcp.TableColumn[]) => emit('update:columns', value)
 
+    // 单选项中被选中时触发的事件
+    const radioChange = (index: number) => {
+      emit('radioChange', index)
+    }
+
     expose({
       getRef: tableRef
     })
 
     return {
       tableRef,
+      tableRadio,
       showTableSetting,
+      radioChange,
       handleNoneValue,
       refresh,
       updateColumn,

+ 11 - 4
src/packages/pc/views/listing/sell/components/add/index.vue

@@ -11,14 +11,20 @@
             <el-form-item label="履约方式" prop="PerformanceTemplateID">
                 <component :is="components.performance" v-model="formItem.PerformanceTemplateID" />
             </el-form-item>
-            <el-form-item label="选择商品" prop="Origin">
-                <el-input />
-            </el-form-item>
             <el-form-item class="el-form-item--row">
                 <el-button type="primary" @click="onSubmit">提交</el-button>
                 <el-button @click="onCancel(false)" plain>取消</el-button>
             </el-form-item>
         </el-form>
+        <app-table :data="dataList" :columns="columns" :height="400" selection-type="radio" border>
+            <template #header>
+                <el-input placeholder="搜索商品" />
+            </template>
+            <!-- 剩余数量 -->
+            <template #remainqty="{ row }">
+                {{ row.ftotalqty - row.ffreezeqty }}
+            </template>
+        </app-table>
     </app-drawer>
 </template>
 
@@ -28,12 +34,13 @@ import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { useSellOrderForm } from '@/business/order'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
+import AppTable from '@pc/components/base/table/index.vue'
 
 const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const { loading, formItem, selectedCategoryId, categoryList, formSubmit } = useSellOrderForm()
+const { loading, formItem, dataList, columns, selectedCategoryId, categoryList, formSubmit } = useSellOrderForm()
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()

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

@@ -29,6 +29,7 @@ declare namespace Ermcp {
         isvalid: number; // 是否有效 - 0:无效 1:有效
         kppath: string; // 金伯利证书图片(相对地址) - 类型:3
         kpweight: string; // 金伯利证书重量 - 类型:3
+        ladingbillid: number; // 提单ID(208+Unix秒时间戳(10位)+xxxxxx)
         marketprice: string; // 市场价
         origin: string; // 原产地 - 类型:3
         price: number; // 总价(价格) - 类型:1,2,3,4,5
@@ -41,6 +42,7 @@ declare namespace Ermcp {
         size2: string; // 尺寸2 - 类型:2,4,5
         size3: string; // 尺寸3 - 类型:2,4,5
         stonedesc: string; // 配石描述 - 类型:4
+        subnum: number; // 提单子单号
         userid: number; // 用户ID
         warehouseid: number; // 仓库ID
         warehousenamedisplay: string;