Browse Source

优化权益人手机号

lex-wxl 2 days ago
parent
commit
de4beab15c

+ 4 - 0
miniprogram/pages/orders/order-detail.less

@@ -276,6 +276,10 @@ page {
   }
 }
 
+.addPhone {
+  padding: 12rpx;
+}
+
 .select-address {
   .address-info {
     padding-right: 36rpx;

+ 12 - 3
miniprogram/pages/orders/order-detail.ts

@@ -28,6 +28,7 @@ Page({
       name: '',
       phoneNumber: ''
     },
+    userNote: '', // 购买人手机号
     userBeneficiaryId: '', // 添加购买人信息
     userBeneficiaryInfo: {
       name: '',
@@ -331,13 +332,20 @@ Page({
       return
     }
 
-    if (!this.data.userBeneficiaryId) {
+    if (!this.data.userNote || !/^1[3456789]\d{9}$/.test(this.data.userNote)) {
       wx.showToast({
-        title: '请添加购买人',
-        icon: 'none'
+        title: '请输入正确的手机号',
+        icon: "none"
       })
       return
     }
+    // if (!this.data.userBeneficiaryId) {
+    //   wx.showToast({
+    //     title: '请添加购买人',
+    //     icon: 'none'
+    //   })
+    //   return
+    // }
     wx.showLoading({
       mask: true,
       title: "订单提交中...",
@@ -384,6 +392,7 @@ Page({
           "goodsInfos": goodsInfos,
           receiveAddress: this.data.receiveAddress,
           userBeneficiaryId: this.data.userBeneficiaryId,
+          userNote: this.data.userNote,
           "orderName": name,
           "orderDesc": name
         })

+ 6 - 3
miniprogram/pages/orders/order-detail.wxml

@@ -70,8 +70,11 @@
         <image src="./images/icon-arrow.png" wx:if="{{ !goodsInfo.orderNo }}" class="icon-arrow" />
       </view>
 
-
-      <view class="select-section" wx:if="{{ !userBeneficiaryId }}" wx:key="userBeneficiaryId">
+      <view class="select-section addPhone" wx:if="{{!goodsInfo.orderNo}}">
+        <van-field style="width: 100%" border="{{false}}" model:value="{{ userNote }}" maxlength="11" type="number" placeholder="请输入购买人手机号" >
+        </van-field>
+      </view>
+      <!-- <view class="select-section" wx:if="{{ !userBeneficiaryId }}" wx:key="userBeneficiaryId">
         <view class="name">添加购买人</view>
         <button class="add-buy-btn" bind:tap="onAddBuyer">添加</button>
       </view>
@@ -97,7 +100,7 @@
           </view>
         </view>
 
-      </view>
+      </view> -->
 
       <view class="order-time" wx:if="{{ goodsInfo.createTime }}">
           <view class="order-item">