lex-xin 5 mesi fa
parent
commit
f759a17f53

+ 2 - 1
miniprogram/app.json

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

+ 12 - 0
miniprogram/pages/buyerInformation/index.json

@@ -0,0 +1,12 @@
+{
+  "usingComponents": {
+    "navigation-bar": "/components/navigation-bar/navigation-bar",
+    "van-popup": "@vant/weapp/popup/index",
+    "van-area": "@vant/weapp/area/index",
+    "van-picker": "@vant/weapp/picker/index",
+    "van-search": "@vant/weapp/search/index",
+    "van-field": "@vant/weapp/field/index",
+    "van-loading": "@vant/weapp/loading/index"
+  },
+  "disableScroll": true
+}

+ 223 - 0
miniprogram/pages/buyerInformation/index.less

@@ -0,0 +1,223 @@
+/* pages/buyerInformation/index.wxss */
+.container {
+  height: 100vh;
+  display: flex;
+  flex-direction: column;
+  background: url('https://oss.dayaedu.com/ktyq/1739781599065.png') top center no-repeat;
+  background-color: #FAD400;
+  background-size: contain;
+}
+
+.record-list {
+  flex: 1;
+  padding-bottom: 12rpx;
+  overflow-y: scroll;
+  box-sizing: border-box;
+}
+
+.title-img {
+  margin-top: 50rpx;
+  width: 568rpx;
+  margin-left: 92rpx;
+}
+
+.section {
+  margin: 24rpx 14rpx;
+  // background: linear-gradient(180deg, #E3F9FF 0%, #FFFFFF 9%, #FFFFFF 100%);
+  background: rgba(255, 255, 255, 0.56);
+  border-radius: 12rpx;
+  padding: 12rpx;
+  // border: 12rpx solid rgba(255, 255, 255, 0.56);
+
+  .section-content {
+    border-radius: 12rpx;
+    overflow: hidden;
+  }
+
+  .section-title {
+    width: 236rpx;
+    height: 46rpx;
+    margin: 20rpx 0 18rpx 28rpx;
+  }
+
+  .van-cell {
+    padding: 28rpx;
+    font-size: 30rpx;
+    line-height: 42rpx;
+
+    .required {
+      font-weight: 600;
+      color: #666666;
+
+      text {
+        color: #FF5A56;
+      }
+    }
+
+    .van-field__label {
+      font-weight: 600;
+      color: #666666;
+    }
+
+    .van-icon-arrow {
+      color: #CCCCCC;
+      font-weight: 600;
+    }
+  }
+
+  .gender-section {
+    display: flex;
+
+    .gender-item {
+      margin-left: 24rpx;
+      background: rgba(28, 172, 241, 0.11);
+      border-radius: 12rpx;
+      font-weight: 500;
+      font-size: 28rpx;
+      color: #1CACF1;
+      width: 104rpx;
+      line-height: 48rpx;
+      text-align: center;
+
+      &.active {
+        background: #1CACF1;
+        color: #FFFFFF;
+      }
+    }
+  }
+}
+
+.btnGroup {
+  // box-shadow: inset 0rpx 2rpx 0rpx 0rpx #F0F0F0;
+  padding: 22rpx 32rpx 56rpx;
+  background-color: #fff;
+
+  button {
+    width: 100% !important;
+    line-height: 94rpx;
+    padding: 0 !important;
+    color: #FEFFCA;
+    font-size: 36rpx;
+    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;
+  }
+}
+
+.van-picker__toolbar,
+.toolbar-top {
+  margin: 0 14rpx !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: #1CACF1 !important;
+}
+
+.toolbar-top {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.searchList {
+  .icon-search {
+    width: 32rpx;
+    height: 32rpx;
+    margin: auto 10rpx auto auto;
+  }
+
+  .van-search {
+    margin: 40rpx 26rpx 26rpx !important;
+    padding: 0 !important;
+    height: 70rpx !important;
+    background: #F6F6F6 !important;
+    border-radius: 35rpx !important;
+    border: 1rpx solid #FFFFFF !important;
+  }
+
+  .van-search__content {
+    background: #F6F6F6 !important;
+  }
+
+  .van-search__content {
+    border-top-left-radius: 35rpx !important;
+    border-bottom-left-radius: 35rpx !important;
+  }
+
+  .van-cell {
+    font-size: 26rpx !important;
+  }
+
+  .searchBtn {
+    width: 112rpx;
+    line-height: 54rpx !important;
+    padding: 0 !important;
+    text-align: center;
+    background-color: #1CACF1;
+    font-weight: 500;
+    font-size: 28rpx;
+    color: #FFFFFF;
+    line-height: 40rpx;
+    border-radius: 40rpx;
+    margin-right: 6rpx;
+  }
+}
+
+.van-picker-column__item--selected {
+  font-weight: 600;
+  font-size: 32rpx;
+  color: #1CACF1 !important;
+}
+
+.empty-box {
+  padding-top: 12rpx;
+  box-sizing: border-box;
+  height: 220px;
+  text-align: center;
+  font-size: 32rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #999999;
+  position: relative;
+
+  .empty_loading {
+    align-items: center;
+    background-color: var(--picker-loading-mask-color, hsla(0, 0%, 100%, .9));
+    bottom: 0;
+    display: flex;
+    justify-content: center;
+    left: 0;
+    position: absolute;
+    right: 0;
+    top: 0;
+    z-index: 4;
+  }
+
+  image {
+    width: 364rpx;
+    height: 190rpx;
+  }
+
+  .empty-text {
+    font-size: 28rpx;
+    color: #AAA;
+    line-height: 40rpx;
+    text-align: center;
+    padding-top: 36rpx;
+  }
+}

+ 800 - 0
miniprogram/pages/buyerInformation/index.ts

@@ -0,0 +1,800 @@
+import { api_schoolAreaDetail, api_schoolAreaList, api_sysAreaQueryAllProvince, api_userBeneficiarySave, api_userBeneficiaryUpdate } from "../../api/new";
+import { GRADE_ENUM } from "../../utils/util";
+
+
+const classList: any = [];
+for (let i = 1; i <= 40; i++) {
+  classList.push({ text: i + '班', value: i });
+}
+
+/** 获取年级 */
+const getGradeList = (gradeYear?: string, instrumentCode?: string) => {
+  let tempList: any = [];
+  const five = [
+    { text: '一年级', value: 1, instrumentCode },
+    { text: '二年级', value: 2, instrumentCode },
+    { text: '三年级', value: 3, instrumentCode },
+    { text: '四年级', value: 4, instrumentCode },
+    { text: '五年级', value: 5, instrumentCode }
+  ];
+  const one = [{ text: '六年级', value: 6, instrumentCode }];
+  const three = [
+    { text: '七年级', value: 7, instrumentCode },
+    { text: '八年级', value: 8, instrumentCode },
+    { text: '九年级', value: 9, instrumentCode }
+  ];
+  if (gradeYear === 'FIVE_YEAR_SYSTEM') {
+    tempList.push(...[...five]);
+  } else if (gradeYear === 'SIX_YEAR_SYSTEM') {
+    tempList.push(...[...five, ...one]);
+  } else if (gradeYear === 'THREE_YEAR_SYSTEM') {
+    tempList.push(...[...three]);
+  } else if (gradeYear === 'FORE_YEAR_SYSTEM') {
+    tempList.push(...[...one, ...three]);
+  } else {
+    tempList.push(...[...five, ...one, ...three]);
+  }
+  return tempList;
+};
+
+// pages/buyerInformation/index.ts
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    cacheArea: [] as { cityCode: string, shiftCityCode: string }[], // 临时存储的对应关系
+
+    phone: '',
+    name: '',
+    gender: '',
+    schoolAreaId: '',
+    schoolAreaName: '',
+    currentClassTxt: '', // 班级
+    currentClass: null,
+    currentGradeTxt: '', // 年级
+    currentGradeNum: null,
+    cityCode: null,
+    cityName: "",
+    provinceCode: null,
+    provinceName: "",
+    regionCode: null,
+    regionName: "",
+
+    userBeneficiaryId: '', // 选中用户的编号
+    userBeneficiaryInfo: {
+      name: '',
+      phoneNumber: '',
+      schoolInfo: ''
+    },
+    showArea: false,
+    showAreaAfterLeave: false,
+    areaList: [] as any,
+    showSchool: false,
+    showSchoolAfterLeave: false, // 离开后
+    /** 学校列表 */
+    schoolAreaList: [] as any,
+    schoolAreaIndex: 0,
+    /** 临时切换时选择的学校编号 */
+    tempChangeSchoolAreaId: '',
+    schoolLoading: false,
+    /** 搜索学校 */
+    searchName: '',
+    /** 学校类型 */
+    schoolInstrumentSetType: '',
+    /** 年级 */
+    gradeGradeList: [] as any,
+    gradeGradeIndex: 0,
+    showGradeClass: false,
+    showGradeClassAfterLeave: false, // 离开后
+    /** 班级 */
+    classList: [] as any,
+    classIndex: 0,
+    showClass: false,
+    showClassAfterLeave: false, // 离开后
+    buyerLoading: false,
+    currentIndex: 0,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options: any) {
+    if (options.userBeneficiaryId) {
+      this.setData({
+        userBeneficiaryId: options.userBeneficiaryId
+      })
+    }
+    // 从缓存里面获取用户信息
+    this.getUserDetail()
+
+    this.getAreas()
+    this.getSchools()
+  },
+
+  async getUserDetail() {
+    try {
+      const information = wx.getStorageSync('buyerInfomation')
+      const users = information ? JSON.parse(information) : null
+      if (users) {
+        this.setData({
+          phone: users.phone,
+          name: users.name,
+          gender: users.gender,
+          schoolAreaId: users.schoolAreaId,
+          schoolAreaName: users.schoolAreaName,
+          currentGradeClassTxt: users.currentGradeClassTxt,
+          currentClass: users.currentClass,
+          currentGradeNum: users.currentGradeNum,
+          cityCode: users.cityCode,
+          cityName: users.cityName,
+          provinceCode: users.provinceCode,
+          provinceName: users.provinceName,
+          regionCode: users.regionCode,
+          regionName: users.regionName,
+
+          schoolAreaIndex: users.schoolAreaIndex || 0,
+          gradeClassIndexs: users.gradeClassIndexs || [0, 0]
+        }, () => {
+          this.getSchoolAreaDetail()
+        })
+      }
+    } catch {
+      // 
+    }
+  },
+  onBack() {
+    // 如果有购买人编号,返回时则不缓存数据
+    if (!this.data.userBeneficiaryId) {
+      this.onSetCatch(this.data)
+    }
+    wx.navigateBack()
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+  async getUserDetail() {
+    try {
+      // const { data } = await api_userBeneficiaryDetail({
+      //   id: this.data.userBeneficiaryId
+      // })
+      // console.log(data, 'data')
+      const information = wx.getStorageSync('buyerInfomation')
+      const users = information ? JSON.parse(information) : null
+      if (users) {
+        this.setData({
+          phone: users.phone,
+          name: users.name,
+          gender: users.gender,
+          schoolAreaId: users.schoolAreaId,
+          schoolAreaName: users.schoolAreaName,
+          currentGradeTxt: users.currentGradeTxt,
+          currentClass: users.currentClass,
+          currentClassTxt: users.currentClassTxt,
+          currentGradeNum: users.currentGradeNum,
+          cityCode: users.cityCode,
+          cityName: users.cityName,
+          provinceCode: users.provinceCode,
+          provinceName: users.provinceName,
+          regionCode: users.regionCode,
+          regionName: users.regionName,
+          schoolAreaIndex: users.schoolAreaIndex,
+          gradeGradeIndex: users.gradeGradeIndex,
+          classIndex: users.classIndex
+        }, () => {
+          this.getSchoolAreaDetail()
+        })
+      }
+    } catch {
+      // 
+    }
+  },
+  /** 获取省市区 */
+  async getAreas() {
+    try {
+      const { data } = await api_sysAreaQueryAllProvince({})
+      this.setData({
+        areaList: this.formateArea(data.data)
+      })
+    } 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
+  },
+  /** 获取学校列表 */
+  async getSchools(name?: string) {
+    this.setData({
+      schoolLoading: true
+    })
+    try {
+      // 判断是否有地区信息
+      if (!this.data.provinceCode || !this.data.cityCode) {
+        return
+      }
+      const citycode = this.formateCityCode()
+      const { data } = await api_schoolAreaList({
+        name,
+        testFlag: true,
+        provinceCode: this.data.provinceCode,
+        cityCode: citycode,
+        regionCode: this.data.regionCode
+      })
+      const result = data.data || []
+      const tempList: any[] = []
+      result.forEach((item: any) => {
+        tempList.push({
+          text: item.name,
+          value: item.id
+        })
+      })
+
+      let tempSchoolId = ''
+      if (tempList.length > 0) {
+        const first = tempList[0]
+        tempSchoolId = first.value || ''
+      }
+
+      this.setData({
+        schoolAreaList: tempList,
+        tempChangeSchoolAreaId: tempSchoolId
+      })
+    } catch {
+      // 
+    }
+    this.setData({
+      schoolLoading: false
+    })
+  },
+  /** 获取学校详情 */
+  async getSchoolAreaDetail() {
+    if (!this.data.schoolAreaId) return
+    const { data } = await api_schoolAreaDetail({ id: this.data.schoolAreaId })
+    const result = data.data || {}
+
+    let tempGradeGradeList: any = []
+    let tempClassList: any = []
+    let schoolInstrumentSetType = ''
+    if (result.school) {
+      const schoolInfo = result.school || {};
+      const schoolInstrumentList = schoolInfo.schoolInstrumentList || [];
+      // forms.schoolInstrumentSetType = schoolInfo.instrumentSetType;
+      if (schoolInfo.instrumentSetType === 'SCHOOL') {
+        tempGradeGradeList = getGradeList(schoolInfo.gradeYear)
+        tempClassList = classList
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
+      } else if (schoolInfo.instrumentSetType === 'GRADE') {
+        const gradeList: any = []
+        schoolInstrumentList.forEach((item: any) => {
+          gradeList.push({
+            text: GRADE_ENUM[item.gradeNum],
+            value: item.gradeNum,
+            instrumentId: item.instrumentId
+          })
+        });
+        gradeList.sort((a: any, b: any) => a.value - b.value);
+        tempGradeGradeList = gradeList
+        tempClassList = classList
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
+      } else if (schoolInfo.instrumentSetType === 'CLASS') {
+        //   // 班级
+        const tempGradeList: any[] = [];
+        schoolInstrumentList.forEach((item: any) => {
+          if (!tempGradeList.includes(item.gradeNum)) {
+            tempGradeList.push(item.gradeNum);
+          }
+        });
+
+        const lastGradeList: any[] = [];
+        tempGradeList.forEach((temp: any) => {
+          const list = {
+            text: GRADE_ENUM[temp],
+            value: temp,
+            instrumentId: '',
+            instrumentCode: '',
+            instrumentName: '',
+            classList: [] as any
+          };
+          schoolInstrumentList.forEach((item: any) => {
+            if (temp === item.gradeNum) {
+              list.instrumentId = item.instrumentId;
+              list.instrumentCode = item.instrumentCode;
+              list.instrumentName = item.instrumentName;
+              list.classList.push({
+                text: item.classNum + '班',
+                value: item.classNum,
+                instrumentCode: item.instrumentCode
+              });
+            }
+          });
+          // 排序班级
+          list.classList.sort((a: any, b: any) => a.value - b.value);
+          lastGradeList.push(list);
+        });
+        lastGradeList.sort((a: any, b: any) => a.value - b.value);
+
+        tempGradeGradeList = lastGradeList
+        tempClassList = lastGradeList[this.data.gradeGradeIndex]?.classList || []
+        schoolInstrumentSetType = schoolInfo.instrumentSetType
+      } else {
+        tempGradeGradeList = getGradeList()
+        tempClassList = classList
+        schoolInstrumentSetType = ''
+      }
+    } else {
+      tempGradeGradeList = getGradeList()
+      tempClassList = classList
+      schoolInstrumentSetType = ''
+    }
+
+
+    // 格式化年级班级 - 如果后台改了学校配置,本地保存了缓存,判断年级、班级是否存在
+    const gradeIndex = this.data.gradeGradeIndex
+    const classIndex = this.data.classIndex
+    if ((tempGradeGradeList.length || 0) - 1 < gradeIndex) {
+      tempClassList = tempGradeGradeList[0]?.classList || []
+      this.setData({
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType,
+        gradeGradeIndex: 0,
+        classIndex: 0,
+        // currentClass: null,
+        // currentClassTxt: '',
+        // currentGradeNum: null,
+        // currentGradeTxt: ''
+      })
+    } else if ((tempClassList.length || 0) - 1 < classIndex) {
+      this.setData({
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType,
+        classIndex: 0,
+        // currentClass: null,
+        // currentClassTxt: '',
+      })
+    } else {
+      this.setData({
+        gradeGradeList: tempGradeGradeList,
+        classList: tempClassList,
+        schoolInstrumentSetType: schoolInstrumentSetType
+      })
+    }
+  },
+  /** 选择男女 */
+  onCheckGender(e: any) {
+    const { dataset } = e.target
+    this.setData({
+      gender: dataset.gender
+    })
+  },
+  /** 显示选择地区 */
+  onShowAreaList() {
+    this.setData({
+      showArea: true
+    })
+  },
+  /** 关闭选择地区 */
+  onCloseAreaList() {
+    this.setData({
+      showArea: false
+    })
+  },
+  /** 选择地区关闭后 */
+  onAreaAfterLeave() {
+    this.setData({
+      showAreaAfterLeave: true
+    })
+  },
+  /** 选择地区打开前 */
+  onAreaBeforeEnter() {
+    this.setData({
+      showAreaAfterLeave: false
+    })
+  },
+  /** 确定选择地区 */
+  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,
+
+      searchName: '',
+      schoolAreaId: '',
+      schoolAreaName: '',
+      schoolAreaIndex: 0,
+      currentGradeNum: null,
+      currentGradeTxt: '',
+      gradeGradeIndex: 0,
+      currentClass: null,
+      currentClassTxt: '',
+      classIndex: 0
+    }, () => {
+      this.getSchools()
+    })
+  },
+  /** 关闭选择学校 */
+  onCloseSchool() {
+    this.setData({
+      showSchool: false
+    })
+  },
+  /** 选择学校关闭后 */
+  onSchoolAfterLeave() {
+    this.setData({
+      showSchoolAfterLeave: true
+    })
+  },
+  /** 选择学校打开前 */
+  onSchoolBeforeEnter() {
+    this.setData({
+      showSchoolAfterLeave: false
+    })
+  },
+  /** 选择学校 */
+  onSelectSchool() {
+    if (!this.data.provinceName) {
+      wx.showToast({
+        title: '请选择地区',
+        icon: 'none'
+      })
+      return
+    }
+    this.setData({
+      showSchool: true
+    })
+  },
+  /** 确定选择学校 */
+  onSubmitSchool() {
+    if (this.data.tempChangeSchoolAreaId === this.data.schoolAreaId) {
+      this.setData({
+        showSchool: false
+      })
+      return
+    }
+
+    const detail = this.data.schoolAreaList.find((item: any) => item.value === this.data.tempChangeSchoolAreaId)
+    const detailIndex = this.data.schoolAreaList.findIndex((item: any) => item.value === this.data.tempChangeSchoolAreaId)
+    // console.log(detail, detailIndex, this.data.tempChangeSchoolAreaId)
+    if (detailIndex === -1) return
+    this.setData({
+      schoolAreaName: detail.text,
+      schoolAreaId: detail.value,
+      schoolAreaIndex: detailIndex,
+      showSchool: false,
+
+      currentGradeNum: null,
+      currentGradeTxt: '',
+      gradeGradeIndex: 0,
+      currentClass: null,
+      currentClassTxt: '',
+      classIndex: 0
+    }, () => {
+      this.getSchoolAreaDetail()
+    })
+  },
+  onChangeSchool(e: any) {
+    const { value } = e.detail.value
+    this.setData({
+      tempChangeSchoolAreaId: value
+    })
+  },
+  onSearch() {
+    this.setData({
+      schoolAreaIndex: 0
+    }, () => {
+      this.getSchools(this.data.searchName);
+    })
+  },
+  onSearchChange(e: any) {
+    this.setData({
+      searchName: e.detail
+    })
+  },
+  /** 选择年级班级 */
+  onSelectGradeClass() {
+    if (!this.data.schoolAreaId) {
+      wx.showToast({
+        title: '请选择学校',
+        icon: 'none'
+      })
+      return
+    }
+    this.setData({
+      showGradeClass: true
+    })
+  },
+  /** 年级班级 */
+  onCloseGradeClass() {
+    this.setData({
+      showGradeClass: false
+    })
+  },
+  onGradeClassBeforeEnter() {
+    this.setData({
+      showGradeClassAfterLeave: false
+    })
+  },
+  onGradeClassAfterLeave() {
+    this.setData({
+      showGradeClassAfterLeave: true
+    })
+  },
+  /** 确认选择年级班级 */
+  onSubmitGradeClass(e: any) {
+    const selectedOptions: any = e.detail.value
+    const selectedIndexs: any = e.detail.index
+    if (this.data.schoolInstrumentSetType === "CLASS") {
+      const gradeDetail = this.data.gradeGradeList;
+      const classList = gradeDetail?.find((item: any) => item.value === selectedOptions.value)
+      console.log(classList, "classList")
+      if (classList) {
+        this.setData({
+          classIndex: 0,
+          classList: classList.classList
+        })
+      }
+    }
+    this.setData({
+      currentGradeTxt: selectedOptions.text,
+      currentGradeNum: selectedOptions.value,
+      gradeGradeIndex: selectedIndexs,
+      showGradeClass: false,
+
+      currentClass: null,
+      currentClassTxt: ''
+    })
+  },
+
+  /** 选择班级 */
+  onSelectClass() {
+    if (!this.data.schoolAreaId) {
+      wx.showToast({
+        title: '请选择所在年级',
+        icon: 'none'
+      })
+      return
+    }
+    this.setData({
+      showClass: true
+    })
+  },
+  /** 班级 */
+  onCloseClass() {
+    this.setData({
+      showClass: false
+    })
+  },
+  onClassBeforeEnter() {
+    this.setData({
+      showClassAfterLeave: false
+    })
+  },
+  onClassAfterLeave() {
+    this.setData({
+      showClassAfterLeave: true
+    })
+  },
+  /** 确认选择班级 */
+  onSubmitClass(e: any) {
+    const selectedOptions: any = e.detail.value
+    const selectedIndexs: any = e.detail.index
+    this.setData({
+      currentClassTxt: selectedOptions.text,
+      currentClass: selectedOptions.value,
+      classIndex: selectedIndexs,
+      showClass: false
+    })
+  },
+  messageName(value: string) {
+    const nameReg = /^[\u4E00-\u9FA5]+$/
+    if (!value) {
+      return '请填写享用者姓名';
+    } else if (!nameReg.test(value)) {
+      return '享用者姓名必须为中文';
+    } else if (value.length < 2 || value.length > 14) {
+      return '享用者姓名必须为2~14个字';
+    } else {
+      return ''
+    }
+  },
+  /** 最终提交 */
+  async onSubmitBuyer() {
+    try {
+      const params = this.data
+      if (this.messageName(params.name)) {
+        wx.showToast({
+          title: this.messageName(params.name),
+          icon: "none"
+        })
+        return
+      }
+
+      if (!params.phone || !/^1[3456789]\d{9}$/.test(params.phone)) {
+        wx.showToast({
+          title: '请填写正确的电话号码',
+          icon: "none"
+        })
+        return
+      }
+
+      if (!params.gender) {
+        wx.showToast({
+          title: '请选择性别',
+          icon: 'none'
+        })
+        return
+      }
+
+      if (!params.provinceCode || !params.cityCode) {
+        wx.showToast({
+          title: '请选择学校地区',
+          icon: "none"
+        })
+        return
+      }
+
+      if (!params.schoolAreaId) {
+        wx.showToast({
+          title: '请选择所在学校',
+          icon: "none"
+        })
+        return
+      }
+
+      if (!params.currentGradeNum) {
+        wx.showToast({
+          title: '请选择所在年级',
+          icon: "none"
+        })
+        return
+      }
+
+      if (!params.currentClass) {
+        wx.showToast({
+          title: '请选择所在班级',
+          icon: "none"
+        })
+        return
+      }
+
+      const objs = {
+        phone: params.phone,
+        name: params.name,
+        gender: params.gender,
+        currentGradeNum: params.currentGradeNum,
+        currentClass: params.currentClass,
+        schoolAreaId: params.schoolAreaId,
+        defaultStatus: false
+      }
+      const userBeneficiary = {
+        name: params.name,
+        phoneNumber: params.phone,
+        schoolInfo: (params.provinceName || '') + (params.cityName || '') + (params.regionName || '') + params.schoolAreaName + params.currentGradeTxt + params.currentClassTxt
+      }
+      let userBeneficiaryId = ''
+      this.setData({
+        buyerLoading: true
+      })
+      if (params.userBeneficiaryId) {
+        const { data } = await api_userBeneficiaryUpdate({
+          id: params.userBeneficiaryId,
+          ...objs
+        })
+
+        wx.showToast({
+          title: '保存成功',
+          icon: 'none'
+        })
+        userBeneficiaryId = data.data.id
+      } else {
+        const { data } = await api_userBeneficiarySave({
+          ...objs
+        })
+
+        wx.showToast({
+          title: '保存成功',
+          icon: 'none'
+        })
+        userBeneficiaryId = data.data.id
+      }
+
+      this.setData({
+        userBeneficiaryId,
+        userBeneficiaryInfo: userBeneficiary
+      })
+
+      this.onSetCatch(params)
+      this.onCloseBuyer()
+    } catch {
+      //
+    }
+
+    this.setData({
+      buyerLoading: false
+    })
+  },
+  /** 设置缓存 */
+  onSetCatch(params: any) {
+    wx.setStorageSync('buyerInfomation', JSON.stringify({
+      phone: params.phone,
+      name: params.name,
+      gender: params.gender,
+      schoolAreaId: params.schoolAreaId,
+      schoolAreaName: params.schoolAreaName,
+      currentGradeTxt: params.currentGradeTxt,
+      currentClass: params.currentClass,
+      currentClassTxt: params.currentClassTxt,
+      currentGradeNum: params.currentGradeNum,
+      cityCode: params.cityCode,
+      cityName: params.cityName,
+      provinceCode: params.provinceCode,
+      provinceName: params.provinceName,
+      regionCode: params.regionCode,
+      regionName: params.regionName,
+      schoolAreaIndex: params.schoolAreaIndex,
+      gradeGradeIndex: params.gradeGradeIndex,
+      classIndex: params.classIndex
+    }))
+  }
+})

