"use strict"; var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const common_vendor = require("../../../../common/vendor.js"); const modules_mall_sheep_index = require("../../sheep/index.js"); const modules_mall_sheep_api_trade_order = require("../../sheep/api/trade/order.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"); const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni"); (_easycom_s_goods_item2 + _easycom_uni_rate2 + _easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_su_fixed2 + _easycom_s_layout2 + _component_layout_default_uni)(); } 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 }); function onSubmit() { return __async(this, null, function* () { for (const comment of state.commentList) { yield modules_mall_sheep_api_trade_order.OrderApi.createOrderItemComment(comment); } modules_mall_sheep_index.sheep.$router.back(); }); } common_vendor.onLoad((options) => __async(this, null, function* () { if (!options.id) { modules_mall_sheep_index.sheep.$helper.toast(`缺少订单信息,请检查`); return; } state.id = options.id; const { code, data } = yield modules_mall_sheep_api_trade_order.OrderApi.getOrder(state.id); if (code !== 0) { modules_mall_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: "fdae4c95-2-" + i0 + ",fdae4c95-1", 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: "fdae4c95-3-" + i0 + ",fdae4c95-1", d: common_vendor.o(($event) => state.commentList[index].descriptionScores = $event, item.id), e: common_vendor.p({ modelValue: state.commentList[index].descriptionScores }), f: "fdae4c95-4-" + i0 + ",fdae4c95-1", g: common_vendor.o(($event) => state.commentList[index].benefitScores = $event, item.id), h: common_vendor.p({ modelValue: state.commentList[index].benefitScores }), i: "fdae4c95-5-" + i0 + ",fdae4c95-1", 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: "fdae4c95-6-" + i0 + ",fdae4c95-1", m: common_vendor.o(($event) => state.commentList[index].images = $event, item.id), n: common_vendor.p({ fileMediatype: "image", limit: "9", mode: "grid", imageStyles: { width: "168rpx", height: "168rpx" }, url: state.commentList[index].images }), 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-fdae4c95"]]); wx.createPage(MiniProgramPage);