增加:配送商缴费页面及相关接口对接

This commit is contained in:
wuhui_zzw 2024-06-17 18:14:27 +08:00
parent 69e45b95c8
commit d6f1cd4371
9 changed files with 1046 additions and 4 deletions

View File

@ -49,3 +49,23 @@ export function roleAndCorrelationRole(data) {
return request.get(`agent/role_and_correlation_role`, data);
}
// 配送商 - 获取缴费列表
export function deliveryPaymentList(data) {
return request.get(`agent/delivery/payment_list`, data);
}
export function deliveryCreateOrder(data) {
return request.post(`agent/delivery/create_order`, data);
}

View File

@ -1397,7 +1397,6 @@
}
]
},
{
"root": "pages/agent",
"name": "agent",
@ -1452,6 +1451,24 @@
"style": {
"navigationBarTitleText": "我的邀请"
}
},
{
"path": "delivery/mer_list",
"style": {
"navigationBarTitleText": "我的商户"
}
},
{
"path": "delivery/payment",
"style": {
"navigationBarTitleText": "资金缴费"
}
},
{
"path": "delivery/payment_record",
"style": {
"navigationBarTitleText": "缴费记录"
}
}
]
},

View File

@ -146,6 +146,24 @@ export default {
url: '/pages/agent/user/order',
icon: 'icon-dingdanguanli',
});
menuList.push({
title: '我的商户',
type: 'link',
url: '/pages/agent/delivery/mer_list',
icon: 'icon-ziti',
});
menuList.push({
title: '资金缴费',
type: 'link',
url: '/pages/agent/delivery/payment',
icon: 'icon-yue2',
});
menuList.push({
title: '缴费记录',
type: 'link',
url: '/pages/agent/delivery/payment_record',
icon: 'icon-dingdan-xuanzhong',
});
}
//
if(['6'].includes(String(agentType))){

View File

@ -0,0 +1,123 @@
<template>
<view>
<view class="main-content" v-if="Object.values(list).length > 0">
配送商关联商户列表
</view>
<emptyPage v-else title="暂无信息~"></emptyPage>
<!-- 授权登录 -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
</view>
</template>
<script>
import {mapGetters} from "vuex";
import emptyPage from '@/components/emptyPage.vue';
import authorize from '@/components/Authorize';
export default {
components: {
authorize,
emptyPage
},
computed: {
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor'])
},
data() {
return {
//
isAuto: false, //
isShowAuth: false,//
//
total: 0,
list: [],
page: 1,
agent_id: 0,
}
},
onLoad(options) {
let _this = this;
_this.agent_id = options.agent_id || 0;
// agent_id <= 0
if(Number(_this.agent_id) <= 0){
_this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
//
if (!this.isLogin) {
//
this.isAuto = true;
this.isShowAuth = true
}else{
//
this.init();
}
},
//
onReachBottom() {
this.getList();
},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
this.getList();
},
//
getList() {
let _this = this;
console.log("列表信息获取");
// let params = {
// page: _this.page,
// pid: _this.agent_id
// };
// myAgentList(params).then(res => {
// let list = res.data.list || {};
// _this.total = res.data.count || 0;
// if (Object.values(list).length > 0) {
// _this.list = _this.$util.SplitArray(list, _this.list);
// _this.$set(_this, 'list', _this.list);
// _this.page++;
// }
// }).catch(err => {
// this.$util.Tips({title: err});
// });
},
}
}
</script>
<style lang="scss" scoped>
.main-content {
width: 100vw;
min-height: 100vh!important;
background: #f6f6f6;
}
</style>

View File

