const _my = require("../../__antmove/api/index.js")(my); const wx = _my; // components/input/index.js Component({ /** * 组件的属性列表 */ properties: { value: "", type: { type: String, value: "" }, // 数组 itemData: { type: Object, value: function () { return {}; } }, isDisable: { type: Boolean, value: true }, // 空调 aircondition: { type: Boolean, value: false }, // 投影 projection: { type: Boolean, value: false }, // 左侧数组 leftList: { type: Array, value: function () { return []; } }, // 右侧数组 rightList: { type: Array, value: function () { return []; } } }, /** * 组件的初始数据 */ data: {}, lifetimes: { attached: function () { }, detached: function () {// 在组件实例被从页面节点树移除时执行 } }, /** * 组件的方法列表 */ methods: { getWater(e) { console.log(e); if (!this.data.isDisable) { this.triggerEvent("teaWater", e); } }, cleaeTea(e) { console.log(e); this.triggerEvent('cleaeTea', e) }, getSnack(e) { if (!this.data.isDisable) { this.triggerEvent("snack", e); } }, getMonogram(e) { let dataset = e.currentTarget.dataset; let { leftList, rightList } = this.data // console.log(e, 1); if (!this.data.isDisable) { var that = this; my.prompt({ title: "桌签内容", inputValue: dataset.type === 'left' ? leftList[dataset.index].monogram : rightList[dataset.index].monogram, placeholder: '请输入桌签内容', // showCancel: true, // editable: true, message: " ", okButtonText: '确定', cancelButtonText: '取消', success: function (res) { console.log(res, 2); dataset.val = res.inputValue; // console.log(dataset, 4); // console.log(dataset.val, 3); if (res.ok) { that.triggerEvent("monogram", dataset); } else if (res.cancel) { } } }); } }, largeScreenFun(e) { // console.log(e); if (!this.data.isDisable) { let index = e.currentTarget.dataset.index; switch (e.currentTarget.dataset.type) { case "1": this.triggerEvent("change", "projection"); break; case "2": this.triggerEvent("change", "aircondition"); break; case "3": this.setData({ [`list[${index}].isTable`]: !this.data.list[index].isTable }); break; case "4": this.setData({ [`list[${index}].isWater`]: !this.data.list[index].isWater }); break; case "5": this.setData({ [`list[${index}].isDessert`]: !this.data.list[index].isDessert }); break; case "6": this.setData({ [`list1[${index}].isTable`]: !this.data.list1[index].isTable }); break; case "7": this.setData({ [`list1[${index}].isWater`]: !this.data.list1[index].isWater }); break; case "8": this.setData({ [`list1[${index}].isDessert`]: !this.data.list1[index].isDessert }); break; default: break; } } }, antmoveAction: function () { //执行时动态赋值,请勿删除 } } });