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
+35
View File
@@ -66,3 +66,38 @@ export function confirmReceipt(data) {
data, 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" <view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID"
@click="jumpOrderInfo(item)">去付款</view> @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_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_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<view class="operate_comm operate_but_1" <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>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> --> <!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
@@ -184,13 +189,16 @@
</view> </view>
</view> </view>
</up-modal> </up-modal>
<!-- 腾讯电子签H5 → 集成到UniApp -->
<web-view v-if="signUrl" :src="signUrl" @message="handleMessage"></web-view>
</view> </view>
</template> </template>
<script> <script>
import { MINE_ORDER_TYPE, ORDER_TYPE, ORDER_STATUS, getValue } from '@/utils/enumUtils.js'; import { MINE_ORDER_TYPE, ORDER_TYPE, ORDER_STATUS, getValue } from '@/utils/enumUtils.js';
import { ORDER_STATUS_CSS } from '@/utils/enumCssUtils.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 dayjs from 'dayjs';
import { formatDate1, copyData } from '@/utils/index.js' import { formatDate1, copyData } from '@/utils/index.js'
@@ -267,12 +275,19 @@ export default {
loading: false, // 加载状态标志 loading: false, // 加载状态标志
openShow: false, openShow: false,
afterShow: false,// 售后申请 afterShow: false,// 售后申请
isCheckSigne: false,
flowId: null,
signUrl: null
} }
}, },
onLoad(options) { onLoad(options) {
const type = options.type; const type = options.type;
this.form.type = type && type < 5 ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID; this.form.type = type && type < 5 ? parseInt(type, 10) : MINE_ORDER_TYPE.UNPAID;
this.loadData(); this.loadData();
// 待收货判断是否签署
if (this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE) {
this.checkSigned();
}
}, },
methods: { methods: {
dayjs, dayjs,
@@ -292,9 +307,14 @@ export default {
console.log("searchFun", val); console.log("searchFun", val);
}, },
checkType(item) { checkType(item) {
console.log("checkType---", item);
this.form.page = 1; this.form.page = 1;
this.form.type = item.id; this.form.type = item.id;
this.orderList = []; this.orderList = [];
// 待收货判断是否签署
if (this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE) {
this.checkSigned();
}
if (item.id !== MINE_ORDER_TYPE.AFTER_SALE) { if (item.id !== MINE_ORDER_TYPE.AFTER_SALE) {
this.loadData(); this.loadData();
} else { } else {
@@ -389,15 +409,15 @@ export default {
*/ */
confirmReceiptOk(item) { confirmReceiptOk(item) {
const then = this; const then = this;
uni.showModal({ // uni.showModal({
title: '提示', // title: '提示',
content: '是否确认收货?', // content: '是否确认收货?',
success: function (res) { // success: function (res) {
if (res.confirm) { // if (res.confirm) {
then.confirmReceiptFun(item); // then.confirmReceiptFun(item);
} // }
} // }
}); // });
}, },
async confirmReceiptFun(item) { async confirmReceiptFun(item) {
const params = { const params = {
@@ -409,7 +429,103 @@ export default {
this.form.page = 1; this.form.page = 1;
this.loadData(); 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> </script>
@@ -4,6 +4,7 @@
left-path="/pages/mine_package/mine_purse/mine_purse" /> left-path="/pages/mine_package/mine_purse/mine_purse" />
<view class="info_warp"> <view class="info_warp">
<view v-if="form.category === 'raffle' || form.category === 'vcoin'">
<view class="info_title_warp"> <view class="info_title_warp">
<view :class="selInfo === item.key ? 'info_title_item_warp info_title_item_sel_warp' : 'info_title_item_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)"> v-for="item in infoList" :key="item.key" @click="selectInfo(item)">
@@ -11,29 +12,30 @@
<view class="info_title_item_sel_but_warp" v-if="selInfo === item.key"></view> <view class="info_title_item_sel_but_warp" v-if="selInfo === item.key"></view>
</view> </view>
</view> </view>
<view class="line"></view> <view class="line"></view>
</view>
<view v-if="form.category === 'vcoin' || form.category === 'bonus' || form.category === 'expend'">
<view class="info_center_warp"> <view class="info_center_warp">
<view class="info_center_warp-item"> <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-top">21</view>
<view class="info_center_warp-item-bottom">商城总挖矿数量</view> <view class="info_center_warp-item-bottom">{{ item.name }}</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> </view>
</view> </view>
<view class="line"></view> <view class="line"></view>
</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)"> <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"> v-if="orderList && orderList.length !== 0">
<view class="purse_info_left"> <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="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_data_warp">
<view class="purse_info_name">{{ getValue(BALANCE_TYPE, item.type) }}</view> <view class="purse_info_name">{{ getValue(BALANCE_TYPE, item.type) }}</view>
<view class="purse_info_value">{{ formatDate(item.ctdate) }}</view> <view class="purse_info_value">{{ formatDate(item.ctdate) }}</view>
@@ -81,6 +83,7 @@ export default {
key: "lock" key: "lock"
}, },
], ],
source: [],
selInfo: "cur", selInfo: "cur",
form: { form: {
id: 0, id: 0,
@@ -100,6 +103,68 @@ export default {
} }
const lockId = option.lockId; const lockId = option.lockId;
const curId = option.curId; 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') { if (lockId && lockId !== 'null') {
this.lockId = lockId; this.lockId = lockId;
// this.selectInfo(this.infoList[1]); // this.selectInfo(this.infoList[1]);
@@ -223,7 +288,7 @@ export default {
.info_center_warp { .info_center_warp {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 32rpx 100rpx; padding: 32rpx;
.info_center_warp-item { .info_center_warp-item {
.info_center_warp-item-top { .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;
}
}
.purse_info_left .ipurse_nfo_right {
.info_list_warp { display: flex;
margin-top: 30rpx; justify-content: center;
// height: calc(100vh - 500rpx); flex-direction: column;
// overflow-y: auto; }
}
} }
} }
+3 -1
View File
@@ -1,7 +1,9 @@
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 BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境
export const BASE_URL = "https://api.gtn9.art";
export const PRIVACY_EN = "https://www.finecc.net/?Privacy-Agreement/";//隐私协议地址(英文版) export const PRIVACY_EN = "https://www.finecc.net/?Privacy-Agreement/";//隐私协议地址(英文版)
export const PRIVACY_CN = "https://www.finecc.net/?Privac |y/";//隐私协议地址(中文版) export const PRIVACY_CN = "https://www.finecc.net/?Privac |y/";//隐私协议地址(中文版)