123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- const EvanSwitch = () => "../components/evan-switch/evan-switch.js";
- const popupBottom = () => "../components/px-popup-bottom/px-popup-bottom.js";
- const _sfc_main = {
- components: {
- EvanSwitch,
- popupBottom
- },
- data() {
- return {
- liveId: null,
- temps: [],
- totalMoney: 0,
- couponUserId: null,
- couponText: "\u8BF7\u9009\u62E9",
- couponsList: [],
- couponVisible: false,
- companyUserId: null,
- packageId: null,
- address: null,
- package: {},
- form: {
- orderKey: null,
- addressId: null,
- mark: null
- }
- };
- },
- onLoad(option) {
- },
- onShow() {
- },
- methods: {
- getWeixinTemps: function() {
- getWeixinTemps().then((res) => {
- if (res.code == 200) {
- this.temps = res.temp;
- }
- }, (rej) => {
- });
- },
- couponSelect(item) {
- this.couponText = "-\xA5" + item.couponPrice.toFixed(2);
- this.couponUserId = item.id;
- this.couponVisible = false;
- this.computedPackageOrder();
- },
- openCoupon() {
- let that = this;
- var data = { packageCateId: this.package.cateId, couponType: 1, useMinPrice: this.totalMoney };
- getMyEnableCouponList(data).then((res) => {
- this.couponVisible = true;
- that.couponsList = res.data;
- });
- },
- confirmPackageOrder() {
- let data = { packageId: this.packageId, couponUserId: this.couponUserId };
- confirmPackageOrder(data).then((res) => {
- if (res.code == 200) {
- this.form.orderKey = res.orderKey;
- this.address = res.address;
- this.package = res.package;
- if (res.address != null) {
- this.form.addressId = res.address.id;
- }
- this.totalMoney = res.totalMoney;
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- }, (rej) => {
- });
- },
- computedPackageOrder() {
- let data = { packageId: this.packageId, couponUserId: this.couponUserId };
- computedPackageOrder(data).then((res) => {
- if (res.code == 200) {
- this.totalMoney = res.totalMoney;
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- }, (rej) => {
- });
- },
- submitOrder() {
- var that = this;
- if (this.form.orderKey == null) {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BA2\u5355KEY\u4E0D\u5B58\u5728"
- });
- return;
- }
- if (this.form.addressId == null) {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u6536\u8D27\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A"
- });
- return;
- }
- common_vendor.index.requestSubscribeMessage({
- tmplIds: this.temps,
- success(res) {
- that.createPackageOrder();
- },
- fail(res) {
- that.createPackageOrder();
- }
- });
- },
- createPackageOrder() {
- common_vendor.index.showLoading({
- title: "\u6B63\u5728\u5904\u7406\u4E2D..."
- });
- let data = { couponUserId: this.couponUserId, mark: this.form.mark, orderKey: this.form.orderKey, addressId: this.form.addressId, packageId: this.packageId, companyUserId: this.companyUserId };
- createPackageOrder(data).then((res) => {
- common_vendor.index.hideLoading();
- if (res.code == 200) {
- if (res.order.isPrescribe == 1) {
- setTimeout(function() {
- common_vendor.index.redirectTo({
- url: "prescribe?orderId=" + res.order.id
- });
- }, 200);
- } else {
- setTimeout(function() {
- common_vendor.index.redirectTo({
- url: "./paymentOrder?orderId=" + res.order.id
- });
- }, 200);
- }
- return;
- } else {
- if (res.code == 501) {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- setTimeout(function() {
- common_vendor.index.navigateBack({
- delta: 1
- });
- }, 200);
- return;
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- }
- }, (rej) => {
- });
- },
- openAddress() {
- common_vendor.index.navigateTo({
- url: "/pages_user/user/address"
- });
- }
- }
- };
- if (!Array) {
- const _component_popupBottom = common_vendor.resolveComponent("popupBottom");
- _component_popupBottom();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.address == null
- }, $data.address == null ? {
- b: common_vendor.o(($event) => $options.openAddress())
- } : {}, {
- c: $data.address != null
- }, $data.address != null ? common_vendor.e({
- d: common_vendor.t($data.address.realName),
- e: $data.address.phone != null
- }, $data.address.phone != null ? {
- f: common_vendor.t(_ctx.utils.parsePhone($data.address.phone))
- } : {}, {
- g: common_vendor.t($data.address.province),
- h: common_vendor.t($data.address.city),
- i: common_vendor.t($data.address.district),
- j: common_vendor.t($data.address.detail),
- k: common_vendor.o(($event) => $options.openAddress())
- }) : {}, {
- l: $data.package.imgUrl,
- m: common_vendor.t($data.package.title),
- n: common_vendor.t($data.package.descs),
- o: $data.package.payMoney != null
- }, $data.package.payMoney != null ? {
- p: common_vendor.t($data.package.payMoney.toFixed(2))
- } : {}, {
- q: $data.package.payMoney != null
- }, $data.package.payMoney != null ? {
- r: common_vendor.t($data.package.payMoney.toFixed(2))
- } : {}, {
- s: common_vendor.t($data.couponText),
- t: common_vendor.o(($event) => $options.openCoupon()),
- v: $data.form.mark,
- w: common_vendor.o(($event) => $data.form.mark = $event.detail.value),
- x: $data.totalMoney != null
- }, $data.totalMoney != null ? {
- y: common_vendor.t($data.totalMoney.toFixed(2))
- } : {}, {
- z: common_vendor.o((...args) => $options.submitOrder && $options.submitOrder(...args)),
- A: $data.couponsList.length > 0
- }, $data.couponsList.length > 0 ? {
- B: common_vendor.f($data.couponsList, (item, index, i0) => {
- return common_vendor.e({
- a: item.status == 0
- }, item.status == 0 ? {} : {}, {
- b: item.status != 0
- }, item.status != 0 ? {} : {}, {
- c: common_vendor.t(item.couponPrice),
- d: common_vendor.t(item.useMinPrice),
- e: common_vendor.t(item.couponTitle),
- f: common_vendor.t(item.limitTime),
- g: common_vendor.o(($event) => $options.couponSelect(item)),
- h: index
- });
- })
- } : {}, {
- C: $data.couponsList.length == 0
- }, $data.couponsList.length == 0 ? {} : {}, {
- D: common_vendor.sr("popup", "6a46ad18-0"),
- E: common_vendor.p({
- visible: $data.couponVisible,
- title: " ",
- bgColor: "#f5f5f5",
- radius: "30",
- maxHeight: "60%"
- })
- });
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6a46ad18"], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages_shop/confirmPackageOrder.vue"]]);
- wx.createPage(MiniProgramPage);
|