app/Resources/static-src/app/js/order/create/index.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

import notify from 'common/notify';

let utils = {
  divition(x, y) {
    return Math.round(Math.round(x * 1000) / Math.round(y * 1000) * 1000) / 1000;
  },
  multiple(x, y) {
    return Math.round(Math.round(x * 100) * Math.round(y * 100)) / 10000;
  },
  subtract(x, y) {
    return Math.round(Math.round(x * 1000) - Math.round(y * 1000)) / 1000;
  },
  moneyFormatFloor(value) {
    // 转化成字符串
    let tempValue = value + '';
    tempValue = parseInt(Math.round(tempValue * 1000));
    // 抹去最后1位
    tempValue = parseInt(tempValue / 10) * 10 / 1000;
    return tempValue.toFixed(2);
  },
  moneyFormatCeil(value) {
    let tempValue = value + '';
    tempValue = parseFloat(tempValue).toFixed(3);
    let length = tempValue.length;
    if (tempValue.substr(length - 1, 1) === '0') {
      return this.moneyFormatFloor(tempValue);
    }
    return this.moneyFormatFloor(parseFloat(tempValue) + 0.01);
  }
};


class OrderCreate {
  constructor(props) {
    this.element = $(props.element);
    this.submitBtn = '#order-create-btn';
    this.validator = null;
    this.coinSetting = JSON.parse(this.element.find('.js-coin-setting ').text());
    this.init();
  }

  init() {
    this.initEvent();
    this.validator = this.element.validate({
      currentDom: this.submitBtn,
    });

    let couponDefaultSelect = $('#coupon-select').val();
    if (couponDefaultSelect != '') {
      let couponCode = $('[role="coupon-code-input"]');
      couponCode.val(couponDefaultSelect);
      $('button[role="coupon-use"]').trigger('click');
    }

    let totalPrice = parseFloat($('[role="total-price"]').text());
    let _this = this;
    if ($('[role="coinNum"]').length > 0) {
      let coinNum = $('[role="coinNum"]').val();
      if (isNaN(coinNum) || coinNum <= 0) {
        $(this).val('0.00');

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。