| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const ErpTabBar = () => "../../components/erp-tab-bar.js";
- const _sfc_main = {
- components: { ErpTabBar },
- data() {
- return {
- isAuthorized: false,
- selectedModels: []
- };
- },
- computed: {
- totalCount() {
- return this.selectedModels.reduce((sum, item) => sum + parseInt(item.count || 0), 0);
- }
- },
- onLoad() {
- common_vendor.index.$on("add_order_item", (data) => {
- this.selectedModels.push(data);
- common_vendor.index.showToast({ title: "添加成功", icon: "success" });
- });
- common_vendor.index.$on("update_order_item", (res) => {
- if (res.index > -1) {
- this.$set(this.selectedModels, res.index, res.data);
- common_vendor.index.showToast({ title: "修改成功", icon: "success" });
- }
- });
- },
- onUnload() {
- common_vendor.index.$off("add_order_item");
- common_vendor.index.$off("update_order_item");
- },
- methods: {
- contactAdmin() {
- common_vendor.index.showModal({ title: "联系管理员", content: "管理员电话:138-0000-0000", showCancel: false, confirmColor: "#C1001C" });
- },
- goToAddModel() {
- common_vendor.index.navigateTo({
- url: "/pages/order/add-model/index"
- });
- },
- editItem(index, item) {
- common_vendor.index.navigateTo({
- url: `/pages/order/edit-model/index?index=${index}&data=${encodeURIComponent(JSON.stringify(item))}`
- });
- },
- removeItem(index) {
- const self = this;
- common_vendor.index.showModal({
- title: "提示",
- content: "确定移除该型号吗?",
- success: (res) => {
- if (res.confirm) {
- self.selectedModels.splice(index, 1);
- }
- }
- });
- },
- submitFinalOrder() {
- if (this.selectedModels.length === 0)
- return;
- common_vendor.index.showLoading({ title: "正在提交结果", mask: true });
- setTimeout(() => {
- common_vendor.index.hideLoading();
- common_vendor.index.navigateTo({
- url: "/pages/order/success/index"
- });
- }, 1500);
- }
- }
- };
- if (!Array) {
- const _component_erp_tab_bar = common_vendor.resolveComponent("erp-tab-bar");
- _component_erp_tab_bar();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: !$data.isAuthorized
- }, !$data.isAuthorized ? {
- b: common_vendor.o((...args) => $options.contactAdmin && $options.contactAdmin(...args), "d8"),
- c: common_vendor.o(($event) => $data.isAuthorized = true, "35")
- } : common_vendor.e({
- d: $data.selectedModels.length > 0
- }, $data.selectedModels.length > 0 ? {} : {}, {
- e: $data.selectedModels.length > 0
- }, $data.selectedModels.length > 0 ? {
- f: common_vendor.f($data.selectedModels, (item, index, i0) => {
- return {
- a: common_vendor.o(($event) => $options.removeItem(index), index),
- b: common_vendor.t(item.type),
- c: common_vendor.t(item.count),
- d: common_vendor.t(item.surfaceName),
- e: index,
- f: common_vendor.o(($event) => $options.editItem(index, item), index)
- };
- })
- } : {
- g: common_vendor.o((...args) => $options.goToAddModel && $options.goToAddModel(...args), "65")
- }, {
- h: $data.selectedModels.length > 0
- }, $data.selectedModels.length > 0 ? {
- i: common_vendor.o((...args) => $options.goToAddModel && $options.goToAddModel(...args), "31")
- } : {}, {
- j: $data.selectedModels.length > 0
- }, $data.selectedModels.length > 0 ? {
- k: common_vendor.t($data.selectedModels.length),
- l: common_vendor.t($options.totalCount),
- m: $data.selectedModels.length === 0,
- n: common_vendor.o((...args) => $options.submitFinalOrder && $options.submitFinalOrder(...args), "fd")
- } : {}), {
- o: common_vendor.p({
- active: "order"
- })
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-17a44f9d"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/index.js.map
|