feat:签名功能

This commit is contained in:
2025-08-12 11:28:59 +08:00
parent 3f87303223
commit cd8ecd0a48
4 changed files with 320 additions and 68 deletions
+58 -23
View File
@@ -6,10 +6,10 @@ import request from '@/utils/request.js'; // 引入封装的方法
*/
export function getOrderList(params) {
return request({
url: "/order/getList",
method: "get",
data:params,
});
url: "/order/getList",
method: "get",
data: params,
});
}
/**
@@ -18,20 +18,20 @@ export function getOrderList(params) {
*/
export function getDetail(params) {
return request({
url: "/order/getDetail",
method: "get",
data:params,
});
url: "/order/getDetail",
method: "get",
data: params,
});
}
// 支付订单
export function payment(data) {
// data.appId = APPID;
return request({
url: "/order/payment",
method: "post",
data,
});
url: "/order/payment",
method: "post",
data,
});
}
/**
* 查询订单统计
@@ -39,10 +39,10 @@ export function payment(data) {
*/
export function getStatistics(params) {
return request({
url: "/order/getStatistics",
method: "get",
data:params,
});
url: "/order/getStatistics",
method: "get",
data: params,
});
}
/**
@@ -51,18 +51,53 @@ export function getStatistics(params) {
*/
export function getSupportPay(params) {
return request({
url: "/cart/getSupportPay",
method: "get",
data:params,
});
url: "/cart/getSupportPay",
method: "get",
data: params,
});
}
// 确认收货
export function confirmReceipt(data) {
// data.appId = APPID;
return request({
url: "/order/confirmReceipt",
method: "post",
data,
url: "/order/confirmReceipt",
method: "post",
data,
});
}
// 判断是否已经签名
export function isSignContract() {
return request({
url: "/signature/isSignContract",
method: "get",
});
}
// 获取H5签署链接
export function getSignUrl(data) {
return request({
url: "/signature/createFlowSignUrl",
method: "post",
data,
});
}
// 发起合同签章
export function signContract(data) {
return request({
url: "/signature/contractSignature",
method: "post",
data,
});
}
// 获取跳转至腾讯电子签小程序的签署链接
export function getMiniProgramSignUrl(data) {
return request({
url: "/signature/createSchemeUrl",
method: "post",
data,
});
}
+129 -13
View File
@@ -73,11 +73,16 @@
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID"
@click="jumpOrderInfo(item)">去付款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE"
@click="confirmReceiptOk(item)">确认收货</view>
<view class="operate_comm operate_but_2" v-if="!isCheckSigne && item.status === ORDER_TYPE.NOT_RECEIVE"
@click="onSignContract(item)">去签署
</view>
<view v-if="isCheckSigne && item.status === ORDER_TYPE.NOT_RECEIVE" @click="confirmReceiptOk(item)">确认收货
</view>
<!-- <view class="operate_comm operate_but_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<view class="operate_comm operate_but_1"
v-if="[ORDER_TYPE.NOT_RECEIVE, ORDER_TYPE.UNSHIPPED].includes(item.status)" @click="afterShow = true;">
v-if="[ORDER_TYPE.NOT_RECEIVE, ORDER_TYPE.UNSHIPPED].includes(item.status) && isCheckSigne"
@click="afterShow = true;">
申请售后
</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
@@ -184,13 +189,16 @@
</view>
</view>
</up-modal>
<!-- 腾讯电子签H5 → 集成到UniApp -->
<web-view v-if="signUrl" :src="signUrl" @message="handleMessage"></web-view>
</view>
</template>
<script>
import { MINE_ORDER_TYPE, ORDER_TYPE, ORDER_STATUS, getValue } from '@/utils/enumUtils.js';
import { ORDER_STATUS_CSS } from '@/utils/enumCssUtils.js';
import { getOrderList, confirmReceipt } from '@/api/order.js';
import { getOrderList, confirmReceipt, getSignUrl, signContract, isSignContract, getMiniProgramSignUrl } from '@/api/order.js';
import dayjs from 'dayjs';
import { formatDate1, copyData } from '@/utils/index.js'
@@ -267,12 +275,19 @@ export default {
loading: false, // 加载状态标志
openShow: false,
afterShow: false,// 售后申请
isCheckSigne: false,
flowId: null,
signUrl: null
}
},
onLoad(options) {
const type = options.type;
this.form.type = type && type < 5 ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID;
this.loadData();
// 待收货判断是否签署
if (this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE) {
this.checkSigned();
}
},
methods: {
dayjs,
@@ -292,9 +307,14 @@ export default {
console.log("searchFun", val);
},
checkType(item) {
console.log("checkType---", item);
this.form.page = 1;
this.form.type = item.id;
this.orderList = [];
// 待收货判断是否签署
if (this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE) {
this.checkSigned();
}
if (item.id !== MINE_ORDER_TYPE.AFTER_SALE) {
this.loadData();
} else {
@@ -389,15 +409,15 @@ export default {
*/
confirmReceiptOk(item) {
const then = this;
uni.showModal({
title: '提示',
content: '是否确认收货?',
success: function (res) {
if (res.confirm) {
then.confirmReceiptFun(item);
}
}
});
// uni.showModal({
// title: '提示',
// content: '是否确认收货?',
// success: function (res) {
// if (res.confirm) {
// then.confirmReceiptFun(item);
// }
// }
// });
},
async confirmReceiptFun(item) {
const params = {
@@ -409,7 +429,103 @@ export default {
this.form.page = 1;
this.loadData();
}
},
// 判断是否已经签名
async checkSigned() {
const { bizcode, data } = await isSignContract();
if (bizcode === 100) {
this.isCheckSigne = data;
}
},
// 发起合同签章
async onSignContract(item) {
const params = {
// 需要的参数
orderId: item.id,
}
const { bizcode, data } = await signContract(params);
if (bizcode === 100) {
this.flowId = item.flowId
if (this.flowId)
this.onGetSignUrl(this.flowId);
}
},
// 获取H5签署链接
async onGetSignUrl(flowId) {
const params = {
// 需要的参数
orderId: flowId,
}
const { bizcode, data } = await getSignUrl(params);
if (bizcode === 100) {
this.onGetMiniProgramSignUrl(data)
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "获取签署链接失败,请稍后再试",
});
return null;
}
},
// 获取跳转至腾讯电子签小程序的签署链接
async onGetMiniProgramSignUrl(item) {
const params = {
// 需要的参数
flowId: this.flowId,
endPoint: item.flowApproverUrlInfos.signUrl
}
const { bizcode, data } = await getMiniProgramSignUrl(params);
if (bizcode === 100) {
// return data;
console.log("跳转至腾讯电子签小程序的签署链接", data);
// #ifdef APP-PLUS || WEB
// #endif
// #ifdef MP-WEIXIN
// 小程序
this.openTencentESign(data);
// #endif
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "获取签署链接失败,请稍后再试",
});
return null;
}
},
// 电子签的回调地址
handleMessage(e) {
const data = e.detail.data[0];
console.log();
// if (data.type === 'signDone' && data.result === 'success') {
// uni.navigateTo({ url: '/pages/result/index' });
// }
},
// 小程序签名
openTencentESign() {
// 这个链接需要后端调用腾讯电子签 API 获取
// 类似:https://esign.tencent.com/miniprogram?flowId=xxxx&token=xxxx
const signPath = '/pages/sign/sign?flowId=xxxxx&token=yyyyy' // 腾讯电子签小程序内部页面路径
uni.navigateToMiniProgram({
appId: 'wxXXXXXXXXXXXXXXX', // 腾讯电子签官方小程序的 appId
path: signPath, // 跳转到的页面路径 + 参数
extraData: {}, // 如果需要传额外参数
envVersion: 'release', // 小程序版本 release / trial / develop
success(res) {
console.log('跳转成功', res)
},
fail(err) {
console.error('跳转失败', err)
}
})
}
}
}
</script>
@@ -4,36 +4,38 @@
left-path="/pages/mine_package/mine_purse/mine_purse" />
<view class="info_warp">
<view class="info_title_warp">
<view :class="selInfo === item.key ? 'info_title_item_warp info_title_item_sel_warp' : 'info_title_item_warp'"
v-for="item in infoList" :key="item.key" @click="selectInfo(item)">
<text>{{ item.name }}</text>
<view class="info_title_item_sel_but_warp" v-if="selInfo === item.key"></view>
<view v-if="form.category === 'raffle' || form.category === 'vcoin'">
<view class="info_title_warp">
<view :class="selInfo === item.key ? 'info_title_item_warp info_title_item_sel_warp' : 'info_title_item_warp'"
v-for="item in infoList" :key="item.key" @click="selectInfo(item)">
<text>{{ item.name }}</text>
<view class="info_title_item_sel_but_warp" v-if="selInfo === item.key"></view>
</view>
</view>
<view class="line"></view>
</view>
<view class="line"></view>
<view class="info_center_warp">
<view class="info_center_warp-item">
<view class="info_center_warp-item-top">21</view>
<view class="info_center_warp-item-bottom">商城总挖矿数量</view>
</view>
<view class="info_center_warp-item">
<view class="info_center_warp-item-top">231</view>
<view class="info_center_warp-item-bottom">已兑换数量</view>
<view v-if="form.category === 'vcoin' || form.category === 'bonus' || form.category === 'expend'">
<view class="info_center_warp">
<view class="info_center_warp-item" v-for="item in source">
<view class="info_center_warp-item-top">21</view>
<view class="info_center_warp-item-bottom">{{ item.name }}</view>
</view>
</view>
<view class="line"></view>
</view>
<view class="line"></view>
<view class="info_list_warp">
<view class="info_list_warp-mine">
<scroll-view scroll-y="true" @scrolltolower="loadMore(selInfo)" style="height:calc(100vh - 300rpx)">
<view v-for="item in orderList" :key="item.id" class="purse_info_item"
<view v-for="item in orderList" :key="item.id" class="purse_info_item-mine"
v-if="orderList && orderList.length !== 0">
<view class="purse_info_left">
<!-- <up-image :src="item.type === 1? '/static/mine/purse_sf.png' : '/static/mine/purse_xf.png'" width="40" height="40" bgColor="#f1f6ff00"></up-image> -->
<up-image src="/static/mine/purse_sf.png" width="40" height="40" bgColor="#f1f6ff00"></up-image>
<up-image src="/static/mine/purse_sf.png" width="32" height="32" bgColor="#f1f6ff00"></up-image>
<view class="purse_data_warp">
<view class="purse_info_name">{{ getValue(BALANCE_TYPE, item.type) }}</view>
<view class="purse_info_value">{{ formatDate(item.ctdate) }}</view>
@@ -81,6 +83,7 @@ export default {
key: "lock"
},
],
source: [],
selInfo: "cur",
form: {
id: 0,
@@ -100,6 +103,68 @@ export default {
}
const lockId = option.lockId;
const curId = option.curId;
// 分红金额
if (category === 'bonus') {
this.source = [
{
name: "今日分红数量",
key: "cur"
},
{
name: "总分红数量",
key: "lock"
},
{
name: "平台总分红",
key: "lock"
},
{
name: "分红资金池剩余",
key: "lock"
},
];
}
// TBC
if (category === 'vcoin') {
this.source = [
{
name: "商城总挖矿数量",
key: "cur"
},
{
name: "已兑换数量",
key: "lock"
},
];
}
// 贡献值 expend
if (category === 'expend') {
this.source = [
{
name: "今日贡献值",
key: "cur"
},
{
name: "总贡献值",
key: "lock"
},
{
name: "今日商城贡献值",
key: "lock"
},
{
name: "我的占比",
key: "lock"
},
];
}
if (lockId && lockId !== 'null') {
this.lockId = lockId;
// this.selectInfo(this.infoList[1]);
@@ -223,7 +288,7 @@ export default {
.info_center_warp {
display: flex;
justify-content: space-between;
padding: 32rpx 100rpx;
padding: 32rpx;
.info_center_warp-item {
.info_center_warp-item-top {
@@ -242,15 +307,49 @@ export default {
}
}
.info_list_warp-mine {
padding: 44rpx 32rpx;
.purse_info_item-mine {
display: flex;
justify-content: space-between;
border: 0;
height: 128rpx;
margin-bottom: 0;
padding: 0;
.purse_data_warp {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 20rpx;
.purse_info_name {
font-size: 28rpx;
color: #333333;
font-weight: normal;
}
.purse_info_value {
font-size: 24rpx;
color: #999999;
}
.purse_info_title {
font-weight: bold;
font-size: 32px;
color: #333333;
}
}
.info_list_warp {
margin-top: 30rpx;
// height: calc(100vh - 500rpx);
// overflow-y: auto;
.purse_info_left .ipurse_nfo_right {
display: flex;
justify-content: center;
flex-direction: column;
}
}
}
}
+9 -7
View File
@@ -1,12 +1,14 @@
export const BASE_URL="https://frontend.jdns360.com/api"; // 正式环境
// export const BASE_URL="https://frontend.jdns360.com/api"; // 正式环境
// export const BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境
export const PRIVACY_EN="https://www.finecc.net/?Privacy-Agreement/";//隐私协议地址(英文版)
export const PRIVACY_CN="https://www.finecc.net/?Privac |y/";//隐私协议地址(中文版)
export const BASE_URL = "https://api.gtn9.art";
export const USER_EN="https://www.finecc.net/?FAQ/3421.html";//用户协议(英文版)
export const USER_CN="https://www.finecc.net/?wenti/3422.html";//用户协议(中文版)
export const PRIVACY_EN = "https://www.finecc.net/?Privacy-Agreement/";//隐私协议地址(英文版)
export const PRIVACY_CN = "https://www.finecc.net/?Privac |y/";//隐私协议地址(中文版)
export const USER_EN = "https://www.finecc.net/?FAQ/3421.html";//用户协议(英文版)
export const USER_CN = "https://www.finecc.net/?wenti/3422.html";//用户协议(中文版)
// 信任桥 测试环境
// export const Authorization = "JETZ/vKlEkgrxD4f14YBDNjmh2i2KoPF2ToNtDnIqtHV33tZdyZU8YfMBZV+5OT2cCc5URvFuhE9jCbnDScnjV/QtJMZK57dVWL9nmkByJ1epgDjkOO0w9gN8hVmcnDl8Rt415b2PDfagNmTZ6yThBGEjA+9w4rnkDQxec6SI/EcYDjX5EDQC8WQd3+1jyyfSrVpNOktB1/wlkP9B1VUATCD3agxQG5BrUvLWxiCPre12/mHv2N9cnNbgbu698RaWF2LsvULRGNciS0OJJYaKz7RPCZnA4C34C1m85beBgrrvJUaJtimlB9GU9c9NX5atdc3z/gRbVaEXhv24mpQVA==";
@@ -15,5 +17,5 @@ export const USER_CN="https://www.finecc.net/?wenti/3422.html";//用户协议(
// 信任桥 正式环境
export const Authorization = "bxboAtH04huysyO1DO2E4FNomvQaFItp0gzHRv0aM+Hx4Rb9pijiAlWdRPUtB4HUJrwa1yVGoKFyCmXGZYja9v+GPz+SFVnDJJk/yit2LLMxX85SpnzRzVySJSsDTBLSTrh5BhGPST2iymdcGvQAdNIW9gAQoeDGIr8o3ctgLF08cdJiEQc255Ql7LxdqiHgP/SgY2JUrlGxGzE5iXDETCmXCvBxqbxEzhe4JbgdEMlKjjA0jcFDam0ArHPD2CoHI7WemdJZDw2+OAokFnoSF8dMyt1G9+nHqD40iMcK5bG6BFUNJwVMFgIZvQz5OqotqaNKnq/80UNDyOyeaaj9Lw==";
export const CUSTOMER_SERVICE_PHONE_NUMBER="138 8888 8888";// 客服联系方式
export const CLOUD_SERVICE_PHONE_NUMBER="186 5566 5566";// 云仓客服联系方式
export const CUSTOMER_SERVICE_PHONE_NUMBER = "138 8888 8888";// 客服联系方式
export const CLOUD_SERVICE_PHONE_NUMBER = "186 5566 5566";// 云仓客服联系方式