Browse Source

2023-3-3

功能完善 微信支付
master
guoxing 2 years ago
parent
commit
322aaf3b44
  1. 2
      mallplusui-uniapp-app/common/api.js
  2. 507
      mallplusui-uniapp-app/components/payments/paymentsByApp.vue
  3. BIN
      mallplusui-uniapp-app/docs/pyw_app_key.jks
  4. 13
      mallplusui-uniapp-app/docs/签名密码及第三方登录信息.txt
  5. 10
      mallplusui-uniapp-app/manifest.json
  6. 1218
      mallplusui-uniapp-app/pages/order/order.vue
  7. 86
      mallplusui-uniapp-app/pages/order/orderDetail.vue

2
mallplusui-uniapp-app/common/api.js

@ -1,7 +1,7 @@
import store from '../store/index';
export default {
// qq 237524947 wx15d4269d3210863d
// BASEURI: 'http://2xpk7t.natappfree.cc/api/',
// BASEURI: 'http://2wsiyd.natappfree.cc/api/',
BASEURI: 'http://mall.yyundong.com/portalapi/api/',
// BASEURI: 'http://192.168.31.52:8083/api/',
ADMINURI: 'http://mall.yyundong.com/adminapi/',

507
mallplusui-uniapp-app/components/payments/paymentsByApp.vue

@ -1,6 +1,7 @@
<template>
<view class="pay-type-list">
<view class="type-item b-b" v-for="item in paymentss" :key="item.code" @click="toPayHandler(item.code)" v-if="!(type == 2 && item.code == 'balancepay')">
<view class="type-item b-b" v-for="item in paymentss" :key="item.code" @click="toPayHandler(item.code)"
v-if="!(type == 2 && item.code == 'balancepay')">
<text v-if="item.code == 'wechatpay'" class="icon yticon icon-weixinzhifu"></text>
<text v-if="item.code == 'alipay'" class="icon yticon icon-alipay"></text>
<text v-if="item.code == 'offline'" class="icon yticon icon-weixinzhifu"></text>
@ -15,273 +16,287 @@
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
export default {
props: {
//
orderId: {
type: String,
default() {
return '';
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
export default {
props: {
//
orderId: {
type: String,
default () {
return '';
}
},
//
recharge: {
type: Number,
default () {
return 0;
}
},
// id
uid: {
type: Number,
default () {
return 0;
}
},
//
type: {
type: Number,
default () {
return 1;
}
}
},
//
recharge: {
type: Number,
default() {
return 0;
}
data() {
return {
paymentss: []
};
},
// id
uid: {
type: Number,
default() {
return 0;
}
mounted() {
this.getPayment();
},
//
type: {
type: Number,
default() {
return 1;
}
}
},
data() {
return {
paymentss: []
};
},
mounted() {
this.getPayment();
},
methods: {
//
async getPayment() {
console.log('getPayments');
let params = {};
this.orderInfo = await Api.apiCall('get', Api.order.paymentlist, params);
this.paymentss = this.formatPayments(this.orderInfo);
},
//
formatPayments(payments) {
// 线
if (this.type === 2) {
payments = payments.filter(item => item.code !== 'balancepay' || item.is_online === 1);
}
methods: {
//
async getPayment() {
console.log('getPayments');
let params = {};
this.orderInfo = await Api.apiCall('get', Api.order.paymentlist, params);
this.paymentss = this.formatPayments(this.orderInfo);
},
//
formatPayments(payments) {
// 线
if (this.type === 2) {
payments = payments.filter(item => item.code !== 'balancepay' || item.is_online === 1);
}
// logo
payments.forEach(item => {
this.$set(item, 'icon', '/static/image/' + item.code + '.png');
});
return payments;
},
//
async toPayHandler(code) {
let _this = this;
let params = { orderId: this.orderId };
let data = {
payment_code: code,
payment_type: _this.type
};
data['ids'] = this.type == 1 || this.type == 5 || this.type == 6 ? this.orderId : this.uid;
if ((this.type == 5 || this.type == 6) && this.recharge) {
data['params'] = {
trade_type: 'APP',
formid: this.orderId
// logo
payments.forEach(item => {
this.$set(item, 'icon', '/static/image/' + item.code + '.png');
});
return payments;
},
//
async toPayHandler(code) {
let _this = this;
let params = {
orderId: this.orderId
};
let data = {
payment_code: code,
payment_type: _this.type
};
}
switch (code) {
case 'alipay':
/**
* 支付宝支付需要模拟GET提交数据
*/
if (_this.type == 1 && _this.orderId) {
data['params'] = {
trade_type: 'APP'
};
} else if (_this.type == 2 && _this.recharge) {
data['params'] = {
trade_type: 'APP',
money: _this.recharge
};
}
let res = await Api.apiCall('get', Api.order.aliAppPay, params);
if (res) {
console.log(res);
uni.requestPayment({
provider: 'alipay',
orderInfo: res,
success: function(data) {
let rawdataResult = JSON.parse(data.rawdata).result;
let r = rawdataResult.split(';')[0];
let r1 = rawdataResult.split(';')[0].length - 1;
let r2 = rawdataResult.split(';')[0].length - 2;
let alipayTradeAppPayResponse = JSON.parse(r.substr(0, r1)).alipay_trade_app_pay_response;
let out_trade_no = alipayTradeAppPayResponse.out_trade_no;
_this.$common.successToShow('支付成功', () => {
//_this.redirectHandler(res.data.payment_id)
_this.redirectHandler(out_trade_no);
});
}
});
} else {
_this.$comon.errorToShow(res.msg);
}
data['ids'] = this.type == 1 || this.type == 5 || this.type == 6 ? this.orderId : this.uid;
if ((this.type == 5 || this.type == 6) && this.recharge) {
data['params'] = {
trade_type: 'APP',
formid: this.orderId
};
}
switch (code) {
case 'alipay':
/**
* 支付宝支付需要模拟GET提交数据
*/
if (_this.type == 1 && _this.orderId) {
data['params'] = {
trade_type: 'APP'
};
} else if (_this.type == 2 && _this.recharge) {
data['params'] = {
trade_type: 'APP',
money: _this.recharge
};
}
break;
case 'wechatpay':
// H5
if (_this.type == 1 && _this.orderId) {
data['params'] = {
trade_type: 'APP'
};
} else if (_this.type == 2 && _this.recharge) {
data['params'] = {
trade_type: 'APP',
money: _this.recharge
};
}
let res = await Api.apiCall('get', Api.order.aliAppPay, params);
console.log("aliAppPay》》》", res);
if (res) {
console.log(res);
uni.requestPayment({
provider: 'alipay',
orderInfo: res,
success: function(data) {
console.log("aliAppPay_data》》》", data);
let rawdataResult = JSON.parse(data.rawdata).result;
let r = rawdataResult.split(';')[0];
let r1 = rawdataResult.split(';')[0].length - 1;
let r2 = rawdataResult.split(';')[0].length - 2;
let alipayTradeAppPayResponse = JSON.parse(r.substr(0, r1))
.alipay_trade_app_pay_response;
let out_trade_no = alipayTradeAppPayResponse.out_trade_no;
_this.$common.successToShow('支付成功', () => {
//_this.redirectHandler(res.data.payment_id)
_this.redirectHandler(out_trade_no);
});
}
});
} else {
_this.$comon.errorToShow(res.msg);
}
// app
let res1 = await Api.apiCall('get', Api.order.appPay, params);
debugger
console.log(res1)
console.log(data)
if (res1) {
//
uni.requestPayment({
provider: 'wxpay',
orderInfo: res1,
success: function(data) {
console.log(res1)
console.log(data)
_this.$common.successToShow('支付成功', () => {
_this.redirectHandler(data);
});
},
fail: function(res) {
console.log(JSON.stringify(res));
}
});
} else {
_this.$common.errorToShow(res.msg);
}
break;
case 'wechatpay':
// H5
if (_this.type == 1 && _this.orderId) {
data['params'] = {
trade_type: 'APP'
};
} else if (_this.type == 2 && _this.recharge) {
data['params'] = {
trade_type: 'APP',
money: _this.recharge
};
}
break;
case 'balancepay':
/**
* 用户余额支付
*
*/
let params1 = { orderId: this.orderId };
let data1 = await Api.apiCall('post', Api.order.balancePay, params1);
console.log(data1);
if (data1) {
uni.redirectTo({
url: '/pages/order/payment/result?order=' + JSON.stringify(data1)
});
} else {
this.$api.msg(data1.data);
}
break;
case 'offline':
/**
* 线下支付
*/
_this.$common.modelShow('线下支付说明', '请联系客服进行线下支付', () => {}, false, '取消', '确定');
break;
// app
let res1 = await Api.apiCall('get', Api.order.appPay, params);
debugger
console.log(res1)
console.log(data)
if (res1) {
//
uni.requestPayment({
provider: 'wxpay',
orderInfo: res1,
success: function(data) {
console.log(res1)
console.log(data)
_this.$common.successToShow('支付成功', () => {
_this.redirectHandler(data);
});
},
fail: function(res) {
console.log(JSON.stringify(res));
}
});
} else {
_this.$common.errorToShow(res.msg);
}
break;
case 'balancepay':
/**
* 用户余额支付
*
*/
let params1 = {
orderId: this.orderId
};
let data1 = await Api.apiCall('post', Api.order.balancePay, params1);
console.log(data1);
if (data1) {
uni.redirectTo({
url: '/pages/order/payment/result?order=' + JSON.stringify(data1)
});
} else {
this.$api.msg(data1.data);
}
break;
case 'offline':
/**
* 线下支付
*/
_this.$common.modelShow('线下支付说明', '请联系客服进行线下支付', () => {}, false, '取消', '确定');
break;
}
},
//
redirectHandler(paymentId) {
this.$common.redirectTo('/pages/order/payment/result?id=' + paymentId);
}
},
//
redirectHandler(paymentId) {
this.$common.redirectTo('/pages/order/payment/result?id=' + paymentId);
}
}
};
};
</script>
<style lang="scss">
.app {
width: 100%;
}
.app {
width: 100%;
}
.price-box {
background-color: #fff;
height: 265upx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 28upx;
color: #909399;
.price-box {
background-color: #fff;
height: 265upx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 28upx;
color: #909399;
.price {
font-size: 50upx;
color: #303133;
margin-top: 12upx;
.price {
font-size: 50upx;
color: #303133;
margin-top: 12upx;
&:before {
content: '¥';
font-size: 40upx;
&:before {
content: '¥';
font-size: 40upx;
}
}
}
}
.pay-type-list {
margin-top: 20upx;
background-color: #fff;
padding-left: 60upx;
.pay-type-list {
margin-top: 20upx;
background-color: #fff;
padding-left: 60upx;
.type-item {
height: 120upx;
padding: 20upx 0;
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 60upx;
font-size: 30upx;
position: relative;
}
.type-item {
height: 120upx;
padding: 20upx 0;
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 60upx;
font-size: 30upx;
position: relative;
}
.icon {
width: 100upx;
font-size: 52upx;
}
.icon-erjiye-yucunkuan {
color: #fe8e2e;
}
.icon-weixinzhifu {
color: #36cb59;
}
.icon-alipay {
color: #01aaef;
}
.tit {
font-size: $font-lg;
color: $font-color-dark;
margin-bottom: 4upx;
.icon {
width: 100upx;
font-size: 52upx;
}
.icon-erjiye-yucunkuan {
color: #fe8e2e;
}
.icon-weixinzhifu {
color: #36cb59;
}
.icon-alipay {
color: #01aaef;
}
.tit {
font-size: $font-lg;
color: $font-color-dark;
margin-bottom: 4upx;
}
.con {
flex: 1;
display: flex;
flex-direction: column;
font-size: $font-sm;
color: $font-color-light;
}
}
.con {
flex: 1;
.mix-btn {
display: flex;
flex-direction: column;
font-size: $font-sm;
color: $font-color-light;
align-items: center;
justify-content: center;
width: 630upx;
height: 80upx;
margin: 80upx auto 30upx;
font-size: $font-lg;
color: #fff;
background-color: $base-color;
border-radius: 10upx;
box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
}
}
.mix-btn {
display: flex;
align-items: center;
justify-content: center;
width: 630upx;
height: 80upx;
margin: 80upx auto 30upx;
font-size: $font-lg;
color: #fff;
background-color: $base-color;
border-radius: 10upx;
box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
}
</style>

BIN
mallplusui-uniapp-app/docs/pyw_app_key.jks

Binary file not shown.

13
mallplusui-uniapp-app/docs/签名密码及第三方登录信息.txt

@ -0,0 +1,13 @@
签名密码及第三方登录信息
证书别名:key0
证书签名的密码:yxt123
QQ登录的
APP ID:101453048
APP Key:80382d6bd51922ef10a182f69b84581d
审核通过
微信
AppID: wxc46a728ab3aae3c0
AppSecret: 85f3970bdfba3d7d01fdd82bc370aeec

10
mallplusui-uniapp-app/manifest.json

@ -2,8 +2,8 @@
"name" : "汇融云链",
"appid" : "__UNI__FB2C9C4",
"description" : "",
"versionName" : "1.0.0.3",
"versionCode" : 1003,
"versionName" : "1.0.0.5",
"versionCode" : 1005,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,
@ -63,7 +63,7 @@
"sdkConfigs" : {
"oauth" : {
"weixin" : {
"appid" : "wx04b09a8148e4875c",
"appid" : "wxa66597d50184d027",
"appsecret" : "3526ec2107c123f59b5c1cb7ff23a252",
"UniversalLinks" : ""
},
@ -73,7 +73,7 @@
},
"payment" : {
"weixin" : {
"appid" : "wx04b09a8148e4875c",
"appid" : "wxa66597d50184d027",
"UniversalLinks" : "",
"__platform__" : [ "android" ]
},
@ -91,7 +91,7 @@
"ad" : {},
"share" : {
"weixin" : {
"appid" : "wx04b09a8148e4875c",
"appid" : "wxa66597d50184d027",
"UniversalLinks" : ""
},
"qq" : {

1218
mallplusui-uniapp-app/pages/order/order.vue

File diff suppressed because it is too large

86
mallplusui-uniapp-app/pages/order/orderDetail.vue

@ -5,29 +5,36 @@
<scroll-view class="list-scroll-content" scroll-y>
<!-- 订单列表 -->
<view class="order-item">
<view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">{{orderInfo.orderSn}}</text>
</view>
<view class="i-top b-b">
<text class="time">{{ orderInfo.createTime }}</text>
<!-- <text class="state" :style="{ color: orderInfo.stateTipColor }" @click="navToDetailPage(item)">{{ orderInfo.id }}--</text> -->
<text class="state"
:style="{ color: orderInfo.stateTipColor }">{{ orderInfo.stateTip }}</text>
<text v-if="orderInfo.status === 9" class="del-btn yticon icon-iconfontshanchu1"
@click="deleteOrder(index)"></text>
</view>
<view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">订单商品</text>
</view>
<view v-if="goodsItem.type === 1" class="goods-box-single"
v-for="(goodsItem, goodsIndex) in orderInfo.orderItemList" :key="goodsIndex">
<img class="goods-img" :src="goodsItem.productPic" mode="aspectFill"></img>
<view class="right">
<text class="title clamp">{{ goodsItem.productName }}</text>
<text class="attr-box">{{ goodsItem.productAttr }} x
{{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }} </text>
<view class="num_price">
<text class="attr-box">x {{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }}</text>
</view>
<view style="display: flex;flex-direction: row;">
<text style="color: #c1c1c1;font-size: 13px;"
v-if="orderInfo.status === 5||orderInfo.status === 3">{{orderInfo.deliveryCompany}}</text>
<text style="color: #c1c1c1;font-size: 13px;"
v-if="orderInfo.status === 5||orderInfo.status === 3">{{ orderInfo.deliverySn }}</text>
</view>
</view>
</view>
<view class="i-top b-b">
<!-- <view class="i-top b-b">
<text class="state" :style="{ color: orderInfo.stateTipColor }">订单赠品</text>
</view>
<view v-if="goodsItem.type === 2" class="goods-box-single"
@ -39,38 +46,41 @@
{{ goodsItem.productQuantity }}</text>
<text class="price">{{ goodsItem.productPrice }} </text>
</view>
</view>
</view> -->
<view style="display: flex;flex-direction: column; margin-right: 13px;margin-bottom: 10px;">
<view class="price-box">
<text class="num">{{ orderInfo.orderItemList.length }}</text>
件商品, 会员折扣
<text class="price">{{ orderInfo.vipAmount }}</text>
优惠券抵扣
, 优惠券抵扣
<text class="price">{{ orderInfo.couponAmount }}</text>
</view>
<view class="price-box">
积分抵扣
<text class="price">{{ orderInfo.integrationAmount }}</text>
,运费
, 运费
<text class="price">{{ orderInfo.freightAmount }}</text>
<view class="yt-list-cell b-b" v-if="groupActivity">
<!-- <view class="yt-list-cell b-b" v-if="groupActivity">
<text class="cell-tit clamp">活动金额</text>
<text class="cell-tip">{{ groupActivity.price }}</text>
</view>
,实付款
</view> -->
, 实付款
<text class="price">{{ orderInfo.payAmount }}</text>
</view>
<view class="action-box b-t">
</view>
<view class="action-box b-t" v-if="orderInfo.status==12||orderInfo.status==3">
<button v-if="orderInfo.status == 12" class="action-btn"
@click="cancelOrder(orderInfo)">取消订单</button>
<button v-if="orderInfo.status == 12" class="action-btn recom"
@click="payOrder(orderInfo)">立即支付</button>
<button v-if="orderInfo.status <7" class="action-btn recom"
@click="applyRefund(orderInfo.id)">申请售后</button>
<!-- <button v-if="orderInfo.status <7" class="action-btn recom"
@click="applyRefund(orderInfo.id)">申请售后</button> -->
<button v-if="orderInfo.status == 3" class="action-btn recom"
@click="confimDelivery(orderInfo)">确认收货</button>
<button class='action-btn recom' hover-class="btn-hover" v-if="orderInfo.status === 4"
@click="toEvaluate(orderInfo.id)">立即评价</button>
<!-- <button class='action-btn recom' hover-class="btn-hover" v-if="orderInfo.status === 4"
@click="toEvaluate(orderInfo.id)">立即评价</button>-->
</view>
</view>
</scroll-view>
@ -101,7 +111,9 @@
data() {
return {
tabCurrentIndex: 0,
orderInfo: [],
orderInfo: {
orderItemList:[]
},
navList: [{
status: 0,
text: '全部',
@ -143,6 +155,8 @@
this.orderInfo = await Api.apiCall('get', Api.order.orderDetail, params);
this.orderInfo = Object.assign(this.orderInfo, this.orderStateExp(this.orderInfo.status));
this.orderInfo.createTime = this.dateFormat(this.orderInfo.createTime);
console.log("data:------" + JSON.stringify(this.orderInfo))
console.log("data:------" + this.orderInfo.stateTip)
},
methods: {
@ -233,15 +247,11 @@
orderStateExp(value) {
let stateTip = '',
stateTipColor = '#fa436a';
if (value === 12) {
stateTipColor = '#909399';
return '待付款';
}
if (value === 1) {
stateTipColor = '#909399';
return '支付成功,没有回掉';
}
if (value === 2) {
stateTip= '支付成功,没有回掉';
}else if (value === 2) {
stateTip = '待发货';
} else if (value === 3) {
stateTip = '待收货';
@ -256,6 +266,9 @@
stateTip = ' 维权已完成';
} else if (value === 8) {
stateTip = '待分享';
}else if (value === 12) {
stateTipColor = '#909399';
stateTip= '待付款';
} else if (value === 13) {
stateTip = '申请退款';
} else if (value === 14) {
@ -426,16 +439,23 @@
line-height: 1;
}
.num_price {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 5px;
.attr-box {
flex: 1;
font-size: $font-sm + 2upx;
color: $font-color-light;
padding: 10upx 12upx;
margin: 0 2upx 0 8upx;
}
.price {
font-size: $font-base + 2upx;
color: $font-color-dark;
&:before {
content: '¥';
font-size: $font-sm;
@ -443,13 +463,13 @@
}
}
}
}
}
.price-box {
display: flex;
justify-content: flex-end;
align-items: baseline;
padding: 20upx 30upx;
font-size: $font-sm + 2upx;
color: $font-color-light;

Loading…
Cancel
Save