lex-xin 5 月之前
父节点
当前提交
b69aeebfd4

+ 2 - 1
miniprogram/app.json

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

二进制
miniprogram/pages/index/images/icon-buy.png


二进制
miniprogram/pages/index/images/icon-home-active.png


二进制
miniprogram/pages/index/images/icon-order.png


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

@@ -4,6 +4,7 @@
   width: 100%;
   background: #F5F6F7;
 }
+
 .scrollarea {
   flex: 1;
   overflow-y: hidden;
@@ -153,11 +154,6 @@
   }
 }
 
-.goodsSection {
-  // margin-bottom: 156rpx;
-  // padding-bottom: 154rpx;
-}
-
 .goodsIntro {
   background: #FFFFFF;
   overflow: hidden;
@@ -176,8 +172,8 @@
   left: 0;
   width: 100%;
   background-color: #FFFFFF;
-  box-shadow: inset 0rpx 2rpx 0rpx 0rpx #F0F0F0;
-  padding: 20rpx 32rpx 58rpx 32rpx;
+  box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.5);
+  padding: 20rpx 64rpx 58rpx;
   display: flex;
   align-items: center;
   box-sizing: border-box;
@@ -186,25 +182,29 @@
   .orders {
     display: flex;
     align-items: center;
+    justify-content: center;
     margin-right: 40rpx;
-    padding: 8rpx 0 16rpx;
-
-    &.active {
-      text {
-        color: #131415;
-      }
+    height: 94rpx;
+    flex: 1;
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
+
+    +.orders {
+      margin-right: 0;
     }
 
     image {
-      width: 44rpx;
-      height: 44rpx;
+      width: 46rpx;
+      height: 46rpx;
     }
 
     text {
-      padding-left: 16rpx;
-      font-weight: 500;
-      font-size: 28rpx;
-      color: #AAAAAA;
+      padding-left: 8rpx;
+      font-weight: 600;
+      font-size: 32rpx;
+      color: #FEFFCA;
       line-height: 44rpx;
       text-align: center;
     }
@@ -290,6 +290,7 @@
     .addBuyer-left {
       display: flex;
       flex: 1;
+
       .info {
         flex: 1;
       }

+ 19 - 254
miniprogram/pages/index/index.ts

@@ -1,8 +1,6 @@
 // index.ts
-
-import { api_shopInstruments, api_shopProduct } from "../../api/login";
 import { api_schoolAreaDetail, api_schoolAreaList, api_sysAreaQueryAllProvince, api_userBeneficiarySave, api_userBeneficiaryUpdate } from "../../api/new";
-import { debounce, formatPrice, GRADE_ENUM } from '../../utils/util'
+import {  GRADE_ENUM } from '../../utils/util'
 
 const classList: any = [];
 for (let i = 1; i <= 40; i++) {
@@ -49,27 +47,17 @@ Page({
    */
   data: {
     goodsImgList: [
-      'https://oss.dayaedu.com/ktyq/1739523537634.png',
+      'https://oss.dayaedu.com/ktyq/1739524049205.png',
       'https://oss.dayaedu.com/ktyq/1739523564827.png',
       'https://oss.dayaedu.com/ktyq/1739523574402.png',
       'https://oss.dayaedu.com/ktyq/1739523583463.png'
     ],
     current: 0,
     popupShow: false,
-    instrumentList: [] as any,
-    list: [] as any,
-    isOverSaled: false, // 是否所有商品都没有库存
-    smallGoods: {}, // 最小金额商品
-    selected: {} as any,
-    selectInstrumentId: '', // 选中的乐器
-    selectedInstrument: {} as any,
-    formatSelectGood: {
-      typeName: '',
-      showSalePrice: '', // 显示的现价
-      originalPrice: 0, // 原价
-      salePrice: 0, // 现价
-      discountPrice: '' // 已省
-    } as any, // 格式化所有选中的数据
+    
+    
+
+
     showService: false,
     isFromPreviewImage: false,
     showBuyer: false, // 收益人
@@ -142,173 +130,7 @@ Page({
   onLoad() {
     // this.onInit()
   },
-  /**
-   * 获取基础信息
-   */
-  async onInit() {
-    try {
-      const result = await api_shopInstruments({ appId: app.globalData.appId })
-      const instrumentList = result.data.data || []
-      instrumentList?.forEach((item: any) => {
-        item.showSalePrice = formatPrice(item.salePrice || 0, 'ALL')
-      })
-      const { data } = await api_shopProduct({ appId: app.globalData.appId });
-      const list = data.data || []
-      let selected: any = {}
-      let isOverSaled = true // 是否销售完
-
-      // 最少金额商品
-      let smallGoods: any = {}
-      list.forEach((item: any) => {
-        item.originalPrice = formatPrice(item.originalPrice, "ALL");
-        item.showSalePrice = formatPrice(item.salePrice, "ALL");
-        item.typeName = this.formatPeriod(item.num, item.period);
-        item.discountPrice = formatPrice(
-          item.originalPrice - item.salePrice,
-          "ALL"
-        );
-        const prices: any = formatPrice(item.salePrice)
-        item.integerPart = prices.integerPart
-        item.decimalPart = prices.decimalPart
-        if (item.stockNum > 0) {
-          isOverSaled = false
-          if (!selected.id) {
-            selected = item
-          }
-        }
-
-        // 获取最小金额
-        if (smallGoods?.salePrice) {
-          smallGoods = smallGoods.salePrice <= item.salePrice ? smallGoods : item
-        } else {
-          smallGoods = item
-        }
-      });
-      if (isOverSaled) {
-        // 没有可购买商品则默认选中第一个商品
-        selected = list[0]
-      }
-
-      this.setData({
-        list,
-        instrumentList, // 乐器列表
-        isOverSaled,
-        selected,
-        smallGoods,
-        selectInstrumentId: '',
-        selectedInstrument: {},
-
-        userBeneficiaryId: '',
-        userBeneficiaryInfo: {
-          name: '',
-          phoneNumber: '',
-          schoolInfo: ''
-        }
-      }, () => {
-        this.onFormatGoods()
-      })
-    } catch (e) {
-      console.log(e, 'e')
-    }
-  },
-  // 格式化类型
-  formatPeriod(num: number, type: string) {
-    const template: any = {
-      DAY: "天卡",
-      MONTH: "月卡",
-      YEAR: "年卡"
-    }
-    if (type === "YEAR" && num >= 99) {
-      return '永久卡'
-    }
-    return num + (template[type] || '')
-  },
-  /** 切换swiper */
-  onSwiperChange(e: any) {
-    console.log(e, 'e')
-    return false
-  },
-  // 选择
-  onSelectGoods(e: any) {
-    const { dataset } = e.currentTarget
-    const item = this.data.list.find((item: any) => item.id === dataset.id)
-    // 判断是否有库存
-    if (item.stockNum <= 0) {
-      return
-    }
-    this.setData({
-      selected: item || {}
-    }, () => {
-      this.onFormatGoods()
-    })
-  },
-  /** 选中乐器 */
-  onSelectInstrument(e: any) {
-    const { dataset } = e.currentTarget;
-    if (dataset.id === this.data.selectInstrumentId) {
-      this.setData({
-        selectInstrumentId: '',
-        selectedInstrument: {}
-      }, () => {
-        this.onFormatGoods()
-      })
-    } else {
-      const item = this.data.instrumentList.find((item: any) => item.id === dataset.id);
-      this.setData({
-        selectInstrumentId: dataset.id,
-        selectedInstrument: item || {}
-      }, () => {
-        this.onFormatGoods()
-      })
-    }
-
-  },
-  /** 格式化选中的商品 */
-  onFormatGoods() {
-    const selected = this.data.selected;
-    const selectedInstrument = this.data.selectedInstrument
-
-    const params = {
-      typeName: '',
-      showSalePrice: '' as any, // 显示的现价
-      originalPrice: 0, // 原价
-      salePrice: 0, // 现价
-      discountPrice: '' as any, // 已省
-      integerPart: '',
-      decimalPart: '',
-    }
-    // 选中期限
-    if (selected.id) {
-      params.typeName = selected.typeName
-      params.showSalePrice = selected.showSalePrice
-      params.originalPrice = selected.originalPrice
-      params.salePrice = selected.salePrice
-      params.discountPrice = selected.discountPrice
-
-      const prices: any = formatPrice(params.salePrice);
-      params.integerPart = prices.integerPart
-      params.decimalPart = prices.decimalPart
-    }
-    // 选中乐器
-    if (selectedInstrument.id) {
-      params.typeName = selected.typeName ? selected.typeName + '+' + selectedInstrument.name : selectedInstrument.name
-      params.originalPrice = Number(selected.originalPrice) + Number(selectedInstrument.originalPrice)
-      params.salePrice = Number(selected.salePrice) + Number(selectedInstrument.salePrice)
-      params.showSalePrice = formatPrice(params.salePrice, "ALL");
-      params.discountPrice = formatPrice(
-        params.originalPrice - params.salePrice,
-        "ALL"
-      );
-
-      const prices: any = formatPrice(params.salePrice);
-      params.integerPart = prices.integerPart
-      params.decimalPart = prices.decimalPart
-    }
-
-    this.setData({
-      formatSelectGood: params
-    })
-  },
+  
   isLogin() {
     // 判断是否登录
     if (!app.globalData.isLogin) {
@@ -329,6 +151,16 @@ Page({
       url: '../orders/orders',
     })
   },
+  /** 申请加入 */
+  onBuyGoods() {
+    // 判断是否登录
+    if (!this.isLogin()) {
+      return
+    }
+    wx.navigateTo({
+      url: '../select-goods/index',
+    })
+  },
   /** 客服 */
   onService() {
     this.setData({
@@ -361,67 +193,7 @@ Page({
       }
     })
   },
-  onSubmit() {
-    // 判断是否登录
-    const that = this
-    if (!this.data.userBeneficiaryId) {
-      wx.showToast({
-        title: '请填写享用者的个人信息',
-        icon: 'none'
-      })
-      return
-    }
-    debounce(function () {
-      if (!that.isLogin()) {
-        return
-      }
-      const params = [] as any
-      const selected = that.data.selected
-      if (selected.id) {
-        params.push({
-          pic: selected.pic,
-          name: selected.name,
-          period: selected.period,
-          num: selected.num,
-          originalPrice: selected.originalPrice,
-          salePrice: selected.salePrice,
-          shopId: selected.shopId,
-          id: selected.id,
-          goodsType: 'ACTIVATION_CODE', // INSTRUMENTS
-        })
-      }
-      const selectedInstrument = that.data.selectedInstrument
-      if (selectedInstrument.id) {
-        params.push({
-          pic: selectedInstrument.pic,
-          name: selectedInstrument.name,
-          period: selectedInstrument?.period,
-          num: selectedInstrument?.num || 0,
-          originalPrice: selectedInstrument.originalPrice,
-          salePrice: selectedInstrument.salePrice,
-          shopId: selectedInstrument.shopId,
-          id: selectedInstrument.id,
-          goodsType: 'INSTRUMENTS', // INSTRUMENTS
-        })
-      }
-
-      let info = JSON.stringify({
-        ...params
-      });
-      info = encodeURIComponent(info);
-
-      console.log(params, "params")
-      wx.navigateTo({
-        url: `../orders/order-detail?orderInfo=${info}&userBeneficiaryId=${that.data.userBeneficiaryId}`,
-        success: () => {
-          that.setData({
-            popupShow: false,
-            currentIndex: 1,
-          })
-        }
-      })
-    }, 500)()
-  },
+  
   onPreivewGoodsImg(e: { currentTarget: { dataset: any } }) {
     wx.previewImage({
       current: e.currentTarget.dataset.src,
@@ -448,17 +220,10 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-    if (!this.data.isFromPreviewImage) {
-      this.onInit()
-    } else {
-      this.setData({
-        isFromPreviewImage: false
-      })
-    }
   },
   onShareAppMessage() {
     return {
-      title: '器乐数字AI工具',
+      title: '翼时代器乐数字Ai',
       path: '/pages/index/index',
       imageUrl: 'https://oss.dayaedu.com/ktyq/1733312164991.png'
     }

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

@@ -15,13 +15,13 @@
       </view>
 
       <view class="bottom-section">
-        <view class="orders active">
-          <image src="./images/icon-home-active.png" />
-          <text>首页</text>
-        </view>
         <view class="orders" bind:tap="onOrder">
           <image src="./images/icon-order.png" />
-          <text>订单</text>
+          <text>我的订单</text>
+        </view>
+        <view class="orders" bind:tap="onBuyGoods">
+          <image src="./images/icon-buy.png" />
+          <text>申请加入</text>
         </view>
       </view>
 
@@ -31,72 +31,7 @@
           <image bind:tap="onClose" src="./images/icon-close-1.png" class="iconClose"></image>
           <!-- wx:if="{{popupShow}}" -->
           <!-- <view class="popup-mask" bind:tap="onClose"></view> -->
-          <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>
-              <!-- 添加权益人 -->
-              <view class="addBuyer" bind:tap="onSelectBuyer">
-                <view class="addBuyer-left">
-                  <image src="./images/icon-man.png" class="icon-man"></image>
-                  <view class="info" wx:if="{{ userBeneficiaryId }}">
-                    <view class="users">
-                      <text>{{ userBeneficiaryInfo.name }}</text>
-                      <text>{{ userBeneficiaryInfo.phoneNumber }}</text>
-                    </view>
-                    <view class="address">{{ userBeneficiaryInfo.schoolInfo }}</view>
-                  </view>
-                  <view class="info" wx:else>
-                    <view class="users">
-                      <text>请填写享用者的个人信息</text>
-                    </view>
-                  </view>
-                </view>
-                <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
-              </view>
-
-              <view class="goodsInfo">
-                <view class="desc">会员有效期</view>
-                <view class="goodsList">
-                  <view wx:for="{{ list }}" wx:key="index" class="goodsItem {{ item.id == selected.id ? 'selected' : '' }} {{ item.stockNum <= 0 ? 'nosale' : '' }}" bind:tap="onSelectGoods" data-id="{{ item.id }}">{{ item.typeName }}
-                    <image wx:if="{{ item.stockNum <= 0 }}" src="./images/nosale.png"></image>
-                  </view>
-                </view>
-              </view>
-
-              <view class="goodsInfo">
-                <view class="desc">乐器搭配<text>(非必选)</text></view>
-                <view class="goodsList">
-                  <view wx:for="{{ instrumentList }}" wx:key="index" class="goodsItem {{ item.id == selectInstrumentId ? 'selected' : '' }}" bind:tap="onSelectInstrument" data-id="{{ item.id }}">
-                    {{ item.name }} <text>¥{{ item.showSalePrice }}</text>
-                  </view>
-                </view>
-              </view>
-            </view>
-            <view style="padding-bottom: 300rpx;"></view>
-            <view class="popupBottom">
-              <!-- 有选择商品的时候 -->
-              <view class="current-item" wx:if="{{!isOverSaled && selected.id}}">
-                <!-- <view class="current-item-text">您已选择:</view> -->
-                <view class="current-top">
-                  共计 <view class="prices"><text class="stuff">¥</text>
-                    <text class="priceZ">{{ formatSelectGood.integerPart || 0 }}</text>
-                    <text class="priceF">.{{ formatSelectGood.decimalPart || '00' }}</text>
-                  </view>
-                  <text class="line">|</text>原价 ¥ {{ formatSelectGood.originalPrice }}
-                  <block wx:if="{{ formatSelectGood.originalPrice > formatSelectGood.salePrice }}">
-                    <text class="line">|</text>
-                    <text>优惠 ¥ {{ formatSelectGood.discountPrice }}</text>
-                  </block>
-                </view>
-
-                <view class="current-select-text">已选:{{ formatSelectGood.typeName }}</view>
-              </view>
-              <view class="btnGroup">
-                <button type="primary" catch:tap="onSubmit">立即享受专属权益</button>
-              </view>
-            </view>
-          </scroll-view>
+          
           <!-- <view class="popup-container">
                 
               </view> -->

二进制
miniprogram/pages/login/images/radio-active.png


二进制
miniprogram/pages/login/images/radio-default.png


+ 24 - 15
miniprogram/pages/login/login.less

@@ -7,38 +7,44 @@
   display: flex;
   align-items: center;
   flex-direction: column;
-  padding-top: 150rpx;
+  padding-top: 210rpx;
+
   image {
-    width: 160rpx;
-    height: 160rpx;
+    width: 148rpx;
+    height: 148rpx;
     border-radius: 32rpx;
     overflow: hidden;
   }
+
   .appname {
     padding-top: 40rpx;
     font-weight: 600;
-    font-size: 40rpx;
+    font-size: 44rpx;
     color: #333333;
-    line-height: 56rpx;
+    line-height: 60rpx;
   }
 }
 
 .login-section {
   padding-top: 180rpx;
   padding: 180rpx 40rpx 0;
+
   button {
     width: 100%;
-    line-height: 88rpx;
-    background: linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%);
-    border-radius: 44rpx;
-    font-weight: 500;
-    font-size: 32rpx;
-    color: #FFFFFF;
+    line-height: 94rpx;
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
+    font-weight: 600;
+    font-size: 36rpx;
+    color: #FEFFCA;
     padding-top: 0;
     padding-bottom: 0;
+
     &[disabled][type=primary] {
-      color: #fff;
-      background: linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%);
+      color: #FEFFCA;
+      background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
       opacity: 0.7;
     }
   }
@@ -50,21 +56,24 @@
     width: 100%;
     text-align: center;
     line-height: 36rpx;
+
     .radioSection {
       height: 36rpx;
       display: inlin-flex;
       align-items: center;
       justify-content: center;
     }
+
     .radio {
       width: 28rpx;
       height: 28rpx;
       margin-right: 12rpx;
       transform: translateY(4rpx)
     }
+
     .protocol {
-      color: #FE2451;
+      color: #A76D1C;
     }
-  } 
+  }
 
 }

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

@@ -2,8 +2,8 @@
 <view class="container">
   <navigation-bar title="登录" ></navigation-bar>
   <view class="appInfo">
-    <image src="https://oss.dayaedu.com/ktyq/1733126154750.png"></image>
-    <text class="appname">器乐数字AI工具</text>
+    <image src="https://oss.dayaedu.com/ktyq/1739524690769.png"></image>
+    <text class="appname">翼时代器乐数字Ai</text>
   </view>
   <view class="login-section">
     <view class="btnSection">

+ 2 - 2
miniprogram/pages/protocol/register.ts

@@ -17,11 +17,11 @@ Page({
     if(options.type) {
       if(options.type === "privacy") {
         this.setData({
-          src: app.globalData.baseUrl + '/classroom-app/#/privacy-protocol?wx=1'
+          src: app.globalData.baseUrl + '/classroom-app/#/privacy-protocol?wx=6'
         })
       } else if(options.type === "register") {
         this.setData({
-          src: app.globalData.baseUrl + '/classroom-app/#/preview-protocol?wx=1'
+          src: app.globalData.baseUrl + '/classroom-app/#/preview-protocol?wx=6'
         })
       } else if(options.type == 'activation') {
         this.setData({

二进制
miniprogram/pages/select-goods/images/icon-back.png


二进制
miniprogram/pages/select-goods/images/icon-default.png


二进制
miniprogram/pages/select-goods/images/icon-edit.png


二进制
miniprogram/pages/select-goods/images/icon-select.png


二进制
miniprogram/pages/select-goods/images/icon2.png


二进制
miniprogram/pages/select-goods/images/nosale.png


+ 5 - 0
miniprogram/pages/select-goods/index.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "navigation-bar": "/components/navigation-bar/navigation-bar"
+  }
+}

+ 204 - 0
miniprogram/pages/select-goods/index.less

@@ -0,0 +1,204 @@
+/* pages/select-goods/index.wxss */
+.container {
+  position: relative;
+  height: 100vh;
+  width: 100%;
+  background: #F5F6F7;
+}
+
+.top-bar {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  height: 376rpx;
+  background: linear-gradient(180deg, #FDEC00 0%, #FAD400 100%);
+  width: 100%;
+}
+
+.goods-section {
+  .popup-container {
+    // position: fixed;
+    // bottom: 0;
+    // left: 0;
+    // right: 0;
+    // z-index: 10;
+    width: 100%;
+    background: #FFFFFF;
+    border-radius: 32rpx 32rpx 0rpx 0rpx;
+    // padding: 40rpx 0 0;
+    box-sizing: border-box;
+    // flex: 1;
+    max-height: 86vh;
+
+    .popup-scroll {
+      overflow-x: hidden;
+      overflow-y: scroll;
+      border-radius: 32rpx 32rpx 0rpx 0rpx;
+      flex: 1 auto;
+    }
+
+    .top-vip-img {
+      width: 100%;
+    }
+
+    .goodsInfo {
+      padding: 0 40rpx 48rpx;
+    }
+  }
+
+
+  .product-section {
+    display: flex;
+    padding-bottom: 60rpx;
+
+    .product-img {
+      width: 160rpx;
+      height: 160rpx;
+      flex-shrink: 0;
+      margin-right: 32rpx;
+      border-radius: 6px;
+      overflow: hidden;
+
+      image {
+        width: 100%;
+        height: 100%;
+      }
+    }
+
+    .product-left {
+      display: flex;
+      align-items: flex-start;
+
+      .currentPrice {
+        font-weight: bold;
+        color: #FE2451;
+        font-family: DINAlternate, DINAlternate;
+
+        .stuff {
+          padding-right: 2rpx;
+          font-size: 36rpx;
+        }
+
+        .priceZ {
+          font-size: 60rpx;
+        }
+
+        .priceF {
+          font-size: 36rpx;
+        }
+      }
+
+      .originPrice {
+        padding-left: 16rpx;
+        font-size: 32rpx;
+        color: #AAAAAA;
+        line-height: 44rpx;
+        text-decoration: line-through;
+        padding-top: 32rpx;
+      }
+    }
+  }
+
+  .goodsInfo {
+    flex-direction: column;
+    align-items: flex-start;
+    padding-bottom: 90rpx;
+
+    .desc {
+      font-weight: 600;
+      font-size: 30rpx;
+      color: #000000;
+      line-height: 40rpx;
+      display: flex;
+      align-items: center;
+
+      .iconBefore {
+        width: 18rpx;
+        height: 28rpx;
+        margin-right: 8rpx;
+      }
+
+      text {
+        padding-left: 8rpx;
+        font-size: 28rpx;
+        color: #AAAAAA;
+        line-height: 40rpx;
+      }
+    }
+
+    .goodsList {
+      display: flex;
+      align-items: center;
+      flex-wrap: wrap;
+    }
+
+    .goodsItem {
+      background: rgba(255, 255, 255, 0.7);
+      border-radius: 12rpx;
+      border: 4rpx solid rgba(255, 255, 255, 0.7);
+      padding: 10rpx;
+      margin-right: 16rpx;
+      font-weight: 600;
+      font-size: 24rpx;
+      color: #131415;
+      position: relative;
+      margin-top: 24rpx;
+      display: flex;
+      align-items: center;
+
+      &.selected {
+        border: 4rpx solid #FE4600;
+      }
+
+      &.nosale {
+        background: #F4F4F5;
+        color: #B1B1B1;
+      }
+
+      .goodImg {
+        flex-shrink: 1;
+        width: 64rpx;
+        height: 64rpx;
+        margin-right: 10rpx;
+      }
+
+      .infos {
+        .name {
+          line-height: 28rpx;
+        }
+
+        .price {
+          font-family: DINAlternate, DINAlternate;
+          font-weight: bold;
+          font-size: 24rpx;
+          color: #FE4600;
+        }
+      }
+
+      .nosale {
+        position: absolute;
+        top: -20rpx;
+        right: -16rpx;
+        width: 56rpx;
+        height: 28rpx;
+        display: block;
+        z-index: 1;
+      }
+    }
+  }
+
+
+
+  button {
+    width: 100%;
+    line-height: 88rpx;
+    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
+    border-radius: 44rpx;
+    font-weight: 500;
+    font-size: 32rpx;
+    color: #FFFFFF;
+    padding-top: 0;
+    padding-bottom: 0;
+  }
+}

+ 275 - 0
miniprogram/pages/select-goods/index.ts

@@ -0,0 +1,275 @@
+import { api_shopInstruments, api_shopProduct } from "../../api/login"
+import { debounce, formatPrice } from "../../utils/util"
+// 获取应用实例
+const app = getApp<IAppOption>()
+// pages/select-goods/index.ts
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    instrumentList: [] as any,
+    list: [] as any,
+    isOverSaled: false, // 是否所有商品都没有库存
+    smallGoods: {}, // 最小金额商品
+    selected: {} as any,
+    selectInstrumentId: '', // 选中的乐器
+    selectedInstrument: {} as any,
+    formatSelectGood: {
+      typeName: '',
+      showSalePrice: '', // 显示的现价
+      originalPrice: 0, // 原价
+      salePrice: 0, // 现价
+      discountPrice: '' // 已省
+    } as any, // 格式化所有选中的数据
+
+    userBeneficiaryId: '', // 选中用户的编号
+    userBeneficiaryInfo: {
+      name: '',
+      phoneNumber: '',
+      schoolInfo: ''
+    },
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad() {
+    this.onInit()
+  },
+  /**
+   * 获取基础信息
+   */
+  async onInit() {
+    try {
+      const result = await api_shopInstruments({ appId: app.globalData.appId })
+      const instrumentList = result.data.data || []
+      instrumentList?.forEach((item: any) => {
+        item.showSalePrice = formatPrice(item.salePrice || 0, 'ALL')
+      })
+      const { data } = await api_shopProduct({ appId: app.globalData.appId });
+      const list = data.data || []
+      let selected: any = {}
+      let isOverSaled = true // 是否销售完
+
+      // 最少金额商品
+      let smallGoods: any = {}
+      list.forEach((item: any) => {
+        item.originalPrice = formatPrice(item.originalPrice, "ALL");
+        item.showSalePrice = formatPrice(item.salePrice, "ALL");
+        item.typeName = this.formatPeriod(item.num, item.period);
+        item.discountPrice = formatPrice(
+          item.originalPrice - item.salePrice,
+          "ALL"
+        );
+        const prices: any = formatPrice(item.salePrice)
+        item.integerPart = prices.integerPart
+        item.decimalPart = prices.decimalPart
+        if (item.stockNum > 0) {
+          isOverSaled = false
+          if (!selected.id) {
+            selected = item
+          }
+        }
+
+        // 获取最小金额
+        if (smallGoods?.salePrice) {
+          smallGoods = smallGoods.salePrice <= item.salePrice ? smallGoods : item
+        } else {
+          smallGoods = item
+        }
+      });
+      if (isOverSaled) {
+        // 没有可购买商品则默认选中第一个商品
+        selected = list[0]
+      }
+
+      this.setData({
+        list,
+        instrumentList, // 乐器列表
+        isOverSaled,
+        selected,
+        smallGoods,
+        selectInstrumentId: '',
+        selectedInstrument: {},
+
+        userBeneficiaryId: '',
+        userBeneficiaryInfo: {
+          name: '',
+          phoneNumber: '',
+          schoolInfo: ''
+        }
+      }, () => {
+        this.onFormatGoods()
+      })
+    } catch (e) {
+      console.log(e, 'e')
+    }
+  },
+  // 格式化类型
+  formatPeriod(num: number, type: string) {
+    const template: any = {
+      DAY: "天卡",
+      MONTH: "月卡",
+      YEAR: "年卡"
+    }
+    if (type === "YEAR" && num >= 99) {
+      return '永久卡'
+    }
+    return num + (template[type] || '')
+  },
+
+  // 选择
+  onSelectGoods(e: any) {
+    const { dataset } = e.currentTarget
+    const item = this.data.list.find((item: any) => item.id === dataset.id)
+    // 判断是否有库存
+    if (item.stockNum <= 0) {
+      return
+    }
+    this.setData({
+      selected: item || {}
+    }, () => {
+      this.onFormatGoods()
+    })
+  },
+  /** 选中乐器 */
+  onSelectInstrument(e: any) {
+    const { dataset } = e.currentTarget;
+    if (dataset.id === this.data.selectInstrumentId) {
+      this.setData({
+        selectInstrumentId: '',
+        selectedInstrument: {}
+      }, () => {
+        this.onFormatGoods()
+      })
+    } else {
+      const item = this.data.instrumentList.find((item: any) => item.id === dataset.id);
+      this.setData({
+        selectInstrumentId: dataset.id,
+        selectedInstrument: item || {}
+      }, () => {
+        this.onFormatGoods()
+      })
+    }
+
+  },
+  isLogin() {
+    // 判断是否登录
+    if (!app.globalData.isLogin) {
+      wx.navigateTo({
+        url: '../login/login',
+      })
+      return false
+    }
+    return true
+  },
+  /** 格式化选中的商品 */
+  onFormatGoods() {
+    const selected = this.data.selected;
+    const selectedInstrument = this.data.selectedInstrument
+
+    const params = {
+      typeName: '',
+      showSalePrice: '' as any, // 显示的现价
+      originalPrice: 0, // 原价
+      salePrice: 0, // 现价
+      discountPrice: '' as any, // 已省
+      integerPart: '',
+      decimalPart: '',
+    }
+    // 选中期限
+    if (selected.id) {
+      params.typeName = selected.typeName
+      params.showSalePrice = selected.showSalePrice
+      params.originalPrice = selected.originalPrice
+      params.salePrice = selected.salePrice
+      params.discountPrice = selected.discountPrice
+
+      const prices: any = formatPrice(params.salePrice);
+      params.integerPart = prices.integerPart
+      params.decimalPart = prices.decimalPart
+    }
+    // 选中乐器
+    if (selectedInstrument.id) {
+      params.typeName = selected.typeName ? selected.typeName + '+' + selectedInstrument.name : selectedInstrument.name
+      params.originalPrice = Number(selected.originalPrice) + Number(selectedInstrument.originalPrice)
+      params.salePrice = Number(selected.salePrice) + Number(selectedInstrument.salePrice)
+      params.showSalePrice = formatPrice(params.salePrice, "ALL");
+      params.discountPrice = formatPrice(
+        params.originalPrice - params.salePrice,
+        "ALL"
+      );
+
+      const prices: any = formatPrice(params.salePrice);
+      params.integerPart = prices.integerPart
+      params.decimalPart = prices.decimalPart
+    }
+
+    this.setData({
+      formatSelectGood: params
+    })
+  },
+  onSubmit() {
+    // 判断是否登录
+    const that = this
+    if (!this.data.userBeneficiaryId) {
+      wx.showToast({
+        title: '请填写享用者的个人信息',
+        icon: 'none'
+      })
+      return
+    }
+    debounce(function () {
+      if (!that.isLogin()) {
+        return
+      }
+      const params = [] as any
+      const selected = that.data.selected
+      if (selected.id) {
+        params.push({
+          pic: selected.pic,
+          name: selected.name,
+          period: selected.period,
+          num: selected.num,
+          originalPrice: selected.originalPrice,
+          salePrice: selected.salePrice,
+          shopId: selected.shopId,
+          id: selected.id,
+          goodsType: 'ACTIVATION_CODE', // INSTRUMENTS
+        })
+      }
+      const selectedInstrument = that.data.selectedInstrument
+      if (selectedInstrument.id) {
+        params.push({
+          pic: selectedInstrument.pic,
+          name: selectedInstrument.name,
+          period: selectedInstrument?.period,
+          num: selectedInstrument?.num || 0,
+          originalPrice: selectedInstrument.originalPrice,
+          salePrice: selectedInstrument.salePrice,
+          shopId: selectedInstrument.shopId,
+          id: selectedInstrument.id,
+          goodsType: 'INSTRUMENTS', // INSTRUMENTS
+        })
+      }
+
+      let info = JSON.stringify({
+        ...params
+      });
+      info = encodeURIComponent(info);
+
+      console.log(params, "params")
+      wx.navigateTo({
+        url: `../orders/order-detail?orderInfo=${info}&userBeneficiaryId=${that.data.userBeneficiaryId}`,
+        success: () => {
+          that.setData({
+            popupShow: false,
+            currentIndex: 1,
+          })
+        }
+      })
+    }, 500)()
+  },
+})

+ 62 - 0
miniprogram/pages/select-goods/index.wxml

@@ -0,0 +1,62 @@
+<!--pages/select-goods/index.wxml-->
+<view class="container">
+  <navigation-bar title=" " background="transparent" back="{{ false }}"></navigation-bar>
+  <view class="top-bar"></view>
+
+  <view class="select-good-section">
+
+  </view>
+
+  <view class="goods-section">
+    <scroll-view class="popup-container" bounces="false" scroll-y="true" type="list">
+      <view class="popup-scroll">
+        <view class="goodsInfo">
+          <view class="desc">
+            <image src="./images/icon2.png" class="iconBefore"></image>选择规格({{ list.length }})</view>
+          <view class="goodsList">
+            <view wx:for="{{ list }}" wx:key="index" class="goodsItem {{ item.id == selected.id ? 'selected' : '' }} {{ item.stockNum <= 0 ? 'nosale' : '' }}" bind:tap="onSelectGoods" data-id="{{ item.id }}">
+              <image class="goodImg" src="{{ item.pic }}"></image>
+              <view class="infos">
+                <view class="name">{{ item.typeName }}</view>
+                <view class="price">¥<text>{{ item.showSalePrice }}</text></view>
+              </view>
+              <image class="nosale" wx:if="{{ item.stockNum <= 0 }}" src="./images/nosale.png"></image>
+            </view>
+          </view>
+        </view>
+
+        <!-- <view class="goodsInfo">
+          <view class="desc"><image src="./images/icon2.png" class="iconBefore"></image>选择乐器({{ instrumentList.length }})</view>
+          <view class="goodsList">
+            <view wx:for="{{ instrumentList }}" wx:key="index" class="goodsItem {{ item.id == selectInstrumentId ? 'selected' : '' }}" bind:tap="onSelectInstrument" data-id="{{ item.id }}">
+              {{ item.name }} <text>¥{{ item.showSalePrice }}</text>
+            </view>
+          </view>
+        </view> -->
+      </view>
+      <view style="padding-bottom: 300rpx;"></view>
+      <view class="popupBottom">
+        <!-- 有选择商品的时候 -->
+        <view class="current-item" wx:if="{{!isOverSaled && selected.id}}">
+          <!-- <view class="current-item-text">您已选择:</view> -->
+          <view class="current-top">
+            共计 <view class="prices"><text class="stuff">¥</text>
+              <text class="priceZ">{{ formatSelectGood.integerPart || 0 }}</text>
+              <text class="priceF">.{{ formatSelectGood.decimalPart || '00' }}</text>
+            </view>
+            <text class="line">|</text>原价 ¥ {{ formatSelectGood.originalPrice }}
+            <block wx:if="{{ formatSelectGood.originalPrice > formatSelectGood.salePrice }}">
+              <text class="line">|</text>
+              <text>优惠 ¥ {{ formatSelectGood.discountPrice }}</text>
+            </block>
+          </view>
+
+          <view class="current-select-text">已选:{{ formatSelectGood.typeName }}</view>
+        </view>
+        <view class="btnGroup">
+          <button type="primary" catch:tap="onSubmit">立即享受专属权益</button>
+        </view>
+      </view>
+    </scroll-view>
+  </view>
+</view>

+ 7 - 0
project.private.config.json

@@ -9,6 +9,13 @@
     "miniprogram": {
       "list": [
         {
+          "name": "pages/select-goods/index",
+          "pathName": "pages/select-goods/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
+        {
           "name": "pages/orders/order-result",
           "pathName": "pages/orders/order-result",
           "query": "orderNo=1889588449653125122&tabIdx=0",