"use strict"; const common_vendor = require("../../../common/vendor.js"); const sheep_index = require("../../../sheep/index.js"); require("../../../sheep/request/index.js"); const sheep_api_member_address = require("../../../sheep/api/member/address.js"); require("../../../sheep/helper/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/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/test.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/config/index.js"); require("../../../sheep/config/zIndex.js"); require("../../../sheep/helper/digit.js"); if (!Array) { const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item"); const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput"); const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed"); const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout"); (_easycom_uni_forms_item2 + _easycom_uni_easyinput2 + _easycom_uni_forms2 + _easycom_su_fixed2 + _easycom_s_layout2)(); } const _easycom_uni_forms_item = () => "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js"; const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js"; const _easycom_uni_forms = () => "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"; const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js"; const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js"; if (!Math) { (_easycom_uni_forms_item + _easycom_uni_easyinput + _easycom_uni_forms + _easycom_su_fixed + _easycom_s_layout)(); } const _sfc_main = { __name: "edit", setup(__props) { const invoiceFormRef = common_vendor.ref(null); const currentProtocol = common_vendor.ref(false); const state = common_vendor.reactive({ showRegion: false, model: { invoiceType: 1, invoiceTitleType: 1, invoiceTitle: "", taxIDNumber: "" }, rules: {}, protocol: false }); function onChange() { state.protocol = !state.protocol; } function onProtocol(title) { sheep_index.sheep.$router.go("/pages/public/richtext", { title }); } const rules = { invoiceType: { rules: [{ required: true, errorMessage: "请选择发票类型" }] }, invoiceTitleType: { rules: [{ required: true, errorMessage: "请选择抬头类型" }] }, invoiceTitle: { rules: [{ required: true, errorMessage: "请输入发票抬头" }] }, taxIDNumber: { rules: [{ required: true, errorMessage: "请输入单位税号" }] } }; const invoiceType = (e) => { state.model.invoiceType = e.detail.value; state.model.invoiceTitleType = 1; }; const invoiceTitleType = (e) => { state.model.invoiceTitleType = e.detail.value; }; const onSave = async () => { const validate = await common_vendor.unref(invoiceFormRef).validate().catch((error) => { console.log("error: ", error); }); if (!validate) { return; } if (!state.protocol) { currentProtocol.value = true; setTimeout(function() { currentProtocol.value = false; }, 500); return; } const formData = { ...state.model }; const { code } = state.model.id > 0 ? await sheep_api_member_address.AddressApi.updateAddress(formData) : await sheep_api_member_address.AddressApi.createAddress(formData); if (code === 0) { sheep_index.sheep.$router.back(); } }; const onDelete = () => { common_vendor.index.showModal({ title: "提示", content: "确认删除此收货地址吗?", success: async function(res) { if (!res.confirm) { return; } const { code } = await sheep_api_member_address.AddressApi.deleteAddress(state.model.id); if (code === 0) { sheep_index.sheep.$router.back(); } } }); }; common_vendor.onLoad(async (options) => { }); return (_ctx, _cache) => { return common_vendor.e({ a: state.model.invoiceType == 1, b: state.model.invoiceType == 2, c: common_vendor.o(invoiceType), d: common_vendor.p({ name: "invoiceType", label: "发票类型" }), e: state.model.invoiceType == 1 }, state.model.invoiceType == 1 ? { f: state.model.invoiceTitleType == 1, g: state.model.invoiceTitleType == 2, h: common_vendor.o(invoiceTitleType), i: common_vendor.p({ name: "invoiceTitleType", label: "抬头类型" }) } : {}, { j: common_vendor.o(($event) => state.model.invoiceTitle = $event), k: common_vendor.p({ placeholder: "请输入发票抬头", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), l: common_vendor.p({ name: "invoiceTitle", label: "发票抬头" }), m: state.model.invoiceTitleType == 2 }, state.model.invoiceTitleType == 2 ? { n: common_vendor.o(($event) => state.model.taxIDNumber = $event), o: common_vendor.p({ type: "number", placeholder: "请输入单位税号", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.taxIDNumber }), p: common_vendor.p({ name: "taxIDNumber", label: "单位税号" }), q: common_vendor.o(($event) => state.model.invoiceTitle = $event), r: common_vendor.p({ type: "number", placeholder: "选填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), s: common_vendor.p({ name: "invoiceTitle", label: "注册地址" }), t: common_vendor.o(($event) => state.model.invoiceTitle = $event), v: common_vendor.p({ type: "number", placeholder: "选填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), w: common_vendor.p({ name: "invoiceTitle", label: "注册电话" }), x: common_vendor.o(($event) => state.model.invoiceTitle = $event), y: common_vendor.p({ type: "number", placeholder: "选填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), z: common_vendor.p({ name: "invoiceTitle", label: "开户银行" }), A: common_vendor.o(($event) => state.model.invoiceTitle = $event), B: common_vendor.p({ type: "number", placeholder: "选填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), C: common_vendor.p({ name: "invoiceTitle", label: "银行账号" }) } : {}, { D: state.model.invoiceType == 2 }, state.model.invoiceType == 2 ? { E: common_vendor.o(($event) => state.model.taxIDNumber = $event), F: common_vendor.p({ type: "number", placeholder: "请输入单位税号", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.taxIDNumber }), G: common_vendor.p({ name: "taxIDNumber", label: "单位税号" }), H: common_vendor.o(($event) => state.model.invoiceTitle = $event), I: common_vendor.p({ type: "number", placeholder: "必填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), J: common_vendor.p({ name: "invoiceTitle", label: "注册地址" }), K: common_vendor.o(($event) => state.model.invoiceTitle = $event), L: common_vendor.p({ type: "number", placeholder: "必填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), M: common_vendor.p({ name: "invoiceTitle", label: "注册电话" }), N: common_vendor.o(($event) => state.model.invoiceTitle = $event), O: common_vendor.p({ type: "number", placeholder: "必填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), P: common_vendor.p({ name: "invoiceTitle", label: "开户银行" }), Q: common_vendor.o(($event) => state.model.invoiceTitle = $event), R: common_vendor.p({ type: "number", placeholder: "必填", inputBorder: false, placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal", modelValue: state.model.invoiceTitle }), S: common_vendor.p({ name: "invoiceTitle", label: "银行账号" }) } : {}, { T: state.model.invoiceType == 2 }, state.model.invoiceType == 2 ? { U: state.protocol, V: common_vendor.o(onChange), W: common_vendor.o(($event) => onProtocol("专用发票抬头确认书")), X: common_vendor.o(onChange), Y: currentProtocol.value ? 1 : "" } : {}, { Z: common_vendor.sr(invoiceFormRef, "1891008f-1,1891008f-0", { "k": "invoiceFormRef" }), aa: common_vendor.o(($event) => state.model = $event), ab: common_vendor.p({ rules, validateTrigger: "bind", labelWidth: "160", labelAlign: "left", border: true, labelStyle: { fontWeight: "bold" }, modelValue: state.model }), ac: common_vendor.o(onSave), ad: state.model.id }, state.model.id ? { ae: common_vendor.o(onDelete) } : {}, { af: common_vendor.p({ bottom: true, opacity: false, bg: "", placeholder: true, noFixed: false, index: 10 }), ag: common_vendor.p({ title: state.model.id ? "编辑发票抬头" : "新增发票抬头" }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1891008f"], ["__file", "D:/zx/mall-front-app/pages/user/invoice/edit.vue"]]); wx.createPage(MiniProgramPage);