"use strict";
const common_vendor = require("../../../common/vendor.js");
require("../../../sheep/index.js");
const sheep_api_promotion_bargain = require("../../../sheep/api/promotion/bargain.js");
require("../../../sheep/api/index.js");
require("../../../sheep/api/distri/score.js");
require("../../../sheep/request/index.js");
require("../../../sheep/config/index.js");
require("../../../sheep/store/index.js");
require("../../../sheep/store/app.js");
require("../../../sheep/api/promotion/diy.js");
require("../../../sheep/platform/index.js");
require("../../../sheep/platform/provider/wechat/index.js");
require("../../../sheep/platform/provider/wechat/miniProgram.js");
require("../../../sheep/api/member/auth.js");
require("../../../sheep/api/member/social.js");
require("../../../sheep/api/member/user.js");
require("../../../sheep/platform/provider/apple/index.js");
require("../../../sheep/platform/share.js");
require("../../../sheep/router/index.js");
require("../../../sheep/hooks/useModal.js");
require("../../../sheep/helper/index.js");
require("../../../sheep/helper/test.js");
require("../../../sheep/helper/digit.js");
require("../../../sheep/api/member/signin.js");
require("../../../sheep/helper/throttle.js");
require("../../../sheep/url/index.js");
require("../../../sheep/platform/pay.js");
require("../../../sheep/api/pay/order.js");
require("../../../sheep/store/user.js");
require("../../../sheep/store/cart.js");
require("../../../sheep/api/trade/cart.js");
require("../../../sheep/api/pay/wallet.js");
require("../../../sheep/api/trade/order.js");
require("../../../sheep/api/promotion/coupon.js");
require("../../../sheep/store/sys.js");
require("../../../sheep/store/modal.js");
require("../../../sheep/api/distri/share.js");
require("../../../sheep/api/distri/team.js");
require("../../../sheep/api/infra/file.js");
require("../../../sheep/api/member/address.js");
require("../../../sheep/api/member/point.js");
require("../../../sheep/api/migration/app.js");
require("../../../sheep/api/migration/chat.js");
require("../../../sheep/api/migration/index.js");
require("../../../sheep/api/migration/third.js");
require("../../../sheep/api/pay/channel.js");
require("../../../sheep/api/product/category.js");
require("../../../sheep/api/product/comment.js");
require("../../../sheep/api/product/favorite.js");
require("../../../sheep/api/product/history.js");
require("../../../sheep/api/product/spu.js");
require("../../../sheep/api/promotion/activity.js");
require("../../../sheep/api/promotion/article.js");
require("../../../sheep/api/promotion/combination.js");
require("../../../sheep/api/promotion/rewardActivity.js");
require("../../../sheep/api/promotion/seckill.js");
require("../../../sheep/api/system/area.js");
require("../../../sheep/api/system/voice.js");
require("../../../sheep/api/trade/afterSale.js");
require("../../../sheep/api/trade/brokerage.js");
require("../../../sheep/api/trade/config.js");
require("../../../sheep/api/trade/delivery.js");
require("../../../sheep/config/zIndex.js");
if (!Array) {
  const _easycom_s_count_down2 = common_vendor.resolveComponent("s-count-down");
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  (_easycom_s_count_down2 + _easycom_s_layout2)();
}
const _easycom_s_count_down = () => "../../../sheep/components/s-count-down/s-count-down.js";
const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
if (!Math) {
  (_easycom_s_count_down + _easycom_s_layout)();
}
const _sfc_main = {
  __name: "detail",
  setup(__props) {
    const state = common_vendor.reactive({
      id: "",
      buyPrice: "",
      bargainInfo: {},
      bgColor: {
        "bgColor": "#333333",
        "Color": "#fff",
        "width": "44rpx",
        "timeTxtwidth": "16rpx",
        "isDay": true
      },
      bargainUserHelpList: [],
      couponsHidden: true
    });
    async function getBargainDetails() {
      let {
        data,
        code
      } = await sheep_api_promotion_bargain.BargainApi.getBargainActivityDetail({
        id: state.id
      });
      if (code == 0) {
        state.bargainInfo = data;
        state.buyPrice = state.bargainInfo.bargainFirstPrice;
      }
    }
    common_vendor.onLoad(function(options) {
      if (options.hasOwnProperty("id")) {
        options.id ? state.id = options.id : state.id = "";
      }
      getBargainDetails();
    });
    function fen2yuan(price) {
      return (price / 100).toFixed(2);
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: state.bargainInfo.picUrl,
        b: common_vendor.t(state.bargainInfo.name),
        c: common_vendor.t(fen2yuan(state.bargainInfo.bargainMinPrice)),
        d: common_vendor.t(state.bargainInfo.stock),
        e: common_vendor.t(state.bargainInfo.unitName),
        f: common_vendor.t(fen2yuan(state.buyPrice)),
        g: state.bargainInfo.endTime > (/* @__PURE__ */ new Date()).getTime() && state.bargainInfo.stock > 0
      }, state.bargainInfo.endTime > (/* @__PURE__ */ new Date()).getTime() && state.bargainInfo.stock > 0 ? {
        h: common_vendor.p({
          tipText: " ",
          bgColor: state.bgColor,
          dayText: ":",
          hourText: ":",
          minuteText: ":",
          secondText: " ",
          datatime: state.bargainInfo.endTime / 1e3,
          isDay: true
        })
      } : state.bargainInfo.endTime <= (/* @__PURE__ */ new Date()).getTime() ? {
        j: common_vendor.o((...args) => _ctx.currentBargainUser && _ctx.currentBargainUser(...args))
      } : state.bargainInfo.stock <= 0 ? {
        l: common_vendor.o((...args) => _ctx.currentBargainUser && _ctx.currentBargainUser(...args))
      } : {}, {
        i: state.bargainInfo.endTime <= (/* @__PURE__ */ new Date()).getTime(),
        k: state.bargainInfo.stock <= 0,
        m: common_vendor.o((...args) => _ctx.goProduct && _ctx.goProduct(...args)),
        n: state.bargainUserHelpList.length > 0
      }, state.bargainUserHelpList.length > 0 ? common_vendor.e({
        o: _ctx.index < 3 || !state.couponsHidden
      }, _ctx.index < 3 || !state.couponsHidden ? {
        p: common_vendor.f(state.bargainUserHelpList, (item, index, i0) => {
          return {
            a: item.avatar,
            b: common_vendor.t(item.nickname),
            c: common_vendor.t(_ctx.formatDate(item.createTime)),
            d: common_vendor.t(fen2yuan(item.reducePrice)),
            e: index
          };
        })
      } : {}, {
        q: state.bargainUserHelpList.length > 3
      }, state.bargainUserHelpList.length > 3 ? {
        r: common_vendor.t(state.couponsHidden ? "展开更多" : "关闭展开"),
        s: common_vendor.n(state.couponsHidden ? "icon-xiangxia" : "icon-xiangshang"),
        t: common_vendor.o((...args) => _ctx.openTap && _ctx.openTap(...args))
      } : {}) : {}, {
        v: state.bargainUserHelpList.length === 0
      }, state.bargainUserHelpList.length === 0 ? {} : {}, {
        w: common_vendor.p({
          title: "砍价详情"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6d33792e"], ["__file", "D:/zx/mall-front-app/pages/activity/bargain/detail.vue"]]);
wx.createPage(MiniProgramPage);
