"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../../sheep/index.js");
const sheep_api_trade_order = require("../../../sheep/api/trade/order.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/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/bargain.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_goods_item2 = common_vendor.resolveComponent("s-goods-item");
  const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
  const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  const _easycom_s_uploader2 = common_vendor.resolveComponent("s-uploader");
  const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  (_easycom_s_goods_item2 + _easycom_uni_rate2 + _easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_su_fixed2 + _easycom_s_layout2)();
}
const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.js";
const _easycom_uni_rate = () => "../../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
const _easycom_s_uploader = () => "../../../sheep/components/s-uploader/s-uploader.js";
const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
if (!Math) {
  (_easycom_s_goods_item + _easycom_uni_rate + _easycom_uni_easyinput + _easycom_s_uploader + _easycom_su_fixed + _easycom_s_layout)();
}
const _sfc_main = {
  __name: "add",
  setup(__props) {
    const state = common_vendor.reactive({
      orderInfo: {},
      commentList: [],
      id: null
    });
    async function onSubmit() {
      common_vendor.index.showModal({
        title: "提示",
        content: "是否评论？",
        success: async function(res) {
          if (!res.confirm) {
            return;
          }
          for (const comment of state.commentList) {
            await sheep_api_trade_order.OrderApi.createOrderItemComment(comment);
          }
          sheep_index.sheep.$router.back();
        }
      });
    }
    common_vendor.onLoad(async (options) => {
      if (!options.id) {
        sheep_index.sheep.$helper.toast(`缺少订单信息，请检查`);
        return;
      }
      state.id = options.id;
      const {
        code,
        data
      } = await sheep_api_trade_order.OrderApi.getOrder(state.id);
      if (code !== 0) {
        sheep_index.sheep.$helper.toast("无待评价订单");
        return;
      }
      data.items.forEach((item) => {
        state.commentList.push({
          anonymous: false,
          orderItemId: item.id,
          descriptionScores: 5,
          benefitScores: 5,
          content: "",
          picUrls: []
        });
      });
      state.orderInfo = data;
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(state.orderInfo.items, (item, index, i0) => {
          return {
            a: "c66153cb-1-" + i0 + ",c66153cb-0",
            b: common_vendor.p({
              img: item.picUrl,
              title: item.spuName,
              skuText: item.properties.map((property) => property.valueName).join(" "),
              price: item.payPrice,
              num: item.count
            }),
            c: "c66153cb-2-" + i0 + ",c66153cb-0",
            d: common_vendor.o(($event) => state.commentList[index].descriptionScores = $event, item.id),
            e: common_vendor.p({
              modelValue: state.commentList[index].descriptionScores
            }),
            f: "c66153cb-3-" + i0 + ",c66153cb-0",
            g: common_vendor.o(($event) => state.commentList[index].benefitScores = $event, item.id),
            h: common_vendor.p({
              modelValue: state.commentList[index].benefitScores
            }),
            i: "c66153cb-4-" + i0 + ",c66153cb-0",
            j: common_vendor.o(($event) => state.commentList[index].content = $event, item.id),
            k: common_vendor.p({
              inputBorder: false,
              type: "textarea",
              maxlength: "120",
              autoHeight: true,
              placeholder: "宝贝满足你的期待吗？说说你的使用心得，分享给想买的他们吧~",
              modelValue: state.commentList[index].content
            }),
            l: "c66153cb-5-" + i0 + ",c66153cb-0",
            m: common_vendor.o(($event) => state.commentList[index].picUrls = $event, item.id),
            n: common_vendor.p({
              fileMediatype: "image",
              limit: "9",
              mode: "grid",
              imageStyles: {
                width: "168rpx",
                height: "168rpx"
              },
              url: state.commentList[index].picUrls
            }),
            o: item.id
          };
        }),
        b: common_vendor.o(onSubmit),
        c: common_vendor.p({
          bottom: true,
          placeholder: true
        }),
        d: common_vendor.p({
          title: "评价"
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c66153cb"], ["__file", "D:/zx/mall-front-app/pages/goods/comment/add.vue"]]);
wx.createPage(MiniProgramPage);
