Pārlūkot izejas kodu

提交客户管家代码

Lijy 11 mēneši atpakaļ
vecāks
revīzija
25bd3a3b40

+ 2 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/relatedProducts/relatedProducts.vue

@@ -64,6 +64,7 @@ import { ref, reactive, onMounted, inject, watchEffect } from "vue";
 const props = defineProps<{
     productTableList: any,
     height?: string,
+    productTableListValue: any
 }>()
 
 const productTable: any = ref([{}])
@@ -125,6 +126,7 @@ function returnData() {
 
 watchEffect(() => {
     const { productTableList, height, productTableListValue = [] } = props
+    console.log(productTableListValue, '<==== 数据')
     productArrar.value = productTableList || []
     productTable.value = productTableListValue.length > 0 ? productTableListValue : [{ index: 0 }]
     heightClass.value = !height ? '200px' : height

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/api.ts

@@ -19,6 +19,7 @@ export const DETELEFILEFILE = `/business-opportunity/deleteFile`
 export const REFIENAMEFILE = `/business-opportunity/reFileName`
 export const UPLOADFILEFILE = `/business-opportunity/uploadFile`
 export const URL_IMPOERBUSINESS = `/business-opportunity/importData`
+export const URL_DETELESTAGE = `/business-opportunity/deleteStage`
 
 
 export const stageStatus = [

+ 9 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/stageSetting.vue

@@ -29,7 +29,7 @@
                         <el-table-column label="操作" fixed="right" width="200">
                             <template #default="scope">
                                 <el-button link type="primary" size="large" @click="addStage(scope.row)">编辑</el-button>
-                                <el-button link type="danger" size="large" @click="deteStage(+scope.$index)" :disabled="scope.row.isFinish == 1">删除</el-button>
+                                <el-button link type="danger" size="large" @click="deteStage(+scope.$index, scope.row)" :disabled="scope.row.isFinish == 1">删除</el-button>
                                 <el-button link type="primary" size="large" @click="moveStage(+scope.$index, 'up')"
                                     v-if="scope.$index != 0">上移</el-button>
                                 <el-button link type="primary" size="large" @click="moveStage(+scope.$index, 'down')"
@@ -75,7 +75,7 @@
 <script lang="ts" setup>
 import { post } from '@/utils/request';
 import { ref, reactive, onMounted, watch, inject } from 'vue'
-import { BUSIESS_GETSATE, BUSIESS_SAVESAIE } from '../api';
+import { BUSIESS_GETSATE, BUSIESS_SAVESAIE, URL_DETELESTAGE } from '../api';
 import { List } from 'echarts';
 
 type moveStageType = 'up' | 'down';
@@ -191,7 +191,13 @@ function moveStage(index: number, stageType: moveStageType) {
     }
 }
 
-function deteStage(index: number) {
+function deteStage(index: number, row: any) {
+    if(row.id) {
+        post(URL_DETELESTAGE, { id: row.id }).then(() => {
+            stageTableList.value.splice(index, 1)
+        })
+        return
+    }
     stageTableList.value.splice(index, 1)
 }
 

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/api.ts

@@ -8,6 +8,7 @@ export const GETALLPRODUCT = `/sys-form/getListByCode/Order`
 export const GETTABLELISTPRODUCT = `/product/list`
 export const GETTABLELIST = `${MOD}/list`
 export const URL_OEDERUPDATE = `${MOD}/addOrUpdate`
+export const URL_PRODUTWITHORDER = `${MOD}/productWithOrder`
 
 export const tableColumns: TableColumn[] = [
     { prop: 'orderCode', label: '订单编号', event: 'toDetali', width: '150' },

+ 19 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/index.vue

@@ -88,7 +88,7 @@
       <div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.orderTemplateLoadinng">
         <GenerateForm ref="orderTemplateRef" :data="orderTemplate" :value="orderTemplateValue" />
         <div>相关产品</div>
-        <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
+        <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" :productTableListValue="productTableListValue" />
       </div>
     </el-dialog>
   </div>
@@ -98,7 +98,7 @@
 import { ref, reactive, onMounted, inject, defineExpose } from "vue";
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, getTemplateKey } from '@/utils/tools'
 import { post, get } from "@/utils/request";
-import { tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT, GETTABLELISTPRODUCT, URL_OEDERUPDATE } from "./api";
+import { tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT, GETTABLELISTPRODUCT, URL_OEDERUPDATE, URL_PRODUTWITHORDER } from "./api";
 import { useRouter, useRoute } from "vue-router";
 import { GenerateForm } from '@zmjs/form-design';
 import { URL_FETALL } from "../customer/api";
@@ -153,14 +153,15 @@ const relatedProductsRef = ref<typeof RelatedProducts>()
 const filterItems = ref<FilterItem[]>([]) // 渲染筛选条件
 const formTable = ref([]) // 表格数据
 const productTableList = ref([])
+const productTableListValue = ref([])
 
 function saveOrder(flag: boolean) {
   orderTemplateRef.value?.getData().then((res: any) => {
     let productTableListData = relatedProductsRef?.value?.returnData()
     const produt = productTableListData ? JSON.stringify(productTableListData) : []
     allLoading.editSaveLading = true
-    post(URL_OEDERUPDATE, { 
-      ...res, 
+    post(URL_OEDERUPDATE, {
+      ...res,
       orderEndDate: res.orderEndDate ? formatDate(res.orderEndDate) : '',
       orderStartDate: res.orderStartDate ? formatDate(res.orderStartDate) : '',
       orderProductDetailString: produt
@@ -184,6 +185,7 @@ function editOrder(item: any) {
   showVisible('editOrderVisible')
   allLoading.orderTemplateLoadinng = true
   if (item) {
+    editProduct(item)
     const templateKey = getTemplateKey(orderTemplate.value.list)
     let formVal: templateKey = {}
     for (let i = 0; i < orderTemplate.value.list.length; i++) {
@@ -195,6 +197,8 @@ function editOrder(item: any) {
   }
   if (!item) {
     orderTemplateValue.value = {}
+    productTableListValue.value = []
+    allText.orderEditText = '新增订单'
   }
   setTimeout(() => {
     orderTemplateRef.value && orderTemplateRef.value.reset()
@@ -285,6 +289,17 @@ function setFilterItems() {
   ]
 }
 
+function editProduct(row: any) {
+  post(URL_PRODUTWITHORDER, { id: row.id }).then(({ data }) => {
+    const list = data.map((item: any) => {
+      const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice } = item
+      return { id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice }
+    })
+    console.log('开始执行', list)
+    productTableListValue.value = list
+  })
+}
+
 function getProductTableList() {
   post(GETTABLELISTPRODUCT, { pageIndex: -1, pageSize: -1 }).then((res) => {
     if (res.code == 'ok') {