Przeglądaj źródła

提现记录、分账记录

chenrui 3 lat temu
rodzic
commit
ac46969d03

+ 24 - 0
src/api/satelliteWH.js

@@ -73,6 +73,22 @@ export const satelliteWHWithdrawalList = (params) => {
     method: 'post'
   })
 }
+//  提现  账户信息
+export const satelliteWHWithdrawalAccount = (params) => {
+  return axios({
+    url: '/satelliteWHWithdrawal/queryAccount',
+    method: 'get'
+  })
+}
+//  提现  申请提现
+export const satelliteWHWithdrawalApply = (params) => {
+  return axios({
+    url: '/satelliteWHWithdrawal/applyWithdrawal',
+    data: params,
+    method: 'post'
+  })
+}
+
 //  分账  列表  有分页
 export const satelliteWHSeparateList = (params) => {
   const url = `/satelliteWHSeparate/queryPage/${params.pageNo}/${params.pageSize}`
@@ -84,3 +100,11 @@ export const satelliteWHSeparateList = (params) => {
     method: 'post'
   })
 }
+//  分账  列表  合计
+export const satelliteWHSeparateTotal = (params) => {
+  return axios({
+    url: '/satelliteWHSeparate/findTotalSeparate',
+    data: params,
+    method: 'post'
+  })
+}

+ 10 - 10
src/config/router.config.js

