orderdetails.vue 27 KB

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