canInvoiceBills.js
5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const common_hotel = require("../../common/hotel.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = {
__name: "canInvoiceBills",
setup(__props) {
const billsList = common_vendor.ref([]);
const chosenList = common_vendor.ref([]);
common_vendor.ref(null);
let totalMoney = 0;
const isLoadMore = common_vendor.ref(false);
common_vendor.ref("loading");
common_vendor.ref({
contentdown: "点击查看更多",
contentrefresh: "正在加载...",
contentnomore: "没有更多数据了"
});
const app = getApp();
const currUser = common_vendor.index.getStorageSync("currUser");
common_vendor.onShow(() => {
billsList.value = [];
getBills();
});
let activeId;
let remarks;
let kpType;
common_vendor.onLoad((options) => {
activeId = options.activeId;
if (options.remarks) {
remarks = JSON.parse(decodeURIComponent(options.remarks));
}
kpType = options.kpType;
});
function chooseThis(s) {
s.selected = !s.selected;
}
function checkChoose() {
let arr = [];
for (const c of billsList.value) {
if (c.selected) {
arr.push(c.id);
totalMoney = totalMoney + c.total;
}
chosenList.value = arr;
}
}
function goNext() {
checkChoose();
if (chosenList.value.length == 0) {
common_vendor.index.showToast({
icon: "none",
title: "请至少选择一个订单",
duration: 2e3
});
return;
}
let orders = chosenList.value.toString();
const obj = encodeURIComponent(JSON.stringify(remarks));
let path = `/pages_hotel/hotel/addInvoice?orders=${orders}&totalMoney=${totalMoney.toFixed(2)}&activeId=${activeId}&remarks=${obj}&kpType=${kpType}`;
common_vendor.index.redirectTo({
url: path
});
}
function getBills() {
common_vendor.index.showLoading({
title: "加载中"
});
console.log("currUser", currUser);
isLoadMore.value = false;
const venueId = app.globalData.venue.id;
var obj = {
activeId,
userId: currUser.userId,
venueId
};
common_hotel.getCanInvoiceBills(obj).then((res) => {
billsList.value = res.rows;
for (var b of billsList.value) {
b.messageObj = JSON.parse(b.message);
}
common_vendor.index.hideLoading();
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(billsList.value, (b, k0, i0) => {
return common_vendor.e({
a: b.orderType == 0
}, b.orderType == 0 ? {} : {}, {
b: b.orderType == 1
}, b.orderType == 1 ? {} : {}, {
c: b.orderType == 2
}, b.orderType == 2 ? {} : {}, {
d: common_vendor.t(b.id),
e: common_vendor.t(b.name),
f: b.orderType == 2
}, b.orderType == 2 ? {
g: common_vendor.f(b.messageObj.foodsList, (n, index, i1) => {
return common_vendor.e({
a: n.num > 0
}, n.num > 0 ? {
b: common_vendor.t(n.name),
c: common_vendor.t(n.categoryName),
d: common_vendor.t(n.num)
} : {}, {
e: index
});
})
} : {}, {
h: b.orderType == 1
}, b.orderType == 1 ? {
i: common_vendor.f(b.messageObj.carsList, (car, index, i1) => {
return common_vendor.e({
a: car.num > 0
}, car.num > 0 ? {
b: common_vendor.t(car.name),
c: common_vendor.t(car.num)
} : {}, {
d: index
});
})
} : {}, {
j: b.orderType == 0
}, b.orderType == 0 ? {
k: common_vendor.t(b.messageObj.roomName),
l: common_vendor.t(b.messageObj.roomInfo),
m: common_vendor.t(b.messageObj.roomType),
n: common_vendor.t(b.messageObj.roomStayDate)
} : {}, {
o: common_vendor.t(b.total),
p: b.selected
}, b.selected ? {
q: "dcd97c95-0-" + i0,
r: common_vendor.p({
color: "#1EC886",
type: "checkbox-filled",
size: "30"
})
} : {
s: "dcd97c95-1-" + i0,
t: common_vendor.p({
type: "circle",
color: "#E5E5E5",
size: "30"
})
}, {
v: common_vendor.o(($event) => chooseThis(b), b.id),
w: b.id
});
}),
b: billsList.value.length == 0
}, billsList.value.length == 0 ? {
c: common_assets._imports_0$4
} : {}, {
d: billsList.value.length != 0
}, billsList.value.length != 0 ? {
e: common_vendor.o(goNext)
} : {});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-dcd97c95"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_hotel/hotel/canInvoiceBills.vue"]]);
wx.createPage(MiniProgramPage);