msb_test
ch 2 years ago
parent 5d8a42f48c
commit 39f379875b

@ -1,4 +1,3 @@
VUE_APP_BASE_URL = https://k8s-horse-gateway.mashibing.cn
VUE_APP_STATIC_URL = https://k8s-shop-app.mashibing.cn
#VUE_APP_IM_URL = ws://192.168.10.94:8090
VUE_APP_IM_URL = wss://k8s-horse-gateway.mashibing.cn

@ -1,49 +0,0 @@
/*
* @Author: ch
* @Date: 2022-05-05 14:40:00
* @LastEditors: ch
* @LastEditTime: 2022-06-28 10:59:13
* @Description: 根据git分支生成对应环境的环境变量
* 开发时如果环境变量换了可以不用重启服务直接运行node env.config.js即可
*/
const fs = require('fs');
const path = require('path');
const envConfig = {
dev : {
// baseUrl: 'https://you-gateway.mashibing.com',
baseUrl: 'https://k8s-horse-gateway.mashibing.cn',
// baseUrl: '',
staticUrl : 'https://k8s-shop-app.mashibing.cn',
// imUrl : 'ws://192.168.10.94:8090'
imUrl : 'wss://k8s-horse-gateway.mashibing.cn'
},
test : {
baseUrl: 'https://k8s-horse-gateway.mashibing.cn',
staticUrl : 'https://k8s-shop-app.mashibing.cn',
imUrl : 'wss://k8s-horse-gateway.mashibing.cn'
},
beta : {
baseUrl: 'https://you-gateway.mashibing.com',
staticUrl : 'https://you-app.mashibing.com',
imUrl : 'wss://you-gateway.mashibing.com'
},
prod : {
baseUrl: 'https://you-gateway.mashibing.com',
staticUrl : 'https://you-app.mashibing.com',
imUrl : 'wss://you-gateway.mashibing.com'
}
}
let curEnvConfig = null;
const argv = global.process.argv;
for(key in envConfig){
if(argv.includes(`--ENV:${key}`)){
curEnvConfig = envConfig[key];
break;
}
}
if(!curEnvConfig){
curEnvConfig = envConfig.dev;
}
fs.writeFileSync(`${path.resolve(__dirname, './src/common/config')}/env.js`,
`const ENV = ${JSON.stringify(curEnvConfig)}; export default ENV;`);

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-18 11:11:05
* @LastEditors: ch
* @LastEditTime: 2022-06-29 21:53:26
* @LastEditTime: 2022-07-12 18:31:15
* @Description: file content
*/
import {RouterMount,createRouter} from 'uni-simple-router';
@ -14,7 +14,8 @@ const router = createRouter({
//全局路由前置守卫
router.beforeEach((to, from, next) => {
// 兼容页面刷新body样式丢失问题
if (document.body) {
// console.log(document);
if (document) {
document.body.setAttribute('class', `uni-body ${to.path.replace('/', '').replace(/\//g, '-')}`)
}
next();

@ -2,12 +2,12 @@
* @Author: ch
* @Date: 2022-04-29 14:26:10
* @LastEditors: ch
* @LastEditTime: 2022-06-30 16:03:35
* @LastEditTime: 2022-07-13 10:37:21
* @Description: file content
*/
import { ApiPostAliH5Pay, ApiPostAliAppPay } from '@/common/api/pay';
import ENV from '@/common/config/env';
const ENV = process.env;
export const Alipay = async ({orderId})=>{
// #ifdef APP-PLUS
@ -38,7 +38,7 @@ export const Alipay = async ({orderId})=>{
// #ifdef H5
const { error, result } = await ApiPostAliH5Pay({
orderId,
returnUrl : decodeURIComponent(`${ENV.staticUrl}/payResult?orderId=${orderId}&payType=alih5`)
returnUrl : decodeURIComponent(`${ENV.VUE_APP_STATIC_URL}/payResult?orderId=${orderId}&payType=alih5`)
});
if(error){
uni.$u.toast(error.message);

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-20 11:00:07
* @LastEditors: ch
* @LastEditTime: 2022-06-13 10:11:33
* @LastEditTime: 2022-07-13 10:37:52
* @Description: file content
*/
@ -11,7 +11,7 @@ import { ToAsyncAwait, FormatJsonSearch } from '@/common/utils';
import { ApiGetCurrentUser } from '@/common/api/account';
import { ApiGetSoketTicket } from '@/common/api/im';
import $store from '@/common/store';
import ENV from '@/common/config/env';
const ENV = process.env;
const Im = new MsbIm({
reconnect: true,
@ -31,7 +31,7 @@ const ImInit = async () => {
avatar : $store.state.userInfo.avatar
})
await ToAsyncAwait(Im.init({
url: `${ENV.imUrl}/ws${par}`
url: `${ENV.VUE_APP_IM_URL}/ws${par}`
}))
};

@ -2,10 +2,9 @@
* @Author: ch
* @Date: 2022-05-06 15:33:55
* @LastEditors: ch
* @LastEditTime: 2022-06-15 14:26:16
* @LastEditTime: 2022-07-13 10:38:34
* @Description: file content
*/
import ENV from '@/common/config/env';
import { Wxpay } from './wxpay';
export const pay = ({orderId, openId, payType})=>{
if(payType === 'wxpay'){

@ -2,14 +2,14 @@
* @Author: ch
* @Date: 2022-03-17 17:42:32
* @LastEditors: ch
* @LastEditTime: 2022-06-29 17:43:49
* @LastEditTime: 2022-07-13 10:39:07
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/
import MsbUniRequest from '@/common/plugins/msbUniRequest';
import $store from '@/common/store';
import ENV from '@/common/config/env';
import { CreateUUID } from '@/common/utils';
const ENV = process.env;
// 获取已有的UUID没则创建一个并保存到locaStorage中下次使用
let uuid = $store.state.uuid
@ -82,7 +82,7 @@ const clearRepeat = (option) =>{
// 不需要token的接口封装
const MsbRequest = new MsbUniRequest();
MsbRequest.baseUrl = ENV.baseUrl;
MsbRequest.baseUrl = ENV.VUE_APP_BASE_URL;
MsbRequest.use('request', (option) => {
if(option.header.repeat){
@ -102,7 +102,7 @@ MsbRequest.use('error', errorIntercept);
// 需要token的接口封装
const MsbRequestTk = new MsbUniRequest();
MsbRequestTk.baseUrl = ENV.baseUrl;
MsbRequestTk.baseUrl = ENV.VUE_APP_BASE_URL;
MsbRequestTk.use('request', (option) => {
const token = $store.state.token;

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-17 19:15:10
* @LastEditors: ch
* @LastEditTime: 2022-06-22 10:39:15
* @LastEditTime: 2022-07-13 10:39:35
* @Description: 一些无法归类的公共方法容器
*/
@ -15,7 +15,6 @@ import {
formatJsonSearch as FormatJsonSearch
} from "js-util-all";
import ENV from '@/common/config/env';
import {AD_JUMP_TYPE} from '@/common/dicts/ad';
/**

@ -2,12 +2,12 @@
* @Author: ch
* @Date: 2022-04-29 14:26:10
* @LastEditors: ch
* @LastEditTime: 2022-06-29 17:17:40
* @LastEditTime: 2022-07-13 10:40:10
* @Description: file content
*/
import { ApiPostWxH5Pay, ApiPostWxJsApiPay, ApiPostWxAppPay } from '@/common/api/pay';
import ENV from '@/common/config/env';
const ENV = process.env;
export const Wxpay = async ({orderId,openId})=>{
// #ifdef APP-PLUS
@ -74,7 +74,7 @@ export const Wxpay = async ({orderId,openId})=>{
uni.$u.toast(error.message);
return false;
}
const redirect_url = decodeURIComponent(`${ENV.staticUrl}/payResult?orderId=${orderId}&payType=wxh5`);
const redirect_url = decodeURIComponent(`${ENV.VUE_APP_STATIC_URL}/payResult?orderId=${orderId}&payType=wxh5`);
window.location.href = `${result.payDataInfo.h5Url}&redirect_url=${redirect_url}`;
}
// #endif

@ -14,7 +14,7 @@
"path": "pages/webView",
"aliasPath" : "/webView",
"style": {
"navigationBarTitleText": "马士兵严选"
"navigationBarTitleText": "收银台"
}
},
{

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-15 17:46:10
* @LastEditors: ch
* @LastEditTime: 2022-06-29 20:39:45
* @LastEditTime: 2022-07-13 14:13:24
* @Description: file content
-->
<template>
@ -23,7 +23,7 @@
<!-- 待支付可以取消支付订单 -->
<template v-if="orderInfo.orderStatus === 1">
<UiButton class="footer--btn" @click="cancelShow = true">取消订单</UiButton>
<UiButton class="footer--btn" type="gradual" @click="payShow = true">去支</UiButton>
<UiButton class="footer--btn" type="gradual" @click="handlePay"></UiButton>
</template>
<u-popup class="cancel" :show="cancelShow" @close="closeCancel" round="16rpx" closeable>
<view class="cancel--title">取消订单原因</view>
@ -49,13 +49,14 @@
<UiButton type="gradual" :disabed="cancelValue == 0" @click="cancelOrder"></UiButton>
</view>
</u-popup>
<BsPay class="modal" :show.sync="payShow" :order="orderInfo"></BsPay>
<!-- <BsPay class="modal" :show.sync="payShow" :order="orderInfo"></BsPay> -->
</view>
</template>
<script>
import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue'
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order'
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order';
import {ApiPostCashierPrepay} from '@/common/api/pay';
import BsPay from '../../../../components/BsPay.vue';
import ORDER from '@/common/dicts/order';
export default {
@ -72,8 +73,6 @@ export default {
//
cancelShow : false,
cancelValue : 0,
//
payShow : false
}
},
methods : {
@ -119,29 +118,32 @@ export default {
}
}
})
// this.$msb.confirm({
// content : '',
// confirm : async ()=>{
// const {error} = await ApiPutOrderReceive({
// orderId : this.$Route.query.id
// });
// if(error){
// uni.$toast(error.message);
// return false;
// }
// this.$Router.push('/orderSuccess');
// }
// })
},
service(){
// uni.$u.toast('')
this.$Router.push({
path : '/messageChat',
query : {
orderId : this.orderInfo.orderId
}
})
},
async handlePay(){
const {error, result} = await ApiPostCashierPrepay({orderId:this.orderInfo.orderId});
if(error){
uni.$u.toast(error.message);
return false;
}
// #ifdef H5
window.location.replace(result.wapCashierUrl)
// #endif
// #ifndef H5
this.$Router.push(`/webView?url=${encodeURIComponent(result.wapCashierUrl)}`);
// #endif
}
}
}

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 10:58:24
* @LastEditors: ch
* @LastEditTime: 2022-06-29 20:29:48
* @LastEditTime: 2022-07-13 14:12:17
* @Description: file content
-->
<template>
@ -32,7 +32,7 @@
<view class="orders--footer">
<UiButton size="min" type="gradual"
v-if="item.orderStatus === ORDER.STATUS.AWAIT_PAY" @click="pay(item)">去支付</UiButton>
v-if="item.orderStatus === ORDER.STATUS.AWAIT_PAY" @click="handlePay(item)">去支付</UiButton>
<UiButton size="min" v-if="[ORDER.STATUS.CLOSE,ORDER.STATUS.AWAIT_PAY].includes(item.orderStatus)"
@click="$Router.push(`/orderDetail?id=${item.orderId}`)">查看详情</UiButton>
<UiButton size="min" v-if="item.orderStatus >= ORDER.STATUS.FINISH_SEND_GOODS"
@ -49,13 +49,14 @@
</view>
<u-loadmore :status="loadingStatus" v-if="loadingStatus !== 'nomore'"/>
<BsPay :show.sync="payShow" :order="payOrder"></BsPay>
<!-- <BsPay :show.sync="payShow" :order="payOrder"></BsPay> -->
</view>
</template>
<script>
import BsEmpty from '@/components/BsEmpty.vue';
import UiButton from '@/components/UiButton.vue';
import { ApiGetOrderList, ApiPutOrderReceive } from '@/common/api/order';
import {ApiPostCashierPrepay} from '@/common/api/pay';
import BsPay from '../../components/BsPay.vue';
import UiGoodsInfo from '../../components/UiGoodsInfo.vue';
import UiGoodsInfoMax from '../../components/UiGoodsInfoMax.vue';
@ -80,7 +81,6 @@ export default {
pageIndex : 1,
pageSize : 10,
payShow : false,
payOrder : null
}
},
@ -134,9 +134,21 @@ export default {
/**
* 立即支付
*/
pay(item){
this.payShow = true;
this.payOrder = item;
async handlePay(item){
const {error, result} = await ApiPostCashierPrepay({orderId:item.orderId});
if(error){
uni.$u.toast(error.message);
return false;
}
// #ifdef H5
window.location.replace(result.wapCashierUrl)
// #endif
// #ifndef H5
this.$Router.push(`/webView?url=${encodeURIComponent(result.wapCashierUrl)}`);
// #endif
},
/**

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-20 14:14:53
* @LastEditors: ch
* @LastEditTime: 2022-07-12 17:29:00
* @LastEditTime: 2022-07-13 14:08:54
* @Description: file content
-->
<template>
@ -175,8 +175,19 @@ export default {
return false;
}
const {error:er, result:res} = await ApiPostCashierPrepay({orderId:result.orderId});
this.$Router.push(`/webView?url=${encodeURIComponent('http://www.baidu.com')}`)
// console.log(res);
if(er){
uni.$u.toast(er.message);
return false;
}
// #ifdef H5
window.location.replace(res.wapCashierUrl)
// #endif
// #ifndef H5
this.$Router.push(`/webView?url=${encodeURIComponent(res.wapCashierUrl)}`);
// #endif
}
}

@ -2,11 +2,11 @@
* @Author: ch
* @Date: 2022-07-12 17:19:59
* @LastEditors: ch
* @LastEditTime: 2022-07-12 17:34:26
* @LastEditTime: 2022-07-12 18:35:24
* @Description: file content
-->
<template><view>
<!-- <web-view src="http://www.baidu.com"></web-view> -->
<web-view :src="url"></web-view>
</view>
</template>
<script>
@ -17,7 +17,7 @@ export default {
}
},
onLoad(){
this.url = this.$Route.query.url
this.url = decodeURIComponent(this.$Route.query.url)
console.log();
}
}

Loading…
Cancel
Save