新增支付类型挂账
This commit is contained in:
parent
608c41de4f
commit
00172f75e7
|
|
@ -29,7 +29,7 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
|||
# VITE_API_URL = 'http://192.168.1.34:10589/cashier-client'
|
||||
|
||||
# 测试
|
||||
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
|
||||
VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
|
||||
|
||||
# 预发布
|
||||
# VITE_API_URL = 'https://pre-cashierclient.sxczgkj.cn/cashier-client'
|
||||
|
|
@ -38,4 +38,4 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
|||
# VITE_API_URL = 'https://36z1017t45.goho.co/cashier-client'
|
||||
|
||||
# 正式
|
||||
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
|
||||
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
|
||||
|
|
@ -142,3 +142,29 @@ export function vipPay(data) {
|
|||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人-分页
|
||||
* @param {*} params
|
||||
* @returns
|
||||
*/
|
||||
export function buyerPage(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/credit/buyer/page",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账支付
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export function payCreditPay(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/pay/creditPay",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@
|
|||
</div>
|
||||
<span class="title">{{ item.payName }}</span>
|
||||
</div>
|
||||
<div class="item" :class="{ active: payActive == 'buyer' }"
|
||||
@click="payTypeChange('buyer', { payType: 'buyer' })">
|
||||
<div class="icon">
|
||||
<div class="img"
|
||||
style="display: flex;align-items: center;justify-content: center;background-color: var(--el-color-danger);color: #fff;font-size: 24px;border-radius: 11px;">
|
||||
挂
|
||||
</div>
|
||||
</div>
|
||||
<span class="title">挂账</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input_wrap">
|
||||
<div class="input" style="flex: 1;">储值:¥{{ money }}</div>
|
||||
|
|
@ -83,11 +93,56 @@
|
|||
<el-pagination layout="prev, pager, next, total" background style="margin-top: 20px;"
|
||||
:total="Number(tableData.total)" v-model:current-page="tableData.page" @current-change="getMemberList" />
|
||||
</el-dialog>
|
||||
<!-- 选择挂账人员 -->
|
||||
<el-dialog title="挂账" top="3vh" v-model="showBuyer" width="90%" @closed="resetBuyerTable">
|
||||
<el-form inline>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入挂账人或手机号搜索" v-model="buyerTable.keywords" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getBuyerList">搜索</el-button>
|
||||
<el-button @click="resetBuyerTable">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="buyerTable.list" height="440px" border stripe v-loading="buyerTable.loading">
|
||||
<el-table-column prop="debtor" label="挂账人" />
|
||||
<el-table-column prop="mobile" label="手机" width="150px" />
|
||||
<el-table-column prop="position" label="职位" width="120px" />
|
||||
<el-table-column prop="repaymentMethod" label="还款方式" width="160px">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.repaymentMethod == 'total'">按总金额还款</template>
|
||||
<template v-if="scope.row.repaymentMethod == 'order'">按订单还款</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="creditAmount" label="挂账额度" width="160px">
|
||||
<template v-slot="scope">
|
||||
¥{{ formatDecimal(scope.row.creditAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remainingAmount" label="剩余挂账额度" width="160px">
|
||||
<template v-slot="scope">
|
||||
¥{{ formatDecimal(scope.row.remainingAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="accumulateAmount" label="累计挂账金额" width="160px">
|
||||
<template v-slot="scope">
|
||||
¥{{ formatDecimal(scope.row.accumulateAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120px" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" @click="payCreditPayHandle(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination layout="prev, pager, next, total" background style="margin-top: 20px;"
|
||||
:total="Number(buyerTable.total)" v-model:current-page="buyerTable.page" @current-change="getBuyerList" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, computed, watch, reactive } from 'vue'
|
||||
import { queryPayType, accountPay, cashPay, vipPay } from '@/api/pay'
|
||||
import { queryPayType, accountPay, cashPay, vipPay, buyerPage, payCreditPay } from '@/api/pay'
|
||||
import { queryMembermember, createMembermember, membermemberScanPay, accountPaymember } from '@/api/member/index.js'
|
||||
import { useUser } from "@/store/user.js"
|
||||
import { clearNoNum, formatDecimal } from '@/utils'
|
||||
|
|
@ -96,6 +151,7 @@ import scanModal from '@/components/payCard/scanModal.vue'
|
|||
import { ElMessage } from "element-plus";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
import { fa } from 'element-plus/es/locale/index.mjs'
|
||||
|
||||
const global = useGlobal()
|
||||
|
||||
|
|
@ -143,6 +199,76 @@ const payType = ref('')
|
|||
const payList = ref([])
|
||||
const payLoading = ref(false)
|
||||
|
||||
// 挂账人 start
|
||||
const showBuyer = ref(false)
|
||||
const buyerTable = reactive({
|
||||
keywords: '',
|
||||
loading: false,
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
list: []
|
||||
})
|
||||
|
||||
// 显示挂账人
|
||||
function showBuyerHandle() {
|
||||
showBuyer.value = true
|
||||
getBuyerList()
|
||||
}
|
||||
|
||||
//
|
||||
function resetBuyerTable() {
|
||||
buyerTable.keywords = ''
|
||||
buyerTable.page = 1
|
||||
getBuyerList()
|
||||
}
|
||||
|
||||
// 获取挂账人列表
|
||||
async function getBuyerList() {
|
||||
try {
|
||||
buyerTable.loading = true
|
||||
const res = await buyerPage({
|
||||
page: buyerTable.page,
|
||||
size: buyerTable.size,
|
||||
shopId: store.userInfo.shopId,
|
||||
keywords: buyerTable.keywords,
|
||||
status: 1,
|
||||
responsiblePerson: '',
|
||||
repaymentStatus: ''
|
||||
})
|
||||
buyerTable.loading = false
|
||||
buyerTable.list = res.list
|
||||
buyerTable.total = res.total
|
||||
} catch (error) {
|
||||
buyerTable.loading = false
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 选择挂账人支付
|
||||
async function payCreditPayHandle(row) {
|
||||
try {
|
||||
payLoading.value = true
|
||||
buyerTable.loading = true
|
||||
const res = await payCreditPay({
|
||||
creditBuyerId: row.id,
|
||||
orderId: props.orderId,
|
||||
payAmount: props.discount > 0 ? money.value : '',
|
||||
discountAmount: props.discount > 0 ? formatDecimal(props.amount - money.value) : ''
|
||||
})
|
||||
showBuyer.value = false
|
||||
payLoading.value = false
|
||||
buyerTable.loading = false
|
||||
ElMessage.success('支付成功')
|
||||
emit('paySuccess')
|
||||
} catch (error) {
|
||||
buyerTable.loading = false
|
||||
payLoading.value = false
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
// 显示选择挂账人 end
|
||||
|
||||
// 获得扫码值
|
||||
function scanCodeSuccess() {
|
||||
emit('paySuccess')
|
||||
|
|
@ -162,8 +288,13 @@ async function payTypeChange(index, item) {
|
|||
showDialog.value = true
|
||||
getMemberList()
|
||||
}
|
||||
if (payList.value[payActive.value].payType == 'deposit' && !global.orderMemberInfo.id) {
|
||||
scanModalRef.value.show()
|
||||
if (item.payType == 'buyer') {
|
||||
showBuyerHandle()
|
||||
}
|
||||
if (payActive.value != 'buyer') {
|
||||
if (payList.value[payActive.value].payType == 'deposit' && !global.orderMemberInfo.id) {
|
||||
scanModalRef.value.show()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -174,9 +305,10 @@ async function payTypeChange(index, item) {
|
|||
async function confirmOrder() {
|
||||
try {
|
||||
await staffPermission('yun_xu_shou_kuan')
|
||||
|
||||
if (payLoading.value) return
|
||||
if (payList.value[payActive.value].payType == 'scanCode') {
|
||||
if (payActive.value == 'buyer') {
|
||||
showBuyerHandle()
|
||||
} else if (payList.value[payActive.value].payType == 'scanCode') {
|
||||
scanModalRef.value.show()
|
||||
} else {
|
||||
// if (money.value < props.amount) return
|
||||
|
|
|
|||
Loading…
Reference in New Issue