detail.js 11 KB

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