瀏覽代碼

bug修改

Co-authored-by: Copilot <copilot@github.com>
hurx 23 小時之前
父節點
當前提交
a78ad8cf0b

+ 11 - 0
src/api/breg/index.ts

@@ -74,3 +74,14 @@ export const selectByPhone = (phonenumber: string) => {
     timeout: 20000
   });
 };
+
+/**
+ * 根据名称查询客户信息
+ * @param customerName
+ */
+export const selectBycustomerName = (customerName: string) => {
+  return request({
+    url: '/customer/pcCustomer/selectByCustomerName/' + customerName,
+    method: 'get'
+  });
+};

+ 1 - 1
src/api/pc/enterprise/purchaseHabit.ts

@@ -16,7 +16,7 @@ export function getInvoiceInfo(id: number) {
  */
 export const addPurchaseHabit = (data: PurchaseHabit) => {
   return request({
-    url: '/customer/purchaseHabit',
+    url: '/customer/pcPurchaseHabit',
     method: 'post',
     data: data
   });

+ 25 - 5
src/views/breg/index.vue

@@ -134,7 +134,7 @@
 </template>
 
 <script setup lang="ts">
-import { smsCode, selectBusinessByCustomerName, registerCustomer, selectByPhone } from '@/api/breg/index';
+import { smsCode, selectBusinessByCustomerName, registerCustomer, selectByPhone, selectBycustomerName } from '@/api/breg/index';
 import { onUnmounted } from 'vue';
 import { onPath } from '@/utils/siteConfig';
 const nextNum = ref<any>(1);
@@ -283,14 +283,34 @@ const nextStep = () => {
   } else if (nextNum.value == 2) {
     if (validateStrict(form.value.customerName)) {
       loading.value = true;
-      selectBusinessByCustomerName(form.value.customerName)
+      // 1. 首先检查客户是否存在
+      selectBycustomerName(form.value.customerName)
         .then((res: any) => {
           if (res.code == 200) {
-            enterprise.value = res.data;
-            nextNum.value = 3;
+            // 2. 如果客户已存在,直接提示并中断后续逻辑
+            if (res.data.length > 0) {
+              ElMessage({
+                message: '该客户已存在',
+                type: 'warning'
+              });
+              loading.value = false;
+              return; // 这里的 return 会跳出当前的 .then() 回调
+            }
           }
+          // 3. 只有当客户不存在时,才会执行下面的代码
+          selectBusinessByCustomerName(form.value.customerName)
+            .then((res: any) => {
+              if (res.code == 200) {
+                enterprise.value = res.data;
+                nextNum.value = 3;
+              }
+            })
+            .finally(() => {
+              loading.value = false;
+            });
         })
-        .finally(() => {
+        .catch(() => {
+          // 4. 处理第一个请求失败的情况,并关闭 loading
           loading.value = false;
         });
     } else {

+ 13 - 9
src/views/enterprise/invoiceManage/index.vue

@@ -3,23 +3,27 @@
     <div class="page-title"><i class="title-bar"></i><span>发票管理</span></div>
     <!-- 搜索栏 -->
     <div class="search-bar">
-      <el-input v-model="queryParams.keyword" placeholder="搜索" style="width: 200px" clearable>
+      <el-input v-model="queryParams.taxId" placeholder="纳税人识别号" style="width: 260px" clearable @keyup.enter="handleQuery">
         <template #prefix
           ><el-icon><Search /></el-icon
         ></template>
       </el-input>
-      <el-select v-model="queryParams.searchType" placeholder="账户名称" style="width: 120px">
-        <el-option label="账户名称" value="accountName" />
-        <el-option label="发票抬头" value="invoiceTitle" />
-        <el-option label="纳税人识别号" value="taxNo" />
-      </el-select>
+      <el-input v-model="queryParams.bankName" placeholder="开户名称" style="width: 260px" clearable @keyup.enter="handleQuery">
+        <template #prefix
+          ><el-icon><Search /></el-icon
+        ></template>
+      </el-input>
+      <!-- <el-select v-model="queryParams.taxId" placeholder="账户名称" style="width: 150px" @keyup.enter="handleQuery">
+        <el-option label="账户名称" value="bankName" />
+        <el-option label="纳税人识别号" value="taxId" />
+      </el-select> -->
       <div class="search-right"><el-button type="danger" @click="handleAdd">新增开票信息</el-button></div>
     </div>
     <!-- 表格 -->
     <el-table :data="tableData" border style="width: 100%" :resizable="false">
-      <el-table-column prop="bankName" label="开户银行" width="140" show-overflow-tooltip :resizable="false" />
+      <el-table-column prop="bankName" label="开户银行" width="260" show-overflow-tooltip :resizable="false" />
       <el-table-column prop="bankAccount" label="开户账户" width="180" :resizable="false" />
-      <el-table-column prop="taxId" label="纳税人识别号" width="180" :resizable="false" />
+      <el-table-column prop="taxId" label="纳税人识别号" width="200" :resizable="false" />
       <el-table-column prop="address" label="地址" min-width="140" show-overflow-tooltip :resizable="false" />
       <el-table-column prop="phone" label="电话" width="120" :resizable="false" />
       <el-table-column label="操作" width="120" fixed="right" :resizable="false">
@@ -84,7 +88,7 @@ const total = ref(0);
 const invoiceTopic = ref('');
 const taxNo = ref('');
 
-const queryParams = reactive({ pageNum: 1, pageSize: 10, keyword: '', searchType: 'accountName' });
+const queryParams = reactive({ pageNum: 1, pageSize: 10, keyword: '', searchType: 'bankName', bankName: '', taxId: '', invoiceTitle: '' });
 const form = reactive({ invoiceTitle: '', taxNo: '', bankName: '', bankAccount: '', address: '', phone: '', bankId: null, bankCode: '' });
 const rules = {
   // invoiceTitle: [{ required: true, message: '请输入发票抬头', trigger: 'blur' }],

+ 15 - 6
src/views/enterprise/purchaseHabit/index.vue

@@ -135,7 +135,7 @@ import { reactive, getCurrentInstance, toRefs, onMounted, ComponentInternalInsta
 import { useRouter } from 'vue-router';
 import { ArrowLeft } from '@element-plus/icons-vue';
 import { ElMessage } from 'element-plus';
-import { updatePurchaseHabit, getCustomerPurchaseHabitData } from '@/api/pc/enterprise/purchaseHabit';
+import { addPurchaseHabit, updatePurchaseHabit, getCustomerPurchaseHabitData } from '@/api/pc/enterprise/purchaseHabit';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { welfare_item, sys_platform_yes_no, product_types_choosing, purchase_item, product_customization, daily_print_volume } = toRefs<any>(
@@ -161,8 +161,8 @@ const form = reactive({
   productTypes: [] as string[],
   printVolume: '',
   printAmount: '',
-  buyOriginal: '',
-  technologyService: '',
+  buyOriginal: '0',
+  technologyService: '1',
   categories: [] as string[],
   otherCategory: '',
   welfares: [] as string[],
@@ -231,10 +231,19 @@ const handleSave = async () => {
       otherCustomize: form.otherCustomize || undefined,
       remark: form.remark || undefined
     };
+    if (!form.id) {
+      // 新增
+      await addPurchaseHabit(submitData);
+      ElMessage.success('保存成功');
+      // handleBack();
+      return;
+    } else {
+      await updatePurchaseHabit(submitData);
+      ElMessage.success('保存成功');
+    }
 
-    await updatePurchaseHabit(submitData);
-    ElMessage.success('保存成功');
-    handleBack();
+    // handleBack();
+    getCustomerPurchaseHabitData();
   } catch (error) {
     ElMessage.error('保存失败');
   }

+ 15 - 1
src/views/enterprise/purchaseHistory/index.vue

@@ -60,7 +60,7 @@
         <div class="order-header flex-row-between">
           <div class="flex-row-start" style="gap: 0 15px">
             <el-checkbox style="margin: 2px 0px 0px 0" v-model="order.checked" @change="handleOrderCheck" />
-            <div>{{ order.orderTime }}</div>
+            <div>{{ formatOrderTime(order.orderTime) }}</div>
             <div>订单号:{{ order.orderNo }}</div>
             <div>下单人:{{ order.orderPerson }}</div>
             <div>部门:{{ order.department }}</div>
@@ -134,6 +134,7 @@ import { ElMessage } from 'element-plus';
 import { getDeptTree } from '@/api/pc/organization';
 import { DeptInfo } from '@/api/pc/organization/types';
 import { addProductShoppingCart } from '@/api/goods/index';
+import { parseTime } from '@/utils/ruoyi';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { order_status, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'pay_method'));
 
@@ -151,6 +152,19 @@ const statusTabs = [
   { key: 'cancelled', label: '已取消', icon: CircleClose }
 ];
 
+// 格式化时间
+const formatOrderTime = (timeStr: string) => {
+  if (!timeStr) return '';
+  try {
+    // 处理后端返回的中文时间格式 "2026/3/13 上午3:35"
+    const date = new Date(timeStr);
+    if (isNaN(date.getTime())) return timeStr;
+    return parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}');
+  } catch (e) {
+    return timeStr;
+  }
+};
+
 // 监听标签页切换,重置页码并重新获取数据
 watch(activeTab, (newTab) => {
   queryParams.pageNum = 1;

+ 16 - 10
src/views/order/afterSale/index.vue

@@ -65,16 +65,22 @@
           </div>
           <div class="card-content">
             <div class="col-product">
-              <div class="product-image">
-                <el-image :src="item.productImage" fit="contain">
-                  <template #error
-                    ><div class="image-placeholder">
-                      <el-icon :size="30" color="#ccc"><Picture /></el-icon></div
-                  ></template>
-                </el-image>
+              <!-- <div class="product-image"></div> -->
+              <div
+                v-if="item.productImage && item.productImage.length > 0"
+                style="display: flex; flex-wrap: wrap; max-width: 200px; margin-right: 10px"
+              >
+                <el-image
+                  v-for="(url, index) in item.productImage"
+                  :key="index"
+                  :src="url"
+                  :preview-src-list="item.productImage"
+                  style="width: 60px; height: 60px; margin: 0 4px 4px 0; object-fit: cover; border: 1px solid #eee"
+                  fit="cover"
+                />
               </div>
               <div class="product-info">
-                <div class="product-name">{{ item.productName }}</div>
+                <!-- <div class="product-name">{{ item.productName }}</div> -->
                 <div class="product-quantity">x{{ item.quantity }}</div>
               </div>
             </div>
@@ -308,8 +314,8 @@ const loadAfterSaleData = async () => {
         id: item.id,
         serviceNo: item.returnNo,
         orderNo: item.orderNo,
-        productImage: '',
-        productName: item.orderReturnItemList?.[0]?.productName || '商品名称',
+        productImage: item.orderReturnItemList?.map((productItem) => productItem.productImage),
+        productName: item.orderReturnItemList?.[0]?.productName,
         quantity: item.returnProductNum || 1,
         applyTime: item.returnTime,
         serviceType: item.serviceType,

+ 2 - 2
src/views/order/orderManage/auditDetail.vue

@@ -70,7 +70,7 @@ const loading = ref(false);
 
 const progressSteps = ref<{ title: string; icon: any; desc: string; time: string; reviewStatus?: number }[]>([
   { title: '提交订单', icon: Document, desc: '订单已提交', time: '', reviewStatus: 2 },
-  { title: '完成', icon: CircleCheck, desc: '交易完成', time: '', reviewStatus: 0 }
+  // { title: '完成', icon: CircleCheck, desc: '交易完成', time: '', reviewStatus: 0 }
 ]);
 
 // 订单时间信息(用于流程节点时间显示)
@@ -143,7 +143,7 @@ const loadFlowNodes = async () => {
       });
 
       // 完成节点:显示订单的 updateTime
-      steps.push({ title: '完成', icon: CircleCheck, desc: '交易完成', time: formatTime(orderTimeInfo.updateTime), reviewStatus: 0 });
+      // steps.push({ title: '完成', icon: CircleCheck, desc: '交易完成', time: formatTime(orderTimeInfo.updateTime), reviewStatus: 0 });
 
       progressSteps.value = steps;
 

+ 1 - 1
src/views/order/orderManage/detail.vue

@@ -62,7 +62,7 @@
           > -->
         </el-table>
         <div class="product-summary">
-          共{{ productList.length }}商品 运费:¥{{ orderInfo.freight }} 共计<span class="total-price">¥{{ orderInfo.totalAmount }}</span>
+          共{{ productList.length }}商品 运费:¥{{ orderInfo.freight }} 共计<span class="total-price">¥{{ orderInfo.totalAmount }}</span>
         </div>
       </div>
       <!-- 收货地址 -->

+ 14 - 15
src/views/order/orderManage/index.vue

@@ -76,9 +76,9 @@
           <el-icon><component :is="tab.icon" /></el-icon><span>{{ tab.label }}</span>
         </div>
       </div>
-      <el-button type="danger" link
+      <!-- <el-button type="danger" link
         ><el-icon><Delete /></el-icon>订单回收站</el-button
-      >
+      > -->
     </div>
     <!-- 订单列表 -->
     <div class="order-list">
@@ -132,22 +132,16 @@
             <div v-else style="width: 200px"></div>
             <div class="status-cell" v-if="itemIndex === 0">
               <div class="status-info">
-                <span
-                  class="status-text"
-                  :class="{ 'clickable': order.statusText === '待支付' }"
-                  :style="{ color: getStatusColor(order.status) }"
-                  @click="order.statusText === '待支付' && handlePayment(order)"
-                  >{{ order.statusText }}</span
-                >
-                <span
-                  v-if="order.auditStatus"
-                  :class="['audit-status', getAuditStatusClass(order.auditStatus), 'clickable-audit']"
-                  @click="order.auditStatus == '0' && handleAudit(order)"
-                >
+                <span class="status-text" :style="{ color: getStatusColor(order.status) }">{{ order.statusText }}</span>
+              </div>
+              <div class="status-info">
+                <span class="status-text" v-if="order.auditStatus">
                   {{ order.auditStatus == '0' ? '待审批' : order.auditStatus == '1' ? '' : '审批驳回' }}</span
                 >
               </div>
               <div class="action-buttons">
+                <el-button type="primary" v-if="order.statusText === '待支付'" link @click="handlePayment(order)"> 支付订单 </el-button>
+                <el-button type="primary" v-if="order.auditStatus == '0'" link @click="handleAudit(order)"> 审批订单 </el-button>
                 <el-button type="primary" v-if="order.statusText == '发货完成'" link @click="handleConfirmReceipt(order)">确认收货</el-button>
                 <el-button type="primary" v-if="order.statusText == '已完成' && order.evaluationStatus == '0'" link @click="handleEvaluation(order)"
                   >评价</el-button
@@ -372,7 +366,7 @@ const loadDeptTree = async () => {
 
 /** 单个加入购物车 */
 const handleAddCart = async (item: any) => {
-  addProductShoppingCart({ productId: item.id, productNum: 1 }).then((res: any) => {
+  addProductShoppingCart({ productId: item.productId, productNum: 1 }).then((res: any) => {
     if (res.code == 200) {
       ElMessage.success('已加入购物车');
     }
@@ -643,6 +637,11 @@ const handleAudit = (order: any) => {
 
 const handleConfirmReceipt = async (order: any) => {
   try {
+    await ElMessageBox.confirm('确定要确认收货吗?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    });
     const res = await batchConfirmation([order.id]);
     if (res.code === 200) {
       ElMessage.success('确认收货成功');

+ 8 - 4
src/views/organization/staffManage/index.vue

@@ -306,11 +306,15 @@ const handleSubmit = async () => {
   const valid = await formRef.value?.validate();
   if (!valid) return;
   if (editingRow.value) {
-    await updateContact(formData);
-    ElMessage.success('编辑成功');
+    const res = await updateContact(formData);
+    if (res.code === 200) {
+      ElMessage.success('编辑成功');
+    }
   } else {
-    await addContact(formData);
-    ElMessage.success('新增成功');
+    const res = await addContact(formData);
+    if (res.code === 200) {
+      ElMessage.success('新增成功');
+    }
   }
   loadContactList();
   dialogVisible.value = false;