120 lines
6.3 KiB
JavaScript
120 lines
6.3 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const BILL_send_bill_model = require("./model.js");
|
|
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
|
|
const gen_Apis = require("../../gen/Apis.js");
|
|
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
|
|
require("../../common/libraries/userUserLogin.js");
|
|
const common_libraries_sendWxWork = require("../../common/libraries/sendWxWork.js");
|
|
const getHouseBill = (id, name) => {
|
|
BILL_send_bill_model.useModel.currentHouses.value = { id, name };
|
|
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Bill.HouseBills.List, { asset_houses_id: id, type: 1 }).then((res) => {
|
|
var _a;
|
|
(_a = res == null ? void 0 : res.data) == null ? void 0 : _a.map((i) => {
|
|
var _a2;
|
|
i.isSelect = true;
|
|
(_a2 = i == null ? void 0 : i.bills) == null ? void 0 : _a2.map((b) => {
|
|
b.isSelect = true;
|
|
});
|
|
});
|
|
BILL_send_bill_model.useModel.listData.value = (res == null ? void 0 : res.data) || [];
|
|
console.log(res);
|
|
});
|
|
};
|
|
const method = {
|
|
handleChange(e) {
|
|
var _a, _b, _c, _d, _e;
|
|
let data = (_d = (_b = (_a = BILL_send_bill_model.useModel) == null ? void 0 : _a.showData) == null ? void 0 : _b.value) == null ? void 0 : _d.houseList[(_c = e == null ? void 0 : e.detail) == null ? void 0 : _c.value];
|
|
getHouseBill(data == null ? void 0 : data.asset_houses_id, (_e = data == null ? void 0 : data.asset_house) == null ? void 0 : _e.full_name);
|
|
console.log(e, "e");
|
|
},
|
|
getList() {
|
|
var _a, _b;
|
|
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Customer.CustomerHouses.List, (_b = (_a = BILL_send_bill_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
|
|
var _a2, _b2, _c, _d, _e, _f;
|
|
if ((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.houseList) == null ? void 0 : _b2.length) {
|
|
let data = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.houseList[0];
|
|
(_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.houseList) == null ? void 0 : _e.map(
|
|
(i) => {
|
|
var _a3;
|
|
i.full_name = (_a3 = i == null ? void 0 : i.asset_house) == null ? void 0 : _a3.full_name;
|
|
}
|
|
);
|
|
getHouseBill(data == null ? void 0 : data.asset_houses_id, (_f = data == null ? void 0 : data.asset_house) == null ? void 0 : _f.full_name);
|
|
}
|
|
BILL_send_bill_model.useModel.showData.value = res == null ? void 0 : res.data;
|
|
console.log(res);
|
|
});
|
|
},
|
|
getHouseBill,
|
|
handleSelect(idx) {
|
|
var _a, _b;
|
|
let is = BILL_send_bill_model.useModel.listData.value[idx].isSelect;
|
|
BILL_send_bill_model.useModel.listData.value[idx].isSelect = !is;
|
|
(_b = (_a = BILL_send_bill_model.useModel.listData.value[idx]) == null ? void 0 : _a.bills) == null ? void 0 : _b.map((b) => {
|
|
b.isSelect = !is;
|
|
});
|
|
},
|
|
handleFindSelect(res, index, idx) {
|
|
var _a;
|
|
let is = res == null ? void 0 : res.isSelect;
|
|
BILL_send_bill_model.useModel.listData.value[index].bills[idx].isSelect = !is;
|
|
let allChecked = (_a = BILL_send_bill_model.useModel.listData.value[index].bills) == null ? void 0 : _a.every(
|
|
(item) => item == null ? void 0 : item.isSelect
|
|
);
|
|
BILL_send_bill_model.useModel.listData.value[index].isSelect = allChecked;
|
|
},
|
|
handleParmaryClick() {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
let bill_ids = [];
|
|
(_c = (_b = (_a = BILL_send_bill_model.useModel) == null ? void 0 : _a.listData) == null ? void 0 : _b.value) == null ? void 0 : _c.map((res) => {
|
|
var _a2, _b2;
|
|
if ((_a2 = res == null ? void 0 : res.bills) == null ? void 0 : _a2.length) {
|
|
(_b2 = res == null ? void 0 : res.bills) == null ? void 0 : _b2.map((i) => {
|
|
if (i == null ? void 0 : i.isSelect) {
|
|
bill_ids == null ? void 0 : bill_ids.push(i == null ? void 0 : i.id);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
if (!(bill_ids == null ? void 0 : bill_ids.length)) {
|
|
return common_libraries_naviHelper.showToast("请至少选择一个月账单!");
|
|
}
|
|
common_libraries_sendWxWork.sendChatMessage({
|
|
page: `/INDEX/bill_order/index.html?bill_ids=${JSON.stringify(bill_ids)}&house_id=${(_f = (_e = (_d = BILL_send_bill_model.useModel) == null ? void 0 : _d.currentHouses) == null ? void 0 : _e.value) == null ? void 0 : _f.id}`,
|
|
title: `分享给您${(_i = (_h = (_g = BILL_send_bill_model.useModel) == null ? void 0 : _g.currentHouses) == null ? void 0 : _h.value) == null ? void 0 : _i.name}物业账单`,
|
|
imgUrl: "https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg"
|
|
});
|
|
},
|
|
handleQRCode() {
|
|
var _a, _b, _c;
|
|
let bill_ids = [];
|
|
let total_amount = 0;
|
|
(_c = (_b = (_a = BILL_send_bill_model.useModel) == null ? void 0 : _a.listData) == null ? void 0 : _b.value) == null ? void 0 : _c.map((res) => {
|
|
var _a2, _b2;
|
|
if ((_a2 = res == null ? void 0 : res.bills) == null ? void 0 : _a2.length) {
|
|
(_b2 = res == null ? void 0 : res.bills) == null ? void 0 : _b2.map((i) => {
|
|
if (i == null ? void 0 : i.isSelect) {
|
|
bill_ids == null ? void 0 : bill_ids.push(i == null ? void 0 : i.id);
|
|
total_amount += parseFloat(i == null ? void 0 : i.amount);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
if (!(bill_ids == null ? void 0 : bill_ids.length)) {
|
|
return common_libraries_naviHelper.showToast("请至少选择一个月账单!");
|
|
}
|
|
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.HouseOrder.HouseOrders.Store, {
|
|
bill_ids: bill_ids || [],
|
|
total_payable_amount: total_amount,
|
|
amount: total_amount
|
|
}).then((res) => {
|
|
var _a2, _b2, _c2, _d, _e, _f, _g;
|
|
common_vendor.index.navigateTo({
|
|
url: `/BILL/poster/index?id=${(_b2 = (_a2 = BILL_send_bill_model.useModel.currentHouses) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id}&order_id=${(_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.id}&time=${(_d = res == null ? void 0 : res.data) == null ? void 0 : _d.created_at}&name=${(_g = (_f = (_e = BILL_send_bill_model.useModel) == null ? void 0 : _e.currentHouses) == null ? void 0 : _f.value) == null ? void 0 : _g.name}&amount=${total_amount}`
|
|
});
|
|
});
|
|
}
|
|
};
|
|
exports.method = method;
|