123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_order = require("../api/order.js");
- require("../common/request.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 {
- address: null,
- addressId: null,
- totalNum: null,
- orderKey: null,
- price: null,
- liveId: null,
- orderList: [],
- userInfo: null,
- userAddrLiat: [],
- temps: [],
- couponUserId: null,
- couponText: "\u8BF7\u9009\u62E9",
- couponsList: [],
- couponVisible: false,
- priceAll: {
- payPrice: 0,
- totalPostage: 0,
- usedIntegral: 0,
- totalPrice: 0
- },
- address: null,
- carts: [],
- checked: false,
- type: null,
- cartIds: null,
- confirmParam: []
- };
- },
- computed: {
- priceSum() {
- return this.price * this.totalNum;
- }
- },
- onLoad(options) {
- console.log("\u786E\u8BA4\u8BA2\u5355", options);
- this.orderKey = options.orderKey;
- this.liveId = options.liveId;
- this.productId = options.productId;
- this.totalNum = Number(options.totalNum);
- this.price = Number(options.price);
- },
- mounted() {
- common_vendor.index.$on("updateAddress", (e) => {
- this.address = e;
- this.addressId = e.addressId;
- });
- },
- beforeDestroy() {
- common_vendor.index.$off("updateAddress");
- },
- methods: {
- createLiveOrder() {
- let data = {
- liveId: this.liveId,
- orderKey: this.orderKey,
- userName: "\u6CA1\u540D\u5B57",
- userPhone: "1234568",
- userAddress: "\u968F\u4FBF\u4F4F",
- productId: this.productId,
- totalNum: this.totalNum
- };
- return api_order.createliveOrder(data).then((res) => {
- if (res.code == 200) {
- this.orderList = res.order;
- return res.order;
- } else {
- common_vendor.index.showToast({
- title: res.msg,
- icon: "none"
- });
- throw new Error(res.msg);
- }
- });
- },
- getWeixinOrderTemps: function() {
- getWeixinOrderTemps().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.computed();
- },
- openCoupon() {
- let that = this;
- var data = {
- couponType: 2,
- useMinPrice: this.price.payPrice
- };
- getMyEnableCouponList(data).then((res) => {
- this.couponVisible = true;
- that.couponsList = res.data;
- });
- },
- integralChange(e) {
- this.form.useIntegral = e ? 1 : 0;
- this.computed();
- },
- async submitOrder() {
- try {
- if (this.orderKey == null) {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BA2\u5355KEY\u4E0D\u5B58\u5728"
- });
- return;
- }
- if (this.address == null) {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u6536\u8D27\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A"
- });
- return;
- }
- const orderList = await this.createLiveOrder();
- const orderListStr = encodeURIComponent(JSON.stringify(orderList));
- common_vendor.index.navigateTo({
- url: `/pages_shop/paymentOrder?orderList=${orderListStr}`
- });
- } catch (error) {
- console.error("\u8BA2\u5355\u521B\u5EFA\u5931\u8D25:", error);
- common_vendor.index.showToast({
- title: "\u63D0\u4EA4\u5931\u8D25",
- icon: "none"
- });
- }
- },
- openAddress() {
- common_vendor.index.navigateTo({
- url: "/pages_user/address"
- });
- }
- }
- };
- if (!Array) {
- const _component_popupBottom = common_vendor.resolveComponent("popupBottom");
- _component_popupBottom();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- var _a, _b, _c;
- 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.$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: common_vendor.f($data.carts, (shop, idx, i0) => {
- return common_vendor.e({
- a: shop.storeName && shop.storeName != "null"
- }, shop.storeName && shop.storeName != "null" ? {
- b: common_vendor.t(shop.storeName)
- } : {}, {
- c: common_vendor.f(shop.list, (item, index, i1) => {
- var _a2;
- return {
- a: item.productAttrImage ? item.productAttrImage : item.productImage,
- b: common_vendor.t(_ctx.utils.getDictLabelName("storeProductType", item.productType)),
- c: common_vendor.t(item.productName),
- d: common_vendor.t(item.productAttrName),
- e: common_vendor.t((_a2 = item.price) == null ? void 0 : _a2.toFixed(2)),
- f: common_vendor.t(item.cartNum),
- g: index
- };
- })
- }, $data.price && $data.price.length > 0 ? {
- d: common_vendor.t($data.price[idx].payPostage == null || $data.price[idx].payPostage == 0 ? "\u514D\u8FD0\u8D39" : $data.price[idx].payPostage.toFixed(2))
- } : {}, {
- e: shop.markinfo,
- f: common_vendor.o(($event) => shop.markinfo = $event.detail.value),
- g: idx
- });
- }),
- m: $data.price && $data.price.length > 0,
- n: common_vendor.t((_a = $data.price) == null ? void 0 : _a.toFixed(2)),
- o: common_vendor.t((_b = $options.priceSum) == null ? void 0 : _b.toFixed(2)),
- p: common_vendor.t((_c = $options.priceSum) == null ? void 0 : _c.toFixed(2)),
- q: common_vendor.o((...args) => $options.submitOrder && $options.submitOrder(...args)),
- r: $data.couponsList.length > 0
- }, $data.couponsList.length > 0 ? {
- s: 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
- });
- })
- } : {}, {
- t: $data.couponsList.length == 0
- }, $data.couponsList.length == 0 ? {} : {}, {
- v: common_vendor.sr("popup", "bb501b1c-0"),
- w: 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-bb501b1c"], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages_shop/confirmCreateOrder.vue"]]);
- wx.createPage(MiniProgramPage);
|