123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const common_assets = require("../common/assets.js");
- const _sfc_main = {
- // mixins: [MescrollMixin],
- data() {
- return {
- searchKey: "",
- status: 0,
- orderStatus: [
- { name: "全部", value: "" },
- { name: "待付款", value: "0" },
- { name: "待发货", value: "1" },
- { name: "待收货", value: "2" },
- { name: "已完成", value: "3" }
- ],
- mescroll: null,
- // 上拉加载的配置
- upOption: {
- onScroll: true,
- use: true,
- // 是否启用上拉加载; 默认true
- page: {
- num: 0,
- // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10
- // 每页数据的数量,默认10
- },
- noMoreSize: 10,
- // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- icon: "/static/images/no_data.png",
- tip: "暂无数据"
- }
- },
- // 列表数据
- dataList: []
- };
- },
- onLoad(option) {
- this.status = option.status;
- var that = this;
- common_vendor.index.$on("refreshOrder", () => {
- that.mescroll.resetUpScroll();
- });
- },
- methods: {
- goSearch(e) {
- this.searchKey = e.detail.value;
- this.mescroll.resetUpScroll();
- },
- refund(item) {
- common_vendor.index.navigateTo({
- url: "./refundOrderProduct?orderId=" + item.id
- });
- },
- // tab切换
- orderStatusChange(item) {
- this.status = item.value;
- this.mescroll.resetUpScroll();
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll();
- },
- upCallback(page) {
- var that = this;
- var data = {
- keyword: this.searchKey,
- status: this.status,
- page: page.num,
- pageSize: page.size
- };
- getMyStoreOrderList(data).then((res) => {
- if (res.code == 200) {
- if (page.num == 1) {
- that.dataList = res.data.list;
- } else {
- that.dataList = that.dataList.concat(res.data.list);
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "请求失败"
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
- // 查看订单详情
- showDetail(item) {
- console.log(item);
- common_vendor.index.navigateTo({
- url: "./storeOrderDetail?id=" + item.id
- });
- },
- cancel(item) {
- var that = this;
- common_vendor.index.showModal({
- title: "提示",
- content: "确定取消订单吗",
- success: function(res) {
- if (res.confirm) {
- var data = {
- orderId: item.id
- };
- cancelOrder(data).then((res2) => {
- if (res2.code == 200) {
- common_vendor.index.showToast({
- icon: "success",
- title: "操作成功"
- });
- that.mescroll.resetUpScroll();
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res2.msg
- });
- }
- });
- } else if (res.cancel)
- ;
- }
- });
- },
- pay(item) {
- if (item.isPrescribe == 1 && item.prescribeId == null) {
- common_vendor.index.navigateTo({
- url: "/pages/shopping/prescribe?orderId=" + item.id
- });
- } else {
- common_vendor.index.navigateTo({
- url: "/pages/shopping/paymentOrder?orderId=" + item.id
- });
- }
- },
- // 查看物流
- showDelivery(item) {
- common_vendor.index.navigateTo({
- url: "./storeOrderDelivery?orderId=" + item.id
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_vendor.f($data.orderStatus, (item, index, i0) => {
- return {
- a: common_vendor.t(item.name),
- b: $data.status == item.value,
- c: index,
- d: common_vendor.n($data.status == item.value ? "item active" : "item"),
- e: common_vendor.o(($event) => $options.orderStatusChange(item), index)
- };
- }),
- b: common_assets._imports_0$12,
- c: common_assets._imports_1,
- d: common_vendor.o((...args) => $options.goSearch && $options.goSearch(...args)),
- e: common_vendor.f($data.dataList, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(item.storeName || ""),
- b: item.storeName,
- c: common_vendor.t(item.orderCode),
- d: common_vendor.t(_ctx.utils.getDictLabelName("storeOrderStatus", item.status)),
- e: common_vendor.o(($event) => $options.showDetail(item), index),
- f: item.isPackage != 1
- }, item.isPackage != 1 ? {
- g: common_vendor.f(item.items, (subItem, subIndex, i1) => {
- return common_vendor.e({
- a: JSON.parse(subItem.jsonInfo).image,
- b: subItem.isPrescribe == 1
- }, subItem.isPrescribe == 1 ? {} : {}, {
- c: common_vendor.t(JSON.parse(subItem.jsonInfo).productName),
- d: common_vendor.t(JSON.parse(subItem.jsonInfo).sku),
- e: common_vendor.t(JSON.parse(subItem.jsonInfo).price.toFixed(2)),
- f: common_vendor.t(JSON.parse(subItem.jsonInfo).num),
- g: common_vendor.o(($event) => $options.showDetail(item), subIndex),
- h: subIndex
- });
- })
- } : {}, {
- h: item.isPackage == 1 && item.packageJson != null
- }, item.isPackage == 1 && item.packageJson != null ? {
- i: JSON.parse(item.packageJson).imgUrl,
- j: common_vendor.t(JSON.parse(item.packageJson).title),
- k: common_vendor.t(JSON.parse(item.packageJson).descs),
- l: common_vendor.o(($event) => $options.showDetail(item), index)
- } : {}, {
- m: common_vendor.t(item.payPrice.toFixed(2)),
- n: item.status == 0
- }, item.status == 0 ? {
- o: common_vendor.o(($event) => $options.cancel(item), index)
- } : {}, {
- p: item.status == 0
- }, item.status == 0 ? {
- q: common_vendor.o(($event) => $options.pay(item), index)
- } : {}, {
- r: item.isAfterSales == 1
- }, item.isAfterSales == 1 ? {
- s: common_vendor.o(($event) => $options.refund(item), index)
- } : {}, {
- t: item.status >= 2 && item.deliveryId != null
- }, item.status >= 2 && item.deliveryId != null ? {
- v: common_vendor.o(($event) => $options.showDelivery(item), index)
- } : {}, {
- w: index
- });
- })
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|