bookticket.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <view class="navbar-box">
  5. <u-navbar title="订单详情" :safeAreaInsetTop="true" @leftClick="leftClick" :titleStyle="{color:'#fff'}"
  6. leftIconColor="#fff" bgColor="transparent"></u-navbar>
  7. </view>
  8. <view class="page-wrap">
  9. <view class="base-info">
  10. <view class="up u-flex">
  11. <image class="img" :src="pageContent.performImg" mode="aspectFill" alt="">
  12. <view class="text">
  13. <view class="name text-item">{{pageContent.performName}}-{{pageContent.goodsName}}</view>
  14. <view class="time text-item">日期 {{pageContent.timeDate}}({{pageContent.timeWeek}})</view>
  15. <view class="time text-item">场次 {{pageContent.performTimeStart}} -
  16. {{pageContent.performTimeEnd}}</view>
  17. <view class="num text-item">{{pageContent.goodsName}} / {{pageContent.seatTypeName}}</view>
  18. <view class=" text-item">{{pageContent.auditoriumName}}</view>
  19. <!-- <view class="position text-item">{{performInfo.name}}</view> -->
  20. <!-- <view class="addr u-flex u-row-between">
  21. <view class="u-line-1">地址:遵义市《伟大转折》演艺中心</view>
  22. <u-icon name="arrow-right" color="#2D2D2D" size="36rpx"></u-icon>
  23. </view> -->
  24. </view>
  25. </view>
  26. <view class="down">
  27. <view class="num-wrap u-flex u-row-between">
  28. <view class="title">选购数量</view>
  29. <view class="num">{{totalVisitor}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="block-wrap purchaser">
  34. <view class="block-title u-flex">
  35. <view class="name">购票人信息</view>
  36. <!-- <text>用于入园身份验证</text> -->
  37. </view>
  38. <view class="" v-if="vuex_member_info.isAuth">
  39. <view class="item">姓名:{{pageContent.purchaser.name}}</view>
  40. <view class="item">手机号:{{pageContent.purchaser.mobile|hidePhoneNumber}}</view>
  41. <view class="item">身份证:{{pageContent.purchaser.idcard|maskID}}</view>
  42. </view>
  43. <view class="un-auth" v-else @click="$u.route('center/factorauth',{from:'bookticket'})">
  44. 请先<text style="color: #ED0000;">实名认证</text>
  45. </view>
  46. </view>
  47. <view class="block-wrap visitors">
  48. <view class="block-title u-flex">
  49. <view class="name">观影人信息</view>
  50. <text v-if="needIdcardNumber">需要{{needIdcardNumber}}张身份证</text>
  51. <!-- <text>用于入园身份验证</text> -->
  52. </view>
  53. <view class="people-list u-flex u-flex-wrap">
  54. <view class="people btn" v-if="visitors.length>0" v-for="(visitor,index) in visitors" :key="index">
  55. {{visitor.name}}
  56. </view>
  57. <view class="btn u-flex u-row-center"
  58. @click="visitorShow = true">
  59. <u-icon name="plus-circle" color="#2D2D2D" size="32rpx"></u-icon>
  60. <text class="text">新增/更换</text>
  61. </view>
  62. </view>
  63. <!-- <view class="no-people u-flex" v-if="!visitors.length>0">
  64. <text>游客</text>
  65. <text class="right" @click="visitorShow = true">点击选择游客</text>
  66. </view> -->
  67. <view class="peoples" v-if="visitors.length>0">
  68. <view class="peoples-item u-flex u-row-between" v-for="(visitor,index) in visitors" :key="index">
  69. <view class="left u-flex">
  70. <u-icon @click="delVisitor(visitor)" name="close-circle" color="#2D2D2D"
  71. size="32rpx"></u-icon>
  72. <text style="margin-left: 8rpx;">观影人{{ index + 1 }}</text>
  73. <text class="name">{{visitor.name}}</text>
  74. <!-- <text class="people-id">{{ visitor.idcard | maskID }}</text> -->
  75. </view>
  76. <view class="right" @click="editVisitor(visitor)">编辑</view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="coupon">
  81. <view class="title u-flex u-row-between u-border-bottom">
  82. <text>本单可享优惠</text>
  83. </view>
  84. <view class="single-til u-flex u-row-between">
  85. <view class="text">优惠券</view>
  86. <view class="more-text u-flex">
  87. <text>未使用</text>
  88. <u-icon name="arrow-right" color="#E6E6E6" size="24rpx"></u-icon>
  89. </view>
  90. </view>
  91. <view class="no-coupon">
  92. 您暂无可使用优惠券~
  93. </view>
  94. </view>
  95. <view class="notice">
  96. <view class="title u-flex u-row-between u-border-bottom">
  97. <text>购票须知</text>
  98. </view>
  99. <view class="notice-item parse-content">
  100. <u-parse :content="pageContent.ticketNotice"></u-parse>
  101. </view>
  102. <!-- <view class="notice-item">
  103. 1.由于设备故障等不可抗力因素,存在少量场次取消的情况,会
  104. 进行退票退款
  105. </view>
  106. <view class="notice-item">
  107. 2.由于影院系统不稳定等因素,存在出票失败的情况,会进行退款
  108. </view>
  109. <view class="notice-item">
  110. 3.取票码可以在“我的-订单页”中查看
  111. </view> -->
  112. </view>
  113. </view>
  114. <u-popup :show="visitorShow">
  115. <view class="people-show-content">
  116. <view class="title">
  117. <view class="cancel" @click="visitorShow=false">取消</view>
  118. 选择观影人
  119. </view>
  120. <view class="add-btn u-flex u-row-center" @click="addVisitor">
  121. <!-- <image class="img" :src="staticUrl+'/img/car.png'" ></image> -->
  122. 添加观影人信息
  123. </view>
  124. <view class="list">
  125. <u-checkbox-group v-model="selectedVisitor" iconPlacement="left">
  126. <view class="people u-flex u-row-between" v-for="(item,index) in visitorList" :key="index">
  127. <u-checkbox activeColor="#ED0303" :label="item.name" :name="item.idcard"></u-checkbox>
  128. <u-icon name="edit-pen-fill" color="#7F7F7F" size="32rpx"
  129. @click="editVisitor(item)"></u-icon>
  130. </view>
  131. </u-checkbox-group>
  132. </view>
  133. <view class="full-btn" @click="confirmVisitor">确定</view>
  134. </view>
  135. </u-popup>
  136. <view class="page-bottom">
  137. <view class="inner u-flex u-row-between">
  138. <view class="left u-flex">
  139. <text>应付金额:</text>
  140. <view class="total-price">
  141. {{totalPrice}}
  142. </view>
  143. </view>
  144. <view class="right">
  145. <view class="btn active" v-if="totalPrice>=0&&cansubmit&&vuex_member_info.isAuth"
  146. @click="setTemplate">立即支付</view>
  147. <!-- <u-button @click="setTemplate" class="btn active" v-if="totalPrice>0&&cansubmit&&vuex_member_info.isAuth">立即支付</u-button> -->
  148. <view class="btn" v-else>立即支付</view>
  149. </view>
  150. </view>
  151. </view>
  152. <u-modal
  153. :show="umodal.show"
  154. :title="umodal.title"
  155. :content='umodal.content'
  156. confirmColor="#ED0303"
  157. @confirm="modalConfirm"
  158. ></u-modal>
  159. </view>
  160. </template>
  161. <script>
  162. import { locale } from "moment/moment";
  163. import {
  164. systemInfo
  165. } from "@/mixin.js";
  166. // #ifdef H5
  167. import wxH5 from "weixin-jsapi";
  168. // #endif
  169. export default {
  170. mixins: [systemInfo],
  171. data() {
  172. return {
  173. performId: '',
  174. performInfo: {},
  175. pageData: {}, //上个页面传过来的数据
  176. pageContent: {
  177. performName: '',
  178. goodsName: '',
  179. timeDate: '',
  180. timeWeek: '',
  181. seatTypeName: '',
  182. auditoriumName: '',
  183. performTimeEnd: '',
  184. performTimeStart: '',
  185. purchaser: {
  186. mobile: '',
  187. idcard: ''
  188. },
  189. ticketNotice: '',
  190. viewerList: [],
  191. }, //页面信息
  192. ticketNotice: '',
  193. cansubmit: true,
  194. staticUrl: this.$commonConfig.staticUrl,
  195. visitors: [], //确认的游客
  196. visitorShow: false, //游客弹层
  197. visitorList: [], //游客列表
  198. selectedVisitor: [], //选中的游客(id)
  199. params: {}, //要提交的数据
  200. orderId: '', //订单提交获取
  201. payResult: {}, //gotoPay结果
  202. paysuccess: false, //支付结果
  203. templateIdList: [], //微信小程序订阅消息
  204. umodal:{
  205. show:false,
  206. title:'温馨提示',
  207. content:''
  208. },
  209. scene:null,
  210. retailId:null,//分销码
  211. label:null,//scene解析出来的
  212. retailId:null,
  213. }
  214. },
  215. computed: {
  216. totalPrice() {
  217. let that = this;
  218. return this.visitors.reduce((total, item) => {
  219. let price = Number(that.pageData.salePrice);
  220. if(this.pageContent.personnelNum!==0){
  221. total = price
  222. }else{
  223. total += price;
  224. }
  225. return total;
  226. }, 0).toFixed(2);
  227. },
  228. totalVisitor() {
  229. let that = this;
  230. return this.visitors.reduce((total, item) => {
  231. total += 1;
  232. return total;
  233. }, 0);
  234. },
  235. needIdcardNumber(){
  236. if(this.pageContent.oneMany===1&&this.pageContent.personnelNum!==0){
  237. return this.pageContent.personnelNum
  238. }else if(this.pageContent.oneMany===1&&this.pageContent.personnelNum===0){
  239. return null
  240. }else if(this.pageContent.oneMany===2){
  241. return 1
  242. }
  243. }
  244. },
  245. onShow() {
  246. this.getSettlement();
  247. },
  248. onLoad(page) {
  249. console.log('page', page);
  250. this.pageData = page;
  251. this.performId = page.performId;
  252. this.pageData.performTimeId = page.performTimeId;
  253. this.pageData.seatTypeId = page.seatTypeId
  254. this.getSystemInfo();
  255. this.getSettlement();
  256. this.getTemplateIdList(); //获取模板列表
  257. },
  258. methods: {
  259. leftClick(e) {
  260. let pages = getCurrentPages();
  261. if (pages.length == 1) {
  262. uni.$u.route('/pages/index/index')
  263. } else {
  264. uni.navigateBack()
  265. };
  266. },
  267. getSettlement() {
  268. this.$u.api.getSettlement(this.pageData).then(res => {
  269. // console.log('getSettlement',res.data);
  270. this.pageContent = res.data;
  271. this.getMemberAll();
  272. }).catch(err => {
  273. console.log('getSettlement', err);
  274. })
  275. },
  276. getMemberAll() {
  277. let that = this;
  278. // const userId = this.vuex_member_info.id;
  279. const userId = this.pageContent.viewerList[0]?.id;
  280. this.$u.api.selectMemberAll({
  281. userid: userId
  282. }).then(res => {
  283. // console.log('getMemberAll',res.data);
  284. this.visitorList = res.data.list;
  285. // this.visitors = this.visitorList.filter(obj => obj.memberId==userId);
  286. this.selectedVisitor = [];
  287. this.visitorList.forEach(visitor => {
  288. if (this.visitors.find(item => item.idcard === visitor.idcard)) {
  289. this.selectedVisitor.push(visitor.idcard);
  290. }
  291. });
  292. this.visitors = this.visitorList.filter(obj => that.selectedVisitor.includes(obj.idcard));
  293. console.log('this.visitorList',this.visitorList);
  294. console.log('this.selectedVisitor',this.selectedVisitor);
  295. console.log('this.visitors',this.visitors);
  296. }).catch(err => {
  297. console.log('getMemberAll', err);
  298. })
  299. },
  300. confirmVisitor() {
  301. let that = this;
  302. if(this.needIdcardNumber&&this.needIdcardNumber!==this.selectedVisitor.length){
  303. uni.showToast({
  304. title:`身份证数量应该为${this.needIdcardNumber}张`,
  305. icon:'none'
  306. })
  307. return false
  308. }
  309. // console.log('selectedVisitor',this.selectedVisitor);
  310. this.visitorShow = false;
  311. this.visitors = this.visitorList.filter(obj => that.selectedVisitor.includes(obj.idcard)).map(item => {
  312. return {
  313. name: item.name,
  314. mobile: item.mobile,
  315. idcard: item.idcard
  316. }
  317. });
  318. // console.log('this.visitors',this.visitors);
  319. },
  320. delVisitor(visitor) {
  321. // console.log('delVisitor',visitor);
  322. // console.log('this.visitors',this.visitors);
  323. this.visitors = this.visitors.filter(obj => obj.idcard != visitor.idcard);
  324. this.selectedVisitor = this.selectedVisitor.filter(item => item != visitor.idcard);
  325. // console.log('this.visitors',this.visitors);
  326. // console.log('this.selectedVisitor',this.selectedVisitor);
  327. },
  328. addVisitor() {
  329. uni.$u.route('/center/people', {
  330. type: 'addVisitor',
  331. fromPage: 'bookticket'
  332. });
  333. },
  334. editVisitor(item) {
  335. uni.$u.route('/center/people', {
  336. type: 'editVisitor',
  337. fromPage: 'bookticket',
  338. id: item.id,
  339. name: item.name,
  340. mobile: item.mobile,
  341. idcard: item.idcard,
  342. });
  343. },
  344. getTemplateIdList() {
  345. this.$u.api.templateIdList({
  346. templateLabel: 'order_pay'
  347. }).then(res => {
  348. // console.log('getTemplateIdList', res.data);
  349. this.templateIdList = res.data.list.map(item => {
  350. return item.templateId
  351. });
  352. // if(this.templateIdList.length>0){
  353. // this.templateEven();
  354. // }
  355. }).catch(err => {
  356. console.log('getTemplateIdList', err);
  357. })
  358. },
  359. async submitorder() {
  360. let _this = this;
  361. let retailId = null;
  362. try {
  363. retailId = await new Promise((resolve, reject) => {
  364. uni.getStorage({
  365. key: 'retailId',
  366. success: function (res) {
  367. console.log('getPositionData retailId====', res.data);
  368. resolve(res.data);
  369. },
  370. fail: function (error) {
  371. reject(error);
  372. }
  373. });
  374. });
  375. console.log('getPositionData retailId', retailId);
  376. } catch (error) {
  377. console.error('获取retailId失败', error);
  378. // 在这里可以添加处理失败的逻辑
  379. }
  380. this.retailId = retailId;
  381. console.log('submitorder retailId',this.retailId);
  382. if(this.pageContent.oneMany === 2 && this.pageContent.personnelNum!==0){//一证多票,补齐观影人信息
  383. let dontNeedCardsNumber = this.pageContent.personnelNum - this.visitors.length;
  384. if(dontNeedCardsNumber>0){//
  385. for (let i = 0;i<dontNeedCardsNumber;i++) {
  386. console.log('dontNeedCardsNumber',dontNeedCardsNumber);
  387. this.visitors.push({
  388. name: this.visitors[0].name,
  389. idcard: this.visitors[0].idcard,
  390. mobile: this.visitors[0].mobile,
  391. });
  392. }
  393. }
  394. }
  395. let params = {
  396. performId: this.pageContent.performId,
  397. goodsList: [{
  398. goodsId: this.pageContent.goodsId,
  399. salePeice: this.pageContent.salePrice,
  400. saleNum: 1
  401. }],
  402. auditoriumId: this.pageContent.auditoriumId,
  403. performTimeId: this.pageContent.performTimeId,
  404. seatTypeId: this.pageContent.seatTypeId,
  405. purchaser: {
  406. name: this.pageContent.purchaser.name,
  407. mobile: this.pageContent.purchaser.mobile,
  408. idcard: this.pageContent.purchaser.idcard
  409. },
  410. viewerList: this.visitors,
  411. label:this.label,
  412. retailId:this.retailId
  413. }
  414. console.log('submitorder params',params);
  415. // return
  416. // #ifdef MP
  417. params['source'] = 1
  418. // #endif
  419. // #ifdef H5
  420. params['source'] = 4
  421. // #endif
  422. this.cansubmit = false;
  423. // console.log('pageData',this.pageData);
  424. // console.log('visitors',this.visitors);
  425. // console.log('params',params);
  426. this.$u.api.submitOrder(params,{custom:{toast:false}}).then(res => {
  427. // console.log('submitOrder',res.data);
  428. this.orderId = res.data.orderId;
  429. // this.templateEven()
  430. this.gotoPay();
  431. }).catch(err => {
  432. this.cansubmit = true;
  433. uni.hideLoading();
  434. // uni.$u.toast(err.msg);
  435. // if (err.msg.includes('限购')) {
  436. this.umodal.title = '';
  437. this.umodal.content = err.msg;
  438. this.umodal.show = true;
  439. // setTimeout(() => {
  440. // uni.$u.route('/center/order', {
  441. // status: 0
  442. // });
  443. // }, 2000)
  444. // }
  445. console.log('submitOrder', err);
  446. })
  447. },
  448. modalConfirm(){
  449. this.umodal.show = false;
  450. },
  451. // 订阅消息
  452. templateEven() {
  453. let that = this
  454. wx.showModal({
  455. title: '温馨提示',
  456. content: '为更好的促进与您的交流,服务号需要实时向您发送消息',
  457. confirmText: "同意",
  458. cancelText: "拒绝",
  459. success: function(res) {
  460. if (res.confirm) {
  461. //调用订阅消息
  462. // console.log('用户点击确定');
  463. //调用订阅
  464. that.setTemplate();
  465. } else if (res.cancel) {
  466. // console.log('用户点击取消');
  467. ///显示第二个弹说明一下
  468. wx.showModal({
  469. title: '温馨提示',
  470. content: '拒绝后您将无法获取实时的消息',
  471. confirmText: "知道了",
  472. showCancel: false,
  473. success: function(res) {
  474. that.gotoPay();
  475. ///点击知道了的后续操作
  476. ///如跳转首页面
  477. }
  478. });
  479. }
  480. }
  481. });
  482. },
  483. // 设置小程序订阅消息
  484. setTemplate() {
  485. if(this.needIdcardNumber&&this.needIdcardNumber!==this.visitors.length){
  486. uni.showToast({
  487. title:'观影人信息不正确',
  488. icon:'none'
  489. })
  490. return false
  491. }
  492. let that = this;
  493. // console.log('templateIdList', this.templateIdList);
  494. // #ifdef MP
  495. uni.requestSubscribeMessage({
  496. tmplIds: that.templateIdList,
  497. success(res) {
  498. // that.gotoPay();
  499. console.log("设置小程序订阅消息 success:", res);
  500. },
  501. fail(res) {
  502. console.log("设置小程序订阅消息 fail:", res);
  503. },
  504. complete(res) {
  505. // that.gotoPay();
  506. that.submitorder();
  507. console.log("设置小程序订阅消息 complete:", res);
  508. }
  509. })
  510. // #endif
  511. // #ifdef H5
  512. that.gotoPay()
  513. // #endif
  514. },
  515. gotoPay() {
  516. this.$u.api.gotoPay({
  517. orderId: this.orderId,
  518. openid: ''
  519. }).then(res => {
  520. // this.payResult = res.data.payInfo;
  521. // this.payResult.package = res.data.payInfo.packageValue;
  522. // ygh
  523. if(!res.data.needPay){
  524. //this.payQuery();
  525. uni.$u.route('/center/orderdetails', {
  526. type:'redirectTo',
  527. id: this.orderId
  528. });
  529. }else {
  530. this.payResult = res.data.payInfo;
  531. this.payResult.package = res.data.payInfo.packageValue;
  532. // #ifdef H5
  533. this.initConfig(this.payResult)
  534. // #endif
  535. // #ifdef MP
  536. this.wxPay()
  537. // #endif
  538. }
  539. // if(this.params.paymentMode==1||this.params.paymentMode==4){
  540. // this.wxPay()
  541. // }else{
  542. // uni.$u.route('/shopping/paysuccess');
  543. // }
  544. // console.log('gotoPayres', res.data);
  545. }).catch(err => {
  546. this.cansubmit = true;
  547. // this.paypass = '';
  548. // this.checkPassShow = false;
  549. console.log('gotoPay', err);
  550. })
  551. },
  552. wxPay() {
  553. let that = this;
  554. uni.requestPayment({
  555. ...this.payResult,
  556. "provider": "wxpay",
  557. "orderInfo": {
  558. // "appid": "wx499********7c70e", // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  559. // "noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
  560. // "package": "Sign=WXPay", // 固定值
  561. // "partnerid": "148*****52", // 微信支付商户号
  562. // "prepayid": "wx202254********************fbe90000", // 统一下单订单号
  563. // "timestamp": 1597935292, // 时间戳(单位:秒)
  564. // "sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5/RSA 签名
  565. },
  566. success(res) {
  567. that.payQuery();
  568. },
  569. fail(e) {
  570. uni.$u.route('/center/order', {
  571. status: 0
  572. });
  573. console.log('wxPayfail', e);
  574. },
  575. complete() {
  576. this.cansubmit = true;
  577. }
  578. })
  579. },
  580. payQuery() {
  581. let that = this;
  582. let retryCount = 0;
  583. let maxRetryCount = 5; // 设置最大重试次数
  584. let interval = 2000; // 设置间隔时间为2秒
  585. let timeout = 10000; // 设置超时时间为10秒
  586. let timer;
  587. uni.showLoading({
  588. title: '支付结果查询中'
  589. })
  590. timer = setInterval(() => {
  591. retryCount++;
  592. if (retryCount > maxRetryCount || retryCount * interval > timeout) {
  593. clearInterval(timer);
  594. uni.hideLoading();
  595. console.log("支付查询超时或达到最大重试次数");
  596. // 在这里添加超时或达到最大重试次数的处理逻辑
  597. uni.$u.route('/center/order');
  598. } else {
  599. console.log("第" + retryCount + "次查询");
  600. // 调用查询支付状态的方法
  601. // 如果支付状态为成功,则清除定时器并处理成功的逻辑
  602. // 如果支付状态为失败,则清除定时器并处理失败的逻辑
  603. this.$u.api.payQuery({
  604. orderId: this.orderId
  605. }).then(res => {
  606. // 0-未支付 1-已支付 2-支付中 3-支付失败 4-支付退款
  607. let payStatus = res.data.payStatus;
  608. if (payStatus === 1) {
  609. uni.$u.route('/center/orderdetails', {
  610. type:'redirectTo',
  611. id: res.data.orderId
  612. });
  613. // uni.$u.route('/center/order', {
  614. // status: 3
  615. // });
  616. // uni.$u.route('/center/paysuccess');
  617. } else if (payStatus === 0 || payStatus === 2) {
  618. this.payQuery()
  619. } else if (payStatus === 3) {
  620. uni.toast('支付失败')
  621. }
  622. clearInterval(timer);
  623. }).catch(err => {
  624. console.log('payQuery', err);
  625. }).finally(() => {
  626. uni.hideLoading()
  627. this.cansubmit = true;
  628. })
  629. }
  630. }, interval);
  631. },
  632. /**
  633. * 公众号微信支付
  634. */
  635. initConfig() {
  636. // #ifdef H5
  637. let that = this
  638. wxH5.config({
  639. debug: false, // 这里一般在测试阶段先用ture,等打包给后台的时候就改回false,
  640. appId: that.payResult.appId, // 必填,公众号的唯一标识
  641. timestamp: that.payResult.timeStamp, // 必填,生成签名的时间戳
  642. nonceStr: that.payResult.nonceStr, // 必填,生成签名的随机串
  643. signature: that.payResult.paySign, // 必填,签名
  644. jsApiList: ['chooseWXPay', 'checkJsApi'] // 必填,需要使用的JS接口列表
  645. })
  646. wxH5.ready(() => {
  647. wxH5.chooseWXPay({
  648. timestamp: that.payResult.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
  649. nonceStr: that.payResult.nonceStr, // 支付签名随机串,不长于 32 位
  650. package: that.payResult.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
  651. signType: 'SHA1', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  652. paySign: that.payResult.paySign, // 支付签名
  653. success: () => {
  654. that.payQuery();
  655. },
  656. fail: (e) => {
  657. uni.$u.route('/center/order', {
  658. status: 0
  659. });
  660. console.log('wxPayfail', e);
  661. },
  662. cancel: () => {
  663. uni.$u.route('/center/order', {
  664. status: 0
  665. });
  666. that.cansubmit = true;
  667. }
  668. })
  669. })
  670. // #endif
  671. },
  672. }
  673. }
  674. </script>
  675. <style>
  676. page {
  677. background: linear-gradient(180deg, #ED0000 0%, #F9FBFD 50%, #fff 100%);
  678. background-repeat: no-repeat;
  679. }
  680. </style>
  681. <style lang="scss" scoped>
  682. .base-info {
  683. border-radius: 30rpx;
  684. overflow: hidden;
  685. background: radial-gradient(circle at -26rpx 294rpx, transparent 8%, #fff 4%) left, radial-gradient(circle at calc(100% + 26rpx) 294rpx, transparent 8%, #fff 4%) right;
  686. background-size: 50% 100%;
  687. background-repeat: no-repeat;
  688. padding: 34rpx 36rpx;
  689. box-sizing: border-box;
  690. margin: 30rpx 0 40rpx;
  691. .up {
  692. margin-bottom: 36rpx;
  693. .img {
  694. display: block;
  695. width: 172rpx;
  696. height: 230rpx;
  697. border-radius: 20rpx;
  698. margin-right: 32rpx;
  699. }
  700. .text {
  701. flex: 1;
  702. font-size: 22rpx;
  703. font-weight: 400;
  704. color: #606060;
  705. line-height: 1;
  706. }
  707. .text-item {
  708. margin-bottom: 18rpx;
  709. }
  710. .name {
  711. font-size: 32rpx;
  712. line-height: 1.5;
  713. font-weight: bold;
  714. color: #2D2D2D;
  715. }
  716. .addr {
  717. font-size: 24rpx;
  718. font-weight: 500;
  719. color: #2D2D2D;
  720. }
  721. }
  722. .down {
  723. position: relative;
  724. &:before {
  725. content: '';
  726. width: calc(100% + 26rpx);
  727. height: 1px;
  728. position: absolute;
  729. left: -13rpx;
  730. top: -2rpx;
  731. border-top: 4rpx dashed #F39FA0;
  732. }
  733. .num-wrap {
  734. padding-top: 36rpx;
  735. .title {
  736. font-size: 14px;
  737. color: #4E4E4E;
  738. }
  739. }
  740. }
  741. }
  742. .block-wrap {
  743. background: #FFFFFF;
  744. box-shadow: 0rpx 0rpx 20rpx 2rpx rgba(221, 221, 221, 0.5);
  745. border-radius: 20rpx;
  746. margin-bottom: 28rpx;
  747. padding: 32rpx 30rpx 34rpx;
  748. .block-title {
  749. // padding-left: 16rpx;
  750. position: relative;
  751. margin-bottom: 22rpx;
  752. font-size: 24rpx;
  753. font-weight: 500;
  754. color: #CACACA;
  755. // &:before{
  756. // content: '';
  757. // width: 6rpx;
  758. // height: 32rpx;
  759. // background: #1677FF;
  760. // border-radius: 4rpx;
  761. // position: absolute;
  762. // left: 0;
  763. // top: 50%;
  764. // margin-top: -16rpx;
  765. // }
  766. .name {
  767. font-size: 32rpx;
  768. font-weight: bold;
  769. color: #2D2D2D;
  770. margin-right: 20rpx;
  771. }
  772. }
  773. .no-people {
  774. font-size: 28rpx;
  775. font-weight: 400;
  776. color: #7F7F7F;
  777. .right {
  778. margin-left: 20rpx;
  779. color: #1677FF;
  780. }
  781. }
  782. .peoples {
  783. font-size: 28rpx;
  784. font-weight: 400;
  785. color: #7F7F7F;
  786. margin-bottom: 24rpx;
  787. .peoples-item {
  788. margin-bottom: 10rpx;
  789. }
  790. .name {
  791. margin-left: 20rpx;
  792. margin-right: 28rpx;
  793. font-size: 28rpx;
  794. font-weight: bold;
  795. color: #363636;
  796. }
  797. .people-id {
  798. font-size: 20rpx;
  799. font-weight: 400;
  800. color: #606060;
  801. }
  802. .right {
  803. font-size: 28rpx;
  804. font-weight: 400;
  805. color: #ED0303;
  806. }
  807. }
  808. }
  809. .people-list {
  810. margin-bottom: 20rpx;
  811. .btn {
  812. width: 185rpx;
  813. height: 60rpx;
  814. line-height: 60rpx;
  815. font-size: 24rpx;
  816. font-weight: 500;
  817. color: #2D2D2D;
  818. background-color: #F1F1F1;
  819. border: 1px solid #F1F1F1;
  820. border-radius: 8rpx;
  821. margin-bottom: 12rpx;
  822. .text {
  823. margin-left: 16rpx;
  824. }
  825. &.people {
  826. margin-right: 16rpx;
  827. text-align: center;
  828. background-color: #FFF2F2;
  829. border-color: #ED0303;
  830. }
  831. }
  832. }
  833. .visitors {
  834. margin-bottom: 20rpx;
  835. }
  836. .people-show-content {
  837. background: #FFFFFF;
  838. border-radius: 40rpx 40rpx 0rpx 0rpx;
  839. padding: 30rpx 40rpx;
  840. .title {
  841. position: relative;
  842. font-size: 32rpx;
  843. font-weight: 500;
  844. color: #606060;
  845. margin-bottom: 46rpx;
  846. text-align: center;
  847. .cancel {
  848. position: absolute;
  849. left: 0;
  850. top: 0;
  851. }
  852. }
  853. .add-btn {
  854. margin-bottom: 28rpx;
  855. background: #ffdee1;
  856. border-radius: 44rpx;
  857. padding: 26rpx;
  858. font-size: 24rpx;
  859. font-weight: 400;
  860. color: #ff1616;
  861. .img {
  862. width: 28rpx;
  863. height: 36rpx;
  864. margin-right: 36rpx;
  865. }
  866. }
  867. .list {
  868. /deep/ .u-radio-group {
  869. flex-wrap: wrap;
  870. }
  871. /deep/ .u-checkbox-group {
  872. flex-wrap: wrap;
  873. }
  874. overflow-y: auto;
  875. height: 40vh;
  876. .people {
  877. width: 100%;
  878. margin-bottom: 24rpx;
  879. }
  880. }
  881. .btn {}
  882. }
  883. .coupon {
  884. background: #FFFFFF;
  885. box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(232, 232, 232, 0.5);
  886. border-radius: 16rpx;
  887. padding: 44rpx 36rpx;
  888. margin-bottom: 24rpx;
  889. .title {
  890. font-size: 28rpx;
  891. font-weight: bold;
  892. color: #2D2D2D;
  893. padding-bottom: 20rpx;
  894. margin-bottom: 26rpx;
  895. border-bottom-style: dashed;
  896. }
  897. .single-til {
  898. margin-bottom: 28rpx;
  899. .text {
  900. font-weight: 400;
  901. }
  902. }
  903. .no-coupon {
  904. height: 116rpx;
  905. line-height: 116rpx;
  906. text-align: center;
  907. background: #F9FAFD;
  908. border-radius: 8rpx;
  909. font-size: 24rpx;
  910. font-weight: 400;
  911. color: #C0C0C0;
  912. }
  913. }
  914. .notice {
  915. background: #FFFFFF;
  916. box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(232, 232, 232, 0.5);
  917. border-radius: 16rpx;
  918. padding: 44rpx 36rpx;
  919. margin-bottom: 24rpx;
  920. .title {
  921. font-size: 28rpx;
  922. font-weight: bold;
  923. color: #2D2D2D;
  924. padding-bottom: 20rpx;
  925. margin-bottom: 26rpx;
  926. border-bottom-style: dashed;
  927. }
  928. .notice-item {
  929. font-size: 24rpx;
  930. font-weight: 400;
  931. color: #7F7F7F;
  932. line-height: 36rpx;
  933. margin-bottom: 8rpx;
  934. }
  935. }
  936. .page-bottom {
  937. position: relative;
  938. z-index: 1001;
  939. height: 98rpx;
  940. padding: 24rpx 20rpx 50rpx;
  941. .inner {
  942. position: fixed;
  943. background-color: #fff;
  944. height: 98rpx;
  945. left: 0;
  946. right: 0;
  947. bottom: 0;
  948. padding: 24rpx 20rpx 50rpx;
  949. box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(215, 215, 215, 0.5);
  950. .total-price {
  951. font-size: 40rpx;
  952. font-weight: bold;
  953. color: #ED0000;
  954. }
  955. .btn {
  956. font-size: 28rpx;
  957. height: 80rpx;
  958. line-height: 80rpx;
  959. border-radius: 50rpx;
  960. padding: 0 50rpx;
  961. background-color: #eee;
  962. color: #333;
  963. text-align: center;
  964. &.active {
  965. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  966. color: #fff;
  967. }
  968. }
  969. }
  970. }
  971. .purchaser {
  972. .item {
  973. margin-bottom: 10rpx;
  974. font-size: 26rpx;
  975. color: #333;
  976. }
  977. .un-auth {
  978. padding: 26rpx;
  979. background-color: #eee;
  980. color: #333;
  981. text-align: center;
  982. border-radius: 8rpx;
  983. }
  984. }
  985. </style>