lex-xin 8 bulan lalu
induk
melakukan
fcb1833989

+ 2 - 1
miniprogram/app.json

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

+ 1 - 1
miniprogram/components/navigation-bar/navigation-bar.ts

@@ -64,7 +64,7 @@ Component({
       const wxWindowInfo = wx.getWindowInfo()
       const isAndroid = wxDeviceInfo.platform === 'android'
       const isDevtools = wxDeviceInfo.platform === 'devtools'
-      console.log(wxWindowInfo, wxDeviceInfo, 'wxDeviceInfo----')
+      // console.log(wxWindowInfo, wxDeviceInfo, 'wxDeviceInfo----')
       this.setData({
         ios: !isAndroid,
         innerPaddingRight: `padding-right: ${wxWindowInfo.windowWidth - rect.left}px`,

+ 5 - 0
miniprogram/pages/download/download.json

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

+ 62 - 0
miniprogram/pages/download/download.less

@@ -0,0 +1,62 @@
+/* pages/download/download.wxss */
+page {
+  height: 100vh;
+  display: flex;
+  flex-direction: column;
+  background: #F4F4F4;
+}
+
+.pageInfo {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+}
+.record-content {
+  display: flex;
+  flex-direction: column;
+  width: 100%;
+  flex: 1;
+  overflow-y: auto;
+}
+
+.record-list {
+  flex: 1;
+  overflow-y: scroll;
+  box-sizing: border-box;
+}
+.container {
+  background: url('https://oss.dayaedu.com/ktyq/1733231022871.png') no-repeat top center;
+  background-size: contain;
+  background-color: #FFFFFF;
+
+  .section {
+    display: flex;
+    align-items: center;
+    flex-direction: column;
+    padding: 414rpx 20rpx 190rpx;
+  }
+
+  .qrCodeImg  {
+    width: 296rpx;
+    height: 296rpx;
+  }
+
+  .func {
+    width: 100%;
+    margin: 23px 0 0;
+  }
+
+  .btnGroup {
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    width: 100%;
+    padding: 16px 20px 30px;
+    background: linear-gradient( 180deg, rgba(255,255,255,0) 0%, #FFFFFF 50%, #FFFFFF 100%);
+    box-sizing: border-box;
+    .btnImg {
+      width: 100%;
+    }
+  }
+}

+ 91 - 0
miniprogram/pages/download/download.ts

@@ -0,0 +1,91 @@
+// pages/download/download.ts
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isIOS: false,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad() {
+    const wxDeviceInfo = wx.getDeviceInfo()
+    const isAndroid = wxDeviceInfo.platform === 'android'
+    this.setData({
+      isIOS: !isAndroid
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+  onDownload() {
+    wx.downloadFile({
+      url: 'https://oss.dayaedu.com/ktyq/1733277847031.png',
+      success: (res) => {
+        wx.saveImageToPhotosAlbum({
+          filePath: res.tempFilePath,
+          success: () => { 
+            wx.showToast({
+              title: '保存成功',
+              icon: 'success',
+            });
+          },
+          fail: () => {
+            wx.showToast({
+              title: '保存失败',
+              icon: 'none',
+            });
+          }
+        })
+      }
+    })
+  },
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 19 - 0
miniprogram/pages/download/download.wxml

@@ -0,0 +1,19 @@
+<!--pages/download/download.wxml-->
+<view class="pageInfo">
+  <navigation-bar title="下载音乐数字课堂"></navigation-bar>
+  <view class="record-content">
+    <scroll-view class="record-list" type="list" scroll-y>
+      <view class="container">
+        <view class="section">
+          <image src="https://oss.dayaedu.com/ktyq/1733226456374.png" class="qrCodeImg"></image>
+          <image wx:if="isIOS" mode="widthFix" src="https://oss.dayaedu.com/ktyq/1733230943390.png" class="func"></image>
+          <image wx:else mode="widthFix" src="https://oss.dayaedu.com/ktyq/1733233798354.png" class="func"></image>
+        </view>
+
+        <view class="btnGroup">
+          <image mode="widthFix" bind:tap="onDownload" src="https://oss.dayaedu.com/ktyq/1733230976760.png" class="btnImg"></image>
+        </view>
+      </view>
+    </scroll-view>
+  </view>
+</view>

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

@@ -25,6 +25,7 @@ Page({
       "https://oss.dayaedu.com/ktyq/1732706055542.png",
       "https://oss.dayaedu.com/ktyq/1732706066094.png"
     ],
+    serviceShow: true,
     current: 0,
     // autoplay: false,
     // interval: 5000,
@@ -221,12 +222,15 @@ Page({
         isFromPreviewImage: false
       })
     }
+    this.setData({
+      serviceShow: true
+    })
+  },
+  onHide() {
+    this.setData({
+      serviceShow: false
+    })
   },
-  // openService() {
-  //   wx.navigateTo({
-  //     url: '../service/service'
-  //   })
-  // },
   onScroll(e: { detail: any }) {
     // console.log(e, 'any')
     const scrollTop = e.detail.scrollTop || 0

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

@@ -106,5 +106,5 @@
   </view>
 
   <!-- 客服 -->
-  <service bind:openService="openService"></service>
+  <service wx:if="{{serviceShow}}"></service>
 </scroll-view>

+ 11 - 5
miniprogram/pages/orders/order-detail.ts

@@ -8,6 +8,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    serviceShow: true,
     status: 'ing',
     statusList: {
       ing: {
@@ -35,6 +36,16 @@ Page({
       });
     }
   },
+  onShow() {
+    this.setData({
+      serviceShow: true
+    })
+  },
+  onHide() {
+    this.setData({
+      serviceShow: false
+    })
+  },
   // 获取后台配置的支付方式
   async queryPayType() {
     try {
@@ -169,11 +180,6 @@ Page({
       }
     })
   },
-  openService() {
-    wx.navigateTo({
-      url: '../service/service'
-    })
-  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 1 - 1
miniprogram/pages/orders/order-detail.wxml

@@ -55,5 +55,5 @@
       <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '立即支付' }}</button>
   </view>
     <!-- 客服 -->
-    <service bind:openService="openService"></service>
+    <service wx:if="{{serviceShow}}"></service>
 </view>

+ 34 - 4
miniprogram/pages/orders/order-result.less

@@ -181,7 +181,7 @@ page {
   margin-top: 28rpx;
   border-top: 2rpx solid #F0F0F0;
   padding-top: 60rpx;
-  padding-bottom: 32rpx;
+  padding-bottom: 22rpx;
   text-align: center;
   display: flex;
   flex-direction: column;
@@ -224,16 +224,46 @@ page {
   .qrcode-text {
     display: inline-block;
     margin-top: 32rpx;
-    padding: 16rpx 32rpx;
+    padding: 16rpx 32rpx 0;
     font-weight: 500;
     font-size: 28rpx;
     color: #131415;
     line-height: 40rpx;
-    background: #FFE7C7;
+    // background: #FFE7C7;
     border-radius: 36rpx;
 
     &.used {
-      background: #F2F2F2;
+      // background: #F2F2F2;
+      color: #AAAAAA;
+    }
+  }
+
+  .qrcode-btn--section {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    // padding-bottom: 22rpx;
+    padding-top: 32rpx;
+    button {
+      border-radius: 78rpx;
+      // line-height: 68rpx;
+      padding: 14rpx 30rpx;
+      width: auto;
+      border-radius: 68rpx;
+      font-weight: 500;
+      font-size: 28rpx;
+      margin: 0 16rpx;
+      min-width: 200rpx;
+      box-sizing: border-box;
+    }
+    .submit {
+      background: linear-gradient( 315deg, #FF4A00 0%, #FE8C00 100%);
+      color: #FFFFFF;
+    }
+    .download {
+      background: #FFEADE;
+      
+      color: #FF5000;
     }
   }
 }

+ 47 - 5
miniprogram/pages/orders/order-result.ts

@@ -48,6 +48,7 @@ Page({
     orderNo: "" as string,
     showCanvas: false, // 是否显示二维码
     canvasImg: "" as string,
+    serviceShow: true,
     refoundStatus: false,
     cancelRefoundStatus: false
   },
@@ -65,6 +66,19 @@ Page({
       });
     }
   },
+  onShow() {
+    this.setData({
+      serviceShow: true
+    })
+    if(this.data.orderNo) {
+      this.getDetail(this.onTimeout)
+    }
+  },
+  onHide() {
+    this.setData({
+      serviceShow: false
+    })
+  },
   async getDetail(callback?: any) {
     try {
       const { data } = await api_userPaymentOrderDetail(this.data.orderNo);
@@ -80,6 +94,7 @@ Page({
             integerPart: prices.integerPart,
             decimalPart: prices.decimalPart,
             shortUrl: item.activationCodeInfo.shortUrl,
+            code: item.activationCodeInfo.activationCode,
             originalPrice: this.formatPrice(item.paymentCashAmount, 'ALL'),
             typeName: this.formatPeriod(item.activationCodeInfo?.times || 1, item.activationCodeInfo.type)
           })
@@ -90,11 +105,13 @@ Page({
         } else if(result.refundStyle === 'OFFLINE') {
           refundStyleStr = '线下'
         }
+        const firstGoods = tempGoods[0]
         const goodsInfo = {
           orderNo: result.orderNo,
           createTime: result.createTime,
           wechatStatus: result.wechatStatus,
           goods: tempGoods,
+          code: firstGoods.code || '',
           refundOrderId: result.refundOrderId,
           refundTime: result.refundTime,
           refundAmount: this.formatPrice(result.refundAmount || 0, 'ALL'),
@@ -211,11 +228,6 @@ Page({
       clearTimeout(timer)
     }
   },
-  openService() {
-    wx.navigateTo({
-      url: '../service/service'
-    })
-  },
   /** 申请退款 */
   async cancelRefound() {
     this.setData({
@@ -268,5 +280,35 @@ Page({
         wx.showToast({title: '复制失败,请稍后再试', icon: 'none'})
       }
     })
+  },
+  onActivation(e: { currentTarget: any  }) {
+    const code = e.currentTarget.dataset.code || ''
+    if(!code) {
+      wx.showToast({
+        title: '暂无法激活',
+        icon: 'none'
+      })
+      return
+    }
+    wx.navigateTo({
+      url: '../protocol/register?type=activation&code=' + code
+    })
+  },
+  onDownload() {
+    wx.saveImageToPhotosAlbum({
+      filePath: this.data.canvasImg,
+      success: () => { 
+        wx.showToast({
+          title: '保存成功',
+          icon: 'success',
+        });
+      },
+      fail: () => {
+        wx.showToast({
+          title: '保存失败',
+          icon: 'none',
+        });
+      }
+    })
   }
 })

+ 7 - 3
miniprogram/pages/orders/order-result.wxml

@@ -41,9 +41,13 @@
             <view class="loader" wx:if="{{!canvasImg}}"></view>
           </view>
           <view>
-            <view class="qrcode-text" wx:if="{{goodsInfo.wechatStatus == 'WAIT_USE'}}">扫描二维码激活使用</view>
-            <view class="qrcode-text used" wx:else>二维码已使用</view>
+            <view class="qrcode-text" wx:if="{{goodsInfo.wechatStatus == 'WAIT_USE'}}">扫描二维码或点击激活按钮使用</view>
+            <view class="qrcode-text used" wx:else>二维码已激活</view>
           </view>
+          <view class="qrcode-btn--section" wx:if="{{goodsInfo.wechatStatus == 'WAIT_USE'}}">
+              <button class="download" disabled="{{ !canvasImg ? true : false }}" bind:tap="onDownload">下载二维码</button>
+              <button class="submit" disabled="{{ !canvasImg ? true : false }}"  bind:tap="onActivation" data-code="{{ goodsInfo.code }}">立即激活</button>
+            </view>
         </view>
       </view>
 
@@ -87,7 +91,7 @@
   </view>
 
    <!-- 客服 -->
-   <service bind:openService="openService"></service>
+   <service wx:if="{{serviceShow}}"></service>
 
   <!-- 退费 -->
   <apply-refound refoundStatus="{{ refoundStatus }}" goodsInfo="{{goodsInfo}}" bind:changeRefoundStatus="changeRefoundStatus" bind:onConfirm="onRefoundComfirm"></apply-refound>

+ 8 - 6
miniprogram/pages/orders/orders.ts

@@ -42,6 +42,7 @@ Page({
     rows: 10,
     recordList: [],
     maxPage: 1, // 总分页数
+    serviceShow: true,
     refoundStatus: false,
     cancelRefoundStatus: false,
     goodsInfo: {}, // 选中的数据
@@ -54,6 +55,7 @@ Page({
   },
   onShow() {
     this.setData({
+      serviceShow: true,
       page: 1,
       maxPage: 1,
       recordList: [],
@@ -61,6 +63,11 @@ Page({
       this.getList()
     })
   },
+  onHide() {
+    this.setData({
+      serviceShow: false
+    })
+  },
   /** 切换分类 */
   switchTab(e: { currentTarget: { dataset: { idx: any } } }) {
     const idx = e.currentTarget.dataset.idx;
@@ -374,10 +381,5 @@ Page({
         this.getList()
       })
     }, 1500);
-  },
-  openService() {
-    wx.navigateTo({
-      url: '../service/service'
-    })
-  },
+  }
 })

+ 1 - 1
miniprogram/pages/orders/orders.wxml

@@ -62,7 +62,7 @@
     </scroll-view>
   </view>
   <!-- 客服 -->
-  <service bind:openService="openService"></service>
+  <service wx:if="{{serviceShow}}"></service>
   <!-- 申请退款 -->
   <apply-refound refoundStatus="{{ refoundStatus }}" goodsInfo="{{goodsInfo}}" bind:changeRefoundStatus="changeRefoundStatus" bind:onConfirm="onRefoundComfirm"></apply-refound>
 </view>

+ 19 - 10
miniprogram/pages/protocol/register.ts

@@ -23,20 +23,29 @@ Page({
         this.setData({
           src: app.globalData.baseUrl + '/classroom-app/#/preview-protocol?wx=2'
         })
+      } else if(options.type == 'activation') {
+        this.setData({
+          src: app.globalData.baseUrl + '/classroom-app/#/activationRegister?wx=wx_lite&code=' + options.code
+        })
+        // this.setData({
+        //   src: app.globalData.baseUrl + '/classroom-app/#/download?wx=wx_lite'
+        // })
       }
     }
-    // if(options.orderInfo) {
-    //   const orderInfo = JSON.parse(decodeURIComponent(options.orderInfo));
-    //   // console.log(orderInfo, app.globalData.baseUrl + `/classroom-app/?code=081xNSll2ff0xe4sb4ll2RxTRv0xNSlk#/payResult?paymentType=${orderInfo.paymentType}&pay_channel=${orderInfo.pay_channel}&wxAppId=${orderInfo.wxAppId}&body=${orderInfo.body}&price=${orderInfo.price}&orderNo=${orderInfo.orderNo}&userId=${orderInfo.userId}`)
-    //   const url = app.globalData.baseUrl + `/classroom-app/?code=0811HI0w3EfxT337iM1w3MifZf01HI0G#/payResultWechat?paymentType=${orderInfo.paymentType}&pay_channel=${orderInfo.pay_channel}&wxAppId=${orderInfo.wxAppId}&body=${orderInfo.body}&price=${orderInfo.price}&orderNo=${orderInfo.orderNo}&userId=${orderInfo.userId}`
-    //   this.setData({
-    //     src: url
-    //   }, () => {
-    //     console.log(this.data.src, 'src')
-    //   })
+  },
+  onPostMessage() {
+    // console.log(e, 'e------------------')
+    // https://oss.dayaedu.com/ktyq/1723428765364.apk
+    // const 
+    // const data = e.detail.data || []
+    // if(data.length <= 0) {
+    //   return
     // }
+    // data.forEach((item: any) => {
+    //   if(item.action === 'download') {
+    //   }
+    // })
   },
-
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 1 - 1
miniprogram/pages/protocol/register.wxml

@@ -1,4 +1,4 @@
 <!--pages/protocol/register.wxml-->
 <view class="container">
-    <web-view src="{{ src }}"></web-view>
+    <web-view src="{{ src }}" bindmessage="onPostMessage"></web-view>
 </view>