Просмотр исходного кода

修改在page2界面更改完核准价之后更新顶部价格

Yannay 1 месяц назад
Родитель
Сommit
8691569847

+ 1 - 0
pages/orderDetailRefactored/components/OrderDetailView.vue

@@ -24,6 +24,7 @@
24 24
         :follow-up-list="followUpList"
25 25
         @next="handleNext"
26 26
         @update-file-ids="handleUpdateFileIds"
27
+        @price-updated="$emit('price-updated')"
27 28
       />
28 29
     </view>
29 30
     

+ 15 - 1
pages/orderDetailRefactored/components/PageTwo.vue

@@ -124,6 +124,7 @@
124 124
                   placeholder="0" 
125 125
                   min="0"
126 126
                   @input="onPriceInput" 
127
+                  @blur="saveApprovedPrice"
127 128
                 />
128 129
               </view>
129 130
             </view>
@@ -324,10 +325,23 @@ export default {
324 325
     /**
325 326
      * 快速调整价格
326 327
      */
327
-    quickChangePrice(amount) {
328
+    async quickChangePrice(amount) {
328 329
       let newPrice = this.approvedPrice + amount
329 330
       newPrice = Math.max(0, newPrice)
330 331
       this.approvedPrice = newPrice
332
+
333
+      await uni.$u.api.updateReceiptForm({
334
+        id: this.currentReceipt.id,
335
+        sellingPrice: newPrice
336
+      })
337
+      this.$emit('price-updated')
338
+    },
339
+    async saveApprovedPrice() {
340
+      await uni.$u.api.updateReceiptForm({
341
+        id: this.currentReceipt.id,
342
+        sellingPrice: this.approvedPrice
343
+      })
344
+      this.$emit('price-updated')
331 345
     },
332 346
 
333 347
     /**

+ 19 - 1
pages/orderDetailRefactored/index.vue

@@ -24,7 +24,7 @@
24 24
 
25 25
     <!-- 订单详情视图 -->
26 26
     <OrderDetailView :order-detail="orderDetail" :top-info="topInfo" :order-id="orderId"
27
-      :current-receipt="currentReceipt" />
27
+      :current-receipt="currentReceipt" @price-updated="refreshCurrentReceipt" />
28 28
 
29 29
     <!-- 加一单模态窗 -->
30 30
     <u-modal :show="addOneModalVisible" title="加一单" showCancelButton @cancel="handleAddOneCancel"
@@ -173,6 +173,24 @@ export default {
173 173
     },
174 174
 
175 175
     /**
176
+     * 刷新当前收单(用于价格等修改后同步顶部信息)
177
+     */
178
+    async refreshCurrentReceipt() {
179
+      if (!this.currentReceipt || !this.currentReceipt.id) return
180
+      try {
181
+        const res = await uni.$u.api.getReceiptForm(this.currentReceipt.id)
182
+        if (res.code === 200 && res.data) {
183
+          this.currentReceipt = res.data
184
+          this.topInfo.brand = res.data.brand || '暂无'
185
+          this.topInfo.model = res.data.model || '暂无'
186
+          this.topInfo.price = res.data.sellingPrice ?? '暂无'
187
+        }
188
+      } catch (error) {
189
+        console.error('刷新当前收单失败:', error)
190
+      }
191
+    },
192
+
193
+    /**
176 194
      * 点击收单项
177 195
      */
178 196
     async handleReceiptClick(item) {