123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- "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,
- reasonsOptions: [],
- reasons: "请选择",
- explains: "",
- refundAmount: 0
- };
- },
- onLoad(option) {
- this.type = option.type;
- this.orderId = option.orderId;
- this.getStoreOrderItems();
- this.getDictByKey("sys_sales_reasons");
- },
- methods: {
- getDictByKey(key) {
- var data = { key };
- getDictByKey(data).then(
- (res) => {
- if (res.code == 200) {
- if (key == "sys_sales_reasons") {
- this.reasonsOptions = res.data;
- }
- }
- },
- (err) => {
- }
- );
- },
- getStoreOrderItems() {
- var data = { orderId: this.orderId };
- getStoreOrderItems(data).then((res) => {
- if (res.code == 200) {
- this.order = res.order;
- this.items = res.items;
- this.refundAmount = this.order.payMoney.toFixed(2);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "请求失败"
- });
- }
- });
- },
- handleReasons(e) {
- console.log(e.detail.value);
- this.reasons = this.reasonsOptions[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,
- orderId: this.orderId,
- refundType: 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
- });
- }
- });
- }
- }
- };
- if (!Array) {
- const _easycom_u__textarea2 = common_vendor.resolveComponent("u--textarea");
- _easycom_u__textarea2();
- }
- const _easycom_u__textarea = () => "../uni_modules/uview-plus/components/u--textarea/u--textarea.js";
- if (!Math) {
- _easycom_u__textarea();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.order != null
- }, $data.order != null ? {
- b: common_vendor.f($data.items, (item, index, i0) => {
- return {
- a: JSON.parse(item.jsonInfo).image == "" ? "/static/images/drug.svg" : 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.refundAmount,
- d: common_vendor.o(($event) => $data.refundAmount = $event.detail.value),
- e: common_vendor.t($data.reasons),
- f: common_assets._imports_0$10,
- g: common_vendor.o((...args) => $options.handleReasons && $options.handleReasons(...args)),
- h: $data.reasons,
- i: $data.reasonsOptions,
- j: common_vendor.o(($event) => $data.explains = $event),
- k: common_vendor.p({
- height: 100,
- placeholder: "请描述申请售后服务的具体原因",
- count: 100,
- modelValue: $data.explains
- }),
- l: common_vendor.o(($event) => $options.submit())
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|