From 5a85c220e182202b94e1637d235f3534a5914993 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 16 九月 2025 14:54:53 +0800
Subject: [PATCH] yys  支付与发货管理联调

---
 src/views/salesManagement/paymentShipping/index.vue |  176 +++++++++++++++++++++++++---------------------------------
 1 files changed, 75 insertions(+), 101 deletions(-)

diff --git a/src/views/salesManagement/paymentShipping/index.vue b/src/views/salesManagement/paymentShipping/index.vue
index 20c5b40..ae59d08 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,7 +89,7 @@
 
       <!-- 鍒嗛〉 -->
       <pagination
-        :total="pagination.total"
+        :total="total"
         layout="total, sizes, prev, pager, next, jumper"
         :page="pagination.currentPage"
         :limit="pagination.pageSize"
@@ -98,7 +103,7 @@
         <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">
@@ -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>
@@ -263,10 +268,28 @@
 </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'
+
+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 +299,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 +321,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 +342,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 +364,7 @@
 
 const handleSearch = () => {
   // 鎼滅储閫昏緫宸插湪computed涓鐞�
+  getList()
 }
 
 const resetSearch = () => {
@@ -432,7 +403,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 +424,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 +439,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 +460,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 +475,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
     }

--
Gitblit v1.9.3