123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
- const sheep_index = require("../../sheep/index.js");
- require("../../sheep/url/index.js");
- require("../../sheep/store/index.js");
- require("../../sheep/store/app.js");
- require("../../sheep/api/promotion/diy.js");
- require("../../sheep/request/index.js");
- require("../../sheep/config/index.js");
- require("../../sheep/platform/index.js");
- require("../../sheep/platform/provider/wechat/index.js");
- require("../../sheep/platform/provider/wechat/miniProgram.js");
- require("../../sheep/api/member/auth.js");
- require("../../sheep/api/member/social.js");
- require("../../sheep/api/member/user.js");
- require("../../sheep/platform/provider/apple/index.js");
- require("../../sheep/platform/share.js");
- require("../../sheep/router/index.js");
- require("../../sheep/hooks/useModal.js");
- require("../../sheep/helper/index.js");
- require("../../sheep/helper/test.js");
- require("../../sheep/helper/digit.js");
- require("../../sheep/api/member/signin.js");
- require("../../sheep/helper/throttle.js");
- require("../../sheep/platform/pay.js");
- require("../../sheep/api/pay/order.js");
- require("../../sheep/store/user.js");
- require("../../sheep/store/cart.js");
- require("../../sheep/api/trade/cart.js");
- require("../../sheep/api/pay/wallet.js");
- require("../../sheep/api/trade/order.js");
- require("../../sheep/api/promotion/coupon.js");
- require("../../sheep/store/sys.js");
- require("../../sheep/store/modal.js");
- require("../../sheep/util/index.js");
- require("../../sheep/api/index.js");
- require("../../sheep/api/distri/score.js");
- require("../../sheep/api/distri/share.js");
- require("../../sheep/api/distri/team.js");
- require("../../sheep/api/infra/file.js");
- require("../../sheep/api/member/address.js");
- require("../../sheep/api/member/point.js");
- require("../../sheep/api/migration/app.js");
- require("../../sheep/api/migration/chat.js");
- require("../../sheep/api/migration/index.js");
- require("../../sheep/api/migration/third.js");
- require("../../sheep/api/pay/channel.js");
- require("../../sheep/api/product/category.js");
- require("../../sheep/api/product/comment.js");
- require("../../sheep/api/product/favorite.js");
- require("../../sheep/api/product/history.js");
- require("../../sheep/api/product/spu.js");
- require("../../sheep/api/promotion/activity.js");
- require("../../sheep/api/promotion/article.js");
- require("../../sheep/api/promotion/bargain.js");
- require("../../sheep/api/promotion/combination.js");
- require("../../sheep/api/promotion/rewardActivity.js");
- require("../../sheep/api/promotion/seckill.js");
- require("../../sheep/api/system/area.js");
- require("../../sheep/api/system/voice.js");
- require("../../sheep/api/trade/afterSale.js");
- require("../../sheep/api/trade/brokerage.js");
- require("../../sheep/api/trade/config.js");
- require("../../sheep/api/trade/delivery.js");
- require("../../sheep/config/zIndex.js");
- if (!Array) {
- const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
- const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
- const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
- const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
- const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
- const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
- (_easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_s_goods_item2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
- }
- const _easycom_su_tabs = () => "../../sheep/ui/su-tabs/su-tabs.js";
- const _easycom_su_sticky = () => "../../sheep/ui/su-sticky/su-sticky.js";
- const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
- const _easycom_s_goods_item = () => "../../sheep/components/s-goods-item/s-goods-item.js";
- const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
- const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
- if (!Math) {
- (_easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_s_goods_item + _easycom_uni_load_more + _easycom_s_layout)();
- }
- const _sfc_main = {
- __name: "otherlist",
- setup(__props) {
- const tradeManaged = common_vendor.computed(() => sheep_index.sheep.$store("app").has_wechat_trade_managed);
- const pagination = {
- data: [],
- current_page: 1,
- total: 1,
- last_page: 1
- };
- const state = common_vendor.reactive({
- currentTab: 0,
- pagination: {
- data: [],
- current_page: 1,
- total: 1,
- last_page: 1
- },
- loadStatus: "",
- deleteOrderId: 0,
- error: 0
- });
- const tabMaps = [
- {
- name: "全部",
- value: "all"
- },
- {
- name: "待付款",
- value: "unpaid"
- },
- {
- name: "待发货",
- value: "nosend"
- },
- {
- name: "待收货",
- value: "noget"
- },
- {
- name: "待评价",
- value: "nocomment"
- }
- ];
- function onTabsChange(e) {
- if (state.currentTab === e.index)
- return;
- state.pagination = pagination;
- state.currentTab = e.index;
- getOrderList();
- }
- function onOrderDetail(orderSN) {
- sheep_index.sheep.$router.go("/pages/order/detail", {
- orderSN
- });
- }
- function onOrderGroupon(order) {
- sheep_index.sheep.$router.go("/pages/activity/groupon/detail", {
- id: order.ext.groupon_id
- });
- }
- function onOrderInvoice(invoiceId) {
- sheep_index.sheep.$router.go("/pages/order/invoice", {
- invoiceId
- });
- }
- function onPay(orderSN) {
- sheep_index.sheep.$router.go("/pages/pay/index", {
- orderSN
- });
- }
- function onComment(orderSN) {
- sheep_index.sheep.$router.go("/pages/goods/comment/add", {
- orderSN
- });
- }
- async function onConfirm(order, ignore = false) {
- if (sheep_index.sheep.$platform.name === "WechatMiniProgram" && !common_vendor.lodashExports.isEmpty(order.wechat_extra_data) && tradeManaged.value === 1 && !ignore) {
- mpConfirm(order);
- return;
- }
- const { error } = await sheep_index.sheep.$api.order.confirm(order.id);
- if (error === 0) {
- state.pagination = pagination;
- getOrderList();
- }
- }
- function mpConfirm(order) {
- if (!common_vendor.wx$1.openBusinessView) {
- sheep_index.sheep.$helper.toast(`请升级微信版本`);
- return;
- }
- common_vendor.wx$1.openBusinessView({
- businessType: "weappOrderConfirm",
- extraData: {
- merchant_trade_no: order.wechat_extra_data.merchant_trade_no,
- transaction_id: order.wechat_extra_data.transaction_id
- },
- success(response) {
- console.log("success:", response);
- if (response.errMsg === "openBusinessView:ok") {
- if (response.extraData.status === "success") {
- onConfirm(order, true);
- }
- }
- },
- fail(error) {
- console.log("error:", error);
- },
- complete(result) {
- console.log("result:", result);
- }
- });
- }
- async function onExpress(orderId) {
- sheep_index.sheep.$router.go("/pages/order/express/list", {
- orderId
- });
- }
- async function onCancel(orderId) {
- common_vendor.index.showModal({
- title: "提示",
- content: "确定要取消订单吗?",
- success: async function(res) {
- if (res.confirm) {
- const { error, data } = await sheep_index.sheep.$api.order.cancel(orderId);
- if (error === 0) {
- let index = state.pagination.data.findIndex((order) => order.id === orderId);
- state.pagination.data[index] = data;
- }
- }
- }
- });
- }
- function onDelete(orderId) {
- common_vendor.index.showModal({
- title: "提示",
- content: "确定要删除订单吗?",
- success: async function(res) {
- if (res.confirm) {
- const { error, data } = await sheep_index.sheep.$api.order.delete(orderId);
- if (error === 0) {
- let index = state.pagination.data.findIndex((order) => order.id === orderId);
- state.pagination.data.splice(index, 1);
- }
- }
- }
- });
- }
- async function onRefund(orderId) {
- common_vendor.index.showModal({
- title: "提示",
- content: "确定要申请退款吗?",
- success: async function(res) {
- if (res.confirm) {
- sheep_index.sheep.$platform.useProvider("wechat").subscribeMessage("order_refund");
- const { error, data } = await sheep_index.sheep.$api.order.applyRefund(orderId);
- if (error === 0) {
- let index = state.pagination.data.findIndex((order) => order.id === orderId);
- state.pagination.data[index] = data;
- }
- }
- }
- });
- }
- async function getOrderList(page = 1, list_rows = 5) {
- state.loadStatus = "loading";
- let res = await sheep_index.sheep.$api.order.list({
- type: tabMaps[state.currentTab].value,
- list_rows,
- page
- });
- state.error = res.error;
- if (res.error === 0) {
- let orderList = common_vendor._.concat(state.pagination.data, res.data.data);
- state.pagination = {
- ...res.data,
- data: orderList
- };
- if (state.pagination.current_page < state.pagination.last_page) {
- state.loadStatus = "more";
- } else {
- state.loadStatus = "noMore";
- }
- }
- }
- common_vendor.onLoad(async (options) => {
- if (options.type) {
- state.currentTab = options.type;
- }
- getOrderList();
- });
- function loadmore() {
- if (state.loadStatus !== "noMore") {
- getOrderList(state.pagination.current_page + 1);
- }
- }
- common_vendor.onReachBottom(() => {
- loadmore();
- });
- common_vendor.onPullDownRefresh(() => {
- state.pagination = pagination;
- getOrderList();
- setTimeout(function() {
- common_vendor.index.stopPullDownRefresh();
- }, 800);
- });
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.o(onTabsChange),
- b: common_vendor.p({
- list: tabMaps,
- scrollable: false,
- current: state.currentTab
- }),
- c: common_vendor.p({
- bgColor: "#fff"
- }),
- d: state.pagination.total === 0
- }, state.pagination.total === 0 ? {
- e: common_vendor.p({
- icon: "/static/order-empty.png",
- text: "暂无订单"
- })
- } : {}, {
- f: state.pagination.total > 0
- }, state.pagination.total > 0 ? {
- g: common_vendor.f(state.pagination.data, (order, k0, i0) => {
- return common_vendor.e({
- a: common_vendor.t(order.order_sn),
- b: common_vendor.t(order.status_text),
- c: common_vendor.n(common_vendor.unref(sheep_hooks_useGoods.formatOrderColor)(order.status_code)),
- d: common_vendor.f(order.items, (item, k1, i1) => {
- return common_vendor.e({
- a: item.btns.includes("aftersale")
- }, item.btns.includes("aftersale") ? {
- b: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/apply", {
- item: JSON.stringify(item)
- }), item.id)
- } : {}, {
- c: item.btns.includes("re_aftersale")
- }, item.btns.includes("re_aftersale") ? {
- d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/apply", {
- item: JSON.stringify(item)
- }), item.id)
- } : {}, {
- e: item.btns.includes("aftersale_info")
- }, item.btns.includes("aftersale_info") ? {
- f: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/detail", {
- id: item.ext.aftersale_id
- }), item.id)
- } : {}, {
- g: item.btns.includes("buy_again")
- }, item.btns.includes("buy_again") ? {
- h: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/index", {
- id: item.goods_id
- }), item.id)
- } : {}, {
- i: "ad14ec43-4-" + i0 + "-" + i1 + ",ad14ec43-0",
- j: common_vendor.p({
- img: item.goods_image,
- title: item.goods_title,
- skuText: item.goods_sku_text,
- price: item.goods_price,
- score: order.score_amount,
- num: item.goods_num
- }),
- k: item.id
- });
- }),
- e: order.total_discount_fee > 0
- }, order.total_discount_fee > 0 ? {
- f: common_vendor.t(order.total_discount_fee)
- } : {}, {
- g: common_vendor.t(order.dispatch_amount),
- h: common_vendor.t(order.order_amount),
- i: order.score_amount
- }, order.score_amount ? {} : {}, {
- j: order.score_amount
- }, order.score_amount ? {
- k: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/score1.svg"),
- l: common_vendor.t(order.score_amount)
- } : {}, {
- m: order.btns.includes("groupon")
- }, order.btns.includes("groupon") ? {
- n: common_vendor.t(order.status_code === "groupon_ing" ? "邀请拼团" : "拼团详情"),
- o: common_vendor.o(($event) => onOrderGroupon(order), order.id)
- } : {}, {
- p: order.btns.includes("invoice")
- }, order.btns.includes("invoice") ? {
- q: common_vendor.o(($event) => {
- var _a;
- return onOrderInvoice((_a = order.invoice) == null ? void 0 : _a.id);
- }, order.id)
- } : {}, {
- r: order.btns.length === 0
- }, order.btns.length === 0 ? {
- s: common_vendor.o(($event) => onOrderDetail(order.order_sn), order.id)
- } : {}, {
- t: order.btns.includes("confirm")
- }, order.btns.includes("confirm") ? {
- v: common_vendor.o(($event) => onConfirm(order), order.id)
- } : {}, {
- w: order.btns.includes("express")
- }, order.btns.includes("express") ? {
- x: common_vendor.o(($event) => onExpress(order.id), order.id)
- } : {}, {
- y: order.btns.includes("apply_refund")
- }, order.btns.includes("apply_refund") ? {
- z: common_vendor.o(($event) => onRefund(order.id), order.id)
- } : {}, {
- A: order.btns.includes("re_apply_refund")
- }, order.btns.includes("re_apply_refund") ? {
- B: common_vendor.o(($event) => onRefund(order.id), order.id)
- } : {}, {
- C: order.btns.includes("cancel")
- }, order.btns.includes("cancel") ? {
- D: common_vendor.o(($event) => onCancel(order.id), order.id)
- } : {}, {
- E: order.btns.includes("comment")
- }, order.btns.includes("comment") ? {
- F: common_vendor.o(($event) => onComment(order.order_sn), order.id)
- } : {}, {
- G: order.btns.includes("delete")
- }, order.btns.includes("delete") ? {
- H: common_vendor.o(($event) => onDelete(order.id), order.id)
- } : {}, {
- I: order.btns.includes("pay")
- }, order.btns.includes("pay") ? {
- J: common_vendor.o(($event) => onPay(order.order_sn), order.id)
- } : {}, {
- K: common_vendor.n(order.btns.length > 3 ? "ss-row-between" : "ss-row-right"),
- L: order.id,
- M: common_vendor.o(($event) => onOrderDetail(order.order_sn), order.id)
- });
- })
- } : {}, {
- h: state.pagination.total > 0
- }, state.pagination.total > 0 ? {
- i: common_vendor.o(loadmore),
- j: common_vendor.p({
- status: state.loadStatus,
- ["content-text"]: {
- contentdown: "上拉加载更多"
- }
- })
- } : {}, {
- k: common_vendor.p({
- title: "我的订单"
- })
- });
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ad14ec43"], ["__file", "D:/zx/mall-front-app/pages/order/otherlist.vue"]]);
- wx.createPage(MiniProgramPage);
|