improve; 支付配置

This commit is contained in:
From-wh 2023-04-10 18:41:08 +08:00
parent 69b6b9cb7d
commit b13734503b
9 changed files with 70 additions and 316 deletions

View File

@ -221,3 +221,13 @@ export function getCategoryVersion(name) {
noAuth: true
});
}
/**
* 配置信息
*
*/
export function basicConfig(name) {
return request.get(`basic_config`, {}, {
noAuth: true
});
}

View File

@ -135,9 +135,6 @@
groomList,
memberOverdueTime
} from '@/api/user.js';
import {
orderOfflinePayType
} from '@/api/order.js';
import {
toLogin
} from '@/libs/login.js';
@ -145,7 +142,9 @@
openPaySubscribe
} from '@/utils/SubscribeMessage.js';
import dayjs from '@/plugin/dayjs/dayjs.min.js';
import {
basicConfig
} from '@/api/public.js'
export default {
components: {
home,
@ -358,7 +357,7 @@
});
},
getOrderPayType() {
orderOfflinePayType().then(res => {
basicConfig().then(res => {
const {
ali_pay_status,
pay_weixin_open

View File

@ -17,6 +17,7 @@
}
},
onLoad(option) {
console.log(option)
this.url = option.url;
try {
const res = uni.getSystemInfoSync();

View File

@ -46,6 +46,9 @@
getCashierOrder,
orderPay
} from '@/api/order.js';
import {
basicConfig
} from '@/api/public.js'
export default {
components: {
countDown,
@ -128,7 +131,7 @@
onLoad(options) {
if (options.order_id) this.orderId = options.order_id
if (options.from_type) this.fromType = options.from_type
this.getCashierOrder()
this.getBasicConfig()
},
onShow() {
let options = wx.getEnterOptionsSync();
@ -172,6 +175,32 @@
}
},
methods: {
getBasicConfig() {
basicConfig().then(res => {
//微信支付是否开启
this.cartArr[0].payStatus = res.data.wechat_pay_status || 0
//支付宝是否开启
this.cartArr[1].payStatus = res.data.ali_pay_status || 0;
//#ifdef MP
this.cartArr[1].payStatus = 0;
//#endif
//余额支付是否开启
this.cartArr[2].payStatus = res.data.yue_pay_status
if (res.data.offline_pay_status) {
this.cartArr[3].payStatus = 1
} else {
this.cartArr[3].payStatus = 0
}
//好友代付是否开启
this.cartArr[4].payStatus = res.data.friend_pay_status || 0;
this.getCashierOrder()
}).catch(err => {
uni.hideLoading();
return this.$util.Tips({
title: err
})
})
},
getCashierOrder() {
uni.showLoading({
title: this.$t(`创建订单中`)
@ -182,24 +211,7 @@
this.payPostage = res.data.pay_postage
this.offlinePostage = res.data.offline_postage
this.invalidTime = res.data.invalid_time
//微信支付是否开启
this.cartArr[0].payStatus = res.data.wechat_pay_status || 0
//支付宝是否开启
this.cartArr[1].payStatus = res.data.ali_pay_status || 0;
//#ifdef MP
this.cartArr[1].payStatus = false;
//#endif
//余额支付是否开启
// that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
this.cartArr[2].number = res.data.now_money;
this.cartArr[2].payStatus = res.data.yue_pay_status
if (res.data.offline_pay_status) {
this.cartArr[3].payStatus = 1
} else {
this.cartArr[3].payStatus = 0
}
//好友代付是否开启
this.cartArr[4].payStatus = res.data.friend_pay_status || 0;
uni.hideLoading();
}).catch(err => {
uni.hideLoading();

View File

@ -228,8 +228,6 @@
<invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
:url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
</invoice-picker>
<payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice.toString()"
@changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
<canvas canvas-id="canvas" v-if="canvasStatus"
:style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
</view>

View File

@ -406,10 +406,6 @@
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id"
:totalPrice='totalPrice' :friendPay="true"></payment>
<invoiceModal :aleartStatus="aleartStatus" :invoiceData="invoiceData" @close="aleartStatus=false">
</invoiceModal>
<view class="mask invoice-mask" v-if="aleartStatus" @click="aleartStatus = false"></view>
@ -448,7 +444,6 @@
makeUpinvoice
} from '@/api/user.js';
import home from '@/components/home';
import payment from '@/components/payment';
import orderGoods from "@/components/orderGoods";
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
import {
@ -466,7 +461,6 @@
import zbCode from '@/components/zb-code/zb-code.vue'
export default {
components: {
payment,
home,
invoicePicker,
invoiceModal,
@ -587,7 +581,6 @@
}
},
onShow() {
this.payClose()
if (this.isLogin) {
this.getOrderInfo();
this.getUserInfo();
@ -675,29 +668,6 @@
url: `/pages/goods/order_refund_goods/index?orderId=` + this.order_id
})
},
// refundSubmit() {
// if (!this.express_num.trim()) {
// return this.$util.Tips({
// title: '请输入物流单号'
// })
// }
// refundExpress({
// express_id: this.express_num,
// id: this.orderInfo.id
// }).then(res => {
// this.$util.Tips({
// title: '操作成功',
// icon: 'success'
// }, () => {
// this.refund_close = false
// this.getOrderInfo();
// });
// }).catch(err => {
// this.$util.Tips({
// title: err,
// })
// })
// },
getCustomerType() {
getCustomerType().then(res => {
this.customerInfo = res.data;
@ -732,76 +702,7 @@
});
// #endif
},
// openSubcribe(e, type) {
// let page = e;
// // #ifdef MP
// uni.showLoading({
// title: '正在加载',
// })
// openOrderRefundSubscribe().then(res => {
// uni.hideLoading();
// uni.navigateTo({
// url: page,
// success: (res) => {
// if (!type) {
// let cartList = [];
// this.cartInfo.forEach((item) => {
// let i = {
// cart_info: item,
// cart_id: item.id,
// cart_num: item.cart_num,
// surplus_num: item.cart_num - item.refund_num
// }
// cartList.push(i)
// })
// res.eventChannel.emit('goodsData', {
// cartList: cartList,
// count: 1,
// })
// }
// }
// });
// }).catch(() => {
// uni.hideLoading();
// });
// // #endif
// // #ifndef MP
// uni.navigateTo({
// url: page,
// success: (res) => {
// if (!type) {
// let cartList = [];
// this.cartInfo.forEach((item) => {
// let i = {
// cart_info: item,
// cart_id: item.id,
// cart_num: item.cart_num,
// surplus_num: item.cart_num - item.refund_num
// }
// cartList.push(i)
// })
// res.eventChannel.emit('goodsData', {
// cartList: cartList,
// count: 1,
// })
// }
// }
// });
// // #endif
// },
goReturnGoods() {
},
/**
* 事件回调
*
*/
onChangeFun: function(e) {
let opt = e;
let action = opt.action || null;
let value = opt.value != undefined ? opt.value : null;
(action && this[action]) && this[action](value);
},
goReturnGoods() {},
/**
* 拨打电话
*/
@ -829,13 +730,6 @@
},
});
},
/**
* 关闭支付组件
*
*/
payClose: function() {
this.pay_close = false;
},
/**
* 打开支付组件
*
@ -848,20 +742,6 @@
// this.pay_order_id = this.orderInfo.order_id;
// this.totalPrice = this.orderInfo.pay_price;
},
/**
* 支付成功回调
*
*/
pay_complete: function() {
this.pay_close = false;
this.pay_order_id = '';
uni.navigateTo({
url: '/pages/goods/order_pay_status/index?order_id=' + this.orderInfo.order_id + '&msg=' +
this.$t(`支付成功`) +
'&type=3' + '&totalPrice=' + this.totalPrice
})
this.getOrderInfo();
},
/**
* 支付失败回调
*

View File

@ -136,8 +136,6 @@
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
<payment :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"
:totalPrice="totalPrice"></payment>
</view>
</template>
@ -149,14 +147,10 @@
orderDel,
orderPay
} from '@/api/order.js';
import {
getUserInfo
} from '@/api/user.js';
import {
openOrderSubscribe
} from '@/utils/SubscribeMessage.js';
import home from '@/components/home';
import payment from '@/components/payment';
import {
toLogin
} from '@/libs/login.js';
@ -170,7 +164,6 @@
import colors from '@/mixins/color.js';
export default {
components: {
payment,
home,
emptyPage,
// #ifdef MP
@ -188,35 +181,6 @@
orderStatus: 9, //订单状态
page: 1,
limit: 20,
payMode: [{
name: this.$t(`微信支付`),
icon: 'icon-weixinzhifu',
value: 'weixin',
title: this.$t(`使用微信快捷支付`),
payStatus: true
},
{
name: this.$t(`支付宝支付`),
icon: 'icon-zhifubao',
value: 'alipay',
title: this.$t(`使用支付宝支付`),
payStatus: true
},
{
name: this.$t(`余额支付`),
icon: 'icon-yuezhifu',
value: 'yue',
title: this.$t(`可用余额`),
number: 0,
payStatus: true
}, {
"name": this.$t(`好友代付`),
"icon": "icon-haoyoudaizhifu",
value: 'friend',
title: this.$t(`找微信好友支付`),
payStatus: 1,
}
],
pay_close: false,
pay_order_id: '',
totalPrice: '0',
@ -262,7 +226,6 @@
methods: {
onLoadFun() {
this.getOrderData();
this.getUserInfo();
},
// 授权关闭
authColse: function(e) {
@ -278,17 +241,6 @@
let value = opt.value != undefined ? opt.value : null;
action && this[action] && this[action](value);
},
/**
* 获取用户信息
*
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.payMode[2].number = res.data.now_money;
that.$set(that, 'payMode', that.payMode);
});
},
/**
* 关闭支付组件
*
@ -305,23 +257,6 @@
let that = this;
orderData().then(res => {
that.$set(that, 'orderData', res.data);
that.payMode.map(item => {
if (item.value == 'weixin') {
item.payStatus = res.data.pay_weixin_open ? true : false;
}
if (item.value == 'alipay') {
item.payStatus = res.data.ali_pay_status ? true : false;
}
if (item.value == 'yue') {
item.payStatus = res.data.yue_pay_status == 1 ? true : false;
}
if (item.value == 'friend') {
item.payStatus = res.data.friend_pay_status == 1 ? true : false;
}
});
//#ifdef MP
this.payMode[1].payStatus = false;
//#endif
});
},
/**
@ -362,34 +297,6 @@
uni.navigateTo({
url: `/pages/goods/cashier/index?order_id=${order_id}&from_type=order`
})
// this.$set(this, 'pay_close', true);
// this.$set(this, 'pay_order_id', order_id);
// this.$set(this, 'totalPrice', pay_price);
},
/**
* 支付成功回调
*
*/
pay_complete: function() {
this.loadend = false;
this.page = 1;
this.$set(this, 'orderList', []);
this.pay_close = false;
uni.navigateTo({
url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id +
'&msg=' + this.$t(`支付成功`) + '&type=3&totalPrice=' + this.totalPrice
})
this.pay_order_id = '';
this.getOrderData();
this.getOrderList();
},
/**
* 支付失败回调
*
*/
pay_fail: function() {
this.pay_close = false;
this.pay_order_id = '';
},
/**
* 去订单详情

View File

@ -164,9 +164,6 @@
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
</view>
</template>
<style scoped lang="scss">
@ -543,9 +540,6 @@
import {
openOrderRefundSubscribe
} from '@/utils/SubscribeMessage.js';
import {
getUserInfo
} from '@/api/user.js';
import home from '@/components/home';
import payment from '@/components/payment';
import orderGoods from "@/components/orderGoods";
@ -583,31 +577,6 @@
isGoodsReturn: false, //是否为退款订单
status: {}, //订单底部按钮状态
isClose: false,
payMode: [{
name: this.$t(`微信支付`),
icon: "icon-weixinzhifu",
value: 'weixin',
title: this.$t(`使用微信快捷支付`),
payStatus: true,
},
// #ifdef H5 || APP-PLUS
{
name: this.$t(`支付宝支付`),
icon: 'icon-zhifubao',
value: 'alipay',
title: this.$t(`使用支付宝支付`),
payStatus: true
},
// #endif
{
name: this.$t(`余额支付`),
icon: "icon-yuezhifu",
value: 'yue',
title: this.$t(`可用余额`),
number: 0,
payStatus: true
},
],
pay_close: false,
pay_order_id: '',
totalPrice: '0',
@ -624,7 +593,6 @@
onShow() {
if (this.isLogin) {
this.getOrderInfo();
this.getUserInfo();
} else {
toLogin();
}
@ -702,57 +670,12 @@
},
});
},
/**
* 关闭支付组件
*
*/
payClose: function() {
this.pay_close = false;
},
/**
* 打开支付组件
*
*/
pay_open: function() {
this.pay_close = true;
this.pay_order_id = this.orderInfo.order_id;
this.totalPrice = this.orderInfo.pay_price;
},
/**
* 支付成功回调
*
*/
pay_complete: function() {
this.pay_close = false;
this.pay_order_id = '';
this.getOrderInfo();
},
/**
* 支付失败回调
*
*/
pay_fail: function() {
this.pay_close = false;
this.pay_order_id = '';
},
/**
* 登录授权回调
*
*/
onLoadFun: function() {
this.getOrderInfo();
this.getUserInfo();
},
/**
* 获取用户信息
*
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.payMode[1].number = res.data.now_money;
that.$set(that, 'payMode', that.payMode);
})
},
/**
* 获取订单详细信息

View File

@ -86,6 +86,9 @@
import home from '@/components/home';
import colors from "@/mixins/color";
import payment from '@/components/payment';
import {
basicConfig
} from '@/api/public.js'
export default {
components: {
payment,
@ -152,6 +155,7 @@
this.from = this.$wechat.isWeixin() ? "weixin" : "weixinh5"
// #endif
if (this.isLogin) {
this.getBasicConfig();
this.getUserInfo();
this.getRecharge();
} else {
@ -159,6 +163,26 @@
}
},
methods: {
getBasicConfig() {
basicConfig().then(res => {
const {
ali_pay_status,
pay_weixin_open
} = res.data;
this.payMode[0].payStatus = pay_weixin_open;
// #ifdef APP-PLUS || H5
this.payMode[1].payStatus = ali_pay_status;
// #endif
//#ifdef MP
this.payMode[1].payStatus = false;
//#endif
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
});
});
},
/**
* 选择金额