+ 83 - 0
miniprogram/pages/buyerInformation/index.wxml

@@ -0,0 +1,83 @@
+<!--pages/buyerInformation/index.wxml-->
+<view class="container">
+  <navigation-bar delta="0" bind:back="onBack" title="" background-color="transparent"></navigation-bar>
+  <scroll-view class="record-list" type="list" scroll-y>
+    <image src="https://oss.dayaedu.com/ktyq/1739781586832.png" mode="widthFix" class="title-img" />
+
+    <view class="section">
+      <view class="section-content">
+        <van-field value="{{ provinceName ? (provinceName || '') + ' ' + (cityName || '') + ' ' + (regionName || '') : '' }}" bind:tap="onShowAreaList" placeholder="请选择地区" input-align="right" is-link readonly>
+          <view class="required" slot="label"><text>*</text>所在地区</view>
+        </van-field>
+        <van-field model:value="{{ schoolAreaName }}" placeholder="请选择学校" input-align="right" is-link readonly bind:tap="onSelectSchool">
+          <view class="required" slot="label"><text>*</text>所在学校</view>
+        </van-field>
+        <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">
+          <view class="required" slot="label"><text>*</text>学生姓名</view>
+        </van-field>
+        <van-field border="{{ false }}" input-align="right">
+          <view class="required" slot="label"><text>*</text>学生性别</view>
+          <view class="gender-section" slot="button">
+            <view class="gender-item {{ gender === '1' ? 'active' : '' }}" bind:tap="onCheckGender" data-gender="1">男</view>
+            <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" />
+      </view>
+    </view>
+  </scroll-view>
+
+  <view class="btnGroup">
+    <button type="primary" bind:tap="onSubmit">
+      确认
+    </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="8" item-height="46" value="{{ regionCode || cityCode }}" bind:cancel="onCloseAreaList" bind:confirm="submitArea" />
+  </van-popup>
+
+  <!-- 学校 -->
+  <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{102}}" show="{{showSchool}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseSchool" bind:after-leave="onSchoolAfterLeave" bind:before-enter="onSchoolBeforeEnter">
+    <view class="toolbar-top">
+      <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>
+    <view class="empty-box" wx:if="{{ schoolAreaList.length <= 0 }}">
+      <view class="empty_loading" wx:if="{{ schoolLoading }}">
+        <van-loading color="#1989fa" />
+      </view>
+      <image mode="widthFix" src="https://oss.dayaedu.com/ktyq/1731839238916.png"></image>
+      <view class="empty-text">暂无数据</view>
+    </view>
+  </van-popup>
+
+
+  <!-- 年级 -->
+  <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>
+  </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>
+  </van-popup>
+</view>

+ 5 - 747
miniprogram/pages/index/index.ts

@@ -1,6 +1,6 @@
 // index.ts
 import { api_schoolAreaDetail, api_schoolAreaList, api_sysAreaQueryAllProvince, api_userBeneficiarySave, api_userBeneficiaryUpdate } from "../../api/new";
-import {  GRADE_ENUM } from '../../utils/util'
+import { GRADE_ENUM } from '../../utils/util'
 
 const classList: any = [];
 for (let i = 1; i <= 40; i++) {
@@ -54,74 +54,13 @@ Page({
     ],
     current: 0,
     popupShow: false,
-    
-    
+
+
 
 
     showService: false,
     isFromPreviewImage: false,
     showBuyer: false, // 收益人
-    cacheArea: [] as { cityCode: string, shiftCityCode: string }[], // 临时存储的对应关系
-
-    phone: '',
-    name: '',
-    gender: '',
-    schoolAreaId: '',
-    schoolAreaName: '',
-    currentClassTxt: '', // 班级
-    currentClass: null,
-    currentGradeTxt: '', // 年级
-    currentGradeNum: null,
-    cityCode: null,
-    cityName: "",
-    provinceCode: null,
-    provinceName: "",
-    regionCode: null,
-    regionName: "",
-
-    showGender: false,
-    genderList: [{
-      name: '男',
-      value: '1',
-      className: 'one-gender cancel-gender'
-    }, {
-      name: '女',
-      value: '0',
-      className: 'two-gender cancel-gender'
-    }],
-    userBeneficiaryId: '', // 选中用户的编号
-    userBeneficiaryInfo: {
-      name: '',
-      phoneNumber: '',
-      schoolInfo: ''
-    },
-    showArea: false,
-    showAreaAfterLeave: false,
-    areaList: [] as any,
-    showSchool: false,
-    showSchoolAfterLeave: false, // 离开后
-    /** 学校列表 */
-    schoolAreaList: [] as any,
-    schoolAreaIndex: 0,
-    /** 临时切换时选择的学校编号 */
-    tempChangeSchoolAreaId: '',
-    schoolLoading: false,
-    /** 搜索学校 */
-    searchName: '',
-    /** 学校类型 */
-    schoolInstrumentSetType: '',
-    /** 年级 */
-    gradeGradeList: [] as any,
-    gradeGradeIndex: 0,
-    showGradeClass: false,
-    showGradeClassAfterLeave: false, // 离开后
-    /** 班级 */
-    classList: [] as any,
-    classIndex: 0,
-    showClass: false,
-    showClassAfterLeave: false, // 离开后
-    buyerLoading: false,
-    currentIndex: 0,
   },
 
   /**
@@ -130,7 +69,7 @@ Page({
   onLoad() {
     // this.onInit()
   },
-  
+
   isLogin() {
     // 判断是否登录
     if (!app.globalData.isLogin) {
@@ -193,7 +132,7 @@ Page({
       }
     })
   },
-  
+
   onPreivewGoodsImg(e: { currentTarget: { dataset: any } }) {
     wx.previewImage({
       current: e.currentTarget.dataset.src,
@@ -234,686 +173,5 @@ Page({
       path: '/pages/index/index',
       imageUrl: 'https://oss.dayaedu.com/ktyq/1733312164991.png'
     }
-  },
-
-
-  onSelectBuyer() {
-    // 从缓存里面获取用户信息
-    this.getUserDetail()
-    if (this.data.areaList.length <= 0) {
-      this.getAreas()
-    }
-    this.getSchools()
-    this.setData({
-      showBuyer: true
-    })
-  },
-  onCloseBuyer() {
-    this.setData({
-      showBuyer: false
-    }, () => {
-      if (!this.data.userBeneficiaryId) {
-        this.onSetCatch(this.data)
-      }
-    })
-  },
-  async getUserDetail() {
-    try {
-      // const { data } = await api_userBeneficiaryDetail({
-      //   id: this.data.userBeneficiaryId
-      // })
-      // console.log(data, 'data')
-      const information = wx.getStorageSync('buyerInfomation')
-      const users = information ? JSON.parse(information) : null
-      if (users) {
-        this.setData({
-          phone: users.phone,
-          name: users.name,
-          gender: users.gender,
-          schoolAreaId: users.schoolAreaId,
-          schoolAreaName: users.schoolAreaName,
-          currentGradeTxt: users.currentGradeTxt,
-          currentClass: users.currentClass,
-          currentClassTxt: users.currentClassTxt,
-          currentGradeNum: users.currentGradeNum,
-          cityCode: users.cityCode,
-          cityName: users.cityName,
-          provinceCode: users.provinceCode,
-          provinceName: users.provinceName,
-          regionCode: users.regionCode,
-          regionName: users.regionName,
-          schoolAreaIndex: users.schoolAreaIndex,
-          gradeGradeIndex: users.gradeGradeIndex,
-          classIndex: users.classIndex
-        }, () => {
-          this.getSchoolAreaDetail()
-        })
-      }
-    } catch {
-      // 
-    }
-  },
-  /** 获取省市区 */
-  async getAreas() {
-    try {
-      const { data } = await api_sysAreaQueryAllProvince({})
-      this.setData({
-        areaList: this.formateArea(data.data)
-      })
-    } 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
-  },
-  /** 获取学校列表 */
-  async getSchools(name?: string) {
-    this.setData({
-      schoolLoading: true
-    })
-    try {
-      // 判断是否有地区信息
-      if (!this.data.provinceCode || !this.data.cityCode) {
-        return
-      }
-      const citycode = this.formateCityCode()
-      const { data } = await api_schoolAreaList({
-        name,
-        testFlag: true,
-        provinceCode: this.data.provinceCode,
-        cityCode: citycode,
-        regionCode: this.data.regionCode
-      })
-      const result = data.data || []
-      const tempList: any[] = []
-      result.forEach((item: any) => {
-        tempList.push({
-          text: item.name,
-          value: item.id
-        })
-      })
-
-      let tempSchoolId = ''
-      if (tempList.length > 0) {
-        const first = tempList[0]
-        tempSchoolId = first.value || ''
-      }
-
-      this.setData({
-        schoolAreaList: tempList,
-        tempChangeSchoolAreaId: tempSchoolId
-      })
-    } catch {
-      // 
-    }
-    this.setData({
-      schoolLoading: false
-    })
-  },
-  onCheckedGender() {
-    this.setData({
-      showGender: true
-    })
-  },
-  onCloseGender() {
-    this.setData({
-      showGender: false,
-    })
-  },
-  onSelectGender(e: any) {
-    const genderList = this.data.genderList
-    const gender = e.detail.value
-    genderList.forEach((item: any, index: number) => {
-      if (item.value === gender) {
-        item.className = index === 0 ? 'one-gender select-gender' : 'two-gender select-gender'
-      } else {
-        item.className = index === 0 ? 'one-gender cancel-gender' : 'two-gender cancel-gender'
-      }
-    })
-    console.log(e, genderList, gender, '1212')
-    this.setData({
-      gender,
-      genderList
-    })
-  },
-  /** 获取学校详情 */
-  async getSchoolAreaDetail() {
-    if (!this.data.schoolAreaId) return
-    const { data } = await api_schoolAreaDetail({ id: this.data.schoolAreaId })
-    const result = data.data || {}
-
-    let tempGradeGradeList: any = []
-    let tempClassList: any = []
-    let schoolInstrumentSetType = ''
-    if (result.school) {
-      const schoolInfo = result.school || {};
-      const schoolInstrumentList = schoolInfo.schoolInstrumentList || [];
-      // forms.schoolInstrumentSetType = schoolInfo.instrumentSetType;
-      if (schoolInfo.instrumentSetType === 'SCHOOL') {
-        tempGradeGradeList = getGradeList(schoolInfo.gradeYear)
-        tempClassList = classList
-        schoolInstrumentSetType = schoolInfo.instrumentSetType
-      } else if (schoolInfo.instrumentSetType === 'GRADE') {
-        const gradeList: any = []
-        schoolInstrumentList.forEach((item: any) => {
-          gradeList.push({
-            text: GRADE_ENUM[item.gradeNum],
-            value: item.gradeNum,
-            instrumentId: item.instrumentId
-          })
-        });
-        gradeList.sort((a: any, b: any) => a.value - b.value);
-        tempGradeGradeList = gradeList
-        tempClassList = classList
-        schoolInstrumentSetType = schoolInfo.instrumentSetType
-      } else if (schoolInfo.instrumentSetType === 'CLASS') {
-        //   // 班级
-        const tempGradeList: any[] = [];
-        schoolInstrumentList.forEach((item: any) => {
-          if (!tempGradeList.includes(item.gradeNum)) {
-            tempGradeList.push(item.gradeNum);
-          }
-        });
-
-        const lastGradeList: any[] = [];
-        tempGradeList.forEach((temp: any) => {
-          const list = {
-            text: GRADE_ENUM[temp],
-            value: temp,
-            instrumentId: '',
-            instrumentCode: '',
-            instrumentName: '',
-            classList: [] as any
-          };
-          schoolInstrumentList.forEach((item: any) => {
-            if (temp === item.gradeNum) {
-              list.instrumentId = item.instrumentId;
-              list.instrumentCode = item.instrumentCode;
-              list.instrumentName = item.instrumentName;
-              list.classList.push({
-                text: item.classNum + '班',
-                value: item.classNum,
-                instrumentCode: item.instrumentCode
-              });
-            }
-          });
-          // 排序班级
-          list.classList.sort((a: any, b: any) => a.value - b.value);
-          lastGradeList.push(list);
-        });
-        lastGradeList.sort((a: any, b: any) => a.value - b.value);
-
-        tempGradeGradeList = lastGradeList
-        tempClassList = lastGradeList[this.data.gradeGradeIndex]?.classList || []
-        schoolInstrumentSetType = schoolInfo.instrumentSetType
-      } else {
-        tempGradeGradeList = getGradeList()
-        tempClassList = classList
-        schoolInstrumentSetType = ''
-      }
-    } else {
-      tempGradeGradeList = getGradeList()
-      tempClassList = classList
-      schoolInstrumentSetType = ''
-    }
-
-
-    // 格式化年级班级 - 如果后台改了学校配置,本地保存了缓存,判断年级、班级是否存在
-    const gradeIndex = this.data.gradeGradeIndex
-    const classIndex = this.data.classIndex
-    if ((tempGradeGradeList.length || 0) - 1 < gradeIndex) {
-      tempClassList = tempGradeGradeList[0]?.classList || []
-      this.setData({
-        gradeGradeList: tempGradeGradeList,
-        classList: tempClassList,
-        schoolInstrumentSetType: schoolInstrumentSetType,
-        gradeGradeIndex: 0,
-        classIndex: 0,
-        // currentClass: null,
-        // currentClassTxt: '',
-        // currentGradeNum: null,
-        // currentGradeTxt: ''
-      })
-    } else if ((tempClassList.length || 0) - 1 < classIndex) {
-      this.setData({
-        gradeGradeList: tempGradeGradeList,
-        classList: tempClassList,
-        schoolInstrumentSetType: schoolInstrumentSetType,
-        classIndex: 0,
-        // currentClass: null,
-        // currentClassTxt: '',
-      })
-    } else {
-      this.setData({
-        gradeGradeList: tempGradeGradeList,
-        classList: tempClassList,
-        schoolInstrumentSetType: schoolInstrumentSetType
-      })
-    }
-  },
-  /** 选择男女 */
-  onCheckGender(e: any) {
-    const { dataset } = e.target
-    this.setData({
-      gender: dataset.gender
-    })
-  },
-  /** 显示选择地区 */
-  onShowAreaList() {
-    this.setData({
-      showArea: true
-    })
-  },
-  /** 关闭选择地区 */
-  onCloseAreaList() {
-    this.setData({
-      showArea: false
-    })
-  },
-  /** 选择地区关闭后 */
-  onAreaAfterLeave() {
-    this.setData({
-      showAreaAfterLeave: true
-    })
-  },
-  /** 选择地区打开前 */
-  onAreaBeforeEnter() {
-    this.setData({
-      showAreaAfterLeave: false
-    })
-  },
-  /** 确定选择地区 */
-  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,
-
-      searchName: '',
-      schoolAreaId: '',
-      schoolAreaName: '',
-      schoolAreaIndex: 0,
-      currentGradeNum: null,
-      currentGradeTxt: '',
-      gradeGradeIndex: 0,
-      currentClass: null,
-      currentClassTxt: '',
-      classIndex: 0
-    }, () => {
-      this.getSchools()
-    })
-  },
-  /** 关闭选择学校 */
-  onCloseSchool() {
-    this.setData({
-      showSchool: false
-    })
-  },
-  /** 选择学校关闭后 */
-  onSchoolAfterLeave() {
-    this.setData({
-      showSchoolAfterLeave: true
-    })
-  },
-  /** 选择学校打开前 */
-  onSchoolBeforeEnter() {
-    this.setData({
-      showSchoolAfterLeave: false
-    })
-  },
-  /** 选择学校 */
-  onSelectSchool() {
-    if (!this.data.provinceName) {
-      wx.showToast({
-        title: '请选择地区',
-        icon: 'none'
-      })
-      return
-    }
-    this.setData({
-      showSchool: true
-    })
-  },
-  /** 确定选择学校 */
-  onSubmitSchool() {
-    if(this.data.tempChangeSchoolAreaId === this.data.schoolAreaId) {
-      this.setData({
-        showSchool: false
-      })
-      return
-    }
-
-    const detail = this.data.schoolAreaList.find((item: any) => item.value === this.data.tempChangeSchoolAreaId)
-    const detailIndex = this.data.schoolAreaList.findIndex((item: any) => item.value === this.data.tempChangeSchoolAreaId)
-    // console.log(detail, detailIndex, this.data.tempChangeSchoolAreaId)
-    if (detailIndex === -1) return
-    this.setData({
-      schoolAreaName: detail.text,
-      schoolAreaId: detail.value,
-      schoolAreaIndex: detailIndex,
-      showSchool: false,
-
-      currentGradeNum: null,
-      currentGradeTxt: '',
-      gradeGradeIndex: 0,
-      currentClass: null,
-      currentClassTxt: '',
-      classIndex: 0
-    }, () => {
-      this.getSchoolAreaDetail()
-    })
-  },
-  onChangeSchool(e: any) {
-    const { value } = e.detail.value
-    this.setData({
-      tempChangeSchoolAreaId: value
-    })
-  },
-  onSearch() {
-    this.setData({
-      schoolAreaIndex: 0
-    }, () => {
-      this.getSchools(this.data.searchName);
-    })
-  },
-  onSearchChange(e: any) {
-    this.setData({
-      searchName: e.detail
-    })
-  },
-  /** 选择年级班级 */
-  onSelectGradeClass() {
-    if (!this.data.schoolAreaId) {
-      wx.showToast({
-        title: '请选择学校',
-        icon: 'none'
-      })
-      return
-    }
-    this.setData({
-      showGradeClass: true
-    })
-  },
-  /** 年级班级 */
-  onCloseGradeClass() {
-    this.setData({
-      showGradeClass: false
-    })
-  },
-  onGradeClassBeforeEnter() {
-    this.setData({
-      showGradeClassAfterLeave: false
-    })
-  },
-  onGradeClassAfterLeave() {
-    this.setData({
-      showGradeClassAfterLeave: true
-    })
-  },
-  /** 确认选择年级班级 */
-  onSubmitGradeClass(e: any) {
-    const selectedOptions: any = e.detail.value
-    const selectedIndexs: any = e.detail.index
-    if (this.data.schoolInstrumentSetType === "CLASS") {
-      const gradeDetail = this.data.gradeGradeList;
-      const classList = gradeDetail?.find((item: any) => item.value === selectedOptions.value)
-      console.log(classList, "classList")
-      if (classList) {
-        this.setData({
-          classIndex: 0,
-          classList: classList.classList
-        })
-      }
-    }
-    this.setData({
-      currentGradeTxt: selectedOptions.text,
-      currentGradeNum: selectedOptions.value,
-      gradeGradeIndex: selectedIndexs,
-      showGradeClass: false,
-
-      currentClass: null,
-      currentClassTxt: ''
-    })
-  },
-
-  /** 选择班级 */
-  onSelectClass() {
-    if (!this.data.schoolAreaId) {
-      wx.showToast({
-        title: '请选择所在年级',
-        icon: 'none'
-      })
-      return
-    }
-    this.setData({
-      showClass: true
-    })
-  },
-  /** 班级 */
-  onCloseClass() {
-    this.setData({
-      showClass: false
-    })
-  },
-  onClassBeforeEnter() {
-    this.setData({
-      showClassAfterLeave: false
-    })
-  },
-  onClassAfterLeave() {
-    this.setData({
-      showClassAfterLeave: true
-    })
-  },
-  /** 确认选择班级 */
-  onSubmitClass(e: any) {
-    const selectedOptions: any = e.detail.value
-    const selectedIndexs: any = e.detail.index
-    this.setData({
-      currentClassTxt: selectedOptions.text,
-      currentClass: selectedOptions.value,
-      classIndex: selectedIndexs,
-      showClass: false
-    })
-  },
-  messageName(value: string) {
-    const nameReg = /^[\u4E00-\u9FA5]+$/
-    if (!value) {
-      return '请填写享用者姓名';
-    } else if (!nameReg.test(value)) {
-      return '享用者姓名必须为中文';
-    } else if (value.length < 2 || value.length > 14) {
-      return '享用者姓名必须为2~14个字';
-    } else {
-      return ''
-    }
-  },
-  /** 最终提交 */
-  async onSubmitBuyer() {
-    try {
-      const params = this.data
-      if (this.messageName(params.name)) {
-        wx.showToast({
-          title: this.messageName(params.name),
-          icon: "none"
-        })
-        return
-      }
-
-      if (!params.phone || !/^1[3456789]\d{9}$/.test(params.phone)) {
-        wx.showToast({
-          title: '请填写正确的电话号码',
-          icon: "none"
-        })
-        return
-      }
-
-      if (!params.gender) {
-        wx.showToast({
-          title: '请选择性别',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!params.provinceCode || !params.cityCode) {
-        wx.showToast({
-          title: '请选择学校地区',
-          icon: "none"
-        })
-        return
-      }
-
-      if (!params.schoolAreaId) {
-        wx.showToast({
-          title: '请选择所在学校',
-          icon: "none"
-        })
-        return
-      }
-
-      if (!params.currentGradeNum) {
-        wx.showToast({
-          title: '请选择所在年级',
-          icon: "none"
-        })
-        return
-      }
-
-      if (!params.currentClass) {
-        wx.showToast({
-          title: '请选择所在班级',
-          icon: "none"
-        })
-        return
-      }
-
-      const objs = {
-        phone: params.phone,
-        name: params.name,
-        gender: params.gender,
-        currentGradeNum: params.currentGradeNum,
-        currentClass: params.currentClass,
-        schoolAreaId: params.schoolAreaId,
-        defaultStatus: false
-      }
-      const userBeneficiary = {
-        name: params.name,
-        phoneNumber: params.phone,
-        schoolInfo: (params.provinceName || '') + (params.cityName || '') + (params.regionName || '') + params.schoolAreaName + params.currentGradeTxt + params.currentClassTxt
-      }
-      let userBeneficiaryId = ''
-      this.setData({
-        buyerLoading: true
-      })
-      if (params.userBeneficiaryId) {
-        const { data } = await api_userBeneficiaryUpdate({
-          id: params.userBeneficiaryId,
-          ...objs
-        })
-
-        wx.showToast({
-          title: '保存成功',
-          icon: 'none'
-        })
-        userBeneficiaryId = data.data.id
-      } else {
-        const { data } = await api_userBeneficiarySave({
-          ...objs
-        })
-
-        wx.showToast({
-          title: '保存成功',
-          icon: 'none'
-        })
-        userBeneficiaryId = data.data.id
-      }
-
-      this.setData({
-        userBeneficiaryId,
-        userBeneficiaryInfo: userBeneficiary
-      })
-
-      this.onSetCatch(params)
-      this.onCloseBuyer()
-    } catch {
-      //
-    }
-
-    this.setData({
-      buyerLoading: false
-    })
-  },
-  /** 设置缓存 */
-  onSetCatch(params: any) {
-    wx.setStorageSync('buyerInfomation', JSON.stringify({
-      phone: params.phone,
-      name: params.name,
-      gender: params.gender,
-      schoolAreaId: params.schoolAreaId,
-      schoolAreaName: params.schoolAreaName,
-      currentGradeTxt: params.currentGradeTxt,
-      currentClass: params.currentClass,
-      currentClassTxt: params.currentClassTxt,
-      currentGradeNum: params.currentGradeNum,
-      cityCode: params.cityCode,
-      cityName: params.cityName,
-      provinceCode: params.provinceCode,
-      provinceName: params.provinceName,
-      regionCode: params.regionCode,
-      regionName: params.regionName,
-      schoolAreaIndex: params.schoolAreaIndex,
-      gradeGradeIndex: params.gradeGradeIndex,
-      classIndex: params.classIndex
-    }))
   }
 })

