Compare commits
5 Commits
0cac04e0db
...
c8c4cd6bd4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c4cd6bd4 | ||
|
|
f0189c6f2c | ||
|
|
def0aef656 | ||
|
|
a6eebd287c | ||
|
|
4df3526466 |
@ -735,7 +735,7 @@ export default {
|
||||
}
|
||||
|
||||
// 根据选中的分类ID筛选数据
|
||||
this.defaultInfoList = this.originalDefaultInfoList.filter(info => info.id === item.id);
|
||||
this.defaultInfoList = this.originalDefaultInfoList.filter(info => info?.id === item?.id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,9 @@
|
||||
<view class="payItem_tit">
|
||||
<view class="payItem_left">
|
||||
<checkbox :checked="item.check" @click="checkChange(item, index)"
|
||||
v-if="item.community_order_rows.some(itemObj => itemObj.pay_status == 1)"></checkbox>
|
||||
v-if="item.community_order_rows.some(itemObj => itemObj.pay_status == 1)"
|
||||
:disabled="!canSelectBill(index)">
|
||||
</checkbox>
|
||||
<view style="margin-left: 24rpx">{{ item.order_date }}年</view>
|
||||
</view>
|
||||
<view class="payItem_right">
|
||||
@ -73,8 +75,8 @@
|
||||
</view>
|
||||
<view v-if="item.more">
|
||||
<view class="payItem_List" v-for="(items, indes) in item.community_order_rows" :key="items.order_id">
|
||||
<checkbox :checked="items.check" @click="itemsCheckChange(items, indes, index)"
|
||||
v-if="items.pay_status == 1"></checkbox>
|
||||
<checkbox :checked="items.check" @click="itemsCheckChange(items, indes, index)" v-if="items.pay_status == 1"
|
||||
:disabled="!canSelectItem(indes, index)"></checkbox>
|
||||
<view class="Item_time" v-if="items.billing_cycle == 1">
|
||||
{{ items.order_date }}年
|
||||
</view>
|
||||
@ -279,6 +281,7 @@ export default {
|
||||
currentCommunity: "", //当前房源
|
||||
currentCommunityAddr: "", //当前房源地址
|
||||
Bill: "", //账单
|
||||
Bill2: "", //未支付账单
|
||||
balanceMoney: 0, //公积金
|
||||
|
||||
currentMoney: 0, //所选金额
|
||||
@ -289,6 +292,7 @@ export default {
|
||||
page_num: 1,
|
||||
payOrderList: [],
|
||||
flag: false,
|
||||
isAllow: false,
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
@ -387,9 +391,10 @@ export default {
|
||||
page_num: 1,
|
||||
page_size: 50,
|
||||
}).then((res) => {
|
||||
this.isAllow = res.rows[0].community.bill_allow_skip_payment === 1;
|
||||
this.roomList = res.rows;
|
||||
if (!this.currentRoom.room_id) {
|
||||
this.currentRoom = this.roomList[0]
|
||||
this.currentRoom = this.roomList[0]
|
||||
}
|
||||
this.selectedRoomId = this.currentRoom.room_id;
|
||||
this.getOrderList().then(() => {
|
||||
@ -405,6 +410,7 @@ export default {
|
||||
|
||||
// 选择房源
|
||||
selectRoom(item) {
|
||||
this.getRoomSelect()
|
||||
// 更新选中的房源ID
|
||||
this.selectedRoomId = item.room_id;
|
||||
// 在控制台输出选中的数据
|
||||
@ -451,7 +457,30 @@ export default {
|
||||
ite.check = false;
|
||||
});
|
||||
});
|
||||
|
||||
// 按照年份和月份进行排序
|
||||
res.rows.sort((a, b) => {
|
||||
// 首先获取年份(从community_order_rows中第一个元素的order_date提取)
|
||||
const yearA = a.community_order_rows && a.community_order_rows.length > 0 ? parseInt(a.community_order_rows[0].order_date) : 0;
|
||||
const yearB = b.community_order_rows && b.community_order_rows.length > 0 ? parseInt(b.community_order_rows[0].order_date) : 0;
|
||||
|
||||
// 如果年份不同,按照年份排序
|
||||
if (yearA !== yearB) {
|
||||
return yearA - yearB;
|
||||
}
|
||||
|
||||
// 如果年份相同,获取月份进行比较
|
||||
const monthA = a.community_order_rows && a.community_order_rows.length > 0 ? parseInt(a.community_order_rows[0].order_datetime) : 0;
|
||||
const monthB = b.community_order_rows && b.community_order_rows.length > 0 ? parseInt(b.community_order_rows[0].order_datetime) : 0;
|
||||
return monthA - monthB;
|
||||
});
|
||||
|
||||
this.Bill = res.rows;
|
||||
this.Bill2 = res.rows.reduce((result, item) => {
|
||||
const paidOrders = item.community_order_rows.filter(ite => ite.pay_status == 1);
|
||||
return result.concat(paidOrders);
|
||||
}, []);
|
||||
|
||||
resolve();
|
||||
}).catch((error) => {
|
||||
reject(error);
|
||||
@ -462,49 +491,107 @@ export default {
|
||||
changeCheck(e, index) {
|
||||
this.Bill[index].more = !this.Bill[index].more;
|
||||
},
|
||||
// 判断是否可以选择该年份的账单
|
||||
canSelectBill(index) {
|
||||
if (this.isAllow) return true;
|
||||
|
||||
// 如果是第一条账单,总是可以选择
|
||||
if (index === 0) return true;
|
||||
|
||||
// 检查前面所有年份的账单是否都已支付
|
||||
for (let i = 0; i < index; i++) {
|
||||
const yearBill = this.Bill[i];
|
||||
// 检查该年份是否有未支付的账单
|
||||
const hasUnpaid = yearBill.community_order_rows.some(item => item.pay_status === 1);
|
||||
if (hasUnpaid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// 判断是否可以选择该具体的账单项
|
||||
canSelectItem(indes, index) {
|
||||
if (this.isAllow) return true;
|
||||
|
||||
// 首先检查该年份是否可以选择
|
||||
if (!this.canSelectBill(index)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果是该年份的第一项,总是可以选择
|
||||
if (indes === 0) return true;
|
||||
|
||||
// 检查该年份前面的月份是否都已支付
|
||||
const yearBill = this.Bill[index];
|
||||
for (let i = 0; i < indes; i++) {
|
||||
if (yearBill.community_order_rows[i].pay_status === 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
//整体选择
|
||||
checkChange(e, index) {
|
||||
this.Bill[index].check = !this.Bill[index].check;
|
||||
this.Bill[index].community_order_rows.forEach((item) => {
|
||||
if (item.pay_status == 1) {
|
||||
item.check = this.Bill[index].check;
|
||||
}
|
||||
});
|
||||
|
||||
// 重新计算选中金额
|
||||
let money = 0;
|
||||
this.Bill.forEach((item) => {
|
||||
item.community_order_rows.forEach((ite) => {
|
||||
if (ite.check && ite.pay_status == 1) {
|
||||
money += ite.money;
|
||||
// 只针对没有禁用的多选框操作
|
||||
if (this.canSelectBill(index)) {
|
||||
this.Bill[index].check = !this.Bill[index].check;
|
||||
this.Bill[index].community_order_rows.forEach((item, indes) => {
|
||||
// 子项也只针对没有禁用的多选框操作
|
||||
if (item.pay_status == 1 && this.canSelectItem(indes, index)) {
|
||||
item.check = this.Bill[index].check;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.currentMoney = money ? money.toFixed(2) : 0.00;
|
||||
|
||||
// 重新计算选中金额
|
||||
let money = 0;
|
||||
this.Bill.forEach((item) => {
|
||||
item.community_order_rows.forEach((ite) => {
|
||||
if (ite.check && ite.pay_status == 1) {
|
||||
money += ite.money;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.currentMoney = money ? money.toFixed(2) : 0.00;
|
||||
}
|
||||
},
|
||||
//具体选择
|
||||
itemsCheckChange(e, indes, index) {
|
||||
this.Bill[index].community_order_rows[indes].check =
|
||||
!this.Bill[index].community_order_rows[indes].check;
|
||||
//判断是否全部选中
|
||||
let isAll = this.Bill[index].community_order_rows.every((item) => {
|
||||
return item.check;
|
||||
});
|
||||
if (isAll) {
|
||||
this.Bill[index].check = true;
|
||||
} else {
|
||||
this.Bill[index].check = false;
|
||||
}
|
||||
//帮我计算所有Bill的的community_order_rows 所选中的金额 现在取消选择金额没有减
|
||||
let money = 0;
|
||||
this.Bill.forEach((item) => {
|
||||
item.community_order_rows.forEach((ite) => {
|
||||
if (ite.check) {
|
||||
money += ite.money;
|
||||
// 只针对没有禁用的多选框操作
|
||||
if (this.canSelectItem(indes, index)) {
|
||||
this.Bill[index].community_order_rows[indes].check =
|
||||
!this.Bill[index].community_order_rows[indes].check;
|
||||
|
||||
//判断是否全部选中(只检查可选中的项)
|
||||
let isAll = this.Bill[index].community_order_rows.every((item, idx) => {
|
||||
// 只考虑可选中的项(未支付且可以选择)
|
||||
if (item.pay_status === 1 && this.canSelectItem(idx, index)) {
|
||||
return item.check;
|
||||
}
|
||||
// 对于已支付或不可选择的项,不影响全选状态
|
||||
return true;
|
||||
});
|
||||
});
|
||||
this.currentMoney = money ? money.toFixed(2) : 0.00;
|
||||
|
||||
if (isAll) {
|
||||
this.Bill[index].check = true;
|
||||
} else {
|
||||
this.Bill[index].check = false;
|
||||
}
|
||||
|
||||
// 计算所有选中的金额
|
||||
let money = 0;
|
||||
this.Bill.forEach((item) => {
|
||||
item.community_order_rows.forEach((ite) => {
|
||||
if (ite.check && ite.pay_status == 1) {
|
||||
money += ite.money;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.currentMoney = money ? money.toFixed(2) : 0.00;
|
||||
}
|
||||
},
|
||||
//切换支付方式
|
||||
changePayType(e) {
|
||||
|
||||
@ -40,7 +40,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="GG_rigth" @click="showSizePopup">
|
||||
共{{ info.commodity_goods_info_list ? info.commodity_goods_info_list.length : 0 }}款<u-icon size="26rpx" name="arrow-right"></u-icon>
|
||||
共{{ info.commodity_goods_info_list ? info.commodity_goods_info_list.length : 0 }}款<u-icon size="26rpx"
|
||||
name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -177,7 +178,7 @@
|
||||
<view class="car_right" v-if="
|
||||
info.commodity_goods_info_list[currentGGIndex].stock_quantity > 0 &&
|
||||
(!info.commodity_goods_info_list[currentGGIndex].cart_count ||
|
||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0)
|
||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0)
|
||||
" @click="addCar">
|
||||
加入购物车
|
||||
</view>
|
||||
@ -189,7 +190,8 @@
|
||||
加入购物车
|
||||
</view>
|
||||
|
||||
<view class="car_right car_right_disabled" v-if="info.commodity_goods_info_list[currentGGIndex].stock_quantity < 1">
|
||||
<view class="car_right car_right_disabled"
|
||||
v-if="info.commodity_goods_info_list[currentGGIndex].stock_quantity < 1">
|
||||
已售罄
|
||||
</view>
|
||||
</view>
|
||||
@ -435,7 +437,6 @@ export default {
|
||||
request(apiArr.getGoodsInfo, "POST", {
|
||||
id: this.id,
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
|
||||
// 分割图片
|
||||
res.commodity_goods_info_list.forEach((item) => {
|
||||
@ -458,7 +459,6 @@ export default {
|
||||
});
|
||||
}
|
||||
this.info = res;
|
||||
console.log("this.info", this.info.commodity_goods_info_list);
|
||||
|
||||
// 检查是否有传入的选中商品信息,如果有则设置为默认选中
|
||||
let selectedIndex = 0;
|
||||
@ -517,14 +517,17 @@ export default {
|
||||
//获取购物车数量
|
||||
getShopCar() {
|
||||
request(apiArr.getCarCount, "POST", {}).then((res) => {
|
||||
this.carNum = res.total;
|
||||
this.prevCarNum = res.total;
|
||||
});
|
||||
},
|
||||
|
||||
getShopCarList() {
|
||||
request(apiArr.getCar, "POST", {}).then((res) => {
|
||||
this.carOrderList = res.commodity_cart_list;
|
||||
return request(apiArr.getCar, "POST", {}).then((res) => {
|
||||
// 合并当日达和普通商品数据
|
||||
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
||||
this.carNum = res.total;
|
||||
return res;
|
||||
});
|
||||
},
|
||||
|
||||
@ -655,20 +658,23 @@ export default {
|
||||
},
|
||||
onReachBottom() { },
|
||||
onShow() {
|
||||
this.getShopCarList();
|
||||
this.getGoodsInfo();
|
||||
this.getShopCar();
|
||||
this.getComment();
|
||||
this.getShopCarList().then(() => {
|
||||
this.getGoodsInfo();
|
||||
this.getShopCar();
|
||||
this.getComment();
|
||||
});
|
||||
},
|
||||
|
||||
//离开页面的时候直接更新购物车数量(目前接口是 传入商品id 数量。如果有当前商品就更新数量。如果没有就增加商品。如果删除某个商品 count 为0 就删除)
|
||||
onHide() {
|
||||
let goods_id_and_count = [];
|
||||
this.info.commodity_goods_info_list.forEach((item) => {
|
||||
goods_id_and_count.push({
|
||||
goods_id: item.id,
|
||||
count: item.cart_count ? item.cart_count.count : 0,
|
||||
});
|
||||
if (item.cart_count) {
|
||||
goods_id_and_count.push({
|
||||
goods_id: item.id,
|
||||
count: item.cart_count.count,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
request(apiArr.updateCar, "POST", {
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
<view class="serverList1_right" v-if="serverRightList.length > 0">
|
||||
<view :class="['serverItemRight', `serverItemRight${index + 1}`]"
|
||||
v-for="(item, index) in serverRightList" :key="index">
|
||||
<image :src="item.pic_src" mode="" @tap="index === 0 ? toAdvertisingView(serverRightList) : headerServerClick(item)"/>
|
||||
<image :src="item.pic_src" mode="" @tap="index === 0 ? toAdvertisingView(serverRightList) : goToPurify(item)"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -360,6 +360,18 @@ export default {
|
||||
NavgateTo('/packages/advertising/index/index?id=' + item.id, { isLogin: false })
|
||||
},
|
||||
|
||||
//跳转到净水小程序
|
||||
goToPurify() {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: 'wx77b22c0a0018e580',
|
||||
path: 'pages/newLogin/newLogin',
|
||||
envVersion: 'release',
|
||||
success(res) {
|
||||
// 打开成功
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async goToWuye() {
|
||||
uni.removeStorageSync('order_dispatch_permission');
|
||||
uni.removeStorageSync('work_order_permission');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user