lex-xin 5 mēneši atpakaļ
vecāks
revīzija
bbc7fa3d66

BIN
miniprogram/pages/index/buyerInformation/images/icon-back.png


+ 0 - 11
miniprogram/pages/index/buyerInformation/index.json

@@ -1,11 +0,0 @@
-{
-  "component": true,
-  "usingComponents": {
-    "van-popup": "@vant/weapp/popup/index",
-    "van-area": "@vant/weapp/area/index",
-    "van-picker": "@vant/weapp/picker/index",
-    "van-search": "@vant/weapp/search/index",
-    "van-field": "@vant/weapp/field/index",
-    "van-loading": "@vant/weapp/loading/index"
-  }
-}

+ 0 - 112
miniprogram/pages/index/buyerInformation/index.less

@@ -1,112 +0,0 @@
-/* components/buyerInformation/index.wxss */
-.icon-close {
-  position: absolute;
-  z-index: 2;
-  top: 28rpx;
-  left: 20rpx;
-  padding: 20rpx;
-  width: 36rpx;
-  height: 36rpx;
-}
-
-.container {
-  background: linear-gradient(180deg, #FFDEE7 0%, #FFFFFF 12%, #FFFFFF 100%);
-  border-radius: 32rpx 32rpx 0rpx 0rpx;
-  height: 68vh;
-}
-
-
-.pop-address-title {
-  position: relative;
-  z-index: 1;
-  text-align: center;
-  padding-top: 40rpx;
-  padding-bottom: 36rpx;
-  font-weight: 600;
-  font-size: 36rpx;
-  color: #131415;
-  line-height: 50rpx;
-}
-
-
-.section {
-  margin: 24rpx 0;
-  // background: linear-gradient(180deg, #E3F9FF 0%, #FFFFFF 9%, #FFFFFF 100%);
-  border-radius: 18rpx;
-  border: 8rpx solid #FFFFFF;
-  background-color: #fff;
-
-  .section-content {
-    background: linear-gradient(180deg, #E3F9FF 0%, #FFFFFF 9%, #FFFFFF 100%);
-    border-radius: 12rpx;
-    overflow: hidden;
-  }
-
-  .section-title {
-    width: 236rpx;
-    height: 46rpx;
-    margin: 20rpx 0 18rpx 28rpx;
-  }
-
-
-  .van-cell {
-    padding: 28rpx !important;
-    font-size: 30rpx !important;
-    line-height: 42rpx;
-
-    .van-field__label {
-      font-weight: 600;
-      color: #666666;
-    }
-
-    .van-icon-arrow {
-      color: #CCCCCC;
-      font-weight: 600;
-    }
-  }
-
-
-  .gender-section {
-    display: flex;
-
-    .gender-item {
-      margin-left: 24rpx;
-      background: rgba(28, 172, 241, 0.11);
-      border-radius: 12rpx;
-      font-weight: 500;
-      font-size: 28rpx;
-      color: #1CACF1;
-      width: 104rpx;
-      line-height: 48rpx;
-      text-align: center;
-
-      &.active {
-        background: #1CACF1;
-        color: #FFFFFF;
-      }
-    }
-  }
-}
-
-
-.van-picker-column__item--selected {
-  font-weight: 600;
-  font-size: 32rpx;
-  color: #6D4718 !important;
-}
-
-.pop-btn-group {
-  padding: 100rpx 32rpx 58rpx;
-}
-
-.submit-btn {
-  width: 100% !important;
-  margin: 0 !important;
-  padding: 0 !important;
-  line-height: 88rpx;
-  background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
-  border-radius: 88rpx;
-  font-weight: 500;
-  font-size: 32rpx;
-  color: #FBEAC9;
-}

+ 0 - 44
miniprogram/pages/index/buyerInformation/index.ts

@@ -1,44 +0,0 @@
-Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    popShow: {
-      type: Boolean,
-      default: false
-    }
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-    phone: '',
-    name: '',
-    gender: '1',
-    schoolAreaId: '',
-    schoolAreaName: '',
-    currentGradeClassTxt: '',
-    currentClass: null,
-    currentGradeNum: null,
-    cityCode: null,
-    cityName: "",
-    provinceCode: null,
-    provinceName: "",
-    regionCode: null,
-    regionName: "",
-  },
-  lifetimes: {
-    attached() {
-      // console.log(this.data, "data")
-    }
-  },
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    onCloseBuyer() {
-      this.triggerEvent("cancel", false)
-    }
-  }
-})

+ 0 - 30
miniprogram/pages/index/buyerInformation/index.wxml

