bookticket.vue 30 KB

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