edit.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. require("../../../sheep/request/index.js");
  5. const sheep_api_member_address = require("../../../sheep/api/member/address.js");
  6. require("../../../sheep/helper/index.js");
  7. require("../../../sheep/api/index.js");
  8. require("../../../sheep/api/distri/score.js");
  9. require("../../../sheep/api/distri/share.js");
  10. require("../../../sheep/api/distri/team.js");
  11. require("../../../sheep/api/infra/file.js");
  12. require("../../../sheep/config/index.js");
  13. require("../../../sheep/api/member/auth.js");
  14. require("../../../sheep/api/member/point.js");
  15. require("../../../sheep/api/member/signin.js");
  16. require("../../../sheep/api/member/social.js");
  17. require("../../../sheep/api/member/user.js");
  18. require("../../../sheep/api/migration/app.js");
  19. require("../../../sheep/api/migration/chat.js");
  20. require("../../../sheep/api/migration/index.js");
  21. require("../../../sheep/api/migration/third.js");
  22. require("../../../sheep/api/pay/channel.js");
  23. require("../../../sheep/api/pay/order.js");
  24. require("../../../sheep/api/pay/wallet.js");
  25. require("../../../sheep/api/product/category.js");
  26. require("../../../sheep/api/product/comment.js");
  27. require("../../../sheep/api/product/favorite.js");
  28. require("../../../sheep/api/product/history.js");
  29. require("../../../sheep/api/product/spu.js");
  30. require("../../../sheep/api/promotion/activity.js");
  31. require("../../../sheep/api/promotion/article.js");
  32. require("../../../sheep/api/promotion/bargain.js");
  33. require("../../../sheep/api/promotion/combination.js");
  34. require("../../../sheep/api/promotion/coupon.js");
  35. require("../../../sheep/api/promotion/diy.js");
  36. require("../../../sheep/api/promotion/rewardActivity.js");
  37. require("../../../sheep/api/promotion/seckill.js");
  38. require("../../../sheep/api/system/area.js");
  39. require("../../../sheep/api/system/voice.js");
  40. require("../../../sheep/api/trade/afterSale.js");
  41. require("../../../sheep/api/trade/brokerage.js");
  42. require("../../../sheep/api/trade/cart.js");
  43. require("../../../sheep/api/trade/config.js");
  44. require("../../../sheep/api/trade/delivery.js");
  45. require("../../../sheep/api/trade/order.js");
  46. require("../../../sheep/url/index.js");
  47. require("../../../sheep/store/index.js");
  48. require("../../../sheep/store/app.js");
  49. require("../../../sheep/platform/index.js");
  50. require("../../../sheep/platform/provider/wechat/index.js");
  51. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  52. require("../../../sheep/platform/provider/apple/index.js");
  53. require("../../../sheep/platform/share.js");
  54. require("../../../sheep/router/index.js");
  55. require("../../../sheep/hooks/useModal.js");
  56. require("../../../sheep/helper/test.js");
  57. require("../../../sheep/helper/throttle.js");
  58. require("../../../sheep/platform/pay.js");
  59. require("../../../sheep/store/user.js");
  60. require("../../../sheep/store/cart.js");
  61. require("../../../sheep/store/sys.js");
  62. require("../../../sheep/store/modal.js");
  63. require("../../../sheep/config/zIndex.js");
  64. require("../../../sheep/helper/digit.js");
  65. if (!Array) {
  66. const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
  67. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  68. const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
  69. const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  70. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  71. (_easycom_uni_forms_item2 + _easycom_uni_easyinput2 + _easycom_uni_forms2 + _easycom_su_fixed2 + _easycom_s_layout2)();
  72. }
  73. const _easycom_uni_forms_item = () => "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js";
  74. const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  75. const _easycom_uni_forms = () => "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.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_uni_forms_item + _easycom_uni_easyinput + _easycom_uni_forms + _easycom_su_fixed + _easycom_s_layout)();
  80. }
  81. const _sfc_main = {
  82. __name: "edit",
  83. setup(__props) {
  84. const invoiceFormRef = common_vendor.ref(null);
  85. const currentProtocol = common_vendor.ref(false);
  86. const state = common_vendor.reactive({
  87. showRegion: false,
  88. model: {
  89. invoiceType: 1,
  90. invoiceTitleType: 1,
  91. invoiceTitle: "",
  92. taxIDNumber: ""
  93. },
  94. rules: {},
  95. protocol: false
  96. });
  97. function onChange() {
  98. state.protocol = !state.protocol;
  99. }
  100. function onProtocol(title) {
  101. sheep_index.sheep.$router.go("/pages/public/richtext", {
  102. title
  103. });
  104. }
  105. const rules = {
  106. invoiceType: {
  107. rules: [{
  108. required: true,
  109. errorMessage: "请选择发票类型"
  110. }]
  111. },
  112. invoiceTitleType: {
  113. rules: [{
  114. required: true,
  115. errorMessage: "请选择抬头类型"
  116. }]
  117. },
  118. invoiceTitle: {
  119. rules: [{
  120. required: true,
  121. errorMessage: "请输入发票抬头"
  122. }]
  123. },
  124. taxIDNumber: {
  125. rules: [{
  126. required: true,
  127. errorMessage: "请输入单位税号"
  128. }]
  129. }
  130. };
  131. const invoiceType = (e) => {
  132. state.model.invoiceType = e.detail.value;
  133. state.model.invoiceTitleType = 1;
  134. };
  135. const invoiceTitleType = (e) => {
  136. state.model.invoiceTitleType = e.detail.value;
  137. };
  138. const onSave = async () => {
  139. const validate = await common_vendor.unref(invoiceFormRef).validate().catch((error) => {
  140. console.log("error: ", error);
  141. });
  142. if (!validate) {
  143. return;
  144. }
  145. if (!state.protocol) {
  146. currentProtocol.value = true;
  147. setTimeout(function() {
  148. currentProtocol.value = false;
  149. }, 500);
  150. return;
  151. }
  152. const formData = {
  153. ...state.model
  154. };
  155. const {
  156. code
  157. } = state.model.id > 0 ? await sheep_api_member_address.AddressApi.updateAddress(formData) : await sheep_api_member_address.AddressApi.createAddress(formData);
  158. if (code === 0) {
  159. sheep_index.sheep.$router.back();
  160. }
  161. };
  162. const onDelete = () => {
  163. common_vendor.index.showModal({
  164. title: "提示",
  165. content: "确认删除此收货地址吗?",
  166. success: async function(res) {
  167. if (!res.confirm) {
  168. return;
  169. }
  170. const {
  171. code
  172. } = await sheep_api_member_address.AddressApi.deleteAddress(state.model.id);
  173. if (code === 0) {
  174. sheep_index.sheep.$router.back();
  175. }
  176. }
  177. });
  178. };
  179. common_vendor.onLoad(async (options) => {
  180. });
  181. return (_ctx, _cache) => {
  182. return common_vendor.e({
  183. a: state.model.invoiceType == 1,
  184. b: state.model.invoiceType == 2,
  185. c: common_vendor.o(invoiceType),
  186. d: common_vendor.p({
  187. name: "invoiceType",
  188. label: "发票类型"
  189. }),
  190. e: state.model.invoiceType == 1
  191. }, state.model.invoiceType == 1 ? {
  192. f: state.model.invoiceTitleType == 1,
  193. g: state.model.invoiceTitleType == 2,
  194. h: common_vendor.o(invoiceTitleType),
  195. i: common_vendor.p({
  196. name: "invoiceTitleType",
  197. label: "抬头类型"
  198. })
  199. } : {}, {
  200. j: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  201. k: common_vendor.p({
  202. placeholder: "请输入发票抬头",
  203. inputBorder: false,
  204. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  205. modelValue: state.model.invoiceTitle
  206. }),
  207. l: common_vendor.p({
  208. name: "invoiceTitle",
  209. label: "发票抬头"
  210. }),
  211. m: state.model.invoiceTitleType == 2
  212. }, state.model.invoiceTitleType == 2 ? {
  213. n: common_vendor.o(($event) => state.model.taxIDNumber = $event),
  214. o: common_vendor.p({
  215. type: "number",
  216. placeholder: "请输入单位税号",
  217. inputBorder: false,
  218. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  219. modelValue: state.model.taxIDNumber
  220. }),
  221. p: common_vendor.p({
  222. name: "taxIDNumber",
  223. label: "单位税号"
  224. }),
  225. q: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  226. r: common_vendor.p({
  227. type: "number",
  228. placeholder: "选填",
  229. inputBorder: false,
  230. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  231. modelValue: state.model.invoiceTitle
  232. }),
  233. s: common_vendor.p({
  234. name: "invoiceTitle",
  235. label: "注册地址"
  236. }),
  237. t: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  238. v: common_vendor.p({
  239. type: "number",
  240. placeholder: "选填",
  241. inputBorder: false,
  242. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  243. modelValue: state.model.invoiceTitle
  244. }),
  245. w: common_vendor.p({
  246. name: "invoiceTitle",
  247. label: "注册电话"
  248. }),
  249. x: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  250. y: common_vendor.p({
  251. type: "number",
  252. placeholder: "选填",
  253. inputBorder: false,
  254. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  255. modelValue: state.model.invoiceTitle
  256. }),
  257. z: common_vendor.p({
  258. name: "invoiceTitle",
  259. label: "开户银行"
  260. }),
  261. A: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  262. B: common_vendor.p({
  263. type: "number",
  264. placeholder: "选填",
  265. inputBorder: false,
  266. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  267. modelValue: state.model.invoiceTitle
  268. }),
  269. C: common_vendor.p({
  270. name: "invoiceTitle",
  271. label: "银行账号"
  272. })
  273. } : {}, {
  274. D: state.model.invoiceType == 2
  275. }, state.model.invoiceType == 2 ? {
  276. E: common_vendor.o(($event) => state.model.taxIDNumber = $event),
  277. F: common_vendor.p({
  278. type: "number",
  279. placeholder: "请输入单位税号",
  280. inputBorder: false,
  281. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  282. modelValue: state.model.taxIDNumber
  283. }),
  284. G: common_vendor.p({
  285. name: "taxIDNumber",
  286. label: "单位税号"
  287. }),
  288. H: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  289. I: common_vendor.p({
  290. type: "number",
  291. placeholder: "必填",
  292. inputBorder: false,
  293. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  294. modelValue: state.model.invoiceTitle
  295. }),
  296. J: common_vendor.p({
  297. name: "invoiceTitle",
  298. label: "注册地址"
  299. }),
  300. K: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  301. L: common_vendor.p({
  302. type: "number",
  303. placeholder: "必填",
  304. inputBorder: false,
  305. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  306. modelValue: state.model.invoiceTitle
  307. }),
  308. M: common_vendor.p({
  309. name: "invoiceTitle",
  310. label: "注册电话"
  311. }),
  312. N: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  313. O: common_vendor.p({
  314. type: "number",
  315. placeholder: "必填",
  316. inputBorder: false,
  317. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  318. modelValue: state.model.invoiceTitle
  319. }),
  320. P: common_vendor.p({
  321. name: "invoiceTitle",
  322. label: "开户银行"
  323. }),
  324. Q: common_vendor.o(($event) => state.model.invoiceTitle = $event),
  325. R: common_vendor.p({
  326. type: "number",
  327. placeholder: "必填",
  328. inputBorder: false,
  329. placeholderStyle: "color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal",
  330. modelValue: state.model.invoiceTitle
  331. }),
  332. S: common_vendor.p({
  333. name: "invoiceTitle",
  334. label: "银行账号"
  335. })
  336. } : {}, {
  337. T: state.model.invoiceType == 2
  338. }, state.model.invoiceType == 2 ? {
  339. U: state.protocol,
  340. V: common_vendor.o(onChange),
  341. W: common_vendor.o(($event) => onProtocol("专用发票抬头确认书")),
  342. X: common_vendor.o(onChange),
  343. Y: currentProtocol.value ? 1 : ""
  344. } : {}, {
  345. Z: common_vendor.sr(invoiceFormRef, "1891008f-1,1891008f-0", {
  346. "k": "invoiceFormRef"
  347. }),
  348. aa: common_vendor.o(($event) => state.model = $event),
  349. ab: common_vendor.p({
  350. rules,
  351. validateTrigger: "bind",
  352. labelWidth: "160",
  353. labelAlign: "left",
  354. border: true,
  355. labelStyle: {
  356. fontWeight: "bold"
  357. },
  358. modelValue: state.model
  359. }),
  360. ac: common_vendor.o(onSave),
  361. ad: state.model.id
  362. }, state.model.id ? {
  363. ae: common_vendor.o(onDelete)
  364. } : {}, {
  365. af: common_vendor.p({
  366. bottom: true,
  367. opacity: false,
  368. bg: "",
  369. placeholder: true,
  370. noFixed: false,
  371. index: 10
  372. }),
  373. ag: common_vendor.p({
  374. title: state.model.id ? "编辑发票抬头" : "新增发票抬头"
  375. })
  376. });
  377. };
  378. }
  379. };
  380. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1891008f"], ["__file", "D:/zx/mall-front-app/pages/user/invoice/edit.vue"]]);
  381. wx.createPage(MiniProgramPage);