收藏
回答

上传报错/addContract/add.js Unexpected token: punc (.)

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.06.2412050
var t = (0,
  require("../../../@babel/runtime/helpers/interopRequireDefault").default)(
    require("../../../utils/request"),
  ),
  e = getApp();
Page({
  data: {
    type"",
    custId: "",
    signId: "",
    contractId: "",
    info: {},
    title: "",
    roomTypeData: [],
    roomData: [],
    sourceData: [],
    parityData: [],
    babyQuantity: 1,
    saleData: [],
    collectMoney: {},
    typeData: [],
    wayData: [],
  },
  onLoad: function (t{
    this.getUserInfo(t.id);
    this.setData({
      custId: t.id,
      type: t.type,
      contractId: t.contractId ? t.contractId : "",
      title: t.title ? t.title : "",
      signId: t.signId ? t.signId : "",
    }),
      "contract" == t.type
        ? (wx.setNavigationBarTitle({ title: "新增合同" }),
          this.getClientSource(),
          this.getRoomType(),
          this.getRoom(),
          this.getParityData()
          )
        : "money" == t.type &&
          (wx.setNavigationBarTitle({
            title: t.title ? "编辑收款" : "新增收款",
          }),
          t.title && this.getCollectMoney(t.signId)),
      this.getType(),
      this.getSale(),
      this.getCollectWay();
  },


  getUserInfo: function (id{
    var a = this;
    t.default
      .get("/project/customer/".concat(id))
      .then(function (t{
        if (200 == t.code) {
          a.setData({ info: t.data });
        }
      })
      .catch(function (t{
        e.alert("系统繁忙~请稍后重试~"), console.error("抛异常了:".concat(t.msg));
      });
  },


  getCollectWay: function () {
    var a = this;
    t.default
      .get("/system/dict/data/type/way_type")
      .then(function (t{
        if(t.code == 200) {
          const map = (t.data || []).reduce((acc, item) => {
            item?.dictValue !== undefined && (acc[item.dictValue] = item.dictLabel);
            return acc;
          }, {});
          a.setData({ wayData: map });
        }
      })
      .catch(function (t) {
        e.alert("系统繁忙~请稍后重试~"), console.error("抛异常了:".concat(t.msg));
      });
  },
  formSubmitfunction (a) {
    var i = this.data,
      n = a.detail.value;
      const saleName = i.saleData.find(e=>e.userId == n.sale).nickName;
    return "" == n.number.trim()
      ? e.toast("请输入合同编号")
      : "" == n.name.trim()
        ? e.toast("请输入合同名称")
        : "" == n.roomType
          ? e.toast("请选择合同房型")
          : "" == n.room
            ? e.toast("请选择房间")
            : "" == n.deposit.trim()
              ? e.toast("请输入合同定金")
              : "" == n.balance.trim()
                ? e.toast("请输入合同尾款")
                : "" == n.realPrice.trim()
                  ? e.toast("请输入合实际价格")
                  : "" == n.packagePrice.trim()
                    ? e.toast("请输入合同套餐价")
                    : null == n.enterDate
                      ? e.toast("请选择入住日期")
                      : "" == n.totalDays.trim()
                        ? e.toast("请输入入住天数")
                        : null == n.signDate
                          ? e.toast("请选择签约时间")
                          : "" == n.parity
                            ? e.toast("请选择胎次")
                            : "" == n.origin
                              ? e.toast("请选择订单来源")
                              : "" == n.sale
                                ? e.toast("请选择母婴顾问")
                                : void t.default
                                    .post("/project/customerContract", {
                                      custId: i.custId,
                                      babyQuantity: i.babyQuantity,
                                      parity: n.parity,
                                      enterDate: n.enterDate,
                                      signDate: n.signDate,
                                      totalDays: n.totalDays,
                                      deposit: n.deposit,
                                      first: n.first,
                                      continueType: n.continueType,
                                      outDate: i.outDate,
                                      insurancePrice: n.insurancePrice,
                                      name: n.name,
                                      number: n.number,
                                      origin: i.info.origin,
                                      packagePrice: n.packagePrice,
                                      remark: n.remark,
                                      room: n.room,
                                      roomType: n.roomType,
                                      saleId: n.sale,
                                      saleName: saleName,
                                      status: n.status,
                                      balance: n.balance,
                                      realPrice: n.realPrice,
                                    })
                                    .then(function (t) {
                                      200 == t.code &&
                                        (wx.showToast({
                                          title: "新增成功",
                                          icon: "success",
                                        }),
                                        setTimeout(function () {
                                          wx.navigateBack({ delta: 1 });
                                        }, 800));
                                    });
  },
  editMoneyfunction (a) {
    var i = this.data,
      n = a.detail.value;
    if ("" == n.userName.trim()return e.toast("请输入客户名字");
    if ("" == n.collectName.trim()return e.toast("请输入收款名称");
    if ("" == n.collectNumber.trim()return e.toast("请输入收款编号");
    if ("" == n.money.trim()return e.toast("请输入收款金额");
    if (null == n.payTypereturn e.toast("请选择收款类型");
    if (null == n.datereturn e.toast("请选择入收款日期");
    if (null == n.wayreturn e.toast("请选择收款方式");
    var o = i.title ? "/custSignRec/update" : "/custSignRec/insert";
    t.default
      .post(o, {
        custId: i.custId,
        contractId: i.contractId,
        custSignRecId: i.signId,
        money: n.money,
        name: n.collectName,
        recMode: n.way,
        recNum: n.collectNumber,
        recTime: n.date,
        recType: n.payType,
        remarks: n.remarks,
        serialNumber: n.serialNumber,
        serviceRemarks: n.desc,
        status: n.status,
      })
      .then(function (t) {
        1 == t.code && e.backAlert(i.title ? "修改成功" : "新增成功");
      })
      .catch(function (t) {
        console.error("抛异常了:".concat(t));
      });
  },
  getSalefunction () {
    var e = this;
    t.default.get("/system/user/list").then(function (t) {
      200 == t.code && e.setData({ saleData: t.rows });
    });
  },
  getTypefunction () {
    var e = this;
    t.default
      .get("/system/dict/data/type/pay_type")
      .then(function (t) {
        if(t.code == 200) {
          const map = (t.data || []).reduce((acc, item) => {
            item?.dictValue !== undefined && (acc[item.dictValue] = item.dictLabel);
            return acc;
          }, {});
          e.setData({ typeData: map });
        }
      })
      .catch(function (t) {
        console.error("抛异常了:".concat(t));
      });
  },
  getRoomTypefunction () {
    var e = this;
    t.default.get("/system/dict/data/type/room_type").then(function (t) {
      if (t.code == 200) {
        e.setData({ roomTypeData: t.data });
      }
    });
  },
  getParityDatafunction () {
    var e = this;
    t.default.get("/system/dict/data/type/parity_type").then(function (t) {
      if (t.code == 200) {
        e.setData({ parityData: t.data });
      }
    });
  },
  getRoomfunction () {
    var e = this;
    t.default.get("/app/roomList").then(function (t) {
      200 == t.code && e.setData({ roomData: t.data });
    });
  },
  selectSalefunction (t) {
    this.setData({ sale: t.detail.value });
  },
  selectDueDatefunction (t) {
    this.setData({ dueDate: t.detail.value });
  },
  selectEnterDatefunction (t) {
    var e = this.data;
    this.setData({ enterDate: t.detail.value }),
      t.detail.value && e.days && this.getOutDate(t.detail.value, e.days);
  },
  inputDaysfunction (t) {
    var e = this.data;
    this.setData({ days: t.detail.value }),
      t.detail.value &&
        e.enterDate &&
        this.getOutDate(e.enterDate, t.detail.value);
  },
  getOutDatefunction (t, e) {
    var a = new Date(t).valueOf() + 24 * e * 3600 * 1e3,
      i = new Date(a),
      n = i.getFullYear(),
      o = i.getMonth() + 1;
    o < 10 && (o = "0" + o);
    var s = i.getDate();
    s < 10 && (s = "0" + s), this.setData({ outDate: n + "-" + o + "-" + s });
  },
  selectSignDatefunction (t) {
    this.setData({ signDate: t.detail.value });
  },
  selectRoomTypefunction (t) {
    this.setData({ roomType: t.detail.value });
  },
  selectRoomfunction (t) {
    this.setData({ room: t.detail.value });
  },
  selectSourcefunction (t) {
    this.setData({ origin: t.detail.value });
  },
  selectDatefunction (t) {
    this.setData({ date: t.detail.value });
  },
  selectParityfunction (t) {
    this.setData({ parity: t.detail.value });
  },
  selectBabyQuantityfunction (t) {
    this.setData({ babyQuantity: parseInt(t.detail) });
  },
  getClientSourcefunction () {
    var a = this;
    t.default
      .get("/system/dict/data/type/customer_origin")
      .then(function (t) {
        if(t.code == 200) {
          const map = (t.data || []).reduce((acc, item) => {
            item?.dictValue !== undefined && (acc[item.dictValue] = item.dictLabel);
            return acc;
          }, {});
          a.setData({ sourceData: map });
        }
      })
      .catch(function (t) {
        e.alert("系统繁忙~请稍后重试~"), console.error("抛异常了:".concat(t));
      });
  },
  getCollectMoneyfunction (a) {
    var i = this;
    t.default
      .get("/custSignRec/findById?custSignRecId=".concat(a))
      .then(function (t) {
        1 == t.code && i.setData({ collectMoney: t.result });
      })
      .catch(function (t) {
        e.alert("系统繁忙~请稍后重试~"), console.error("抛异常了:".concat(t));
      });
  },
  selectWayfunction (t) {
    this.setData({ way: t.detail.value });
  },
  selectTypefunction (t) {
    this.setData({ payType: t.detail.value });
  },
});


回答关注问题邀请回答
收藏

1 个回答

  • 社区技术运营专员-Jahozheng
    社区技术运营专员-Jahozheng
    星期三 15:18

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    星期三 15:18
    有用
    回复
登录 后发表内容