Browse Source

添加样式

lex-xin 9 months ago
parent
commit
efbce19d3d

+ 2 - 1
miniprogram/pages/address/index.less

@@ -252,6 +252,7 @@ toolbar-confirm {
 
   .cell-group {
     flex: 1 auto;
+    overflow-y: auto;
 
     .van-cell {
       padding: 36rpx 40rpx;
@@ -264,7 +265,7 @@ toolbar-confirm {
     .van-field__control--textarea {
       // padding: 0 !important;
       // --cell-line-height: 80rpx !important;
-      height: 72rpx !important;
+      // height: 72rpx !important;
     }
     // .van-field__body--textarea {
     //   --cell-line-height: 60rpx;

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

@@ -47,7 +47,7 @@
           <van-field model:value="{{ name }}" label="收货人" placeholder="请填写收货人姓名" placeholder-style="color: #bbb" maxlength="50" />
           <van-field model:value="{{ phoneNumber }}" label="电话号码" type="number" placeholder-style="color: #bbb" placeholder="请输入手机号码" maxlength="11" />
           <van-field value="{{ provinceName ? provinceName + '/' + cityName + (regionName ? '/' + regionName : '' )  : '' }}" label="选择地区" placeholder-style="color: #bbb" placeholder="请选择省/市/区" readonly is-link bind:tap="onShowAreaList" />
-          <van-field wx:if="{{ showTextarea }}" model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize maxlength="100" border="{{ false }}" />
+          <van-field wx:if="{{ showTextarea }}" model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号"  autosize maxlength="100" border="{{ false }}" />
         </van-cell-group>
 
         <view class="pop-btn-group">

+ 18 - 7
miniprogram/pages/index/index.ts

@@ -682,14 +682,29 @@ Page({
       })
 
       let tempSchoolId = ''
+      let areaIndex = 0
       if (tempList.length > 0) {
-        const first = tempList[0]
-        tempSchoolId = first.value || ''
+        const childIndex = tempList.findIndex((item: any) => this.data.schoolAreaId === item.value)
+        console.log(childIndex, 'childIndex')
+
+        if (childIndex !== -1) {
+          const first = tempList[childIndex]
+          tempSchoolId = first.value || ''
+          areaIndex = childIndex
+        } else {
+          const first = tempList[0]
+          tempSchoolId = first.value || ''
+          areaIndex = 0
+        }
       }
 
       this.setData({
+        schoolAreaIndex: areaIndex,
         schoolAreaList: tempList,
         tempChangeSchoolAreaId: tempSchoolId
+      }, () => {
+        const schoolArea = this.selectComponent('#schoolArea')
+        schoolArea?.setIndexes([areaIndex])
       })
     } catch {
       // 
@@ -963,11 +978,7 @@ Page({
     })
   },
   onSearch() {
-    this.setData({
-      schoolAreaIndex: 0
-    }, () => {
-      this.getSchools(this.data.searchName);
-    })
+    this.getSchools(this.data.searchName);
   },
   onSearchChange(e: any) {
     this.setData({

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

@@ -195,8 +195,6 @@
               <button disabled="{{ buyerLoading }}" class="submit-btn" bind:tap="onSubmitBuyer">保存信息</button>
             </view>
           </view>
-
-
         </van-popup>
 
         <!-- 性别 -->
@@ -222,7 +220,7 @@
               <view slot="action" class="searchBtn" bind:tap="onSearch">搜索</view>
             </van-search>
           </view>
-          <van-picker loading="{{ schoolLoading }}" wx:if="{{ !showSchoolAfterLeave && schoolAreaList.length > 0 }}" columns="{{ schoolAreaList }}" bind:change="onChangeSchool" visible-item-count="6" default-index="{{ schoolAreaIndex }}">
+          <van-picker id="schoolArea" loading="{{ schoolLoading }}" wx:if="{{ !showSchoolAfterLeave && schoolAreaList.length > 0 }}" columns="{{ schoolAreaList }}" bind:change="onChangeSchool" visible-item-count="6" default-index="{{ schoolAreaIndex }}">
           </van-picker>
           <view class="empty-box" wx:if="{{ schoolAreaList.length <= 0 }}">
             <view class="empty_loading" wx:if="{{ schoolLoading }}">