lex-xin 2 ماه پیش
والد
کامیت
5b51215fe2

+ 2 - 1
miniprogram/app.json

@@ -7,7 +7,8 @@
     "pages/orders/order-detail",
     "pages/orders/order-result",
     "pages/protocol/register",
-    "pages/download/download"
+    "pages/download/download",
+    "pages/address/index"
   ],
   "window": {
     "navigationBarTextStyle": "black",

+ 3 - 0
miniprogram/pages/address/index.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 1 - 0
miniprogram/pages/address/index.less

@@ -0,0 +1 @@
+/* pages/address/index.wxss */

+ 66 - 0
miniprogram/pages/address/index.ts

@@ -0,0 +1,66 @@
+// pages/address/index.ts
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 2 - 0
miniprogram/pages/address/index.wxml

@@ -0,0 +1,2 @@
+<!--pages/address/index.wxml-->
+<text>pages/address/index.wxml</text>

+ 1 - 1
miniprogram/pages/index/index.ts

@@ -423,7 +423,7 @@ Page({
 
       console.log(params, "params")
       wx.navigateTo({
-        url: `../orders/order-detail?orderInfo=${info}`,
+        url: `../orders/order-detail?orderInfo=${info}&userBeneficiaryId=${that.data.userBeneficiaryId}`,
         success: () => {
           that.setData({
             popupShow: false

+ 2 - 2
miniprogram/pages/index/index.wxml

@@ -1,5 +1,5 @@
 <swiper indicator-dots="{{false}}" vertical="true" class="firstConainer">
-  <!-- <swiper-item>
+  <swiper-item>
     <view class="pageContainer firstPageContainer">
       <navigation-bar title="器乐数字AI工具" back="{{false}}"></navigation-bar>
       <swiper indicator-dots="{{false}}" class="fistSwiperSection" previous-margin="78rpx" next-margin="78rpx" bindchange="onFirstChange">
@@ -15,7 +15,7 @@
 
       <image src="./images/up-arrow.png" class="upArrow"></image>
     </view>
-  </swiper-item> -->
+  </swiper-item>
   <swiper-item>
     <view class="pageContainer">
       <!--index.wxml-->

BIN
miniprogram/pages/orders/images/address-top.png


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


BIN
miniprogram/pages/orders/images/icon-arrow-right.png


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


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


+ 251 - 29
miniprogram/pages/orders/order-detail.less

@@ -11,14 +11,17 @@ page {
   background-color: #FFFFFF;
   border-radius: 20rpx;
   padding: 24rpx 32rpx;
+
   .status {
     display: flex;
     padding-bottom: 24rpx;
+
     image {
       width: 48rpx;
       height: 48rpx;
       margin-right: 16rpx;
     }
+
     text {
       font-weight: 600;
       font-size: 36rpx;
@@ -26,6 +29,7 @@ page {
       line-height: 48rpx;
     }
   }
+
   .tips {
     font-size: 28rpx;
     color: #777777;
@@ -33,19 +37,83 @@ page {
   }
 }
 
+
+.addBuyer {
+  position: relative;
+  margin: 26rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 24rpx;
+  overflow: hidden;
+
+  .addressTop {
+    position: absolute;
+    z-index: 1;
+    top: 0;
+    left: 0;
+    width: 100%;
+  }
+
+  .icon-man {
+    width: 36rpx;
+    height: 36rpx;
+    margin-right: 16rpx;
+  }
+
+  .addBuyer-left {
+    display: flex;
+  }
+
+  .users {
+    font-weight: 600;
+    font-size: 32rpx;
+    color: #131415;
+    line-height: 40rpx;
+
+    width: 520rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+  }
+
+  .address {
+    padding-top: 16rpx;
+    font-size: 26rpx;
+    color: #777777;
+    line-height: 34rpx;
+
+    text {
+      padding-right: 24rpx;
+    }
+  }
+
+  .arrow-right {
+    width: 24rpx;
+    height: 24rpx;
+  }
+}
+
 .order-content {
   margin: 24rpx 26rpx 0;
   border-radius: 20rpx;
   padding: 28rpx 24rpx;
-  display: flex;
   background-color: #FFFFFF;
 }
+
 .item-content {
   display: flex;
   width: 100%;
+
+  &+.item-content {
+    padding-top: 60rpx;
+  }
+
   .goods-icon {
-    width: 160rpx;
-    height: 160rpx;
+    width: 140rpx;
+    height: 140rpx;
     margin-right: 24rpx;
     flex-shrink: 0;
     border-radius: 6px;
@@ -62,49 +130,144 @@ page {
     display: flex;
     justify-content: space-between;
     padding-top: 4rpx;
+
     .goods-name {
       flex: 1 auto;
       white-space: nowrap;
       overflow: hidden;
       font-weight: 600;
       font-size: 30rpx;
+      color: #131415;
+      line-height: 50rpx;
       text-overflow: ellipsis;
-      max-width: 310rpx;
+      max-width: 480rpx;
     }
-    .goods-price {
-      flex-shrink: 0;
-      font-family: DINAlternate, DINAlternate;
-      font-weight: bold;
-      font-size: 30rpx;
-      color: #131415;
-      line-height: 48rpx;
-      text {
-        padding-right: 4rpx;
-      }
+  }
+
+  .goods-price {
+    flex-shrink: 0;
+    font-family: DINAlternate, DINAlternate;
+    font-weight: bold;
+    color: #131415;
+    line-height: 48rpx;
+
+    .stuff {
+      font-size: 28rpx;
+      padding-right: 4rpx;
+    }
+
+    .priceZ {
+      font-size: 40rpx;
+    }
+
+    .priceF {
+      font-size: 32rpx;
     }
   }
 
+  .origin-price {
+    font-weight: 400;
+    font-size: 24rpx;
+    color: #6D4718;
+    line-height: 1;
+  }
+
   .goods-type {
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    padding-top: 12rpx;
+    padding-top: 28rpx;
+
     .goods-card {
       height: 40rpx;
-      background: #FEEDF0;
+      background: #fdf2e2;
       border-radius: 6rpx;
       font-size: 26rpx;
-      color: #FE2451;
+      color: #502f00;
       line-height: 40rpx;
       padding: 0 12rpx;
     }
+
     .goods-num {
       font-size: 28rpx;
-      color: #777777;
+      color: #777;
       line-height: 36rpx;
     }
   }
+}
+
+.goodsInfos {
+  margin-top: 32rpx;
+  // border-top: 2rpx solid #F2F2F2;
+
+  .qrcode-line {
+    position: relative;
+    background: linear-gradient(to right, transparent 50%, rgba(219, 219, 219, 1) 50%) repeat-x; // 设置水平方向的线性渐变,透明与半透明色交替,模拟虚线线段
+    background-size: 10px 1px; // 设置背景大小,控制虚线的线段长度和粗细,这里线段长度为10px,粗细为1px
+    height: 2rpx; // 元素高度,可根据实际需求调整,用于展示虚线效果的高度范围
+    // margin: 42rpx 0 32rpx;
+
+    &::before,
+    &::after {
+      content: '';
+      position: absolute;
+      top: -20rpx;
+      display: block;
+      width: 40rpx;
+      height: 40rpx;
+      background-color: #F4F4F4;
+      border-radius: 50%;
+    }
+
+    &::before {
+      left: -50rpx;
+    }
+
+    &::after {
+      right: -50rpx;
+    }
+  }
+}
 
+.goodsInfo-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding-top: 32rpx;
+
+  .title {
+    font-weight: 400;
+    font-size: 28rpx;
+    color: #131415;
+    line-height: 40rpx;
+  }
+
+  .goods-price {
+    flex-shrink: 0;
+    font-family: DINAlternate, DINAlternate;
+    font-weight: bold;
+    color: #131415;
+    line-height: 48rpx;
+
+    .stuff {
+      font-size: 32rpx;
+      padding-right: 4rpx;
+    }
+
+    .priceZ {
+      font-size: 48rpx;
+    }
+
+    .priceF {
+      font-size: 32rpx;
+    }
+  }
+
+  .calc-price {
+    font-weight: bold;
+    font-size: 28rpx;
+    color: #FF0047;
+    line-height: 32rpx;
+  }
 }
 
 .order-time {
@@ -117,14 +280,17 @@ page {
     display: flex;
     justify-content: space-between;
     padding-bottom: 36rpx;
+
     &:last-child {
       padding-bottom: 0;
     }
+
     .title {
       font-size: 28rpx;
       color: #131415;
       line-height: 40rpx;
     }
+
     .value {
       font-size: 28rpx;
       color: #777777;
@@ -133,25 +299,57 @@ page {
   }
 }
 
+.wechat-section {
+  background: #FFFFFF;
+  border-radius: 20rpx;
+  padding: 28rpx 24rpx;
+  margin: 24rpx 26rpx;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  .wechat-left {
+    font-weight: 600;
+    font-size: 28rpx;
+    color: #000000;
+    line-height: 40rpx;
+    display: flex;
+    align-items: center;
+
+    image {
+      margin-right: 16rpx;
+      width: 40rpx;
+      height: 34rpx;
+    }
+  }
+
+  .checkbox {
+    width: 32rpx;
+    height: 32rpx;
+  }
+}
+
 .order-btn {
   position: fixed;
   bottom: 0;
   left: 0;
   width: 100%;
   background-color: #FFFFFF;
-  padding: 20rpx 32rpx 58rpx 40rpx;
+  padding: 20rpx 32rpx 58rpx 32rpx;
   display: flex;
-  justify-content: space-between;
+  justify-content: flex-end;
   box-sizing: border-box;
 
   .orders {
     display: flex;
     flex-direction: column;
     margin-right: 40rpx;
+
     image {
       width: 48rpx;
       height: 48rpx;
     }
+
     text {
       font-weight: 500;
       font-size: 22rpx;
@@ -165,44 +363,68 @@ page {
     display: flex;
   }
 
-  .price {
+  .price-section {
     display: flex;
     align-items: center;
+  }
+
+  .price {
+    display: flex;
+    align-items: flex-end;
 
     .desc {
       font-weight: 500;
       font-size: 28rpx;
       color: #777;
       line-height: 40rpx;
-      padding-top: 20rpx;
       flex-shrink: 0;
     }
+
     .currentPrice {
       font-weight: bold;
       color: #FE2451;
       font-family: DINAlternate, DINAlternate;
+      display: flex;
+      align-items: flex-end;
+
       .stuff {
         font-size: 32rpx;
       }
+
       .priceZ {
-        font-size: 56rpx;
+        font-size: 48rpx;
+        line-height: 1;
       }
+
       .priceF {
         font-size: 32rpx;
       }
     }
+
+    .line {
+      margin: 0 12rpx 8rpx;
+      background-color: #D2D2D2;
+      width: 2rpx;
+      height: 20rpx;
+    }
+
+    .discountPrice {
+      // padding-bottom: 6rpx;
+      font-size: 24rpx;
+      color: #FE2451;
+    }
   }
 
   button {
-    margin: 0 0 0 12rpx;
-    width: auto;
-    background: linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%);
+    margin-left: 12rpx !important;
+    width: 240rpx !important;
+    line-height: 88rpx;
+    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
     border-radius: 78rpx;
-    padding: 22rpx 84rpx;
+    padding: 0 !important;
     font-weight: 500;
     font-size: 32rpx;
     color: #FFFFFF;
-    line-height: 44rpx;
     flex-shrink: 0;
   }
 }

+ 63 - 8
miniprogram/pages/orders/order-detail.ts

@@ -1,5 +1,6 @@
 // pages/orders/order-detail.ts
 import { api_executeOrder, api_executePayment, api_queryByParamName, api_userPaymentOrderUnpaid } from "../../api/login";
+import { formatPrice } from "../../utils/util";
 
 // 获取应用实例
 const app = getApp<IAppOption>()
@@ -17,6 +18,14 @@ Page({
       },
     },
     goodsInfo: {} as any,
+    hasInstrument: false, // 是否有乐器
+    receiveAddress: '', // 选择的地址信息
+    receiveAddressInfo: {
+      addressDetail: '',
+      name: '',
+      phoneNumber: ''
+    },
+    userBeneficiaryId: '', // 添加购买人信息
     paymentType: null as any, // 支付类型
     paymentChannel: null as any,
     showService: false,
@@ -28,11 +37,51 @@ Page({
   onLoad(options: any) {
     this.queryPayType()
     if (options.orderInfo) {
+      console.log('goods', options)
       const goods = JSON.parse(decodeURIComponent(options.orderInfo));
-      console.log(goods, 'goods')
+      console.log(goods, 'goods', options)
+      const infos = {
+        allSalePrice: 0,
+        allOriginPrice: 0,
+        allDiscountPrice: '',
+        integerPart: '',
+        decimalPart: '',
+        name: '',
+        shopId: '',
+        orderNo: options.orderNo || '',
+        goodsList: [] as any
+      }
+      // 是否有乐器
+      let hasInstrument = false
+      for (let i in goods) {
+        const item = goods[i]
+
+        if (item.goodsType === "INSTRUMENTS") {
+          hasInstrument = true
+        }
+        infos.name = infos.name ? infos.name + '+' + item.name : item.name
+        infos.shopId = item.shopId
+
+        const afterPrice: any = formatPrice(item.salePrice)
+        infos.goodsList.push({
+          ...item,
+          ...afterPrice
+        })
+
+        infos.allSalePrice += Number(item.salePrice)
+        infos.allOriginPrice += Number(item.originalPrice)
+      }
+
+      const allAfterPrice: any = formatPrice(infos.allSalePrice)
+      // console.log(infos.allOriginPrice, infos.allSalePrice)
+      infos.allDiscountPrice = formatPrice(infos.allOriginPrice - infos.allSalePrice, 'ALL') as string
+      infos.integerPart = allAfterPrice.integerPart
+      infos.decimalPart = allAfterPrice.decimalPart
+      // console.log(infos, 'infos')
       this.setData({
-        goodsInfo: goods,
-        status: goods.status
+        goodsInfo: infos,
+        status: options.status || '',
+        hasInstrument
       });
     }
   },
@@ -54,6 +103,12 @@ Page({
       console.log(error, "error");
     }
   },
+  /** 添加收货地址 */
+  onSelectAddress() {
+    wx.navigateTo({
+      url: `../address/index`,
+    })
+  },
   onPayError(message?: string) {
     wx.hideLoading()
     wx.showToast({
@@ -69,8 +124,8 @@ Page({
     });
     try {
       const { salePrice, shopId, name, id, orderNo } = this.data.goodsInfo
-      if(orderNo) {
-        const {data} = await api_userPaymentOrderUnpaid({
+      if (orderNo) {
+        const { data } = await api_userPaymentOrderUnpaid({
           orderNo: orderNo,
           paymentType: 'WECHAT_MINI'
         })
@@ -101,7 +156,7 @@ Page({
         if (data.code === 200) {
           const { paymentConfig, paymentType, orderNo } = data.data
           this.onExecutePay(paymentConfig, paymentType, orderNo)
-        } else if(data.code === 5200) {
+        } else if (data.code === 5200) {
           wx.hideLoading()
           wx.showToast({
             title: data.message,
@@ -115,7 +170,7 @@ Page({
       wx.hideLoading()
     }
   },
-  async onExecutePay( paymentConfig: any, paymentType: string, orderNo: string) {
+  async onExecutePay(paymentConfig: any, paymentType: string, orderNo: string) {
     wx.login({
       success: async (wxres: any) => {
         const res = await api_executePayment({
@@ -129,7 +184,7 @@ Page({
           // wxPubAppId: 'wxbde13f59d40cb4f2'
         })
         wx.hideLoading()
-        if(res.data.code === 200) {
+        if (res.data.code === 200) {
           this.onPay(paymentType, res.data.data.reqParams, orderNo)
         } else {
           this.onPayError(res.data.message)

+ 87 - 15
miniprogram/pages/orders/order-detail.wxml

@@ -1,19 +1,57 @@
 <!--pages/orders/order-detail.wxml-->
 <view class="container">
-  <navigation-bar title="订单详情"></navigation-bar>
+  <navigation-bar title="核对订单"></navigation-bar>
 
   <scroll-view class="record-list" type="list" scroll-y bindscrolltolower="loadMore">
-    <view class="order-status">
+    <!-- <view class="order-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="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="{{ userBeneficiaryId }}">
+          <view class="users">
+            {{ userBeneficiaryInfo.schoolInfo }}
+          </view>
+          <view class="address">
+            <text>{{ userBeneficiaryInfo.name }}</text>
+            <text>{{ userBeneficiaryInfo.phoneNumber }}</text>
+          </view>
+        </view>
+        <view class="info" wx:else>
+          <view class="users">
+            新建收货地址
+          </view>
+          <view class="address">请填写您的收货地址与信息</view>
+        </view>
+      </view>
+      <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
     </view>
 
     <view class="order-content">
-      <view class="item-content">
-        <image class='goods-icon' src="{{ goodsInfo.pic }}" mode="" />
+      <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>
+          <view class="goods-type">
+            <view class="goods-price">
+              <text class="stuff">¥</text>
+              <text class="priceZ">{{ item.integerPart }}</text>
+              <text class="priceF">.{{ item.decimalPart }}</text>
+            </view>
+            <view class="origin-price">|日常价 ¥ {{item.originalPrice}}</view>
+          </view>
+        </view>
+        <!-- <image class='goods-icon' src="{{ goodsInfo.pic }}" mode="" />
         <view class="goods-desc">
           <view class="goodsInfo">
             <view class="goods-name">{{ goodsInfo.name }}</view>
@@ -23,10 +61,38 @@
             <view class="goods-card">{{ goodsInfo.typeName }}</view>
             <view class="goods-num">x1</view>
           </view>
+        </view> -->
+      </view>
+
+      <view class="goodsInfos">
+        <view class="qrcode-line"></view>
+        <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>
+        </view>
+
+        <view class="goodsInfo-item" wx:if="{{ goodsInfo.allOriginPrice > goodsInfo.allSalePrice }}">
+          <text class="title">惊喜优惠</text>
+
+          <view class="calc-price">-¥ {{ goodsInfo.allDiscountPrice }}</view>
         </view>
       </view>
     </view>
 
+    <view class="wechat-section">
+      <view class="wechat-left">
+        <image src="./images/icon-wechat.png"></image>
+        微信支付
+      </view>
+
+      <image src="./images/icon-checkbox.png" class="checkbox"></image>
+    </view>
+
     <!-- <view class="order-time">
       <view class="order-item">
         <view class="title">订单号</view>
@@ -40,20 +106,26 @@
   </scroll-view>
 
   <view class="order-btn">
-    <view class="orders" bind:tap="onService">
-        <image src="./images/icon-service.png" />
-        <text>客服</text>
-      </view>
+    <!-- <view class="orders" bind:tap="onService">
+      <image src="./images/icon-service.png" />
+      <text>客服</text>
+    </view> -->
     <view class="more">
-      <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 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>
         </view>
       </view>
-      <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '立即支付' }}</button>
+      <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '提交' }}</button>
     </view>
   </view>
 

+ 7 - 0
project.private.config.json

@@ -9,6 +9,13 @@
     "miniprogram": {
       "list": [
         {
+          "name": "pages/orders/order-detail",
+          "pathName": "pages/orders/order-detail",
+          "query": "orderInfo=%257B%25220%2522%253A%257B%2522pic%2522%253A%2522https%253A%252F%252Foss.dayaedu.com%252Fktyq%252Fbasic%252F1739175447189.png%2522%252C%2522name%2522%253A%2522%25E7%25BB%2588%25E8%25BA%25AB%2522%252C%2522originalPrice%2522%253A%25223888.00%2522%252C%2522salePrice%2522%253A3680.01%252C%2522shopId%2522%253A%25221860977507241574402%2522%252C%2522id%2522%253A%25221861228127462633474%2522%252C%2522goodsType%2522%253A%2522ACTIVATION_CODE%2522%257D%252C%25221%2522%253A%257B%2522pic%2522%253A%2522https%253A%252F%252Foss.dayaedu.com%252Fktyq%252Fbasic%252F1739174280217.png%2522%252C%2522name%2522%253A%2522%25E5%25BE%25B7%25E5%25BC%258F%25E7%25AB%2596%25E7%25AC%259B%2522%252C%2522originalPrice%2522%253A199%252C%2522salePrice%2522%253A99%252C%2522shopId%2522%253A%25221860977507241574402%2522%252C%2522id%2522%253A%25221888860066698870786%2522%252C%2522goodsType%2522%253A%2522INSTRUMENTS%2522%257D%257D&userBeneficiaryId=1889266174420692993",
+          "launchMode": "default",
+          "scene": null
+        },
+        {
           "name": "pages/login/login",
           "pathName": "pages/login/login",
           "query": "",