Browse Source

fix: order & store

lhl 7 months ago
parent
commit
39318a1dec

+ 2 - 2
src/api/order/index.ts

@@ -13,8 +13,8 @@ export const assignSalesman = (id: number, data: any): Promise<IResponse> => {
 export const assignDesigner = (id: number, data: any): Promise<IResponse> => {
 export const assignDesigner = (id: number, data: any): Promise<IResponse> => {
   return request.post({ url: `${REQUEST_BASE}/decoration/order/designer/${id}`, data })
   return request.post({ url: `${REQUEST_BASE}/decoration/order/designer/${id}`, data })
 }
 }
-export const assignWorker = (params: searchOrder): Promise<IResponse> => {
-  return request.post({ url: `${REQUEST_BASE}/decoration/order/`, params })
+export const assignWorker = (id: number, params: any): Promise<IResponse> => {
+  return request.post({ url: `${REQUEST_BASE}/decoration/order/worker/${id}`, params })
 }
 }
 export const passAddItem = (id: number): Promise<IResponse> => {
 export const passAddItem = (id: number): Promise<IResponse> => {
   return request.post({ url: `${REQUEST_BASE}/decoration/order/pass/${id}` })
   return request.post({ url: `${REQUEST_BASE}/decoration/order/pass/${id}` })

+ 20 - 20
src/views/Order/orderList/components/addItem.vue

@@ -2,7 +2,7 @@
 import { PropType, ref } from 'vue'
 import { PropType, ref } from 'vue'
 import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
 import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
 // import { Icon } from '@/components/Icon'
 // import { Icon } from '@/components/Icon'
-import { ElImage, ElButton, ElMessage, ElMessageBox } from 'element-plus'
+import { ElImage, ElButton, ElMessage } from 'element-plus'
 import { passAddItem } from '@/api/order'
 import { passAddItem } from '@/api/order'
 
 
 const props = defineProps({
 const props = defineProps({
@@ -143,25 +143,25 @@ const goPassAddItem = async (e) => {
   })
   })
   emit('passAddItem')
   emit('passAddItem')
 }
 }
-const open = () => {
-  ElMessageBox.confirm('您确定拒绝当前增项?', 'Warning', {
-    confirmButtonText: '确认',
-    cancelButtonText: '取消',
-    type: 'warning'
-  })
-    .then(() => {
-      // ElMessage({
-      //   type: 'success',
-      //   message: 'Delete completed',
-      // })
-    })
-    .catch(() => {
-      ElMessage({
-        type: 'info',
-        message: 'Delete canceled'
-      })
-    })
-}
+// const open = () => {
+//   ElMessageBox.confirm('您确定拒绝当前增项?', 'Warning', {
+//     confirmButtonText: '确认',
+//     cancelButtonText: '取消',
+//     type: 'warning'
+//   })
+//     .then(() => {
+//       // ElMessage({
+//       //   type: 'success',
+//       //   message: 'Delete completed',
+//       // })
+//     })
+//     .catch(() => {
+//       ElMessage({
+//         type: 'info',
+//         message: 'Delete canceled'
+//       })
+//     })
+// }
 </script>
 </script>
 
 
 <template>
 <template>

+ 127 - 140
src/views/Order/orderList/index.vue

@@ -7,14 +7,12 @@ import { Table, TableColumn } from '@/components/Table'
 import { ContentWrap } from '@/components/ContentWrap'
 import { ContentWrap } from '@/components/ContentWrap'
 import { FormSchema } from '@/components/Form'
 import { FormSchema } from '@/components/Form'
 import { Search } from '@/components/Search'
 import { Search } from '@/components/Search'
-import { Dialog } from '@/components/Dialog'
 import { searchTime } from '@/utils/searchTime'
 import { searchTime } from '@/utils/searchTime'
 import { searchOrder } from '@/api/order/types'
 import { searchOrder } from '@/api/order/types'
 import { ElTabs, ElTabPane, ElButton, ElDivider, ElDrawer } from 'element-plus'
 import { ElTabs, ElTabPane, ElButton, ElDivider, ElDrawer } from 'element-plus'
 import Detail from './components/Detail.vue'
 import Detail from './components/Detail.vue'
 import Draft from './components/Draft.vue'
 import Draft from './components/Draft.vue'
 import addItem from './components/addItem.vue'
 import addItem from './components/addItem.vue'
-import { SalespersonButtom } from '@/components/SalespersonList'
 const { tableRegister, tableState, tableMethods } = useTable({
 const { tableRegister, tableState, tableMethods } = useTable({
   fetchDataApi: async () => {
   fetchDataApi: async () => {
     const res = await getOrderList({
     const res = await getOrderList({
@@ -33,8 +31,6 @@ const { dataList, loading, total, currentPage, pageSize } = tableState
 const { getList } = tableMethods
 const { getList } = tableMethods
 const dialogVisible = ref(false)
 const dialogVisible = ref(false)
 const dialogTitle = ref('')
 const dialogTitle = ref('')
-const showSalesperson = ref(false)
-
 
 
 const tableColumns = reactive<TableColumn[]>([
 const tableColumns = reactive<TableColumn[]>([
   {
   {
@@ -53,7 +49,7 @@ const tableColumns = reactive<TableColumn[]>([
         return (
         return (
           <>
           <>
             <div>昵称: {row.real_name}</div>
             <div>昵称: {row.real_name}</div>
-			<div>UID: {row.uid} </div>
+            <div>UID: {row.uid} </div>
             <div>手机号: {row.phone}</div>
             <div>手机号: {row.phone}</div>
           </>
           </>
         )
         )
@@ -61,75 +57,63 @@ const tableColumns = reactive<TableColumn[]>([
     }
     }
   },
   },
   {
   {
-      field: 'salesperson',
-      label: '业务员',
-      minWidth: 100,
-      slots: {
-        default: (data: any) => {
-          const row = data.row
-  		if(row.salesperson && row.salesperson.id) {
-  			return (
-  			  <>
-  			    <div> {row.salesperson.name}</div>
-  			  </>
-  			)
-  		}else {
-  			return (
-  			  <>
-  			  </>
-  			)
-  		}
-          
+    field: 'salesperson',
+    label: '业务员',
+    minWidth: 100,
+    slots: {
+      default: (data: any) => {
+        const row = data.row
+        if (row.salesperson && row.salesperson.id) {
+          return (
+            <>
+              <div> {row.salesperson.name}</div>
+            </>
+          )
+        } else {
+          return <></>
         }
         }
       }
       }
-    },
-{
+    }
+  },
+  {
     field: 'designer',
     field: 'designer',
     label: '设计师',
     label: '设计师',
     minWidth: 100,
     minWidth: 100,
     slots: {
     slots: {
       default: (data: any) => {
       default: (data: any) => {
         const row = data.row
         const row = data.row
-		if(row.designer && row.designer.id) {
-			return (
-			  <>
-			    <div> {row.designer.name}</div>
-			  </>
-			)
-		}else {
-			return (
-			  <>
-			  </>
-			)
-		}
-        
+        if (row.designer && row.designer.id) {
+          return (
+            <>
+              <div> {row.designer.name}</div>
+            </>
+          )
+        } else {
+          return <></>
+        }
+      }
+    }
+  },
+
+  {
+    field: 'worker',
+    label: '安装工',
+    minWidth: 100,
+    slots: {
+      default: (data: any) => {
+        const row = data.row
+        if (row.worker && row.worker.id) {
+          return (
+            <>
+              <div> {row.worker.name}</div>
+            </>
+          )
+        } else {
+          return <></>
+        }
       }
       }
     }
     }
   },
   },
-	
-	{
-	    field: 'worker',
-	    label: '安装工',
-	    minWidth: 100,
-	    slots: {
-	      default: (data: any) => {
-	        const row = data.row
-			if(row.worker && row.worker.id) {
-				return (
-				  <>
-				    <div> {row.worker.name}</div>
-				  </>
-				)
-			}else {
-				return (
-				  <>
-				  </>
-				)
-			}
-	        
-	      }
-	    }
-	  },
   {
   {
     field: 'address',
     field: 'address',
     label: '地址',
     label: '地址',
@@ -163,23 +147,28 @@ const tableColumns = reactive<TableColumn[]>([
     align: 'center',
     align: 'center',
     slots: {
     slots: {
       default: (data: any) => {
       default: (data: any) => {
-        const row = data.row;
-		if(row.add_item.length > 0 && row.add_item[0].status == 0) {
-			return (
-			  <>
-			  <ElButton type="primary" link size="small" onClick={() => action('edit', row)}>详情</ElButton>
-			  <ElDivider direction="vertical" />
-			  <ElButton type="primary" link size="small" onClick={() => action('auth', row)}>审核增项</ElButton>
-			  </>
-			)
-		}else {
-			return (
-			  <>
-			  <ElButton type="primary" link size="small" onClick={() => action('edit', row)}>详情</ElButton>
-			  </>
-			)
-		}
-        
+        const row = data.row
+        if (row.add_item.length > 0 && row.add_item[0].status == 0) {
+          return (
+            <>
+              <ElButton type="primary" link size="small" onClick={() => action('edit', row)}>
+                详情
+              </ElButton>
+              <ElDivider direction="vertical" />
+              <ElButton type="primary" link size="small" onClick={() => action('auth', row)}>
+                审核增项
+              </ElButton>
+            </>
+          )
+        } else {
+          return (
+            <>
+              <ElButton type="primary" link size="small" onClick={() => action('edit', row)}>
+                详情
+              </ElButton>
+            </>
+          )
+        }
       }
       }
     }
     }
   }
   }
@@ -287,39 +276,30 @@ const tabsConfigs = reactive([
   {
   {
     title: '设计稿',
     title: '设计稿',
     total: 0,
     total: 0,
-    step:1
+    step: 1
   },
   },
   {
   {
     title: '增项',
     title: '增项',
     total: 0,
     total: 0,
-    step:2
-  },
+    step: 2
+  }
 ])
 ])
-const getLists = (e)=> {
-	console.log(e)
-}
 const checkedSalesperson = (e) => {
 const checkedSalesperson = (e) => {
-	console.log(e,'x',e.value)
-	currentRow.value.salesperson_id = e.value.id;
-	currentRow.value.salesperson = e.value
-	getList()
+  console.log(e, 'x', e.value)
+  currentRow.value.salesperson_id = e.value.id
+  currentRow.value.salesperson = e.value
+  getList()
 }
 }
 const checkedDesigner = (e) => {
 const checkedDesigner = (e) => {
-	console.log(e,'x',e.value)
-	currentRow.value.designer_id = e.value.id;
-	currentRow.value.designer = e.value
-	getList()
-}
-const checkedWorker = (e) => {
-	console.log(e,'x',e.value)
-	currentRow.value.worker_id = e.value.id;
-	currentRow.value.worker = e.value
-	getList()
+  console.log(e, 'x', e.value)
+  currentRow.value.designer_id = e.value.id
+  currentRow.value.designer = e.value
+  getList()
 }
 }
 const passAddItem = () => {
 const passAddItem = () => {
-	isAuth.value = false
-	// currentRow.value.add_item[0].status = 1
-	getList()
+  isAuth.value = false
+  // currentRow.value.add_item[0].status = 1
+  getList()
 }
 }
 const action = async (type: string, row?: any) => {
 const action = async (type: string, row?: any) => {
   // actionType.value = type
   // actionType.value = type
@@ -327,22 +307,22 @@ const action = async (type: string, row?: any) => {
   //   dialogTitle.value = t('exampleDemo.add')
   //   dialogTitle.value = t('exampleDemo.add')
   //   currentRow.value = undefined
   //   currentRow.value = undefined
   // }
   // }
-  
+
   //   console.log(currentRow, 'currentRow')
   //   console.log(currentRow, 'currentRow')
   // }
   // }
-	const res = await getOrderDetail(row.id)
-    if(type == 'edit') {
-		isEdit.value = true
-		dialogTitle.value = '详情'
-		currentRow.value = res.data
-		dialogVisible.value = true
-	}else if(type == 'auth') {
-		isAuth.value = true
-		activeNames.value = 2
-		dialogTitle.value = '详情'
-		currentRow.value = res.data
-		dialogVisible.value = true
-	}
+  const res = await getOrderDetail(row.id)
+  if (type == 'edit') {
+    isEdit.value = true
+    dialogTitle.value = '详情'
+    currentRow.value = res.data
+    dialogVisible.value = true
+  } else if (type == 'auth') {
+    isAuth.value = true
+    activeNames.value = 2
+    dialogTitle.value = '详情'
+    currentRow.value = res.data
+    dialogVisible.value = true
+  }
 }
 }
 // const goAssignSalesman = async (id:number, data: any) => {
 // const goAssignSalesman = async (id:number, data: any) => {
 // 	await assignSalesman(id,data)
 // 	await assignSalesman(id,data)
@@ -378,30 +358,37 @@ const action = async (type: string, row?: any) => {
       }"
       }"
     />
     />
   </ContentWrap>
   </ContentWrap>
-  
-  <ElDrawer
-      v-model="dialogVisible"
-      direction="rtl"
-	  size="50%"
-    >
-	<!-- // :title="dialogTitle" -->
-	<template #header="{ titleId, titleClass }">
-	      <h4 :id="titleId" :class="titleClass">{{dialogTitle}}</h4>
-	      <!-- <el-button type="danger" @click="close">
+
+  <ElDrawer v-model="dialogVisible" direction="rtl" size="50%">
+    <!-- // :title="dialogTitle" -->
+    <template #header="{ titleId, titleClass }">
+      <h4 :id="titleId" :class="titleClass">{{ dialogTitle }}</h4>
+      <!-- <el-button type="danger" @click="close">
 	        <el-icon class="el-icon--left"><CircleCloseFilled /></el-icon>
 	        <el-icon class="el-icon--left"><CircleCloseFilled /></el-icon>
 	        Close
 	        Close
 	      </el-button> -->
 	      </el-button> -->
-	    </template>
-      <ElTabs v-model="activeNames" >
-        <ElTabPane
-          v-for="(item, index) in tabsConfigs"
-          :key="index"
-          :label="`${item.title}${item.total > 0 ? `(${item.total})` : ''}`"
-          :name="index"
-        />
-      </ElTabs>
-	  <Detail v-if="activeNames === 0" :current-row="currentRow" :isEdit="isEdit" @checkedSalesperson="checkedSalesperson" @checkedDesigner="checkedDesigner"/>
-	  <Draft v-if="activeNames === 1" :current-row="currentRow" />
-	  <addItem v-if="activeNames === 2" :current-row="currentRow" :isAuth="isAuth" @passAddItem="passAddItem"/>
-    </ElDrawer>
+    </template>
+    <ElTabs v-model="activeNames">
+      <ElTabPane
+        v-for="(item, index) in tabsConfigs"
+        :key="index"
+        :label="`${item.title}${item.total > 0 ? `(${item.total})` : ''}`"
+        :name="index"
+      />
+    </ElTabs>
+    <Detail
+      v-if="activeNames === 0"
+      :current-row="currentRow"
+      :isEdit="isEdit"
+      @checkedSalesperson="checkedSalesperson"
+      @checkedDesigner="checkedDesigner"
+    />
+    <Draft v-if="activeNames === 1" :current-row="currentRow" />
+    <addItem
+      v-if="activeNames === 2"
+      :current-row="currentRow"
+      :isAuth="isAuth"
+      @passAddItem="passAddItem"
+    />
+  </ElDrawer>
 </template>
 </template>

+ 13 - 0
src/views/Store/list/components/Write.vue

@@ -89,6 +89,18 @@ onMounted(async () => {
   if (props.currentRow) {
   if (props.currentRow) {
     required = false
     required = false
   }
   }
+  if (props.currentRow.latitude) {
+    center.value = {
+      lat: props.currentRow.latitude,
+      lng: props.currentRow.longitude
+    }
+    geometries.value = [
+      {
+        styleId: 'marker',
+        position: { lat: props.currentRow.latitude, lng: props.currentRow.longitude }
+      }
+    ]
+  }
   await nextTick()
   await nextTick()
   if (rules && rules.store_account) {
   if (rules && rules.store_account) {
     rules.store_account[0].required = required
     rules.store_account[0].required = required
@@ -109,6 +121,7 @@ const props = defineProps({
 })
 })
 
 
 const selectAddress = (item: mapAddressData) => {
 const selectAddress = (item: mapAddressData) => {
+  console.log(item, 'item')
   if (!item || !item.adcode || !item.lng || !item.lat) {
   if (!item || !item.adcode || !item.lng || !item.lat) {
     console.error('Invalid input item:', item)
     console.error('Invalid input item:', item)
     return
     return