@@ -1,30 +0,0 @@
-<!--components/buyerInformation/index.wxml-->
-<van-popup show="{{ popShow }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseBuyer" position="bottom" round z-index="101">
-  <image src="./images/icon-back.png" class="icon-close" bind:tap="onCloseBuyer" />
-  <view class="container">
-    <view class="pop-address-title">
-      {{ id ? '享用者信息' : '享用者信息' }}
-    </view>
-
-    <view class="section">
-      <view class="section-content">
-        <van-field required label="联系方式" model:value="{{ phone }}" maxlength="11" type="number" placeholder="请输入手机号码" input-align="right" />
-        <van-field required label="学生姓名" model:value="{{ name }}" placeholder="请输入学生姓名" input-align="right" />
-        <van-field border="{{ false }}" required label="学生性别" input-align="right">
-          <view class="gender-section" slot="button">
-            <view class="gender-item {{ gender === '1' ? 'active' : '' }}" bind:tap="onCheckGender" data-gender="1">男</view>
-            <view class="gender-item {{ gender === '0' ? 'active' : '' }}" bind:tap="onCheckGender" data-gender="0">女</view>
-          </view>
-        </van-field>
-
-        <van-field required label="所在地区" value="{{ provinceName ? provinceName + ' ' + cityName + ' ' + regionName : '' }}" bind:tap="onShowAreaList" placeholder="请选择地区" input-align="right" is-link readonly />
-        <!-- <van-field required model:value="{{ schoolAreaName }}" label="就读学校" placeholder="请选择学校" input-align="right" is-link readonly bind:tap="onSelectSchool" />
-        <van-field border="{{ false }}" value="{{ currentGradeClassTxt }}" required label="年级班级" placeholder="请选择年级" input-align="right" is-link readonly bind:tap="onSelectGradeClass" /> -->
-      </view>
-    </view>
-  </view>
-
-  <view class="pop-btn-group">
-    <button class="submit-btn" bind:tap="onOperationAddress">确认</button>
-  </view>
-</van-popup>

+ 54 - 26
miniprogram/pages/index/index.ts

