From 9289a4fbacafcc7a80385fc3a3167f383d5cf991 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 一月 2026 18:00:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/views/salesManagement/paymentShipping/index.vue | 207 +++++++++++++++++++++------------------------------
1 files changed, 85 insertions(+), 122 deletions(-)
diff --git a/src/views/salesManagement/paymentShipping/index.vue b/src/views/salesManagement/paymentShipping/index.vue
index 20c5b40..32edfde 100644
--- a/src/views/salesManagement/paymentShipping/index.vue
+++ b/src/views/salesManagement/paymentShipping/index.vue
@@ -40,7 +40,7 @@
<!-- 鏀粯涓庡彂璐у垪琛� -->
<el-table
- :data="filteredList"
+ :data="recordList"
style="width: 100%"
v-loading="loading"
border
@@ -52,7 +52,12 @@
<el-table-column prop="customer" label="瀹㈡埛鍚嶇О" />
<el-table-column prop="orderAmount" label="璁㈠崟閲戦" width="120">
<template #default="scope">
- 楼{{ scope.row.orderAmount.toFixed(2) }}
+ 楼{{ scope.row.orderAmount }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="orderAmount" label="宸蹭粯娆鹃噾棰�" width="120">
+ <template #default="scope">
+ 楼{{ scope.row.paidAmount }}
</template>
</el-table-column>
<el-table-column prop="paymentMethod" label="浠樻鏂瑰紡" width="120" />
@@ -73,7 +78,7 @@
<el-table-column prop="shippingDate" label="鍙戣揣鏃ユ湡" width="120" />
<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="handleView(scope.row)">鏌ョ湅</el-button>-->
<el-button link type="primary" @click="handlePayment(scope.row)" v-if="scope.row.paymentStatus !== '宸蹭粯娆�'">浠樻</el-button>
<el-button link type="primary" @click="handleShipping(scope.row)" v-if="scope.row.paymentStatus === '宸蹭粯娆�' && scope.row.shippingStatus === '寰呭彂璐�'">鍙戣揣</el-button>
<el-button link type="primary" @click="handleEdit(scope.row)">缂栬緫</el-button>
@@ -84,21 +89,21 @@
<!-- 鍒嗛〉 -->
<pagination
- :total="pagination.total"
+ :total="total"
layout="total, sizes, prev, pager, next, jumper"
- :page="pagination.currentPage"
- :limit="pagination.pageSize"
+ :page="pagination.current"
+ :limit="pagination.size"
@pagination="handleCurrentChange"
/>
</el-card>
<!-- 鏂板/缂栬緫瀵硅瘽妗� -->
- <el-dialog v-model="dialogVisible" :title="dialogTitle" width="700px">
+ <FormDialog v-model="dialogVisible" :title="dialogTitle" :width="'700px'" @close="dialogVisible = false" @confirm="handleSubmit" @cancel="dialogVisible = false">
<el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="璁㈠崟鍙�" prop="orderNo">
- <el-input v-model="form.orderNo" placeholder="璇疯緭鍏ヨ鍗曞彿"></el-input>
+ <el-input v-model="form.orderNo" placeholder="璇疯緭鍏ヨ鍗曞彿" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -183,7 +188,7 @@
</el-dialog>
<!-- 浠樻瀵硅瘽妗� -->
- <el-dialog v-model="paymentDialogVisible" title="璁㈠崟浠樻" width="500px">
+ <FormDialog v-model="paymentDialogVisible" title="璁㈠崟浠樻" :width="'500px'" @close="paymentDialogVisible = false" @confirm="savePayment" @cancel="paymentDialogVisible = false">
<el-form label-width="100px">
<el-form-item label="璁㈠崟鍙�">
<span>{{ currentRecord.orderNo }}</span>
@@ -192,7 +197,7 @@
<span>{{ currentRecord.customer }}</span>
</el-form-item>
<el-form-item label="璁㈠崟閲戦">
- <span>楼{{ currentRecord.orderAmount.toFixed(2) }}</span>
+ <span>楼{{ currentRecord.orderAmount }}</span>
</el-form-item>
<el-form-item label="浠樻閲戦" prop="paymentAmount">
<el-input-number v-model="paymentAmount" :precision="2" :min="0" :max="currentRecord.orderAmount" style="width: 100%"></el-input-number>
@@ -209,16 +214,10 @@
<el-input type="textarea" v-model="paymentRemark" rows="3" placeholder="璇疯緭鍏ヤ粯娆惧娉�"></el-input>
</el-form-item>
</el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="paymentDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="savePayment">纭� 瀹�</el-button>
- </div>
- </template>
- </el-dialog>
+ </FormDialog>
<!-- 鍙戣揣瀵硅瘽妗� -->
- <el-dialog v-model="shippingDialogVisible" title="璁㈠崟鍙戣揣" width="500px">
+ <FormDialog v-model="shippingDialogVisible" title="璁㈠崟鍙戣揣" :width="'500px'" @close="shippingDialogVisible = false" @confirm="saveShipping" @cancel="shippingDialogVisible = false">
<el-form label-width="100px">
<el-form-item label="璁㈠崟鍙�">
<span>{{ currentRecord.orderNo }}</span>
@@ -252,21 +251,34 @@
<el-input type="textarea" v-model="shippingRemark" rows="3" placeholder="璇疯緭鍏ュ彂璐у娉�"></el-input>
</el-form-item>
</el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="shippingDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="saveShipping">纭� 瀹�</el-button>
- </div>
- </template>
- </el-dialog>
+ </FormDialog>
</div>
</template>
<script setup>
-import { ref, reactive, computed } from 'vue'
+import { ref, reactive, computed,onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Search } from '@element-plus/icons-vue'
+import {listPage,add,update,deletePaymentShipping} from "@/api/salesManagement/paymentShipping.js"
import Pagination from '@/components/PIMTable/Pagination.vue'
+import FormDialog from '@/components/Dialog/FormDialog.vue'
+
+const total = ref(0)
+onMounted(() => {
+ getList()
+})
+
+const getList = () => {
+ loading.value = true
+ listPage({...searchForm,...pagination}).then(res => {
+ if(res.code === 200){
+ recordList.value = res.data.records
+ total.value = res.data.total
+ loading.value = false
+ console.log(recordList.value)
+ }
+ })
+}
// 鍝嶅簲寮忔暟鎹�
const loading = ref(false)
@@ -276,49 +288,11 @@
shippingStatus: ''
})
-const recordList = ref([
- {
- id: 1,
- orderNo: 'ORD202312001',
- customer: '涓婃捣绉戞妧鏈夐檺鍏徃',
- orderAmount: 50000.00,
- paymentMethod: '鍏ㄦ鍒颁粯',
- paymentStatus: '宸蹭粯娆�',
- shippingStatus: '宸插彂璐�',
- shippingDate: '2023-12-05',
- trackingNo: 'SF1234567890',
- remark: '閲嶈瀹㈡埛璁㈠崟'
- },
- {
- id: 2,
- orderNo: 'ORD202312002',
- customer: '娣卞湷鐢靛瓙鏈夐檺鍏徃',
- orderAmount: 35000.00,
- paymentMethod: '鍒嗘湡浠樻',
- paymentStatus: '閮ㄥ垎浠樻',
- shippingStatus: '寰呭彂璐�',
- shippingDate: '',
- trackingNo: '',
- remark: '甯歌璁㈠崟'
- },
- {
- id: 3,
- orderNo: 'ORD202312003',
- customer: '鍖椾含璐告槗鍏徃',
- orderAmount: 28000.00,
- paymentMethod: '鏈堢粨',
- paymentStatus: '鏈粯娆�',
- shippingStatus: '寰呭彂璐�',
- shippingDate: '',
- trackingNo: '',
- remark: '鏂板鎴疯鍗�'
- }
-])
+const recordList = ref([])
const pagination = reactive({
- total: 3,
- currentPage: 1,
- pageSize: 10
+ current: 1,
+ size: 10
})
const dialogVisible = ref(false)
@@ -336,7 +310,7 @@
})
const rules = {
- orderNo: [{ required: true, message: '璇疯緭鍏ヨ鍗曞彿', trigger: 'blur' }],
+ // orderNo: [{ required: true, message: '璇疯緭鍏ヨ鍗曞彿', trigger: 'blur' }],
customer: [{ required: true, message: '璇烽�夋嫨瀹㈡埛', trigger: 'change' }],
orderAmount: [{ required: true, message: '璇疯緭鍏ヨ鍗曢噾棰�', trigger: 'blur' }],
paymentMethod: [{ required: true, message: '璇烽�夋嫨浠樻鏂瑰紡', trigger: 'change' }],
@@ -357,21 +331,6 @@
const trackingNo = ref('')
const shippingRemark = ref('')
const formRef = ref()
-
-// 璁$畻灞炴��
-const filteredList = computed(() => {
- let list = recordList.value
- if (searchForm.orderNo) {
- list = list.filter(item => item.orderNo.includes(searchForm.orderNo))
- }
- if (searchForm.paymentStatus) {
- list = list.filter(item => item.paymentStatus === searchForm.paymentStatus)
- }
- if (searchForm.shippingStatus) {
- list = list.filter(item => item.shippingStatus === searchForm.shippingStatus)
- }
- return list
-})
// 鏂规硶
const getPaymentStatusType = (status) => {
@@ -394,6 +353,7 @@
const handleSearch = () => {
// 鎼滅储閫昏緫宸插湪computed涓鐞�
+ getList()
}
const resetSearch = () => {
@@ -432,7 +392,7 @@
const handlePayment = (row) => {
currentRecord.value = row
- paymentAmount.value = row.orderAmount
+ paymentAmount.value = row.orderAmount - row.paidAmount
paymentMethod.value = ''
paymentRemark.value = ''
paymentDialogVisible.value = true
@@ -453,12 +413,13 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- const index = recordList.value.findIndex(item => item.id === row.id)
- if (index > -1) {
- recordList.value.splice(index, 1)
- pagination.total--
- ElMessage.success('鍒犻櫎鎴愬姛')
- }
+ let ids = [row.id]
+ deletePaymentShipping(ids).then(res => {
+ if(res.code === 200){
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ getList()
+ }
+ })
})
}
@@ -467,17 +428,20 @@
ElMessage.warning('璇烽�夋嫨浠樻鏂瑰紡')
return
}
-
- const index = recordList.value.findIndex(item => item.id === currentRecord.value.id)
- if (index > -1) {
- if (paymentAmount.value >= currentRecord.value.orderAmount) {
- recordList.value[index].paymentStatus = '宸蹭粯娆�'
- } else if (paymentAmount.value > 0) {
- recordList.value[index].paymentStatus = '閮ㄥ垎浠樻'
- }
- ElMessage.success('浠樻璁板綍宸蹭繚瀛�')
- paymentDialogVisible.value = false
+ currentRecord.value.paidAmount = Number(currentRecord.value.paidAmount) + paymentAmount.value
+ if(currentRecord.value.paidAmount == currentRecord.value.orderAmount){
+ currentRecord.value.paymentStatus = '宸蹭粯娆�'
+ }else{
+ currentRecord.value.paymentStatus = '閮ㄥ垎浠樻'
}
+ update(currentRecord.value).then(res => {
+ if(res.code === 200){
+ ElMessage.success('浠樻淇℃伅宸蹭繚瀛�')
+ paymentDialogVisible.value = false
+ getList()
+ }
+ })
+
}
const saveShipping = () => {
@@ -485,15 +449,14 @@
ElMessage.warning('璇峰~鍐欏畬鏁寸殑鍙戣揣淇℃伅')
return
}
-
- const index = recordList.value.findIndex(item => item.id === currentRecord.value.id)
- if (index > -1) {
- recordList.value[index].shippingStatus = '宸插彂璐�'
- recordList.value[index].shippingDate = shippingDate.value
- recordList.value[index].trackingNo = trackingNo.value
- ElMessage.success('鍙戣揣淇℃伅宸蹭繚瀛�')
- shippingDialogVisible.value = false
- }
+ currentRecord.value.shippingStatus = '宸插彂璐�'
+ update(currentRecord.value).then(res => {
+ if(res.code === 200){
+ ElMessage.success('鍙戣揣淇℃伅宸蹭繚瀛�')
+ shippingDialogVisible.value = false
+ getList()
+ }
+ })
}
const handleSubmit = () => {
@@ -501,20 +464,20 @@
if (valid) {
if (isEdit.value) {
// 缂栬緫
- const index = recordList.value.findIndex(item => item.id === editId.value)
- if (index > -1) {
- recordList.value[index] = { ...form, id: editId.value }
- ElMessage.success('缂栬緫鎴愬姛')
- }
+ update(form).then(res => {
+ if(res.code === 200){
+ ElMessage.success('缂栬緫鎴愬姛')
+ getList()
+ }
+ })
} else {
// 鏂板
- const newId = Math.max(...recordList.value.map(item => item.id)) + 1
- recordList.value.push({
- ...form,
- id: newId
+ add(form).then(res => {
+ if(res.code === 200){
+ ElMessage.success('鏂板鎴愬姛')
+ getList()
+ }
})
- pagination.total++
- ElMessage.success('鏂板鎴愬姛')
}
dialogVisible.value = false
}
@@ -522,8 +485,8 @@
}
const handleCurrentChange = (val) => {
- pagination.currentPage = val.page
- pagination.pageSize = val.limit
+ pagination.current = val.page
+ pagination.size = val.limit
}
</script>
--
Gitblit v1.9.3