orderdetails.vue 28 KB

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