11.18 充值退款功能添加

formal_basic
shilei 6 days ago
parent a99f060fd9
commit 13e5beaf97

@ -233,6 +233,14 @@
"enablePullDownRefresh": false
}
},
{
"path": "billingPage/addInvoice/addInvoice",
"style": {
"navigationBarTitleText": "开发票",
"enablePullDownRefresh": false
}
},
{
"path": "billingPage/billingMean/billingMean",

@ -236,7 +236,19 @@
});
istipsonly.value++
}
} else if (res.data.data.orderStatus == 5) {
uni.showModal({
title: '支付结果',
showCancel: false,
content: '已自动支付完成,请点击确认退出当前页面',
success: function(res) {
if (res.confirm) {
uni.switchTab({
url: '/pages/index/index'
})
}
}
});
}
}).catch((err) => {
uni.showToast({

@ -113,6 +113,14 @@
</view>
<view><text class="lg text-gray cuIcon-right padding-top-xs"></text></view>
</view>
<view class="flex padding-tb-sm justify-between" @click="goAddinvoice">
<view class="flex">
<uv-icon name="setting" color="#2cc06c" size="20"></uv-icon>
<!-- <view class="titleFont">其他设置</view> -->
<view class="titleFont">开发票</view>
</view>
<view><text class="lg text-gray cuIcon-right padding-top-xs"></text></view>
</view>
<view class="flex padding-tb-sm justify-between" @click="goSetting">
<view class="flex">
<uv-icon name="setting" color="#2cc06c" size="20"></uv-icon>
@ -232,6 +240,26 @@
url: '/pages/userCenter/about/about'
})
}
const goAddinvoice = () => {
if (!uni.getStorageSync("userInfo")) {
uni.showToast({
title: '请先完成登录',
duration: 2000,
icon: 'error'
});
return;
} else {
uni.navigateTo({
url: '/pagesCenter/billingPage/addInvoice/addInvoice'
})
}
// else if (realNameAuthFlag.value != 1) {
// errornotify.value.show()
// return
// }
}
const gologin = () => {
uni.navigateTo({
url: '../../pagesCenter/login/enter'

@ -23,6 +23,7 @@
<view class="tab_cls">
<uv-subsection :list="tab_list" :current="tab_current" @change="tab_change"></uv-subsection>
</view>
<!-- refundStatus == 0 才可以退款 -->
<!-- <view class="action padding-lr-sm padding-bottom-sm"><text class="cuIcon-titles textBlue"></text>充值明细</view> -->
<view class="content_pay">
<view class="cu-card " v-for="(item,index) in payData" :key="index" v-if="payData.length!=0">
@ -30,12 +31,13 @@
<view class="flex padding-sm justify-between">
<!-- left -->
<view>
<view class="flex">
<!-- <view class="pay">{{item.tradeType== 3?'平台充值':'个人充值'}}</view> -->
<view class="flex" style="align-items: center;">
<view class="payState">
付款成功
</view>
<text class="refund_moneny"
v-if="tab_current == 0 && money >= item.payPrice / 100 && item.refundStatus == 0"
@click="handle_refund(item.id)">退款</text>
</view>
<view class="margin-top-sm payTime" v-if="tab_current == 0">{{item.payTime}}</view>
<view class="margin-top-sm payTime" v-else>{{item.createTime}}</view>
@ -43,7 +45,8 @@
<!-- right -->
<view>
<view class="text-price payMoney">
{{tab_current == 0? (item.payPrice / 100): (item.price / 100) }}</view>
{{tab_current == 0? (item.payPrice / 100): (item.price / 100) }}
</view>
<view class="allMoney" v-if="tab_current == 0">
<text>实际到账金额</text>
{{item.totalPrice?item.totalPrice / 100: 0}}
@ -91,7 +94,7 @@
const tab_current = ref(0)
onLoad(() => {
handle_bindType()
getPayconsumption()
// getPayconsumption()
})
onShow(() => {
getPayList(0)
@ -122,6 +125,59 @@
url: '/pages/index/recharge/recharge'
})
}
const handle_refund = (id) => {
uni.showModal({
title: '提示',
content: '是否确认提交退款申请?',
success: function(res) {
if (res.confirm) {
handle_refund_submit(id)
} else if (res.cancel) {
// console.log('');
}
}
});
}
const handle_refund_submit = async (id) => {
await uni.$request({
url: config.baseUrl +
`app-api/pay/wallet-recharge/refund?id=${id}`
}).then(res => {
// console.log(res, '退');
uni.showLoading({
title: '申请中...请稍后'
})
if (res.data.code == 0) {
setTimeout(() => {
uni.showToast({
title: '申请成功',
duration: 2000,
icon: 'success'
});
}, 2000)
setTimeout(() => {
handle_bindType()
uni.hideLoading()
}, 4000)
} else {
setTimeout(() => {
uni.showToast({
title: res.data.msg,
duration: 2000,
icon: 'error'
});
}, 2000)
setTimeout(() => {
handle_bindType()
uni.hideLoading()
}, 4000)
}
// if()
})
}
const getPayList = async (type) => {
let param = {
pageNo: pageNo.value,
@ -168,7 +224,7 @@
data,
code
} = await PayWalletApi.getWalletTransactionPage(param)
console.log(data, 'data')
// console.log(data, 'data')
}
onReachBottom(async () => {
if (payData.value.length == totalPages.value) {
@ -303,6 +359,13 @@
overflow: hidden;
overflow-y: scroll;
}
.refund_moneny {
font-size: 13px;
text-decoration: underline;
margin-left: 10rpx;
color: red;
}
</style>
<style lang="scss">
page {

@ -15,33 +15,33 @@
</view>
</view>
<view class="line line-icon ">
<u-form-item :required="true" label="发票抬头" prop="userInfo.invoiceHeader" borderBottom ref="item1">
<u--input v-model="model1.userInfo.invoiceHeader" border="none" inputAlign='right'
<u-form-item :required="true" label="发票抬头" prop="userInfo.invoiceTitle" borderBottom ref="item1">
<u--input v-model="model1.userInfo.invoiceTitle" border="none" inputAlign='right'
placeholder="请填写发票抬头"></u--input>
</u-form-item>
</view>
<view v-if="checked==1">
<view class="line">
<u-form-item :required="true" label="税号" prop="userInfo.taxId" borderBottom ref="item1">
<u--input v-model="model1.userInfo.taxId" border="none" inputAlign='right'
<u-form-item :required="true" label="税号" prop="userInfo.dutyNumber" borderBottom ref="item1">
<u--input v-model="model1.userInfo.dutyNumber" border="none" inputAlign='right'
placeholder="请填写纳税人识别号"></u--input>
</u-form-item>
</view>
<view class="line">
<u-form-item label="注册地址" prop="userInfo.address" borderBottom ref="item1">
<u--input v-model="model1.userInfo.address" border="none" inputAlign='right'
<u-form-item label="注册地址" prop="userInfo.registeredAddress" borderBottom ref="item1">
<u--input v-model="model1.userInfo.registeredAddress" border="none" inputAlign='right'
placeholder="请填写公司注册地址"></u--input>
</u-form-item>
</view>
<view class="line">
<u-form-item label="公司开户行" prop="userInfo.bank" borderBottom ref="item1">
<u--input v-model="model1.userInfo.bank" border="none" inputAlign='right'
<u-form-item label="公司开户行" prop="userInfo.bankOfDeposit" borderBottom ref="item1">
<u--input v-model="model1.userInfo.bankOfDeposit" border="none" inputAlign='right'
placeholder="请填写银行名称"> </u--input>
</u-form-item>
</view>
<view class="line">
<u-form-item label="开户行账户" prop="userInfo.cardNo" borderBottom ref="item1">
<u--input v-model="model1.userInfo.cardNo" border="none" inputAlign='right'
<u-form-item label="开户行账户" prop="userInfo.openBankAccount" borderBottom ref="item1">
<u--input v-model="model1.userInfo.openBankAccount" border="none" inputAlign='right'
placeholder="请填写银行账号"></u--input>
</u-form-item>
</view>
@ -49,7 +49,7 @@
</u--form>
</view>
<!-- 邮寄信息 -->
<view class="content-title">
<!-- <view class="content-title">
<view class="content-name">
<view class="orders-line"></view>
<view>邮寄信息</view>
@ -88,7 +88,7 @@
<view class="">
<u-switch v-model="switchValue" @change="switchVhange"></u-switch>
</view>
</view>
</view> -->
<!-- position bottom -->
<view class="footer-box">
<view>
@ -127,11 +127,11 @@
const formAddress = ref(null);
const model1 = reactive({
userInfo: {
invoiceHeader: '',
taxId: '',
address: '',
bank: '',
cardNo: '',
invoiceTitle: '',
dutyNumber: '',
registeredAddress: '',
bankOfDeposit: '',
openBankAccount: '',
}
})
const model2 = reactive({
@ -147,12 +147,12 @@
const saveTaxid = ref('')
//
const rules = ref({
'userInfo.invoiceHeader': {
'userInfo.invoiceTitle': {
required: true,
message: '请填写发票抬头',
trigger: ['blur', 'change']
},
'userInfo.taxId': {
'userInfo.dutyNumber': {
required: true,
pattern: /^[0-9a-zA-Z]*$/g,
transform(value) {
@ -187,33 +187,34 @@
//
onLoad((option) => {
console.log(option, 'option');
if (option.detail) {
let detail = JSON.parse(option.detail)
model1.userInfo.invoiceHeader = detail.invoiceHeader
model1.userInfo.taxId = detail.taxId
model1.userInfo.address = detail.address
model1.userInfo.bank = detail.bank
model1.userInfo.cardNo = detail.cardNo
model2.userInfo2.address = detail.shippingAddress
model2.userInfo2.phone = detail.contactPhone
model2.userInfo2.contacts = detail.recipient
email.value = detail.email
if (detail.type === 1) {
isChecked.value = 0
checked.value = 1
} else {
isChecked.value = 1
checked.value = 2
}
if (detail.isDefault === 1) {
switchValue.value = true
} else {
switchValue.value = false
}
updataId.value = detail.id
console.log('JSON.parse(option.detail)', JSON.parse(option.detail));
}
// console.log(option, 'option');
// if (option.detail) {
// let detail = JSON.parse(option.detail)
// model1.userInfo.invoiceHeader = detail.invoiceHeader
// model1.userInfo.taxId = detail.taxId
// model1.userInfo.address = detail.address
// model1.userInfo.bank = detail.bank
// model1.userInfo.cardNo = detail.cardNo
// model2.userInfo2.address = detail.shippingAddress
// model2.userInfo2.phone = detail.contactPhone
// model2.userInfo2.contacts = detail.recipient
// email.value = detail.email
// if (detail.type === 1) {
// isChecked.value = 0
// checked.value = 1
// } else {
// isChecked.value = 1
// checked.value = 2
// }
// if (detail.isDefault === 1) {
// switchValue.value = true
// } else {
// switchValue.value = false
// }
// updataId.value = detail.id
// console.log('JSON.parse(option.detail)', JSON.parse(option.detail));
// }
handle_start_access_token()
})
//
watch(checked, (newVal, oldVal) => {
@ -248,6 +249,15 @@
}
})
const handle_start_access_token = async () => {
uni.$request({
url: "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx7b910c0c240c2676&secret=APPSECRET",
method: 'GET'
}).then(res => {
console.log(res, '===发票步骤1====?');
})
}
//
const onChange = (e) => {
@ -276,68 +286,49 @@
console.log(err, '校验失败1');
})
})
let p2 = new Promise((resolve, reject) => {
formAddress.value.validate().then(res => {
resolve()
}).catch(err => {
console.log(err, '校验失败2');
})
})
Promise.all([p1, p2]).then((result) => {
console.log('xxxxxxxxx', model1.userInfo.invoiceHeader);
if (checked.value == 2) {
model1.userInfo.taxId = ''
model1.userInfo.address = ''
model1.userInfo.bank = ''
model1.userInfo.cardNo = ''
}
// let p2 = new Promise((resolve, reject) => {
// formAddress.value.validate().then(res => {
// resolve()
// }).catch(err => {
// console.log(err, '2');
// })
// })
// Promise.all([p1, p2]).then((result) => {
Promise.all([p1]).then((result) => {
// console.log('xxxxxxxxx', model1.userInfo.invoiceHeader);
// if (checked.value == 2) {
// model1.userInfo.taxId = ''
// model1.userInfo.address = ''
// model1.userInfo.bank = ''
// model1.userInfo.cardNo = ''
// }
let data = {
id: updataId.value,
orderNo: 12,
invoiceStatus: 0,
type: checked.value,
isDefault: isDefault.value,
email: email.value,
orderType: 1,
// 1
invoiceHeader: model1.userInfo.invoiceHeader,
taxId: model1.userInfo.taxId,
address: model1.userInfo.address,
bank: model1.userInfo.bank,
cardNo: model1.userInfo.cardNo,
// 2
shippingAddress: model2.userInfo2.address,
contactPhone: model2.userInfo2.phone,
recipient: model2.userInfo2.contacts,
invoiceTitle: model1.userInfo.invoiceTitle,
dutyNumber: model1.userInfo.dutyNumber,
registeredAddress: model1.userInfo.registeredAddress,
bankOfDeposit: model1.userInfo.bankOfDeposit,
openBankAccount: model1.userInfo.openBankAccount,
}
// uni.$u.toast('')
if (updataId.value) {
uni.$request({
url: config.wxUrl_pay + "pay/invoice/modifyHeader",
method: 'POST',
data: data,
}).then(res => {
uni.$u.toast(res.data.msg)
setTimeout(function() {
uni.navigateBack({
delta: 1,
});
}, 500)
console.log(res.data.msg, '=======?');
})
} else {
uni.$request({
url: config.wxUrl_pay + "pay/invoice/addHeader",
method: 'POST',
data: data,
}).then(res => {
uni.$u.toast(res.data.msg)
setTimeout(function() {
uni.navigateBack({
delta: 1,
});
}, 500)
console.log(res.data.msg, '=======?');
})
}
uni.$request({
url: config.baseUrl + "app-api/cloud/invoice/create",
method: 'POST',
data: data,
}).then(res => {
uni.$u.toast(res.data.msg)
// setTimeout(function() {
// uni.navigateBack({
// delta: 1,
// });
// }, 500)
console.log(res.data.msg, '=======?');
})
}).catch((error) => {
console.log(error)

@ -261,7 +261,7 @@
data,
code
} = await PayOrderApi.getOrder(id);
console.log(data, '设置支付订单信息')
// console.log(data, '')
if (code !== 0 || !data) {
state.payStatus = -2;
return;

@ -75,7 +75,7 @@ http.interceptors.request.use(
showAuthModal();
return Promise.reject();
}
console.log(config,'config')
// console.log(config,'config')
// 自定义处理【loading 加载中】:如果需要显示 loading则显示 loading
if (config.custom.showLoading) {
LoadingInstance.count++;

Loading…
Cancel
Save