+ 0 - 73
miniprogram/pages/index/index.wxml

@@ -38,78 +38,5 @@
         </view>
       </van-popup>
     </view>
-
-    <!-- <service popShow="{{ showService }}" bind:changePop="changePop"></service> -->
-    <van-popup show="{{ showBuyer }}" safe-area-inset-bottom="{{false}}" lock-scroll="{{true}}" bind:close="onCloseBuyer" position="bottom" round z-index="101">
-      <image src="./images/icon-back.png" class="icon-close-pop" bind:tap="onCloseBuyer" />
-      <view class="container-pop">
-        <view class="pop-address-title">享用者信息</view>
-        <view class="section">
-          <view class="section-content">
-            <van-field label="姓名" model:value="{{ name }}" maxlength="15" placeholder="请填写享用者姓名" />
-            <van-field label="电话号码" model:value="{{ phone }}" maxlength="11" type="number" placeholder="请填写电话号码" />
-            <van-field label="性别" placeholder="请选择性别" value="{{ gender ? (gender === '1' ? '男' : '女') : '' }}" is-link readonly bind:tap="onCheckedGender"></van-field>
-
-            <van-field label="学校地区" value="{{ provinceName ? provinceName + '/' + cityName +  (regionName ? ('/' + regionName) : '') : '' }}" bind:tap="onShowAreaList" placeholder="请选择学校地区" is-link readonly />
-
-            <van-field model:value="{{ schoolAreaName }}" label="所在学校" placeholder="请选择所在学校" is-link readonly bind:tap="onSelectSchool" />
-            <van-field value="{{ currentGradeTxt }}" label="所在年级" placeholder="请选择所在年级" is-link readonly bind:tap="onSelectGradeClass" />
-            <van-field value="{{ currentClassTxt }}" label="所在班级" placeholder="请选择所在年级" is-link readonly bind:tap="onSelectClass" />
-          </view>
-        </view>
-
-        <view class="pop-btn-group">
-          <button disabled="{{ buyerLoading }}" class="submit-btn" bind:tap="onSubmitBuyer">保存信息</button>
-        </view>
-      </view>
-
-
-    </van-popup>
-
-    <!-- 性别 -->
-    <van-action-sheet z-index="103" show="{{ showGender }}" actions="{{ genderList }}" description="选择性别" cancel-text="取消" bind:close="onCloseGender" bind:cancel="onCloseGender" bind:select="onSelectGender" />
-
-    <!-- 地区 -->
-    <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-popup>
-
-    <!-- 学校 -->
-    <van-popup round="{{true}}" lock-scroll="{{true}}" z-index="{{102}}" show="{{showSchool}}" position="bottom" safe-area-inset-bottom="{{false}}" bind:close="onCloseSchool" bind:after-leave="onSchoolAfterLeave" bind:before-enter="onSchoolBeforeEnter">
-      <view class="toolbar-top">
-        <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>
-      <view class="empty-box" wx:if="{{ schoolAreaList.length <= 0 }}">
-        <view class="empty_loading" wx:if="{{ schoolLoading }}">
-          <van-loading color="#1989fa" />
-        </view>
-        <image mode="widthFix" src="https://oss.dayaedu.com/ktyq/1731839238916.png"></image>
-        <view class="empty-text">暂无数据</view>
-      </view>
-    </van-popup>
-
-
-    <!-- 年级 -->
-    <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>
-    </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>
-    </van-popup>
   </scroll-view>
 </view>

