orderdetails.vue 28 KB

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