orderdetails.vue 30 KB

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