Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

signAContract.vue 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template></template>
  2. <script setup lang="ts">
  3. import { unifyTemplate } from '@/hooks/unifyTemplate';
  4. import { onLoad } from '@dcloudio/uni-app';
  5. import { request } from '@/utils/network/request';
  6. import { setToken } from '@/utils/storage';
  7. const {
  8. initData, //初始化数据
  9. qdOrderVal //qdOrder中数据 ref
  10. } = unifyTemplate(); //初始化数据
  11. //获取页面配置
  12. onLoad((opin) => {
  13. initData(opin, 3).then(async (data) => {
  14. await register(data.order);
  15. if (parseInt(data.order.isValueCard) === 1) {
  16. // 1-储值,2-记账
  17. handleGoods(data.qdOrder.qdOrderNo, data.config.jumpPage);
  18. } else {
  19. contractTesting(data.qdOrder.qdOrderNo, data.config.jumpPage);
  20. }
  21. });
  22. });
  23. // 无感登录,如果没有登录调用登录
  24. async function login(orderData) {
  25. let data = {
  26. userType: '',
  27. account: ''
  28. };
  29. if (orderData.order.userType === 'PERSONAL_USER') {
  30. // 个人办理
  31. data.userType = 'PERSONAL';
  32. data.account = orderData.order.customerTel;
  33. } else {
  34. // 单位办理
  35. data.userType = 'ENTERPRISE';
  36. data.account = orderData.order.customerIdnum;
  37. }
  38. await request('abaf0013caa24dafad12b0f571e8ee40', {
  39. data
  40. }).then((res) => {
  41. if (res.statusCode === 0) {
  42. let bizContent = JSON.parse(res.bizContent);
  43. // 保存token
  44. setToken(bizContent.accessToken);
  45. }
  46. // contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
  47. });
  48. }
  49. // 推送
  50. function handleGoods(qdOrderNo, jumpPage) {
  51. const data = {
  52. qdOrderNo
  53. };
  54. console.log(data, '推送请求参数ad8836c3ec25437b913059cf94d6c9ba');
  55. request('ad8836c3ec25437b913059cf94d6c9ba', {
  56. data
  57. }).then((res) => {
  58. if (res.statusCode === 0) {
  59. // 储值卡跳转下个页面
  60. uni.navigateTo({
  61. url: '/' + jumpPage,
  62. animationType: 'pop-in',
  63. animationDuration: 500
  64. });
  65. }
  66. });
  67. }
  68. // 签约检测
  69. function contractTesting(qdOrderNo, jumpPage) {
  70. const data = {
  71. qdOrderNo
  72. };
  73. console.log(data,'签约检测');
  74. request('fdfbdddba6ec49f8b451cf2e299b4feb', {
  75. data
  76. }).then((res) => {
  77. if (res.statusCode === 0) {
  78. const data = JSON.parse(res.bizContent);
  79. console.log(data, '签约状态');
  80. if (
  81. data.signStatus === 1 &&
  82. data.accountStatus === 1 &&
  83. data.bindStatus === 1
  84. ) {
  85. // 上面三值都为1才进行下一步,否则进行签约初始化
  86. if (!jumpPage) return;
  87. uni.navigateTo({
  88. url: '/' + jumpPage,
  89. animationType: 'pop-in',
  90. animationDuration: 500
  91. });
  92. /* 自定义返回 */
  93. } else {
  94. // 进行签约初始化
  95. signingInitialization(qdOrderNo);
  96. }
  97. // qdOrderStore.orderInfo.value.orderId = JSON.parse(res.bizContent).orderId
  98. // 通过检测
  99. }
  100. });
  101. }
  102. // 签约初始化
  103. function signingInitialization(qdOrderNo) {
  104. const data = {
  105. qdOrderNo
  106. };
  107. request('94569071cf814517908cd35693f1f2e1', {
  108. data
  109. }).then((res) => {
  110. if (res.statusCode === 0) {
  111. const data = JSON.parse(res.bizContent);
  112. console.log(data);
  113. if (data.returnType === 0) {
  114. // 0-无需跳转,关闭H5即可 1-需跳转至返回url
  115. // const opened = window.open('about:blank', '_self');
  116. // opened.opener = null;
  117. // opened.close();
  118. closeWin();
  119. } else {
  120. // uni.navigateTo({
  121. // url: `/pages/sigManage/signContract?qdOrderNo=${qdOrderNo}&jumpPage=${data.returnUrl}`,
  122. // animationType: 'pop-in',
  123. // animationDuration: 500
  124. // })
  125. console.log(data);
  126. window.open(data.signUrl, '_self');
  127. }
  128. }
  129. });
  130. }
  131. import wx from 'weixin-js-sdk';
  132. // 关闭当前页面方法
  133. function closeWin() {
  134. // @ts-ignore
  135. wx.miniProgram.getEnv(function (res) {
  136. if (res.miniprogram) {
  137. // @ts-ignore
  138. wx.miniProgram.navigateTo({
  139. url: '/page/index/index'
  140. });
  141. } else {
  142. const opened = window.open('about:blank', '_self');
  143. opened.opener = null;
  144. opened.close();
  145. }
  146. });
  147. }
  148. // 无感注册拿到openId
  149. function register(data: any) {
  150. let params: any = {};
  151. params.idNum = data.customerIdnum;
  152. params.idType = data.customerIdtype;
  153. params.mobile = data.customerTel || data.agentTel;
  154. params.userName = data.customerName;
  155. params.gender = data.customerGender || 'UNKOWN';
  156. params.certifyChannel = 'BAIDUOCR'; //实名渠道
  157. params.address = data.address || '默认地址';
  158. let userType = '';
  159. if (data.userType !== 'PERSONAL_USER') {
  160. // 企业 办理
  161. params.agentIdNum = data.agentIdNum;
  162. params.agentIdType = data.agentIdType;
  163. params.agentName = data.agentName;
  164. userType = 'ENTERPRISE';
  165. params.department = data.customerDepartment;
  166. }else{
  167. userType = 'PERSONAL';
  168. }
  169. params.userType = userType;
  170. console.log('请求参数',params);
  171. return request('52de4029940f4e03b18c3a0b8d64c2db', {
  172. data: params
  173. }).then((res) => {
  174. if (res.statusCode === 0) {
  175. let bizContent = JSON.parse(res.bizContent);
  176. // 保存token
  177. setToken(bizContent.accessToken);
  178. return bizContent.openId;
  179. }
  180. });
  181. }
  182. </script>
  183. <!-- 签约管理 -->
  184. <style lang="scss" scoped>
  185. .sig-manage {
  186. height: 100vh;
  187. width: 100%;
  188. display: flex;
  189. justify-content: center;
  190. align-items: center;
  191. }
  192. .container {
  193. height: 100%;
  194. width: 100%;
  195. display: flex;
  196. flex-direction: column;
  197. }
  198. :deep(.u-checkbox__label) {
  199. margin: 0;
  200. margin-right: 5rpx;
  201. }
  202. .check-content {
  203. flex: 1 1 auto;
  204. position: relative;
  205. .posi {
  206. position: absolute;
  207. padding: 20rpx;
  208. bottom: 30rpx;
  209. left: 0;
  210. width: 100%;
  211. }
  212. }
  213. .content {
  214. display: inline;
  215. word-wrap: break-word;
  216. }
  217. .item-line {
  218. color: $u-type-primary;
  219. cursor: pointer;
  220. }
  221. .btn {
  222. height: 80rpx;
  223. opacity: 1;
  224. border-radius: 100rpx;
  225. margin: 20rpx;
  226. }
  227. .btn-text {
  228. color: #ffffff;
  229. font-size: 28rpx;
  230. }
  231. .nav-bg {
  232. /* background: linear-gradient(to right, #13E7C1, #43A1E0); */
  233. border: 1px solid #ffffff;
  234. background: #1aac1b;
  235. }
  236. .btn-buttom {
  237. flex: 0 0 auto;
  238. }
  239. .slot-content {
  240. height: 82vh;
  241. overflow-y: auto;
  242. }
  243. </style>