"use strict"; const common_vendor = require("../../common/vendor.js"); const api_shop_goods_index = require("../../api/shop/goods/index.js"); const api_layout_index = require("../../api/layout/index.js"); const api_shop_merchant_index = require("../../api/shop/merchant/index.js"); require("../../utils/request.js"); const api_booking_field_index = require("../../api/booking/field/index.js"); const api_booking_period_index = require("../../api/booking/period/index.js"); const store_modules_tenant = require("../../store/modules/tenant.js"); const tenantStore = store_modules_tenant.useTenantStore(); const lineBg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAOCAYAAABdC15GAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFxSURBVHgBzZNRTsJAEIb/WTW+lpiY+FZPIDew3ABP4GJ8hxsI9zBpOYHeQDwBPQI+mRiRvpLojtPdYhCorQqF/6GdbGd2vvwzBXZcNAt4oj1ANeUoAT5iqkUjbEFLHNmhD1YPEvpZ3ghkGlVDCkc94/BmHMq998I5ONiY1ZBfpKAyuOtgAc5yOEDmYEWNh32BHF91sGHZHmwW4azciN9aQwnz3SJEgOmte+R2tdLprTYoa50mvuomlLpD4Y3oQZnov6D2RzCqI93bWOHaEmAGqQUyRBlZR1WfarcD/EJ2z8DtzDGvsMCwpm8XOCfDUsVOCYhiqRxI/CTQo4UOvjzO7Pow18vfywneuUHHUUxLn55lLw5JFpZ8bEUcY8oXdOLWiHLTxvoGpLqoUmy6dBT15o/ox3znpoycAmxUsiJTbs1cmxeVKp+0zmFIS7bGWiVghC7Vwse8jFKAX9eljh4ggKLLv7uaQvG9/F59Oo2SouxPu7OTCxN/s8wAAAAASUVORK5CYII="; const _sfc_main = { data() { return { id: 0, list: [{ name: "周三", value: "05月08日" }, { name: "周四", value: "05月09日" }, { name: "周五", value: "05月10日" }, { name: "周六", value: "05月11日" }, { name: "周日", value: "05月12日" }, { name: "周一", value: "05月13日" }, { name: "周二", value: "05月14日" }], week: 0, items: ["全场", "半场"], lineBg, // 时段 periodList: [], // 场地 fieldList: [], order: [], // 订单总金额 total: 0, keys: [], // 场馆列表 merchant: {}, // 网站参数 fields: {}, // 幻灯片广告 ads: [], // 小程序导航图标 navigation: [], // 小程序导航图标(双排) doubleNavigation: [], isLogin: false, disabled: false, styleType: { color: "#ff0000" }, activeColor: { color: "#303133" } }; }, onLoad(option) { this.id = option.id; this.reload(); }, computed: { total() { const app2 = this; app2.total = 0; app2.order.map((d) => { console.log(d.totalPrice); app2.total = app2.total + d.totalPrice; }); return app2.total; } }, methods: { async reload() { const app2 = this; const info = await tenantStore.fetchTenantInfo(); if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) { app2.isLogin = true; } if (info.fields) { info.fields.map((d) => { const key = d.name; app2.fields[key] = d.value; }); } if (info.serverTime) { this.week = info.serverTime.week; } if (info.websiteLogo) { common_vendor.index.setStorageSync("app_logo", info.websiteLogo); app2.logo = info.websiteLogo; } if (info.mpMenus) { console.log("info.mpMenus: ", info.mpMenus); const arr = info.mpMenus.filter((d) => d.type == 2 && d.rows == 0); const arr1 = info.mpMenus.filter((d) => d.type == 2 && d.rows == 1); const arr2 = info.mpMenus.filter((d) => d.type == 2 && d.rows == 2); if (arr) { app2.navigation = arr; } if (arr1) { app2.doubleNavigation.push(arr1); } if (arr2) { app2.doubleNavigation.push(arr2); } } Promise.all([app2.getMerchant(), app2.getBookingField(), app2.getBookingPeriod()]).then((res) => { app2.merchant = res[0]; console.log("Promise.all", app2.merchant); }); }, getSiteInfo() { return new Promise((resolve, reject) => { api_layout_index.getSiteInfo().then((result) => { resolve(result); }).catch(reject); }); }, onDisabled() { this.disabled = !this.disabled; }, navTo(url) { common_vendor.index.navigateTo({ url }); }, listAdList() { }, pageGoods() { return new Promise((resolve, reject) => { api_shop_goods_index.pageGoods({}).then((result) => { resolve(result.list); }).catch(reject); }); }, getMerchantList() { return new Promise((resolve, reject) => { api_shop_merchant_index.listMerchant({}).then((result) => { resolve(result); }).catch(reject); }); }, getMerchant() { api_shop_merchant_index.getMerchant(this.id).then((data) => { app.merchant = data; if (data.files) { app.ads = JSON.parse(data.files); } common_vendor.index.setNavigationBarTitle({ title: data.merchantName }); }); }, getBookingField() { api_booking_field_index.listField({ merchantId: this.id, isStatus: 1 }).then((list) => { this.fieldList = list; }); }, getBookingPeriod() { const { week } = this; const merchantId = this.id; const isStatus = 1; api_booking_period_index.listPeriod({ merchantId, isStatus, week }).then((list) => { this.periodList = list; }); }, change(e) { const { index } = e.detail; const id = this.merchant[index].merchantId; this.openUrl(`/package/booking/booking?id=${id}`); }, callPhone(phone) { common_vendor.index.makePhoneCall({ phoneNumber: phone }); }, onMap() { common_vendor.index.getLocation({ type: "gcj02", //返回可以用于uni.openLocation的经纬度 success: function(res) { console.log("返回可以用于uni.openLocation的经纬度: ", res); const latitude = this.merchant.latitude; const longitude = this.merchant.longitude; common_vendor.index.openLocation({ latitude, longitude, success: function() { console.log("success"); } }); } }); }, openUrl(url) { if (!this.isLogin) { this.$refs.login.open("bottom"); return false; } else { common_vendor.index.navigateTo({ url }); } }, onField(i, i2) { const app2 = this; const p = this.periodList[i]; const f = this.fieldList[i2]; const key = `${p.periodId}_${f.fieldId}`; const index = app2.order.findIndex((d) => d.key == key); console.log("index: ", index); console.log("app.order.length: ", app2.order.length); if (index >= 0) { app2.order.splice(index, 1); } else { if (app2.order.length > 1) { common_vendor.index.showToast({ title: "最多预定两个场地!", icon: "none" }); return false; } app2.order.push({ key, fid: f.fieldId, pid: p.periodId, totalPrice: p.price }); } }, isActive(text) { const index = this.order.find((d) => d.key == text); if (index) { return true; } }, save() { common_vendor.index.navigateTo({ url: "/package/booking/cashier" }); } } }; if (!Array) { const _easycom_uv_tabs2 = common_vendor.resolveComponent("uv-tabs"); const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control"); const _easycom_uv_badge2 = common_vendor.resolveComponent("uv-badge"); const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon"); const _easycom_uv_count_to2 = common_vendor.resolveComponent("uv-count-to"); const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button"); const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login"); (_easycom_uv_tabs2 + _easycom_uni_segmented_control2 + _easycom_uv_badge2 + _easycom_uv_icon2 + _easycom_uv_count_to2 + _easycom_uv_button2 + _easycom_ws_login2)(); } const _easycom_uv_tabs = () => "../../uni_modules/uv-tabs/components/uv-tabs/uv-tabs.js"; const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js"; const _easycom_uv_badge = () => "../../uni_modules/uv-badge/components/uv-badge/uv-badge.js"; const _easycom_uv_icon = () => "../../uni_modules/uv-icon/components/uv-icon/uv-icon.js"; const _easycom_uv_count_to = () => "../../uni_modules/uv-count-to/components/uv-count-to/uv-count-to.js"; const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js"; const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js"; if (!Math) { (_easycom_uv_tabs + _easycom_uni_segmented_control + _easycom_uv_badge + _easycom_uv_icon + _easycom_uv_count_to + _easycom_uv_button + _easycom_ws_login)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: common_vendor.p({ list: $data.list, itemStyle: { height: "58px" }, activeStyle: { color: "#2ba91c" }, lineColor: "#2ba91c", inactiveStyle: { color: "#808080" } }), b: common_vendor.o(_ctx.onClickItem), c: common_vendor.p({ current: _ctx.current, values: $data.items, activeColor: "#2ba91c", inActiveColor: "#ff0000" }), d: common_vendor.p({ isDot: true, type: "blank" }), e: common_vendor.p({ isDot: true, type: "info" }), f: common_vendor.p({ isDot: true, type: "success" }), g: common_vendor.p({ isDot: true, type: "warning" }), h: common_vendor.t($data.order), i: common_vendor.f($data.periodList, (item, index, i0) => { return { a: common_vendor.t(item.timePeriod), b: common_vendor.f($data.fieldList, (item2, index2, i1) => { return { a: common_vendor.t(item2.fieldName), b: common_vendor.n($options.isActive(`${item.periodId}_${item2.fieldId}`) ? "active web-bg-success" : ""), c: common_vendor.o(($event) => $options.onField(index, index2), index2), d: index2 }; }), c: common_vendor.t(item.price), d: index }; }), j: common_vendor.p({ name: "shopping-cart", size: "36", color: "#ffffff" }), k: common_vendor.p({ type: "error", max: "99", value: $data.order.length }), l: common_vendor.p({ startVal: 0, decimals: "2", duration: "100", color: "#ebcf00", bold: true, endVal: $options.total }), m: common_vendor.o($options.save), n: common_vendor.p({ customStyle: { background: "linear-gradient(to right, #70b915, #008e04)", borderRadius: "0 30px 30px 0", color: "#ffffff", order: "none", padding: "22px 30px" }, text: "去支付" }), o: common_vendor.sr("login", "f5dda94d-10"), p: common_vendor.o($options.reload), q: common_vendor.p({ logo: _ctx.logo }) }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f5dda94d"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/booking/cashier.vue"]]); wx.createPage(MiniProgramPage);