Ver Fonte

修改显示

lex-xin há 2 meses atrás
pai
commit
f0cafc0594

+ 3 - 2
miniprogram/api/login.ts

@@ -87,10 +87,11 @@ export const api_studentOrderPage = (params: any) => {
 
 
 /** 订单详情 */
-export const api_userPaymentOrderDetail = (orderNo: string) => {
+export const api_userPaymentOrderDetail = (orderNo: string, params?: any) => {
   return request({
     url: `/edu-app/userPaymentOrder/detail/${orderNo}`,
-    method: "get"
+    method: "get",
+    data: params
   } as any);
 };
 

+ 19 - 21
miniprogram/pages/index/index.less

@@ -209,6 +209,7 @@ page {
 
     .priceZ {
       font-size: 60rpx;
+      line-height: 1;
     }
 
     .priceF {
@@ -219,6 +220,7 @@ page {
       padding-left: 4rpx;
       font-size: 28rpx;
       line-height: 48rpx;
+      vertical-align: bottom;
     }
   }
 
@@ -267,6 +269,7 @@ page {
     padding: 0 !important;
     margin: 0 !important;
     width: 100%;
+    pointer-events: all;
   }
 }
 
@@ -418,26 +421,14 @@ page {
   }
 }
 
-
+// .van-overlay, .van-transition {
+//   // pointer-events: all !important;
+// }
 // 'demo-text-1', 'demo-text-2', 'demo-text-3'
 .popup-section {
-  // max-height: 86vh;
-  // overflow-x: hidden;
-  // overflow-y: auto;
-
-  // &.hidden {
-  //   display: none;
-  // }
-
-  // .popup-mask {
-  //   position: fixed;
-  //   top: 0;
-  //   left: 0;
-  //   right: 0;
-  //   bottom: 0;
-  //   background-color: rgba(0, 0, 0, 0.6);
-  //   z-index: 9;
-  // }
+  max-height: 86vh;
+  display: flex;
+  flex-direction: column;
 
   .popup-container {
     // position: fixed;
@@ -450,9 +441,8 @@ page {
     border-radius: 32rpx 32rpx 0rpx 0rpx;
     // padding: 40rpx 0 0;
     box-sizing: border-box;
+    // flex: 1;
     max-height: 86vh;
-    display: flex;
-    flex-direction: column;
 
     .popup-scroll {
       overflow-x: hidden;
@@ -518,6 +508,7 @@ page {
     position: absolute;
     right: 0;
     top: 0;
+    z-index: 1;
     padding: 24rpx;
     width: 44rpx;
     height: 44rpx;
@@ -594,6 +585,8 @@ page {
     }
   }
 
+
+
   button {
     width: 100%;
     line-height: 88rpx;
@@ -607,8 +600,11 @@ page {
   }
 }
 
-
 .popupBottom {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
   background: #ffffff;
   border-top: 2rpx solid #F0F0F0;
   padding: 0 32rpx 58rpx;
@@ -879,9 +875,11 @@ toolbar-confirm {
   color: #000000 !important;
   line-height: 44rpx !important;
 }
+
 .one-gender {
   margin-top: 24rpx !important;
 }
+
 .two-gender {
   margin-bottom: 24rpx !important;
 }

+ 22 - 5
miniprogram/pages/index/index.ts

@@ -58,7 +58,7 @@ Page({
     ],
     firstCurrent: 0,
     imgList: [
-      'https://oss.dayaedu.com/ktyq/1732610921517.png',
+      'https://oss.dayaedu.com/ktyq/1739429062237.png',
       'https://oss.dayaedu.com/ktyq/1732610940095.png',
       'https://oss.dayaedu.com/ktyq/1732610952376.png',
       'https://oss.dayaedu.com/ktyq/1732610965625.png',
@@ -151,6 +151,7 @@ Page({
     showClass: false,
     showClassAfterLeave: false, // 离开后
     buyerLoading: false,
+    currentIndex: 1,
   },
 
   /**
@@ -240,6 +241,11 @@ Page({
     }
     return num + (template[type] || '')
   },
+  /** 切换swiper */
+  onSwiperChange(e: any) {
+    console.log(e, 'e')
+    return false
+  },
   // 选择
   onSelectGoods(e: any) {
     const { dataset } = e.currentTarget
@@ -394,7 +400,7 @@ Page({
     const that = this
     if (!this.data.userBeneficiaryId) {
       wx.showToast({
-        title: '请填写享用者信息',
+        title: '请填写享用者的个人信息',
         icon: 'none'
       })
       return
@@ -997,14 +1003,25 @@ Page({
       showClass: false
     })
   },
-
+  messageName(value: string) {
+    const nameReg = /^[\u4E00-\u9FA5]+$/
+    if (!value) {
+      return '请填写享用者姓名';
+    } else if (!nameReg.test(value)) {
+      return '享用者姓名必须为中文';
+    } else if (value.length < 2 || value.length > 14) {
+      return '享用者姓名必须为2~14个字';
+    } else {
+      return ''
+    }
+  },
   /** 最终提交 */
   async onSubmitBuyer() {
     try {
       const params = this.data
-      if (!params.name) {
+      if (this.messageName(params.name)) {
         wx.showToast({
-          title: '请填写享用者姓名',
+          title: this.messageName(params.name),
           icon: "none"
         })
         return

+ 10 - 6
miniprogram/pages/index/index.wxml

@@ -90,11 +90,12 @@
 
 
           <van-popup show="{{ popupShow }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onClose" position="bottom" round z-index="101">
-            <view class="popup-section" >
-            <!-- wx:if="{{popupShow}}" -->
+            <view class="popup-section">
+              <image bind:tap="onClose" src="./images/icon-close-1.png" class="iconClose"></image>
+              <!-- wx:if="{{popupShow}}" -->
               <!-- <view class="popup-mask" bind:tap="onClose"></view> -->
-              <view class="popup-container">
-                <image bind:tap="onClose" src="./images/icon-close-1.png" class="iconClose"></image>
+              <scroll-view class="popup-container" bounces="false" scroll-y="true" type="list">
+                
                 <view class="popup-scroll">
                   <image src="https://oss.dayaedu.com/ktyq/1739242193106.png" mode="widthFix" class="top-vip-img"></image>
                   <!-- 添加权益人 -->
@@ -135,6 +136,7 @@
                     </view>
                   </view>
                 </view>
+                <view style="padding-bottom: 300rpx;"></view>
                 <view class="popupBottom">
                   <!-- 有选择商品的时候 -->
                   <view class="current-item" wx:if="{{!isOverSaled && selected.id}}">
@@ -157,7 +159,10 @@
                     <button type="primary" catch:tap="onSubmit">立即享受专属权益</button>
                   </view>
                 </view>
-              </view>
+              </scroll-view>
+              <!-- <view class="popup-container">
+                
+              </view> -->
             </view>
           </van-popup>
         </view>
@@ -239,5 +244,4 @@
 
     </view>
   </swiper-item>
-
 </swiper>

BIN
miniprogram/pages/orders/images/icon-down.png


+ 50 - 5
miniprogram/pages/orders/order-detail.less

@@ -6,12 +6,22 @@ page {
   background: #F5F6F7;
 }
 
+.container {
+  display: flex;
+  flex-direction: column;
+}
+
 .record-list {
   flex: 1;
   overflow-y: scroll;
   box-sizing: border-box;
 }
 
+.scroll-container {
+  padding-bottom: 186rpx;
+  overflow: hidden;
+}
+
 .order-status {
   margin: 24rpx 26rpx 0;
   background-color: #FFFFFF;
@@ -334,14 +344,20 @@ page {
 .order-time {
   margin: 24rpx 26rpx 0;
   border-radius: 20rpx;
-  padding: 36rpx 24rpx;
+  padding: 28rpx 24rpx;
   background-color: #FFFFFF;
 
+  .line {
+    width: 100%;
+    height: 2rpx;
+    background: #F2F2F2;
+    margin-bottom: 28rpx;
+  }
+
   .order-item {
     display: flex;
     justify-content: space-between;
-    padding-bottom: 36rpx;
-
+    padding-bottom: 28rpx;
     &:last-child {
       padding-bottom: 0;
     }
@@ -350,12 +366,41 @@ page {
       font-size: 28rpx;
       color: #131415;
       line-height: 40rpx;
+      flex-shrink: 0;
+      padding-right: 46rpx;
     }
-
     .value {
       font-size: 28rpx;
       color: #777777;
-      line-height: 40rpx;
+      line-height: 42rpx;
+      display: flex;
+      align-items: center;
+      text-align: right;
+      &.red {
+        color: #FE2451;
+      }
+
+      &.expanded {
+        .iconDown {
+          transform: rotate(0deg);
+        }
+      }
+
+      .iconDown {
+        margin-left: 8rpx;
+        width: 24rpx;
+        height: 24rpx;
+        transform: rotate(180deg);
+      }
+
+      .copy {
+        font-size: 28rpx;
+        color: #FE2451;
+        line-height: 42rpx;
+        display: flex;
+        align-items: center;
+        padding-left: 16rpx;
+      }
     }
   }
 }

+ 76 - 51
miniprogram/pages/orders/order-detail.ts

@@ -1,7 +1,7 @@
 // pages/orders/order-detail.ts
-import { api_executeOrder, api_executePayment, api_queryByParamName, api_userPaymentOrderUnpaid } from "../../api/login";
+import { api_executeOrder, api_executePayment, api_queryByParamName, api_userPaymentOrderDetail, api_userPaymentOrderUnpaid } from "../../api/login";
 import { api_sysAreaQueryAllProvince, api_userReceiveAddressPage, api_userReceiveAddressSave } from "../../api/new";
-import { formatPrice } from "../../utils/util";
+import { formatPrice, GRADE_ENUM } from "../../utils/util";
 
 // 获取应用实例
 const app = getApp<IAppOption>()
@@ -10,9 +10,9 @@ Page({
    * 页面的初始数据
    */
   data: {
-    status: 'ing',
+    status: 'WAIT_PAY',
     statusList: {
-      ing: {
+      WAIT_PAY: {
         logo: './images/ing.png',
         title: '等待付款',
         content: '请尽快完成支付,以便我们为您处理订单'
@@ -29,6 +29,12 @@ Page({
       phoneNumber: ''
     },
     userBeneficiaryId: '', // 添加购买人信息
+    userBeneficiaryInfo: {
+      name: '',
+      phoneNumber: '',
+      schoolInfo: ''
+    },
+    isExpanded: false,
     paymentType: null as any, // 支付类型
     paymentChannel: null as any,
     showService: false,
@@ -72,7 +78,8 @@ Page({
         name: '',
         shopId: '',
         orderNo: options.orderNo || '',
-        goodsList: [] as any
+        goodsList: [] as any,
+        createTime: '', // 订单时间
       }
       // 是否有乐器
       let hasInstrument = false
@@ -98,7 +105,6 @@ Page({
       }
 
       const allAfterPrice: any = formatPrice(infos.allSalePrice)
-      // console.log(infos.allOriginPrice, infos.allSalePrice)
       infos.allDiscountPrice = formatPrice(infos.allOriginPrice - infos.allSalePrice, 'ALL') as string
       const allDiscount: any = formatPrice(infos.allOriginPrice - infos.allSalePrice)
       infos.integerPart = allAfterPrice.integerPart
@@ -111,9 +117,44 @@ Page({
         userBeneficiaryId: options.userBeneficiaryId,
         status: options.status || '',
         hasInstrument
+      }, () => {
+        this.getOrderDetail()
       });
     }
   },
+  /** 获取订单详情 */
+  async getOrderDetail() {
+    try {
+      if (!this.data.goodsInfo.orderNo) return
+      const { data } = await api_userPaymentOrderDetail(this.data.goodsInfo.orderNo, {
+        version: 'V2'
+      });
+
+      const result = data.data || {}
+      const addresses: any = result.addresses
+      const beneficiary: any = result.beneficiary
+      const tempSchoolAddress = [beneficiary?.provinceName, beneficiary?.cityName, beneficiary?.regionName, beneficiary?.schoolAreaName, GRADE_ENUM[beneficiary?.currentGradeNum], beneficiary?.currentClass + '班']
+      this.setData({
+        receiveAddress: addresses?.id,
+        receiveAddressInfo: {
+          addressDetail: addresses?.detailAddress,
+          name: addresses?.name,
+          phoneNumber: addresses?.phoneNumber
+        },
+        userBeneficiaryId: beneficiary.schoolAreaId, // 添加购买人信息
+        userBeneficiaryInfo: {
+          name: beneficiary.name,
+          phoneNumber: beneficiary.phone,
+          schoolInfo: tempSchoolAddress.join('')
+        },
+        'goodsInfo.createTime': result.createTime
+      }, () => {
+        console.log(this.data)
+      })
+    } catch {
+      // 
+    }
+  },
   // 格式化类型
   formatPeriod(num: number, type: string) {
     if (!type) return ''
@@ -201,17 +242,17 @@ Page({
         }
       } else {
         const { data } = await api_executeOrder({
-          "orderType": "WECHAT_MINI",
-          "paymentType": this.data.paymentType,
-          "paymentCashAmount": allSalePrice,
-          "paymentCouponAmount": 0,
-          "shopId": shopId,
-          "openId": app.globalData.userInfo?.liteOpenid,
-          "goodsInfos": goodsInfos,
+          orderType: "WECHAT_MINI",
+          paymentType: this.data.paymentType,
+          paymentCashAmount: allSalePrice,
+          paymentCouponAmount: 0,
+          shopId: shopId,
+          openId: app.globalData.userInfo?.liteOpenid,
+          goodsInfos: goodsInfos,
           receiveAddress: this.data.receiveAddress,
           userBeneficiaryId: this.data.userBeneficiaryId,
-          "orderName": name,
-          "orderDesc": name
+          orderName: name,
+          orderDesc: name
         })
         if (data.code === 200) {
           const { paymentConfig, paymentType, orderNo } = data.data
@@ -296,10 +337,10 @@ Page({
       fail(ressonInfo) {
         console.log('支付失败', ressonInfo)
         that.onPayError()
-        const goodsInfo = that.data.goodsInfo
-        goodsInfo.orderNo = orderNo
         that.setData({
-          goodsInfo
+          'goodsInfo.orderNo': orderNo
+        }, () => {
+          that.getOrderDetail()
         })
       }
     })
@@ -327,7 +368,7 @@ Page({
    */
   onShow() {
     if (this.data.backParams) {
-      console.log(this.data.backParams, 'backParams'); // { key: 'value' }
+      // console.log(this.data.backParams, 'backParams'); // { key: 'value' }
       const backParams: any = this.data.backParams || {};
       this.setData({
         receiveAddress: backParams.receiveAddress,
@@ -337,35 +378,6 @@ Page({
     }
     this.getAddress()
   },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
   /** 地址列表 */
   async getAddress() {
     try {
@@ -417,8 +429,6 @@ Page({
           name: firstValue
         })
       }
-      console.log(areaList,
-        currentValues)
       this.setData({
         areaList,
         currentValues
@@ -563,7 +573,22 @@ Page({
       console.log(e, '1212')
     }
   },
-
+  onExpanded() {
+    this.setData({
+      isExpanded: !this.data.isExpanded
+    })
+  },
+  onCopy(e: { currentTarget: any }) {
+    wx.setClipboardData({
+      data: e.currentTarget.dataset.orderno,
+      success: () => {
+        wx.showToast({title: '复制成功', icon: 'none'})
+      },
+      fail: () => {
+        wx.showToast({title: '复制失败,请稍后再试', icon: 'none'})
+      }
+    })
+  },
   /**
    * 用户点击右上角分享
    */

+ 169 - 96
miniprogram/pages/orders/order-detail.wxml

@@ -1,132 +1,157 @@
 <!--pages/orders/order-detail.wxml-->
 <view class="container">
-  <navigation-bar title="核对订单"></navigation-bar>
+  <navigation-bar title="{{ goodsInfo.orderNo ? '订单详情' : '核对订单' }}"></navigation-bar>
 
   <scroll-view class="record-list" type="list" scroll-y>
-    <!-- <view class="order-status">
-      <view class="status">
-        <image src="{{ statusList[status].logo }}"></image>
-        <text>{{ statusList[status].title }}</text>
+    <view class="scroll-container">
+      <view class="order-status" wx:if="{{statusList[status]}}">
+        <view class="status">
+          <image src="{{ statusList[status].logo }}"></image>
+          <text>{{ statusList[status].title }}</text>
+        </view>
+        <view class="tips">{{ statusList[status].content }}</view>
       </view>
-      <view class="tips">{{ statusList[status].content }}</view>
-    </view> -->
-
-    <!-- 添加权益人 -->
-    <view class="addBuyer" bind:tap="onSelectAddress" wx:if="{{ hasInstrument }}">
-      <image src="./images/address-top.png" mode="widthFix" class="addressTop"></image>
-      <view class="addBuyer-left">
-        <image src="./images/icon-address.png" class="icon-man"></image>
-        <view class="info" wx:if="{{ receiveAddress }}">
-          <view class="users">
-            {{ receiveAddressInfo.addressDetail }}
-          </view>
-          <view class="address">
-            <text>{{ receiveAddressInfo.name }}</text>
-            <text>{{ receiveAddressInfo.phoneNumber }}</text>
+
+      <!-- 添加地址 -->
+      <view wx:if="{{ hasInstrument && !goodsInfo.orderNo }}" class="addBuyer" bind:tap="onSelectAddress">
+        <image src="./images/address-top.png" mode="widthFix" class="addressTop"></image>
+        <view class="addBuyer-left">
+          <image src="./images/icon-address.png" class="icon-man"></image>
+          <view class="info" wx:if="{{ receiveAddress }}">
+            <view class="users">
+              {{ receiveAddressInfo.addressDetail }}
+            </view>
+            <view class="address">
+              <text>{{ receiveAddressInfo.name }}</text>
+              <text>{{ receiveAddressInfo.phoneNumber }}</text>
+            </view>
           </view>
-        </view>
-        <view class="info" wx:else>
-          <view class="users">
-            新建收货地址
+          <view class="info" wx:else>
+            <view class="users">
+              新建收货地址
+            </view>
+            <view class="address">请填写您的收货地址与信息</view>
           </view>
-          <view class="address">请填写您的收货地址与信息</view>
         </view>
+        <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
       </view>
-      <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
-    </view>
 
-    <view class="order-content">
-      <view class="item-content" wx:for="{{ goodsInfo.goodsList }}" wx:key="index">
-        <image class='goods-icon' src="{{ item.pic }}" mode="" />
-        <view class="goods-desc">
-          <view class="goodsInfo">
-            <view class="goods-name">{{ item.name }}</view>
-            <view class="goods-current-price">¥<text>{{ item.integerPart }}.{{ item.decimalPart }}</text></view>
-          </view>
-          <view class="goods-type">
-            <view>
-              <text class="goods-card" wx:if="{{ item.typePeriod }}">{{ item.typePeriod }}</text>
+      <view class="order-content">
+        <view class="item-content" wx:for="{{ goodsInfo.goodsList }}" wx:key="index">
+          <image class='goods-icon' src="{{ item.pic }}" mode="" />
+          <view class="goods-desc">
+            <view class="goodsInfo">
+              <view class="goods-name">{{ item.name }}</view>
+              <view class="goods-current-price">¥<text>{{ item.integerPart }}.{{ item.decimalPart }}</text></view>
+            </view>
+            <view class="goods-type">
+              <view>
+                <text class="goods-card" wx:if="{{ item.typePeriod }}">{{ item.typePeriod }}</text>
+              </view>
+              <view class="goods-num">x 1</view>
             </view>
-            <view class="goods-num">x 1</view>
           </view>
         </view>
-      </view>
 
-      <view class="goodsInfos">
-        <view class="goodsInfo-item">
-          <text class="title">商品总额</text>
+        <view class="goodsInfos">
+          <view class="goodsInfo-item">
+            <text class="title">商品总额</text>
 
-          <view class="goods-price">
-            <text class="stuff">¥</text>
-            <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-            <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+            <view class="goods-price">
+              <text class="stuff">¥</text>
+              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
+              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+            </view>
           </view>
-        </view>
 
-        <view class="goodsInfo-item" wx:if="{{ goodsInfo.allOriginPrice > goodsInfo.allSalePrice }}">
-          <text class="title">惊喜优惠</text>
+          <view class="goodsInfo-item" wx:if="{{ goodsInfo.allOriginPrice > goodsInfo.allSalePrice }}">
+            <text class="title">惊喜优惠</text>
 
-          <!-- <view class="calc-price">-¥ {{ goodsInfo.allDiscountPrice }}</view> -->
-          <view class="goods-price calc-price">
-            <text class="stuff">¥</text>
-            <text class="priceZ">{{ goodsInfo.discountIntegerPart }}</text>
-            <text class="priceF">.{{ goodsInfo.discountDecimalPart }}</text>
+            <!-- <view class="calc-price">-¥ {{ goodsInfo.allDiscountPrice }}</view> -->
+            <view class="goods-price calc-price">
+              <text class="stuff">¥</text>
+              <text class="priceZ">{{ goodsInfo.discountIntegerPart }}</text>
+              <text class="priceF">.{{ goodsInfo.discountDecimalPart }}</text>
+            </view>
           </view>
-        </view>
 
-        <view class="qrcode-line"></view>
+          <view class="qrcode-line"></view>
 
-        <view class="goodsInfo-count">
-          <view class="goods-price">
-            <text class="before">共{{ goodsInfo.goodsList.length }}件:</text>
-            <text class="stuff">¥</text>
-            <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-            <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+          <view class="goodsInfo-count">
+            <view class="goods-price">
+              <text class="before">共{{ goodsInfo.goodsList.length }}件:</text>
+              <text class="stuff">¥</text>
+              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
+              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+            </view>
           </view>
         </view>
       </view>
-    </view>
 
-    <view class="wechat-section">
-      <view class="wechat-left">
-        <image src="./images/icon-wechat.png"></image>
-        微信支付
+      <view class="wechat-section" wx:if="{{ !goodsInfo.orderNo }}">
+        <view class="wechat-left">
+          <image src="./images/icon-wechat.png"></image>
+          微信支付
+        </view>
+
+        <image src="./images/icon-checkbox.png" class="checkbox"></image>
       </view>
 
-      <image src="./images/icon-checkbox.png" class="checkbox"></image>
-    </view>
 
-    <!-- <view class="order-time">
-      <view class="order-item">
-        <view class="title">订单号</view>
-        <view class="value">2133442226668</view>
-      </view>
-      <view class="order-item">
-        <view class="title">下单时间</view>
-        <view class="value">2023-07-12 18:12:45</view>
+      <view class="order-time" wx:if="{{ goodsInfo.orderNo }}">
+        <block wx:if="{{ receiveAddress }}">
+          <template is="address" data="{{ receiveAddressInfo }}"></template>
+          <view class="line"></view>
+          <block wx:if="{{ isExpanded }}">
+            <block wx:if="{{ userBeneficiaryId }}">
+              <template is="schoolInfo" data="{{ userBeneficiaryInfo }}"></template>
+              <view class="line" wx:if="{{ !receiveAddress }}"></view>
+            </block>
+            <template is="orderInfo" data="{{ goodsInfo }}"></template>
+          </block>
+        </block>
+        <block wx:else>
+          <block wx:if="{{ userBeneficiaryId }}">
+            <template is="schoolInfo" data="{{ userBeneficiaryInfo }}"></template>
+            <view class="line" wx:if="{{ !receiveAddress }}"></view>
+          </block>
+          <block wx:if="{{ isExpanded || !userBeneficiaryId }}">
+            <template is="orderInfo" data="{{ goodsInfo }}"></template>
+          </block>
+        </block>
+
+        <view class="order-item" bind:tap="onExpanded" wx:if="{{ userBeneficiaryId }}">
+          <view class="title">更多信息</view>
+          <view class="value {{ isExpanded ? 'expanded' : '' }}">
+            {{ isExpanded ? '收起' : '展开' }}
+            <image src="./images/icon-down.png" class="iconDown"></image>
+          </view>
+        </view>
       </view>
-    </view> -->
-  </scroll-view>
+    </view>
 
-  <view class="order-btn">
-    <view class="more">
-      <view class="price-section">
-        <view class="price">
-          <view class="desc">共计</view>
-          <view class="currentPrice">
-            <text class="stuff">¥</text>
-            <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-            <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
-          </view>
 
-          <text class="line"></text>
+    <view class="order-btn">
+      <view class="more">
+        <view class="price-section">
+          <view class="price">
+            <view class="desc">共计</view>
+            <view class="currentPrice">
+              <text class="stuff">¥</text>
+              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
+              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+            </view>
+
+            <text class="line"></text>
 
-          <text class="discountPrice">优惠 ¥{{ goodsInfo.allDiscountPrice }}</text>
+            <text class="discountPrice">优惠 ¥{{ goodsInfo.allDiscountPrice }}</text>
+          </view>
         </view>
+        <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '提交' }}</button>
       </view>
-      <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '提交' }}</button>
     </view>
-  </view>
+  </scroll-view>
+
 
 
   <van-popup show="{{ addressShow }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseAddress" position="bottom" round z-index="101" bind:after-leave="onAddressAfterLeave">
@@ -140,7 +165,7 @@
         <van-field model:value="{{ name }}" label="收货人" placeholder="请填写收货人姓名" placeholder-style="color: #bbb" />
         <van-field model:value="{{ phoneNumber }}" label="电话号码" type="number" placeholder-style="color: #bbb" placeholder="请输入手机号码" maxlength="11" />
         <van-field value="{{ provinceName ? provinceName + '/' + cityName + '/' + regionName : '' }}" label="选择地区" placeholder-style="color: #bbb" placeholder="请选择省/市/区" readonly is-link bind:tap="onShowAreaList" />
-        <van-field model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize />
+        <van-field model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize maxlength="100" />
       </van-cell-group>
 
       <view class="pop-btn-group">
@@ -154,4 +179,52 @@
     <van-area id='area1' areaList="{{areaList}}" visible-item-count="9" item-height="46" value="{{ regionCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
   </van-popup>
   <!-- <service popShow="{{ showService }}" bind:changePop="changePop"></service> -->
-</view>
+</view>
+
+
+<template name="address">
+  <view class="order-item">
+    <view class="title">收货人</view>
+    <view class="value">{{ receiveAddressInfo.name }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">电话号码</view>
+    <view class="value">{{ receiveAddressInfo.phoneNumber }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">收货地址</view>
+    <view class="value">{{ receiveAddressInfo.addressDetail }}</view>
+  </view>
+</template>
+
+<template name="schoolInfo">
+  <view class="order-item">
+    <view class="title">享用者姓名</view>
+    <view class="value">{{ userBeneficiaryInfo.name }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">电话号码</view>
+    <view class="value">{{ userBeneficiaryInfo.phoneNumber }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">学校信息</view>
+    <view class="value">{{ userBeneficiaryInfo.schoolInfo }}</view>
+  </view>
+
+  <!-- name: beneficiary.name,
+      phoneNumber: beneficiary.phone,
+      schoolInfo: tempSchoolAddress.join('') -->
+</template>
+
+<template name="orderInfo">
+  <view class="order-item">
+    <view class="title">订单编号</view>
+    <view class="value">{{ goodsInfo.orderNo }}
+      <view class="copy" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
+    </view>
+  </view>
+  <view class="order-item">
+    <view class="title">创建时间</view>
+    <view class="value">{{ goodsInfo.createTime }}</view>
+  </view>
+</template>

+ 27 - 3
miniprogram/pages/orders/order-result.less

@@ -20,7 +20,8 @@ page {
 }
 
 .scroll-container {
-  padding-bottom: 180rpx;
+  padding-bottom: 46rpx;
+  overflow: hidden;
 }
 
 .order-status {
@@ -343,29 +344,52 @@ page {
   padding: 28rpx 24rpx;
   background-color: #FFFFFF;
 
+  .line {
+    width: 100%;
+    height: 2rpx;
+    background: #F2F2F2;
+    margin-bottom: 28rpx;
+  }
+
   .order-item {
     display: flex;
     justify-content: space-between;
-    padding-bottom: 36rpx;
+    padding-bottom: 28rpx;
     &:last-child {
       padding-bottom: 0;
     }
+
     .title {
       font-size: 28rpx;
       color: #131415;
       line-height: 40rpx;
       flex-shrink: 0;
-      padding-right: 26rpx;
+      padding-right: 46rpx;
     }
     .value {
       font-size: 28rpx;
       color: #777777;
       line-height: 42rpx;
       display: flex;
+      align-items: center;
+      text-align: right;
       &.red {
         color: #FE2451;
       }
 
+      &.expanded {
+        .iconDown {
+          transform: rotate(0deg);
+        }
+      }
+
+      .iconDown {
+        margin-left: 8rpx;
+        width: 24rpx;
+        height: 24rpx;
+        transform: rotate(180deg);
+      }
+
       .copy {
         font-size: 28rpx;
         color: #FE2451;

+ 10 - 2
miniprogram/pages/orders/order-result.ts

@@ -45,6 +45,7 @@ Page({
     timer: null as any,
     goodsInfo: {} as any,
     orderNo: "" as string,
+    isExpanded: false // 是否展开
   },
 
   /**
@@ -64,7 +65,9 @@ Page({
   },
   async getDetail(callback?: any) {
     try {
-      const { data } = await api_userPaymentOrderDetail(this.data.orderNo);
+      const { data } = await api_userPaymentOrderDetail(this.data.orderNo, {
+        version: 'V2'
+      });
       if (data.code == 200) {
         const result = data.data || {}
         const goodsInfos = result.goodsInfos || []
@@ -72,7 +75,7 @@ Page({
         goodsInfos.forEach((item: any) => {
           tempGoods.push({
             ...item,
-            // originalPrice: formatPrice(item.originalPrice, 'ALL'),
+            originalPrice: formatPrice(item.originalPrice, 'ALL'),
             typeName: this.formatPeriod(item.activationCodeInfo?.times || 1, item.activationCodeInfo?.type)
           })
         })
@@ -141,6 +144,11 @@ Page({
       url: '../index/index'
     })
   },
+  onExpanded() {
+    this.setData({
+      isExpanded: !this.data.isExpanded
+    })
+  },
   onTimeout() {
     // 轮询10次查询订单状态
     // const goodsInfo = this.data.goodsInfo

+ 71 - 13
miniprogram/pages/orders/order-result.wxml

@@ -61,25 +61,83 @@
         </view>
       </view>
 
-      <!-- <canvas class='my_draw_canvas only_canvas' data-type="image" canvas-id='canvasCode' id="canvasCode"></canvas> -->
-
       <view class="order-time">
-        <view class="order-item">
-          <view class="title">订单编号</view>
-          <view class="value">{{ goodsInfo.orderNo }}
-            <view class="copy" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
+        <block wx:if="{{ goodsInfo.addresses.id }}">
+          <template is="address" data="{{ goodsInfo }}"></template>
+          <view class="line"></view>
+          <block wx:if="{{ isExpanded }}">
+            <block wx:if="{{ goodsInfo.beneficiary.id }}">
+              <template is="schoolInfo" data="{{ goodsInfo }}"></template>
+              <view class="line" wx:if="{{ !goodsInfo.addresses.id }}"></view>
+            </block>
+            <template is="orderInfo" data="{{ goodsInfo }}"></template>
+          </block>
+        </block>
+        <block wx:else>
+          <block wx:if="{{ goodsInfo.beneficiary.id }}">
+            <template is="schoolInfo" data="{{ goodsInfo }}"></template>
+            <view class="line" wx:if="{{ !goodsInfo.addresses.id }}"></view>
+          </block>
+          <block wx:if="{{ isExpanded || !goodsInfo.beneficiary.id }}">
+            <template is="orderInfo" data="{{ goodsInfo }}"></template>
+          </block>
+        </block>
+
+        <view class="order-item" bind:tap="onExpanded" wx:if="{{ goodsInfo.beneficiary.id }}">
+          <view class="title">更多信息</view>
+          <view class="value {{ isExpanded ? 'expanded' : '' }}">
+            {{ isExpanded ? '收起' : '展开' }}
+            <image src="./images/icon-down.png" class="iconDown"></image>
           </view>
         </view>
-        <view class="order-item">
-          <view class="title">下单时间</view>
-          <view class="value">{{ goodsInfo.createTime }}</view>
-        </view>
       </view>
-
     </view>
   </scroll-view>
 
-  <view class="order-btn" wx:if="{{ goodsInfo.wechatStatus != 'WAIT_PAY' }}">
+  <!-- <view class="order-btn" wx:if="{{ goodsInfo.wechatStatus != 'WAIT_PAY' }}">
     <button type="primary" bind:tap="onSubmit">再来一单</button>
+  </view> -->
+</view>
+
+<template name="address">
+  <view class="order-item">
+    <view class="title">收货人</view>
+    <view class="value">{{ goodsInfo.addresses.name }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">电话号码</view>
+    <view class="value">{{ goodsInfo.addresses.phoneNumber }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">收货地址</view>
+    <view class="value">{{ goodsInfo.addresses.addressDetail }}</view>
+  </view>
+</template>
+
+<template name="schoolInfo">
+  <view class="order-item">
+    <view class="title">享用者姓名</view>
+    <view class="value">{{ goodsInfo.beneficiary.name }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">电话号码</view>
+    <view class="value">{{ goodsInfo.beneficiary.phoneNumber }}</view>
+  </view>
+  <view class="order-item">
+    <view class="title">学校信息</view>
+    <view class="value">{{ goodsInfo.beneficiary.schoolInfo }}</view>
+  </view>
+</template>
+
+<template name="orderInfo">
+  <view class="order-item">
+    <view class="title">订单编号</view>
+    <view class="value">{{ goodsInfo.orderNo }}
+      <view class="copy" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
+    </view>
+  </view>
+  <view class="order-item">
+    <view class="title">创建时间</view>
+    <view class="value">{{ goodsInfo.createTime }}</view>
   </view>
-</view>
+</template>

+ 40 - 80
miniprogram/pages/orders/orders.ts

@@ -1,4 +1,4 @@
-import { api_executePayment, api_queryByParamName, api_studentOrderPage, api_userPaymentCancelRefund, api_userPaymentOrderUnpaid } from "../../api/login";
+import { api_executePayment, api_queryByParamName, api_studentOrderPage, api_userPaymentOrderUnpaid } from "../../api/login";
 import { formatPrice } from "../../utils/util";
 // 获取应用实例
 const app = getApp<IAppOption>()
@@ -204,13 +204,35 @@ Page({
   },
   onDetail(e: any) {
     const { dataset } = e.currentTarget
-    // if (dataset.wechatstatus === "WAIT_PAY") {
-    //   this.onSubmit({ orderNo: dataset.orderno })
-    // } else {
+    if (dataset.wechatstatus === "WAIT_PAY") {
+      const orderDetail: any = this.data.recordList.find((item: any) => item.orderNo === dataset.orderno)
+      if (!orderDetail) return
+
+      const details = orderDetail.studentPaymentOrderDetails || []
+
+      const params = [] as any
+      details.forEach((item: any) => {
+        params.push({
+          pic: item.goodsUrl,
+          name: item.goodsName,
+          originalPrice: item.originalPrice,
+          salePrice: item.paymentCashAmount,
+          goodsType: item.goodsType, // INSTRUMENTS
+        })
+      })
+
+      let info = JSON.stringify({
+        ...params
+      });
+      info = encodeURIComponent(info);
+      wx.navigateTo({
+        url: `../orders/order-detail?orderInfo=${info}&orderNo=${orderDetail.orderNo}&status=${orderDetail.wechatStatus}`,
+      });
+    } else {
       wx.navigateTo({
-        url: `../orders/order-result?orderNo=${dataset.orderno}&tabIdx=${this.data.tabIdx}`
+        url: `../orders/order-result?orderNo=${dataset.orderno}`
       })
-    // }
+    }
   },
   // 购买
   async onSubmit(goodsInfo: any) {
@@ -248,16 +270,25 @@ Page({
         wx.hideLoading()
         if (res.data.code === 200) {
           this.onPaying(paymentType, res.data.data.reqParams, orderNo)
-        }  else if ([5435, 5436, 5437, 5439, 5442, 5443, 5408, 5427, 5432].includes(res.data.code)) {
+        } else if ([5435, 5436, 5437, 5439, 5442, 5443, 5408, 5427, 5432].includes(res.data.code)) {
           wx.hideLoading()
           wx.showToast({
             title: res.data.message,
             icon: 'none'
           })
           setTimeout(() => {
-            this.getList()
+            this.setData(
+              {
+                page: 1,
+                maxPage: 1,
+                recordList: [],
+              },
+              () => {
+                this.getList();
+              }
+            );
           }, 1000);
-        }  else {
+        } else {
           this.onPayError(res.data.message)
         }
       },
@@ -281,7 +312,6 @@ Page({
       signType: prePayInfo.signType ? prePayInfo.signType : 'MD5',
       success() {
         wx.showToast({ title: '支付成功', icon: 'success' });
-        // that.onRefoundComfirm()
       },
       fail(ressonInfo) {
         console.log('支付失败', ressonInfo)
@@ -314,76 +344,6 @@ Page({
       icon: 'none'
     })
   },
-  async onRefounded(e: any) {
-    const { dataset } = e.currentTarget
-    const item: any = this.data.recordList.find((item: any) => item.id === dataset.id)
-    console.log(dataset, item, 'item')
-    if (!item) {
-      return
-    }
-
-    if (item.wechatStatus === "REFUNDING") {
-      this.setData({
-        cancelRefoundStatus: true
-      }, async () => {
-        try {
-          const refundOrderId = item.refundOrderId
-          const { data } = await api_userPaymentCancelRefund(refundOrderId)
-          wx.hideLoading()
-          if (data.code == 200) {
-            wx.showToast({ title: '取消退款成功', icon: 'none' })
-            this.onRefoundComfirm()
-          } else {
-            wx.showToast({ title: data.message, icon: 'none' })
-          }
-        } catch {
-        }
-      })
-
-    } else {
-      const { orderNo, studentPaymentOrderDetails } = item
-      const goodsInfo: any = {
-        orderNo,
-        goods: []
-      }
-      if (Array.isArray(studentPaymentOrderDetails)) {
-        studentPaymentOrderDetails.forEach((item: any) => {
-          goodsInfo.goods.push({
-            ...item,
-            id: item.userPaymentOrderDetailId,
-            currentPrice: item.paymentCashAmount
-          })
-        })
-      }
-      this.setData({
-        goodsInfo,
-        cancelRefoundStatus: true,
-        refoundStatus: true
-      })
-    }
-  },
-  changeRefoundStatus(e: { detail: any }) {
-    this.setData({
-      refoundStatus: e.detail,
-      cancelRefoundStatus: false,
-    })
-  },
-  onRefoundComfirm() {
-    const that = this
-    this.setData({
-      refoundStatus: false
-    })
-    setTimeout(() => {
-      that.setData({
-        page: 1,
-        maxPage: 1,
-        cancelRefoundStatus: false,
-        recordList: [],
-      }, () => {
-        this.getList()
-      })
-    }, 1500);
-  },
   onShareAppMessage() {
     return {
       title: '器乐数字AI工具',