123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template></template>
- <script setup lang="ts">
- import { unifyTemplate } from '@/hooks/unifyTemplate';
- import { onLoad } from '@dcloudio/uni-app';
- import { request } from '@/utils/network/request';
- import { setToken } from '@/utils/storage';
- const {
- initData, //初始化数据
- qdOrderVal //qdOrder中数据 ref
- } = unifyTemplate(); //初始化数据
-
- //获取页面配置
- onLoad((opin) => {
- initData(opin, 3).then(async (data) => {
- await register(data.order);
- if (parseInt(data.order.isValueCard) === 1) {
- // 1-储值,2-记账
- handleGoods(data.qdOrder.qdOrderNo, data.config.jumpPage);
- } else {
- contractTesting(data.qdOrder.qdOrderNo, data.config.jumpPage);
- }
- });
- });
- // 无感登录,如果没有登录调用登录
- async function login(orderData) {
- let data = {
- userType: '',
- account: ''
- };
- if (orderData.order.userType === 'PERSONAL_USER') {
- // 个人办理
- data.userType = 'PERSONAL';
- data.account = orderData.order.customerTel;
- } else {
- // 单位办理
- data.userType = 'ENTERPRISE';
- data.account = orderData.order.customerIdnum;
- }
- await request('abaf0013caa24dafad12b0f571e8ee40', {
- data
- }).then((res) => {
- if (res.statusCode === 0) {
- let bizContent = JSON.parse(res.bizContent);
- // 保存token
- setToken(bizContent.accessToken);
- }
- // contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
- });
- }
- // 推送
- function handleGoods(qdOrderNo, jumpPage) {
- const data = {
- qdOrderNo
- };
- console.log(data, '推送请求参数ad8836c3ec25437b913059cf94d6c9ba');
- request('ad8836c3ec25437b913059cf94d6c9ba', {
- data
- }).then((res) => {
- if (res.statusCode === 0) {
- // 储值卡跳转下个页面
- uni.navigateTo({
- url: '/' + jumpPage,
- animationType: 'pop-in',
- animationDuration: 500
- });
- }
- });
- }
- // 签约检测
- function contractTesting(qdOrderNo, jumpPage) {
- const data = {
- qdOrderNo
- };
- console.log(data,'签约检测');
- request('fdfbdddba6ec49f8b451cf2e299b4feb', {
- data
- }).then((res) => {
- if (res.statusCode === 0) {
- const data = JSON.parse(res.bizContent);
- console.log(data, '签约状态');
- if (
- data.signStatus === 1 &&
- data.accountStatus === 1 &&
- data.bindStatus === 1
- ) {
- // 上面三值都为1才进行下一步,否则进行签约初始化
- if (!jumpPage) return;
- uni.navigateTo({
- url: '/' + jumpPage,
- animationType: 'pop-in',
- animationDuration: 500
- });
- /* 自定义返回 */
- } else {
- // 进行签约初始化
- signingInitialization(qdOrderNo);
- }
- // qdOrderStore.orderInfo.value.orderId = JSON.parse(res.bizContent).orderId
- // 通过检测
- }
- });
- }
- // 签约初始化
- function signingInitialization(qdOrderNo) {
- const data = {
- qdOrderNo
- };
- request('94569071cf814517908cd35693f1f2e1', {
- data
- }).then((res) => {
- if (res.statusCode === 0) {
- const data = JSON.parse(res.bizContent);
- console.log(data);
- if (data.returnType === 0) {
- // 0-无需跳转,关闭H5即可 1-需跳转至返回url
- // const opened = window.open('about:blank', '_self');
- // opened.opener = null;
- // opened.close();
- closeWin();
- } else {
- // uni.navigateTo({
- // url: `/pages/sigManage/signContract?qdOrderNo=${qdOrderNo}&jumpPage=${data.returnUrl}`,
- // animationType: 'pop-in',
- // animationDuration: 500
- // })
- console.log(data);
- window.open(data.signUrl, '_self');
- }
- }
- });
- }
- import wx from 'weixin-js-sdk';
- // 关闭当前页面方法
- function closeWin() {
- // @ts-ignore
- wx.miniProgram.getEnv(function (res) {
- if (res.miniprogram) {
- // @ts-ignore
- wx.miniProgram.navigateTo({
- url: '/page/index/index'
- });
- } else {
- const opened = window.open('about:blank', '_self');
- opened.opener = null;
- opened.close();
- }
- });
- }
-
- // 无感注册拿到openId
- function register(data: any) {
- let params: any = {};
- params.idNum = data.customerIdnum;
- params.idType = data.customerIdtype;
- params.mobile = data.customerTel || data.agentTel;
- params.userName = data.customerName;
- params.gender = data.customerGender || 'UNKOWN';
- params.certifyChannel = 'BAIDUOCR'; //实名渠道
- params.address = data.address || '默认地址';
- let userType = '';
- if (data.userType !== 'PERSONAL_USER') {
- // 企业 办理
- params.agentIdNum = data.agentIdNum;
- params.agentIdType = data.agentIdType;
- params.agentName = data.agentName;
- userType = 'ENTERPRISE';
- params.department = data.customerDepartment;
- }else{
- userType = 'PERSONAL';
- }
- params.userType = userType;
- console.log('请求参数',params);
- return request('52de4029940f4e03b18c3a0b8d64c2db', {
- data: params
- }).then((res) => {
- if (res.statusCode === 0) {
- let bizContent = JSON.parse(res.bizContent);
- // 保存token
- setToken(bizContent.accessToken);
- return bizContent.openId;
- }
- });
- }
- </script>
- <!-- 签约管理 -->
- <style lang="scss" scoped>
- .sig-manage {
- height: 100vh;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .container {
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
- }
-
- :deep(.u-checkbox__label) {
- margin: 0;
- margin-right: 5rpx;
- }
-
- .check-content {
- flex: 1 1 auto;
- position: relative;
-
- .posi {
- position: absolute;
- padding: 20rpx;
- bottom: 30rpx;
- left: 0;
- width: 100%;
- }
- }
-
- .content {
- display: inline;
- word-wrap: break-word;
- }
-
- .item-line {
- color: $u-type-primary;
- cursor: pointer;
- }
-
- .btn {
- height: 80rpx;
- opacity: 1;
- border-radius: 100rpx;
- margin: 20rpx;
- }
-
- .btn-text {
- color: #ffffff;
- font-size: 28rpx;
- }
-
- .nav-bg {
- /* background: linear-gradient(to right, #13E7C1, #43A1E0); */
- border: 1px solid #ffffff;
- background: #1aac1b;
- }
-
- .btn-buttom {
- flex: 0 0 auto;
- }
-
- .slot-content {
- height: 82vh;
- overflow-y: auto;
- }
- </style>
|