Parcourir la source

对接退款接口

wangxin il y a 6 ans
Parent
commit
2da591735a

+ 23 - 3
src/views/hlgaccount/modules/HlgAccountPaymentDetailsModal.vue

@@ -41,8 +41,12 @@
             :loading="loading"
             :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
             @change="handleTableChange">
-                <span slot="type" slot-scope="text">
+                <span slot="type" slot-scope="text,scope,index">
                   {{text?'收入':'支出'}}
+                  <a-button type="link" @click="changeDisplay(scope,index)">
+                     <a-icon type="eye" v-show="scope.isDisplay === '1'"/>
+                      <a-icon type="eye-invisible" :style="{color:'#8e8e8e'}" v-show="scope.isDisplay === '0'"/>
+                  </a-button>
                 </span>
           </a-table>
         </div>
@@ -54,7 +58,7 @@
 
 <script>
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import { httpAction, getAction } from '@/api/manage'
+  import { httpAction, getAction, putAction } from '@/api/manage'
   import pick from 'lodash.pick'
   import JDate from '@/components/jeecg/JDate'
   import HlgAccountTopUpRefundModal from './HlgAccountTopUpRefundListModal'
@@ -129,7 +133,8 @@
         companyName: '',
         companyId: 0,
         url: {
-          list: '/hlgaccount/hlgAccountDetail/list'
+          list: '/hlgaccount/hlgAccountDetail/list',
+          edit: '/hlgaccount/hlgAccountDetail/edit'
         }
 
       }
@@ -182,6 +187,21 @@
       handleCancel() {
         this.close()
       },
+      changeDisplay(scope, index) {
+        this.loading = true
+        this.confirmLoading = true
+        const isDisplay = Number(!Number(scope.isDisplay)).toString()
+        putAction(this.url.edit, { id: scope.id, isDisplay }).then(data => {
+          this.confirmLoading = false
+          if (data.success) {
+            this.$set(this.dataSource[index], 'isDisplay', isDisplay)
+          }
+          if (data.code === 510) {
+            this.$message.warning(res.message)
+          }
+          this.loading = false
+        })
+      },
       topUpRefund() {
         this.$refs.topUpRefundModalForm.edit(this.model)
         this.$refs.topUpRefundModalForm.title = '充值退款'

+ 8 - 3
src/views/hlgaccount/modules/HlgAccountRechargeModal.vue

@@ -13,7 +13,7 @@
       <a-form :form="form">
 
         <a-form-item label="充值金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <a-input-number v-decorator="[ 'totalAmount', validatorRules.money,{initialValue:0}]" :precision="2"
+          <a-input-number v-decorator="[ 'totalAmount', validatorRules.totalAmount,{initialValue:0}]" :precision="2"
                           style="width: 100%"
                           placeholder="请输入充值金额"></a-input-number>
         </a-form-item>
@@ -99,7 +99,7 @@
         confirmLoading: false,
         companyId: 0,
         url: {
-          add: '/hlgaccount/hlgAccount/recharge'
+          add: '/hlgaccount/hlgAccountDetail/recharge'
         }
 
       }
@@ -171,7 +171,12 @@
                 this.$message.info('充值成功')
                 this.close()
               }else {
-                this.$message.error(data.message)
+                this.$error({
+                  title: '充值失败',
+                  content: data.message,
+                  okText: '确定',
+                  centered:true
+                })
               }
               if (data.code === 510) {
                 this.$message.warning(data.message)

+ 23 - 9
src/views/hlgaccount/modules/HlgAccountRefundModal.vue

@@ -13,7 +13,7 @@
       <a-form :form="form">
 
         <a-form-item label="退款总金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <a-input v-decorator="[ 'totalRefundAmount', validatorRules.totalRefundAmount,{initialValue:0}]"
+          <a-input v-decorator="[ 'refundAmount', validatorRules.refundAmount,{initialValue:0}]"
                    :precision="2"
                    style="width: 100%"
                    enterButton="Search"
@@ -95,13 +95,13 @@
         },
         form: this.$form.createForm(this, {
           onValuesChange: (props, fields) => {
-            this.service_charge = this.accMul(fields.totalRefundAmount || 0, this.accDiv(this.serviceRate, 100)).toFixed(2)
-            this.real_money = this.accSub(fields.totalRefundAmount || 0, this.accMul(fields.totalRefundAmount || 0, this.accDiv(this.serviceRate, 100))).toFixed(2)
+            this.service_charge = this.accMul(fields.refundAmount || 0, this.accDiv(this.serviceRate, 100)).toFixed(2)
+            this.real_money = this.accSub(fields.refundAmount || 0, this.accMul(fields.refundAmount || 0, this.accDiv(this.serviceRate, 100))).toFixed(2)
           }
         }),
         disableSubmit: false,
         validatorRules: {
-          totalRefundAmount: {
+          refundAmount: {
             rules: [{ required: true, message: '请输入充值金额!' }, {
               validator: this.checkMoney
             }]
@@ -111,7 +111,7 @@
         companyId: 0,
         url: {
           add: '/hlgaccount/hlgAccount/add',
-          edit: '/hlgaccount/hlgAccountDetail/edit'
+          refund: '/hlgaccount/hlgAccountDetail/refund'
         }
 
       }
@@ -161,6 +161,9 @@
         // })
       },
       close() {
+        this.form.setFieldsValue({
+          refundAmount: ''
+        })
         this.$emit('ok')
         this.visible = false
       },
@@ -169,13 +172,24 @@
           if (!err) {
             this.confirmLoading = true
             this.loading = true
-            putAction(this.url.edit, { id: this.id, isDisplay: this.isDisplay }).then(data => {
+            putAction(this.url.refund, {
+              id: this.id,
+              refundAmount: value.refundAmount,
+              isDisplay: this.isDisplay
+            }).then(data => {
               this.confirmLoading = false
               if (data.success) {
                 this.$message.info('退款成功')
                 this.close()
+              } else {
+                this.$error({
+                  title: '退款失败',
+                  content: data.message,
+                  okText: '确定',
+                  centered:true
+                })
               }
-              if (res.code === 510) {
+              if (data.code === 510) {
                 this.$message.warning(res.message)
               }
               this.loading = false
@@ -203,11 +217,11 @@
         this.serviceRate = data
       },
       editDisplay(data) {
-        this.isDisplay = data.target.value
+        this.isDisplay = data.target.value.toString()
       },
       inputAll() {
         this.form.setFieldsValue({
-          totalRefundAmount: this.model.amount - this.model.totalRefundAmount
+          refundAmount: this.model.amount - this.model.totalRefundAmount
         })
       }
     }

+ 1 - 1
src/views/hlgaccount/modules/HlgAccountTopUpRefundListModal.vue

@@ -140,7 +140,7 @@
         companyId: 0,
         accountId: 0,
         url: {
-          list: '/hlgaccount/hlgAccountDetail/list'
+          list: '/hlgaccount/hlgAccountDetail/refundList'
         }
 
       }

+ 1 - 1
vue.config.js

@@ -59,7 +59,7 @@ module.exports = {
     port: 8091,
     proxy: {
       '/powerjob': {
-        target: 'http://127.0.0.1:8090', //请求本地 需要powerjob后台项目
+        target: 'http://192.168.1.102:8090', //请求本地 需要powerjob后台项目
         ws: false,
         changeOrigin: true
       },