Bläddra i källkod

绿色回收bug优化

liyuan 4 veckor sedan
förälder
incheckning
0ff8d0b757
2 ändrade filer med 90 tillägg och 10 borttagningar
  1. 21 5
      pages/views/recycling/details.vue
  2. 69 5
      pages/views/recycling/index.vue

+ 21 - 5
pages/views/recycling/details.vue

@@ -2,7 +2,7 @@
 
   <view class="container">
 
-    <view class="form-section" @click="openPicker">
+    <view class="form-section" @click="openPicker" :disabled="formData.status === 2">
       <view class="section-title">选择客户</view>
       <u-input
           v-model="formData.customerName"
@@ -13,7 +13,7 @@
       ></u-input>
     </view>
 
-    <u-popup :show="showCustomerPicker" mode="bottom" @close="closePicker">
+    <u-popup :show="showCustomerPicker" mode="bottom" @close="closePicker" :disabled="formData.status === 2">
       <!-- 顶部操作栏(渐变背景) -->
       <view class="picker-header">
         <text class="header-btn" @click="closePicker">取消</text>
@@ -48,6 +48,7 @@
             class="customer-card"
             :class="{active: selectedIndex === index}"
             @click="selectItem(index)"
+            :disabled="formData.status === 2"
         >
           <text class="customer-name">{{ item.cname }}</text>
           <u-icon
@@ -79,6 +80,7 @@
               :min="0"
               integer
               class="quantity-box"
+              :disabled="formData.status === 2"
           ></u-number-box>
           <view class="amount-box">
             <text class="amount-symbol">¥</text>
@@ -104,6 +106,7 @@
           :maxlength="200"
           auto-height
           confirm-type="done"
+          :disabled="formData.status === 2"
           :count="true"
           :height="180"
           class="remark-textarea"
@@ -117,11 +120,11 @@
           @afterRead="afterRead"
           @delete="deletePic"
           multiple
+          :deletable="formData.status !== 2"
           maxCount="3"
           :previewFullImage="true"
           uploadIcon="plus"
           uploadIconColor="#999"
-          deletable
           :previewImage="true"
           class="upload-area"
       >
@@ -130,13 +133,13 @@
         </template>
       </u-upload>
     </view>
-    <view class="submit-section" v-if="!this.formData.status || this.formData.status !== 2">
+    <view class="submit-section" v-if="!formData.status || formData.status !== 2">
       <button
           class="submit-btn"
           :disabled="totalAmount <= 0 || !formData.customerId"
           @click="clickSubmit"
       >
-        {{this.formData.id ? '修改回收单' : '提交回收单'}}
+        {{formData.id ? '修改回收单' : '提交回收单'}}
       </button>
     </view>
   </view>
@@ -162,6 +165,10 @@ export default {
     this.getGoodsList()
     console.log(options.id);
   },
+  onUnload() {
+    // 监听页面关闭
+    console.info('11111')
+  },
   data() {
     return {
       showCustomerPicker: false,
@@ -333,10 +340,18 @@ export default {
         console.info(res)
         this.formData.id = res.data
         uni.showToast({title: '提交成功'});
+        this.backPage()
       }).finally(() => {
         uni.hideLoading();
       })
     },
+    backPage(){
+      setTimeout(() => {
+        uni.navigateBack({
+          delta: 1
+        });
+      }, 1000)
+    },
     handleUpdate() {
       uni.showLoading({title: '提交中...'});
       this.formData.greenRecyclingItemList = this.goodsList.filter(item => item.productQuantity > 0)
@@ -344,6 +359,7 @@ export default {
         console.info(res)
         // this.formData.id = res.data
         uni.showToast({title: '修改成功'});
+        this.backPage()
       }).finally(() => {
         uni.hideLoading();
       })

+ 69 - 5
pages/views/recycling/index.vue

@@ -2,6 +2,24 @@
   <view class="container">
     <!-- 固定在顶部的筛选区域 -->
     <view class="filter-header">
+      <view class="input-group">
+        <u--input
+            class="input-item"
+            v-model="customerName"
+            placeholder="请输入客户名称"
+            border="surround"
+            clearable
+        ></u--input>
+        <u--input
+            class="input-item"
+            v-model="quantity"
+            placeholder="请输入订单数量"
+            type="number"
+            border="surround"
+            clearable
+        ></u--input>
+      </view>
+
       <view class="filter-controls">
         <view class="date-picker">
           <picker mode="date" @change="bindStartDateChange">
@@ -31,8 +49,8 @@
             </view>
           </picker>
         </view>
-        <button class="filter-btn" @click="handleSearch">查询</button>
       </view>
+      <button class="filter-btn" @click="handleSearch">查询</button>
     </view>
 
 
@@ -58,7 +76,7 @@
           >
             <!-- 原有订单内容 -->
             <view class="item-header">
-              <text class="order-id">订单号:{{ item.id }}</text>
+              <text class="order-id">订单号:{{ item.customerName }}</text>
               <view :class="['status-badge', getStatusClass(item.status)]">
                 {{ getStatusText(item.status) }}
               </view>
@@ -114,6 +132,8 @@ export default {
       moveIndex: -1,
       startDate: '',
       endDate: '',
+      customerName: '',
+      quantity: '',
       orderList: [],
       pageNum: 1,
       pageSize: 10,
@@ -126,6 +146,9 @@ export default {
   created() {
     this.fetchOrderList()
   },
+  onShow() {
+    this.handleSearch()
+  },
   methods: {
     handleMove(index) {
       console.info('index-----', index)
@@ -156,12 +179,10 @@ export default {
     },
     clearStartDate() {
       this.startDate = '';
-      // 如果需要触发change事件可以手动调用
       this.bindStartDateChange({detail: {value: ''}});
     },
     clearEndDate() {
       this.endDate = '';
-      // 如果需要触发change事件可以手动调用
       this.bindEndDateChange({detail: {value: ''}});
     },
     bindStartDateChange(e) {
@@ -188,6 +209,8 @@ export default {
       let params = {
         current: this.pageNum,
         size: this.pageSize,
+        customerName: this.customerName,
+        quantity: this.quantity,
         startDate: this.startDate,
         endDate: this.endDate
       }
@@ -252,8 +275,9 @@ export default {
   top: 0;
   z-index: 100;
   background: #fff;
-  padding: 15rpx 20rpx;
+  padding: 20rpx;
   border-bottom: 1rpx solid #f0f0f0;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
 }
 
 
@@ -425,4 +449,44 @@ export default {
   border-radius: 12rpx; /* 与列表项圆角一致 */
   overflow: hidden; /* 防止按钮溢出 */
 }
+
+.input-group {
+  display: flex;
+  gap: 20rpx;
+  margin-bottom: 20rpx;
+}
+
+.input-item {
+  flex: 1;
+
+  .u--input {
+    background: #f8f8f8;
+    border-radius: 10rpx;
+    padding: 16rpx 20rpx;
+    font-size: 28rpx;
+    color: #333;
+    border: 1rpx solid #e0e0e0;
+    transition: all 0.3s ease;
+
+    &__content {
+      height: 80rpx;
+      line-height: 80rpx;
+    }
+
+    &__field-wrapper {
+      border: none;
+    }
+
+    &__placeholder {
+      color: #999;
+      font-size: 26rpx;
+    }
+
+    &:focus {
+      border-color: #2979ff;
+      box-shadow: 0 0 0 2rpx rgba(41, 121, 255, 0.2);
+      background: #fff;
+    }
+  }
+}
 </style>