detail.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.js");
  5. const sheep_api_trade_afterSale = require("../../../sheep/api/trade/afterSale.js");
  6. require("../../../sheep/url/index.js");
  7. require("../../../sheep/store/index.js");
  8. require("../../../sheep/store/app.js");
  9. require("../../../sheep/api/promotion/diy.js");
  10. require("../../../sheep/request/index.js");
  11. require("../../../sheep/config/index.js");
  12. require("../../../sheep/platform/index.js");
  13. require("../../../sheep/platform/provider/wechat/index.js");
  14. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  15. require("../../../sheep/api/member/auth.js");
  16. require("../../../sheep/api/member/social.js");
  17. require("../../../sheep/api/member/user.js");
  18. require("../../../sheep/platform/provider/apple/index.js");
  19. require("../../../sheep/platform/share.js");
  20. require("../../../sheep/router/index.js");
  21. require("../../../sheep/hooks/useModal.js");
  22. require("../../../sheep/helper/index.js");
  23. require("../../../sheep/helper/test.js");
  24. require("../../../sheep/helper/digit.js");
  25. require("../../../sheep/helper/throttle.js");
  26. require("../../../sheep/platform/pay.js");
  27. require("../../../sheep/api/pay/order.js");
  28. require("../../../sheep/store/user.js");
  29. require("../../../sheep/store/cart.js");
  30. require("../../../sheep/api/trade/cart.js");
  31. require("../../../sheep/api/pay/wallet.js");
  32. require("../../../sheep/api/trade/order.js");
  33. require("../../../sheep/api/promotion/coupon.js");
  34. require("../../../sheep/store/sys.js");
  35. require("../../../sheep/store/modal.js");
  36. require("../../../sheep/config/zIndex.js");
  37. require("../../../sheep/util/index.js");
  38. if (!Array) {
  39. const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
  40. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  41. const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  42. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  43. (_easycom_s_goods_item2 + _easycom_s_empty2 + _easycom_su_fixed2 + _easycom_s_layout2)();
  44. }
  45. const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.js";
  46. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  47. const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
  48. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  49. if (!Math) {
  50. (_easycom_s_goods_item + _easycom_s_empty + _easycom_su_fixed + _easycom_s_layout)();
  51. }
  52. const _sfc_main = {
  53. __name: "detail",
  54. setup(__props) {
  55. common_vendor.useCssVars((_ctx) => ({
  56. "4745ac6a": common_vendor.unref(headerBg)
  57. }));
  58. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  59. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/order/order_bg.png");
  60. const state = common_vendor.reactive({
  61. id: 0,
  62. // 售后编号
  63. info: {},
  64. // 收货信息
  65. loading: false,
  66. active: 0,
  67. // 在 list 的激活位置
  68. list: [{
  69. title: "提交申请"
  70. }, {
  71. title: "处理中"
  72. }, {
  73. title: "完成"
  74. }]
  75. // 时间轴
  76. });
  77. function onApply(id) {
  78. common_vendor.index.showModal({
  79. title: "提示",
  80. content: "确定要取消此申请吗?",
  81. success: async function(res) {
  82. if (!res.confirm) {
  83. return;
  84. }
  85. const { code } = await sheep_api_trade_afterSale.AfterSaleApi.cancelAfterSale(id);
  86. if (code === 0) {
  87. await getDetail(id);
  88. }
  89. }
  90. });
  91. }
  92. const onCopy = () => {
  93. sheep_index.sheep.$helper.copyText(state.info.no);
  94. };
  95. async function getDetail(id) {
  96. state.loading = true;
  97. const { code, data } = await sheep_api_trade_afterSale.AfterSaleApi.getAfterSale(id);
  98. if (code !== 0) {
  99. state.info = null;
  100. return;
  101. }
  102. state.info = data;
  103. sheep_hooks_useGoods.handleAfterSaleButtons(state.info);
  104. if ([10].includes(state.info.status)) {
  105. state.active = 0;
  106. } else if ([20, 30].includes(state.info.status)) {
  107. state.active = 1;
  108. } else if ([40, 50].includes(state.info.status)) {
  109. state.active = 2;
  110. } else if ([61, 62, 63].includes(state.info.status)) {
  111. state.active = 2;
  112. }
  113. }
  114. common_vendor.onLoad((options) => {
  115. if (!options.id) {
  116. sheep_index.sheep.$helper.toast(`缺少订单信息,请检查`);
  117. return;
  118. }
  119. state.id = options.id;
  120. getDetail(options.id);
  121. });
  122. return (_ctx, _cache) => {
  123. var _a, _b, _c, _d;
  124. return common_vendor.e({
  125. a: !common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) && state.loading
  126. }, !common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) && state.loading ? {
  127. b: common_vendor.f(state.list, (item, index, i0) => {
  128. return common_vendor.e({
  129. a: state.list.length - 1 === index && [61, 62, 63].includes(state.info.status)
  130. }, state.list.length - 1 === index && [61, 62, 63].includes(state.info.status) ? {} : {
  131. b: common_vendor.n(state.active >= index ? "activity-color" : "info-color")
  132. }, {
  133. c: state.list.length - 1 !== index
  134. }, state.list.length - 1 !== index ? {
  135. d: common_vendor.n(state.active >= index ? "activity-bg" : "info-bg")
  136. } : {}, {
  137. e: common_vendor.t(item.title),
  138. f: common_vendor.n(state.active >= index ? "activity-color" : "info-color"),
  139. g: index
  140. });
  141. }),
  142. c: common_vendor.s({
  143. marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
  144. paddingTop: Number(statusBarHeight + 88) + "rpx"
  145. }),
  146. d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.formatAfterSaleStatusDescription)(state.info)),
  147. e: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.info.updateTime, "yyyy-mm-dd hh:MM:ss")),
  148. f: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/log", {
  149. id: state.id
  150. })),
  151. g: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.info.refundPrice)),
  152. h: common_vendor.p({
  153. img: state.info.picUrl,
  154. title: state.info.spuName,
  155. titleWidth: 480,
  156. skuText: state.info.properties.map((property) => property.valueName).join(" "),
  157. num: state.info.count
  158. }),
  159. i: common_vendor.t(state.info.no),
  160. j: common_vendor.o(onCopy),
  161. k: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.info.createTime, "yyyy-mm-dd hh:MM:ss")),
  162. l: common_vendor.t(state.info.way === 10 ? "仅退款" : "退款退货"),
  163. m: common_vendor.t(state.info.applyReason),
  164. n: common_vendor.t(state.info.applyDescription)
  165. } : {}, {
  166. o: common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) && state.loading
  167. }, common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) && state.loading ? {
  168. p: common_vendor.p({
  169. icon: "/static/order-empty.png",
  170. text: "暂无该订单售后详情"
  171. })
  172. } : {}, {
  173. q: !common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info)
  174. }, !common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) ? common_vendor.e({
  175. r: (_a = state.info.buttons) == null ? void 0 : _a.includes("cancel")
  176. }, ((_b = state.info.buttons) == null ? void 0 : _b.includes("cancel")) ? {
  177. s: common_vendor.o(($event) => onApply(state.info.id))
  178. } : {}, {
  179. t: (_c = state.info.buttons) == null ? void 0 : _c.includes("delivery")
  180. }, ((_d = state.info.buttons) == null ? void 0 : _d.includes("delivery")) ? {
  181. v: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/return-delivery", {
  182. id: state.info.id
  183. }))
  184. } : {}, {
  185. w: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/chat/index")),
  186. x: common_vendor.p({
  187. bottom: true,
  188. placeholder: true,
  189. bg: "bg-white"
  190. })
  191. }) : {}, {
  192. y: common_vendor.s(_ctx.__cssVars()),
  193. z: common_vendor.p({
  194. title: "售后详情",
  195. navbar: !common_vendor.unref(common_vendor.lodashExports.isEmpty)(state.info) && state.loading ? "inner" : "normal"
  196. })
  197. });
  198. };
  199. }
  200. };
  201. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-915d84ff"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/order/aftersale/detail.vue"]]);
  202. wx.createPage(MiniProgramPage);