Просмотр исходного кода

优化权益人手机号功能

lex-wxl 5 часов назад
Родитель
Сommit
0433eb07c2

+ 1 - 1
miniprogram/config.ts

@@ -1,4 +1,4 @@
-const environmentVariable = "online";
+const environmentVariable = "test";
 const apiUrlInfo = {
 const apiUrlInfo = {
   dev: "https://dev.kt.colexiu.com",
   dev: "https://dev.kt.colexiu.com",
   test: "https://test.kt.colexiu.com",
   test: "https://test.kt.colexiu.com",

+ 7 - 0
miniprogram/pages/index/index.less

@@ -990,4 +990,11 @@ page {
     text-align: center;
     text-align: center;
     padding-top: 18px;
     padding-top: 18px;
   }
   }
+}
+
+.addPhone {
+  margin: 24rpx 40rpx 24rpx;
+  border: 1px solid #F6F6F6;
+  border-radius: 20rpx;
+  overflow: hidden;
 }
 }

+ 13 - 4
miniprogram/pages/index/index.ts

@@ -124,6 +124,7 @@ Page({
       value: '0',
       value: '0',
       className: 'two-gender cancel-gender'
       className: 'two-gender cancel-gender'
     }],
     }],
+    userNote: '', // 存储用户手机号
     userBeneficiaryId: '', // 选中用户的编号
     userBeneficiaryId: '', // 选中用户的编号
     userBeneficiaryInfo: {
     userBeneficiaryInfo: {
       name: '',
       name: '',
@@ -423,10 +424,17 @@ Page({
   onSubmit() {
   onSubmit() {
     // 判断是否登录
     // 判断是否登录
     const that = this
     const that = this
-    if (!this.data.userBeneficiaryId) {
+    // if (!this.data.userBeneficiaryId) {
+    //   wx.showToast({
+    //     title: '请填写享用者的个人信息',
+    //     icon: 'none'
+    //   })
+    //   return
+    // }
+    if (!this.data.userNote || !/^1[3456789]\d{9}$/.test(this.data.userNote)) {
       wx.showToast({
       wx.showToast({
-        title: '请填写享用者的个人信息',
-        icon: 'none'
+        title: '请输入正确的手机号',
+        icon: "none"
       })
       })
       return
       return
     }
     }
@@ -470,7 +478,8 @@ Page({
       info = encodeURIComponent(info);
       info = encodeURIComponent(info);
 
 
       wx.navigateTo({
       wx.navigateTo({
-        url: `../orders/order-detail?orderInfo=${info}&userBeneficiaryId=${that.data.userBeneficiaryId}`,
+        // url: `../orders/order-detail?orderInfo=${info}&userBeneficiaryId=${that.data.userBeneficiaryId}`,
+        url: `../orders/order-detail?orderInfo=${info}&userNote=${that.data.userNote}`,
         success: () => {
         success: () => {
           that.setData({
           that.setData({
             popupShow: false
             popupShow: false

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

@@ -105,8 +105,12 @@
       <!-- <view class="popup-container"> -->
       <!-- <view class="popup-container"> -->
       <view class="popup-scroll">
       <view class="popup-scroll">
         <image src="https://oss.dayaedu.com/ktyq/01/1767886728137.png" mode="widthFix" class="top-vip-img"></image>
         <image src="https://oss.dayaedu.com/ktyq/01/1767886728137.png" mode="widthFix" class="top-vip-img"></image>
+        <!-- 添加手机号 -->
+        <view class="addPhone">
+          <van-field border="{{false}}" model:value="{{ userNote }}" maxlength="11" type="number" placeholder="请输入权益人手机号" />
+        </view>
         <!-- 添加权益人 -->
         <!-- 添加权益人 -->
-        <view class="addBuyer" bind:tap="onSelectBuyer">
+        <!-- <view class="addBuyer" bind:tap="onSelectBuyer">
           <view class="addBuyer-left">
           <view class="addBuyer-left">
             <image src="./images/icon-man.png" class="icon-man"></image>
             <image src="./images/icon-man.png" class="icon-man"></image>
             <view class="info" wx:if="{{ userBeneficiaryId }}">
             <view class="info" wx:if="{{ userBeneficiaryId }}">
@@ -123,7 +127,7 @@
             </view>
             </view>
           </view>
           </view>
           <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
           <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
-        </view>
+        </view> -->
 
 
         <view class="goodsInfo">
         <view class="goodsInfo">
           <view class="desc">会员有效期</view>
           <view class="desc">会员有效期</view>

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

@@ -30,6 +30,7 @@ Page({
       phoneNumber: ''
       phoneNumber: ''
     },
     },
     userBeneficiaryId: '', // 添加购买人信息
     userBeneficiaryId: '', // 添加购买人信息
+    userNote: '', // 购买人手机号
     userBeneficiaryInfo: {
     userBeneficiaryInfo: {
       name: '',
       name: '',
       phoneNumber: '',
       phoneNumber: '',
@@ -124,6 +125,7 @@ Page({
       this.setData({
       this.setData({
         goodsInfo: infos,
         goodsInfo: infos,
         userBeneficiaryId: options.userBeneficiaryId,
         userBeneficiaryId: options.userBeneficiaryId,
+        userNote: options.userNote,
         status: options.status || '',
         status: options.status || '',
         hasInstrument
         hasInstrument
       }, () => {
       }, () => {
@@ -151,6 +153,7 @@ Page({
           phoneNumber: addresses?.phoneNumber
           phoneNumber: addresses?.phoneNumber
         },
         },
         userBeneficiaryId: beneficiary.schoolAreaId, // 添加购买人信息
         userBeneficiaryId: beneficiary.schoolAreaId, // 添加购买人信息
+        userNote: beneficiary.userNote, // 添加购买人手机号
         userBeneficiaryInfo: {
         userBeneficiaryInfo: {
           name: beneficiary.name,
           name: beneficiary.name,
           phoneNumber: beneficiary.phone,
           phoneNumber: beneficiary.phone,
@@ -260,7 +263,8 @@ Page({
           openId: app.globalData.userInfo?.liteOpenid,
           openId: app.globalData.userInfo?.liteOpenid,
           goodsInfos: goodsInfos,
           goodsInfos: goodsInfos,
           receiveAddress: this.data.receiveAddress,
           receiveAddress: this.data.receiveAddress,
-          userBeneficiaryId: this.data.userBeneficiaryId,
+          // userBeneficiaryId: this.data.userBeneficiaryId,
+          userNote: this.data.userNote,
           orderName: name,
           orderName: name,
           orderDesc: name
           orderDesc: name
         })
         })