|
@@ -0,0 +1,312 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <view class="order-page">
|
|
|
|
|
+ <view class="top-view">
|
|
|
|
|
+ <view class="top-row">
|
|
|
|
|
+ <text class="header-item">供应商</text>
|
|
|
|
|
+ <text class="header-item">总欠款 </text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="top-row">
|
|
|
|
|
+ <view class="info-item">
|
|
|
|
|
+ <image class="logo" :src="ghsInfo.smallAvatar"/>
|
|
|
|
|
+ <text class="name">
|
|
|
|
|
+ {{ ghsInfo.name || "" }}
|
|
|
|
|
+ </text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="price-item">
|
|
|
|
|
+ {{ ghsInfo.debtAmount || "0.00" }}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view scroll-y class="shop-list">
|
|
|
|
|
+ <block v-if="!$util.isEmpty(detailsList)">
|
|
|
|
|
+ <DetailsItem
|
|
|
|
|
+ v-for="(item, index) in detailsList"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :info="item"
|
|
|
|
|
+ :isEdit="true"
|
|
|
|
|
+ :isCheck="item.checked"
|
|
|
|
|
+ @click="checkItemEvent"
|
|
|
|
|
+ ></DetailsItem>
|
|
|
|
|
+ </block>
|
|
|
|
|
+ <block v-else>
|
|
|
|
|
+ <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(detailsList)" />
|
|
|
|
|
+ </block>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="bar-view">
|
|
|
|
|
+ <template>
|
|
|
|
|
+ <view class="info-view">
|
|
|
|
|
+ <view
|
|
|
|
|
+ class="details-select"
|
|
|
|
|
+ @click="allCheck"
|
|
|
|
|
+ >
|
|
|
|
|
+ <text
|
|
|
|
|
+ class="iconfont iconxuanzhong"
|
|
|
|
|
+ v-if="isAllCheck"
|
|
|
|
|
+ > </text>
|
|
|
|
|
+ <text
|
|
|
|
|
+ class="iconfont iconweixuanzhong"
|
|
|
|
|
+ v-else
|
|
|
|
|
+ > </text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ 已选 <text class="price">{{ selectList.length }}</text> 笔,
|
|
|
|
|
+ <text class="unit">¥</text>
|
|
|
|
|
+ <text class="price">{{ selectTotalAmount }}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <view class="btn-view">
|
|
|
|
|
+ <button :class="['admin-button-com', 'blue']" @click="batchEvent" >结算</button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
|
|
+import DetailsItem from "./detailsItem";
|
|
|
|
|
+import { getOrderDebtListApi,clearOrderApi } from "@/api/gys/index";
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: { AppWrapperEmpty, DetailsItem },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ghsInfo: "",
|
|
|
|
|
+ totalAmount: "",
|
|
|
|
|
+ num: "",
|
|
|
|
|
+ detailsList: [],
|
|
|
|
|
+ listLoading: false,
|
|
|
|
|
+ isAllCheck: false
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ onPullDownRefresh() {
|
|
|
|
|
+ this.initData().then(res => {
|
|
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad(){
|
|
|
|
|
+ this.initData().then(res => {
|
|
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ selectList() {
|
|
|
|
|
+ let list = [];
|
|
|
|
|
+ if (this.detailsList) {
|
|
|
|
|
+ for (const item of this.detailsList) {
|
|
|
|
|
+ if (item.checked) {
|
|
|
|
|
+ list.push(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(list)
|
|
|
|
|
+ return list;
|
|
|
|
|
+ },
|
|
|
|
|
+ selectTotalAmount() {
|
|
|
|
|
+ let amount = 0;
|
|
|
|
|
+ if (this.detailsList) {
|
|
|
|
|
+ for (const item of this.detailsList) {
|
|
|
|
|
+ if (item.checked) {
|
|
|
|
|
+ amount=amount+Number(item.realPrice);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return amount.toFixed(2);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ selectList () {
|
|
|
|
|
+ if (this.selectList.length === this.detailsList.length) {
|
|
|
|
|
+ this.isAllCheck = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.isAllCheck = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ async initData() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.listLoading = true;
|
|
|
|
|
+ const {
|
|
|
|
|
+ data: { ghsInfo, num, totalAmount, list }
|
|
|
|
|
+ } = await getOrderDebtListApi(this.option.id);
|
|
|
|
|
+ this.ghsInfo = ghsInfo;
|
|
|
|
|
+ this.totalAmount = totalAmount;
|
|
|
|
|
+ this.num = num;
|
|
|
|
|
+ this.detailsList = list.map(ele => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...ele,
|
|
|
|
|
+ checked: false
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.listLoading = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 全选
|
|
|
|
|
+ allCheck () {
|
|
|
|
|
+ this.isAllCheck = !this.isAllCheck
|
|
|
|
|
+ if (this.isAllCheck) {
|
|
|
|
|
+ this.detailsList.map(ele => {
|
|
|
|
|
+ ele.checked = true
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.detailsList.map(ele => {
|
|
|
|
|
+ ele.checked = false
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ checkItemEvent(item) {
|
|
|
|
|
+ for (let index = 0; index < this.detailsList.length; index++) {
|
|
|
|
|
+ const element = this.detailsList[index].id;
|
|
|
|
|
+ if (element == item.id) {
|
|
|
|
|
+ //id相等选中
|
|
|
|
|
+
|
|
|
|
|
+ this.$set(this.detailsList, index, {
|
|
|
|
|
+ ...this.detailsList[index],
|
|
|
|
|
+ checked: !this.detailsList[index].checked
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ batchEvent() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (this.$util.isEmpty(this.selectList)) {
|
|
|
|
|
+ this.$msg("请选择还款订单");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let ids = this.selectList.map(ele => {
|
|
|
|
|
+ return {id:ele.id};
|
|
|
|
|
+ });
|
|
|
|
|
+ let parameter = {
|
|
|
|
|
+ id:JSON.stringify(ids),
|
|
|
|
|
+ ghsId:this.ghsInfo.id,
|
|
|
|
|
+ }
|
|
|
|
|
+ let self = this;
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: '确定已结算?',
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ self.paySuccess(parameter)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {}
|
|
|
|
|
+ },
|
|
|
|
|
+ // 支付成功
|
|
|
|
|
+ async paySuccess(parameter) {
|
|
|
|
|
+ await clearOrderApi(parameter);
|
|
|
|
|
+ this.pageTo({url:'/common/pageSuccess?title=结算成功', type: 2});
|
|
|
|
|
+ },
|
|
|
|
|
+ payFail() {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.order-page {
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ background-color: #f9fbfc;
|
|
|
|
|
+ overflow: scroll;
|
|
|
|
|
+ .top-view {
|
|
|
|
|
+ padding: 30upx;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ .top-row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ &:not(:last-child) {
|
|
|
|
|
+ margin-bottom: 10upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .header-item {
|
|
|
|
|
+ font-size: 24upx;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ color: #999999;
|
|
|
|
|
+ }
|
|
|
|
|
+ .info-item {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ .logo {
|
|
|
|
|
+ margin-right: 10upx;
|
|
|
|
|
+ width: 50upx;
|
|
|
|
|
+ height: 50upx;
|
|
|
|
|
+ border-radius: 50%;
|
|
|
|
|
+ }
|
|
|
|
|
+ .name {
|
|
|
|
|
+ font-size: 28upx;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #333333;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .price-item {
|
|
|
|
|
+ font-size: 34upx;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #333333;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .shop-list {
|
|
|
|
|
+ padding: 20upx 30upx;
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ padding-bottom: 100upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .bar-view {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ padding: 0 30upx;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100upx;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
|
|
|
|
|
+ .info-view {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ font-size: 24upx;
|
|
|
|
|
+ .iconfont {
|
|
|
|
|
+ font-size: 32upx;
|
|
|
|
|
+ color: #dddddd;
|
|
|
|
|
+ }
|
|
|
|
|
+ .price {
|
|
|
|
|
+ margin: 0 5upx;
|
|
|
|
|
+ color: $redColor;
|
|
|
|
|
+ font-size: 32upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .unit {
|
|
|
|
|
+ margin: 0 10upx;
|
|
|
|
|
+ color: $redColor;
|
|
|
|
|
+ font-size: 16upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .btn-view {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ .admin-button-com {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ margin: 0 10upx;
|
|
|
|
|
+ width: 200upx;
|
|
|
|
|
+ height: 70upx;
|
|
|
|
|
+ // line-height: 70upx;
|
|
|
|
|
+ font-size: 32upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .details-select {
|
|
|
|
|
+ margin-right: 20upx;
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ .iconweixuanzhong,
|
|
|
|
|
+ .iconxuanzhong {
|
|
|
|
|
+ font-size: 40upx !important;
|
|
|
|
|
+ }
|
|
|
|
|
+ .iconxuanzhong {
|
|
|
|
|
+ color: $mainColor !important;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|