orderdetails.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
  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'}" leftIconColor="#fff" bgColor="transparent"></u-navbar>
  6. </view>
  7. <u-loading-page :loading="loadingPage"></u-loading-page>
  8. <view class="page-wrap">
  9. <view class="status-content">
  10. <view class="status-item" v-if="orderDetails.status==0">
  11. <view class="text"><text v-if="countdown!='支付超期'"> 请尽快完成付款,还剩 </text>{{countdown}}</view>
  12. <view class="btn-wrap u-flex u-row-center" v-if="countdown!='支付超期'">
  13. <view class="btn cancel" @click="cancelOrder">取消订单</view>
  14. <view class="btn" @click="gotoPay(orderDetails.id)">立即支付</view>
  15. </view>
  16. </view>
  17. <view class="status-item" v-else-if="orderDetails.status==3">
  18. <view class="text"><text v-if="countdown!='演出已开始'">距离演出开始,还剩 </text>{{countdown}}</view>
  19. </view>
  20. <view class="status-item" v-else-if="orderDetails.status==6">
  21. <view class="text"><text>退款失败: </text>{{refundInfo.errReason}}</view>
  22. </view>
  23. <view class="status-item" v-else>
  24. <view class="text">{{orderDetails.status|filterOrderState}}</view>
  25. </view>
  26. </view>
  27. <view class="base-info">
  28. <view class="top u-flex u-row-between">
  29. <view class="name">{{orderDetails.theatreName}}</view>
  30. <!-- <view class="icon-wrap u-flex">
  31. <u-icon name="phone-fill" color="#999999" size="42rpx"></u-icon>
  32. <u-icon name="map-fill" color="#999999" size="42rpx"></u-icon>
  33. </view> -->
  34. </view>
  35. <view class="info u-flex u-row-between">
  36. <image class="img" :src="orderDetails.performImg"></image>
  37. <view class="text">
  38. <view class="name u-flex u-row-between">
  39. {{orderDetails.performName}}
  40. <!-- <text class="status">{{orderDetails.status|filterOrderState}}</text> -->
  41. </view>
  42. <view class="time">{{orderDetails.performDate}} {{orderDetails.performTimeStart}}</view>
  43. <view class="position u-flex u-row-between">
  44. <view class="">{{orderDetails.goodsName}}/{{orderDetails.seatTypeName}}</view>
  45. <view class="">X {{orderDetails.viewerNum}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="box qr-wrap" v-if="orderDetails.parentQrcodeStatus==0">
  51. <view class="title" v-if="orderDetails.supportQrcode">二维码</view>
  52. <template v-if="orderDetails.supportQrcode">
  53. <view class="qr-content">
  54. <view class="img-wrap">
  55. <view class="ayQrcode">
  56. <uv-qrcode :hide="showSingleQR" ref="qrcode" size="180px" :value="mainQR"></uv-qrcode>
  57. </view>
  58. </view>
  59. <view class="order-num">取票号:{{orderDetails.parentQrcodeNo}}</view>
  60. </view>
  61. </template>
  62. <template v-else-if="orderDetails.supportIdcard && !orderDetails.supportQrcode">
  63. <view class="qr-content">
  64. <!-- 禁止使用电子核销码核销入场,只能用身份证刷闸机入场 -->
  65. <view class="qrcode-tip">本票种需凭「取票码」至前台换票入场,或凭「身份证原件」入场</view>
  66. <view class="order-num">取票号:{{orderDetails.parentQrcodeNo}}</view>
  67. </view>
  68. </template>
  69. <template v-else>
  70. <view class="qr-content">
  71. <!-- 只能到前台提供身份证号码/取票号/订单号等信息进行取票 -->
  72. <view class="qrcode-tip">本票种需凭「取票码」至前台换票入场</view>
  73. <view class="order-num">取票号:{{orderDetails.parentQrcodeNo}}</view>
  74. </view>
  75. </template>
  76. </view>
  77. <view class="box viewers-list">
  78. <view class="title">观影人员</view>
  79. <view class="item u-flex u-row-around" v-for="(item,index) in orderDetails.viewersList" :key="index">
  80. <!-- <text>观影人员{{index + 1}}</text> -->
  81. <text style="width: 96rpx;">{{item.name}}</text>
  82. <!-- style="width: 130rpx;" -->
  83. <text style="flex: 1;">{{orderDetails.status>2?item.seatName:"-"}}</text>
  84. <!-- <text>{{item.idcard|maskID}}</text> -->
  85. <text v-if="orderDetails.status==3||orderDetails.status==4||orderDetails.status==6||orderDetails.status==7" @click="singleQR(item,index)" class="qrbtn" :style="{opacity:item.qrcodeStatus===0?'1':'0.5'}">查看二维码</text>
  86. </view>
  87. </view>
  88. <view class="box order-info">
  89. <view class="title u-flex u-row-between">
  90. 订单信息
  91. <view class="btn-box">
  92. <text class="btn" v-if="orderDetails.status==3&&orderDetails.allowReSubmit==1" @click="rebook">改签</text>
  93. <text class="btn" v-if="orderDetails.status==3" @click="refund">申请退款</text>
  94. <text class="btn" v-if="orderDetails.status==7" @click="invoice">申请发票</text>
  95. </view>
  96. </view>
  97. <view class="order-info-item" v-for="(item,index) in orderInfo[orderDetails.status]" :key="index">
  98. <text class="til">{{item.name}}</text>
  99. <text class="con">
  100. <text v-if="item.key=='payType'">{{orderDetails[item.key]|filterPayType}}</text>
  101. <text v-else-if="item.key=='realPrice'"> ¥ {{orderDetails[item.key]}}</text>
  102. <text v-else>{{orderDetails[item.key]}}</text>
  103. <text class="copy-btn" @click="copyOrderNum(orderDetails[item.key])" v-if="item.key=='id'">复制</text>
  104. </text>
  105. </view>
  106. </view>
  107. <view class="box order-info refundInfo" v-if="orderDetails.status==4||orderDetails.status==5||orderDetails.status==6">
  108. <view class="title u-flex u-row-between">
  109. 退款信息
  110. </view>
  111. <view class="order-info-item">
  112. <text class="til">退款单号</text>
  113. <text class="con">{{refundInfo.id}}</text>
  114. <text class="copy-btn" @click="copyOrderNum(refundInfo.id)" >复制</text>
  115. </view>
  116. <view class="order-info-item">
  117. <text class="til">申请时间</text>
  118. <text class="con">{{refundInfo.refundTime}}</text>
  119. </view>
  120. <view class="order-info-item">
  121. <text class="til">订单金额</text>
  122. <text class="con">¥ {{refundInfo.orderAmount}}</text>
  123. </view>
  124. <view class="order-info-item">
  125. <text class="til">退款金额</text>
  126. <text class="con">¥ {{refundInfo.refundAmount}}</text>
  127. </view>
  128. <view class="order-info-item">
  129. <text class="til">退款原因</text>
  130. <text class="con">{{refundInfo.refundReason}}</text>
  131. </view>
  132. <view class="order-info-item" v-if="orderDetails.status==6">
  133. <text class="til">失败原因</text>
  134. <text class="con">{{refundInfo.errReason}}</text>
  135. </view>
  136. <view class="order-info-item">
  137. <text class="til">退款状态</text>
  138. <text class="con">{{refundInfo.status|filterRefundState}}</text>
  139. </view>
  140. </view>
  141. <view class="box tips parse-content">
  142. <view class="title">观影须知</view>
  143. <u-parse :content="formerNotice"></u-parse>
  144. <!-- <view class="tips-item" v-for="(item,index) in tipsArr" :key="index">
  145. {{item}}
  146. </view> -->
  147. </view>
  148. </view>
  149. <u-popup :show="showSingleQR" @close="closeSingleQR" @open="openSingleQR" @touchmove.stop.prevent="handleMoveQrcode" :round="10" mode="center">
  150. <view class="singleQR-wrap">
  151. <view class="title">
  152. 二维码
  153. <!-- <u-icon class="close" @click="closeSingleQR" name="close" color="#333" size="36rpx"></u-icon> -->
  154. </view>
  155. <view class="single-info">
  156. <view class="item">姓名:{{singleInfo.name}}</view>
  157. <view class="item">身份证号码:{{singleInfo.idcard|maskID}}</view>
  158. <view class="item seat-name">座位:{{singleInfo.seatName}}</view>
  159. <view class="item">状态:{{singleInfo.qrcodeStatus|filterSingleState}}</view>
  160. </view>
  161. <template v-if="orderDetails.supportQrcode">
  162. <view class="singleQrcode">
  163. <uv-qrcode ref="singleQrcode" size="180px" :options="singleQrOptions" :value="singleQrContent" ></uv-qrcode>
  164. </view>
  165. </template>
  166. <template v-else-if="orderDetails.supportIdcard && !orderDetails.supportQrcode">
  167. <view class="qrcode-tip">本票种需凭「取票码」至前台换票入场,或凭「身份证原件」入场</view>
  168. </template>
  169. <template v-else>
  170. <view class="qrcode-tip">本票种需凭「取票码」至前台换票入场</view>
  171. </template>
  172. <view class="order-num" :class="{'del-line':singleInfo.qrcodeStatus!==0}">取票号:{{singleInfo.qrcodeNo}}</view>
  173. </view>
  174. </u-popup>
  175. <u-toast ref="uToast"></u-toast>
  176. </view>
  177. </template>
  178. <script>
  179. import { systemInfo } from "@/mixin.js";
  180. // #ifdef H5
  181. import wxH5 from "weixin-jsapi";
  182. // #endif
  183. export default {
  184. mixins:[systemInfo],
  185. components:{
  186. },
  187. data() {
  188. return {
  189. timer: null,
  190. mainQR:'无效值',
  191. id:'',
  192. loadingPage:true,
  193. staticUrl:this.$commonConfig.staticUrl,
  194. orderDetails:{},
  195. deadline: null, // 设置截止时间为某个日期的时间戳
  196. countdown: '', // 用于显示倒计时时间
  197. // 状态(0待支付,2超时取消,3支付完成,待使用,4退款中,5己退款,6退款失败,7己使用,8己超期)
  198. orderInfo:{
  199. 0:[{name:'需付金额',key:'realPrice'},{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'}],
  200. 1:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'}],
  201. 2:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'}],
  202. 3:[{name:'订单金额',key:'realPrice'},{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'}],
  203. 4:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'}],
  204. 5:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'},{name:'备注信息',key:'remark'}],
  205. 6:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'},{name:'备注信息',key:'remark'}],
  206. 7:[{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payWay'},{name:'支付时间',key:'payTime'}],
  207. 8:[{name:'订单金额',key:'realPrice'},{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'备注信息',key:'remark'}],
  208. 9:[{name:'订单金额',key:'realPrice'},{name:'订单编号',key:'id'},{name:'下单时间',key:'createTime'},{name:'备注信息',key:'remark'}],
  209. },
  210. tipsArr:[
  211. '1.请提前到达影院现场,找到自助取票机,打印纸质电影票,完成取票',
  212. '2.如现场自助取票机无法打印电影票,请联系影院工作人员处理',
  213. '3.凭打印好的纸质电影票、检票入场观影',
  214. '4.如果订单使用了兑换券,或购买了特殊场次,暂不支持退票和改签'
  215. ],
  216. params:{
  217. },
  218. singleInfo:{idcard:''},//观影人信息
  219. showSingleQR:false,//显示单人二维码
  220. singleModalQr:false,
  221. singleQrContent:'无效值',
  222. singleQrOptions:{
  223. foregroundColor: "#333333",
  224. },
  225. formerNotice:'',
  226. countdownTimer:null,//订单倒计时
  227. templateIdList:[],//微信小程序订阅消息
  228. refundInfo:{status:null},//退款信息
  229. }
  230. },
  231. onShow() {
  232. this.getOrderDetails(this.id);
  233. },
  234. onLoad(page) {
  235. console.log('page',page);
  236. this.id = page.id;
  237. this.getSystemInfo();
  238. this.getTemplateIdList();//获取模板列表
  239. },
  240. onUnload() {
  241. // 页面离开时停止计时器
  242. // clearInterval(this.timer)
  243. clearInterval(this.countdownTimer)
  244. },
  245. mounted() {
  246. // 每秒更新倒计时时间
  247. this.countdownTimer = setInterval(() => {
  248. const now = new Date().getTime();
  249. const distance = this.deadline - now;
  250. // console.log('distance',distance);
  251. if(this.orderDetails.status==0 && distance<0){
  252. this.countdown = '支付超期';
  253. return
  254. }else if(this.orderDetails.status==3 && distance<0){
  255. this.countdown = '演出已开始';
  256. return
  257. }
  258. // 计算倒计时时间,可以根据需求自定义显示方式
  259. const days = Math.floor(distance / (1000 * 60 * 60 * 24));
  260. const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  261. const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  262. const seconds = Math.floor((distance % (1000 * 60)) / 1000);
  263. // 更新倒计时时间
  264. this.countdown = `${days}天 ${hours}小时 ${minutes}分钟 ${seconds}秒`;
  265. }, 1000);
  266. },
  267. methods: {
  268. leftClick(e){
  269. let pages = getCurrentPages();
  270. if(pages.length==1){
  271. uni.$u.route('/pages/index/index')
  272. }else{
  273. let prePage = pages[pages.length-1];
  274. if(prePage.route=='center/orderdetails'){
  275. uni.navigateBack({
  276. delta: 2
  277. });
  278. }else{
  279. uni.navigateBack()
  280. }
  281. };
  282. },
  283. getTemplateIdList(){
  284. this.$u.api.templateIdList({templateLabel:'order_pay'}).then(res=>{
  285. console.log('getTemplateIdList',res.data);
  286. this.templateIdList = res.data.list.map(item=>{
  287. return item.templateId
  288. });
  289. // if(this.templateIdList.length>0){
  290. // this.templateEven();
  291. // }
  292. }).catch(err=>{
  293. console.log('getTemplateIdList',err);
  294. })
  295. },
  296. getOrderDetails(id){
  297. this.$u.api.orderDetails({id:id}).then(res=>{
  298. this.loadingPage = false;
  299. this.orderDetails = res.data;
  300. this.refundInfo = res.data.refundInfo||{};
  301. if(res.data.status==0){//待支付
  302. this.deadline = new Date(`${res.data.cancelDateTime}`).getTime();
  303. }else if(res.data.status==3){//待使用
  304. this.deadline = new Date(`${res.data.performDateTime}`).getTime();
  305. }
  306. this.mainQR = res.data.parentQrcodeNo;
  307. this.getPerformerNotice();
  308. // console.log('this.deadline',this.deadline);
  309. // console.log('orderDetails',JSON.parse(JSON.stringify(res.data)));
  310. }).catch(err=>{
  311. uni.$u.toast('获取数据失败,!请重试')
  312. uni.navigateBack();
  313. console.log('getOrderDetails',err);
  314. })
  315. },
  316. singleQR(item,index){
  317. let that = this;
  318. // console.log('singleQR',item);
  319. this.showSingleQR = true;
  320. this.singleInfo = item;
  321. if(item.qrcodeStatus!==0){
  322. this.singleQrOptions.foregroundColor='#BCBCBC';
  323. }else{
  324. this.singleQrOptions.foregroundColor='#333333';
  325. }
  326. // this.singleQrContent = {};
  327. // this.singleQrContent.qrcode = item.qrcodeNo;
  328. // this.singleQrContent.time = Date.now();
  329. // this.singleQrContent = JSON.stringify(this.singleQrContent);
  330. this.singleQrContent = item.qrcodeNo
  331. },
  332. openSingleQR(){
  333. // console.log('this.singleInfo',this.singleInfo);
  334. },
  335. closeSingleQR(){
  336. this.showSingleQR = false;
  337. },
  338. clickEven(fun,item){
  339. // console.log('fun',fun);
  340. let funObj = {
  341. pay: this.pay,
  342. logistics:this.logistics,
  343. evaluate:this.evaluate,
  344. refund:this.refund,
  345. cancelOrder:this.cancelOrder,
  346. viewRefund:this.viewRefund,
  347. confirmReceipt:this.confirmReceipt
  348. };
  349. // console.log('funObj[fun]',funObj[fun]);
  350. if (fun in funObj) {
  351. funObj[fun](item);
  352. }
  353. },
  354. pay(item){
  355. // #ifdef H5
  356. this.gotoPay(this.orderDetails.id);
  357. // #endif
  358. // #ifdef MP
  359. this.setTemplate(this.orderDetails.id);
  360. // #endif
  361. // console.log('pay',item);
  362. // uni.$u.route('/center/pay', {
  363. // orderId: item.id,
  364. // // openid: that.vuex_wechatOpenid,
  365. // payAmount:item.orderPrice
  366. // });
  367. },
  368. logistics(item){
  369. // console.log('logistics',item);
  370. uni.$u.route('/center/distribution', {
  371. orderId: item.id
  372. });
  373. },
  374. evaluate(item){
  375. // console.log('logistics',item);
  376. uni.$u.route('/shopping/evaluate', {
  377. id: item.id
  378. });
  379. },
  380. refund(item){
  381. console.log('this.orderDetails',this.orderDetails);
  382. uni.$u.route('/center/refundselect', {
  383. id: this.orderDetails.id,
  384. realPrice:this.orderDetails.realPrice
  385. });
  386. },
  387. cancelOrder(item){
  388. let that = this;
  389. uni.showModal({
  390. title: '提示',
  391. content: '确认取消吗!',
  392. success: res => {
  393. if (res.confirm) {
  394. this.$u.api.cancelOrder({orderId:that.orderDetails.id}).then(res=>{
  395. this.$refs.uToast.show({
  396. message:res.msg,
  397. complete() {
  398. that.getOrderDetails(that.orderDetails.id);
  399. }
  400. });
  401. // uni.$u.toast(res.msg);
  402. console.log('res',res.data);
  403. }).catch(err=>{
  404. console.log('cancelOrder',err);
  405. })
  406. }
  407. }
  408. });
  409. // console.log('logistics',item);
  410. },
  411. confirmReceipt(item){
  412. let that = this;
  413. uni.showModal({
  414. title: '提示',
  415. content: '确认收货吗!',
  416. success: res => {
  417. if (res.confirm) {
  418. this.$u.api.confirmReceipt({orderId:item.id}).then(res=>{
  419. uni.showToast({
  420. title:res.msg,
  421. duration:2000,
  422. complete() {
  423. that.evaluate(item)
  424. that.getOrderDetails(that.id);
  425. }
  426. });
  427. console.log('res',res.data);
  428. }).catch(err=>{
  429. console.log('confirmReceipt',err);
  430. })
  431. }
  432. }
  433. })
  434. },
  435. goMap(){
  436. uni.openLocation({
  437. latitude: Number(this.pickupInfo.pickupLatitude), //维度
  438. longitude: Number(this.pickupInfo.pickupLongitude), //经度
  439. name: "商行地址", //目的地定位名称
  440. scale: 15, //缩放比例
  441. address: this.pickupInfo.pickupAddress //导航详细地址
  442. })
  443. },
  444. copyOrderNum(orderNum){
  445. // console.log('copyOrderNum',orderNum);
  446. uni.setClipboardData({
  447. data: orderNum,
  448. success: function () {
  449. uni.showToast({
  450. title: '复制成功'
  451. });
  452. },
  453. fail(e) {
  454. // console.log('copyOrderNumfail',e);
  455. uni.showToast({
  456. title: '复制失败',
  457. icon:"error"
  458. });
  459. }
  460. });
  461. },
  462. // 设置小程序订阅消息
  463. setTemplate(orderId) {
  464. let that = this;
  465. console.log('templateIdList',this.templateIdList);
  466. uni.requestSubscribeMessage({
  467. tmplIds: that.templateIdList,
  468. success (res) {
  469. // that.gotoPay();
  470. console.log("success:",res);
  471. },
  472. fail (res) {
  473. console.log("fail:",res);
  474. },
  475. complete (res) {
  476. that.gotoPay(orderId);
  477. console.log("complete:",res);
  478. }
  479. })
  480. },
  481. gotoPay(orderId){
  482. this.$u.api.gotoPay({orderId:orderId,openid:''}).then(res=>{
  483. this.payResult = res.data.payInfo;
  484. this.payResult.package = res.data.payInfo.packageValue;
  485. // #ifdef H5
  486. this.initConfig(this.payResult)
  487. // #endif
  488. // #ifdef MP
  489. this.wxPay()
  490. // #endif
  491. // if(this.params.paymentMode==1||this.params.paymentMode==4){
  492. // this.wxPay()
  493. // }else{
  494. // uni.$u.route('/shopping/paysuccess');
  495. // }
  496. console.log('gotoPayres',res.data);
  497. }).catch(err=>{
  498. this.paypass = '';
  499. this.checkPassShow = false;
  500. console.log('gotoPay',err);
  501. })
  502. },
  503. wxPay(){
  504. let that = this;
  505. uni.requestPayment({
  506. ... this.payResult,
  507. "provider": "wxpay",
  508. "orderInfo": {
  509. // "appid": "wx499********7c70e", // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  510. // "noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
  511. // "package": "Sign=WXPay", // 固定值
  512. // "partnerid": "148*****52", // 微信支付商户号
  513. // "prepayid": "wx202254********************fbe90000", // 统一下单订单号
  514. // "timestamp": 1597935292, // 时间戳(单位:秒)
  515. // "sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5/RSA 签名
  516. },
  517. success(res) {
  518. that.payQuery();
  519. },
  520. fail(e) {
  521. console.log('wxPayfail',e);
  522. }
  523. })
  524. },
  525. payQuery(){
  526. let that = this;
  527. let retryCount = 0;
  528. let maxRetryCount = 5; // 设置最大重试次数
  529. let interval = 2000; // 设置间隔时间为2秒
  530. let timeout = 10000; // 设置超时时间为10秒
  531. let timer;
  532. uni.showLoading({
  533. title:'支付结果查询中'
  534. })
  535. timer = setInterval(() => {
  536. retryCount++;
  537. if (retryCount > maxRetryCount || retryCount * interval > timeout) {
  538. clearInterval(timer);
  539. uni.hideLoading();
  540. console.log("支付查询超时或达到最大重试次数");
  541. // 在这里添加超时或达到最大重试次数的处理逻辑
  542. this.reloadList()
  543. } else {
  544. console.log("第" + retryCount + "次查询");
  545. // 调用查询支付状态的方法
  546. // 如果支付状态为成功,则清除定时器并处理成功的逻辑
  547. // 如果支付状态为失败,则清除定时器并处理失败的逻辑
  548. this.$u.api.payQuery({orderId:this.orderId}).then(res=>{
  549. // 0-未支付 1-已支付 2-支付中 3-支付失败 4-支付退款
  550. let payStatus = res.data.payStatus;
  551. if(payStatus===1){
  552. uni.$u.route('/center/paysuccess');
  553. }else if(payStatus===0||payStatus===2){
  554. this.payQuery()
  555. }else if(payStatus===3){
  556. uni.toast('支付失败')
  557. }
  558. clearInterval(timer);
  559. }).catch(err=>{
  560. console.log('payQuery',err);
  561. }).finally(()=>{
  562. uni.hideLoading()
  563. })
  564. }
  565. }, interval);
  566. },
  567. getPerformerNotice(){
  568. this.$u.api.performerNotice({performId:this.orderDetails.performId}).then(res=>{
  569. // console.log('getPerformerNotice',res.data);
  570. this.formerNotice = res.data.performNotice;
  571. }).catch(err=>{
  572. console.log('getPerformerNotice',err);
  573. })
  574. },
  575. handleMoveQrcode(){
  576. console.log('handleMoveQrcode');
  577. return false
  578. },
  579. /**
  580. * 公众号微信支付
  581. */
  582. initConfig() {
  583. // #ifdef H5
  584. let that = this
  585. wxH5.config({
  586. debug: false, // 这里一般在测试阶段先用ture,等打包给后台的时候就改回false,
  587. appId: that.payResult.appId, // 必填,公众号的唯一标识
  588. timestamp: that.payResult.timeStamp, // 必填,生成签名的时间戳
  589. nonceStr: that.payResult.nonceStr, // 必填,生成签名的随机串
  590. signature: that.payResult.paySign, // 必填,签名
  591. jsApiList: ['chooseWXPay', 'checkJsApi'] // 必填,需要使用的JS接口列表
  592. })
  593. wxH5.ready(() => {
  594. wxH5.chooseWXPay({
  595. timestamp: that.payResult.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
  596. nonceStr: that.payResult.nonceStr, // 支付签名随机串,不长于 32 位
  597. package: that.payResult.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
  598. signType: 'SHA1', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  599. paySign: that.payResult.paySign, // 支付签名
  600. success: () => {
  601. that.payQuery();
  602. },
  603. fail: (e) => {
  604. uni.$u.route('/center/order', {
  605. status: 0
  606. });
  607. console.log('wxPayfail', e);
  608. },
  609. cancel: () => {
  610. uni.$u.route('/center/order', {
  611. status: 0
  612. });
  613. that.cansubmit = true;
  614. }
  615. })
  616. })
  617. // #endif
  618. },
  619. invoice(){
  620. console.log('orderDetails',this.orderDetails);
  621. if(this.orderDetails.ifInvoice===0){
  622. uni.$u.route('/center/invoice', {
  623. id: this.orderDetails.id
  624. });
  625. }else{
  626. uni.$u.route('/center/invoicedetails', {
  627. id: this.orderDetails.id
  628. });
  629. }
  630. },
  631. rebook(){
  632. uni.$u.route('pages/ticketlist',{performId:this.orderDetails.performId,orderId:this.orderDetails.id,fromPage:'rebook'})
  633. }
  634. }
  635. }
  636. </script>
  637. <style>
  638. page{
  639. background: linear-gradient(180deg, #ED0000 0%, #F9FBFD 50%,#F9FBFD 100%);
  640. background-repeat: no-repeat;
  641. }
  642. </style>
  643. <style lang="scss" scoped>
  644. .status-content{
  645. text-align: center;
  646. padding-top: 30rpx;
  647. margin-bottom: 52rpx;
  648. .text{
  649. font-size: 32rpx;
  650. font-weight: 400;
  651. color: #FFFFFF;
  652. margin-bottom: 52rpx;
  653. }
  654. .btn-wrap{
  655. margin-bottom: 40rpx;
  656. .btn{
  657. height: 64rpx;
  658. line-height: 64rpx;
  659. padding: 0 42rpx;
  660. border-radius: 8rpx;
  661. border: 2rpx solid #FFFFFF;
  662. background-color: #ffffff;
  663. font-size: 24rpx;
  664. font-weight: bold;
  665. color: #EE0B0B;
  666. &.cancel{
  667. border-color: #FFE2E2;
  668. color: #FFE2E2;
  669. background-color: transparent;
  670. }
  671. &:not(:last-of-type){
  672. margin-right: 100rpx;
  673. }
  674. }
  675. }
  676. }
  677. .base-info{
  678. background: #FFFFFF;
  679. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(221,221,221,0.5);
  680. border-radius: 20rpx;
  681. overflow: hidden;
  682. margin-bottom: 24rpx;
  683. .top{
  684. padding: 20rpx;
  685. background: #F9FAFD;
  686. font-size: 28rpx;
  687. font-weight: 400;
  688. color: #7F7F7F;
  689. }
  690. .info{
  691. padding: 28rpx 20rpx 30rpx 24rpx;
  692. .img{
  693. width: 180rpx;
  694. height: 160rpx;
  695. border-radius: 12rpx;
  696. }
  697. .text{
  698. font-size: 24rpx;
  699. font-weight: 400;
  700. color: #7F7F7F;
  701. padding-left: 26rpx;
  702. flex: 1;
  703. .name{
  704. font-size: 28rpx;
  705. font-weight: bold;
  706. color: #363636;
  707. margin-bottom: 20rpx;
  708. }
  709. .time{
  710. margin-bottom: 20rpx;
  711. }
  712. .position{
  713. margin-bottom: 20rpx;
  714. }
  715. .status{
  716. font-size: 24rpx;
  717. font-weight: 400;
  718. color: #EE0606;
  719. }
  720. }
  721. }
  722. }
  723. .box{
  724. margin-bottom: 24rpx;
  725. background: #FFFFFF;
  726. box-shadow: 0rpx 0rpx 20rpx 2rpx rgba(221,221,221,0.5);
  727. border-radius: 20rpx;
  728. padding: 36rpx 24rpx;
  729. .title{
  730. font-size: 30rpx;
  731. font-weight: bold;
  732. color: #2D2D2D;
  733. padding-bottom: 20rpx;
  734. margin-bottom: 24rpx;
  735. border-bottom: 1px solid #F4F4F4;
  736. .btn{
  737. height: 40rpx;
  738. line-height: 40rpx;
  739. padding: 0 20rpx;
  740. border-radius: 8rpx;
  741. border: 2rpx solid #606060;
  742. font-size: 24rpx;
  743. font-weight: 400;
  744. color: #606060;
  745. cursor: pointer;
  746. }
  747. }
  748. }
  749. .order-info{
  750. .order-info-item{
  751. font-size: 30rpx;
  752. font-weight: 400;
  753. color: #333333;
  754. padding: 10rpx 0;
  755. // &:not(:last-child){
  756. // border-bottom: 0.5px solid #eee;
  757. // }
  758. .til{
  759. font-size: 24rpx;
  760. font-weight: 400;
  761. color: #999999;
  762. margin-right: 40rpx;
  763. }
  764. .copy-btn{
  765. margin-left: 32rpx;
  766. height: 30rpx;
  767. line-height: 30rpx;
  768. padding: 0 14rpx;
  769. border-radius: 8rpx;
  770. font-size: 20rpx;
  771. font-weight: 400;
  772. color: #999999;
  773. background: #EDEDED;
  774. }
  775. }
  776. .btn-box{
  777. .btn:not(:first-of-type){
  778. margin-left: 10px;
  779. }
  780. }
  781. }
  782. .tips{
  783. .tips-item{
  784. font-size: 24rpx;
  785. font-weight: 400;
  786. color: #7F7F7F;
  787. line-height: 36rpx;
  788. margin-bottom: 20rpx;
  789. }
  790. }
  791. .qr-wrap{
  792. .qr-content{
  793. text-align: center;
  794. font-size: 24rpx;
  795. font-weight: 400;
  796. color: #7F7F7F;
  797. }
  798. .img-wrap{
  799. position: relative;
  800. }
  801. .ayQrcode,.img{
  802. width: 180px;
  803. height: 180px;
  804. display: block;
  805. margin: 0 auto 20rpx;
  806. }
  807. .refund-ico{
  808. width: 200rpx;
  809. height: 152rpx;
  810. position: absolute;
  811. bottom: -10rpx;
  812. right: 60rpx;
  813. }
  814. }
  815. .order-num{
  816. position: relative;
  817. margin: 30rpx auto 0;
  818. font-size: 24rpx;
  819. font-weight: 400;
  820. color: #363636;
  821. border: 1px solid #363636;
  822. padding: 5rpx 20rpx;
  823. border-radius: 8rpx;
  824. width: fit-content;
  825. &.del-line{
  826. color: #BCBCBC;
  827. border: 1px solid #BCBCBC;
  828. }
  829. &.del-line::after{
  830. content: '';
  831. width: 110%;
  832. height: 1px;
  833. background-color: #BCBCBC;
  834. position: absolute;
  835. top: 50%;
  836. left: -5%;
  837. }
  838. }
  839. .viewers-list{
  840. .item{
  841. font-size: 28rpx;
  842. color: #333;
  843. margin-bottom: 10px;
  844. .qrbtn{
  845. color: #EE0606;
  846. }
  847. }
  848. }
  849. .singleQR-wrap{
  850. padding: 0 24rpx 50rpx;
  851. box-sizing: border-box;
  852. min-width: 80vw;
  853. .title{
  854. text-align: center;
  855. height: 94rpx;
  856. line-height: 94rpx;
  857. font-size: 28rpx;
  858. font-weight: bold;
  859. color: #2D2D2D;
  860. border-bottom: 2rpx solid #F4F4F4;
  861. margin-bottom: 24rpx;
  862. }
  863. .single-info{
  864. margin-bottom: 24rpx;
  865. .item{
  866. font-size: 24rpx;
  867. font-weight: 400;
  868. color: #363636;
  869. margin-bottom: 10rpx;
  870. &.seat-name{
  871. font-size: 28rpx;
  872. font-weight: bold;
  873. }
  874. }
  875. }
  876. .singleQrcode{
  877. width: 180px;
  878. height: 180px;
  879. margin: 24rpx auto 54rpx;
  880. position: relative;
  881. &.disabled{
  882. // /deep/ .canvas-qrcode{
  883. // opacity: 0.3;
  884. // }
  885. }
  886. }
  887. }
  888. .qrcode-tip{
  889. margin-top: 10px;
  890. text-align: center;
  891. font-size: 24rpx;
  892. font-weight: 400;
  893. color: #7F7F7F;
  894. }
  895. </style>