li.shaoyi 2 rokov pred
rodič
commit
af3e70c1f5

+ 48 - 2
src/packages/pc/views/centralize/mine/components/add/index.vue

@@ -117,17 +117,23 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, defineAsyncComponent, computed } from 'vue'
+import { ref, reactive, defineAsyncComponent, computed, PropType, onMounted } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { formatDate } from '@/filters'
 import { regular } from '@/constants/regex'
 import { maxValue } from '@/constants/common'
 import { getYSProductionModeList, getYSZSCategoryList, YSZSCategory } from '@/constants/presale'
-import { gzCenterPurchaseApply } from '@/services/api/presale'
+import { gzCenterPurchaseApply, queryPresaleorderapplyprice } from '@/services/api/presale'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 import AppUpload from '@pc/components/base/upload/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
 
+const props = defineProps({
+    selectedRow: {
+        type: Object as PropType<Ermcp.GZWrPreSaleApplyRsp>
+    }
+})
+
 // 履约模板
 const PerformanceTemplate = defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue'))
 // 价格编辑
@@ -277,4 +283,44 @@ const onSubmit = () => {
         }
     })
 }
+
+onMounted(() => {
+    if (props.selectedRow) {
+        ({
+            wrstandardname: formData.WRStandardName,
+            yszscategory: formData.YSZSCategory,
+            presaleqty: formData.PresaleQty,
+            performancetemplateid: formData.PerformanceTemplateID,
+            minbuyqty: formData.MinBuyQty,
+            minsuccessqty: formData.MinSuccessQty,
+            maxbuyqty: formData.MaxBuyQty,
+            buymarginvalue: formData.BuyMarginValue,
+            zsshapetypestr: formData.ZSShapeTypeStr,
+            zscolortypestr: formData.ZSColorTypeStr,
+            sizestr: formData.SizeStr,
+            zsclaritytypestr: formData.ZSClarityTypeStr,
+            zspolishtypestr: formData.ZSPolishTypeStr,
+            zssymmetrytypestr: formData.ZSSymmetryTypeStr,
+            zscuttypestr: formData.ZSCutTypeStr,
+            zsfluorescencetypestr: formData.ZSFluorescenceTypeStr,
+            yieldrate: formData.YieldRate,
+            qtydesc: formData.QtyDesc,
+            weightdesc: formData.WeightDesc,
+            remark: formData.Remark,
+        } = props.selectedRow)
+
+        formData.YSProductionMode = props.selectedRow.ysproductionmode || undefined
+        datePickerValue.value = [props.selectedRow.startdate, props.selectedRow.enddate]
+
+        queryPresaleorderapplyprice({
+            applyid: props.selectedRow.presaleapplyid
+        }).then((res) => {
+            formData.GZCenterPurchasePriceLists = res.data.map((e) => ({
+                StepIndex: e.stepindex,
+                Qty: e.qty,
+                Price: e.price,
+            }))
+        })
+    }
+})
 </script>

+ 24 - 7
src/packages/pc/views/centralize/mine/components/apply/index.vue

@@ -8,13 +8,23 @@
             </template>
             <!-- 操作 -->
             <template #operate="{ row }">
-                <el-button size="small" @click="openDetails(row)">查看</el-button>
+                <el-dropdown trigger="click">
+                    <el-button size="small" icon="MoreFilled" round />
+                    <template #dropdown>
+                        <el-dropdown-menu>
+                            <el-dropdown-item @click="showComponent('details', row)">详情</el-dropdown-item>
+                            <el-dropdown-item @click="showComponent('add', row)"
+                                v-if="row.applystatus === 3">重新申请</el-dropdown-item>
+                        </el-dropdown-menu>
+                    </template>
+                </el-dropdown>
             </template>
             <template #footer>
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex" @change="run" />
             </template>
         </app-table>
-        <component :is="Details" v-bind="{ selectedRow }" @closed="showDetails = false" v-if="showDetails" />
+        <component :is="componentMap.get(componentId)" v-bind="{ selectedRow }" @closed="closeComponent"
+            v-if="componentId" />
     </app-drawer>
 </template>
 
@@ -22,19 +32,26 @@
 import { shallowRef, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import { getInOutApplyStatusName } from '@/constants/presale'
+import { useComponent } from '@/hooks/component'
 import { useRequest } from '@/hooks/request'
 import { queryGZWrPreSaleApply } from '@/services/api/presale'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
 import AppPagination from '@pc/components/base/pagination/index.vue'
 
-// 申请详情
-const Details = defineAsyncComponent(() => import('./details.vue'))
+const componentMap = new Map<string, unknown>([
+    ['details', defineAsyncComponent(() => import('./details.vue'))], // 申请详情
+    ['add', defineAsyncComponent(() => import('../add/index.vue'))] // 预售申请
+])
 
 const show = shallowRef(true)
-const showDetails = shallowRef(false)
 const selectedRow = shallowRef<Ermcp.GZWrPreSaleApplyRsp>() // 当前选择的申请明细
 
+const { componentId, openComponent, closeComponent } = useComponent(() => {
+    pageIndex.value = 1
+    run()
+})
+
 const { loading, dataList, total, pageIndex, pageSize, run } = useRequest(queryGZWrPreSaleApply, {
     params: {
         pagesize: 10,
@@ -55,8 +72,8 @@ const columns: Ermcp.TableColumn[] = [
     { prop: 'operate', label: '操作', fixed: 'right' },
 ]
 
-const openDetails = (item: Ermcp.GZWrPreSaleApplyRsp) => {
+const showComponent = (name: string, item: Ermcp.GZWrPreSaleApplyRsp) => {
     selectedRow.value = item
-    showDetails.value = true
+    openComponent(name)
 }
 </script>

+ 1 - 1
src/packages/pc/views/presale/mine/components/add/index.vue

@@ -205,10 +205,10 @@ onMounted(() => {
             yieldrate: formData.YieldRate,
             qtydesc: formData.QtyDesc,
             weightdesc: formData.WeightDesc,
-            ysproductionmode: formData.YSProductionMode,
             remark: formData.Remark,
         } = props.selectedRow)
 
+        formData.YSProductionMode = props.selectedRow.ysproductionmode || undefined
         datePickerValue.value = [props.selectedRow.startdate, props.selectedRow.enddate]
     }
 })