123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const common_assets = require("../common/assets.js");
- const _sfc_main = {
- data() {
- return {
- orderId: null,
- order: null,
- orderCode: null,
- items: [],
- type: null,
- reasonsList: [],
- reasons: "请选择",
- explains: "",
- refundAmount: 0
- };
- },
- onLoad(option) {
- this.type = option.type;
- this.orderCode = option.orderCode;
- this.reasonsList = this.utils.getDict("storeAfterSalesReasons");
- this.orderId = option.orderId;
- console.log(this.orderId);
- this.getMyStoreOrderItemByOrderId();
- },
- methods: {
- getMyStoreOrderItemByOrderId() {
- var data = { orderId: this.orderId };
- getMyStoreOrderItemByOrderId(data).then((res) => {
- if (res.code == 200) {
- this.order = res.order;
- this.items = res.items;
- if (this.order.isPayRemain == 0) {
- this.refundAmount = this.order.payMoney.toFixed(2);
- } else {
- this.refundAmount = this.order.payPrice.toFixed(2);
- }
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "请求失败"
- });
- }
- });
- },
- reasonsChange(e) {
- console.log(e.detail.value);
- this.reasons = this.reasonsList[e.detail.value].dictLabel;
- },
- submit() {
- if (this.reasons == "请选择") {
- common_vendor.index.showToast({
- icon: "none",
- title: "请选择原因"
- });
- return;
- }
- if (this.refundAmount < 0) {
- common_vendor.index.showToast({
- icon: "none",
- title: "请输入退款金额"
- });
- return;
- }
- var productIds = this.items.map((item2) => item2.productId);
- var products = [];
- for (var i = 0; i < productIds.length; i++) {
- var item = { productId: productIds[i] };
- products.push(item);
- }
- var data = { refundAmount: this.refundAmount, orderCode: this.orderCode, serviceType: this.type, reasons: this.reasons, explains: this.explains, productList: products };
- applyAfterSales(data).then((res) => {
- if (res.code == 200) {
- common_vendor.index.showToast({
- icon: "success",
- title: "提交成功"
- });
- setTimeout(function() {
- common_vendor.index.$emit("refreshOrder");
- common_vendor.index.navigateBack({
- delta: 1
- });
- }, 500);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.order != null && $data.order.isPackage != 1
- }, $data.order != null && $data.order.isPackage != 1 ? {
- b: common_vendor.f($data.items, (item, index, i0) => {
- return {
- a: JSON.parse(item.jsonInfo).image,
- b: common_vendor.t(JSON.parse(item.jsonInfo).productName),
- c: common_vendor.t(JSON.parse(item.jsonInfo).sku),
- d: common_vendor.t(JSON.parse(item.jsonInfo).price.toFixed(2)),
- e: common_vendor.t(JSON.parse(item.jsonInfo).num),
- f: index
- };
- })
- } : {}, {
- c: $data.order != null && $data.order.isPackage == 1 && $data.order.packageJson != null
- }, $data.order != null && $data.order.isPackage == 1 && $data.order.packageJson != null ? {
- d: JSON.parse($data.order.packageJson).imgUrl,
- e: common_vendor.t(JSON.parse($data.order.packageJson).title),
- f: common_vendor.t(JSON.parse($data.order.packageJson).descs)
- } : {}, {
- g: $data.refundAmount,
- h: common_vendor.o(($event) => $data.refundAmount = $event.detail.value),
- i: common_vendor.t($data.reasons),
- j: common_assets._imports_0$10,
- k: common_vendor.o((...args) => $options.reasonsChange && $options.reasonsChange(...args)),
- l: $data.reasons,
- m: $data.reasonsList,
- n: $data.explains,
- o: common_vendor.o(($event) => $data.explains = $event.detail.value),
- p: common_vendor.o(($event) => $options.submit())
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|