|
@@ -3,9 +3,8 @@
|
|
<div class="flex justify-between">
|
|
<div class="flex justify-between">
|
|
<div class="title">基本信息</div>
|
|
<div class="title">基本信息</div>
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary">认领</el-button>
|
|
|
|
- <el-button type="primary">转移</el-button>
|
|
|
|
- <el-button type="primary">编辑</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="transferCli()">转移</el-button>
|
|
|
|
+ <el-button type="primary" @click="editInfo(info)">编辑</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form flex flex-wrap justify-between">
|
|
<div class="form flex flex-wrap justify-between">
|
|
@@ -15,30 +14,13 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <el-dialog v-model="allVisible.editContactsVisible" width="1000" :show-close="false" top="10vh">
|
|
|
|
- <template #header="{ close, titleId, titleClass }">
|
|
|
|
- <div class="flex justify-between items-center border-b pb-3 dialog-header">
|
|
|
|
- <h4 :id="titleId">编辑联系人</h4>
|
|
|
|
- <div>
|
|
|
|
- <el-button type="primary" :loading="allLoading.editContactsSaveLoading">保存</el-button>
|
|
|
|
- <el-button @click="closeVisible('editContactsVisible')">取消</el-button>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- <div class="h-[60vh] overflow-y-auto scroll-bar pt-3">
|
|
|
|
- <div class="ml-4 mr-4">
|
|
|
|
- <GenerateForm ref="contactsTemplateRef" :data="contactsTemplate" :value="contactsTemplateValue"
|
|
|
|
- :key="contactsTemplateRefKey" v-loading="allLoading.contactsTemplateRefLoading" />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
-
|
|
|
|
<el-dialog v-model="allVisible.transferVisible" width="600" :show-close="false" top="10vh">
|
|
<el-dialog v-model="allVisible.transferVisible" width="600" :show-close="false" top="10vh">
|
|
<template #header="{ close, titleId, titleClass }">
|
|
<template #header="{ close, titleId, titleClass }">
|
|
<div class="flex justify-between items-center border-b pb-3 dialog-header">
|
|
<div class="flex justify-between items-center border-b pb-3 dialog-header">
|
|
<h4 :id="titleId">{{ allText.operationText }}</h4>
|
|
<h4 :id="titleId">{{ allText.operationText }}</h4>
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary" :loading="allLoading.transferLoading">转移</el-button>
|
|
|
|
|
|
+ <el-button type="primary" :loading="allLoading.transferLoading"
|
|
|
|
+ @click="transferChange()">转移</el-button>
|
|
<el-button @click="allVisible.transferVisible = false">取消</el-button>
|
|
<el-button @click="allVisible.transferVisible = false">取消</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -46,7 +28,7 @@
|
|
<div class="scroll-bar m-6">
|
|
<div class="scroll-bar m-6">
|
|
<div class="flex mb-4">
|
|
<div class="flex mb-4">
|
|
<div class="w-20 flex items-center justify-end pr-4">转移至:</div>
|
|
<div class="w-20 flex items-center justify-end pr-4">转移至:</div>
|
|
- <el-select v-model="transferValue" placeholder="请选择" class="flex1">
|
|
|
|
|
|
+ <el-select v-model.trim="transferValue" placeholder="请选择" class="flex1">
|
|
<el-option v-for="item in transferOptions" :key="item.value" :label="item.label"
|
|
<el-option v-for="item in transferOptions" :key="item.value" :label="item.label"
|
|
:value="item.value" />
|
|
:value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
@@ -54,6 +36,25 @@
|
|
<div class="pl-3 text-[#e94a4a]">转移后,将看不到此联系人</div>
|
|
<div class="pl-3 text-[#e94a4a]">转移后,将看不到此联系人</div>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+
|
|
|
|
+ <el-dialog v-model="allVisible.editOrderVisible" width="1000" :show-close="false" top="10vh">
|
|
|
|
+ <template #header="{ close, titleId, titleClass }">
|
|
|
|
+ <div class="flex justify-between items-center border-b pb-3 dialog-header">
|
|
|
|
+ <h4 :id="titleId">编辑销售订单</h4>
|
|
|
|
+ <div>
|
|
|
|
+ <el-button type="primary" @click="editOrderSave()"
|
|
|
|
+ :loading="allLoading.editOrderSaveLoading">保存</el-button>
|
|
|
|
+ <el-button @click="closeVisible('editOrderVisible')">取消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <div class="h-[60vh] overflow-y-auto scroll-bar pt-3">
|
|
|
|
+ <div class="ml-4 mr-4" v-loading="allLoading.orderTemplateLoading">
|
|
|
|
+ <GenerateForm ref="orderTemplateRef" :data="orderTemplate" :value="orderTemplateValue"
|
|
|
|
+ :key="orderTemplateKey" />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
@@ -61,34 +62,112 @@ import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffec
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
import { getFromValue, getTemplateKey } from '@/utils/tools';
|
|
import { getFromValue, getTemplateKey } from '@/utils/tools';
|
|
import { get, post } from '@/utils/request';
|
|
import { get, post } from '@/utils/request';
|
|
|
|
+import { GETGENERATEFOEM, GETPERSONNEL, URL_OEDERUPDATE, URL_PRODUTWITHORDER, URL_TRANSFER } from '../api';
|
|
|
|
+import { formatDate } from '@/utils/times';
|
|
|
|
|
|
const globalPopup = inject<GlobalPopup>('globalPopup')
|
|
const globalPopup = inject<GlobalPopup>('globalPopup')
|
|
const emits = defineEmits(['refreshData']);
|
|
const emits = defineEmits(['refreshData']);
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
- data?: any
|
|
|
|
|
|
+ data: any
|
|
}>()
|
|
}>()
|
|
const allLoading = reactive({
|
|
const allLoading = reactive({
|
|
- contactsTemplateRefLoading: false,
|
|
|
|
- editContactsSaveLoading: false,
|
|
|
|
|
|
+ orderTemplateLoading: false,
|
|
|
|
+ editOrderSaveLoading: false,
|
|
transferLoading: false
|
|
transferLoading: false
|
|
})
|
|
})
|
|
const allVisible = reactive({
|
|
const allVisible = reactive({
|
|
- editContactsVisible: false,
|
|
|
|
|
|
+ editOrderVisible: false,
|
|
transferVisible: false
|
|
transferVisible: false
|
|
})
|
|
})
|
|
const allText = reactive({
|
|
const allText = reactive({
|
|
operationText: '认领联系人'
|
|
operationText: '认领联系人'
|
|
})
|
|
})
|
|
-const contactsTemplate = ref({
|
|
|
|
|
|
+const orderTemplate = ref({
|
|
list: [],
|
|
list: [],
|
|
config: {}
|
|
config: {}
|
|
})
|
|
})
|
|
-const contactsTemplateValue = ref({})
|
|
|
|
-const contactsTemplateRef = ref<typeof GenerateForm>()
|
|
|
|
-const contactsTemplateRefKey = ref(1)
|
|
|
|
|
|
+const orderTemplateValue = ref({})
|
|
|
|
+const orderTemplateKey = ref(1)
|
|
|
|
+const orderTemplateRef = ref<typeof GenerateForm>()
|
|
const info: any = ref({})
|
|
const info: any = ref({})
|
|
const transferValue = ref('')
|
|
const transferValue = ref('')
|
|
const transferOptions = ref<optionType[]>([])
|
|
const transferOptions = ref<optionType[]>([])
|
|
|
|
+const productTableListValue = ref([])
|
|
|
|
+
|
|
|
|
+function editOrderSave() {
|
|
|
|
+ orderTemplateRef.value?.getData().then((res: any) => {
|
|
|
|
+ allLoading.editOrderSaveLoading = true
|
|
|
|
+ post(URL_OEDERUPDATE, {
|
|
|
|
+ ...orderTemplateValue.value,
|
|
|
|
+ ...res,
|
|
|
|
+ orderEndDate: res.orderEndDate ? formatDate(res.orderEndDate) : '',
|
|
|
|
+ orderStartDate: res.orderStartDate ? formatDate(res.orderStartDate) : '',
|
|
|
|
+ orderProductDetailString: JSON.stringify(productTableListValue.value || [])
|
|
|
|
+ }).then((_res) => {
|
|
|
|
+ closeVisible('editOrderVisible')
|
|
|
|
+ globalPopup?.showSuccess('操作成功')
|
|
|
|
+ emits('refreshData', 'getDetail')
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ allLoading.editOrderSaveLoading = false
|
|
|
|
+ })
|
|
|
|
+ }).catch((_err: any) => {
|
|
|
|
+ console.log(_err)
|
|
|
|
+ globalPopup?.showError('请填写完整')
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function editInfo(item: any) {
|
|
|
|
+ showVisible('editOrderVisible')
|
|
|
|
+ allLoading.orderTemplateLoading = true
|
|
|
|
+ if (item) {
|
|
|
|
+ const templateKey = getTemplateKey(orderTemplate.value.list)
|
|
|
|
+ let formVal: templateKey = { id: item.id }
|
|
|
|
+ for (let i = 0; i < templateKey.length; i++) {
|
|
|
|
+ const key = templateKey[i]
|
|
|
|
+ formVal[key] = item[key]
|
|
|
|
+ }
|
|
|
|
+ console.log(formVal, templateKey, item)
|
|
|
|
+ orderTemplateValue.value = formVal
|
|
|
|
+ editProduct(item)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ orderTemplateKey.value++
|
|
|
|
+ allLoading.orderTemplateLoading = false
|
|
|
|
+ }, 500)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+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, orderProductDetail } = item
|
|
|
|
+ return {
|
|
|
|
+ id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory,
|
|
|
|
+ num: +orderProductDetail?.num,
|
|
|
|
+ discount: +orderProductDetail?.discount,
|
|
|
|
+ sealPrice: +orderProductDetail?.sealPrice,
|
|
|
|
+ totalPrice: +orderProductDetail?.totalPrice
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ productTableListValue.value = list
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function transferCli() {
|
|
|
|
+ transferValue.value = ''
|
|
|
|
+ showVisible('transferVisible')
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function transferChange() {
|
|
|
|
+ allLoading.transferLoading = true
|
|
|
|
+ post(URL_TRANSFER, { id: info.value.id, userId: transferValue.value }).then(() => {
|
|
|
|
+ globalPopup?.showSuccess('操作成功')
|
|
|
|
+ closeVisible('transferVisible')
|
|
|
|
+ emits('refreshData', 'getDetail')
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ allLoading.transferLoading = false
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
|
|
function showVisible(type: keyof typeof allVisible) {
|
|
function showVisible(type: keyof typeof allVisible) {
|
|
allVisible[type] = true
|
|
allVisible[type] = true
|
|
@@ -99,22 +178,51 @@ function closeVisible(type: keyof typeof allVisible) {
|
|
}
|
|
}
|
|
|
|
|
|
const formItems = reactive([
|
|
const formItems = reactive([
|
|
- { label: '联系人', key: 'name', value: '', labelClass: 'w-20 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '客户', key: 'productName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '电话', key: 'phone', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '邮箱', key: 'email', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '职务', key: 'position', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '性别', key: 'sexValue', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
- { label: '地址', key: 'address', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
|
|
+ { label: '订单编号', key: 'orderCode', value: '', labelClass: 'w-20 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '订单名称', key: 'orderName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '客户名称', key: 'customName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '商机名称', key: 'businessOpportunityName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '订单金额', key: 'price', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '回款状态', key: 'receivedStatus', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '已回款金额', key: 'receivedPayment', value: '', labelClass: 'w-24 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '未回款', key: 'unReceivedPayment', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '订单类型', key: 'type', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '下单时间', key: 'placeTime', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '订单开始时间', key: 'orderStartDate', value: '', labelClass: 'w-30 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '订单结束时间', key: 'orderEndDate', value: '', labelClass: 'w-30 text-right text-gray-500', width: '48%' },
|
|
{ label: '负责人', key: 'inchargerName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
{ label: '负责人', key: 'inchargerName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
- { label: '创建人', key: 'creatorName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
|
|
+ { label: '创建人', key: 'createName', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
{ label: '创建时间', key: 'createTime', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
{ label: '创建时间', key: 'createTime', value: '', labelClass: 'w-22 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '客户签约人', key: 'customSigner', value: '', labelClass: 'w-24 text-right text-gray-500', width: '48%' },
|
|
|
|
+ { label: '公司签约人', key: 'companySigner', value: '', labelClass: 'w-24 text-right text-gray-500', width: '48%' },
|
|
{ label: '备注', key: 'remark', value: '', labelClass: 'w-22 text-right text-gray-500', width: '100%' },
|
|
{ label: '备注', key: 'remark', value: '', labelClass: 'w-22 text-right text-gray-500', width: '100%' },
|
|
])
|
|
])
|
|
|
|
|
|
|
|
+watchEffect(() => {
|
|
|
|
+ const { data } = props
|
|
|
|
+ info.value = data
|
|
|
|
+ formItems.forEach(item => {
|
|
|
|
+ item.value = info.value[item.key] || '';
|
|
|
|
+ });
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+async function getSystemField() {
|
|
|
|
+ const { data } = await post(GETPERSONNEL, {})
|
|
|
|
+ transferOptions.value = data.map((item: any) => {
|
|
|
|
+ const { id, name, phone, jobNumber } = item
|
|
|
|
+ return {
|
|
|
|
+ value: id,
|
|
|
|
+ label: name
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const datas = await get(GETGENERATEFOEM)
|
|
|
|
+ orderTemplate.value = JSON.parse(datas.data[0].config)
|
|
|
|
+}
|
|
|
|
+
|
|
// 生命周期钩子
|
|
// 生命周期钩子
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
-
|
|
|
|
|
|
+ getSystemField()
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|