Browse Source

Merge branch 'one-mini' into one-mini-temp

lex-xin 9 months ago
parent
commit
b7d6fd8adc

+ 1 - 1
miniprogram/config.ts

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

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

@@ -214,7 +214,7 @@ Page({
       selectAddressId: '',
       name: '',
       phoneNumber: '',
-      detailAddress: '',
+      detailAddress: null,
       cityCode: null,
       cityName: "",
       provinceCode: null,

+ 4 - 3
miniprogram/pages/index/index.less

@@ -296,7 +296,7 @@ page {
 
     &.selected {
       background: #FEEDF0;
-      font-weight: 600;
+      // font-weight: 600;
       color: #FE2451;
     }
 
@@ -371,7 +371,8 @@ page {
   width: 100%;
   background-color: #FFFFFF;
   box-shadow: inset 0rpx 2rpx 0rpx 0rpx #F0F0F0;
-  padding: 20rpx 32rpx 58rpx 32rpx;
+  padding: 24rpx 32rpx 24rpx 32rpx;
+  padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx); /* 新版 iOS */
   display: flex;
   align-items: center;
   box-sizing: border-box;
@@ -381,7 +382,7 @@ page {
     display: flex;
     align-items: center;
     margin-right: 40rpx;
-    padding: 8rpx 0 16rpx;
+    // padding: 8rpx 0 16rpx;
 
     &.active {
       text {

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

@@ -22,6 +22,7 @@ Page({
     addressList: [] as any,
     goodsInfo: {} as any,
     hasInstrument: false, // 是否有乐器
+    cacheArea: [] as { cityCode: string, shiftCityCode: string }[], // 临时存储的对应关系
     receiveAddress: '', // 选择的地址信息
     receiveAddressInfo: {
       addressDetail: '',
@@ -50,7 +51,7 @@ Page({
     name: '',
     phoneNumber: '',
     detailAddress: '',
-    cityCode: 0,
+    cityCode: null as any,
     cityName: "",
     provinceCode: 0,
     provinceName: "",
@@ -453,8 +454,19 @@ Page({
       province_list[item.code] = item.name;
     });
     area.forEach((item: any) => {
-      item.areas && item.areas.forEach((city: any) => {
-        city_list[city.code] = city.name;
+      item.areas && item.areas.forEach((city: any, index: number) => {
+        let code = city.code + ""
+        // 某些数据不标准 这里需要转换一下
+        if (code[4] !== "0" || code[5] !== "0") {
+          // 现在把区域的数据改为市的
+          const newCode = code.substring(0, 2) + (index < 10 ? `a${index}` : index < 20 ? `b${index - 10}` : index < 30 ? `c${index - 20}` : `d${index - 30}`) + "00";
+          this.data.cacheArea.push({
+            cityCode: code,
+            shiftCityCode: newCode
+          })
+          code = newCode
+        }
+        city_list[code] = city.name;
       });
     });
     area.forEach((item: any) => {
@@ -470,6 +482,16 @@ Page({
       county_list
     };
   },
+  // 转换
+  formateCityCode(reverse?: boolean) {
+    if (!this.data.regionCode && this.data.cityCode) {
+      const cityCodeObj = this.data.cacheArea.find((item: any) => {
+        return item[reverse ? "cityCode" : "shiftCityCode"] == this.data.cityCode
+      })
+      return cityCodeObj ? cityCodeObj[reverse ? "shiftCityCode" : "cityCode"] : ""
+    }
+    return this.data.cityCode
+  },
   /** 显示选择地区 */
   async onShowAreaList() {
     this.setData({
@@ -488,10 +510,10 @@ Page({
     this.setData({
       provinceCode: selectedOptions[0].code,
       cityCode: selectedOptions[1].code,
-      regionCode: selectedOptions[2].code,
-      provinceName: selectedOptions[0].name,
-      cityName: selectedOptions[1].name,
-      regionName: selectedOptions[2].name,
+      regionCode: selectedOptions[2]?.code || null,
+      provinceName: selectedOptions[0].name || '',
+      cityName: selectedOptions[1].name || '',
+      regionName: selectedOptions[2]?.name || '',
       showArea: false,
     })
   },
@@ -512,12 +534,12 @@ Page({
       name: '',
       phoneNumber: '',
       detailAddress: '',
-      cityCode: 0,
+      cityCode: null,
       cityName: "",
       provinceCode: 0,
       provinceName: "",
       regionCode: '',
-      regionName: "",
+      regionName: ""
     })
   },
   /** 创建/修改收货地址 */
@@ -538,7 +560,7 @@ Page({
         })
         return
       }
-      if (!addressForm.provinceCode || !addressForm.cityCode || !addressForm.regionCode) {
+      if (!addressForm.provinceCode || !addressForm.cityCode) {
         wx.showToast({
           title: '请选择地区',
           icon: "none"
@@ -552,12 +574,13 @@ Page({
         })
         return
       }
+      const citycode = this.formateCityCode()
       const params = {
         name: addressForm.name,
         phoneNumber: addressForm.phoneNumber,
         province: addressForm.provinceCode,
-        city: addressForm.cityCode,
-        region: addressForm.regionCode,
+        city: citycode,
+        region: addressForm.regionCode || '',
         detailAddress: addressForm.detailAddress
       }
       const { data } = await api_userReceiveAddressSave({

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

@@ -166,8 +166,8 @@
       <van-cell-group border="{{ false }}" class="cell-group">
         <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 : '' }}" label="选择地区" placeholder-style="color: #bbb" placeholder="请选择省/市/区" readonly is-link bind:tap="onShowAreaList" />
-        <van-field model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize maxlength="100" />
+        <van-field value="{{ provinceName ? provinceName + '/' + cityName + (regionName ? '/' + regionName : '' )  : '' }}" label="选择地区" placeholder-style="color: #bbb" placeholder="请选择省/市/区" readonly is-link bind:tap="onShowAreaList" />
+        <van-field model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize="{{ { maxHeight: 80, minHeight: 30 } }}" maxlength="100" />
       </van-cell-group>
 
       <view class="pop-btn-group">

+ 4 - 2
miniprogram/pages/orders/orders.less

@@ -257,7 +257,9 @@
   width: 100%;
   background-color: #FFFFFF;
   box-shadow: inset 0rpx 2rpx 0rpx 0rpx #F0F0F0;
-  padding: 20rpx 32rpx 58rpx 32rpx;
+  // padding: 20rpx 32rpx 58rpx 32rpx;
+  padding: 24rpx 32rpx 24rpx 32rpx;
+  padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx); /* 新版 iOS */
   display: flex;
   align-items: center;
   box-sizing: border-box;
@@ -267,7 +269,7 @@
     display: flex;
     align-items: center;
     margin-right: 40rpx;
-    padding: 8rpx 0 16rpx;
+    // padding: 8rpx 0 16rpx;
 
     &.active {
       text {