Pārlūkot izejas kodu

订单详情数据转换

kk.shi 3 gadi atpakaļ
vecāks
revīzija
8d008120fc

+ 2 - 3
pages/welfareMall/order/orderCompletion.js

@@ -52,13 +52,12 @@ Page({
         console.log("订单详情数据为空");
         return
     }
-
-    this.data.orderDetail = this.data.orderDetail.concat(...data)
+    //对象转换
+    this.data.orderDetail = data
     this.setData({
         mobileTop:getMobileCache(),
         orderDetail: this.data.orderDetail
     })
-    console.log(orderDetail);
   }, 
 
   /**

+ 7 - 7
pages/welfareMall/order/orderCompletion.wxml

@@ -12,12 +12,12 @@
         </view>
         <view class="content-middle flex-row">
           <view class="middle-it flex-row">
-            <image class="middle-img" src="/images/welfareMall/middle_img.png" />
-            <view class="middle-text">圣诞优惠券包</view>
+            <image class="middle-img" src="{{orderDetail.goodsList[0].fullCoverImg}}" />
+            <view class="middle-text">{{orderDetail.goodsList[0].activityName}}</view>
           </view>
           <view class="middle-num flex-column">
-            <view class="middle-num-money">¥0.0</view>
-            <view class="money-num-count">x1</view>
+            <view class="middle-num-money">¥{{orderDetail.payPriceFormatter}}</view>
+            <view class="money-num-count">x{{orderDetail.goodsList.length}}</view>
           </view>
         </view>
       </view>
@@ -27,17 +27,17 @@
       </view>
       <view class="content-line"></view>
       <view class="content-lower flex-row" catchtap="getCompletion">
-        <view class="lower-total">共1件商品 合计¥9.9</view>
+        <view class="lower-total">共{{orderDetail.goodsList.length}}件商品 合计¥{{orderDetail.payPriceFormatter}}</view>
       </view>
     </view>
     <view class="order-information flex-column">
       <view class="order-information-code flex-row">
         <view class="code-text">订单编号</view>
-        <view class="code-num">123455678897978779799</view>
+        <view class="code-num">{{orderDetail.orderSn}}</view>
       </view>
       <view class="order-information-date flex-row">
         <view class="date-text">交易时间</view>
-        <view class="date-time">2021-11-24 14:20:38</view>
+        <view class="date-time">{{orderDetail.payedAt}}</view>
       </view>
     </view>
     <view class="order-rt flex-row">