@@ -757,8 +757,8 @@ export const asyncRouterMap = [
             component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/satelliteWarehouseInventory/list.vue'),
             meta: {
               title: '卫星仓库存',
-              icon: 'flag'
-              // permission: 'M_goodsShelves_0'
+              icon: 'flag',
+              permission: 'M_satelliteWarehouseInventoryList'
             }
           },
           {
@@ -1543,8 +1543,8 @@ export const asyncRouterMap = [
             component: RouteView,
             meta: {
               title: '提现管理',
-              icon: 'dollar'
-              // permission: 'M_goodsManage_list'
+              icon: 'dollar',
+              permission: 'M_withdrawalManagementList'
             },
             hideChildrenInMenu: true,
             children: [
@@ -1555,8 +1555,8 @@ export const asyncRouterMap = [
                 meta: {
                   title: '提现管理列表',
                   icon: 'dollar',
-                  hidden: true
-                  // permission: 'M_goodsManage_list'
+                  hidden: true,
+                  permission: 'M_withdrawalManagementList'
                 }
               }
             ]
@@ -1568,8 +1568,8 @@ export const asyncRouterMap = [
             component: RouteView,
             meta: {
               title: '分账记录',
-              icon: 'profile'
-              // permission: 'M_goodsManage_list'
+              icon: 'profile',
+              permission: 'M_ledgerRecordList'
             },
             hideChildrenInMenu: true,
             children: [
@@ -1580,8 +1580,8 @@ export const asyncRouterMap = [
                 meta: {
                   title: '分账记录列表',
                   icon: 'profile',
-                  hidden: true
-                  // permission: 'M_goodsManage_list'
+                  hidden: true,
+                  permission: 'M_ledgerRecordList'
                 }
               }
             ]

+ 13 - 2
src/views/financialManagement/ledgerRecord/list.vue

@@ -41,7 +41,7 @@
     </div>
     <!-- alert -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div slot="message">总计:<strong>{{ total }}</strong>条 ,分账金额:<strong>{{ totalAmount || '--' }}</strong> 元</div>
+      <div slot="message">总计:<strong>{{ total }}</strong>条 ,分账金额:<strong>{{ (totalAmount || totalAmount == 0) ? totalAmount : '--' }}</strong> 元</div>
     </a-alert>
     <!-- 列表 -->
     <s-table
@@ -63,7 +63,7 @@ import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
 import rangeDateTime from '@/views/common/rangeDateTime.vue'
 import custSatelliteList from '@/views/common/custSatelliteList.vue'
-import { satelliteWHSeparateList } from '@/api/satelliteWH'
+import { satelliteWHSeparateList, satelliteWHSeparateTotal } from '@/api/satelliteWH'
 export default {
   components: { STable, VSelect, rangeDateTime, custSatelliteList },
   data () {
@@ -110,6 +110,7 @@ export default {
           }
           this.disabled = false
           this.total = data.list.length
+          this.getTotal(Object.assign(parameter, this.queryParam))
           return data
         })
       },
@@ -123,6 +124,16 @@ export default {
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
     },
+    // 合计
+    getTotal (params) {
+      satelliteWHSeparateTotal(params).then(res => {
+        if (res.status == 200) {
+          this.totalAmount = res.data || 0
+        } else {
+          this.totalAmount = ''
+        }
+      })
+    },
     custSatelliteChange (val) {
       this.queryParam.customer.customerSn = val.key
     },

+ 70 - 58
src/views/financialManagement/withdrawalManagement/cashOutModal.vue

@@ -8,56 +8,53 @@
     v-model="isShow"
     @cancle="isShow=false"
     :width="800">
-    <!-- 表单 -->
-    <div>
-      <a-form-model
-        id="cashOutModal-form"
-        ref="ruleForm"
-        :model="form"
-        :rules="rules"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol"
-      >
-        <a-form-model-item label="申请提现金额" prop="brandName">
-          <a-input
-            id="cashOutModal-brandName"
-            :maxLength="30"
-            v-model.trim="form.brandName"
-            @change="filterEmpty"
-            placeholder="请输入以内的金额"
-            allowClear />
-        </a-form-model-item>
-        <a-form-model-item label="实际扣除金额" prop="brandName">
-          <strong>24</strong>元(申请提现金额+提现手续费)
-        </a-form-model-item>
-        <a-form-model-item label="提现账户" prop="brandName">
-          <div>中国农业银行(杨光)</div>
-          <div>61256478784555454545</div>
-        </a-form-model-item>
-      </a-form-model>
-      <div class="btn-cont">
-        <a-button type="primary" id="product-brand-edit-modal-save" @click="handleSave">提交</a-button>
-        <a-button id="product-brand-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 表单 -->
+      <div>
+        <a-form-model
+          id="cashOutModal-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-form-model-item label="申请提现金额" prop="amount">
+            <a-input-number
+              id="cashOutModal-amount"
+              v-model="form.amount"
+              :precision="2"
+              :min="0.01"
+              :max="maxAmount"
+              :placeholder="'请输入'+ maxAmount +'以内的金额'"
+              style="width: 100%;" />
+          </a-form-model-item>
+          <a-form-model-item label="实际扣除金额" prop="brandName">
+            <strong>{{ deductionAmount }}</strong>元(申请提现金额+提现手续费)
+          </a-form-model-item>
+          <a-form-model-item label="提现账户" prop="brandName">
+            <div>{{ nowData&&nowData.bankName || '--' }}({{ nowData&&nowData.accountName || '--' }})</div>
+            <div>{{ nowData&&nowData.accountNo || '--' }}</div>
+          </a-form-model-item>
+        </a-form-model>
+        <div class="btn-cont">
+          <a-button type="primary" id="product-brand-edit-modal-save" @click="handleSave">提交</a-button>
+          <a-button id="product-brand-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
+        </div>
       </div>
-    </div>
+    </a-spin>
   </a-modal>
 </template>
 
 <script>
-import { STable } from '@/components'
-import { dealerProductBrandSave } from '@/api/dealerProductBrand'
+import { satelliteWHWithdrawalApply } from '@/api/satelliteWH'
 export default {
   name: 'ProductBrandEditModal',
-  components: { STable },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
     },
-    itemId: {
-      type: [Number, String],
-      default: ''
-    },
     nowData: {
       type: Object,
       default: null
@@ -71,40 +68,57 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        brandName: '' // 产品品牌名称
+        amount: ''
       },
       rules: {
-        brandName: [
-          { required: true, message: '请输入产品品牌名称', trigger: 'blur' }
+        amount: [
+          { required: true, message: '请输入申请提现金额', trigger: 'blur' }
         ]
+      },
+      spinning: false
+    }
+  },
+  computed: {
+    maxAmount () {
+      const balance = this.nowData.balance || 0
+      const serviceCharge = this.nowData.serviceCharge || 0
+      if ((Number(balance) * 100 - Number(serviceCharge) * 100) <= 0) {
+        return 0
+      } else {
+        return (Number(balance) * 100 - Number(serviceCharge) * 100) / 100
+      }
+    },
+    deductionAmount () {
+      const amount = this.form.amount || 0
+      const serviceCharge = this.nowData.serviceCharge || 0
+      if (amount == 0) {
+        return 0
+      } else {
+        return (Number(amount) * 100 + Number(serviceCharge) * 100) / 100
       }
     }
   },
   methods: {
-    filterEmpty () {
-      let str = this.form.brandName
-      str = str.replace(/\ +/g, '')
-      str = str.replace(/[ ]/g, '')
-      str = str.replace(/[\r\n]/g, '')
-      this.form.brandName = str
-    },
-    //  保存
+    //  提现
     handleSave () {
       const _this = this
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          const formData = JSON.parse(JSON.stringify(_this.form))
-          formData.id = _this.itemId ? _this.itemId : undefined
-          const fa = formData.brandName.substr(0, 1)
-          if (!isNaN(fa)) {
-            this.$message.error('品牌名称只能以汉字或字母开头')
-            return false
+          const params = {
+            amount: this.form.amount,
+            bankName: this.nowData.bankName,
+            bankAccount: this.nowData.accountName,
+            bankAccountNo: this.nowData.accountNo
           }
-          dealerProductBrandSave(formData).then(res => {
+          _this.spinning = true
+          satelliteWHWithdrawalApply(params).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$emit('ok')
               _this.isShow = false
+              _this.spinning = false
+            } else {
+              _this.spinning = false
             }
           })
         } else {
@@ -123,8 +137,6 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
-      } else {
-        this.form.brandName = this.nowData && this.nowData.brandName ? this.nowData.brandName : ''
       }
     }
   }

