From 653120dde7588e5be464166d3c316dc80227dbb0 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 01 九月 2025 16:21:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev_ZQHX' into dev
---
src/views/salesManagement/orderManagement/index.vue | 495 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 495 insertions(+), 0 deletions(-)
diff --git a/src/views/salesManagement/orderManagement/index.vue b/src/views/salesManagement/orderManagement/index.vue
new file mode 100644
index 0000000..aac840f
--- /dev/null
+++ b/src/views/salesManagement/orderManagement/index.vue
@@ -0,0 +1,495 @@
+<template>
+ <div class="app-container">
+ <el-card class="box-card">
+ <!-- 鎼滅储鍖哄煙 -->
+ <el-row :gutter="20" class="search-row">
+ <el-col :span="6">
+ <el-input
+ v-model="searchForm.orderNo"
+ placeholder="璇疯緭鍏ヨ鍗曞彿"
+ clearable
+ @keyup.enter="handleSearch"
+ >
+ <template #prefix>
+ <el-icon><Search /></el-icon>
+ </template>
+ </el-input>
+ </el-col>
+ <el-col :span="6">
+ <el-select v-model="searchForm.customer" placeholder="璇烽�夋嫨瀹㈡埛" clearable>
+ <el-option label="涓婃捣绉戞妧鏈夐檺鍏徃" value="涓婃捣绉戞妧鏈夐檺鍏徃"></el-option>
+ <el-option label="娣卞湷鐢靛瓙鏈夐檺鍏徃" value="娣卞湷鐢靛瓙鏈夐檺鍏徃"></el-option>
+ <el-option label="鍖椾含璐告槗鍏徃" value="鍖椾含璐告槗鍏徃"></el-option>
+ </el-select>
+ </el-col>
+ <el-col :span="6">
+ <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨璁㈠崟鐘舵��" clearable>
+ <el-option label="寰呭鏍�" value="寰呭鏍�"></el-option>
+ <el-option label="宸插鏍�" value="宸插鏍�"></el-option>
+ <el-option label="宸插彂璐�" value="宸插彂璐�"></el-option>
+ <el-option label="宸插畬鎴�" value="宸插畬鎴�"></el-option>
+ <el-option label="宸插彇娑�" value="宸插彇娑�"></el-option>
+ </el-select>
+ </el-col>
+ <el-col :span="6">
+ <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
+ <el-button @click="resetSearch">閲嶇疆</el-button>
+ <el-button style="float: right;" type="primary" @click="handleAdd">
+ 鏂板璁㈠崟
+ </el-button>
+ </el-col>
+ </el-row>
+
+ <!-- 璁㈠崟鍒楄〃 -->
+ <el-table
+ :data="filteredList"
+ style="width: 100%"
+ v-loading="loading"
+ border
+ stripe
+ height="calc(100vh - 22em)"
+ >
+ <el-table-column prop="id" label="ID" width="80" align="center"/>
+ <el-table-column prop="orderNo" label="璁㈠崟鍙�" width="150" />
+ <el-table-column prop="customer" label="瀹㈡埛鍚嶇О" />
+ <el-table-column prop="salesperson" label="涓氬姟鍛�" width="100" />
+ <el-table-column prop="orderDate" label="涓嬪崟鏃ユ湡" width="120" />
+ <el-table-column prop="amount" label="璁㈠崟閲戦" width="120">
+ <template #default="scope">
+ 楼{{ scope.row.amount.toFixed(2) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="paymentMethod" label="浠樻鏂瑰紡" width="120" />
+ <el-table-column prop="status" label="璁㈠崟鐘舵��" width="100">
+ <template #default="scope">
+ <el-tag :type="getStatusType(scope.row.status)">
+ {{ scope.row.status }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="250" fixed="right" align="center">
+ <template #default="scope">
+ <el-button link type="primary" @click="handleView(scope.row)">鏌ョ湅</el-button>
+ <el-button link type="primary" @click="handleEdit(scope.row)" v-if="scope.row.status === '寰呭鏍�'">缂栬緫</el-button>
+ <el-button link type="primary" @click="handleReview(scope.row)" v-if="scope.row.status === '寰呭鏍�'">瀹℃牳</el-button>
+ <el-button link type="primary" @click="handleTransfer(scope.row)" v-if="scope.row.status === '宸插鏍�'">杞崟</el-button>
+ <el-button link type="danger" @click="handleCancel(scope.row)" v-if="scope.row.status === '寰呭鏍�'">鍙栨秷</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <!-- 鍒嗛〉 -->
+ <pagination
+ :total="pagination.total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="pagination.currentPage"
+ :limit="pagination.pageSize"
+ @pagination="handleCurrentChange"
+ />
+ </el-card>
+
+ <!-- 鏂板/缂栬緫瀵硅瘽妗� -->
+ <el-dialog v-model="dialogVisible" :title="dialogTitle" width="700px">
+ <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="瀹㈡埛鍚嶇О" prop="customer">
+ <el-select v-model="form.customer" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%">
+ <el-option label="涓婃捣绉戞妧鏈夐檺鍏徃" value="涓婃捣绉戞妧鏈夐檺鍏徃"></el-option>
+ <el-option label="娣卞湷鐢靛瓙鏈夐檺鍏徃" value="娣卞湷鐢靛瓙鏈夐檺鍏徃"></el-option>
+ <el-option label="鍖椾含璐告槗鍏徃" value="鍖椾含璐告槗鍏徃"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="涓氬姟鍛�" prop="salesperson">
+ <el-select v-model="form.salesperson" placeholder="璇烽�夋嫨涓氬姟鍛�" style="width: 100%">
+ <el-option label="闄堝織寮�" value="闄堝織寮�"></el-option>
+ <el-option label="鍒橀泤濠�" value="鍒橀泤濠�"></el-option>
+ <el-option label="鐜嬪缓鍥�" value="鐜嬪缓鍥�"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="璁㈠崟鏃ユ湡" prop="orderDate">
+ <el-date-picker
+ v-model="form.orderDate"
+ type="date"
+ placeholder="閫夋嫨璁㈠崟鏃ユ湡"
+ style="width: 100%"
+ format="YYYY-MM-DD"
+ value-format="YYYY-MM-DD"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁㈠崟閲戦" prop="amount">
+ <el-input-number v-model="form.amount" :precision="2" :min="0" style="width: 100%"></el-input-number>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浠樻鏂瑰紡" prop="paymentMethod">
+ <el-select v-model="form.paymentMethod" placeholder="璇烽�夋嫨浠樻鏂瑰紡" style="width: 100%">
+ <el-option label="鍏ㄦ鍒颁粯" value="鍏ㄦ鍒颁粯"></el-option>
+ <el-option label="鍒嗘湡浠樻" value="鍒嗘湡浠樻"></el-option>
+ <el-option label="鏈堢粨" value="鏈堢粨"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁㈠崟鐘舵��" prop="status">
+ <el-select v-model="form.status" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%">
+ <el-option label="寰呭鏍�" value="寰呭鏍�"></el-option>
+ <el-option label="宸插鏍�" value="宸插鏍�"></el-option>
+ <el-option label="宸插彂璐�" value="宸插彂璐�"></el-option>
+ <el-option label="宸插畬鎴�" value="宸插畬鎴�"></el-option>
+ <el-option label="宸插彇娑�" value="宸插彇娑�"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="24">
+ <el-form-item label="澶囨敞" prop="remark">
+ <el-input type="textarea" v-model="form.remark" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" rows="3"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="handleSubmit">纭� 瀹�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+
+ <!-- 璁㈠崟瀹℃牳瀵硅瘽妗� -->
+ <el-dialog v-model="reviewDialogVisible" title="璁㈠崟瀹℃牳" width="500px">
+ <el-form label-width="100px">
+ <el-form-item label="璁㈠崟鍙�">
+ <span>{{ currentOrder.orderNo }}</span>
+ </el-form-item>
+ <el-form-item label="瀹㈡埛鍚嶇О">
+ <span>{{ currentOrder.customer }}</span>
+ </el-form-item>
+ <el-form-item label="璁㈠崟閲戦">
+ <span>楼{{ currentOrder.amount.toFixed(2) }}</span>
+ </el-form-item>
+ <el-form-item label="瀹℃牳缁撴灉" prop="reviewResult">
+ <el-radio-group v-model="reviewResult">
+ <el-radio label="閫氳繃">閫氳繃</el-radio>
+ <el-radio label="鎷掔粷">鎷掔粷</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="瀹℃牳鎰忚" prop="reviewComment">
+ <el-input type="textarea" v-model="reviewComment" rows="3" placeholder="璇疯緭鍏ュ鏍告剰瑙�"></el-input>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="reviewDialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="saveReview">纭� 瀹�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+
+ <!-- 璁㈠崟杞崟瀵硅瘽妗� -->
+ <el-dialog v-model="transferDialogVisible" title="璁㈠崟杞崟" width="500px">
+ <el-form label-width="100px">
+ <el-form-item label="璁㈠崟鍙�">
+ <span>{{ currentOrder.orderNo }}</span>
+ </el-form-item>
+ <el-form-item label="褰撳墠涓氬姟鍛�">
+ <span>{{ currentOrder.salesperson }}</span>
+ </el-form-item>
+ <el-form-item label="杞崟缁�" prop="newSalesperson">
+ <el-select v-model="newSalesperson" placeholder="璇烽�夋嫨鏂颁笟鍔″憳" style="width: 100%">
+ <el-option label="闄堝織寮�" value="闄堝織寮�"></el-option>
+ <el-option label="鍒橀泤濠�" value="鍒橀泤濠�"></el-option>
+ <el-option label="鐜嬪缓鍥�" value="鐜嬪缓鍥�"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="杞崟鍘熷洜" prop="transferReason">
+ <el-input type="textarea" v-model="transferReason" rows="3" placeholder="璇疯緭鍏ヨ浆鍗曞師鍥�"></el-input>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="transferDialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="saveTransfer">纭� 瀹�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, computed } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { Plus, Search } from '@element-plus/icons-vue'
+import Pagination from '@/components/PIMTable/Pagination.vue'
+
+// 鍝嶅簲寮忔暟鎹�
+const loading = ref(false)
+const searchForm = reactive({
+ orderNo: '',
+ customer: '',
+ status: ''
+})
+
+const orderList = ref([
+ {
+ id: 1,
+ orderNo: 'ORD202312001',
+ customer: '涓婃捣绉戞妧鏈夐檺鍏徃',
+ salesperson: '闄堝織寮�',
+ orderDate: '2023-12-01',
+ amount: 50000.00,
+ paymentMethod: '鍏ㄦ鍒颁粯',
+ status: '寰呭鏍�',
+ remark: '閲嶈瀹㈡埛璁㈠崟'
+ },
+ {
+ id: 2,
+ orderNo: 'ORD202312002',
+ customer: '娣卞湷鐢靛瓙鏈夐檺鍏徃',
+ salesperson: '鍒橀泤濠�',
+ orderDate: '2023-12-02',
+ amount: 35000.00,
+ paymentMethod: '鍒嗘湡浠樻',
+ status: '宸插鏍�',
+ remark: '甯歌璁㈠崟'
+ },
+ {
+ id: 3,
+ orderNo: 'ORD202312003',
+ customer: '鍖椾含璐告槗鍏徃',
+ salesperson: '鐜嬪缓鍥�',
+ orderDate: '2023-12-03',
+ amount: 28000.00,
+ paymentMethod: '鏈堢粨',
+ status: '宸插彂璐�',
+ remark: '鏂板鎴疯鍗�'
+ }
+])
+
+const pagination = reactive({
+ total: 3,
+ currentPage: 1,
+ pageSize: 10
+})
+
+const dialogVisible = ref(false)
+const dialogTitle = ref('鏂板璁㈠崟')
+const form = reactive({
+ customer: '',
+ salesperson: '',
+ orderDate: '',
+ amount: 0,
+ paymentMethod: '',
+ status: '寰呭鏍�',
+ remark: ''
+})
+
+const rules = {
+ customer: [{ required: true, message: '璇烽�夋嫨瀹㈡埛', trigger: 'change' }],
+ salesperson: [{ required: true, message: '璇烽�夋嫨涓氬姟鍛�', trigger: 'change' }],
+ orderDate: [{ required: true, message: '璇烽�夋嫨璁㈠崟鏃ユ湡', trigger: 'change' }],
+ amount: [{ required: true, message: '璇疯緭鍏ヨ鍗曢噾棰�', trigger: 'blur' }],
+ paymentMethod: [{ required: true, message: '璇烽�夋嫨浠樻鏂瑰紡', trigger: 'change' }],
+ status: [{ required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change' }]
+}
+
+const isEdit = ref(false)
+const editId = ref(null)
+const reviewDialogVisible = ref(false)
+const transferDialogVisible = ref(false)
+const currentOrder = ref({})
+const reviewResult = ref('')
+const reviewComment = ref('')
+const newSalesperson = ref('')
+const transferReason = ref('')
+const formRef = ref()
+
+// 璁$畻灞炴��
+const filteredList = computed(() => {
+ let list = orderList.value
+ if (searchForm.orderNo) {
+ list = list.filter(item => item.orderNo.includes(searchForm.orderNo))
+ }
+ if (searchForm.customer) {
+ list = list.filter(item => item.customer === searchForm.customer)
+ }
+ if (searchForm.status) {
+ list = list.filter(item => item.status === searchForm.status)
+ }
+ return list
+})
+
+// 鏂规硶
+const getStatusType = (status) => {
+ const statusMap = {
+ '寰呭鏍�': 'warning',
+ '宸插鏍�': 'primary',
+ '宸插彂璐�': 'success',
+ '宸插畬鎴�': 'success',
+ '宸插彇娑�': 'danger'
+ }
+ return statusMap[status] || 'info'
+}
+
+const handleSearch = () => {
+ // 鎼滅储閫昏緫宸插湪computed涓鐞�
+}
+
+const resetSearch = () => {
+ searchForm.orderNo = ''
+ searchForm.customer = ''
+ searchForm.status = ''
+}
+
+const handleAdd = () => {
+ dialogTitle.value = '鏂板璁㈠崟'
+ isEdit.value = false
+ form.customer = ''
+ form.salesperson = ''
+ form.orderDate = ''
+ form.amount = 0
+ form.paymentMethod = ''
+ form.status = '寰呭鏍�'
+ form.remark = ''
+ dialogVisible.value = true
+}
+
+const handleView = (row) => {
+ // 鏌ョ湅璁㈠崟璇︽儏
+ ElMessage.info('鏌ョ湅璁㈠崟璇︽儏鍔熻兘寰呭疄鐜�')
+}
+
+const handleEdit = (row) => {
+ dialogTitle.value = '缂栬緫璁㈠崟'
+ isEdit.value = true
+ editId.value = row.id
+ Object.assign(form, row)
+ dialogVisible.value = true
+}
+
+const handleReview = (row) => {
+ currentOrder.value = row
+ reviewResult.value = ''
+ reviewComment.value = ''
+ reviewDialogVisible.value = true
+}
+
+const handleTransfer = (row) => {
+ currentOrder.value = row
+ newSalesperson.value = ''
+ transferReason.value = ''
+ transferDialogVisible.value = true
+}
+
+const handleCancel = (row) => {
+ ElMessageBox.confirm('纭鍙栨秷璇ヨ鍗曞悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ const index = orderList.value.findIndex(item => item.id === row.id)
+ if (index > -1) {
+ orderList.value[index].status = '宸插彇娑�'
+ ElMessage.success('璁㈠崟宸插彇娑�')
+ }
+ })
+}
+
+const handleDelete = (row) => {
+ ElMessageBox.confirm('纭鍒犻櫎璇ヨ鍗曞悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ const index = orderList.value.findIndex(item => item.id === row.id)
+ if (index > -1) {
+ orderList.value.splice(index, 1)
+ pagination.total--
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ }
+ })
+}
+
+const saveReview = () => {
+ if (!reviewResult.value) {
+ ElMessage.warning('璇烽�夋嫨瀹℃牳缁撴灉')
+ return
+ }
+
+ const index = orderList.value.findIndex(item => item.id === currentOrder.value.id)
+ if (index > -1) {
+ if (reviewResult.value === '閫氳繃') {
+ orderList.value[index].status = '宸插鏍�'
+ ElMessage.success('璁㈠崟瀹℃牳閫氳繃')
+ } else {
+ orderList.value[index].status = '宸插彇娑�'
+ ElMessage.success('璁㈠崟瀹℃牳鎷掔粷')
+ }
+ reviewDialogVisible.value = false
+ }
+}
+
+const saveTransfer = () => {
+ if (!newSalesperson.value) {
+ ElMessage.warning('璇烽�夋嫨鏂颁笟鍔″憳')
+ return
+ }
+
+ const index = orderList.value.findIndex(item => item.id === currentOrder.value.id)
+ if (index > -1) {
+ orderList.value[index].salesperson = newSalesperson.value
+ ElMessage.success('璁㈠崟杞崟鎴愬姛')
+ transferDialogVisible.value = false
+ }
+}
+
+const handleSubmit = () => {
+ formRef.value.validate((valid) => {
+ if (valid) {
+ if (isEdit.value) {
+ // 缂栬緫
+ const index = orderList.value.findIndex(item => item.id === editId.value)
+ if (index > -1) {
+ orderList.value[index] = { ...form, id: editId.value }
+ ElMessage.success('缂栬緫鎴愬姛')
+ }
+ } else {
+ // 鏂板
+ const newId = Math.max(...orderList.value.map(item => item.id)) + 1
+ const orderNo = `ORD${new Date().getFullYear()}${String(new Date().getMonth() + 1).padStart(2, '0')}${String(new Date().getDate()).padStart(2, '0')}${String(newId).padStart(3, '0')}`
+ orderList.value.push({
+ ...form,
+ id: newId,
+ orderNo: orderNo
+ })
+ pagination.total++
+ ElMessage.success('鏂板鎴愬姛')
+ }
+ dialogVisible.value = false
+ }
+ })
+}
+
+const handleCurrentChange = (val) => {
+ pagination.currentPage = val.page
+ pagination.pageSize = val.limit
+}
+</script>
+
+<style scoped>
+.search-row {
+ margin-bottom: 20px;
+}
+</style>
--
Gitblit v1.9.3