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.

signContract.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="content" v-if="online === 2">
  3. <custom-header title="支付账户签约" :back="false"></custom-header>
  4. <view style="padding: 20rpx 0 30rpx" class="order-content">
  5. <!-- 获取产品展示 -->
  6. <view class="order-car" v-for='(item,index) in paymentChannelList' :key='index'>
  7. <view class="l-img">
  8. <image class="icon-tip" :src="item.imgUrl" mode='aspectFit'></image>
  9. </view>
  10. <view class="c-amount">
  11. <view class="goods-name">
  12. {{item.name}}
  13. </view>
  14. <view class="goods-des">
  15. {{item.desc}}
  16. </view>
  17. <view class="goods-label">
  18. <view class="label-item" v-for='(labelItem,index) in item.label' :key='index'>
  19. <u-tag :text="labelItem" mode="light" size='mini' bg-color='#38ca83' border-color='#38ca83'
  20. color='#fff' />
  21. </view>
  22. </view>
  23. </view>
  24. <view class="r-btn">
  25. <u-button shape="circle" plain class="custom-style" @click="handleCon">签约</u-button>
  26. </view>
  27. </view>
  28. </view>
  29. <u-popup v-model="show" mode='right' :closeable='true' length='100%'>
  30. <view style='background-color: #f4f4f4;height: 100vh;position: relative;'>
  31. <view class="title">
  32. 签约
  33. </view>
  34. <view class="slot-content">
  35. <view style="background-color: #fff;">
  36. <view class="con-img">
  37. <qrcode-vue :value="qrCodeValue" level="H" :render-as="renderAs" style='width: 100%;height: 100%;' />
  38. </view>
  39. <view class="con-info">
  40. 请打开微信扫码完成签约
  41. </view>
  42. </view>
  43. </view>
  44. <view class="bottom-btn">
  45. <button type="success" class="btn-txt btn" @click="handleNext">下一步</button>
  46. </view>
  47. </view>
  48. </u-popup>
  49. </view>
  50. </template>
  51. <script setup lang='ts'>
  52. import {
  53. fileURL
  54. } from '@/utils/network/api.js';
  55. import {
  56. reactive,
  57. ref
  58. } from 'vue'
  59. import {
  60. unifyTemplate
  61. } from '@/hooks/unifyTemplate'
  62. import {
  63. onLoad
  64. } from '@dcloudio/uni-app';
  65. import {
  66. request
  67. } from '@/utils/network/request'
  68. import QrcodeVue, {
  69. Level,
  70. RenderAs
  71. } from 'qrcode.vue'
  72. const {
  73. CustomHeader, //头部组件
  74. } = unifyTemplate() //初始化数据
  75. const {
  76. initData, //初始化数据
  77. qdOrderVal //qdOrder中数据 ref
  78. } = unifyTemplate() //初始化数据
  79. const online = ref(1) //1为线上,2为线下
  80. const jumpPage = ref('pages/payment/signAContract')
  81. //获取页面配置
  82. onLoad((opin) => {
  83. initData(opin, 3).then(data => {
  84. uni.showLoading({
  85. title: '加载中',
  86. mask: true
  87. });
  88. if (opin.jumpPage) {
  89. jumpPage.value = opin.jumpPage
  90. }
  91. online.value = data.order.promotionModes
  92. if (data.order.promotionModes === 1) {
  93. // 线上直接去小程序
  94. handleTo()
  95. } else {
  96. uni.hideLoading()
  97. }
  98. qrCodeValue.value = `https://file.etcjz.cn/file/web/app.html?orderId=${data.order.orderId}`
  99. })
  100. })
  101. const paymentChannelList = [{
  102. name: '微信支付',
  103. imgUrl: `${fileURL}image/applyCard/wx.png`,
  104. desc: '服务费是每笔交易金额的0',
  105. label: ['微信代付', '微信便捷支付']
  106. }]
  107. const show = ref(false)
  108. const qrCodeValue = ref < String > ('')
  109. const renderAs = ref < RenderAs > ('svg')
  110. // 签约按钮
  111. function handleCon() {
  112. show.value = true
  113. }
  114. // 点击下一步
  115. function handleNext() {
  116. contractTesting(qdOrderVal.value.qdOrderNo, jumpPage.value)
  117. }
  118. // 跳转小程序
  119. function handleTo() {
  120. let getTokenUrl = ''
  121. let getUrl = ''
  122. if (import.meta.env.ENV === 'production') {
  123. getTokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx8fba957179c1329a&secret=699c10826113ddb350fbe58a96e2b015'
  124. getUrl = 'https://api.weixin.qq.com/wxa/generatescheme?access_token='
  125. } else {
  126. getTokenUrl = '/wxApi/cgi-bin/token?grant_type=client_credential&appid=wx8fba957179c1329a&secret=699c10826113ddb350fbe58a96e2b015'
  127. getUrl = '/wxApi/wxa/generatescheme?access_token='
  128. }
  129. uni.request({
  130. url: getTokenUrl,
  131. method: 'GET', //请求方式,必须为大写
  132. success: (res) => {
  133. // console.log('接口返回------', res);
  134. let token = res.data['access_token']
  135. uni.request({
  136. url: getUrl + token,
  137. method: 'POST', //请求方式,必须为大写
  138. data: {
  139. "jump_wxa": {
  140. "path": "pages/index/index",
  141. }
  142. },
  143. success: (res) => {
  144. console.log('接口返回------', res);
  145. //
  146. location.href = res.data.openlink
  147. uni.hideLoading()
  148. }
  149. })
  150. }
  151. })
  152. }
  153. // 签约检测
  154. function contractTesting(qdOrderNo, jumpPage) {
  155. const data = {
  156. qdOrderNo,
  157. }
  158. // uni.navigateTo({
  159. // url: '/' + jumpPage,
  160. // animationType: 'pop-in',
  161. // animationDuration: 500
  162. // })
  163. // signingInitialization(qdOrderNo)
  164. // return
  165. request('fdfbdddba6ec49f8b451cf2e299b4feb', {
  166. data,
  167. }).then((res) => {
  168. if (res.statusCode === 0) {
  169. const data = JSON.parse(res.bizContent)
  170. if (data.status !== 0) {
  171. // 后台调用它方接口报错
  172. uni.showModal({
  173. title: '警告',
  174. content: data.msg,
  175. success: function(res) {}
  176. });
  177. return
  178. }
  179. if (data.signStatus === 1 && data.accountStatus === 1 && data.bindStatus === 1) {
  180. // 上面三值都为1才进行下一步,否则进行签约初始化
  181. uni.navigateTo({
  182. url: '/' + jumpPage + `?qdOrderNo=${qdOrderNo}`,
  183. animationType: 'pop-in',
  184. animationDuration: 500
  185. })
  186. /* 自定义返回 */
  187. } else {
  188. // 进行签约初始化
  189. // 提醒未通过
  190. uni.showModal({
  191. title: '提示',
  192. content: '请使用微信扫描二维码进行签约',
  193. success: function(res) {
  194. if (res.confirm) {} else if (res.cancel) {}
  195. }
  196. });
  197. }
  198. // qdOrderStore.orderInfo.value.orderId = JSON.parse(res.bizContent).orderId
  199. // 通过检测
  200. }
  201. })
  202. }
  203. </script>
  204. <!-- 签约管理 -->
  205. <style lang='scss' scoped>
  206. .order-car {
  207. margin: 30rpx 30rpx 0;
  208. width: calc(100% - 60rpx);
  209. height: 190rpx;
  210. border-radius: 20rpx;
  211. background-image: linear-gradient(to right, #15e5c3, #44a2df);
  212. display: flex;
  213. justify-content: space-between;
  214. box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
  215. align-items: center;
  216. color: #fff;
  217. .l-img {
  218. flex-shrink: 0;
  219. width: 120rpx;
  220. height: 120rpx;
  221. .icon-tip {
  222. height: 100%;
  223. width: 100%;
  224. object-fit: contain;
  225. }
  226. }
  227. .c-amount {
  228. flex: 1;
  229. padding: 20rpx 0;
  230. height: 100%;
  231. box-sizing: border-box;
  232. .goods-name {
  233. margin-bottom: 15rpx;
  234. font-size: 38rpx;
  235. }
  236. .goods-des {
  237. font-size: 26rpx;
  238. margin-bottom: 15rpx;
  239. color: #eff;
  240. }
  241. .goods-label {
  242. display: flex;
  243. align-items: center;
  244. .label-item {
  245. margin-right: 10rpx;
  246. }
  247. }
  248. }
  249. .r-btn {
  250. margin-left: 10rpx;
  251. flex-shrink: 0;
  252. width: 130rpx;
  253. margin-right: 20rpx;
  254. .custom-style {
  255. height: 70rpx;
  256. color: #fff;
  257. border-color: #fff;
  258. background-color: rgba(255, 255, 255, 0.2);
  259. }
  260. }
  261. }
  262. .title {
  263. font-size: 36rpx;
  264. text-align: center;
  265. font-weight: bold;
  266. padding: 20rpx 0;
  267. }
  268. .slot-content {
  269. display: flex;
  270. flex-direction: column;
  271. justify-content: center;
  272. align-items: center;
  273. position: absolute;
  274. top: 40%;
  275. left: 50%;
  276. transform: translate(-50%, -50%);
  277. .con-img {
  278. width: 550rpx;
  279. height: 550rpx;
  280. padding: 100rpx;
  281. box-sizing: border-box;
  282. }
  283. .con-info {
  284. text-align: center;
  285. font-size: 26rpx;
  286. margin-bottom: 100rpx;
  287. }
  288. }
  289. .bottom-btn {
  290. position: absolute;
  291. padding: 20rpx;
  292. display: flex;
  293. align-items: center;
  294. bottom: 100rpx;
  295. width: 750rpx;
  296. .btn {
  297. height: 80rpx;
  298. opacity: 1;
  299. border-radius: 100rpx;
  300. margin: 20rpx 20rpx 20rpx 20rpx;
  301. width: 100%;
  302. }
  303. .btn-txt {
  304. background: #1AAC1B;
  305. margin: 10px;
  306. color: #FFFFFF;
  307. font-size: 28rpx;
  308. }
  309. }
  310. </style>