@ -0,0 +1,740 @@
<template>
<view :style="viewColor">
<!--具体内容-->
<view class='content-box'>
<!--买单金额-->
<view class="money">
<view class="top-bg-line"></view>
<view class="money-box">
<view class="title">缴费金额</view>
<view class="input-box">
<view class="unit">¥</view>
<input class="money-input" :value="payment_current.price | toFixedTwo" readonly disabled />
</view>
</view>
</view>
<!--赠送内容-->
<view class="give">
<view class="box-title">赠送额度</view>
<view class="give-content">
<view class="give-box">赠送冠名品牌额度<view class="give-quota">{{ payment_current.title_quota | toFixedTwo}}</view></view>
<view class="give-box">赠送其他品牌额度<view class="give-quota">{{ payment_current.other_quota | toFixedTwo}}</view></view>
<view class="give-box change-btn" v-if="Object.values(payment_list).length > 1" @click="showChangePopup">切换支付项</view>
</view>
</view>
<!--支付方式-->
<view class="pay-type">
<view class="box-title">支付方式</view>
<view class="box-content">
<radio-group name="pay_type" @change="changePayType">
<view class="pay-label" v-for="(item,index) in pay_list" :key="index" v-if="item.payStatus==1">
<label>
<view class="pay-item">
<view class="left">
<view :class="['iconfont','animated',item.icon]"></view>
<view class="pay-item-info">
<view class="pay-name">{{ item.name }}</view>
<view class='tip'>
{{item.title}}
<block v-if="item.value == 'balance'">
{{now_money}}
</block>
</view>
</view>
</view>
<view class="right">
<radio :value="item.value" :checked="item.value == pay_info.pay_type ? true : false" />
</view>
</view>
</label>
</view>
</radio-group>
</view>
</view>
<!--支付按钮-->
<view class="pay-btn" v-if="agent_id > 0" @click="confirmPayment">确认支付</view>
<view class="pay-btn not-btn" v-else>确认支付</view>
</view>
<!--授权登录-->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
<!--支付项目选择-->
<uni-popup ref="paymentListPopup" type="bottom">
<view class="payment-list-content">
<view class="list">
<view class="box" v-for="(item,index) in payment_list" :key="index">
<view class="left">
<view class="price">¥{{ item.price | toFixedTwo}}</view>
<view class="quota-box">赠送冠名品牌额度<view class="quota-num">{{ item.title_quota | toFixedTwo }}</view></view>
<view class="quota-box">赠送其他品牌额度<view class="quota-num">{{ item.other_quota | toFixedTwo }}</view></view>
</view>
<view class="selected-btn" @click="changePayment(index)">选中</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import emptyPage from '@/components/emptyPage.vue';
import {getUserInfo} from "@/api/user";
import {deliveryPaymentList, deliveryCreateOrder} from "@/api/agent";
const app = getApp();
export default {
components: {
authorize,
emptyPage,
},
data() {
return {
agent_id: '',
//
isAuto: false, //
isShowAuth: false,//
//
pay_list: [
{
"name": "微信支付",
"icon": "icon-weixin2",
value: 'weixin',
title: '微信快捷支付',
payStatus: 1,
},
{
name: "支付宝支付",
icon: "icon-icon34",
// #ifdef H5 || APP-PLUS
value: 'alipay',
// #endif
// #ifdef MP
value: 'alipayQr',
// #endif
title: '支付宝支付',
payStatus: this.$store.getters.globalData.alipay_open
},
{
"name": "余额支付",
"icon": "icon-icon-test",
value: 'balance',
title: '可用余额:',
payStatus: this.$store.getters.globalData.yue_pay_status,
},
{
"name": "线下支付",
"icon": "icon-yinhangqia",
value: 'offline',
title: '线下支付',
payStatus: 2,
},
],
now_money: 0,
pay_info: {
money: 0.00,//
pay_type: 'weixin',
// #ifdef H5
return_url: 'http://' + window.location.host + '/pages/users/order_list/index',
// #endif
},
//
payment_list: {},
payment_index: '',
payment_current: {},
};
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'viewColor'])
},
filters: {
toFixedTwo(value) {
value = value || 0;
value = Number(value);
return value.toFixed(2);
}
},
onLoad(options) {
this.agent_id = options.agent_id || 0;
// agent_id <= 0
if(Number(this.agent_id) <= 0){
this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:`/pages/agent/centerV2?agent_id=${this.agent_id}`});
return false;
}
//
if (!this.isLogin) {
//
this.isAuto = true;
this.isShowAuth = true
}else{
//
this.init();
}
},
onReachBottom: function () {},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
let _this = this;
//
getUserInfo().then(res => {
_this.now_money = res.data.now_money
});
//
this.getPaymentList();
},
//
getPaymentList(){
let _this = this;
deliveryPaymentList().then(res => {
let data = res.data || {};
_this.payment_list = data || {};
_this.payment_index = 0;
_this.payment_current = data[_this.payment_index] || {};
//
if(Object.values(data).length <= 0){
this.$util.Tips({
title: '不存在任何支付项,请联系管理员!',
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
});
},
//
showChangePopup(){
this.$refs.paymentListPopup.open('bottom');
},
//
changePayment(index){
this.payment_index = index;
this.$set(this, 'payment_current', this.payment_list[this.payment_index] || {});
this.$refs.paymentListPopup.close();
},
//
changePayType(e){
this.pay_info.pay_type = e.detail.value || e.target.value;
},
//
confirmPayment(){
let _this = this;
let paymentCurrentInfo = Object.assign({}, _this.payment_current);
let payInfo = Object.assign({},_this.pay_info);
payInfo.agent_id = _this.agent_id;
payInfo.money = Number(paymentCurrentInfo.price).toFixed(2);
payInfo.title_quota = Number(paymentCurrentInfo.title_quota).toFixed(2);
payInfo.other_quota = Number(paymentCurrentInfo.other_quota).toFixed(2);
//
if (payInfo.pay_type == 'weixin') {
// #ifdef H5
payInfo.pay_type = _this.$wechat.isWeixin() ? 'weixin' : 'h5'
// #endif
// #ifdef MP
payInfo.pay_type = 'routine'
// #endif
// #ifdef APP-PLUS
payInfo.pay_type = 'weixin'
// #endif
}
uni.showLoading({title: '订单处理中...', mask: true});
deliveryCreateOrder(payInfo).then(res => {
if (res.status == 200) {
let backUrl = `/pages/agent/delivery/payment_record?agent_id=${_this.agent_id}`;
let backTab = 5;
if(Number(paymentCurrentInfo.price) > 0){
let status = res.data.status,
orderId = res.data.result.order_id,
callback_key = res.data.result.pay_key,
jsConfig = res.data.result.config;
// let goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message;
let goPages = backUrl;
switch (status) {
case 'ORDER_EXIST':
case 'EXTEND_ORDER':
case 'PAY_ERROR':
case 'error':
return _this.$util.Tips({
title: res.message
}, {
tab: backTab,
url: goPages
});
break;
case 'success':
return _this.$util.Tips({
title: res.message,
icon: 'success'
}, {
tab: backTab,
url: goPages
});
break;
case 'alipay':
case "alipayQr":
uni.navigateTo({
url: '/pages/order_pay_back/index?keyCode=' + callback_key + '&url=' +
jsConfig
})
return;
break;
// #ifndef MP
case "wechat":
case "weixin":
case "weixinApp":
jsConfig.timeStamp = jsConfig.timestamp;
// #ifndef APP-PLUS
this.$wechat.pay(jsConfig).then(res => {
return _this.$util.Tips({
title: res.message,
icon: 'success'
}, {
tab: backTab,
url: goPages
});
}).catch(res => {
if (res.errMsg == 'chooseWXPay:cancel') return _this.$util.Tips({
title: '取消支付'
}, {
tab: backTab,
url: goPages + '&status=0'
});
})
// #endif
// #ifdef APP-PLUS
let mp_pay_name=''
if(uni.requestOrderPayment){
mp_pay_name='requestOrderPayment'
}else{
mp_pay_name='requestPayment'
}
uni[mp_pay_name]({
provider: 'wxpay',
orderInfo: jsConfig,
success: (e) => {
// let url = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=';
return _this.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: backTab,
url: backUrl
});
},
fail: (e) => {
// let url = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=';
return _this.$util.Tips({
title: '取消支付',
}, {
tab: backTab,
url: backUrl
});
},
complete: () => {
// let url = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=';
return _this.$util.Tips({
title: '',
}, {
tab: backTab,
url: backUrl
});
},
});
// #endif
break;
// #endif
// #ifdef MP
case "routine":
jsConfig.timeStamp = jsConfig.timestamp;
_this.toPay = true;
let mp_pay_name=''
if(uni.requestOrderPayment){
mp_pay_name='requestOrderPayment'
}else{
mp_pay_name='requestPayment'
}
uni[mp_pay_name]({
...jsConfig,
success: function(res) {
uni.hideLoading();
return _this.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: backTab,
url: goPages
});
},
fail: function(e) {
// let pages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg='
return _this.$util.Tips({
title: '取消支付'
}, {
tab: backTab,
// url: pages + '&status=0'
url: backUrl
});
},
})
break;
// #endif
case "balance":
//
return _this.$util.Tips({
title: res.msg
}, {
tab: backTab,
url: goPages + '&status=1'
});
break;
// #ifdef H5
case 'h5':
let host = window.location.protocol + "//" + window.location.host;
// let url = `${host}/pages/order_pay_status/index?order_id=${orderId}&msg=${res.message}`
let eUrl = encodeURIComponent(backUrl)
let jsurl = jsConfig.mweb_url || jsConfig.h5_url
let locations = `${jsurl}&redirect_url=${eUrl}`
setTimeout(() => {
location.href = locations;
}, 100);
break;
// #endif
// #ifdef APP-PLUS
case 'alipayApp':
uni.requestPayment({
provider: 'alipay',
orderInfo: jsConfig,
success: (e) => {
return _this.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: backTab,
url: goPages
});
},
fail: (e) => {
// let pages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg='
return _this.$util.Tips({
title: '支付失败'
}, {
tab: backTab,
url: backUrl
});
},
complete: () => {
uni.hideLoading();
// let pages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg='
return _this.$util.Tips({
title: ''
}, {
tab: backTab,
url: backUrl
});
},
});
break;
// #endif
default:
// let pages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg='
return _this.$util.Tips({
title: '取消支付'
}, {
tab: backTab,
// url: pages + '&status=0'
url: backUrl
});
}
}else{
_this.$util.Tips({
title: '操作成功!',
},{
tab: backTab,
url: backUrl
});
}
}
}).catch(err => {
uni.hideLoading();
this.$util.Tips({title: err});
});
},
},
}
</script>
<style scoped lang="scss">
.content-box{
width: 100vw;
min-height: 100vh;
background-color: orange;
padding: 20rpx;
background: linear-gradient(to bottom, #1b79ff, #f6f6f6) no-repeat;
background-size: 100% 300rpx;
background-color: #f6f6f6;
//
.box-title{
margin: 30rpx 0;
height: 50rpx;
line-height: 50rpx;
font-size: 28rpx;
padding-left: 20rpx;
font-weight: bold;
position: relative;
}
.box-title:after{
content: "";
position: absolute;
left: 0;
top: calc((50rpx - 30rpx) / 2);
width: 10rpx;
height: 30rpx;
background: #1777ff;
}
//
.money{
position: relative;
padding: 15rpx;
.top-bg-line{
width: 100%;
background-color: #1256ad;
height: 20rpx;
border-radius: 50rpx;
position: absolute;
left: 0;
top: 0;
}
.money-box{
background: #FFFFFF;
position: relative;
width: 100%;
top: -5rpx;
border-radius: 15rpx;
padding: 20rpx;
box-shadow: 0px 3px 5px 0px #ececec;
.title{
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
font-weight: bold;
}
.input-box{
height: 70rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: flex-end;
font-size: 50rpx;
font-weight: bold;
margin: 20rpx 0 30rpx 0;
}
.unit{
margin-right: 15rpx;
}
.money-input{
height: 70rpx;
}
}
}
//
.give{
.give-content{
width: 100%;
display: inline-flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
flex-direction: column;
.give-box{
display: inline-flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
flex-direction: row;
width: 100%;
height: 50rpx;
line-height: 50rpx;
color: #C3C3C3;
font-size: 30rpx;
.give-quota{
color: #f70e05;
}
}
.change-btn{
color: #1b79ff;
}
}
}
//
.pay-type{
.box-content{
.pay-label:not(:last-child){
margin-bottom: 20rpx;
}
.pay-item{
height: 120rpx;
padding: 20rpx;
width: 100%;
border: 2rpx solid #d9dce4;
border-radius: 15rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-around;
.left{
width: calc(100% - 80rpx);
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
.animated{
width: 44rpx;
height: 44rpx;
border-radius: 50%;
text-align: center;
line-height: 44rpx;
background-color: #fe960f;
color: #fff;
font-size: 30rpx;
margin-right: 15rpx;
}
.icon-weixin2 {
background-color: #41b035;
}
.icon-icon34 {
background-color: #4295D5;
}
.pay-item-info{
.pay-name{
text-align: left;
border-right: 1px solid #eee;
justify-content: left;
}
.tip{
text-align: left;
font-size: 26rpx;
color: #aaa;
}
}
}
.right{
width: 80rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-end;
}
}
}
}
//
.pay-btn{
width: calc(100% - (20rpx * 2));
background: #1777ff;
color: #FFFFFF;
border-radius: 15rpx;
font-size: 30rpx;
text-align: center;
height: 70rpx;
line-height: 70rpx;
position: absolute;
left: 20rpx;
bottom: 150rpx;
}
.not-btn{
background-color: #909399;
color: #fff;
}
}
.payment-list-content{
background: #FFFFFF;
width: 100vw!important;
height: 80vh!important;
padding: 15rpx;
border-top-right-radius: 20rpx;
border-top-left-radius: 20rpx;
.list{
overflow: auto;
height: calc(100% - 60rpx);
.box{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 20rpx 0;
width: 100%;
.left{
width: calc(100% - 110rpx);
display: inline-flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
.price{
width: 100%;
font-size: 36rpx;
height: 70rpx;
line-height: 70rpx;
color: #fb0000;
}
.quota-box{
width: 100%;
font-size: 28rpx;
text-align: left;
height: 40rpx;
line-height: 40rpx;
display: inline-flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
justify-content: flex-start;
color: #818181;
.quota-num{
color: #f70e05;
}
}
}
.selected-btn{
width: 100rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
font-size: 26rpx;
background-color: #67c23a;
color: #fff;
border-radius: 50rpx;
}
}
.box:not(:last-child){
border-bottom: 2rpx solid #f6f6f6;
}
}
}
</style>

View File

@ -0,0 +1,124 @@
<template>
<view>
<!--v-if="Object.values(list).length > 0"-->
<view class="main-content">
资金缴费记录
</view>
<!--<emptyPage v-else title="暂无信息~"></emptyPage>-->
<!-- 授权登录 -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
</view>
</template>
<script>
import {mapGetters} from "vuex";
import emptyPage from '@/components/emptyPage.vue';
import authorize from '@/components/Authorize';
export default {
components: {
authorize,
emptyPage
},
computed: {
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor'])
},
data() {
return {
//
isAuto: false, //
isShowAuth: false,//
//
total: 0,
list: [],
page: 1,
agent_id: 0,
}
},
onLoad(options) {
let _this = this;
_this.agent_id = options.agent_id || 0;
// agent_id <= 0
if(Number(_this.agent_id) <= 0){
_this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
//
if (!this.isLogin) {
//
this.isAuto = true;
this.isShowAuth = true
}else{
//
this.init();
}
},
//
onReachBottom() {
this.getList();
},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
this.getList();
},
//
getList() {
let _this = this;
console.log("列表信息获取");
// let params = {
// page: _this.page,
// pid: _this.agent_id
// };
// myAgentList(params).then(res => {
// let list = res.data.list || {};
// _this.total = res.data.count || 0;
// if (Object.values(list).length > 0) {
// _this.list = _this.$util.SplitArray(list, _this.list);
// _this.$set(_this, 'list', _this.list);
// _this.page++;
// }
// }).catch(err => {
// this.$util.Tips({title: err});
// });
},
}
}
</script>
<style lang="scss" scoped>
.main-content {
width: 100vw;
min-height: 100vh!important;
background: #f6f6f6;
}
</style>

View File

@ -59,7 +59,7 @@ export default {
if(Number(_this.agent_id) <= 0){
_this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:'/pages/agent/center'});
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
//

View File

@ -67,7 +67,7 @@ export default {
if(Number(_this.agent_id) <= 0){
_this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:'/pages/agent/center'});
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
//

View File

@ -558,7 +558,7 @@
filterMenus: function(item){
let that = this;
if(item.url=='/pages/users/user_money/index') item.isShow = that.balance_func_status == 1
else if(item.url == '/pages/agent/center'){
else if(item.url == '/pages/agent/center' || item.url == '/pages/agent/centerV2'){
console.log('是否为代理人员:',that.is_agent)
item.isShow = that.is_agent || false;
}