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

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

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

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

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

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

@@ -124,6 +124,7 @@
124
                   placeholder="0" 
124
                   placeholder="0" 
125
                   min="0"
125
                   min="0"
126
                   @input="onPriceInput" 
126
                   @input="onPriceInput" 
127
+                  @blur="saveApprovedPrice"
127
                 />
128
                 />
128
               </view>
129
               </view>
129
             </view>
130
             </view>
@@ -324,10 +325,23 @@ export default {
324
     /**
325
     /**
325
      * 快速调整价格
326
      * 快速调整价格
326
      */
327
      */
327
-    quickChangePrice(amount) {
328
+    async quickChangePrice(amount) {
328
       let newPrice = this.approvedPrice + amount
329
       let newPrice = this.approvedPrice + amount
329
       newPrice = Math.max(0, newPrice)
330
       newPrice = Math.max(0, newPrice)
330
       this.approvedPrice = newPrice
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
     <OrderDetailView :order-detail="orderDetail" :top-info="topInfo" :order-id="orderId"
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
     <u-modal :show="addOneModalVisible" title="加一单" showCancelButton @cancel="handleAddOneCancel"
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
     async handleReceiptClick(item) {
196
     async handleReceiptClick(item) {