+ 154 - 13
miniprogram/pages/select-goods/index.less

@@ -23,16 +23,20 @@
   z-index: 1;
   background: #FFFFFF;
   border-radius: 32rpx 32rpx 0rpx 0rpx;
-  margin-top: 100rpx;
+  margin-top: -100rpx;
+  padding-top: 100rpx;
   flex: 1 auto;
   display: flex;
   flex-direction: column;
+  overflow-y: auto;
 }
 
 .select-good-section {
   display: flex;
   // align-items: center;
-  margin-top: -100rpx;
+  // margin-top: -100rpx;
+  position: relative;
+  z-index: 200;
 
   .select-good-img {
     width: 222rpx;
@@ -323,7 +327,7 @@
       width: 104rpx;
       height: 104rpx;
       flex-shrink: 0;
-      margin: 0 6rpx 0 26rpx;
+      margin: 0 26rpx 0 26rpx;
     }
 
     .instrment-info {
@@ -372,16 +376,153 @@
 
 
 
-button {
-  width: 100%;
-  line-height: 88rpx;
-  background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
-  border-radius: 44rpx;
-  font-weight: 500;
-  font-size: 32rpx;
-  color: #FFFFFF;
-  padding-top: 0;
-  padding-bottom: 0;
+.btnGroup {
+  button {
+    width: 100%;
+    font-weight: 600;
+    color: #FFFFFF;
+    padding-top: 0;
+    padding-bottom: 0;
+    line-height: 94rpx;
+    flex: 1;
+    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-size: 36rpx;
+  }
+
+  .btn-prices {
+    font-size: 32rpx;
+    color: #FEFFCA;
+
+    .stuff {
+      font-size: 32rpx;
+      padding-left: 8rpx;
+    }
+
+    .priceZ {
+      font-size: 48rpx;
+    }
+
+    .priceF {
+      font-size: 32rpx;
+    }
+  }
+}
+
+.popupBottom {
+  box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.5);
+  padding: 24rpx 24rpx 58rpx;
+}
+
+.select-buyer {
+  display: flex;
+  justify-content: space-between;
+
+  .desc {
+    font-weight: 600;
+    font-size: 30rpx;
+    color: #000000;
+    line-height: 40rpx;
+    display: flex;
+    align-items: center;
+
+    .iconBefore {
+      width: 18rpx;
+      height: 28rpx;
+      margin-right: 8rpx;
+    }
+
+    text {
+      padding-left: 8rpx;
+      font-size: 28rpx;
+      color: #AAAAAA;
+      line-height: 40rpx;
+    }
+  }
+
+  .btn-add {
+    display: inline-block;
+    padding: 4rpx 28rpx;
+    background: linear-gradient(270deg, #FF9501 0%, #FE4600 100%);
+    border-radius: 26rpx;
+    font-weight: 600;
+    font-size: 24rpx;
+    color: #FFFFFF;
+    line-height: 36rpx;
+  }
+
+  &.selected {
+    flex-direction: column;
+
+    .users {
+      position: relative;
+      margin-top: 24rpx;
+      display: flex;
+      align-items: center;
+      background: #F8F8F8;
+      border-radius: 12rpx;
+      border: 4rpx solid #FE4600;
+      padding: 24rpx 0 24rpx 30rpx;
+
+      .checkbox {
+        width: 32rpx;
+        height: 32rpx;
+        flex-shrink: 0;
+        margin-right: 30rpx;
+      }
+
+      .user {
+        .name {
+          padding-bottom: 8rpx;
+          font-weight: 600;
+          font-size: 32rpx;
+          color: #131415;
+          line-height: 44rpx;
+
+          text {
+            font-weight: 400;
+            font-size: 32rpx;
+            color: rgba(119, 119, 119, 1);
+          }
+        }
+
+        .detail {
+          font-size: 26rpx;
+          color: #777777;
+          line-height: 36rpx;
+        }
+      }
+
+      .icon-edit {
+        position: absolute;
+        top: 12rpx;
+        right: 0;
+        padding: 16rpx;
+        width: 28rpx;
+        height: 28rpx;
+      }
+    }
+  }
+}
+
+.current-good {
+  background: linear-gradient(180deg, rgba(254, 248, 241, 0.4) 0%, rgba(251, 233, 205, 0.4) 100%);
+  border-radius: 10rpx;
+  border: 2rpx solid rgba(251, 233, 206, 1);
+  margin: 26rpx 0 24rpx;
+  padding: 10rpx 22rpx;
+  font-size: 24rpx;
+  color: rgba(80, 47, 0, 1);
+
+  .current-item-text {
+    padding-bottom: 4rpx;
+  }
+
+  text {
+    color: rgba(254, 70, 0, 1);
+  }
 }
 
 // }

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

@@ -47,6 +47,10 @@ Page({
       const instrumentList = result.data.data || []
       instrumentList?.forEach((item: any) => {
         item.showSalePrice = formatPrice(item.salePrice || 0, 'ALL')
+        const formatSalePrice: any = formatPrice(item.salePrice || 0)
+        item.integerPart = formatSalePrice.integerPart
+        item.decimalPart = formatSalePrice.decimalPart
+        item.originalPrice = formatPrice(item.originalPrice, "ALL");
       })
       const { data } = await api_shopProduct({ appId: app.globalData.appId });
       const list = data.data || []
@@ -119,7 +123,9 @@ Page({
     }
     return num + (template[type] || '')
   },
-
+  onBack() {
+    wx.navigateBack()
+  },
   // 选择
   onSelectGoods(e: any) {
     const { dataset } = e.currentTarget
@@ -272,4 +278,10 @@ Page({
       })
     }, 500)()
   },
+  /** 添加购买人 */
+  onAddBuyer() {
+    wx.navigateTo({
+      url: "../buyerInformation/index?userBeneficiaryId=" + this.data.userBeneficiaryId,
+    });
+  },
 })

+ 72 - 51
miniprogram/pages/select-goods/index.wxml

@@ -3,45 +3,45 @@
   <navigation-bar title=" " background="transparent" back="{{ false }}"></navigation-bar>
   <view class="top-bar"></view>
 
-  <view class="section-block">
-    <view class="select-good-section">
-      <view class="select-good-img">
-        <image src="{{ selected.pic }}"></image>
-      </view>
-      <view class="good-info">
-        <view class="good-name">{{ selected.name }}</view>
-        <view class="good-price">
-          <!-- <view class="desc">共计</view> -->
-          <view class="currentPrice">
-            <text class="stuff">¥</text>
-            <text class="priceZ">{{ formatSelectGood.integerPart }}</text>
-            <text class="priceF">.{{ formatSelectGood.decimalPart }}</text>
-          </view>
-          <text class="line"></text>
-          <text class="discountPrice">优惠 ¥{{ formatSelectGood.discountPrice }}</text>
-        </view>
 
-        <image class="img_back" bind:tap="onBack" src="./images/icon-back.png"></image>
-      </view>
+  <view class="select-good-section">
+    <view class="select-good-img">
+      <image src="{{ selected.pic }}"></image>
     </view>
+    <view class="good-info">
+      <view class="good-name">{{ selected.name }}</view>
+      <view class="good-price">
+        <!-- <view class="desc">共计</view> -->
+        <view class="currentPrice">
+          <text class="stuff">¥</text>
+          <text class="priceZ">{{ formatSelectGood.integerPart }}</text>
+          <text class="priceF">.{{ formatSelectGood.decimalPart }}</text>
+        </view>
+        <text class="line"></text>
+        <text class="discountPrice">优惠 ¥{{ formatSelectGood.discountPrice }}</text>
+      </view>
 
+      <image class="img_back" bind:tap="onBack" src="./images/icon-back.png"></image>
+    </view>
+  </view>
+  <view class="section-block">
     <scroll-view class="popup-container" bounces="false" scroll-y="true" type="list">
       <view class="popup-scroll">
-        <!-- <view class="goodsInfo">
-            <view class="desc">
-              <image src="./images/icon2.png" class="iconBefore"></image>选择规格({{ list.length }})
-            </view>
-            <view class="goodsList">
-              <view wx:for="{{ list }}" wx:key="index" class="goodsItem {{ item.id == selected.id ? 'selected' : '' }} {{ item.stockNum <= 0 ? 'nosale' : '' }}" bind:tap="onSelectGoods" data-id="{{ item.id }}">
-                <image class="goodImg" src="{{ item.pic }}"></image>
-                <view class="infos">
-                  <view class="name">{{ item.typeName }}</view>
-                  <view class="price">¥<text>{{ item.showSalePrice }}</text></view>
-                </view>
-                <image class="nosale" wx:if="{{ item.stockNum <= 0 }}" src="./images/nosale.png"></image>
+        <view class="goodsInfo">
+          <view class="desc">
+            <image src="./images/icon2.png" class="iconBefore"></image>选择规格({{ list.length }})
+          </view>
+          <view class="goodsList">
+            <view wx:for="{{ list }}" wx:key="index" class="goodsItem {{ item.id == selected.id ? 'selected' : '' }} {{ item.stockNum <= 0 ? 'nosale' : '' }}" bind:tap="onSelectGoods" data-id="{{ item.id }}">
+              <image class="goodImg" src="{{ item.pic }}"></image>
+              <view class="infos">
+                <view class="name">{{ item.typeName }}</view>
+                <view class="price">¥<text>{{ item.showSalePrice }}</text></view>
               </view>
+              <image class="nosale" wx:if="{{ item.stockNum <= 0 }}" src="./images/nosale.png"></image>
             </view>
-          </view> -->
+          </view>
+        </view>
 
         <view class="goodsInfo">
           <view class="desc">
@@ -51,7 +51,8 @@
 
           <view class="goodsInstrument">
             <view class="instrument-item {{ item.id == selectInstrumentId ? 'selected' : '' }}" wx:for="{{ instrumentList }}" wx:key="index" bind:tap="onSelectInstrument" data-id="{{ item.id }}">
-              <image class="checkbox" src="./images/icon-default.png"></image>
+              <image class="checkbox" wx:if="{{ item.id == selectInstrumentId }}" src="./images/icon-select.png"></image>
+              <image class="checkbox" wx:else src="./images/icon-default.png"></image>
 
               <image class="instrument-img" src="{{ item.pic }}"></image>
 
@@ -60,39 +61,59 @@
                 <view class="prices">
                   <view class="currentPrice">
                     <text class="stuff">¥</text>
-                    <text class="priceZ">{{ formatSelectGood.integerPart }}</text>
-                    <text class="priceF">.{{ formatSelectGood.decimalPart }}</text>
+                    <text class="priceZ">{{ item.integerPart }}</text>
+                    <text class="priceF">.{{ item.decimalPart }}</text>
                   </view>
                   <text class="line"></text>
-                  <text class="discountPrice">优惠前 ¥{{ formatSelectGood.discountPrice }}</text>
+                  <text class="discountPrice">优惠前 ¥{{ item.originalPrice }}</text>
                 </view>
               </view>
             </view>
           </view>
         </view>
       </view>
-
     </scroll-view>
     <view class="popupBottom">
-      <!-- 有选择商品的时候 -->
-      <view class="current-item" wx:if="{{!isOverSaled && selected.id}}">
-        <!-- <view class="current-item-text">您已选择:</view> -->
-        <view class="current-top">
-          共计 <view class="prices"><text class="stuff">¥</text>
-            <text class="priceZ">{{ formatSelectGood.integerPart || 0 }}</text>
-            <text class="priceF">.{{ formatSelectGood.decimalPart || '00' }}</text>
+      <view class="select-buyer">
+        <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="desc">
+          <image src="./images/icon2.png" class="iconBefore"></image>选择权益享用人
+        </view>
+        <view class="users">
+          <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>
-          <text class="line">|</text>原价 ¥ {{ formatSelectGood.originalPrice }}
-          <block wx:if="{{ formatSelectGood.originalPrice > formatSelectGood.salePrice }}">
-            <text class="line">|</text>
-            <text>优惠 ¥ {{ formatSelectGood.discountPrice }}</text>
-          </block>
+
+          <image class="icon-edit" src="./images/icon-edit.png"></image>
         </view>
+      </view> -->
+
 
-        <view class="current-select-text">已选:{{ formatSelectGood.typeName }}</view>
+      <!-- 有选择商品的时候 -->
+      <view class="current-good" wx:if="{{!isOverSaled && selected.id}}">
+        <view class="current-item-text">您已选中</view>
+        <text>{{ formatSelectGood.typeName }}</text>,<block wx:if="{{ formatSelectGood.originalPrice > formatSelectGood.salePrice }}">
+          共减 <text>¥ {{ formatSelectGood.discountPrice }}</text>,
+        </block>应付:
+        <text>¥ {{ formatSelectGood.showSalePrice }}</text>
       </view>
       <view class="btnGroup">
-        <button type="primary" catch:tap="onSubmit">立即享受专属权益</button>
+        <button type="primary" catch:tap="onSubmit">
+          <view class="btn-prices">
+            立即支付<text class="stuff">¥</text>
+            <text class="priceZ">{{ formatSelectGood.integerPart || 0 }}</text>
+            <text class="priceF">.{{ formatSelectGood.decimalPart || '00' }}</text>
+          </view>
+        </button>
       </view>
     </view>
   </view>

+ 7 - 0
project.private.config.json

@@ -9,6 +9,13 @@
     "miniprogram": {
       "list": [
         {
+          "name": "pages/buyerInformation/index",
+          "pathName": "pages/buyerInformation/index",
+          "query": "userBeneficiaryId=",
+          "launchMode": "default",
+          "scene": null
+        },
+        {
           "name": "pages/select-goods/index",
           "pathName": "pages/select-goods/index",
           "query": "",