Blame view

src/components/fee/payFeeUserAccount.vue 4.02 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
2
3
4
    <div>
      <el-card v-if="accountList.length > 0" class="margin-bottom-sm">
        <div slot="header" class="flex justify-between">
1a0bdbe0   wuxw   优化缴费页面
5
          <span>{{ $t('payFeeUserAccount.accountInfo') }}</span>
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
6
          <el-button type="primary" size="small" style="float: right;" @click="queryPayFeeUserAccount">
1a0bdbe0   wuxw   优化缴费页面
7
8
9
10
            <i class="el-icon-refresh"></i>
            {{ $t('payFeeUserAccount.refresh') }}
          </el-button>
        </div>
24d3590f   wuxw   房屋收费页面开发完成
11
  
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
12
        <el-table :data="accountList" border style="width: 100%">
96514773   wuxw   解决缴费页面账户选择bug
13
          <el-table-column align="center" :label="$t('payFeeUserAccount.select')" width="120">
1a0bdbe0   wuxw   优化缴费页面
14
            <template slot-scope="scope">
96514773   wuxw   解决缴费页面账户选择bug
15
16
17
18
19
20
              <el-radio
                v-model="selectedAccount"
                :label="scope.row.acctId"
                @change="() => handleAccountChange(scope.row)"
              >
              </el-radio>
1a0bdbe0   wuxw   优化缴费页面
21
22
            </template>
          </el-table-column>
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
23
24
25
          <el-table-column prop="acctTypeName" align="center" :label="$t('payFeeUserAccount.accountType')" />
          <el-table-column prop="acctName" align="center" :label="$t('payFeeUserAccount.accountName')" />
          <el-table-column prop="amount" align="center" :label="$t('payFeeUserAccount.accountAmount')">
1a0bdbe0   wuxw   优化缴费页面
26
27
28
29
            <template slot-scope="scope">
              {{ scope.row.amount }} {{ $t('payFeeUserAccount.yuan') }}
            </template>
          </el-table-column>
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
30
          <el-table-column align="center" :label="$t('payFeeUserAccount.operation')" width="150">
1a0bdbe0   wuxw   优化缴费页面
31
            <template slot-scope="scope">
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
32
              <el-button type="primary" size="mini" @click="openAddUserAmountModal(scope.row)">
1a0bdbe0   wuxw   优化缴费页面
33
34
35
36
37
38
39
                <i class="el-icon-plus"></i>
                {{ $t('payFeeUserAccount.prestore') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
40
    </div>
24d3590f   wuxw   房屋收费页面开发完成
41
42
43
44
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
45
  import { queryCommunityOwnerAccount } from '@/api/fee/payFeeOrderApi'
24d3590f   wuxw   房屋收费页面开发完成
46
47
48
49
50
  
  export default {
    name: 'PayFeeUserAccount',
    data() {
      return {
1a0bdbe0   wuxw   优化缴费页面
51
52
53
54
        accountList: [],
        feeId: '',
        ownerId: '',
        communityId: '',
96514773   wuxw   解决缴费页面账户选择bug
55
        selectedAccount: '' // 单选账户
24d3590f   wuxw   房屋收费页面开发完成
56
57
      }
    },
24d3590f   wuxw   房屋收费页面开发完成
58
    methods: {
1a0bdbe0   wuxw   优化缴费页面
59
60
61
62
      open(params) {
        this.feeId = params.feeId
        this.ownerId = params.ownerId || ''
        this.listUserAccount()
1a0bdbe0   wuxw   优化缴费页面
63
64
65
66
67
      },
      close() {
        this.dialogVisible = false
      },
      async listUserAccount() {
24d3590f   wuxw   房屋收费页面开发完成
68
        try {
1a0bdbe0   wuxw   优化缴费页面
69
          this.communityId = await getCommunityId()
24d3590f   wuxw   房屋收费页面开发完成
70
          const params = {
1a0bdbe0   wuxw   优化缴费页面
71
72
73
74
75
            page: 1,
            row: 20,
            feeId: this.feeId,
            ownerId: this.ownerId,
            communityId: this.communityId
24d3590f   wuxw   房屋收费页面开发完成
76
77
          }
  
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
78
79
          const response = await queryCommunityOwnerAccount(params)
          this.accountList = response.data || []
24d3590f   wuxw   房屋收费页面开发完成
80
        } catch (error) {
1a0bdbe0   wuxw   优化缴费页面
81
          console.error('查询用户账户失败:', error)
24d3590f   wuxw   房屋收费页面开发完成
82
83
        }
      },
1a0bdbe0   wuxw   优化缴费页面
84
85
      queryPayFeeUserAccount() {
        this.listUserAccount()
24d3590f   wuxw   房屋收费页面开发完成
86
      },
1a0bdbe0   wuxw   优化缴费页面
87
      openAddUserAmountModal(userAccount) {
9d019fa6   wuxw   测试OA相关流程
88
        window.open(`/#/views/owner/ownerDetail?ownerId=${userAccount.objId}&currentTab=ownerDetailAccount`)
24d3590f   wuxw   房屋收费页面开发完成
89
      },
96514773   wuxw   解决缴费页面账户选择bug
90
91
92
93
      // 处理账户选择变化
      handleAccountChange(account) {
        if (!account) {
          this.selectedAccount = ''
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
94
        } else {
96514773   wuxw   解决缴费页面账户选择bug
95
          this.selectedAccount = account.acctId
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
96
        }
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
97
98
        this.computeFeeUserAmount()
      },
96514773   wuxw   解决缴费页面账户选择bug
99
      // 计算费用使用金额
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
100
      computeFeeUserAmount() {
1a0bdbe0   wuxw   优化缴费页面
101
102
        let totalUserAmount = 0.0
        let selectAccount = []
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
103
  
96514773   wuxw   解决缴费页面账户选择bug
104
105
106
107
        const account = this.accountList.find(item => item.acctId === this.selectedAccount)
        if (account && Number(account.amount) !== 0) {
          totalUserAmount = parseFloat(account.amount)
          selectAccount = [account]
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
108
109
        }
  
24d3590f   wuxw   房屋收费页面开发完成
110
        this.$emit('changeUserAmountPrice', {
1a0bdbe0   wuxw   优化缴费页面
111
112
          totalUserAmount,
          accountList: this.accountList,
24d3590f   wuxw   房屋收费页面开发完成
113
          integralAmount: 0,
1a0bdbe0   wuxw   优化缴费页面
114
          cashAmount: totalUserAmount,
24d3590f   wuxw   房屋收费页面开发完成
115
          couponAmount: 0,
1a0bdbe0   wuxw   优化缴费页面
116
          selectAccount
24d3590f   wuxw   房屋收费页面开发完成
117
118
        })
      },
1a0bdbe0   wuxw   优化缴费页面
119
120
      handleClose() {
        this.accountList = []
96514773   wuxw   解决缴费页面账户选择bug
121
        this.selectedAccount = '' // 清空选中的账户
1a0bdbe0   wuxw   优化缴费页面
122
123
        this.feeId = ''
        this.ownerId = ''
24d3590f   wuxw   房屋收费页面开发完成
124
125
126
127
128
      }
    }
  }
  </script>
  
1a0bdbe0   wuxw   优化缴费页面
129
130
131
  <style scoped>
  .el-table {
    margin-top: 20px;
24d3590f   wuxw   房屋收费页面开发完成
132
133
  }
  </style>