123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- "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");
- const sheep_api_trade_config = require("../../../sheep/api/trade/config.js");
- const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.js");
- const sheep_api_trade_afterSale = require("../../../sheep/api/trade/afterSale.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/brokerage.js");
- require("../../../sheep/api/trade/delivery.js");
- require("../../../sheep/config/zIndex.js");
- require("../../../sheep/util/index.js");
- if (!Array) {
- const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
- const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
- const _easycom_s_uploader2 = common_vendor.resolveComponent("s-uploader");
- const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
- const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
- const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
- const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
- (_easycom_s_goods_item2 + _easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_uni_forms2 + _easycom_su_fixed2 + _easycom_su_popup2 + _easycom_s_layout2)();
- }
- const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.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_uni_forms = () => "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";
- const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
- const _easycom_su_popup = () => "../../../sheep/ui/su-popup/su-popup.js";
- const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
- if (!Math) {
- (_easycom_s_goods_item + _easycom_uni_easyinput + _easycom_s_uploader + _easycom_uni_forms + _easycom_su_fixed + _easycom_su_popup + _easycom_s_layout)();
- }
- const _sfc_main = {
- __name: "apply",
- setup(__props) {
- const form = common_vendor.ref(null);
- const state = common_vendor.reactive({
- orderId: 0,
- // 订单编号
- itemId: 0,
- // 订单项编号
- order: {},
- // 订单
- item: {},
- // 订单项
- config: {},
- // 交易配置
- // 售后类型
- wayList: [
- {
- text: "仅退款",
- value: "10"
- },
- {
- text: "退款退货",
- value: "20"
- }
- ],
- reasonList: [],
- // 可选的申请原因数组
- showModal: false,
- // 是否显示申请原因弹窗
- currentValue: ""
- // 当前选择的售后原因
- });
- const formData = common_vendor.reactive({
- way: "",
- applyReason: "",
- applyDescription: "",
- applyPicUrls: []
- });
- const rules = common_vendor.reactive({});
- async function submit() {
- if (formData.way == "") {
- common_vendor.index.showToast({
- title: "请选择售后类型",
- icon: "error",
- duration: 1e3
- });
- return false;
- }
- if (state.currentValue == "") {
- common_vendor.index.showToast({
- title: "请选择申请原因",
- icon: "error",
- duration: 1e3
- });
- return false;
- }
- if (formData.applyDescription == "") {
- common_vendor.index.showToast({
- title: "请填写相关描述",
- icon: "error",
- duration: 1e3
- });
- return false;
- }
- sheep_index.sheep.$platform.useProvider("wechat").subscribeMessage("order_aftersale_change");
- let data = {
- orderItemId: state.itemId,
- refundPrice: state.item.payPrice,
- ...formData
- };
- const { code } = await sheep_api_trade_afterSale.AfterSaleApi.createAfterSale(data);
- if (code === 0) {
- common_vendor.index.showToast({
- title: "申请成功"
- });
- sheep_index.sheep.$router.go("/pages/order/aftersale/list");
- }
- }
- function onRefundChange(e) {
- formData.way = e.detail.value;
- state.reasonList = formData.way === "10" ? state.config.afterSaleRefundReasons || [] : state.config.afterSaleReturnReasons || [];
- formData.applyReason = "";
- state.currentValue = "";
- }
- function onChange(e) {
- state.currentValue = e.detail.value;
- }
- function onReason() {
- formData.applyReason = state.currentValue;
- state.showModal = false;
- }
- common_vendor.onLoad(async (options) => {
- if (!options.orderId || !options.itemId) {
- sheep_index.sheep.$helper.toast(`缺少订单信息,请检查`);
- return;
- }
- state.orderId = options.orderId;
- state.itemId = parseInt(options.itemId);
- const { code, data } = await sheep_api_trade_order.OrderApi.getOrder(state.orderId);
- if (code !== 0) {
- return;
- }
- state.order = data;
- state.item = data.items.find((item) => item.id === state.itemId) || {};
- if (state.order.status === 10) {
- state.wayList.splice(1, 1);
- }
- state.config = (await sheep_api_trade_config.TradeConfigApi.getTradeConfig()).data;
- });
- return (_ctx, _cache) => {
- var _a;
- return common_vendor.e({
- a: common_vendor.p({
- img: state.item.picUrl,
- title: state.item.spuName,
- skuText: (_a = state.item.properties) == null ? void 0 : _a.map((property) => property.valueName).join(" "),
- price: state.item.price,
- num: state.item.count
- }),
- b: common_vendor.f(state.wayList, (item, index, i0) => {
- return {
- a: formData.type === item.value,
- b: item.value,
- c: common_vendor.t(item.text),
- d: index
- };
- }),
- c: common_vendor.o(onRefundChange),
- d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.item.payPrice)),
- e: common_vendor.o(($event) => state.showModal = true),
- f: formData.applyReason
- }, formData.applyReason ? {
- g: common_vendor.t(formData.applyReason)
- } : {}, {
- h: common_vendor.o(($event) => state.showModal = true),
- i: common_vendor.o(($event) => formData.applyDescription = $event),
- j: common_vendor.p({
- inputBorder: false,
- type: "textarea",
- maxlength: "120",
- autoHeight: true,
- placeholder: "客官~请描述您遇到的问题,建议上传照片",
- modelValue: formData.applyDescription
- }),
- k: common_vendor.o(($event) => formData.applyPicUrls = $event),
- l: common_vendor.p({
- fileMediatype: "image",
- limit: "9",
- mode: "grid",
- imageStyles: {
- width: "168rpx",
- height: "168rpx"
- },
- url: formData.applyPicUrls
- }),
- m: common_vendor.sr(form, "5be4d0ee-2,5be4d0ee-0", {
- "k": "form"
- }),
- n: common_vendor.o(($event) => formData = $event),
- o: common_vendor.p({
- rules,
- ["label-position"]: "top",
- modelValue: formData
- }),
- p: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/chat/index")),
- q: common_vendor.o(submit),
- r: common_vendor.p({
- bottom: true,
- placeholder: true
- }),
- s: common_vendor.f(state.reasonList, (item, k0, i0) => {
- return {
- a: common_vendor.t(item),
- b: item,
- c: item === state.currentValue,
- d: item
- };
- }),
- t: common_vendor.o(onChange),
- v: common_vendor.o(onReason),
- w: common_vendor.o(($event) => state.showModal = false),
- x: common_vendor.p({
- show: state.showModal,
- round: "10",
- showClose: true
- }),
- y: common_vendor.p({
- title: "申请售后"
- })
- });
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5be4d0ee"], ["__file", "D:/zx/mall-front-app/pages/order/aftersale/apply.vue"]]);
- wx.createPage(MiniProgramPage);
|