Browse Source

添加页面

lex-xin 5 months ago
parent
commit
6aa793cf9f

+ 2 - 3
miniprogram/api/new.ts

@@ -48,9 +48,8 @@ export const api_userReceiveAddressRemove = (params: any) => {
 /** 收获地址详情 */
 export const api_userReceiveAddressDetail = (params: any) => {
   return request({
-    url: `/edu-app/userReceiveAddress/detail`,
-    method: "get",
-    params: params,
+    url: `/edu-app/userReceiveAddress/detail/${params.id}`,
+    method: "get"
   } as any);
 };
 

+ 2 - 1
miniprogram/app.json

@@ -10,7 +10,8 @@
     "pages/download/download",
     "pages/address/index",
     "pages/select-goods/index",
-    "pages/buyerInformation/index"
+    "pages/buyerInformation/index",
+    "pages/address/address-detail"
   ],
   "window": {
     "navigationBarTextStyle": "black",

+ 10 - 0
miniprogram/pages/address/address-detail.json

@@ -0,0 +1,10 @@
+{
+  "usingComponents": {
+    "navigation-bar": "/components/navigation-bar/navigation-bar",
+    "van-cell": "@vant/weapp/cell/index",
+    "van-cell-group": "@vant/weapp/cell-group/index",
+    "van-field": "@vant/weapp/field/index",
+    "van-popup": "@vant/weapp/popup/index",
+    "van-area": "@vant/weapp/area/index"
+  }
+}

+ 163 - 0
miniprogram/pages/address/address-detail.less

@@ -0,0 +1,163 @@
+/* pages/address/address-detail.wxss */
+.container {
+  position: relative;
+  height: 100vh;
+  display: flex;
+  flex-direction: column;
+  background: #F4F4F4;
+
+  &::before {
+    content: '';
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 254rpx;
+    background: linear-gradient(180deg, #FDEC00 0%, #FAD400 100%);
+  }
+}
+
+
+.pop-btn-list {
+  padding: 24rpx 32rpx 58rpx;
+  box-shadow: inset 0rpx 2rpx 0rpx 0rpx #F0F0F0;
+  background-color: #fff;
+
+  .submit-btn {
+    width: 100% !important;
+    margin: 0 !important;
+    padding: 0 !important;
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
+    color: #FEFFCA;
+    font-size: 36rpx;
+    font-weight: 600;
+    line-height: 94rpx;
+  }
+}
+
+
+.van-picker__toolbar,
+.toolbar-top {
+  margin: 0 40rpx !important;
+  padding: 0 14rpx !important;
+  border-bottom: 2rpx solid #F2F2F2;
+  height: auto !important;
+  line-height: normal !important;
+}
+
+.van-picker__cancel,
+.van-picker__confirm,
+.toolbar-cancel,
+toolbar-confirm {
+  font-size: 32rpx !important;
+  padding: 28rpx 0 !important;
+  color: #777777 !important;
+}
+
+.van-picker__confirm,
+.toolbar-confirm {
+  color: #FE4600 !important;
+}
+
+.toolbar-top {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+
+.addressContainer {
+  // background: linear-gradient(180deg, #FFDEE7 0%, #FFFFFF 12%, #FFFFFF 100%);
+  // border-radius: 32rpx 32rpx 0rpx 0rpx;
+  // height: 928rpx;
+  display: flex;
+  flex-direction: column;
+
+  // .icon-close {
+  //   position: absolute;
+  //   z-index: 2;
+  //   top: 24rpx;
+  //   right: 12rpx;
+  //   padding: 20rpx;
+  //   width: 30rpx;
+  //   height: 30rpx;
+  // }
+
+  .pop-address-title {
+    position: relative;
+    z-index: 1;
+    text-align: center;
+    padding-top: 36rpx;
+    padding-bottom: 20rpx;
+    font-weight: 600;
+    font-size: 36rpx;
+    color: #131415;
+    line-height: 50rpx;
+  }
+
+  .section {
+    flex: 1 auto;
+    padding: 24rpx 26rpx 0;
+  }
+
+  .van-cell-group {
+    background: #FFFFFF;
+    border-radius: 20rpx;
+    overflow: hidden;
+
+    .van-cell {
+      padding: 24rpx;
+      font-size: 30rpx;
+    }
+
+    .required {
+      font-weight: 400;
+      color: #666666;
+
+      text {
+        color: #FF5A56;
+      }
+    }
+
+    .van-field__label {
+      color: #666666;
+    }
+
+    .van-icon-arrow {
+      color: #BFBFBF;
+    }
+
+    .textarea {
+      height: 72rpx;
+    }
+  }
+
+  .van-picker-column__item--selected {
+    font-weight: 600;
+    font-size: 32rpx;
+    color: #FE4600 !important;
+  }
+
+  .pop-btn-group {
+    padding: 32rpx 32rpx 58rpx;
+    background: #FFFFFF;
+    box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.5);
+  }
+
+  .submit-btn {
+    width: 100% !important;
+    margin: 0 !important;
+    padding: 0 !important;
+    line-height: 94rpx;
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
+    font-weight: 600;
+    font-size: 36rpx;
+    color: #FEFFCA;
+  }
+}

+ 288 - 0
miniprogram/pages/address/address-detail.ts

@@ -0,0 +1,288 @@
+import { api_sysAreaQueryAllProvince, api_userReceiveAddressDetail, api_userReceiveAddressSave, api_userReceiveAddressUpdate } from "../../api/new";
+
+// pages/address/address-detail.ts
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    addressShow: false,
+    addressAfterLeave: false,
+    showDialog: false,
+    cacheArea: [] as { cityCode: string, shiftCityCode: string }[], // 临时存储的对应关系
+    showArea: false,
+    showAreaAfterLeave: false,
+    areaList: [] as any,
+    currentValues: [] as any,
+
+    // 添加地址表单信息
+    id: "",
+    name: '',
+    phoneNumber: '',
+    detailAddress: '',
+    cityCode: null,
+    cityName: "",
+    provinceCode: null,
+    provinceName: "",
+    regionCode: '',
+    regionName: "",
+
+    btnLoading: false
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  async onLoad(options: any) {
+    await this.getAreas()
+    console.log(options, "options")
+    if (options.receiveAddress) {
+      this.setData({
+        id: options.receiveAddress
+      }, () => {
+        this.getDetail()
+      })
+    }
+
+  },
+  /** 获取详情 */
+  async getDetail() {
+    try {
+      if (!this.data.id) return
+      const { data } = await api_userReceiveAddressDetail({ id: this.data.id })
+      const result = data.data
+      this.setData({
+        name: result.name,
+        phoneNumber: result.phoneNumber,
+        detailAddress: result.detailAddress,
+        cityCode: result.city,
+        cityName: result.cityName,
+        provinceCode: result.province,
+        provinceName: result.provinceName,
+        regionCode: result.region,
+        regionName: result.regionName,
+      }, () => {
+        const cityCode: any = this.formateCityCode(true)
+        this.setData({
+          cityCode
+        })
+      })
+    } catch {
+      // 
+    }
+  },
+  /** 获取省市区 */
+  async getAreas() {
+    try {
+      const { data } = await api_sysAreaQueryAllProvince({})
+      const areaList: any = this.formateArea(data.data)
+      const currentValues = []
+      if (areaList?.province_list) {
+        // 获取第一个键值对
+        const firstKey = Object.keys(areaList?.province_list)[0];
+        // 通过键获取值
+        const firstValue = areaList?.province_list[firstKey];
+        currentValues.push({
+          code: firstKey,
+          name: firstValue
+        })
+      }
+      if (areaList?.city_list) {
+        // 获取第一个键值对
+        const firstKey = Object.keys(areaList?.city_list)[0];
+        // 通过键获取值
+        const firstValue = areaList?.city_list[firstKey];
+        currentValues.push({
+          code: firstKey,
+          name: firstValue
+        })
+      }
+      if (areaList?.county_list) {
+        // 获取第一个键值对
+        const firstKey = Object.keys(areaList?.county_list)[0];
+        // 通过键获取值
+        const firstValue = areaList?.county_list[firstKey];
+        currentValues.push({
+          code: firstKey,
+          name: firstValue
+        })
+      }
+      console.log(areaList,
+        currentValues)
+      this.setData({
+        areaList,
+        currentValues
+      })
+    } catch {
+      // 
+    }
+  },
+  formateArea(area: any[]) {
+    const province_list: { [_: string]: string } = {};
+    const city_list: { [_: string]: string } = {};
+    const county_list: { [_: string]: string } = {};
+    area.forEach((item: any) => {
+      province_list[item.code] = item.name;
+    });
+    area.forEach((item: any) => {
+      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) => {
+      item.areas && item.areas.forEach((city: any) => {
+        city.areas && city.areas.forEach((county: any) => {
+          county_list[county.code] = county.name;
+        });
+      });
+    });
+    return {
+      province_list,
+      city_list,
+      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
+  },
+  /** 显示选择地区 */
+  onShowAreaList() {
+    this.setData({
+      showArea: true
+    })
+  },
+  /** 关闭选择地区 */
+  onCloseAreaList() {
+    this.setData({
+      showArea: false
+    })
+  },
+  onAreaBeforeEnter() {
+    this.setData({
+      showAreaAfterLeave: false
+    })
+  },
+  onAreaAfterLeave() {
+    this.setData({
+      showAreaAfterLeave: true
+    })
+  },
+  /** 确定选择地区 */
+  submitArea(e: any) {
+    const selectedOptions: any = e.detail.values
+    this.setData({
+      provinceCode: selectedOptions[0].code,
+      cityCode: selectedOptions[1].code,
+      regionCode: selectedOptions[2]?.code || null,
+      provinceName: selectedOptions[0].name || '',
+      cityName: selectedOptions[1].name || '',
+      regionName: selectedOptions[2]?.name || '',
+      showArea: false,
+    })
+  },
+  /** 创建/修改收货地址 */
+  async onOperationAddress() {
+    const addressForm = this.data
+    try {
+      if (!addressForm.name) {
+        wx.showToast({
+          title: '请输入收货人姓名',
+          icon: "none"
+        })
+        return
+      }
+      if (!addressForm.phoneNumber || !/^1[3456789]\d{9}$/.test(addressForm.phoneNumber)) {
+        wx.showToast({
+          title: '请输入正确的手机号码',
+          icon: "none"
+        })
+        return
+      }
+      if (!addressForm.provinceCode || !addressForm.cityCode) {
+        wx.showToast({
+          title: '请选择地区',
+          icon: "none"
+        })
+        return
+      }
+      if (!addressForm.detailAddress) {
+        wx.showToast({
+          title: '请输入详细地址',
+          icon: "none"
+        })
+        return
+      }
+      const citycode = this.formateCityCode()
+      const params = {
+        name: addressForm.name,
+        phoneNumber: addressForm.phoneNumber,
+        province: addressForm.provinceCode,
+        city: citycode,
+        region: addressForm.regionCode || '',
+        detailAddress: addressForm.detailAddress
+      }
+      this.setData({
+        btnLoading: true
+      })
+
+      const pages = getCurrentPages();
+      const prevPage = pages[pages.length - 2]; // 获取上一个页面实例
+      console.log(addressForm.id, "addressForm.id")
+      if (addressForm.id) {
+        await api_userReceiveAddressUpdate({
+          id: addressForm.id,
+          ...params
+        })
+        wx.showToast({
+          title: '保存成功',
+          icon: 'none'
+        })
+        prevPage?.setData({ backParams: this.data.id });
+      } else {
+        const { data } = await api_userReceiveAddressSave({
+          ...params
+        })
+        wx.showToast({
+          title: '保存成功',
+          icon: 'none'
+        })
+
+        prevPage?.setData({ backParams: data.data });
+      }
+      // this.onCloseAddress()
+
+      setTimeout(() => {
+        this.setData({
+          btnLoading: false
+        })
+        wx.navigateBack()
+      }, 1000);
+    } catch (e) {
+      // 
+      console.log(e, '1212')
+      this.setData({
+        btnLoading: false
+      })
+    }
+
+  }
+})

+ 33 - 0
miniprogram/pages/address/address-detail.wxml

@@ -0,0 +1,33 @@
+<!--pages/address/index.wxml-->
+<view class="container addressContainer">
+  <navigation-bar title="{{ id ? '修改地址' : '创建新地址' }}"></navigation-bar>
+
+  <view class="section">
+    <van-cell-group border="{{ false }}" class="cell-group">
+    <van-field model:value="{{ name }}" placeholder="姓名" placeholder-style="color: #C0C0C0">
+      <view class="required" slot="label">收货人<text>*</text></view>
+    </van-field>
+    <van-field model:value="{{ phoneNumber }}" type="number" placeholder-style="color: #C0C0C0" placeholder="手机号码" maxlength="11">
+      <view class="required" slot="label">联系电话<text>*</text></view>
+    </van-field>
+    <van-field value="{{ provinceName ? provinceName + '/' + cityName + (regionName ? '/' + regionName : '' )  : '' }}" placeholder-style="color: #C0C0C0" placeholder="省、市、区" readonly bind:tap="onShowAreaList">
+      <view class="required" slot="label">所在地区<text>*</text></view>
+    </van-field>
+    <van-field model:value="{{ detailAddress }}" type="textarea" placeholder-style="color: #C0C0C0" placeholder="小区、门牌号等" input-class="textarea" autosize>
+      <view class="required" slot="label">详细地址<text>*</text></view>
+    </van-field>
+  </van-cell-group>
+
+  </view>
+
+  <view class="pop-btn-group">
+    <button class="submit-btn" disabled="{{ btnLoading }}" bind:tap="onOperationAddress">保存地址</button>
+  </view>
+
+
+  <!-- 地区 -->
+  <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{103}}" show="{{showArea}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseAreaList" bind:after-leave="onAreaAfterLeave" bind:before-enter="onAreaBeforeEnter">
+    <van-area wx:if="{{ !showAreaAfterLeave }}" id='area1' areaList="{{areaList}}" visible-item-count="6" item-height="46" value="{{ regionCode || cityCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
+  </van-popup>
+
+</view>

BIN
miniprogram/pages/address/image/icon-checked.png


+ 35 - 131
miniprogram/pages/address/index.less

@@ -18,16 +18,16 @@
 }
 
 .address-item {
-  padding: 24rpx 24rpx 16rpx;
+  padding: 28rpx 24rpx 16rpx;
   background: #fff;
   border-radius: 20rpx;
   border: 2rpx solid #fff;
   margin-bottom: 22rpx;
 
-  &.active {
-    border: 2rpx solid rgba(254, 36, 81, 0.7);
-    background: #FFF4F6;
-  }
+  // &.active {
+  //   border: 2rpx solid rgba(254, 36, 81, 0.7);
+  //   background: #FFF4F6;
+  // }
 
   .item-title {
     font-size: 26rpx;
@@ -36,25 +36,38 @@
   }
 
   .detailAddress {
-    padding: 16rpx 0;
-    font-weight: 600;
-    font-size: 32rpx;
+    padding-top: 16rpx;
+    font-size: 28rpx;
     color: #131415;
+    line-height: 40rpx;
     word-break: break-all;
-    line-height: 48rpx;
   }
 
   .item-users {
     display: flex;
-    justify-content: space-between;
+    align-items: center;
+    // justify-content: space-between;
+
+    .iconChecked {
+      width: 32rpx;
+      height: 32rpx;
+      margin-right: 8rpx;
+      flex-shrink: 0;
+    }
 
     .item-user {
-      font-size: 26rpx;
-      color: rgba(0, 0, 0, 0.5);
+      font-size: 28rpx;
+      color: #333;
       line-height: 36rpx;
+      font-weight: bold;
 
       text {
-        padding-right: 16rpx;
+        padding-right: 12rpx;
+
+        &:last-child {
+          font-weight: 400;
+          color: #777777;
+        }
       }
     }
   }
@@ -64,8 +77,7 @@
     flex: 1;
     justify-content: flex-end;
     margin-top: 24rpx;
-    padding-top: 16rpx;
-    border-top: 2rpx solid rgba(0, 0, 0, 0.06);
+    // border-top: 2rpx solid rgba(0, 0, 0, 0.06);
 
     .btn {
       width: 104rpx;
@@ -77,14 +89,8 @@
       font-size: 24rpx;
       color: #333333;
       background-color: transparent;
-      border-radius: 24rpx;
-      border: 1rpx solid #DCDCDC;
-    }
-
-    .update-btn {
-      background: transparent;
-      color: #FE2451;
-      border: 1rpx solid #FE2451;
+      border-radius: 12rpx;
+      border: 2rpx solid #DCDCDC;
     }
   }
 }