+ 34 - 39
src/views/financialManagement/withdrawalManagement/list.vue

@@ -21,7 +21,7 @@
     <!-- 操作按钮 -->
     <div class="table-operator">
       <a-button id="withdrawalManagementList-tx" type="primary" class="button-warning" @click="handleCashOut">申请提现</a-button>
-      <div style="display: inline-block;margin-left: 80px;">可提现余额: <strong>¥6</strong> 元</div>
+      <div style="display: inline-block;margin-left: 80px;">可提现余额: <strong>¥{{ accountInfo&&(accountInfo.balance || accountInfo.balance==0) ? accountInfo.balance : '--' }}</strong> 元</div>
     </div>
     <!-- 列表 -->
     <s-table
@@ -45,7 +45,7 @@
       </ul>
     </div>
     <!-- 申请提现 -->
-    <cashOutModal :openModal="openModal" :nowData="nowData" :itemId="itemId" @ok="handleOk" @close="closeModal" />
+    <cashOutModal :openModal="openModal" :nowData="accountInfo" @ok="handleOk" @close="closeModal" />
   </a-card>
 </template>
 
@@ -53,7 +53,7 @@
 import { STable, VSelect } from '@/components'
 import rangeDateTime from '@/views/common/rangeDateTime.vue'
 import cashOutModal from './cashOutModal.vue'
-import { satelliteWHWithdrawalList } from '@/api/satelliteWH'
+import { satelliteWHWithdrawalList, satelliteWHWithdrawalAccount } from '@/api/satelliteWH'
 export default {
   components: { STable, VSelect, rangeDateTime, cashOutModal },
   data () {
@@ -62,19 +62,19 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       // 查询参数
       queryParam: {
-        // beginDate: '',
-        // endDate: ''
+        beginDate: '',
+        endDate: ''
       },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
         { title: '提现时间', dataIndex: 'cashOutDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '提现单号', dataIndex: 'cashOutNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '提现单号', dataIndex: 'withdrawalNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '申请提现金额', dataIndex: 'amount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '开户名', dataIndex: 'bankAccount', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '银行卡号', dataIndex: 'bankAccountNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '状态', dataIndex: 'stateDictValue', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'remark', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '备注', dataIndex: 'resultDesc', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -91,7 +91,8 @@ export default {
       },
       openModal: false, //  弹框
       itemId: '', //  当前id
-      nowData: null //  当前记录数据
+      nowData: null, //  当前记录数据
+      accountInfo: null
     }
   },
   methods: {
@@ -100,53 +101,47 @@ export default {
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
     },
+    // 账户信息
+    getAccount () {
+      satelliteWHWithdrawalAccount().then(res => {
+        if (res.status == 200) {
+          this.accountInfo = res.data
+        } else {
+          this.accountInfo = null
+        }
+      })
+    },
     // 申请提现
     handleCashOut () {
-      this.openModal = true
+      if (this.accountInfo && this.accountInfo.balance && this.accountInfo.serviceCharge) {
+        const balance = Number(this.accountInfo.balance) * 100
+        const serviceCharge = Number(this.accountInfo.serviceCharge) * 100
+        if ((balance - serviceCharge) <= 0) {
+          this.$message.warning('余额不足,暂不能提现!')
+        } else {
+          this.openModal = true
+        }
+      }
     },
     handleOk () {
       this.$refs.table.refresh(true)
+      this.getAccount()
     },
     closeModal () {
       this.openModal = false
     },
-    //  详情
-    handleDetail (row) {
-      this.$router.push({ path: `/financialManagement/withdrawalManagement/detail/${row.id}` })
-    },
-    //  审核
-    handleExamine (row, type) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '操作后不可恢复,确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
-        centered: true,
-        onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
-        }
-      })
-    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate()
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
       this.$refs.table.refresh(true)
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getAccount()
+    })
   }
 }
 </script>

+ 1 - 1
src/views/inventoryManagement/satelliteWarehouseInventory/addModal.vue

@@ -81,7 +81,7 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '客户名称', dataIndex: 'customer.customerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '仓库名称', dataIndex: 'productBrand', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '仓库名称', dataIndex: 'satelliteWarehouseName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '配件名称', dataIndex: 'dealerProduct.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '产品编码', dataIndex: 'dealerProduct.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品原厂编码', dataIndex: 'dealerProduct.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },