bookticket.vue 30 KB

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