orderdetails.vue 27 KB

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