diff --git a/src/api/mdp/pay/pay.js b/src/api/mdp/pay/pay.js index 94cf347..087e602 100644 --- a/src/api/mdp/pay/pay.js +++ b/src/api/mdp/pay/pay.js @@ -2,6 +2,6 @@ import axios from '@/utils/request' import config from '@/api/mdp_pub/mdp_config' let base = config.getPayContext(); -export const aliPay = params => { return axios.post(`${base}/alipay/uniOrder`, params) } -export const weixinPay = params => { return axios.post(`${base}/wxpay/uniOrder/native`, params) } -export const checkWxPayStatus = params => { return axios.get(`${base}/wxpay/uniOrder/checkOrderStatus`, {params}) } +export const aliPay = params => { return axios.post(`${base}/pay/alipay/uniOrder`, params) } +export const weixinPay = params => { return axios.post(`${base}/pay/wxpay/uniOrder/native`, params) } +export const checkWxPayStatus = params => { return axios.get(`${base}/pay/wxpay/uniOrder/checkOrderStatus`, {params}) } diff --git a/src/views/mdp/mo/moOrder/Form.vue b/src/views/mdp/mo/moOrder/Form.vue index aa46477..55e2212 100644 --- a/src/views/mdp/mo/moOrder/Form.vue +++ b/src/views/mdp/mo/moOrder/Form.vue @@ -6,7 +6,9 @@ {{editForm.id}} {{editForm.obranchName}} - ¥{{editForm.ofinalFee}}元 + ¥{{editForm.moFinalFee}}元 + {{editForm.odisRate}}% + ¥{{editForm.ofinalFee}}元 @@ -126,27 +128,37 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + 创建微信收款码 + + + + 创建支付宝收款码 + + @@ -164,9 +176,10 @@ - - % - + + % + 确认修改折扣率 + @@ -190,6 +203,9 @@ import * as MoOrderApi from '@/api/mdp/mo/moOrder'; import { mapGetters } from 'vuex' import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js'; +import {createOrder} from '@/api/mdp/sys/order' +import {aliPay, weixinPay, checkWxPayStatus} from '@/api/mdp/pay/pay' + import MoOrderModuleIndex from '../moOrderModule/Index.vue'; export default { name:'moOrderForm', @@ -217,6 +233,9 @@ export default { editForm: { id:'',name:'',obranchId:'',ouserid:'',ousername:'',moFinalFee:'',status:'',sstatus:'',ctime:'',payTime:'',payCtime:'',moOrginFee:'',ousers:'',ocates:'',omodules:'',poid:'',startTime:'',endTime:'',payType:'',payId:'',prepayId:'',topenId:'',pbankId:'',pbankName:'',pbankCardNo:'',pbankUsername:'',remark:'',finishTime:'',closeTime:'',setTime:'',odays:'',ofinalFee:'',odisRate:'',othFee:'',otype:'',osource:'',memType:'',atype:'',saleUserid:'',saleUsername:'',custPhone:'',custAddress:'',payAt:'',obranchName:'',ooper:'',tranId:'',invoice:'',invoiceTime:'',invoiceId:'' }, + odisRate:null, + codeUrl:null, + timer:0, //增删改查(含批量)接口 apis:{ queryById: MoOrderApi.queryMoOrderById, @@ -258,6 +277,88 @@ export default { params[fieldName]=$event return true; }, + odisRateConfirm(){ + var params={$pks:[this.editForm.id],odisRate:this.odisRate} + this.apis.editSomeFields(params).then(res=>{ + var tips = res.data.tips + if(tips.isOk){ + Object.assign(this.editForm,res.data.data) + } + this.$notify({ message: tips.msg, type: tips.isOk?'success':'error' }); + }) + }, + + createOrder() { + let orderId = this.editForm.id; + if(this.editForm.payType == '2') { + this.toAliPay(orderId); + return; + }else if(this.editForm.payType == '1') { + this.toWeixinPay(orderId); + return; + }else{ + this.$notify({ message: "请选则支付方式", type:'error' }); + return; + } + }, + + toAliPay(orderId) { + let params = { + id: orderId, + otype: 1, + returnUrl: `${window.location.protocol+"//"+window.location.host}/${process.env.CONTEXT}/${process.env.VERSION}/#/my/order/paySuccess` + } + aliPay(params).then(res => { + if(res.data.tips.isOk) { + const div = document.createElement("divform"); + div.innerHTML = res.data.data.htmlStr; + document.body.appendChild(div); + document.forms[0].submit(); + }else { + this.$notify.error(res.data.tips.msg); + } + }).finally(() => { + setTimeout(() => { + this.load.add = false; + }, 2000); + }) + }, + + toWeixinPay(orderId) { + let params = { + id: orderId, + otype: 1, + returnUrl: "" + } + weixinPay(params).then(res => { + if(res.data.tips.isOk) { + this.codeUrl = res.data.data.codeUrl; + this.timer = setInterval(() => { + this.queryOrderStatus(orderId,res.data.data.payId) + }, 3000) + }else { + this.$notify.error(res.data.tips.msg); + } + }).finally(() => { + setTimeout(() => { + this.load.add = false; + }, 2000); + }) + }, + + //查询订单支付状态 + queryOrderStatus(orderId,payId) { + console.log("查询订单"); + checkWxPayStatus({'orderId': orderId, "otype": "1","payId":payId}).then(res => { + if(res.data.tips.isOk) { + this.$router.push({path:'/my/order/paySuccess', query:{total_amount: this.editForm.ofinalFee, out_trade_no: orderId,pay_id:payId}}); + clearInterval(this.timer); + }else { + } + }).finally(() => { + + }) + }, }, mounted() { diff --git a/src/views/mdp/mo/moOrder/Index.vue b/src/views/mdp/mo/moOrder/Index.vue index 1cc1ac3..11a73ef 100644 --- a/src/views/mdp/mo/moOrder/Index.vue +++ b/src/views/mdp/mo/moOrder/Index.vue @@ -1,8 +1,12 @@ - - 查询 + + + + + + 查询 @@ -41,7 +45,7 @@ - + @@ -71,9 +75,19 @@ - + - + + + + + + + + + + + @@ -106,7 +120,7 @@ - + @@ -171,21 +185,6 @@ - - - - - - - - - - - - - - - @@ -256,6 +255,11 @@ + + + + + @@ -344,7 +348,7 @@ export default { }, - defaultCheckColumnNum:8,//默认展示的表格列数,前8列 + defaultCheckColumnNum:15,//默认展示的表格列数,前8列 //增删改查(含批量)接口 apis:{ diff --git a/src/views/order/createOrder.vue b/src/views/order/createOrder.vue index ae36df5..c084740 100644 --- a/src/views/order/createOrder.vue +++ b/src/views/order/createOrder.vue @@ -193,7 +193,7 @@ export default { this.codeUrl = res.data.data.codeUrl; this.weixinPayVisible = true; this.timer = setInterval(() => { - this.queryOrderStatus(orderId) + this.queryOrderStatus(orderId,res.data.data.payId) }, 3000) }else { this.$notify.error(res.data.tips.msg); @@ -206,11 +206,11 @@ export default { }, //查询订单支付状态 - queryOrderStatus(orderId) { + queryOrderStatus(orderId,payId) { console.log("查询订单"); - checkWxPayStatus({'orderId': orderId, "otype": "1"}).then(res => { + checkWxPayStatus({'orderId': orderId, "otype": "1","payId":payId}).then(res => { if(res.data.tips.isOk) { - this.$router.push({path:'/my/order/paySuccess', query:{total_amount: this.data.amount, out_trade_no: orderId}}); + this.$router.push({path:'/my/order/paySuccess', query:{total_amount: this.data.amount, out_trade_no: orderId,payId:payId}}); clearInterval(this.timer); }else { }