@@ -525,7 +525,7 @@ Page({
     this.setData({
       showBuyer: false
     }, () => {
-      if(!this.data.userBeneficiaryId) {
+      if (!this.data.userBeneficiaryId) {
         this.onSetCatch(this.data)
       }
     })
@@ -673,19 +673,21 @@ Page({
   },
   /** 获取学校详情 */
   async getSchoolAreaDetail() {
-    if(!this.data.schoolAreaId) return
+    if (!this.data.schoolAreaId) return
     const { data } = await api_schoolAreaDetail({ id: this.data.schoolAreaId })
     const result = data.data || {}
+
+    let tempGradeGradeList: any = []
+    let tempClassList: any = []
+    let schoolInstrumentSetType = ''
     if (result.school) {
       const schoolInfo = result.school || {};
       const schoolInstrumentList = schoolInfo.schoolInstrumentList || [];
       // forms.schoolInstrumentSetType = schoolInfo.instrumentSetType;
       if (schoolInfo.instrumentSetType === 'SCHOOL') {
-        this.setData({
-          gradeGradeList: getGradeList(schoolInfo.gradeYear),
-          classList: classList,
-          schoolInstrumentSetType: schoolInfo.instrumentSetType
-        })
+        tempGradeGradeList = getGradeList(schoolInfo.gradeYear)
+        tempClassList = classList
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
       } else if (schoolInfo.instrumentSetType === 'GRADE') {
         const gradeList: any = []
         schoolInstrumentList.forEach((item: any) => {
@@ -696,11 +698,9 @@ Page({
           })
         });
         gradeList.sort((a: any, b: any) => a.value - b.value);
-        this.setData({
-          gradeGradeList: gradeList,
-          classList: classList,
-          schoolInstrumentSetType: schoolInfo.instrumentSetType
-        })
+        tempGradeGradeList = gradeList
+        tempClassList = classList
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
       } else if (schoolInfo.instrumentSetType === 'CLASS') {
         //   // 班级
         const tempGradeList: any[] = [];
@@ -738,23 +738,51 @@ Page({
         });
         lastGradeList.sort((a: any, b: any) => a.value - b.value);
 
-        this.setData({
-          gradeGradeList: lastGradeList,
-          classList: lastGradeList[this.data.gradeGradeIndex]?.classList || [],
-          schoolInstrumentSetType: schoolInfo.instrumentSetType
-        })
+        tempGradeGradeList = lastGradeList
+        tempClassList = lastGradeList[this.data.gradeGradeIndex]?.classList || []
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
       } else {
-        this.setData({
-          gradeGradeList: getGradeList(),
-          classList: classList,
-          schoolInstrumentSetType: ''
-        })
+        tempGradeGradeList = getGradeList()
+        tempClassList = classList
+        schoolInstrumentSetType = ''
       }
     } else {
+      tempGradeGradeList = getGradeList()
+      tempClassList = classList
+      schoolInstrumentSetType = ''
+    }
+
+
+    // 格式化年级班级 - 如果后台改了学校配置,本地保存了缓存,判断年级、班级是否存在
+    const gradeIndex = this.data.gradeGradeIndex
+    const classIndex = this.data.classIndex
+    console.log(tempGradeGradeList, tempClassList)
+    if ((tempGradeGradeList.length || 0) - 1 < gradeIndex) {
+      this.setData({
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType,
+        gradeGradeIndex: 0,
+        classIndex: 0,
+        currentClass: null,
+        currentClassTxt: '',
+        currentGradeNum: null,
+        currentGradeTxt: ''
+      })
+    } else if ((tempClassList.length || 0) - 1 < classIndex) {
+      this.setData({
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType,
+        classIndex: 0,
+        currentClass: null,
+        currentClassTxt: '',
+      })
+    } else {
       this.setData({
-        gradeGradeList: getGradeList(),
-        classList: classList,
-        schoolInstrumentSetType: ''
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType
       })
     }
   },
@@ -990,7 +1018,7 @@ Page({
         return
       }
 
-      if(!params.gender) {
+      if (!params.gender) {
         wx.showToast({
           title: '请选择性别',
           icon: 'none'

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

@@ -163,7 +163,6 @@
         </view>
 
         <!-- <service popShow="{{ showService }}" bind:changePop="changePop"></service> -->
-        <!-- <buyerInformation popShow="{{ showBuyer }}" bind:cancel="onCloseBuyer" /> -->
         <van-popup show="{{ showBuyer }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseBuyer" position="bottom" round z-index="101">
           <image src="./images/icon-back.png" class="icon-close-pop" bind:tap="onCloseBuyer" />
           <view class="container-pop">

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

@@ -229,7 +229,6 @@ page {
       font-weight: 400;
       font-size: 24rpx;
       color: #777777;
-      vertical-align: middle;
     }
 
     .stuff {
@@ -341,7 +340,7 @@ page {
 .order-time {
   margin: 24rpx 26rpx 0;
   border-radius: 20rpx;
-  padding: 36rpx 24rpx;
+  padding: 28rpx 24rpx;
   background-color: #FFFFFF;
 
   .order-item {
@@ -355,9 +354,11 @@ page {
       font-size: 28rpx;
       color: #131415;
       line-height: 40rpx;
+      flex-shrink: 0;
+      padding-right: 26rpx;
     }
     .value {
-      font-size: 30rpx;
+      font-size: 28rpx;
       color: #777777;
       line-height: 42rpx;
       display: flex;
@@ -366,7 +367,7 @@ page {
       }
 
       .copy {
-        font-size: 30rpx;
+        font-size: 28rpx;
         color: #FE2451;
         line-height: 42rpx;
         display: flex;

+ 50 - 119
miniprogram/pages/orders/order-result.ts

@@ -1,7 +1,6 @@
 // pages/orders/order-detail.ts
-import drawQrcode from "../../utils/weapp.qrcode.esm";
-import { api_userPaymentCancelRefund, api_userPaymentOrderDetail, api_userPaymentOrderRefundPayment } from "../../api/login";
-import { formatPrice } from "../../utils/util";
+import { api_userPaymentOrderDetail } from "../../api/login";
+import { formatPrice, GRADE_ENUM } from "../../utils/util";
 
 // 获取应用实例
 Page({
@@ -46,12 +45,6 @@ Page({
     timer: null as any,
     goodsInfo: {} as any,
     orderNo: "" as string,
-    showCanvas: false, // 是否显示二维码
-    tabIdx: 0, // 当前是从哪个tab来的
-    canvasImg: "" as string,
-    showService: false,
-    refoundStatus: false,
-    cancelRefoundStatus: false,
   },
 
   /**
@@ -60,8 +53,7 @@ Page({
   onLoad(options: any) {
     if (options.orderNo) {
       this.setData({
-        orderNo: options.orderNo,
-        tabIdx: options.tabIdx
+        orderNo: options.orderNo
       });
     }
   },
@@ -80,21 +72,44 @@ Page({
         goodsInfos.forEach((item: any) => {
           tempGoods.push({
             ...item,
-            // shortUrl: item.activationCodeInfo.shortUrl,
-            // code: item.activationCodeInfo.activationCode,
-            originalPrice: formatPrice(item.paymentCashAmount, 'ALL'),
-            // typeName: this.formatPeriod(item.activationCodeInfo?.times || 1, item.activationCodeInfo.type)
+            // originalPrice: formatPrice(item.originalPrice, 'ALL'),
+            typeName: this.formatPeriod(item.activationCodeInfo?.times || 1, item.activationCodeInfo?.type)
           })
         })
+
+        const addresses = {
+          id: result.addresses?.id,
+          name: result.addresses?.name,
+          phoneNumber: result.addresses?.phoneNumber,
+          addressDetail: result.addresses?.detailAddress
+        }
+
+        const tempSchoolAddress = [result.beneficiary?.provinceName || '', result.beneficiary?.cityName || '', result.beneficiary?.regionName || '', result.beneficiary?.schoolAreaName, GRADE_ENUM[result.beneficiary?.currentGradeNum], result.beneficiary?.currentClass + '班']
+        const beneficiary = {
+          id: result.beneficiary?.schoolAreaId,
+          name: result.beneficiary?.name,
+          phoneNumber: result.beneficiary?.phone,
+          schoolInfo: tempSchoolAddress.join('')
+        }
+
+        const allDiscountPrice: any = formatPrice(result.originalPrice - result.paymentCashAmount)
+        const allAfterPrice: any = formatPrice(result.paymentCashAmount)
         
-        const firstGoods = tempGoods[0]
         const goodsInfo = {
+          discountIntegerPart: allDiscountPrice.integerPart,
+          discountDecimalPart: allDiscountPrice.decimalPart,
+          paymentCashAmount: result.paymentCashAmount,
+          originalPrice: result.originalPrice,
+          integerPart:  allAfterPrice.integerPart,
+          decimalPart: allAfterPrice.decimalPart,
           orderNo: result.orderNo,
           createTime: result.createTime,
           wechatStatus: result.wechatStatus,
           goods: tempGoods,
-          code: firstGoods.code || ''
+          addresses,
+          beneficiary
         }
+        console.log(goodsInfos, "goodsInfo")
         this.setData({
           goodsInfo,
           status: result.wechatStatus
@@ -128,78 +143,24 @@ Page({
   },
   onTimeout() {
     // 轮询10次查询订单状态
-    const goodsInfo = this.data.goodsInfo
-    const timerCount = this.data.timerCount
-    const timer = this.data.timer
-    if(goodsInfo.wechatStatus === 'WAIT_PAY' && timerCount <= 10) {
-      let count = timerCount
-      const tempT = setTimeout(async () => {
-        count += 1
-        await this.getDetail()
-        this.setData({
-          timer: tempT,
-          timerCount: count
-        }, () => {
-          this.onTimeout()
-        })
-      }, 3000);
-    } else {
-      clearTimeout(timer)
-    }
-  },
-  /** 客服 */
-  onService() {
-    this.setData({
-      showService: true
-    })
-  },
-  changePop(event: { detail: any }) {
-    this.setData({
-      showService: event.detail
-    })
-  },
-  /** 申请退款 */
-  async cancelRefound() {
-    this.setData({
-      cancelRefoundStatus: true
-    }, async () => {
-      try {
-        const {data} = await api_userPaymentCancelRefund(this.data.goodsInfo.refundOrderId)
-        // console.log(data, 'data')
-        if(data.code == 200) {
-          wx.showToast({ title: '取消退款成功', icon: 'none' })
-          this.getDetail()
-        } else {
-          wx.showToast({ title: data.message, icon: 'none' })
-        }
-        setTimeout(() => {
-          this.setData({
-            cancelRefoundStatus: false
-          })
-        }, 500);
-      } catch {}
-    })
-    
-  },
-  /** 申请退款 */
-  useRefound() {
-    this.setData({
-      refoundStatus: true
-    })
-  },
-  changeRefoundStatus(e: {detail: any}) {
-    this.setData({
-      refoundStatus: e.detail
-    })
-  },
-  onRefoundComfirm() {
-    this.setData({
-      refoundStatus: false
-    })
-    // wx.navigateBack({
-    //   delta: 1
-    // })
-    this.getDetail()
+    // const goodsInfo = this.data.goodsInfo
+    // const timerCount = this.data.timerCount
+    // const timer = this.data.timer
+    // if(goodsInfo.wechatStatus === 'WAIT_PAY' && timerCount <= 10) {
+    //   let count = timerCount
+    //   const tempT = setTimeout(async () => {
+    //     count += 1
+    //     await this.getDetail()
+    //     this.setData({
+    //       timer: tempT,
+    //       timerCount: count
+    //     }, () => {
+    //       this.onTimeout()
+    //     })
+    //   }, 3000);
+    // } else {
+    //   clearTimeout(timer)
+    // }
   },
   onCopy(e: { currentTarget: any }) {
     wx.setClipboardData({
@@ -212,36 +173,6 @@ Page({
       }
     })
   },
-  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',
-        });
-      }
-    })
-  },
   onShareAppMessage() {
     return {
       title: '器乐数字AI工具',

+ 5 - 34
miniprogram/pages/orders/order-result.wxml

@@ -37,12 +37,12 @@
             </view>
           </view>
 
-          <view class="goodsInfo-item" wx:if="{{ goodsInfo.allOriginPrice > goodsInfo.allSalePrice }}">
+          <view class="goodsInfo-item" wx:if="{{ goodsInfo.originalPrice > goodsInfo.paymentCashAmount }}">
             <text class="title">惊喜优惠</text>
 
             <!-- <view class="calc-price">-¥ {{ goodsInfo.allDiscountPrice }}</view> -->
             <view class="goods-price calc-price">
-              <text class="stuff">¥</text>
+              <text class="stuff">-¥</text>
               <text class="priceZ">{{ goodsInfo.discountIntegerPart }}</text>
               <text class="priceF">.{{ goodsInfo.discountDecimalPart }}</text>
             </view>
@@ -52,7 +52,7 @@
 
           <view class="goodsInfo-count">
             <view class="goods-price">
-              <text class="before">共{{ goodsInfo.goodsList.length }}件:</text>
+              <text class="before">共{{ goodsInfo.goods.length }}件:</text>
               <text class="stuff">¥</text>
               <text class="priceZ">{{ goodsInfo.integerPart }}</text>
               <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
@@ -65,7 +65,7 @@
 
       <view class="order-time">
         <view class="order-item">
-          <view class="title">订单号</view>
+          <view class="title">订单号</view>
           <view class="value">{{ goodsInfo.orderNo }}
             <view class="copy" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
           </view>
@@ -76,39 +76,10 @@
         </view>
       </view>
 
-      <view class="order-time" wx:if="{{ goodsInfo.wechatStatus == 'REFUNDED' || goodsInfo.wechatStatus == 'REFUNDING' }}">
-        <view class="order-item">
-          <view class="title">{{ goodsInfo.wechatStatus == 'REFUNDED' ? '退款时间' : '申请退款时间' }}</view>
-          <view class="value">{{ goodsInfo.refundTime }}</view>
-        </view>
-        <view class="order-item">
-          <view class="title">退款金额</view>
-          <view class="value red">¥{{ goodsInfo.refundAmount }}</view>
-        </view>
-        <view class="order-item" wx:if="{{ goodsInfo.wechatStatus == 'REFUNDED' }}">
-          <view class="title">退款路径</view>
-          <view class="value">{{ goodsInfo.refundStyleStr }}</view>
-        </view>
-      </view>
-
-      <view class="btn-refound" bind:tap="useRefound" wx:if="{{ goodsInfo.wechatStatus == 'WAIT_USE' && tabIdx == 5 }}">申请退款</view>
     </view>
   </scroll-view>
 
   <view class="order-btn" wx:if="{{ goodsInfo.wechatStatus != 'WAIT_PAY' }}">
-    <view class="orders" bind:tap="onService">
-      <image src="./images/icon-service.png" />
-      <text>客服</text>
-    </view>
-    <!-- <button type="primary" bind:tap="useRefound" wx:if="{{ goodsInfo.wechatStatus == 'WAIT_USE' }}">申请退款</button>
-    <block wx:else> -->
-    <button type="primary" bind:tap="cancelRefound" disabled="{{cancelRefoundStatus}}" wx:if="{{ goodsInfo.wechatStatus == 'REFUNDING' }}">取消退款</button>
-    <button type="primary" wx:else bind:tap="onSubmit">再来一单</button>
-    <!-- </block> -->
+    <button type="primary" bind:tap="onSubmit">再来一单</button>
   </view>
-
-  <service popShow="{{ showService }}" bind:changePop="changePop"></service>
-
-  <!-- 退费 -->
-  <apply-refound refoundStatus="{{ refoundStatus }}" goodsInfo="{{goodsInfo}}" bind:changeRefoundStatus="changeRefoundStatus" bind:onConfirm="onRefoundComfirm"></apply-refound>
 </view>

+ 7 - 0
project.private.config.json

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