feat:解决打包问题

This commit is contained in:
2025-08-13 21:29:17 +08:00
parent 59f8dc46a3
commit 8b2b11a250
3 changed files with 131 additions and 38 deletions
+1 -1
View File
@@ -124,5 +124,5 @@
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
"vueVersion" : "2"
}
+114 -28
View File
@@ -1,14 +1,16 @@
<template>
<view class="content">
<TopSafe></TopSafe>
<Header title="我的合同" />
<Header title="我的合同" />
<view class="contract-view">
<ContractItem :type="obj && obj.state"
:text="obj && obj.signatureName"
:time="obj && obj.time"
class="mt-24" @click="onBtn"></ContractItem>
<ContractItem :type="obj && obj.state" :text="obj && obj.signatureName" :time="obj && obj.time" class="mt-24"
@click="onBtn"></ContractItem>
</view>
<DownPopup></DownPopup>
<down-popup :show="downShow" @ok="onSignContract" @click="downShow = false" />
<!-- 腾讯电子签H5 → 集成到UniApp -->
<web-view v-if="signUrl" :src="signUrl" @message="handleMessage"></web-view>
</view>
</template>
@@ -18,30 +20,35 @@ import Header from '@/components/common/header.vue';
import TopSafe from '@/components/common/top-safe.nvue'
import ContractItem from './components/contract-item.vue'
import DownPopup from '@/components/common/down-popup.vue';
import { getContractList,signContract } from '@/api/contract.js'
import { getContractList, signContract } from '@/api/contract.js'
import { getSignUrl, getMiniProgramSignUrl } from '@/api/order.js';
import func from '@/utils/func.js';
export default {
components: { Header,TopSafe,ContractItem,DownPopup },
components: { Header, TopSafe, ContractItem, DownPopup },
data() {
return {
type:false,
obj:null
type: false,
obj: null,
flowId: null,
signUrl: null,
downShow: false,
selectItem: null,
};
},
onShow() {
this.init();
},
methods: {
init(){
init() {
// this.isSignContract()
this.getSignContract()
},
isSignContract(){
signContract().then(res=>{
if(res.bizcode == 100){
isSignContract() {
signContract().then(res => {
if (res.bizcode == 100) {
this.type = res.data;
}else{
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
@@ -49,12 +56,12 @@ export default {
}
})
},
getSignContract(){
getContractList().then(res=>{
if(res.bizcode == 100){
getSignContract() {
getContractList().then(res => {
if (res.bizcode == 100) {
this.obj = res.data[0];
this.obj.time = func.formatDate(new Date(res.data[0].signatureTime),3)
}else{
this.obj.time = func.formatDate(new Date(res.data[0].signatureTime), 3)
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
@@ -62,25 +69,104 @@ export default {
}
})
},
onBtn(){
if(this.type){
onBtn() {
if (this.type) {
//查看
uni.navigateTo({
url:`/pages/contract/check`
url: `/pages/contract/check`
})
}else{
} else {
//去签署
this.downShow = true;
}
},
// 发起合同签章
async onSignContract() {
const params = {
// 需要的参数
orderId: this.selectItem.id,
}
const { bizcode, data } = await signContract(params);
if (bizcode === 100) {
this.flowId = data.flowId;
if (this.flowId)
// #ifdef APP-PLUS || WEB
this.onGetSignUrl(this.flowId);
// #endif
// #ifdef MP-WEIXIN
// 小程序
this.onGetMiniProgramSignUrl(this.flowId)
// #endif
}
},
// 获取H5签署链接
async onGetSignUrl(flowId) {
const params = {
// 需要的参数
flowId: flowId,
}
const { bizcode, data } = await getSignUrl(params);
if (bizcode === 100) {
this.signUrl = data.flowApproverUrlInfos[0].longUrl;
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "获取签署链接失败,请稍后再试",
});
return null;
}
},
// 获取跳转至腾讯电子签小程序的签署链接
async onGetMiniProgramSignUrl(flowId) {
const params = {
flowId: flowId,
endPoint: 'HTTP_SHORT_URL'
}
const { bizcode, data } = await getMiniProgramSignUrl(params);
if (bizcode === 100) {
console.log("跳转至腾讯电子签小程序的签署链接", data);
this.openTencentESign(data.schemeUrl);
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "获取签署链接失败,请稍后再试",
});
return null;
}
},
// 电子签的回调地址
handleMessage(e) {
const data = e.detail;
console.log('电子签的回调地址', e);
},
// 小程序签名
openTencentESign(signPath) {
// 这个链接需要后端调用腾讯电子签 API 获取
uni.navigateToMiniProgram({
appId: 'wxa023b292fd19d41d', // 腾讯电子签官方小程序的 appId
path: signPath, // 跳转到的页面路径 + 参数
extraData: {}, // 如果需要传额外参数
envVersion: 'release', // 小程序版本 release / trial / develop
success(res) {
console.log('跳转成功', res)
},
fail(err) {
console.error('跳转失败', err)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.contract-view{
width:100%;
height:calc(100% - 88rpx - var(--status-bar-height));
.contract-view {
width: 100%;
height: calc(100% - 88rpx - var(--status-bar-height));
display: flex;
flex-direction: column;
align-items: center;
+16 -9
View File
@@ -74,16 +74,12 @@
@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="!isCheckSigne && item.status === ORDER_TYPE.NOT_RECEIVE"
@click="onSignContract(item)">去签署
</view>
<view class="operate_comm operate_but_2" v-if="isCheckSigne && item.status === ORDER_TYPE.NOT_RECEIVE"
<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_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) && isCheckSigne"
@click="afterShow = true;">
v-if="[ORDER_TYPE.NOT_RECEIVE, ORDER_TYPE.UNSHIPPED].includes(item.status)" @click="afterShow = true;">
申请售后
</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
@@ -193,17 +189,20 @@
<!-- 腾讯电子签H5 → 集成到UniApp -->
<web-view v-if="signUrl" :src="signUrl" @message="handleMessage"></web-view>
<down-popup :show="downShow" @ok="onSignContract" @click="downShow = false" />
</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 downPopup from '@/components/common/down-popup.vue'
import { getOrderList, confirmReceipt, getSignUrl, signContract, isSignContract, getMiniProgramSignUrl } from '@/api/order.js';
import dayjs from 'dayjs';
import { formatDate1, copyData } from '@/utils/index.js'
export default {
components: { downPopup },
computed: {
MINE_ORDER_TYPE() {
return MINE_ORDER_TYPE;
@@ -278,7 +277,10 @@ export default {
afterShow: false,// 售后申请
isCheckSigne: false,
flowId: null,
signUrl: null
signUrl: null,
downShow: false,
selectItem: null,
}
},
onLoad(options) {
@@ -410,6 +412,11 @@ export default {
*/
confirmReceiptOk(item) {
const then = this;
if (!isCheckSigne.value) {
this.selectItem = item;
this.downShow = true;
return;
}
uni.showModal({
title: '提示',
content: '是否确认收货?',
@@ -441,10 +448,10 @@ export default {
},
// 发起合同签章
async onSignContract(item) {
async onSignContract() {
const params = {
// 需要的参数
orderId: item.id,
orderId: this.selectItem.id,
}
const { bizcode, data } = await signContract(params);
if (bizcode === 100) {