orderdetails.vue 30 KB

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