@@ -171,115 +177,13 @@
     width: 100% !important;
     margin: 0 !important;
     padding: 0 !important;
-    line-height: 88rpx;
-    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
-    border-radius: 88rpx;
-    font-weight: 500;
-    font-size: 32rpx;
-    color: #fff;
-  }
-}
-
-
-.van-picker__toolbar,
-.toolbar-top {
-  margin: 0 40rpx !important;
-  padding: 0 14rpx !important;
-  border-bottom: 2rpx solid #F2F2F2;
-  height: auto !important;
-  line-height: normal !important;
-}
-
-.van-picker__cancel,
-.van-picker__confirm,
-.toolbar-cancel,
-toolbar-confirm {
-  font-size: 32rpx !important;
-  padding: 28rpx 0 !important;
-  color: #777777 !important;
-}
-
-.van-picker__confirm,
-.toolbar-confirm {
-  color: #FE2451 !important;
-}
-
-.toolbar-top {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-
-
-.addressContainer {
-  background: linear-gradient(180deg, #FFDEE7 0%, #FFFFFF 12%, #FFFFFF 100%);
-  border-radius: 32rpx 32rpx 0rpx 0rpx;
-  height: 928rpx;
-  display: flex;
-  flex-direction: column;
-
-  .icon-close {
-    position: absolute;
-    z-index: 2;
-    top: 24rpx;
-    right: 12rpx;
-    padding: 20rpx;
-    width: 30rpx;
-    height: 30rpx;
-  }
-
-  .pop-address-title {
-    position: relative;
-    z-index: 1;
-    text-align: center;
-    padding-top: 36rpx;
-    padding-bottom: 20rpx;
-    font-weight: 600;
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
+    color: #FEFFCA;
     font-size: 36rpx;
-    color: #131415;
-    line-height: 50rpx;
-  }
-
-  .cell-group {
-    flex: 1 auto;
-
-    .van-cell {
-      padding: 36rpx 40rpx;
-      font-size: 30rpx;
-    }
-
-    .van-field__label {
-      color: #666666;
-    }
-
-    .van-icon-arrow {
-      color: #BFBFBF;
-    }
-
-    .textarea {
-      max-height: 72rpx;
-    }
-  }
-
-  .van-picker-column__item--selected {
     font-weight: 600;
-    font-size: 32rpx;
-    color: #6D4718 !important;
-  }
-
-  .pop-btn-group {
-    padding: 32rpx 32rpx 58rpx;
-  }
-
-  .submit-btn {
-    width: 100% !important;
-    margin: 0 !important;
-    padding: 0 !important;
-    line-height: 88rpx;
-    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
-    border-radius: 88rpx;
-    font-weight: 500;
-    font-size: 32rpx;
-    color: #fff;
+    line-height: 94rpx;
   }
 }

+ 18 - 247
miniprogram/pages/address/index.ts

@@ -7,28 +7,15 @@ Page({
    * 页面的初始数据
    */
   data: {
+    backParams: null as any,
     selectAddressId: '', // 选中地址编号
     addressList: [] as any,
     addressShow: false,
     addressAfterLeave: false,
     showDialog: false,
-    cacheArea: [] as { cityCode: string, shiftCityCode: string }[], // 临时存储的对应关系
-    showArea: false,
-    showAreaAfterLeave: false,
-    areaList: [] as any,
-    currentValues: [] as any,
 
     // 添加地址表单信息
     id: "",
-    name: '',
-    phoneNumber: '',
-    detailAddress: '',
-    cityCode: null,
-    cityName: "",
-    provinceCode: null,
-    provinceName: "",
-    regionCode: '',
-    regionName: "",
   },
 
   /**
@@ -42,173 +29,35 @@ Page({
     }
 
     this.getAddress()
-    this.getAreas()
   },
-  /** 地址列表 */
-  async getAddress() {
-    try {
-      const { data } = await api_userReceiveAddressPage({ page: 1, rows: -1 })
+  onShow() {
+    if (this.data.backParams) {
       this.setData({
-        addressList: data.data.rows || []
+        id: this.data.backParams,
+        backParams: null,
+        addressList: []
+      }, () => {
+        this.getAddress()
       })
-    } catch {
-      // 
     }
   },
-  /** 获取省市区 */
-  async getAreas() {
+  /** 地址列表 */
+  async getAddress() {
     try {
-      const { data } = await api_sysAreaQueryAllProvince({})
-      const areaList: any = this.formateArea(data.data)
-      const currentValues = []
-      if (areaList?.province_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.province_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.province_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      if (areaList?.city_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.city_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.city_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      if (areaList?.county_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.county_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.county_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      console.log(areaList,
-        currentValues)
+      const { data } = await api_userReceiveAddressPage({ page: 1, rows: -1 })
       this.setData({
-        areaList,
-        currentValues
+        addressList: data.data.rows || []
       })
     } catch {
       // 
     }
   },
-  formateArea(area: any[]) {
-    const province_list: { [_: string]: string } = {};
-    const city_list: { [_: string]: string } = {};
-    const county_list: { [_: string]: string } = {};
-    area.forEach((item: any) => {
-      province_list[item.code] = item.name;
-    });
-    area.forEach((item: any) => {
-      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) => {
-      item.areas && item.areas.forEach((city: any) => {
-        city.areas && city.areas.forEach((county: any) => {
-          county_list[county.code] = county.name;
-        });
-      });
-    });
-    return {
-      province_list,
-      city_list,
-      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
-  },
-  /** 显示选择地区 */
-  onShowAreaList() {
-    this.setData({
-      showArea: true
-    })
-  },
-  /** 关闭选择地区 */
-  onCloseAreaList() {
-    this.setData({
-      showArea: false
-    })
-  },
-  onAreaBeforeEnter() {
-    this.setData({
-      showAreaAfterLeave: false
-    })
-  },
-  onAreaAfterLeave() {
-    this.setData({
-      showAreaAfterLeave: true
-    })
-  },
-  /** 确定选择地区 */
-  submitArea(e: any) {
-    const selectedOptions: any = e.detail.values
-    this.setData({
-      provinceCode: selectedOptions[0].code,
-      cityCode: selectedOptions[1].code,
-      regionCode: selectedOptions[2]?.code || null,
-      provinceName: selectedOptions[0].name || '',
-      cityName: selectedOptions[1].name || '',
-      regionName: selectedOptions[2]?.name || '',
-      showArea: false,
-    })
-  },
+  // 添加地址
   onShowAddress() {
-    this.setData({
-      addressAfterLeave: false,
-      addressShow: true
-    })
-  },
-  onCloseAddress() {
-    this.setData({
-      addressShow: false
+    wx.navigateTo({
+      url: `../address/address-detail?receiveAddress=${this.data.id}`,
     })
   },
-  onAddressAfterLeave() {
-    this.setData({
-      addressAfterLeave: true,
-      selectAddressId: '',
-      name: '',
-      phoneNumber: '',
-      detailAddress: '',
-      cityCode: null,
-      cityName: "",
-      provinceCode: 0,
-      provinceName: "",
-      regionCode: null,
-      regionName: "",
-    })
-  },
-
   /** Dialog 隐藏 */
   onDialogClose() {
     this.setData({
@@ -225,20 +74,8 @@ Page({
   /** 修改地址 */
   onUpdateAddress(e: any) {
     const id = e.target.dataset.id
-    const addressInfo = this.data.addressList.find((item: any) => item.id === id)
-    this.setData({
-      addressShow: true,
-      addressAfterLeave: false,
-      selectAddressId: addressInfo.id,
-      name: addressInfo.name,
-      phoneNumber: addressInfo.phoneNumber,
-      detailAddress: addressInfo.detailAddress,
-      cityCode: addressInfo.city,
-      cityName: addressInfo.cityName,
-      provinceCode: addressInfo.province,
-      provinceName: addressInfo.provinceName,
-      regionCode: addressInfo.region,
-      regionName: addressInfo.regionName,
+    wx.navigateTo({
+      url: `../address/address-detail?receiveAddress=${id}`,
     })
   },
   /** 选择地址 */
@@ -284,71 +121,5 @@ Page({
         }
       }
     });
-  },
-  /** 创建/修改收货地址 */
-  async onOperationAddress() {
-    const addressForm = this.data
-    try {
-      if (!addressForm.name) {
-        wx.showToast({
-          title: '请输入收货人姓名',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.phoneNumber || !/^1[3456789]\d{9}$/.test(addressForm.phoneNumber)) {
-        wx.showToast({
-          title: '请输入正确的手机号码',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.provinceCode || !addressForm.cityCode) {
-        wx.showToast({
-          title: '请选择地区',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.detailAddress) {
-        wx.showToast({
-          title: '请输入详细地址',
-          icon: "none"
-        })
-        return
-      }
-      const citycode = this.formateCityCode()
-      const params = {
-        name: addressForm.name,
-        phoneNumber: addressForm.phoneNumber,
-        province: addressForm.provinceCode,
-        city: citycode,
-        region: addressForm.regionCode || '',
-        detailAddress: addressForm.detailAddress
-      }
-      if (addressForm.selectAddressId) {
-        await api_userReceiveAddressUpdate({
-          id: addressForm.selectAddressId,
-          ...params
-        })
-        wx.showToast({
-          title: '修改成功',
-          icon: 'none'
-        })
-      } else {
-        await api_userReceiveAddressSave({
-          ...params
-        })
-        wx.showToast({
-          title: '添加成功',
-          icon: 'none'
-        })
-      }
-      this.getAddress()
-      this.onCloseAddress()
-    } catch (e) {
-      // 
-      console.log(e, '1212')
-    }
-  },
+  }
 })

+ 14 - 41
miniprogram/pages/address/index.wxml

@@ -8,22 +8,20 @@
         <view class="empty-text">暂无收货地址</view>
       </view>
       <view wx:for="{{ addressList }}" wx:key="index">
-        <view class="address-item {{ item.id === id ? 'active' : '' }}" bind:tap="onSelectAddress" data-id="{{ item.id }}">
-          <view class="item-title">
-            {{ item.provinceName }}{{ item.cityName }}{{ item.regionName }}
-          </view>
-          <view class="detailAddress">
-            {{ item.detailAddress }}
-          </view>
+        <view class="address-item" bind:tap="onSelectAddress" data-id="{{ item.id }}">
           <view class="item-users">
+            <image src="./image/icon-checked.png" wx:if="{{ item.id === id }}" class="iconChecked"></image>
             <view class="item-user">
               <text>{{ item.name }}</text>
               <text>{{ item.phoneNumber }}</text>
             </view>
           </view>
+          <view class="detailAddress">
+            {{ item.provinceName }}{{ item.cityName }}{{ item.regionName }}{{ item.detailAddress }}
+          </view>
           <view class="item-btn-group">
             <button class="btn del-btn" catch:tap="onRemoveAddress" data-id="{{ item.id }}">删除</button>
-            <button class="btn update-btn" catch:tap="onUpdateAddress" data-id="{{ item.id }}">编辑</button>
+            <button class="btn update-btn" catch:tap="onUpdateAddress" data-id="{{ item.id }}">修改</button>
           </view>
         </view>
       </view>
@@ -32,44 +30,19 @@
 
 
   <view class="pop-btn-list">
-    <button class="submit-btn" bind:tap="onShowAddress">新建收货地址</button>
+    <button class="submit-btn" bind:tap="onShowAddress">添加新地址</button>
   </view>
 
-  <van-popup show="{{ addressShow }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseAddress" position="bottom" round z-index="101" bind:after-leave="onAddressAfterLeave">
-    <view class="addressContainer" wx:if="{{ !addressAfterLeave }}">
-      <image src="./image/icon-close1.png" class="icon-close" bind:tap="onCloseAddress" />
-      <view class="pop-address-title">
-        {{ selectAddressId ? '修改收货地址' : '新建收货地址' }}
-      </view>
+  <van-popup round lock-scroll="{{true}}" z-index="{{102}}" show="{{showDialog}}">
+    <view class="dialog-section">
+      <view class="dialog-title">删除地址</view>
 
-      <van-cell-group border="{{ false }}" class="cell-group">
-        <van-field model:value="{{ name }}" label="收货人" placeholder="请填写收货人姓名" placeholder-style="color: #bbb" />
-        <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 model:value="{{ detailAddress }}" label="详细地址" type="textarea" placeholder-style="color: #bbb" placeholder="请填写小区/楼号/单元/门牌号" input-class="textarea" autosize />
-      </van-cell-group>
+      <view class="dialog-content">确认要删除该收货地址吗?</view>
 
-      <view class="pop-btn-group">
-        <button class="submit-btn" bind:tap="onOperationAddress">确认</button>
+      <view class="dialog-btn-group">
+        <view class="btn" bind:tap="onDialogClose">取消</view>
+        <view class="btn del-btn" bind:tap="onDialogConfirm">确认</view>
       </view>
     </view>
   </van-popup>
-
-  <!-- 地区 -->
-  <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{103}}" show="{{showArea}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseAreaList" bind:after-leave="onAreaAfterLeave" bind:before-enter="onAreaBeforeEnter">
-    <van-area  wx:if="{{ !showAreaAfterLeave }}" id='area1' areaList="{{areaList}}" visible-item-count="9" item-height="46" value="{{ regionCode || cityCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
-  </van-popup>
-
-  <van-popup round lock-scroll="{{true}}" z-index="{{102}}" show="{{showDialog}}">
-      <view class="dialog-section">
-        <view class="dialog-title">删除地址</view>
-
-        <view class="dialog-content">确认要删除该收货地址吗?</view>
-
-        <view class="dialog-btn-group">
-          <view class="btn" bind:tap="onDialogClose">取消</view>
-          <view class="btn del-btn" bind:tap="onDialogConfirm">确认</view>
-        </view>
-      </view>
-    </van-popup>
 </view>

BIN
miniprogram/pages/buyerInformation/images/icon-search.png


+ 8 - 9
miniprogram/pages/buyerInformation/index.less

@@ -70,17 +70,17 @@
 
     .gender-item {
       margin-left: 24rpx;
-      background: rgba(28, 172, 241, 0.11);
+      background: #FFF1E0;
       border-radius: 12rpx;
       font-weight: 500;
       font-size: 28rpx;
-      color: #1CACF1;
+      color: rgba(254, 70, 0, 0.5);
       width: 104rpx;
       line-height: 48rpx;
       text-align: center;
 
       &.active {
-        background: #1CACF1;
+        background: linear-gradient( 270deg, #FF9501 0%, #FE4600 100%);
         color: #FFFFFF;
       }
     }
@@ -125,7 +125,7 @@ toolbar-confirm {
 
 .van-picker__confirm,
 .toolbar-confirm {
-  color: #1CACF1 !important;
+  color: #FE4600 !important;
 }
 
 .toolbar-top {
@@ -168,7 +168,7 @@ toolbar-confirm {
     line-height: 54rpx !important;
     padding: 0 !important;
     text-align: center;
-    background-color: #1CACF1;
+    background: linear-gradient( 270deg, #FF9501 0%, #FE4600 100%);
     font-weight: 500;
     font-size: 28rpx;
     color: #FFFFFF;
@@ -181,13 +181,13 @@ toolbar-confirm {
 .van-picker-column__item--selected {
   font-weight: 600;
   font-size: 32rpx;
-  color: #1CACF1 !important;
+  color: #FE4600 !important;
 }
 
 .empty-box {
   padding-top: 12rpx;
   box-sizing: border-box;
-  height: 220px;
+  height: 176px;
   text-align: center;
   font-size: 32rpx;
   font-family: PingFangSC-Regular, PingFang SC;
@@ -209,8 +209,7 @@ toolbar-confirm {
   }
 
   image {
-    width: 364rpx;
-    height: 190rpx;
+    width: 224rpx;
   }
 
   .empty-text {

+ 22 - 23
miniprogram/pages/buyerInformation/index.ts

@@ -608,7 +608,7 @@ Page({
 
   /** 选择班级 */
   onSelectClass() {
-    if (!this.data.schoolAreaId) {
+    if (!this.data.currentGradeNum) {
       wx.showToast({
         title: '请选择所在年级',
         icon: 'none'
@@ -659,49 +659,50 @@ Page({
     }
   },
   /** 最终提交 */
-  async onSubmitBuyer() {
+  async onSubmit() {
     try {
       const params = this.data
-      if (this.messageName(params.name)) {
+      if (!params.provinceCode || !params.cityCode) {
         wx.showToast({
-          title: this.messageName(params.name),
+          title: '请选择学校地区',
           icon: "none"
         })
         return
       }
 
-      if (!params.phone || !/^1[3456789]\d{9}$/.test(params.phone)) {
+      if (!params.schoolAreaId) {
         wx.showToast({
-          title: '请填写正确的电话号码',
+          title: '请选择所在学校',
           icon: "none"
         })
         return
       }
 
-      if (!params.gender) {
+      if (!params.phone || !/^1[3456789]\d{9}$/.test(params.phone)) {
         wx.showToast({
-          title: '请选择性别',
-          icon: 'none'
+          title: '请填写正确的电话号码',
+          icon: "none"
         })
         return
       }
 
-      if (!params.provinceCode || !params.cityCode) {
+      if (this.messageName(params.name)) {
         wx.showToast({
-          title: '请选择学校地区',
+          title: this.messageName(params.name),
           icon: "none"
         })
         return
       }
 
-      if (!params.schoolAreaId) {
+      if (!params.gender) {
         wx.showToast({
-          title: '请选择所在学校',
-          icon: "none"
+          title: '请选择性别',
+          icon: 'none'
         })
         return
       }
 
+
       if (!params.currentGradeNum) {
         wx.showToast({
           title: '请选择所在年级',
@@ -732,10 +733,13 @@ Page({
         phoneNumber: params.phone,
         schoolInfo: (params.provinceName || '') + (params.cityName || '') + (params.regionName || '') + params.schoolAreaName + params.currentGradeTxt + params.currentClassTxt
       }
-      let userBeneficiaryId = ''
       this.setData({
         buyerLoading: true
       })
+
+      const pages = getCurrentPages();
+      const prevPage = pages[pages.length - 2]; // 获取上一个页面实例
+
       if (params.userBeneficiaryId) {
         const { data } = await api_userBeneficiaryUpdate({
           id: params.userBeneficiaryId,
@@ -746,7 +750,7 @@ Page({
           title: '保存成功',
           icon: 'none'
         })
-        userBeneficiaryId = data.data.id
+        prevPage?.setData({ backParams: { userBeneficiaryId: data.data.id, name: params.name, phone: params.phone, schoolInfo: (params.provinceName || '') + (params.cityName || '') + (params.regionName || '') + params.schoolAreaName + params.currentGradeTxt + params.currentClassTxt } });
       } else {
         const { data } = await api_userBeneficiarySave({
           ...objs
@@ -756,16 +760,11 @@ Page({
           title: '保存成功',
           icon: 'none'
         })
-        userBeneficiaryId = data.data.id
+        prevPage?.setData({ backParams: { userBeneficiaryId: data.data.id, name: params.name, phone: params.phone, schoolInfo: (params.provinceName || '') + (params.cityName || '') + (params.regionName || '') + params.schoolAreaName  + params.currentGradeTxt + params.currentClassTxt } });
       }
 
-      this.setData({
-        userBeneficiaryId,
-        userBeneficiaryInfo: userBeneficiary
-      })
-
       this.onSetCatch(params)
-      this.onCloseBuyer()
+      wx.navigateBack()
     } catch {
       //
     }

+ 11 - 10
miniprogram/pages/buyerInformation/index.wxml

@@ -15,7 +15,7 @@
         <van-field model:value="{{ phone }}" maxlength="11" type="number" placeholder="请输入手机号码" input-align="right">
           <view class="required" slot="label"><text>*</text>联系方式</view>
         </van-field>
-        <van-field model:value="{{ name }}" placeholder="请输入学生姓名" input-align="right" maxlength="15">
+        <van-field model:value="{{ name }}" placeholder="请输入学生姓名" input-align="right" maxlength="14">
           <view class="required" slot="label"><text>*</text>学生姓名</view>
         </van-field>
         <van-field border="{{ false }}" input-align="right">
@@ -25,8 +25,12 @@
             <view class="gender-item {{ gender === '0' ? 'active' : '' }}" bind:tap="onCheckGender" data-gender="0">女</view>
           </view>
         </van-field>
-        <van-field value="{{ currentGradeTxt }}" input-align="right" label="所在年级" placeholder="请选择所在年级" is-link readonly bind:tap="onSelectGradeClass" />
-        <van-field value="{{ currentClassTxt }}" input-align="right" label="所在班级" placeholder="请选择所在年级" is-link readonly bind:tap="onSelectClass" />
+        <van-field value="{{ currentGradeTxt }}" input-align="right"  placeholder="请选择所在年级" is-link readonly bind:tap="onSelectGradeClass" >
+          <view class="required" slot="label"><text>*</text>所在年级</view>
+        </van-field>
+        <van-field value="{{ currentClassTxt }}" input-align="right" placeholder="请选择所在年级" is-link readonly bind:tap="onSelectClass" >
+          <view class="required" slot="label"><text>*</text>所在班级</view>
+        </van-field>
       </view>
     </view>
   </scroll-view>
@@ -40,7 +44,7 @@
 
   <!-- 地区 -->
   <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{103}}" show="{{showArea}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseAreaList" bind:after-leave="onAreaAfterLeave" bind:before-enter="onAreaBeforeEnter">
-    <van-area wx:if="{{ !showAreaAfterLeave }}" id='area1' areaList="{{areaList}}" visible-item-count="8" item-height="46" value="{{ regionCode || cityCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
+    <van-area wx:if="{{ !showAreaAfterLeave }}" id='area1' areaList="{{areaList}}" visible-item-count="6" item-height="46" value="{{ regionCode || cityCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
   </van-popup>
 
   <!-- 学校 -->
@@ -49,16 +53,13 @@
       <view class="toolbar-cancel" bind:tap="onCloseSchool">取消</view>
       <view class="toolbar-confirm" bind:tap="onSubmitSchool">确认</view>
     </view>
-    <view class="select-school">
-      <van-field border="false" value="{{ provinceName ? provinceName + ' ' + cityName + ' ' + regionName : '' }}" bind:tap="onShowAreaList" placeholder="请选择学校地区" is-link readonly />
-    </view>
     <view class="searchList" wx:if="{{ !showSchoolAfterLeave }}">
       <van-search value="{{ searchName }}" use-left-icon-slot use-action-slot show-action custom-class="searchInput" placeholder="请输入学校名称关键词" bind:search="onSearch" bind:clear="onSearch" bind:change="onSearchChange">
         <image slot="left-icon" src="./images/icon-search.png" class="icon-search" />
         <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 loading="{{ schoolLoading }}" wx:if="{{ !showSchoolAfterLeave && schoolAreaList.length > 0 }}" columns="{{ schoolAreaList }}" bind:change="onChangeSchool" visible-item-count="4" default-index="{{ schoolAreaIndex }}">
     </van-picker>
     <view class="empty-box" wx:if="{{ schoolAreaList.length <= 0 }}">
       <view class="empty_loading" wx:if="{{ schoolLoading }}">
@@ -72,12 +73,12 @@
 
   <!-- 年级 -->
   <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{102}}" show="{{showGradeClass}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseGradeClass" bind:after-leave="onGradeClassAfterLeave" bind:before-enter="onGradeClassBeforeEnter">
-    <van-picker wx:if="{{ !showGradeClassAfterLeave }}" columns="{{ gradeGradeList }}" visible-item-count="6" show-toolbar default-index="{{ gradeGradeIndex }}" bind:cancel="onCloseGradeClass" bind:confirm="onSubmitGradeClass">
+    <van-picker wx:if="{{ !showGradeClassAfterLeave }}" columns="{{ gradeGradeList }}" visible-item-count="4" show-toolbar default-index="{{ gradeGradeIndex }}" bind:cancel="onCloseGradeClass" bind:confirm="onSubmitGradeClass">
     </van-picker>
   </van-popup>
   <!-- 班级 -->
   <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{102}}" show="{{showClass}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseClass" bind:after-leave="onClassAfterLeave" bind:before-enter="onClassBeforeEnter">
-    <van-picker wx:if="{{ !showClassAfterLeave }}" columns="{{ classList }}" visible-item-count="6" show-toolbar default-index="{{ classIndex }}" bind:cancel="onCloseClass" bind:confirm="onSubmitClass">
+    <van-picker wx:if="{{ !showClassAfterLeave }}" columns="{{ classList }}" visible-item-count="4" show-toolbar default-index="{{ classIndex }}" bind:cancel="onCloseClass" bind:confirm="onSubmitClass">
     </van-picker>
   </van-popup>
 </view>

BIN
miniprogram/pages/orders/images/buyuser.png


BIN
miniprogram/pages/orders/images/icon-address.png


BIN
miniprogram/pages/orders/images/icon-arrow-right.png


+ 158 - 42
miniprogram/pages/orders/order-detail.less

@@ -3,12 +3,23 @@ page {
   height: 100vh;
   display: flex;
   flex-direction: column;
-  background: #F5F6F7;
+  background: #F4F4F4;
 }
 
 .container {
   display: flex;
   flex-direction: column;
+  position: relative;
+
+  &::before {
+    content: '';
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 254rpx;
+    background: linear-gradient(180deg, #FDEC00 0%, #FAD400 100%);
+  }
 }
 
 .record-list {
@@ -74,9 +85,15 @@ page {
   }
 
   .icon-man {
-    width: 36rpx;
-    height: 36rpx;
+    width: 44rpx;
+    height: 44rpx;
     margin-right: 16rpx;
+    flex-shrink: 0;
+
+    &.selected {
+      width: 36rpx;
+      height: 36rpx;
+    }
   }
 
   .addBuyer-left {
@@ -84,25 +101,53 @@ page {
   }
 
   .users {
+    display: flex;
     font-weight: 600;
     font-size: 32rpx;
     color: #131415;
-    line-height: 40rpx;
+    line-height: 44rpx;
 
-    width: 520rpx;
+    width: 540rpx;
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
   }
 
   .address {
-    padding-top: 16rpx;
-    font-size: 26rpx;
-    color: #777777;
-    line-height: 34rpx;
+    padding-bottom: 16rpx;
+    font-size: 28rpx;
+    color: #333333;
+    font-weight: bold;
+    line-height: 40rpx;
 
     text {
       padding-right: 24rpx;
+
+      &:last-child {
+        color: #777777;
+        font-weight: 400;
+      }
+    }
+
+  }
+
+  .selected {
+    .users {
+      font-weight: 400;
+      font-size: 28rpx;
+      color: #131415;
+    }
+
+    .address {
+      display: flex;
+      // flex-direction: column;
+
+      .userName {
+        max-width: 300rpx;
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+      }
     }
   }
 
@@ -128,11 +173,11 @@ page {
   }
 
   .goods-icon {
-    width: 160rpx;
-    height: 160rpx;
-    margin-right: 24rpx;
+    width: 140rpx;
+    height: 140rpx;
+    margin-right: 20rpx;
     flex-shrink: 0;
-    border-radius: 6px;
+    border-radius: 11px;
     overflow: hidden;
   }
 
@@ -153,7 +198,7 @@ page {
       overflow: hidden;
       font-weight: 600;
       font-size: 30rpx;
-      color: #131415;
+      color: #333;
       line-height: 50rpx;
       text-overflow: ellipsis;
       max-width: 280rpx;
@@ -167,7 +212,7 @@ page {
       line-height: 48rpx;
 
       text {
-        font-size: 32rpx;
+        font-size: 36rpx;
         padding-left: 4rpx;
       }
     }
@@ -208,17 +253,17 @@ page {
     justify-content: space-between;
 
     .goods-card {
-      background: #FEEDF0;
+      background: #FFF1E0;
       border-radius: 6rpx;
       font-size: 26rpx;
-      color: #FE2451;
+      color: #FE4600;
       line-height: 40rpx;
       padding: 0 12rpx;
     }
 
     .goods-num {
       font-size: 26rpx;
-      color: #777;
+      color: #AAA;
       line-height: 36rpx;
     }
   }
@@ -266,6 +311,7 @@ page {
 
   &:first-child {
     padding-top: 0;
+
     .title {
       color: #777;
     }
@@ -323,28 +369,81 @@ page {
       font-size: 24rpx;
       color: #777777;
       vertical-align: middle;
+      padding-right: 6rpx;
+    }
+
+    .red {
+      color: #FE4600;
     }
 
     .stuff {
-      font-size: 38rpx;
+      font-size: 28rpx;
       padding-right: 4rpx;
     }
 
     .priceZ {
       font-size: 40rpx;
-      line-height: 1;
+      // line-height: 1;
+      color: #FE4600;
     }
 
     .priceF {
       font-size: 24rpx;
+      color: #FE4600;
+    }
+
+    .afterTxt {
+      font-weight: 400;
+      font-size: 24rpx;
+      color: #777777;
+      vertical-align: middle;
+      padding-left: 12rpx;
+    }
+
+    .afterPrice {
+      color: #333333;
+      font-size: 36rpx;
     }
   }
 }
 
-.order-time {
+.buyUsers {
+  position: relative;
   margin: 24rpx 26rpx 0;
+  background: #FFFFFF;
   border-radius: 20rpx;
   padding: 28rpx 24rpx;
+
+  .buyuser_img {
+    position: absolute;
+    top: 0;
+    right: 0;
+    width: 160rpx !important;
+  }
+
+  .users {
+    font-size: 32rpx;
+    color: #777;
+
+    text {
+      color: #131415;
+      font-weight: bold;
+      padding-right: 12rpx;
+    }
+  }
+
+  .detail {
+    padding-top: 8rpx;
+    font-size: 26rpx;
+    color: #777777;
+    line-height: 36rpx;
+  }
+}
+
+.order-time {
+  margin: 24rpx 26rpx 0;
+  border-radius: 20rpx;
+  padding: 0 24rpx;
   background-color: #FFFFFF;
 
   .line {
@@ -357,20 +456,23 @@ page {
   .order-item {
     display: flex;
     justify-content: space-between;
-    padding-bottom: 28rpx;
+    padding: 36rpx 0;
+    border-bottom: 2rpx solid #F0F0F0;
+
     &:last-child {
-      padding-bottom: 0;
+      border-bottom: 0;
     }
 
     .title {
-      font-size: 28rpx;
+      font-size: 30rpx;
       color: #131415;
       line-height: 40rpx;
       flex-shrink: 0;
       padding-right: 46rpx;
     }
+
     .value {
-      font-size: 28rpx;
+      font-size: 30rpx;
       color: #777777;
       line-height: 42rpx;
       display: flex;
@@ -378,6 +480,7 @@ page {
       text-align: right;
       word-break: break-all;
       word-wrap: break-word;
+
       &.red {
         color: #FE2451;
       }
@@ -396,8 +499,8 @@ page {
       }
 
       .copy {
-        font-size: 28rpx;
-        color: #FE2451;
+        font-size: 30rpx;
+        color: #131415;
         line-height: 42rpx;
         display: flex;
         align-items: center;
@@ -443,10 +546,10 @@ page {
   left: 0;
   width: 100%;
   background-color: #FFFFFF;
-  padding: 20rpx 32rpx 58rpx 32rpx;
-  display: flex;
-  justify-content: flex-end;
-  box-sizing: border-box;
+  // display: flex;
+  // justify-content: space-between;
+  // justify-content: flex-end;
+  // box-sizing: border-box;
 
   .orders {
     display: flex;
@@ -469,16 +572,20 @@ page {
 
   .more {
     display: flex;
+    justify-content: space-between;
+    padding: 20rpx 32rpx 58rpx 32rpx;
   }
 
   .price-section {
     display: flex;
-    align-items: center;
+    flex-direction: column;
+    justify-content: center;
   }
 
   .price {
     display: flex;
     align-items: flex-end;
+    padding-bottom: 4rpx;
 
     .desc {
       font-size: 28rpx;
@@ -489,7 +596,7 @@ page {
 
     .currentPrice {
       font-weight: bold;
-      color: #FE2451;
+      color: #333333;
       font-family: DINAlternate, DINAlternate;
       display: flex;
       align-items: flex-end;
@@ -516,24 +623,33 @@ page {
       height: 20rpx;
     }
 
-    .discountPrice {
-      padding-bottom: 2rpx;
-      font-size: 24rpx;
-      color: #FE2451;
+
+  }
+
+  .discountPrice {
+    font-size: 26rpx;
+    color: #FE4600;
+
+    text {
+      font-weight: bold;
     }
   }
 
   button {
     margin-left: 12rpx !important;
-    width: 240rpx !important;
-    line-height: 88rpx;
-    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
-    border-radius: 78rpx;
+    line-height: 94rpx;
     padding: 0 !important;
     font-weight: 500;
+    width: 292rpx !important;
     font-size: 32rpx;
-    color: #FFFFFF;
+    color: #FEFFCA;
+    margin: 0 !important;
     flex-shrink: 0;
+
+    background: linear-gradient(90deg, #544F4A 0%, #302F2B 100%);
+    box-shadow: 0rpx 14rpx 14rpx 0rpx rgba(0, 0, 0, 0.18);
+    border-radius: 30rpx;
+    border: 8rpx solid #FFFFFF;
   }
 }
 

+ 20 - 227
miniprogram/pages/orders/order-detail.ts

@@ -34,28 +34,13 @@ Page({
       phoneNumber: '',
       schoolInfo: ''
     },
-    isExpanded: false,
     paymentType: null as any, // 支付类型
     paymentChannel: null as any,
     showService: false,
 
     showArea: false,
     areaList: [] as any,
-    currentValues: [] as any,
-    addressShow: false,
-    addressAfterLeave: false,
 
-    // 添加地址表单信息
-    id: "",
-    name: '',
-    phoneNumber: '',
-    detailAddress: '',
-    cityCode: 0,
-    cityName: "",
-    provinceCode: 0,
-    provinceName: "",
-    regionCode: '',
-    regionName: "",
   },
 
   /**
@@ -63,6 +48,7 @@ Page({
    */
   onLoad(options: any) {
     this.queryPayType()
+    this.getAddress()
     if (options.orderInfo) {
       console.log('goods', options)
       const goods = JSON.parse(decodeURIComponent(options.orderInfo));
@@ -111,7 +97,6 @@ Page({
       infos.decimalPart = allAfterPrice.decimalPart
       infos.discountIntegerPart = allDiscount.integerPart
       infos.discountDecimalPart = allDiscount.decimalPart
-      // console.log(infos, 'infos')
       this.setData({
         goodsInfo: infos,
         userBeneficiaryId: options.userBeneficiaryId,
@@ -132,8 +117,12 @@ Page({
 
       const result = data.data || {}
       const addresses: any = result.addresses
-      const beneficiary: any = result.beneficiary
-      const tempSchoolAddress = [beneficiary?.provinceName, beneficiary?.cityName || '', beneficiary?.regionName || '', beneficiary?.schoolAreaName, GRADE_ENUM[beneficiary?.currentGradeNum], beneficiary?.currentClass + '班']
+      const tempSchoolAddress = [result.beneficiary?.provinceName || '', result.beneficiary?.cityName || '', result.beneficiary?.regionName || '', result.beneficiary?.schoolAreaName, GRADE_ENUM[result.beneficiary?.currentGradeNum], result.beneficiary?.currentClass + '班']
+      const beneficiary = {
+        name: result.beneficiary?.name,
+        phoneNumber: result.beneficiary?.phone,
+        schoolInfo: tempSchoolAddress.join('')
+      }
       this.setData({
         receiveAddress: addresses?.id,
         receiveAddressInfo: {
@@ -141,13 +130,9 @@ Page({
           name: addresses?.name,
           phoneNumber: addresses?.phoneNumber
         },
-        userBeneficiaryId: beneficiary.schoolAreaId, // 添加购买人信息
-        userBeneficiaryInfo: {
-          name: beneficiary.name,
-          phoneNumber: beneficiary.phone,
-          schoolInfo: tempSchoolAddress.join('')
-        },
-        status: result.wechatStatus, 
+        userBeneficiaryId: result.beneficiary.schoolAreaId, // 添加购买人信息
+        userBeneficiaryInfo: beneficiary,
+        status: result.wechatStatus,
         'goodsInfo.createTime': result.createTime
       }, () => {
         console.log(this.data)
@@ -160,12 +145,12 @@ Page({
   formatPeriod(num: number, type: string) {
     if (!type) return ''
     const template: any = {
-      DAY: "天",
-      MONTH: "月",
-      YEAR: "年"
+      DAY: "天",
+      MONTH: "月",
+      YEAR: "年"
     }
     if (type === "YEAR" && num >= 99) {
-      return '永久'
+      return '永久'
     }
     return num + (template[type] || '')
   },
@@ -189,13 +174,16 @@ Page({
   },
   /** 添加收货地址 */
   onSelectAddress() {
+    if (this.data.goodsInfo?.orderNo) {
+      return
+    }
     console.log(this.data.addressList.length > 0, this.data.receiveAddress)
     if (this.data.addressList.length > 0 || this.data.receiveAddress) {
       wx.navigateTo({
         url: `../address/index?receiveAddress=${this.data.receiveAddress}`,
       })
     } else {
-      this.onShowAddress()
+
     }
   },
   onPayError(message?: string) {
@@ -359,12 +347,6 @@ Page({
     })
   },
   /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-  },
-
-  /**
    * 生命周期函数--监听页面显示
    */
   onShow() {
@@ -385,208 +367,19 @@ Page({
       const { data } = await api_userReceiveAddressPage({ page: 1, rows: -1 })
       this.setData({
         addressList: data.data.rows || []
-      }, () => {
-        if (this.data.addressList.length <= 0) {
-          this.getAreas()
-        }
       })
     } catch {
       // 
     }
   },
-  /** 获取省市区 */
-  async getAreas() {
-    try {
-      const { data } = await api_sysAreaQueryAllProvince({})
-      const areaList: any = this.formateArea(data.data)
-      const currentValues = []
-      if (areaList?.province_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.province_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.province_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      if (areaList?.city_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.city_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.city_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      if (areaList?.county_list) {
-        // 获取第一个键值对
-        const firstKey = Object.keys(areaList?.county_list)[0];
-        // 通过键获取值
-        const firstValue = areaList?.county_list[firstKey];
-        currentValues.push({
-          code: firstKey,
-          name: firstValue
-        })
-      }
-      this.setData({
-        areaList,
-        currentValues
-      })
-    } catch {
-      // 
-    }
-  },
-  formateArea(area: any[]) {
-    const province_list: { [_: string]: string } = {};
-    const city_list: { [_: string]: string } = {};
-    const county_list: { [_: string]: string } = {};
-    area.forEach((item: any) => {
-      province_list[item.code] = item.name;
-    });
-    area.forEach((item: any) => {
-      item.areas && item.areas.forEach((city: any) => {
-        city_list[city.code] = city.name;
-      });
-    });
-    area.forEach((item: any) => {
-      item.areas && item.areas.forEach((city: any) => {
-        city.areas && city.areas.forEach((county: any) => {
-          county_list[county.code] = county.name;
-        });
-      });
-    });
-    return {
-      province_list,
-      city_list,
-      county_list
-    };
-  },
-  /** 显示选择地区 */
-  async onShowAreaList() {
-    this.setData({
-      showArea: true
-    })
-  },
-  /** 关闭选择地区 */
-  onCloseAreaList() {
-    this.setData({
-      showArea: false
-    })
-  },
-  /** 确定选择地区 */
-  submitArea(e: any) {
-    const selectedOptions: any = e.detail.values
-    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,
-      showArea: false,
-    })
-  },
-  onShowAddress() {
-    this.setData({
-      addressAfterLeave: false,
-      addressShow: true
-    })
-  },
-  onCloseAddress() {
-    this.setData({
-      addressShow: false
-    })
-  },
-  onAddressAfterLeave() {
-    this.setData({
-      addressAfterLeave: true,
-      name: '',
-      phoneNumber: '',
-      detailAddress: '',
-      cityCode: 0,
-      cityName: "",
-      provinceCode: 0,
-      provinceName: "",
-      regionCode: '',
-      regionName: "",
-    })
-  },
-  /** 创建/修改收货地址 */
-  async onOperationAddress() {
-    const addressForm = this.data
-    try {
-      if (!addressForm.name) {
-        wx.showToast({
-          title: '请输入收货人姓名',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.phoneNumber || !/^1[3456789]\d{9}$/.test(addressForm.phoneNumber)) {
-        wx.showToast({
-          title: '请输入正确的手机号码',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.provinceCode || !addressForm.cityCode || !addressForm.regionCode) {
-        wx.showToast({
-          title: '请选择地区',
-          icon: "none"
-        })
-        return
-      }
-      if (!addressForm.detailAddress) {
-        wx.showToast({
-          title: '请输入详细地址',
-          icon: "none"
-        })
-        return
-      }
-      const params = {
-        name: addressForm.name,
-        phoneNumber: addressForm.phoneNumber,
-        province: addressForm.provinceCode,
-        city: addressForm.cityCode,
-        region: addressForm.regionCode,
-        detailAddress: addressForm.detailAddress
-      }
-      const { data } = await api_userReceiveAddressSave({
-        ...params
-      })
-      wx.showToast({
-        title: '添加成功',
-        icon: 'none'
-      })
-      this.setData({
-        receiveAddress: data.data, // 选择的地址信息
-        receiveAddressInfo: {
-          addressDetail: (addressForm.provinceName || '') + (addressForm.cityName || '') + (addressForm.regionName || '') + addressForm.detailAddress,
-          name: addressForm.name,
-          phoneNumber: addressForm.phoneNumber
-        }
-      })
-      this.onCloseAddress()
-    } catch (e) {
-      // 
-      console.log(e, '1212')
-    }
-  },
-  onExpanded() {
-    this.setData({
-      isExpanded: !this.data.isExpanded
-    })
-  },
   onCopy(e: { currentTarget: any }) {
     wx.setClipboardData({
       data: e.currentTarget.dataset.orderno,
       success: () => {
-        wx.showToast({title: '复制成功', icon: 'none'})
+        wx.showToast({ title: '复制成功', icon: 'none' })
       },
       fail: () => {
-        wx.showToast({title: '复制失败,请稍后再试', icon: 'none'})
+        wx.showToast({ title: '复制失败,请稍后再试', icon: 'none' })
       }
     })
   },

+ 28 - 146
miniprogram/pages/orders/order-detail.wxml

@@ -1,39 +1,31 @@
 <!--pages/orders/order-detail.wxml-->
 <view class="container">
-  <navigation-bar title="{{ goodsInfo.orderNo ? '订单详情' : '核对订单' }}"></navigation-bar>
+  <navigation-bar title="{{ goodsInfo.orderNo ? '待付款' : '确认订单' }}"></navigation-bar>
 
   <scroll-view class="record-list" type="list" scroll-y>
     <view class="scroll-container">
-      <view class="order-status" wx:if="{{statusList[status]}}">
-        <view class="status">
-          <image src="{{ statusList[status].logo }}"></image>
-          <text>{{ statusList[status].title }}</text>
-        </view>
-        <view class="tips">{{ statusList[status].content }}</view>
-      </view>
-
       <!-- 添加地址 -->
-      <view wx:if="{{ hasInstrument && !goodsInfo.orderNo }}" class="addBuyer" bind:tap="onSelectAddress">
-        <image src="./images/address-top.png" mode="widthFix" class="addressTop"></image>
+      <view wx:if="{{ hasInstrument }}" class="addBuyer" bind:tap="onSelectAddress">
         <view class="addBuyer-left">
-          <image src="./images/icon-address.png" class="icon-man"></image>
-          <view class="info" wx:if="{{ receiveAddress }}">
-            <view class="users">
-              {{ receiveAddressInfo.addressDetail }}
-            </view>
+          <view class="info selected" wx:if="{{ receiveAddress }}">
             <view class="address">
-              <text>{{ receiveAddressInfo.name }}</text>
+              <image src="./images/icon-address.png" class="icon-man {{ receiveAddress ? 'selected' : '' }}"></image>
+              <text class="userName">{{ receiveAddressInfo.name }}</text>
               <text>{{ receiveAddressInfo.phoneNumber }}</text>
             </view>
+            <view class="users">
+              {{ receiveAddressInfo.addressDetail }}
+            </view>
           </view>
           <view class="info" wx:else>
             <view class="users">
+              <image src="./images/icon-address.png" class="icon-man {{ receiveAddress ? 'selected' : '' }}"></image>
               新建收货地址
             </view>
-            <view class="address">请填写您的收货地址与信息</view>
+            <!-- <view class="address">请填写您的收货地址与信息</view> -->
           </view>
         </view>
-        <image src="./images/icon-arrow-right.png" class="arrow-right"></image>
+        <image wx:if="{{ !goodsInfo.orderNo }}" src="./images/icon-arrow-right.png" class="arrow-right"></image>
       </view>
 
       <view class="order-content">
@@ -48,85 +40,39 @@
               <view>
                 <text class="goods-card" wx:if="{{ item.typePeriod }}">{{ item.typePeriod }}</text>
               </view>
-              <view class="goods-num">x 1</view>
+              <view class="goods-num">优惠前 ¥{{ item.originalPrice }}</view>
             </view>
           </view>
         </view>
 
         <view class="goodsInfos">
-          <view class="goodsInfo-item">
-            <text class="title">商品总额</text>
-
-            <view class="goods-price">
-              <text class="stuff">¥</text>
-              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
-            </view>
-          </view>
-
-          <view class="goodsInfo-item" wx:if="{{ goodsInfo.allOriginPrice > goodsInfo.allSalePrice }}">
-            <text class="title">惊喜优惠</text>
-
-            <!-- <view class="calc-price">-¥ {{ goodsInfo.allDiscountPrice }}</view> -->
-            <view class="goods-price calc-price">
-              <text class="stuff">¥</text>
-              <text class="priceZ">{{ goodsInfo.discountIntegerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.discountDecimalPart }}</text>
-            </view>
-          </view>
-
           <view class="qrcode-line"></view>
 
           <view class="goodsInfo-count">
             <view class="goods-price">
-              <text class="before">共{{ goodsInfo.goodsList.length }}件:</text>
+              <text class="before">共{{ goodsInfo.goodsList.length }}件,共减</text>
+              <text class="stuff red">¥</text>
+              <text class="priceZ">{{ goodsInfo.discountIntegerPart }}.{{ goodsInfo.discountDecimalPart }}</text>
+              <!-- <text class="priceF">.{{ goodsInfo.decimalPart }}</text> -->
+              <text class="afterTxt">应付:</text>
               <text class="stuff">¥</text>
-              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+              <text class="afterPrice">{{ goodsInfo.integerPart }}.{{ goodsInfo.decimalPart }}</text>
             </view>
           </view>
         </view>
       </view>
 
-      <view class="wechat-section" wx:if="{{ !goodsInfo.orderNo }}">
-        <view class="wechat-left">
-          <image src="./images/icon-wechat.png"></image>
-          微信支付
+      <view class="buyUsers">
+        <view class="users">
+          <text>{{ goodsInfo.userBeneficiaryInfo.name }}</text>{{ goodsInfo.userBeneficiaryInfo.phoneNumber }}
         </view>
+        <view class="detail">{{goodsInfo.userBeneficiaryInfo.schoolInfo}}</view>
 
-        <image src="./images/icon-checkbox.png" class="checkbox"></image>
+        <image class="buyuser_img" mode="widthFix" src="./images/buyuser.png"></image>
       </view>
 
-
       <view class="order-time" wx:if="{{ goodsInfo.orderNo }}">
-        <block wx:if="{{ receiveAddress }}">
-          <template is="address" data="{{ receiveAddressInfo }}"></template>
-          <view class="line"></view>
-          <block wx:if="{{ isExpanded }}">
-            <block wx:if="{{ userBeneficiaryId }}">
-              <template is="schoolInfo" data="{{ userBeneficiaryInfo }}"></template>
-              <view class="line" wx:if="{{ !receiveAddress }}"></view>
-            </block>
-            <template is="orderInfo" data="{{ goodsInfo }}"></template>
-          </block>
-        </block>
-        <block wx:else>
-          <block wx:if="{{ userBeneficiaryId }}">
-            <template is="schoolInfo" data="{{ userBeneficiaryInfo }}"></template>
-            <view class="line" wx:if="{{ !receiveAddress }}"></view>
-          </block>
-          <block wx:if="{{ isExpanded || !userBeneficiaryId }}">
-            <template is="orderInfo" data="{{ goodsInfo }}"></template>
-          </block>
-        </block>
-
-        <view class="order-item" bind:tap="onExpanded" wx:if="{{ userBeneficiaryId }}">
-          <view class="title">更多信息</view>
-          <view class="value {{ isExpanded ? 'expanded' : '' }}">
-            {{ isExpanded ? '收起' : '展开' }}
-            <image src="./images/icon-down.png" class="iconDown"></image>
-          </view>
-        </view>
+        <template is="orderInfo" data="{{ goodsInfo }}"></template>
       </view>
     </view>
 
@@ -135,87 +81,23 @@
       <view class="more">
         <view class="price-section">
           <view class="price">
-            <view class="desc">共计</view>
+            <view class="desc">应付:</view>
             <view class="currentPrice">
               <text class="stuff">¥</text>
               <text class="priceZ">{{ goodsInfo.integerPart }}</text>
               <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
             </view>
-
-            <text class="line"></text>
-
-            <text class="discountPrice">优惠 ¥{{ goodsInfo.allDiscountPrice }}</text>
           </view>
+          <view class="discountPrice">共减 <text>¥{{ goodsInfo.allDiscountPrice }}</text></view>
         </view>
-        <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '提交' }}</button>
+        <button type="primary" bind:tap="onSubmit">{{ goodsInfo.orderNo ? '继续支付' : '立即支付' }}</button>
       </view>
     </view>
   </scroll-view>
 
-
-
-  <van-popup show="{{ addressShow }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseAddress" position="bottom" round z-index="101" bind:after-leave="onAddressAfterLeave">
-    <view class="addressContainer" wx:if="{{ !addressAfterLeave }}">
-      <image src="./images/icon-close1.png" class="icon-close" bind:tap="onCloseAddress" />
-      <view class="pop-address-title">
-        {{ id ? '修改收货地址' : '新建收货地址' }}
-      </view>
-
-      <van-cell-group border="{{ false }}" class="cell-group">
-        <van-field model:value="{{ name }}" label="收货人" placeholder="请填写收货人姓名" placeholder-style="color: #bbb" />
-        <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-cell-group>
-
-      <view class="pop-btn-group">
-        <button class="submit-btn" bind:tap="onOperationAddress">确认</button>
-      </view>
-    </view>
-  </van-popup>
-
-  <!-- 地区 -->
-  <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{103}}" show="{{showArea}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseAreaList">
-    <van-area id='area1' areaList="{{areaList}}" visible-item-count="9" item-height="46" value="{{ regionCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
-  </van-popup>
   <!-- <service popShow="{{ showService }}" bind:changePop="changePop"></service> -->
 </view>
 
-
-<template name="address">
-  <view class="order-item">
-    <view class="title">收货人</view>
-    <view class="value">{{ receiveAddressInfo.name }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">电话号码</view>
-    <view class="value">{{ receiveAddressInfo.phoneNumber }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">收货地址</view>
-    <view class="value">{{ receiveAddressInfo.addressDetail }}</view>
-  </view>
-</template>
-
-<template name="schoolInfo">
-  <view class="order-item">
-    <view class="title">享用者姓名</view>
-    <view class="value">{{ userBeneficiaryInfo.name }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">电话号码</view>
-    <view class="value">{{ userBeneficiaryInfo.phoneNumber }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">学校信息</view>
-    <view class="value">{{ userBeneficiaryInfo.schoolInfo }}</view>
-  </view>
-
-  <!-- name: beneficiary.name,
-      phoneNumber: beneficiary.phone,
-      schoolInfo: tempSchoolAddress.join('') -->
-</template>
-
 <template name="orderInfo">
   <view class="order-item">
     <view class="title">订单编号</view>
@@ -224,7 +106,7 @@
     </view>
   </view>
   <view class="order-item">
-    <view class="title">创建时间</view>
+    <view class="title line">下单时间</view>
     <view class="value">{{ goodsInfo.createTime }}</view>
   </view>
 </template>

+ 381 - 35
miniprogram/pages/orders/order-result.less

@@ -3,14 +3,26 @@ page {
   height: 100vh;
   display: flex;
   flex-direction: column;
-  background: #F5F6F7;
+  background: #F4F4F4;
 }
+
 .container {
   display: flex;
   flex-direction: column;
   width: 100%;
   flex: 1;
   overflow-y: auto;
+  position: relative;
+
+  &::before {
+    content: '';
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 254rpx;
+    background: linear-gradient(180deg, #FDEC00 0%, #FAD400 100%);
+  }
 }
 
 .record-list {
@@ -29,13 +41,16 @@ page {
   background-color: #FFFFFF;
   border-radius: 20rpx;
   padding: 24rpx 32rpx;
+
   .status {
     display: flex;
+
     image {
       width: 48rpx;
       height: 48rpx;
       margin-right: 16rpx;
     }
+
     text {
       font-weight: 600;
       font-size: 36rpx;
@@ -43,6 +58,7 @@ page {
       line-height: 48rpx;
     }
   }
+
   .tips {
     padding-top: 24rpx;
     font-size: 28rpx;
@@ -55,22 +71,23 @@ page {
   margin: 24rpx 26rpx 0;
   border-radius: 20rpx;
   padding: 28rpx 24rpx;
-  display: flex;
-  flex-direction: column;
   background-color: #FFFFFF;
 }
+
 .item-content {
   display: flex;
   width: 100%;
+
   &+.item-content {
     padding-top: 40rpx;
   }
+
   .goods-icon {
-    width: 160rpx;
-    height: 160rpx;
-    margin-right: 24rpx;
+    width: 140rpx;
+    height: 140rpx;
+    margin-right: 20rpx;
     flex-shrink: 0;
-    border-radius: 6px;
+    border-radius: 11px;
     overflow: hidden;
   }
 
@@ -84,53 +101,313 @@ page {
     display: flex;
     justify-content: space-between;
     padding-top: 4rpx;
+
     .goods-name {
       flex: 1 auto;
       white-space: nowrap;
       overflow: hidden;
       font-weight: 600;
       font-size: 30rpx;
-      color: #131415;
+      color: #333;
       line-height: 50rpx;
       text-overflow: ellipsis;
       max-width: 280rpx;
     }
 
-    .goods-price {
-      flex-shrink: 0;
-      font-family: DINAlternate, DINAlternate;
+    .goods-current-price {
       font-weight: bold;
+      font-family: DINAlternate, DINAlternate;
       font-size: 28rpx;
       color: #131415;
       line-height: 48rpx;
-       text {
-        font-size: 32rpx;
+
+      text {
+        font-size: 36rpx;
         padding-left: 4rpx;
       }
     }
   }
 
+  .goods-price {
+    flex-shrink: 0;
+    font-family: DINAlternate, DINAlternate;
+    font-weight: bold;
+    color: #131415;
+    line-height: 48rpx;
+
+    .stuff {
+      font-size: 28rpx;
+      padding-right: 4rpx;
+    }
+
+    .priceZ {
+      font-size: 40rpx;
+    }
+
+    .priceF {
+      font-size: 32rpx;
+    }
+  }
+
+  .origin-price {
+    font-weight: 400;
+    font-size: 24rpx;
+    color: #6D4718;
+    line-height: 1;
+  }
+
   .goods-type {
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    padding-top: 12rpx;
+    padding-top: 10rpx;
+    justify-content: space-between;
+
     .goods-card {
-      background: #FEEDF0;
+      background: #FFF1E0;
       border-radius: 6rpx;
       font-size: 26rpx;
-      color: #FE2451;
+      color: #FE4600;
       line-height: 40rpx;
       padding: 0 12rpx;
     }
+
     .goods-num {
       font-size: 26rpx;
-      color: #777777;
+      color: #AAA;
       line-height: 36rpx;
     }
   }
 }
 
+.goodsInfos {
+  margin-top: 30rpx;
+  // border-top: 2rpx solid #F2F2F2;
+
+  .qrcode-line {
+    position: relative;
+    // background: linear-gradient(to right, transparent 50%, rgba(219, 219, 219, 1) 50%) repeat-x; // 设置水平方向的线性渐变,透明与半透明色交替,模拟虚线线段
+    // background-size: 10px 1px; // 设置背景大小,控制虚线的线段长度和粗细,这里线段长度为10px,粗细为1px
+    background-color: #F2F2F2;
+    height: 2rpx; // 元素高度,可根据实际需求调整,用于展示虚线效果的高度范围
+    margin: 24rpx 0 28rpx;
+
+    // &::before,
+    // &::after {
+    //   content: '';
+    //   position: absolute;
+    //   top: -20rpx;
+    //   display: block;
+    //   width: 40rpx;
+    //   height: 40rpx;
+    //   background-color: #F4F4F4;
+    //   border-radius: 50%;
+    // }
+
+    // &::before {
+    //   left: -50rpx;
+    // }
+
+    // &::after {
+    //   right: -50rpx;
+    // }
+  }
+}
+
+.goodsInfo-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding-top: 28rpx;
+
+  &:first-child {
+    padding-top: 0;
+
+    .title {
+      color: #777;
+    }
+  }
+
+  .title {
+    font-weight: 400;
+    font-size: 28rpx;
+    color: #FE2451;
+    line-height: 40rpx;
+  }
+
+  .goods-price {
+    flex-shrink: 0;
+    font-family: DINAlternate, DINAlternate;
+    font-weight: bold;
+    color: #131415;
+    line-height: 48rpx;
+
+    .stuff {
+      font-size: 28rpx;
+      padding-right: 4rpx;
+    }
+
+    .priceZ {
+      font-size: 32rpx;
+    }
+
+    .priceF {
+      font-size: 24rpx;
+    }
+  }
+
+  .calc-price {
+    // font-weight: bold;
+    // font-size: 28rpx;
+    color: #FF0047;
+    // line-height: 32rpx;
+  }
+}
+
+.goodsInfo-count {
+  display: flex;
+  justify-content: flex-end;
+
+  .goods-price {
+    flex-shrink: 0;
+    font-family: DINAlternate, DINAlternate;
+    font-weight: bold;
+    color: #131415;
+    line-height: 48rpx;
+
+    .before {
+      font-weight: 400;
+      font-size: 24rpx;
+      color: #777777;
+      vertical-align: middle;
+      padding-right: 6rpx;
+    }
+
+    .red {
+      color: #FE4600;
+    }
+
+    .stuff {
+      font-size: 28rpx;
+      padding-right: 4rpx;
+    }
+
+    .priceZ {
+      font-size: 40rpx;
+      // line-height: 1;
+      color: #FE4600;
+    }
+
+    .priceF {
+      font-size: 24rpx;
+      color: #FE4600;
+    }
+
+    .afterTxt {
+      font-weight: 400;
+      font-size: 24rpx;
+      color: #777777;
+      vertical-align: middle;
+      padding-left: 12rpx;
+    }
+
+    .afterPrice {
+      color: #333333;
+      font-size: 36rpx;
+    }
+  }
+}
+
+.addBuyer {
+  position: relative;
+  margin: 26rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 24rpx;
+  overflow: hidden;
+
+  .addressTop {
+    position: absolute;
+    z-index: 1;
+    top: 0;
+    left: 0;
+    width: 100%;
+  }
+
+  .icon-man {
+    width: 44rpx;
+    height: 44rpx;
+    margin-right: 16rpx;
+    flex-shrink: 0;
+
+    &.selected {
+      width: 36rpx;
+      height: 36rpx;
+    }
+  }
+
+  .addBuyer-left {
+    display: flex;
+  }
+
+  .users {
+    display: flex;
+    font-weight: 600;
+    font-size: 32rpx;
+    color: #131415;
+    line-height: 44rpx;
+
+    width: 540rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+  }
+
+  .address {
+    padding-bottom: 16rpx;
+    font-size: 28rpx;
+    color: #333333;
+    font-weight: bold;
+    line-height: 40rpx;
+
+    text {
+      padding-right: 24rpx;
+
+      &:last-child {
+        color: #777777;
+        font-weight: 400;
+      }
+    }
+
+  }
+
+  .selected {
+    .users {
+      font-weight: 400;
+      font-size: 28rpx;
+      color: #131415;
+    }
+
+    .address {
+      display: flex;
+      // flex-direction: column;
+
+      .userName {
+        max-width: 300rpx;
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+      }
+    }
+  }
+
+  .arrow-right {
+    width: 24rpx;
+    height: 24rpx;
+  }
+}
 
 .goodsInfos {
   margin-top: 30rpx;
@@ -174,6 +451,7 @@ page {
 
   &:first-child {
     padding-top: 0;
+
     .title {
       color: #777;
     }
@@ -261,15 +539,19 @@ page {
   width: 100rpx;
   aspect-ratio: 1;
   border-radius: 50%;
-  background: 
-    radial-gradient(farthest-side,#E8E8E8 94%,#0000) top/8px 8px no-repeat,
-    conic-gradient(#0000 30%,#E8E8E8);
-  -webkit-mask: radial-gradient(farthest-side,#0000 calc(100% - 8px),#000 0);
+  background:
+    radial-gradient(farthest-side, #E8E8E8 94%, #0000) top/8px 8px no-repeat,
+    conic-gradient(#0000 30%, #E8E8E8);
+  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
   animation: tempLoading 1s infinite linear;
 }
-@keyframes tempLoading{ 
-  100%{transform: rotate(1turn)}
+
+@keyframes tempLoading {
+  100% {
+    transform: rotate(1turn)
+  }
 }
+
 .only_canvas {
   position: absolute;
   left: -300rpx;
@@ -277,12 +559,14 @@ page {
   width: 262rpx;
   height: 262rpx;
 }
+
 .qrcode-section {
   margin-top: 28rpx;
   border-top: 2rpx solid #F0F0F0;
   padding-top: 60rpx;
   padding-bottom: 32rpx;
   text-align: center;
+
   .qrcode-wrap {
     position: relative;
     margin: 0 auto;
@@ -291,10 +575,12 @@ page {
     display: inline-block;
     font-size: 0;
   }
+
   .my_draw_canvas {
     width: 262rpx;
     height: 262rpx;
   }
+
   .qrcode-text {
     margin-top: 32rpx;
     padding: 0 32rpx;
@@ -307,11 +593,13 @@ page {
       color: #AAAAAA;
     }
   }
+
   .qrcode-btn--section {
     display: flex;
     align-items: center;
     justify-content: center;
     padding-top: 32rpx;
+
     button {
       border-radius: 78rpx;
       // line-height: 68rpx;
@@ -323,14 +611,17 @@ page {
       margin: 0 16rpx;
       min-width: 200rpx;
       box-sizing: border-box;
+
       &[disabled] {
         opacity: 0.7;
       }
     }
+
     .submit {
-      background: linear-gradient( 270deg, #FF7B57 0%, #FF3460 100%);
+      background: linear-gradient(270deg, #FF7B57 0%, #FF3460 100%);
       color: #FFFFFF;
     }
+
     .download {
       background: #FEEDF0;
       color: #FE2451;
@@ -338,10 +629,43 @@ page {
   }
 }
 
-.order-time {
+.buyUsers {
+  position: relative;
   margin: 24rpx 26rpx 0;
+  background: #FFFFFF;
   border-radius: 20rpx;
   padding: 28rpx 24rpx;
+
+  .buyuser_img {
+    position: absolute;
+    top: 0;
+    right: 0;
+    width: 160rpx !important;
+  }
+
+  .users {
+    font-size: 32rpx;
+    color: #777;
+
+    text {
+      color: #131415;
+      font-weight: bold;
+      padding-right: 12rpx;
+    }
+  }
+
+  .detail {
+    padding-top: 8rpx;
+    font-size: 26rpx;
+    color: #777777;
+    line-height: 36rpx;
+  }
+}
+
+.order-time {
+  margin: 24rpx 26rpx 0;
+  border-radius: 20rpx;
+  padding: 0 24rpx;
   background-color: #FFFFFF;
 
   .line {
@@ -354,20 +678,23 @@ page {
   .order-item {
     display: flex;
     justify-content: space-between;
-    padding-bottom: 28rpx;
+    padding: 36rpx 0;
+    border-bottom: 2rpx solid #F0F0F0;
+
     &:last-child {
-      padding-bottom: 0;
+      border-bottom: 0;
     }
 
     .title {
-      font-size: 28rpx;
+      font-size: 30rpx;
       color: #131415;
       line-height: 40rpx;
       flex-shrink: 0;
       padding-right: 46rpx;
     }
+
     .value {
-      font-size: 28rpx;
+      font-size: 30rpx;
       color: #777777;
       line-height: 42rpx;
       display: flex;
@@ -375,6 +702,7 @@ page {
       text-align: right;
       word-break: break-all;
       word-wrap: break-word;
+
       &.red {
         color: #FE2451;
       }
@@ -393,16 +721,28 @@ page {
       }
 
       .copy {
-        font-size: 28rpx;
-        color: #FE2451;
+        font-size: 30rpx;
+        color: #131415;
         line-height: 42rpx;
         display: flex;
         align-items: center;
-        padding-left: 16rpx;
+
+        &.cell-line {
+          margin-left: 16rpx;
+
+          &::before {
+            content: '';
+            width: 2rpx;
+            height: 22rpx;
+            background: #DCDCDC;
+            margin-right: 16rpx;
+          }
+        }
       }
     }
   }
 }
+
 .btn-refound {
   padding-top: 40rpx;
   text-align: center;
@@ -426,10 +766,12 @@ page {
     display: flex;
     flex-direction: column;
     margin-right: 40rpx;
+
     image {
       width: 48rpx;
       height: 48rpx;
     }
+
     text {
       font-weight: 500;
       font-size: 22rpx;
@@ -449,16 +791,20 @@ page {
       color: #131415;
       line-height: 40rpx;
     }
+
     .currentPrice {
       font-weight: bold;
       color: #FE2451;
       font-family: DINAlternate, DINAlternate;
+
       .stuff {
         font-size: 32rpx;
       }
+
       .priceZ {
         font-size: 56rpx;
       }
+
       .priceF {
         font-size: 32rpx;
       }
@@ -468,7 +814,7 @@ page {
   button {
     margin: 0;
     width: 100%;
-    background: linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%);
+    background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
     border-radius: 78rpx;
     padding: 22rpx 84rpx;
     font-weight: 500;
@@ -478,7 +824,7 @@ page {
 
     &[disabled][type=primary] {
       color: #fff;
-      background: linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%);
+      background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
       opacity: 0.7;
     }
   }

+ 48 - 83
miniprogram/pages/orders/order-result.wxml

@@ -1,15 +1,45 @@
 <!--pages/orders/order-detail.wxml-->
 <view class="container">
-  <navigation-bar title="订单详情"></navigation-bar>
+  <navigation-bar title="{{statusList[status].title}}"></navigation-bar>
 
   <scroll-view class="record-list" type="list" scroll-y>
     <view class="scroll-container">
-      <view class="order-status" wx:if="{{statusList[status]}}">
+      <!-- <view class="order-status" wx:if="{{statusList[status]}}">
         <view class="status">
           <image src="{{ statusList[status].logo }}"></image>
           <text>{{ statusList[status].title }}</text>
         </view>
         <view class="tips" wx:if="{{ statusList[status].content }}">{{ statusList[status].content }}</view>
+      </view> -->
+      <!-- 添加地址 -->
+      <view wx:if="{{ goodsInfo.addresses.id }}" class="addBuyer">
+        <view class="addBuyer-left">
+          <view class="info selected">
+            <view class="address">
+              <image src="./images/icon-address.png" class="icon-man selected"></image>
+              <text class="userName">{{ goodsInfo.addresses.name }}</text>
+              <text>{{ goodsInfo.addresses.phoneNumber }}</text>
+            </view>
+            <view class="users">
+              {{ goodsInfo.addresses.addressDetail }}
+            </view>
+          </view>
+        </view>
+      </view>
+
+      <view wx:if="{{ hasInstrument }}" class="addBuyer">
+        <view class="addBuyer-left">
+          <view class="info selected" wx:if="{{ receiveAddress }}">
+            <view class="address">
+              <image src="./images/icon-address.png" class="icon-man {{ receiveAddress ? 'selected' : '' }}"></image>
+              <text class="userName">{{ receiveAddressInfo.name }}</text>
+              <text>{{ receiveAddressInfo.phoneNumber }}</text>
+            </view>
+            <view class="users">
+              {{ receiveAddressInfo.addressDetail }}
+            </view>
+          </view>
+        </view>
       </view>
 
       <view class="order-content">
@@ -27,69 +57,33 @@
           </view>
         </view>
         <view class="goodsInfos">
-          <view class="goodsInfo-item">
-            <text class="title">商品总额</text>
-
-            <view class="goods-price">
-              <text class="stuff">¥</text>
-              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
-            </view>
-          </view>
-
-          <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="priceZ">{{ goodsInfo.discountIntegerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.discountDecimalPart }}</text>
-            </view>
-          </view>
 
           <view class="qrcode-line"></view>
 
           <view class="goodsInfo-count">
             <view class="goods-price">
-              <text class="before">共{{ goodsInfo.goods.length }}件:</text>
+              <text class="before">共{{ goodsInfo.goods.length }}件,共减</text>
+              <text class="stuff red">¥</text>
+              <text class="priceZ">{{ goodsInfo.discountIntegerPart }}.{{ goodsInfo.discountDecimalPart }}</text>
+              <!-- <text class="priceF">.{{ goodsInfo.decimalPart }}</text> -->
+              <text class="afterTxt">应付:</text>
               <text class="stuff">¥</text>
-              <text class="priceZ">{{ goodsInfo.integerPart }}</text>
-              <text class="priceF">.{{ goodsInfo.decimalPart }}</text>
+              <text class="afterPrice">{{ goodsInfo.integerPart }}.{{ goodsInfo.decimalPart }}</text>
             </view>
           </view>
         </view>
       </view>
 
-      <view class="order-time">
-        <block wx:if="{{ goodsInfo.addresses.id }}">
-          <template is="address" data="{{ goodsInfo }}"></template>
-          <view class="line"></view>
-          <block wx:if="{{ isExpanded }}">
-            <block wx:if="{{ goodsInfo.beneficiary.id }}">
-              <template is="schoolInfo" data="{{ goodsInfo }}"></template>
-              <view class="line" wx:if="{{ !goodsInfo.addresses.id }}"></view>
-            </block>
-            <template is="orderInfo" data="{{ goodsInfo }}"></template>
-          </block>
-        </block>
-        <block wx:else>
-          <block wx:if="{{ goodsInfo.beneficiary.id }}">
-            <template is="schoolInfo" data="{{ goodsInfo }}"></template>
-            <view class="line" wx:if="{{ !goodsInfo.addresses.id }}"></view>
-          </block>
-          <block wx:if="{{ isExpanded || !goodsInfo.beneficiary.id }}">
-            <template is="orderInfo" data="{{ goodsInfo }}"></template>
-          </block>
-        </block>
-
-        <view class="order-item" bind:tap="onExpanded" wx:if="{{ goodsInfo.beneficiary.id }}">
-          <view class="title">更多信息</view>
-          <view class="value {{ isExpanded ? 'expanded' : '' }}">
-            {{ isExpanded ? '收起' : '展开' }}
-            <image src="./images/icon-down.png" class="iconDown"></image>
-          </view>
+      <view class="buyUsers">
+        <view class="users">
+          <text>{{ goodsInfo.beneficiary.name }}</text>{{ goodsInfo.beneficiary.phoneNumber }}
         </view>
+        <view class="detail">{{goodsInfo.beneficiary.schoolInfo}}</view>
+
+        <image class="buyuser_img" mode="widthFix" src="./images/buyuser.png"></image>
+      </view>
+      <view class="order-time">
+        <template is="orderInfo" data="{{ goodsInfo }}"></template>
       </view>
     </view>
   </scroll-view>
@@ -99,41 +93,12 @@
   </view> -->
 </view>
 
-<template name="address">
-  <view class="order-item">
-    <view class="title">收货人</view>
-    <view class="value">{{ goodsInfo.addresses.name }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">电话号码</view>
-    <view class="value">{{ goodsInfo.addresses.phoneNumber }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">收货地址</view>
-    <view class="value">{{ goodsInfo.addresses.addressDetail }}</view>
-  </view>
-</template>
-
-<template name="schoolInfo">
-  <view class="order-item">
-    <view class="title">享用者姓名</view>
-    <view class="value">{{ goodsInfo.beneficiary.name }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">电话号码</view>
-    <view class="value">{{ goodsInfo.beneficiary.phoneNumber }}</view>
-  </view>
-  <view class="order-item">
-    <view class="title">学校信息</view>
-    <view class="value">{{ goodsInfo.beneficiary.schoolInfo }}</view>
-  </view>
-</template>
 
 <template name="orderInfo">
   <view class="order-item">
     <view class="title">订单编号</view>
     <view class="value">{{ goodsInfo.orderNo }}
-      <view class="copy" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
+      <view class="copy cell-line" bind:tap="onCopy" data-orderno="{{goodsInfo.orderNo}}">复制</view>
     </view>
   </view>
   <view class="order-item">

+ 1 - 1
miniprogram/pages/orders/orders.less

@@ -3,7 +3,7 @@
   height: 100vh;
   display: flex;
   flex-direction: column;
-  background: #F5F6F7;
+  background: #F4F4F4;
 }
 
 .container {

+ 17 - 6
miniprogram/pages/select-goods/index.less

@@ -464,7 +464,7 @@
       background: #F8F8F8;
       border-radius: 12rpx;
       border: 4rpx solid #FE4600;
-      padding: 24rpx 0 24rpx 30rpx;
+      padding: 24rpx 30rpx 24rpx 30rpx;
 
       .checkbox {
         width: 32rpx;
@@ -475,16 +475,23 @@
 
       .user {
         .name {
+          display: flex;
+          align-items: center;
           padding-bottom: 8rpx;
-          font-weight: 600;
+          font-weight: 400;
           font-size: 32rpx;
-          color: #131415;
-          line-height: 44rpx;
+          color: rgba(119, 119, 119, 1);
 
           text {
-            font-weight: 400;
+            font-weight: 600;
             font-size: 32rpx;
-            color: rgba(119, 119, 119, 1);
+            color: #131415;
+            line-height: 44rpx;
+            max-width: 300rpx;
+            overflow: hidden;
+            display: inline-block;
+            white-space: nowrap;
+            text-overflow: ellipsis;
           }
         }
 
@@ -492,6 +499,10 @@
           font-size: 26rpx;
           color: #777777;
           line-height: 36rpx;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+          overflow: hidden;
+          max-width: 560rpx;
         }
       }
 

+ 18 - 1
miniprogram/pages/select-goods/index.ts

@@ -9,6 +9,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    backParams: null as any,
     instrumentList: [] as any,
     list: [] as any,
     isOverSaled: false, // 是否所有商品都没有库存
@@ -222,7 +223,7 @@ Page({
     const that = this
     if (!this.data.userBeneficiaryId) {
       wx.showToast({
-        title: '请填写享用者的个人信息',
+        title: '请添加权益享用人',
         icon: 'none'
       })
       return
@@ -284,4 +285,20 @@ Page({
       url: "../buyerInformation/index?userBeneficiaryId=" + this.data.userBeneficiaryId,
     });
   },
+  onShow() {
+    if (this.data.backParams) {
+      // console.log(this.data.backParams, 'backParams'); // { key: 'value' }
+      const backParams: any = this.data.backParams || {};
+      this.setData({
+        userBeneficiaryId: backParams.userBeneficiaryId,
+        userBeneficiaryInfo: {
+          name: backParams.name,
+          phoneNumber: backParams.phone,
+          schoolInfo: backParams.schoolInfo
+        },
+        backParams: null // 清空参数
+      })
+    }
+
+  }
 })

+ 5 - 5
miniprogram/pages/select-goods/index.wxml

@@ -74,14 +74,14 @@
       </view>
     </scroll-view>
     <view class="popupBottom">
-      <view class="select-buyer">
+      <view class="select-buyer" wx:if="{{ !userBeneficiaryId }}">
         <view class="desc">
           <image src="./images/icon2.png" class="iconBefore"></image>选择权益享用人
         </view>
         <view class="btn-add" bind:tap="onAddBuyer">添加</view>
       </view>
 
-      <!-- <view class="select-buyer selected">
+      <view class="select-buyer selected" wx:else>
         <view class="desc">
           <image src="./images/icon2.png" class="iconBefore"></image>选择权益享用人
         </view>
@@ -89,13 +89,13 @@
           <image class="checkbox" src="./images/icon-select.png"></image>
 
           <view class="user">
-            <view class="name">张子珊<text>17656564323</text></view>
-            <view class="detail">武汉市洪山区第二小学三年级2班</view>
+            <view class="name"><text>{{ userBeneficiaryInfo.name }}</text>{{ userBeneficiaryInfo.phoneNumber }}</view>
+            <view class="detail">{{ userBeneficiaryInfo.schoolInfo }}</view>
           </view>
 
           <image class="icon-edit" src="./images/icon-edit.png"></image>
         </view>
-      </view> -->
+      </view>
 
 
       <!-- 有选择商品的时候 -->