修改支付以及域名

msb_beta
ch 3 years ago
parent 3c5da7f87e
commit 1ab8f49994

@ -2,15 +2,17 @@
* @Author: ch
* @Date: 2022-03-22 16:52:28
* @LastEditors: ch
* @LastEditTime: 2022-04-26 19:04:27
* @LastEditTime: 2022-04-29 14:49:13
* @Description: 所有工具类统一在这输出
*/
import * as util from './utils';
import * as requset from './requset';
import * as websocket from './requset';
import * as wxpay from './wxpay';
export * from './utils';
export * from './requset';
export * from './websocket';
export * from './wxpay';
export default { ...util, ...requset, ...websocket}
export default { ...util, ...requset, ...websocket, ...wxpay}

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-17 17:42:32
* @LastEditors: ch
* @LastEditTime: 2022-04-29 14:03:56
* @LastEditTime: 2022-04-29 15:15:55
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/
@ -14,7 +14,7 @@ const BASE_URL = {
'test' : 'https://k8s-horse-gateway.mashibing.cn',
'dev' : '',
'release' : '',
'prod' : '//like-gateway.mashibing.com'
'prod' : '//you-gateway.mashibing.com'
};
/**
* 接口返回成功结果统一处理
@ -22,7 +22,7 @@ const BASE_URL = {
* @param {*} option
*/
const successIntercept = (response, option) =>{
clearRepeat(option)
clearRepeat(option);
if(response.statusCode === 200){
const result = response.data;
if(result.code === 'SUCCESS'){

@ -0,0 +1,56 @@
/*
* @Author: ch
* @Date: 2022-04-29 14:26:10
* @LastEditors: ch
* @LastEditTime: 2022-04-29 14:54:16
* @Description: file content
*/
import { ApiPostWxH5Pay, ApiPostWxJsApiPay } from '@/common/api/wx';
export const Wxpay = async ({orderId,openId})=>{
// 有openId则表示在微信浏览器内
if(openId) {
// 微信JSAPI
const {error, result} = await ApiPostWxJsApiPay({orderId,openId});
if(error){
uni.$u.toast(error.message);
return false;
}
/*
* 公众号id appId String(16) wx8888888888888888
时间戳 timeStamp String(32) 1414561699 当前的时间
随机字符串 nonceStr String(32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS 随机字符串不长于32位推荐随机数生成算法
订单详情扩展字符串 package String(128) prepay_id=123456789 统一下单接口返回的prepay_id参数值提交格式如prepay_id=***
签名方式 signType String(32) MD5 签名类型默认为MD5支持HMAC-SHA256和MD5注意此处需与统一下单的签名类型一致
签名 paySign String(64) C380BEC2BFD727A4B6845133519F3AD6 签名
*/
const par = result.dataInfo;
WeixinJSBridge.invoke('getBrandWCPayRequest', {
appId : par.appId,
timeStamp : par.timeStamp,
nonceStr : par.nonceStr,
package : par.packageValue,
signType : par.signType,
paySign : par.paySign
}, res => {
if(res.err_msg === 'get_brand_wcpay_request:cancel'){
uni.navigateTo({
url : `/payResult?id=${orderId}`
});
}else{
uni.navigateTo({
url : `/payResult?orderId=${orderId}`
});
}
})
}else{
// h5支付
const {error, result} = await ApiPostWxH5Pay({orderId});
if(error){
uni.$u.toast(error.message);
return false;
}
const redirect_url = decodeURIComponent(`https://like-app.mashibing.com/payResult?orderId=${orderId}`);
window.location.href = `${result.dataInfo.payUrl}&redirect_url=${redirect_url}`;
}
}

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-19 11:37:50
* @LastEditors: ch
* @LastEditTime: 2022-04-22 18:11:00
* @LastEditTime: 2022-04-29 15:29:47
* @Description: file content
-->
<template>
@ -12,6 +12,7 @@
<script>
import UiRadioPicker from './UiRadioPicker.vue'
import { ApiPostWxPay } from '@/common/api/order';
import { Wxpay } from '@/common/utils';
export default {
components: { UiRadioPicker },
props : {
@ -39,13 +40,13 @@ export default {
}
},
methods:{
async confirm(val){
confirm(val){
const orderId = this.order.orderId;
const {error, result} = await ApiPostWxPay({orderId,payTypeEnum:'WXPAY'});
if(error){
this.$Router.replace(`/payFail?ordId=${orderId}`)
if(val.value === 'wxpay'){
Wxpay({orderId, openId: this.$store.state.openId});
this.close();
}else{
this.$Router.replace(`/paySuccess?ordId=${orderId}`)
uni.$u.toast('暂不支持支付宝支付');
}
},
close(){

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2021-07-26 23:22:16
* @LastEditors: ch
* @LastEditTime: 2022-04-29 14:13:08
* @LastEditTime: 2022-04-29 14:20:16
* @Description: file content
*/
import Vue from 'vue';
@ -33,9 +33,7 @@ if(store.state.token){
// 微信打开需要授权
const ua = navigator.userAgent.toLowerCase();
console.log(ua);
if(ua.includes('micromessenger')) {
if(!store.state.openId){
let query = toSearchJson(window.location.search)
@ -62,7 +60,6 @@ if(ua.includes('micromessenger')) {
})
}
}
// 微信JSAPI
}

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 10:58:24
* @LastEditors: ch
* @LastEditTime: 2022-04-22 18:07:49
* @LastEditTime: 2022-04-29 15:17:04
* @Description: file content
-->
<template>
@ -38,14 +38,7 @@
<UiButton size="min" v-if="item.orderStatus >= 4"
@click="$Router.push(`/logisitcsInfo?orderId=${item.orderId}`)">查看物流</UiButton>
<UiButton size="min" type="gradual" v-if="item.orderStatus === 4" @click="receive(item)"></UiButton>
<!-- <button class="orders--footer-btn orders--footer-btn__red"
>去支付</button>
<button class="orders--footer-btn" v-if="item.orderStatus === 2"
@click="$Router.push(`/orderDetail?id=${item.orderId}`)">查看详情</button>
<button class="orders--footer-btn" v-if="item.orderStatus >= 4"
@click="$Router.push(`/logisitcsInfo?orderId=${item.orderId}`)">查看物流</button>
<button class="orders--footer-btn orders--footer-btn__red"
v-if="item.orderStatus == 4" @click="receive(item)">确认收货</button> -->
</view>
</view>
<u-loadmore :status="loadingStatus" v-if="loadingStatus === 'loading'"/>

@ -1,44 +0,0 @@
<!--
* @Author: ch
* @Date: 2022-03-28 17:16:44
* @LastEditors: ch
* @LastEditTime: 2022-04-28 15:34:43
* @Description: file content
-->
<template>
<view>
<image class="icon" src="@/static/order/payFail.png"/>
<view class="title">支付失败</view>
<view class="desc">请重新试试</view>
<UiButton class="btn">返回商品详情</UiButton>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
export default {
components: { UiButton }
}
</script>
<style lang="scss" scoped>
page{
text-align: center;
}
.icon{
width: 400rpx;
height: 256rpx;
margin: 169rpx auto 42rpx;
}
.title{
font-size: $font-size-lg;
line-height: 44rpx;
color: $color-grey6;
}
.desc{
font-size: $font-size-sm;
line-height: 34rpx;
color: $color-grey4;
}
.btn{
margin-top: 74rpx;
}
</style>

@ -2,15 +2,15 @@
* @Author: ch
* @Date: 2022-04-28 15:01:41
* @LastEditors: ch
* @LastEditTime: 2022-04-28 15:46:19
* @LastEditTime: 2022-04-29 14:46:23
* @Description: file content
-->
<template>
<view>
<view class="main">
<template v-if="!orderInfo">
<view class="title">交易</view>
<view class="desc">正在交易中请您耐心等待...</view>
<view class="title title--await">结果查询</view>
<view class="desc">正在与支付渠道确认支付结果请您耐心等待...</view>
</template>
<template v-else>
<template v-if="orderInfo.isSuccess">
@ -28,16 +28,19 @@
<image class="icon" src="@/static/order/payFail.png"/>
<view class="title">支付失败</view>
<view class="desc">请重新试试</view>
<UiButton class="btn">返回商品详情</UiButton>
<view class="btns">
<UiButton class="btn">返回商品详情</UiButton>
</view>
</template>
</template>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue';
import BsChoiceGoods from '@/components/BsChoiceGoods.vue';
import {ApiGetOrderPaySatus} from '@/common/api/order';
export default {
components: { UiButton },
components: { UiButton, BsChoiceGoods },
data(){
return {
orderInfo : '',
@ -72,6 +75,9 @@ export default {
page{
text-align: center;
}
.main{
text-align: center;
}
.icon{
width: 400rpx;
height: 256rpx;
@ -81,6 +87,10 @@ page{
font-size: $font-size-lg;
line-height: 44rpx;
color: $color-grey6;
&--await{
margin: 100rpx 0 20rpx;
color: $color-grey5;
}
}
.desc{
font-size: $font-size-sm;

@ -1,75 +0,0 @@
<!--
* @Author: ch
* @Date: 2022-03-28 17:16:44
* @LastEditors: ch
* @LastEditTime: 2022-04-19 18:06:43
* @Description: file content
-->
<template>
<view>
<image class="icon" src="@/static/order/paySuccess.png"/>
<view class="title">支付成功</view>
<view class="desc">您的包裹整装待发</view>
<view class="btns">
<UiButton class="btn" type="primaryLine" @click="$Router.replaceAll('/')"></UiButton>
<UiButton class="btn" type="solid" @click="$Router.replace(`/orderDetail?id=${$Route.query.ordId}`)"></UiButton>
</view>
<view class="recommend-title">为您推荐</view>
<BsChoiceGoods></BsChoiceGoods>
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
export default {
components: { UiButton },
}
</script>
<style lang="scss" scoped>
page{
text-align: center;
}
.icon{
width: 400rpx;
height: 256rpx;
margin: 169rpx auto 42rpx;
}
.title{
font-size: $font-size-lg;
line-height: 44rpx;
color: $color-grey6;
}
.desc{
font-size: $font-size-sm;
line-height: 34rpx;
color: $color-grey4;
}
.btns{
margin: 74rpx 105rpx 0;
display: flex;
justify-content: space-between;
}
.recommend-title{
font-size: $font-size-lg;
text-align: center;
margin: 51rpx auto 30rpx auto;
display: flex;
align-items: center;
justify-content: space-between;
width: 500rpx;
&::after,&::before{
display: inline-block;
content: '';
width: 160rpx;
height: 2rpx;
background: linear-gradient(90deg, $color-grey3 0%, rgba(204, 204, 204, 0) 100%);
}
&::before{
background: linear-gradient(270deg, $color-grey3 0%, rgba(204, 204, 204, 0) 100%);
}
}
</style>

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-20 14:14:53
* @LastEditors: ch
* @LastEditTime: 2022-04-28 19:55:04
* @LastEditTime: 2022-04-29 14:56:02
* @Description: file content
-->
<template>
@ -22,21 +22,10 @@
</UiWhiteBox>
<view class="goods-group">
<view class="goods-group--item" v-for="item in orderInfo.products" :key="item.productId">
<image class="goods-group--item-image" mode="widthFix" :src="item.productImageUrl" />
<view >
<view class="goods-group--item-con">
<text class="goods-group--item-title">{{item.productName}}</text>
<text class="goods-group--item-pirce">{{item.productPrice}}</text>
</view>
<view class="goods-group--item-desc">
<text>{{item.skuDescribe}}</text>
<text class="goods-group--item-num">x{{item.quantity}}</text>
</view>
</view>
</view>
</view>
<UiWhiteBox >
<ui-goods-info v-for="item in orderInfo.products"
:key="item.productId" :data="item" ></ui-goods-info>
</UiWhiteBox>
<UiWhiteBox>
<UiCell class="service--cell" title="配送方式" value="快递配送" :rightIcon="false"></UiCell>
@ -81,11 +70,12 @@
<script>
import UiCell from '@/components/UiCell';
import {ApiPostSubmitOrder, ApiGetBeforeOrder, ApiGetBeforeCartOrder} from '@/common/api/order';
import { ApiPostWxH5Pay, ApiPostWxJsApiPay } from '@/common/api/wx';
import {Wxpay} from '@/common/utils';
import UiButton from '@/components/UiButton.vue';
import UiWhiteBox from '../../components/UiWhiteBox.vue';
import UiGoodsInfo from '../../components/UiGoodsInfo.vue';
export default {
components : {UiCell, UiButton, UiWhiteBox },
components : {UiCell, UiButton, UiWhiteBox, UiGoodsInfo },
data(){
return {
address : {},
@ -174,56 +164,10 @@ export default {
return false;
}
if(this.payType === 'wxpay'){
this.wxpay(result.orderId);
Wxpay(result.orderId, this.$store.state.openId);
}else{
uni.$u.toast('暂不支持支付宝支付');
}
},
async wxpay(orderId){
const openId = this.$store.state.openId;
if(openId) {
// JSAPI
const {error, result} = await ApiPostWxJsApiPay({orderId,openId});
if(error){
uni.$u.toast(error.message);
return false;
}
/*
* 公众号id appId String(16) wx8888888888888888
时间戳 timeStamp String(32) 1414561699 当前的时间
随机字符串 nonceStr String(32) 5K8264ILTKCH16CQ2502SI8ZNMTM67VS 随机字符串不长于32位推荐随机数生成算法
订单详情扩展字符串 package String(128) prepay_id=123456789 统一下单接口返回的prepay_id参数值提交格式如prepay_id=***
签名方式 signType String(32) MD5 签名类型默认为MD5支持HMAC-SHA256和MD5注意此处需与统一下单的签名类型一致
签名 paySign String(64) C380BEC2BFD727A4B6845133519F3AD6 签名
*/
const par = result.dataInfo;
WeixinJSBridge.invoke('getBrandWCPayRequest', {
appId : par.appId,
timeStamp : par.timeStamp,
nonceStr : par.nonceStr,
package : par.packageValue,
signType : par.signType,
paySign : par.paySign
}, res => {
if(res.err_msg === 'get_brand_wcpay_request:cancel'){
this.$$Router.replace(`/payResult?orderId=${orderId}`);
}else{
this.$$Router.replace(`/orderDetail?id=${orderId}`);
}
})
}else{
// h5
const {error, result} = await ApiPostWxH5Pay({orderId});
if(error){
uni.$u.toast(error.message);
return false;
}
const redirect_url = decodeURIComponent(`https://like-app.mashibing.com/payResult?orderId=${orderId}`);
window.location.href = `${result.dataInfo.payUrl}&redirect_url=${redirect_url}`;
}
}
}
}

Loading…
Cancel
Save