orderdetails.vue 29 KB

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