Blame view

src/views/scm/goldList.vue 4.79 KB
6ed9faf1   wuxw   开发完成优惠下的积分功能
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
  <template>
    <div class="gold-container">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <div class="flex justify-between">
            <h3>{{ $t('gold.title') }}</h3>
            <div></div>
          </div>
        </div>
  
        <!-- 业主信息 -->
        <div class="margin-top">
          <el-row>
            <el-col :span="6">
              <div class="form-group">
                <label class="el-form-item__label">
                  {{ $t('goldInfo.accountId') }}
                </label>
                <div class="el-form-item__content">
                  {{ goldInfo.goldId }}
                </div>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="form-group">
                <label class="el-form-item__label">
                  {{ $t('goldInfo.accountName') }}
                </label>
                <div class="el-form-item__content">
                  {{ goldInfo.goldName }}
                </div>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="form-group">
                <label class="el-form-item__label">
                  {{ $t('goldInfo.accountBalance') }}
                </label>
                <div class="el-form-item__content">
                  {{ goldInfo.amount }}
                  <el-button type="text" @click="openApplyWithholdGold">
                    {{ $t('gold.withdraw') }}
                  </el-button>
                </div>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="form-group">
                <label class="el-form-item__label">
                  {{ $t('goldInfo.communityName') }}
                </label>
                <div class="el-form-item__content">
                  {{ goldInfo.communityName }}
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
  
27dcfde5   wuxw   系统全面测试完成
60
        <divider></divider>
6ed9faf1   wuxw   开发完成优惠下的积分功能
61
62
63
64
  
        <div class="margin-top-sm">
          <el-tabs v-model="goldInfo.currentTab" @tab-click="changeTab(goldInfo.currentTab)">
            <el-tab-pane :label="$t('gold.transactionDetails')" name="goldDetail">
27dcfde5   wuxw   系统全面测试完成
65
              <gold-detail v-if="goldInfo.currentTab === 'goldDetail'" ref="goldDetail" />
6ed9faf1   wuxw   开发完成优惠下的积分功能
66
67
            </el-tab-pane>
            <el-tab-pane :label="$t('gold.goldWithdrawal')" name="applyWithholdGold">
27dcfde5   wuxw   系统全面测试完成
68
              <apply-withhold-gold v-if="goldInfo.currentTab === 'applyWithholdGold'" ref="applyWithholdGold" />
6ed9faf1   wuxw   开发完成优惠下的积分功能
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
            </el-tab-pane>
          </el-tabs>
        </div>
  
        <withhold-gold ref="withholdGold" @success="handleSuccess" />
      </el-card>
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { getPropertyGoldInfo } from '@/api/scm/goldApi'
  import GoldDetail from '@/components/scm/goldDetail'
  import ApplyWithholdGold from '@/components/scm/applyWithholdGold'
  import WithholdGold from '@/components/scm/withholdGold'
27dcfde5   wuxw   系统全面测试完成
84
  import divider from '@/components/system/divider' 
6ed9faf1   wuxw   开发完成优惠下的积分功能
85
86
87
88
89
90
  
  export default {
    name: 'GoldList',
    components: {
      GoldDetail,
      ApplyWithholdGold,
27dcfde5   wuxw   系统全面测试完成
91
92
      WithholdGold,
      divider
6ed9faf1   wuxw   开发完成优惠下的积分功能
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
    },
    data() {
      return {
        goldInfo: {
          goldId: '',
          goldName: '',
          amount: '',
          communityName: '',
          communityId: '',
          currentTab: 'goldDetail'
        }
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.loadGoldInfo()
    },
    methods: {
      async loadGoldInfo() {
        try {
          const params = {
            page: 1,
            row: 1,
            communityId: this.communityId
          }
          const { data } = await getPropertyGoldInfo(params)
          if (data && data.length > 0) {
            this.goldInfo = {
              ...this.goldInfo,
              goldId: data[0].goldId,
              goldName: data[0].goldName,
              amount: data[0].amount,
              communityName: data[0].communityName,
              communityId: data[0].communityId
            }
          }
        } catch (error) {
          console.error('Failed to load gold info:', error)
        }
      },
      changeTab(tab) {
        this.goldInfo.currentTab = tab.name || tab
        setTimeout(() => {
          this.$refs[tab].open(this.goldInfo)
        }, 500);
      },
      openApplyWithholdGold() {
        this.$refs.withholdGold.open({
          goldId: this.goldInfo.goldId,
          amount: this.goldInfo.amount,
          communityId: this.goldInfo.communityId
        })
      },
      handleSuccess() {
        this.loadGoldInfo()
        this.goldInfo.currentTab = 'applyWithholdGold'
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .gold-container {
    padding: 20px;
  
    .box-card {
      margin-bottom: 20px;
    }
  
    .margin-top {
      margin-top: 20px;
    }
  
    .margin-top-sm {
      margin-top: 10px;
    }
  
    .form-group {
27dcfde5   wuxw   系统全面测试完成
171
      text-align: left;
6ed9faf1   wuxw   开发完成优惠下的积分功能
172
173
174
      margin-bottom: 0;
      padding: 10px;
      border-radius: 4px;
6ed9faf1   wuxw   开发完成优惠下的积分功能
175
176
177
178
179
180
181
  
      .el-form-item__label {
        font-weight: bold;
        color: #606266;
      }
  
      .el-form-item__content {
6ed9faf1   wuxw   开发完成优惠下的积分功能
182
183
184
185
      }
    }
  }
  </style>