detail.js 9.9 KB

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