同步代码
This commit is contained in:
108
pageCreditBuyer/components/my-action-sheet.vue
Normal file
108
pageCreditBuyer/components/my-action-sheet.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view class="action-sheet" @tap="close" v-if="show">
|
||||
<view class="box">
|
||||
<slot name="title">
|
||||
|
||||
</slot>
|
||||
<view class="item" @tap.stop="itemClick(index)" v-for="(item,index) in props.list" :key="index">
|
||||
<button class="bg-fff btn" hover-class="btn-hover-class" :style="{color:index==0?'red':''}" :class="{'color-main':active==index}">{{item}}</button>
|
||||
</view>
|
||||
<view class="bock-gary"></view>
|
||||
<view class="cancel-btn" @tap="close">
|
||||
<button>取消</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props=defineProps({
|
||||
//那个按钮文字高亮
|
||||
active:{
|
||||
type:Number,
|
||||
default:-1
|
||||
},
|
||||
autoClose:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
title:{
|
||||
type:String,
|
||||
default:'耗材报损'
|
||||
},
|
||||
list:{
|
||||
type:Array,
|
||||
default:['编辑','删除']
|
||||
},
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
const emits=defineEmits(['itemClick','close'])
|
||||
let show=ref(false)
|
||||
function open(){
|
||||
show.value=true
|
||||
}
|
||||
function close(){
|
||||
show.value=false
|
||||
emits('close')
|
||||
}
|
||||
function itemClick(index){
|
||||
if(props.autoClose){
|
||||
close()
|
||||
}
|
||||
emits('itemClick',index)
|
||||
}
|
||||
defineExpose({
|
||||
open,close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$bg:rgb(240, 240, 240);
|
||||
.action-sheet{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
background-color: rgba(51,51,51,.5);
|
||||
z-index: 999;
|
||||
.box{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
/* #ifndef H5 */
|
||||
padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
||||
/* #endif */
|
||||
|
||||
.item{
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
border-bottom: 1px solid $bg;
|
||||
.btn{
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bock-gary{
|
||||
background-color: $bg;
|
||||
height: 20rpx;
|
||||
}
|
||||
.cancel-btn{
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.btn-hover-class{
|
||||
background-color: rgb(222, 222, 222);
|
||||
}
|
||||
</style>
|
||||
448
pageCreditBuyer/components/my-date-pickerview.vue
Normal file
448
pageCreditBuyer/components/my-date-pickerview.vue
Normal file
@@ -0,0 +1,448 @@
|
||||
<template>
|
||||
<view class="mask" v-if="show" @tap="close">
|
||||
<view class="box" @tap.stop="nullFunction">
|
||||
<view class="u-flex u-relative u-row-center u-p-30 top">
|
||||
<view class="font-bold u-font-32">筛选日期时间</view>
|
||||
<view class="close" @tap="close">
|
||||
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view> -->
|
||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
||||
class="picker-view">
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
||||
</picker-view-column>
|
||||
<!-- <picker-view-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
<view class="u-text-center color-999">至</view>
|
||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
||||
class="picker-view">
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
||||
</picker-view-column>
|
||||
<!-- <picker-view-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
|
||||
<!-- 站位 -->
|
||||
<view style="height: 80px;"></view>
|
||||
<view class="fixed_b">
|
||||
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from "@/components/my-components/my-button.vue"
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const $nowDate = new Date()
|
||||
const nowDate = {
|
||||
year: $nowDate.getFullYear(),
|
||||
month: $nowDate.getMonth() + 1,
|
||||
day: $nowDate.getDate(),
|
||||
hours: $nowDate.getHours(),
|
||||
minutes: $nowDate.getMinutes(),
|
||||
seconds: $nowDate.getSeconds()
|
||||
}
|
||||
const yearsLen = 30
|
||||
const years = new Array(yearsLen).fill(1).map((v, index) => {
|
||||
return nowDate.year - index
|
||||
}).reverse()
|
||||
const months = new Array(12).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
})
|
||||
const days = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const days1 = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const hours = new Array(24).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const fastTime = reactive([{
|
||||
title: '今日',
|
||||
key: 'now'
|
||||
},
|
||||
{
|
||||
title: '昨日',
|
||||
key: 'prve'
|
||||
},
|
||||
{
|
||||
title: '本月',
|
||||
key: 'nowMonth'
|
||||
},
|
||||
{
|
||||
title: '上月',
|
||||
key: 'prveMonth'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
|
||||
function setPrveDay() {
|
||||
|
||||
}
|
||||
|
||||
function setNowMoneth() {
|
||||
|
||||
}
|
||||
|
||||
function setprveMoneth() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function setDay(start, end) {
|
||||
value.value = [
|
||||
start.year,
|
||||
start.month,
|
||||
start.day,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
value1.value = [
|
||||
end.year,
|
||||
end.month,
|
||||
end.day,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
]
|
||||
}
|
||||
|
||||
function changeTime(key) {
|
||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
||||
const nowMonthIndex = nowDate.month - 1
|
||||
const nowDayIndex = nowDate.day - 1
|
||||
const dataMap = {
|
||||
now: function() {
|
||||
return {
|
||||
start: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
},
|
||||
end: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
}
|
||||
}
|
||||
},
|
||||
prve: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year,nowDate.month,nowDate.day,0,0,0).getTime()-oneDay)
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
}
|
||||
}
|
||||
},
|
||||
nowMonth: function() {
|
||||
return {
|
||||
start: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day:new Date(nowDate.year, nowDate.month , 0).getDate() - 1
|
||||
}
|
||||
}
|
||||
},
|
||||
prveMonth: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year, nowDate.month-1,0,0,0).getTime()-oneDay)
|
||||
console.log(date.getMonth());
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: date.getDate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = dataMap[key]()
|
||||
setDay(data.start, data.end)
|
||||
changeDays(false,value.value)
|
||||
changeDays(true,value1.value)
|
||||
|
||||
console.log(value1.value);
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
let value = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
])
|
||||
let value1 = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
])
|
||||
|
||||
let show = ref(false)
|
||||
const emits = defineEmits('close', 'open', 'confirm')
|
||||
|
||||
function toggle() {
|
||||
show.value = !show.value
|
||||
if (show.value) {
|
||||
emits('open', true)
|
||||
} else {
|
||||
emits('close', false)
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
emits('close', false)
|
||||
}
|
||||
|
||||
function open() {
|
||||
show.value = true
|
||||
emits('open', true)
|
||||
}
|
||||
|
||||
function returnDateString(arr) {
|
||||
const year = years[arr[0]]
|
||||
const month = arr[1] + 1
|
||||
const day = arr[2] + 1
|
||||
const hour = ('0' + arr[3]).slice(-2)
|
||||
const min = ('0' + arr[4]).slice(-2)
|
||||
const sen = ('0' + arr[5]).slice(-2)
|
||||
return `${year}-${month}-${day} ${hour}:${min}:${sen}`
|
||||
}
|
||||
|
||||
|
||||
function confirm(e) {
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
console.log(start);
|
||||
console.log(end);
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
|
||||
function returnMonthStart(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||
}
|
||||
|
||||
function returnMonthEnd(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||
}
|
||||
|
||||
function changeDays(isDays1,arr){
|
||||
const end = returnMonthEnd(arr)
|
||||
if (end) {
|
||||
if(isDays1){
|
||||
days1.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}else{
|
||||
days.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function bindChange(e) {
|
||||
value.value = e.detail.value
|
||||
changeDays(false, e.detail.value)
|
||||
}
|
||||
|
||||
function bindChange1(e) {
|
||||
value1.value = e.detail.value
|
||||
changeDays(true, e.detail.value)
|
||||
}
|
||||
|
||||
function getDayDate(date = new Date(), type) {
|
||||
const now = date
|
||||
if (type === 'start') {
|
||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
return startOfDay
|
||||
}
|
||||
if (type === 'end') {
|
||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
||||
return endOfDay;
|
||||
}
|
||||
}
|
||||
|
||||
function getMonthArea(date = new Date(), type) {
|
||||
let now = date
|
||||
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
||||
if (type === 'start') {
|
||||
return currentMonthStart
|
||||
}
|
||||
if (type === 'end') {
|
||||
return currentMonthEnd;
|
||||
}
|
||||
return {
|
||||
start: currentMonthStart,
|
||||
end: currentMonthEnd
|
||||
};
|
||||
}
|
||||
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
function pickend(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
function pickend1(e) {
|
||||
console.log(e);
|
||||
}
|
||||
defineExpose({
|
||||
close,
|
||||
open,
|
||||
confirm,
|
||||
toggle
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.fastTime {
|
||||
.item {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 6rpx 40rpx;
|
||||
border-radius: 6rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 30rpx;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
background-color: rgba(0, 0, 0, .7);
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fixed_b {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 30rpx;
|
||||
z-index: 100;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.picker-view {
|
||||
width: 750rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
line-height: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
275
pageCreditBuyer/components/my-repayment.vue
Normal file
275
pageCreditBuyer/components/my-repayment.vue
Normal file
@@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<up-popup :show="show" @close="close" round="20" mode="center" customStyle="width: 80%;">
|
||||
<view class="head">
|
||||
<text></text>
|
||||
<text class="title">{{pageData.formData.orderId?'挂账付款':'挂账还款'}}</text>
|
||||
<text></text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<up-form
|
||||
labelPosition="top"
|
||||
labelWidth="120"
|
||||
required
|
||||
:model="pageData.formData"
|
||||
:rules="pageData.rules"
|
||||
ref="uFormRef"
|
||||
:labelStyle="{fontSize: '28rpx',color: '#333',fontWeight: 'bold'}"
|
||||
>
|
||||
<view class="card top" v-if="pageData.formData.repaymentMethod == 'total'">
|
||||
<view>
|
||||
<text class="label">挂账人</text>
|
||||
<text class="value">{{pageData.debtor.debtor}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">挂账金额</text>
|
||||
<text class="value">{{pageData.debtor.owedAmount || 0}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">账户余额</text>
|
||||
<text class="value">{{pageData.debtor.accountBalance || 0}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<up-form-item label="还款方式" labelPosition="left" v-if="pageData.formData.repaymentMethod == 'total'">
|
||||
<view style="width: 100%;display: flex;justify-content: flex-end;">
|
||||
<up-radio-group v-model="pageData.formData.repaymentMethod" placement="row" style="justify-content: flex-end;">
|
||||
<view v-for="(item, index) in pageData.repaymentMethodList" :key="index">
|
||||
<up-radio
|
||||
v-if="pageData.formData.repaymentMethod == item.value"
|
||||
:label="item.label"
|
||||
:name="item.value"
|
||||
></up-radio>
|
||||
</view>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</up-form-item>
|
||||
<up-form-item label="还款金额(¥)" prop="repaymentAmount">
|
||||
<up-input v-model="pageData.formData.repaymentAmount" type="number" placeholder="请输入金额" customStyle="padding: 0!important;">
|
||||
<template #prefix>
|
||||
<up-button color="#e5e5e5" customStyle="font-size:32rpx;color: #999;width: 124rpx;margin-right: 10rpx;" :hairline="false">¥</up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="支付方式" prop="paymentMethod">
|
||||
<up-input v-model="pageData.formData.paymentMethod" placeholder="请输入支付方式"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="备注" prop="remark">
|
||||
<up-input v-model="pageData.formData.remark" placeholder="请输入备注"></up-input>
|
||||
</up-form-item>
|
||||
</view>
|
||||
|
||||
</up-form>
|
||||
<view class="bottomPop">
|
||||
<view class="save" @click="affirm">保存</view>
|
||||
<view class="cancel" @click="close">取消</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive,ref } from 'vue';
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { creditRePayment, creditPayment } from '@/http/yskApi/credit.js'
|
||||
const props=defineProps({
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
const emits=defineEmits(['close', "affirm"])
|
||||
const pageData = reactive({
|
||||
id: null,
|
||||
title: "",
|
||||
debtor: {
|
||||
debtor: '',
|
||||
formData: 0,
|
||||
accountBalance: 0,
|
||||
},
|
||||
repaymentMethodList: [
|
||||
{ label: '按总金额还款', value: 'total' },
|
||||
{ label: '按订单还款', value: 'order' }
|
||||
],
|
||||
formData: {
|
||||
id: null,
|
||||
creditBuyerId: null,
|
||||
orderId: null,
|
||||
repaymentMethod: '',
|
||||
repaymentAmount: '',
|
||||
paymentMethod: '',
|
||||
remark: ''
|
||||
},
|
||||
rules: {
|
||||
'repaymentAmount': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入金额',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
'paymentMethod': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入支付方式',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
// 表单引用
|
||||
const uFormRef = ref(null);
|
||||
let show=ref(false)
|
||||
|
||||
function open(options){
|
||||
show.value = true;
|
||||
console.log(options)
|
||||
if (options.creditBuyerId) {
|
||||
pageData.formData.creditBuyerId = options.creditBuyerId;
|
||||
pageData.formData.orderId = options.order.orderId;
|
||||
pageData.formData.repaymentMethod = options.repaymentMethod;
|
||||
|
||||
} else {
|
||||
pageData.formData.id = options.id;
|
||||
pageData.formData.repaymentMethod = options.repaymentMethod;
|
||||
pageData.debtor.debtor = options.debtor;
|
||||
pageData.debtor.owedAmount = options.owedAmount;
|
||||
pageData.debtor.accountBalance = options.accountBalance;
|
||||
}
|
||||
pageData.formData.repaymentAmount = "";
|
||||
pageData.formData.paymentMethod = "";
|
||||
pageData.formData.remark = "";
|
||||
}
|
||||
|
||||
function close(){
|
||||
show.value = false;
|
||||
emits('close')
|
||||
}
|
||||
/**
|
||||
* 确认
|
||||
*/
|
||||
let affirm = debounce(() => {
|
||||
uFormRef.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
console.log(pageData.formData)
|
||||
let params = {
|
||||
...pageData.formData
|
||||
}
|
||||
if ( !pageData.formData.orderId ) {
|
||||
creditRePayment(params).then((res) => {
|
||||
console.log(res.repaymentCount > 0)
|
||||
if (res.repaymentCount > 0) {
|
||||
uni.$u.toast('还款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
creditPayment(params).then((res) => {
|
||||
if (!res.repaymentMsg) {
|
||||
uni.$u.toast('付款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 处理验证错误
|
||||
});
|
||||
|
||||
},1000)
|
||||
defineExpose({
|
||||
open,close,affirm
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.head{
|
||||
display: flex;
|
||||
padding: 32rpx 28rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.content{
|
||||
padding: 0 32rpx 32rpx 32rpx;
|
||||
.card{
|
||||
background-color: #fff;
|
||||
margin-bottom: 42rpx;
|
||||
}
|
||||
.card.top{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
background: #F8F8FA;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 48rpx;
|
||||
padding: 16rpx 0 ;
|
||||
>view{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.label{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.value{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
.bottomPop{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
>view {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.save{
|
||||
color: #fff;
|
||||
background: #318AFE;
|
||||
}
|
||||
.cancel{
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user