liudan 3 months ago
parent 8a250d974f
commit 527028fbf0
  1. 3
      api/bargain/checkout.js
  2. 6
      api/cashier/index.js
  3. 3
      common/enum/payment/Method.js
  4. 4
      config.js
  5. 2
      manifest.json
  6. 92
      pages/checkout/cashier/index.vue

@ -3,7 +3,8 @@ import request from '@/utils/request'
// api地址
const api = {
order: 'bargain.checkout/order',
submit: 'bargain.checkout/submit'
submit: 'bargain.checkout/submit',
}
// 结算台订单信息

@ -5,6 +5,7 @@ const api = {
orderInfo: 'cashier/orderInfo',
orderPay: 'cashier/orderPay',
tradeQuery: 'cashier/tradeQuery',
getpayinfo: 'checkout/getpayinfo',
}
/**
@ -15,7 +16,10 @@ const api = {
export function orderInfo(orderId, param) {
return request.get(api.orderInfo, { orderId, ...param })
}
// 积分支付
export const getpayinfo = ( data) => {
return request.post(api.getpayinfo, { ...data }, { isPrompt: false })
}
/**
* 确认支付
* @param {Number} orderId

@ -7,5 +7,6 @@ import Enum from '../enum'
export default new Enum([
{ key: 'WECHAT', name: '微信支付', value: 'wechat' },
{ key: 'ALIPAY', name: '支付宝支付', value: 'alipay' },
{ key: 'BALANCE', name: '余额支付', value: 'balance' }
{ key: 'BALANCE', name: '余额支付', value: 'balance' },
{ key: 'POINT', name: '积分支付', value: 'point' },
])

@ -7,8 +7,8 @@ export default {
* 后端api地址 (必填; 斜杠/结尾; 请确保能访问)
* 例如: https://www.你的域名.com/index.php?s=/api/
*/
apiUrl: "https://www.你的域名.com/index.php?s=/api/",
// apiUrl: "https://www.你的域名.com/index.php?s=/api/",
apiUrl: "https://yhc.xiaqjc.cn/index.php?s=/api/",
/**
* 商城ID (必填)
* 可在超管后台-商城列表中查看

@ -99,7 +99,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"appid" : "wxa498c505c71a85e2",
"setting" : {
// TLS
"urlCheck" : true,

@ -28,7 +28,8 @@
<text>(可用{{ personal.balance }})</text>
</view>
</view>
<view class="item-right col-m" v-if="curPaymentItem && curPaymentItem.method == item.method">
<!-- <view class="item-right col-m" v-if="curPaymentItem && curPaymentItem.method == item.method"> -->
<view class="item-right col-m" v-if="isCheckedHandle(item.method)">
<text class="iconfont icon-check"></text>
</view>
</view>
@ -62,18 +63,21 @@
import { PayMethodEnum } from '@/common/enum/payment'
import { PayStatusEnum } from '@/common/enum/order'
import * as CashierApi from '@/api/cashier'
import * as getpayinfo from '@/api/bargain/checkout.js'
//
const PayMethodIconEnum = {
[PayMethodEnum.WECHAT.value]: 'icon-wechat-pay',
[PayMethodEnum.ALIPAY.value]: 'icon-alipay',
[PayMethodEnum.BALANCE.value]: 'icon-balance-pay'
[PayMethodEnum.BALANCE.value]: 'icon-balance-pay',
[PayMethodEnum.POINT.value]: 'icon-balance-pay',
}
//
const PayMethodClientNameEnum = {
[PayMethodEnum.WECHAT.value]: '微信',
[PayMethodEnum.ALIPAY.value]: '支付宝'
[PayMethodEnum.ALIPAY.value]: '支付宝',
[PayMethodEnum.POINT.value]: '积分',
}
export default {
@ -91,7 +95,7 @@
PayMethodIconEnum,
PayMethodClientNameEnum,
//
curPaymentItem: null,
curPaymentItem: [],
// ID
orderId: null,
//
@ -159,9 +163,56 @@
//
handleSelectPayType(index) {
this.curPaymentItem = this.methods[index]
console.log(index,this.methods,this.curPaymentItem)
let arr = this.curPaymentItem.filter(item=>{
return item.method==this.methods[index].method
})
if(arr.length>0){
//
this.curPaymentItem.forEach((item,i)=>{
if(item.method==this.methods[index].method){
//
this.curPaymentItem.splice(i,1)
}
})
}else{
//
this.curPaymentItem.push(this.methods[index])
}
if(this.methods[index].method=='point'){
//
let res =this.curPaymentItem.filter(item=>{
return item.method=='point'
})
let app = this;
CashierApi.getpayinfo({ orderID:this.orderId,isUsePoints:res.length>0?1:0 }).then(result => {
console.log(result)
app.order = result.data.order
app.personal = result.data.personal
app.methods = result.data.paymentMethods
app.isLoading = false
// app.setDefaultPayType()
app.checkOrderPayStatus()
// #ifdef H5
//
this.performance()
// #endif
})
}
// this.curPaymentItem = this.methods[index]
},
isCheckedHandle(item){
let arr = this.curPaymentItem.filter(i=>{
return i.method==item
})
if(arr.length>0){
return true
}else{
return false
}
},
//
// #ifdef H5
performance() {
@ -196,7 +247,7 @@
handleSubmit() {
const app = this
//
if (!app.curPaymentItem) {
if (app.curPaymentItem.length==0) {
app.$toast('您还没有选择支付方式')
return
}
@ -204,8 +255,21 @@
if (app.disabled) return
app.disabled = true
// API
let method=null;
let isWX = app.curPaymentItem.filter(item=>{
return item.method=="wechat"
})
let isPoint = app.curPaymentItem.filter(item=>{
return item.method=="point"
})
if(app.curPaymentItem.length>0&&isWX.length>0){
method = 'wechat'
}
if(app.curPaymentItem.length>0&&isWX.length==0&&isPoint.length>0){
method = 'point'
}
CashierApi.orderPay(app.orderId, {
method: app.curPaymentItem.method,
method: method,
client: app.platform,
extra: app.getExtraAsUnify(app.curPaymentItem.method)
})
@ -227,7 +291,15 @@
//
onSubmitCallback(result) {
const app = this
const method = app.curPaymentItem.method
// const method = app.curPaymentItem.method
let method;
let isWX = app.curPaymentItem.filter(item=>{
return item.method=="wechat"
})
if(isWX.length>0){
method = "wechat"
}
const paymentData = result.data.payment
//
if (method === PayMethodEnum.BALANCE.value) {

Loading…
Cancel
Save