zhangdan 3 år sedan
förälder
incheckning
25eedf3a86

+ 40 - 0
src/api/merchant.js

@@ -0,0 +1,40 @@
+import { axios } from '@/utils/request'
+
+//  提现列表  有分页
+export const queryMerchantCashOutPage = (params) => {
+  const url = `/merchant/queryMerchantCashOutPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  申请提现
+export const saveMerchantCashOut = (params) => {
+  return axios({
+    url: '/merchant/saveMerchantCashOut',
+    data: params,
+    method: 'post'
+  })
+}
+// 账户明细
+export const queryTradeFlowPage = (params) => {
+  const url = `/merchant/queryTradeFlowPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+export const merchantCashOutDetail = (params) => {
+  return axios({
+    url: '/merchant/queryMerchantAccount',
+    data: {},
+    method: 'get'
+  })
+}

+ 5 - 2
src/libs/tools.js

@@ -225,8 +225,11 @@ export const formatDecimal = function (num, decimal) {
   }
   return parseFloat(num).toFixed(decimal)
 }
-// 处理数字千位分隔符
-export const toThousands = (num) => {
+// 处理数字千位分隔符  num 数值,decimal要保留的小数位数
+export const toThousands = (num, decimal) => {
+  if (decimal) {
+    num = formatDecimal(num, decimal)
+  }
   return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
     return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
       return $1 + ','

+ 49 - 39
src/views/numsGoodsShelves/accountManagement/list.vue

@@ -7,7 +7,7 @@
           <a-row :gutter="15">
             <a-col :xl="6" :lg="6" :md="12" :sm="24">
               <a-form-item label="交易时间">
-                <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD"/>
+                <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD" @change="dateChange"/>
               </a-form-item>
             </a-col>
             <a-col :xl="6" :lg="6" :md="6" :sm="6">
@@ -18,10 +18,8 @@
         </a-form>
       </div>
       <div style="margin:10px 0">
-        <div style="display: flex;align-items: center;padding: 2px 0;">
-          <div>
-            账户余额:<strong>¥986.00 </strong>元
-          </div>
+        <div style="display: flex;align-items: center;">
+          账户余额:<span>{{ pageInfo?toThousands(pageInfo.totalAmount,2):'--' }}</span>
         </div>
       </div>
       <s-table
@@ -33,7 +31,7 @@
         :columns="columns"
         :data="loadData"
         :scroll="{ y:tableHeight }"
-        :defaultLoadData="true"
+        :defaultLoadData="false"
         bordered>
       </s-table>
     </a-spin>
@@ -44,73 +42,84 @@
 import { commonMixin } from '@/utils/mixin'
 import moment from 'moment'
 import { STable } from '@/components'
+import { queryTradeFlowPage, merchantCashOutDetail } from '@/api/merchant'
+import { toThousands } from '@/libs/tools.js'
 export default {
   components: { STable, commonMixin },
   data () {
     return {
+      toThousands,
       spinning: false,
       disabled: false,
       tableHeight: 0,
       showModal: false,
       currentData: null,
+      pageInfo: null,
       time: [],
+      queryParam: {
+        beginDate: '',
+        endDate: ''
+      },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '交易时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '交易说明', dataIndex: 'name', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '交易类型', dataIndex: '', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '交易金额', dataIndex: '', width: '10%', align: 'right', customRender: function (text) { return text || '--' } },
-        { title: '手续费', dataIndex: '', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '账户变动', dataIndex: '', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '变动后余额', dataIndex: '', width: '10%', align: 'right', customRender: function (text) { return text || '--' } }
+        { title: '交易时间', dataIndex: 'tradeTime', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交易说明', dataIndex: 'bizInfo', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '交易类型', dataIndex: 'bizType', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交易金额', dataIndex: 'amount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
+        { title: '手续费', dataIndex: 'totalChannelFee	', width: '10%', align: 'center', customRender: function (text) { return toThousands(text, 2) || '--' } },
+        { title: '账户变动', dataIndex: 'tradeAmount', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '变动后余额', dataIndex: 'afterBalance', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         const _this = this
         _this.disabled = true
         _this.spinning = true
-        return new Promise(function (resolve, reject) {
-          const data = {
-            list: [{ id: 1, createDate: '2020-08-09' }]
+        const paramsPage = Object.assign(parameter, this.queryParam) //  有分页
+        paramsPage.merchantNo = this.pageInfo ? this.pageInfo.merchantNo : ''
+        return queryTradeFlowPage(paramsPage).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            // this.getCount(paramsPage)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
           }
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
-          }
-          _this.spinning = false
-          _this.disabled = false
-          resolve(data)
+          this.spinning = false
+          return data
         })
-
-        // const paramsPage = Object.assign(this.queryParam) //  有分页
-        // return reportSalesReturnThjdReportList(paramsPage).then(res => {
-        //   let data
-        //   if (res.status == 200) {
-        //     data = res.data
-        //     // this.getCount(paramsPage)
-        //     const no = (data.pageNo - 1) * data.pageSize
-        //     for (var i = 0; i < data.list.length; i++) {
-        //       data.list[i].no = no + i + 1
-        //     }
-        //     this.disabled = false
-        //   }
-        //   this.spinning = false
-        //   return data
-        // })
       }
     }
   },
   methods: {
     // 时间改变
     dateChange (date) {
-
+      console.log(date, 'date')
+      this.queryParam.beginDate = moment(date[0]).format('YYYY-MM-DD')
+      this.queryParam.endDate = moment(date[1]).format('YYYY-MM-DD')
     },
     // 禁止选择今天之后的日期
     disabledDate (current) {
       return current && current > moment().endOf('day')
     },
+    getPageInfo () {
+      merchantCashOutDetail({}).then(res => {
+        console.log(res, '===========')
+        if (res.status == 200) {
+          this.pageInfo = res.data
+          this.$refs.table.refresh(true)
+        } else {
+          this.pageInfo = null
+        }
+      })
+    },
     // 重置
     resetSearchForm () {
       this.time = []
+      this.$refs.table.refresh(true)
     },
     // 申请提现
     handleTX () {
@@ -125,6 +134,7 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      _this.getPageInfo()
     }
   },
   mounted () {

+ 3 - 2
src/views/numsGoodsShelves/recallManagement/list.vue

@@ -125,7 +125,7 @@ export default {
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         recallBillNo: '',
-        shelfSn: '', // 数字货架sn
+        shelfSn: undefined, // 数字货架sn
         billState: 'ALL'
       },
       columns: [
@@ -240,9 +240,10 @@ export default {
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         recallBillNo: '', // 调回单号
-        shelfSn: '', // 数字货架sn
+        shelfSn: undefined, // 数字货架sn
         billState: 'ALL'
       }
+      this.$refs.shelfList.resetForm()
       this.$refs.table.refresh(true)
     },
     // 退库

+ 60 - 6
src/views/numsGoodsShelves/withdrawalManagement/applyWithdrawal.vue

@@ -18,17 +18,22 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="申请提现金额" prop="consigneeName">
-          <a-input
+        <a-form-model-item label="申请提现金额" prop="amount">
+          <a-input-number
+            v-model="form.amount"
+            :min="0.1"
+            style="width: 100%;"
+            :precision="2"
             id="applyWithdrawal"
             placeholder="请输入正数(最多两位小数)"
             allowClear />
         </a-form-model-item>
         <a-form-model-item label="实际扣除金额">
-          <span>{{}}元 </span><span style="color: #999;">(申请提现金额-提现手续费)</span>
+          <span>{{ serviceCharge }}元 </span><span style="color: #999;">(申请提现金额+提现手续费)</span>
         </a-form-model-item>
         <a-form-model-item label="提现账户">
-          <span>{{}}</span>
+          <span style="display: block;" v-if="pageInfo">{{ pageInfo.merchantBankAccountEntity?pageInfo.merchantBankAccountEntity.bankAccount:'' }}{{ ' ( '+ pageInfo.dealerName +' ) ' }}</span>
+          <span v-if="pageInfo">{{ pageInfo.merchantBankAccountEntity?pageInfo.merchantBankAccountEntity.bankCard:"" }}</span>
         </a-form-model-item>
         <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
           <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="applyWithdrawal-btn-submit">确定</a-button>
@@ -40,6 +45,7 @@
 </template>
 
 <script>
+import { saveMerchantCashOut, merchantCashOutDetail } from '@/api/merchant'
 export default {
   props: {
     isOpenModal: {
@@ -53,32 +59,80 @@ export default {
       }
     }
   },
+  computed: {
+    serviceCharge () {
+      return this.form.amount ? this.form.amount + 0.5 : 0
+    }
+  },
   data () {
     return {
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 15 }
       },
+      form: {
+        amount: ''
+      },
+      pageInfo: null,
       opened: this.isOpenModal,
       title: '申请提现',
       confirmLoading: false,
       spinning: false,
-      rules: []
+      rules: { amount: [{ required: true, message: '请选择关联客户', trigger: 'blur' }] }
     }
   },
   methods: {
+    getPageInfo () {
+      this.spinning = true
+      merchantCashOutDetail({}).then(res => {
+        console.log(res, '===========')
+        if (res.status == 200) {
+          this.pageInfo = res.data
+        } else {
+          this.pageInfo = null
+        }
+        this.spinning = false
+      })
+    },
     // 保存
     handleSubmit () {
-      this.$emit('close')
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          form.serviceCharge = this.serviceCharge
+          form.merchantType = 'DEALER'
+          form.merchantSn = _this.pageInfo ? _this.pageInfo.merchantSn : ''
+          // form.shelfSn = _this.nowData && _this.nowData.shelfSn
+          _this.spinning = true
+          saveMerchantCashOut(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.opened = false
+                _this.$emit('close')
+                _this.spinning = false
+              }, 1000)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
     // 取消
     cancel () {
+      this.form.amount = ''
       this.$emit('close')
     }
   },
   watch: {
     isOpenModal (nVal, oVal) {
       this.opened = nVal
+      this.getPageInfo()
     }
   }
 }

+ 49 - 37
src/views/numsGoodsShelves/withdrawalManagement/list.vue

@@ -7,7 +7,7 @@
           <a-row :gutter="15">
             <a-col :xl="6" :lg="6" :md="12" :sm="24">
               <a-form-item label="交易时间">
-                <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD"/>
+                <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD" @change="dateChange"/>
               </a-form-item>
             </a-col>
             <a-col :xl="6" :lg="6" :md="6" :sm="6">
@@ -20,7 +20,7 @@
       <div style="margin:10px 0">
         <div style="display: flex;align-items: center;padding: 2px 0;">
           <div style="display: flex;align-items: center;">
-            可提现金额:<a-statistic :precision="2" :value="112893" />
+            可提现金额:<span>{{pageInfo?toThousands(pageInfo.activeAmount,2):'--'}}</span>
             <a-button size="small" type="primary" class="button-primary" @click="handleTX">申请提现</a-button>
             <span>(提示:① 提现手续费为0.5元/笔;② 资金到账周期为工作日+1天)</span>
           </div>
@@ -35,7 +35,7 @@
         :columns="columns"
         :data="loadData"
         :scroll="{ y:tableHeight }"
-        :defaultLoadData="true"
+        :defaultLoadData="false"
         bordered>
       </s-table>
     </a-spin>
@@ -49,74 +49,85 @@ import { commonMixin } from '@/utils/mixin'
 import moment from 'moment'
 import { STable } from '@/components'
 import applyWithdrawal from './applyWithdrawal.vue'
+import {queryMerchantCashOutPage,merchantCashOutDetail} from '@/api/merchant'
+import {toThousands} from '@/libs/tools.js'
 export default {
   components: { STable, applyWithdrawal, commonMixin },
   data () {
     return {
+      toThousands,
       spinning: false,
       disabled: false,
       tableHeight: 0,
       showModal: false,
       currentData: null,
       time: [],
+      pageInfo:null,
+      queryParam:{
+        beginDate:'',
+        endDate:''
+      },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '提现单号', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '提现时间', dataIndex: 'name', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '申请提现金额', dataIndex: '', width: '10%', align: 'right', customRender: function (text) { return text || '--' } },
-        { title: '开户名', dataIndex: '', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '银行卡号', dataIndex: '', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '提现人', dataIndex: '', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '状态', dataIndex: '', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: '', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '提现单号', dataIndex: 'cashOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '提现时间', dataIndex: 'cashOutDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '申请提现金额', dataIndex: 'amount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text,2) || '--' } },
+        { title: '开户名', dataIndex: 'bankAccount', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '银行卡号', dataIndex: 'bankCard', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '提现人', dataIndex: 'operName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'state', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'remarks', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         const _this = this
         _this.disabled = true
         _this.spinning = true
-        return new Promise(function (resolve, reject) {
-          const data = {
-            list: [{ id: 1, createDate: '2020-08-09' }]
+        const paramsPage = Object.assign(parameter,this.queryParam) //  有分页
+        paramsPage.merchantSn=this.pageInfo?this.pageInfo.merchantSn:''
+         paramsPage.merchantType='DEALER'
+        return queryMerchantCashOutPage(paramsPage).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
           }
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
-          }
-          _this.spinning = false
-          _this.disabled = false
-          resolve(data)
+          this.spinning = false
+          return data
         })
-
-        // const paramsPage = Object.assign(this.queryParam) //  有分页
-        // return reportSalesReturnThjdReportList(paramsPage).then(res => {
-        //   let data
-        //   if (res.status == 200) {
-        //     data = res.data
-        //     // this.getCount(paramsPage)
-        //     const no = (data.pageNo - 1) * data.pageSize
-        //     for (var i = 0; i < data.list.length; i++) {
-        //       data.list[i].no = no + i + 1
-        //     }
-        //     this.disabled = false
-        //   }
-        //   this.spinning = false
-        //   return data
-        // })
       }
     }
   },
   methods: {
     // 时间改变
     dateChange (date) {
-
+      console.log(date,'date')
+      this.queryParam.beginDate=moment(date[0]).format('YYYY-MM-DD') 
+      this.queryParam.endDate=moment(date[1]).format('YYYY-MM-DD') 
     },
     // 禁止选择今天之后的日期
     disabledDate (current) {
       return current && current > moment().endOf('day')
     },
+    getPageInfo () {
+      merchantCashOutDetail({}).then(res => {
+        console.log(res, '===========')
+        if (res.status == 200) {
+          this.pageInfo = res.data
+          this.$refs.table.refresh(true)
+        } else {
+          this.pageInfo = null
+        }
+      })
+    },
     // 重置
     resetSearchForm () {
       this.time = []
+      this.$refs.table.refresh(true)
     },
     // 申请提现
     handleTX () {
@@ -131,6 +142,7 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      _this.getPageInfo()
     }
   },
   mounted () {