student_order_detail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view v-if="showPage">
  3. <view class="orderWrapper">
  4. <!-- 头部区域:订单号、头像 -->
  5. <view class="orderHead">
  6. <view class="orderHeadTitle">
  7. <view>
  8. <text>订单号</text>
  9. <text class="orderDetail">{{info.orderId}}</text>
  10. </view>
  11. <view>
  12. <text>对方</text>
  13. <text class="orderDetail">{{info.teacherName}}教员</text>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 中部区域:订单详情 -->
  18. <view class="orderMid">
  19. <view>
  20. <text>对方ID</text>
  21. <text class="orderDetail">{{info.teacherId}}</text>
  22. </view>
  23. <view>
  24. <text>需求号</text>
  25. <text class="courseNum" @click="toNeedDetail">{{info.requireId}}</text>
  26. </view>
  27. <view>
  28. <text>课程号</text>
  29. <text class="courseNum" @click="toCourseDetail">{{info.courseId}}</text>
  30. </view>
  31. <view>
  32. <text>需求金额</text>
  33. <text class="orderDetail">{{info.requireSalary/100}}</text>
  34. </view>
  35. </view>
  36. <view class="orderBottom">
  37. <view>
  38. <text>订单内容</text>
  39. <text class="orderDetail">{{info.requireDetail}}</text>
  40. </view>
  41. <view>
  42. <text>支付日期</text>
  43. <text class="orderDetail">{{info.datetime}}</text>
  44. </view>
  45. <view>
  46. <text>订单状态</text>
  47. <text class="orderPayStatus">{{info.status}}</text>
  48. </view>
  49. </view>
  50. <uni-popup ref="popup" type="dialog">
  51. <uni-popup-dialog type="success" title="联系方式" message="成功消息" cancelText="复制手机号" confirmText="复制微信号" :content="content" @close="close" @confirm="confirm"></uni-popup-dialog>
  52. </uni-popup>
  53. <uni-popup ref="popup1" type="message">
  54. <uni-popup-message type="success" message="复制成功" :duration="1500"></uni-popup-message>
  55. </uni-popup>
  56. </view>
  57. <view class="submitBtnWrapper">
  58. <view class="pay" v-if="!payment">
  59. <view class="paidSucceed">
  60. <button class="submitBtn" @click="getPhone" type="primary">联系方式</button>
  61. <button class="submitBtn" v-if="isShowRefund" :disabled="buttonDisabled" @click="applyForRefund">{{refundButton}}</button>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. showPage: false,
  72. phone: '',
  73. weixin: '',
  74. content: '',
  75. buttonDisabled: true,
  76. refundButton: '同意退款',
  77. isShowRefund: false,
  78. disabled: false,
  79. minute: 0,
  80. second: 0,
  81. info: {},
  82. payment: false, //是否退款
  83. };
  84. },
  85. onLoad(option) {
  86. if (option.orderId !== undefined) {
  87. this.getOne(decodeURIComponent(option.orderId))
  88. }
  89. },
  90. methods: {
  91. close() {
  92. wx.setClipboardData({
  93. data: this.phone,
  94. success: res => {
  95. wx.hideToast()
  96. this.$refs.popup1.open()
  97. }
  98. })
  99. },
  100. confirm() {
  101. wx.setClipboardData({
  102. data: this.weixin,
  103. success: res => {
  104. wx.hideToast()
  105. this.$refs.popup1.open()
  106. }
  107. })
  108. },
  109. toNeedDetail() {
  110. uni.navigateTo({
  111. url: '/subpkg/student/require/student_require_all_detail?requireId=' + encodeURIComponent(this.info.requireId)
  112. })
  113. },
  114. toCourseDetail() {
  115. uni.navigateTo({
  116. url: '/subpkg/teacher/course/teacher_course_all_detail?courseId=' + encodeURIComponent(this.info.courseId)
  117. })
  118. },
  119. // 申请退款
  120. async applyForRefund() {
  121. this.buttonDisabled = true
  122. const queryObj = {
  123. orderNo: this.info.orderId,
  124. reason: '五天内试课不成功'
  125. }
  126. const {data: result} = await uni.$http.get('/payment/wx-pay/refunds', queryObj)
  127. // if (result.message === '成功') {
  128. // this.refundButton = '退款处理中'
  129. // this.timer = setInterval(() => {
  130. // this.queryIsRefundOrder()
  131. // }, 4000)
  132. // }
  133. if (result.message === '成功') {
  134. // this.timer = setInterval(() => {
  135. // this.queryIsRefundOrder(constorderid)
  136. // }, 4000)
  137. this.payment = true
  138. uni.$showMsg('退款申请已提交给微信后台,注意查看微信通知',3000)
  139. }else{
  140. uni.$showMsg('退款失败,请通过投诉通道,通知平台',3000)
  141. //this.findAllRefundingOrderList()
  142. }
  143. },
  144. // 获取手机号
  145. async getPhone() {
  146. const {data: result} = await uni.$http.get('/education/student-requirements/getStuNeedPhoneAndWeixin', {uid: this.info.studentId})
  147. this.phone = result.data.phone
  148. this.weixin = result.data.weixin
  149. this.$refs.popup.open()
  150. this.content = '手机号:'+ this.phone + '\n\n微信号:' + this.weixin
  151. },
  152. // 获取订单信息
  153. async getOne(id) {
  154. const queryObj = {
  155. orderId: id
  156. }
  157. const {data: result} = await uni.$http.get('/payment/order-info/getOrderInfoByOrderId', queryObj)
  158. this.info = result.data.one
  159. if (this.info.isRefund === 1){
  160. this.buttonDisabled = false
  161. this.isShowRefund = true
  162. }
  163. if (this.info.status === '已退款' || this.info.status === '退款中' ) {
  164. this.payment = true
  165. }
  166. this.showPage = true
  167. },
  168. // async queryIsRefundOrder() {
  169. // const {data: result} = await uni.$http.get('/payment/order-info/queryIsRefundOrder', {orderId: this.info.orderId})
  170. // if('已退款' === result.message) {
  171. // clearInterval(this.timer)
  172. // this.payment = true
  173. // this.info.status = '已退款'
  174. // uni.$showMsg('退款成功',1000)
  175. // }
  176. // },
  177. }
  178. }
  179. </script>
  180. <!-- 设置页面背景 -->
  181. <style lang="scss">
  182. page{
  183. height: 100%;
  184. // background-color: #FFF;
  185. }
  186. </style>
  187. <style lang="scss" scoped>
  188. /* 设置全局边距 */
  189. .orderWrapper{
  190. width: 90%;
  191. padding: 20rpx;
  192. margin-left: 20rpx;
  193. border-radius: 30rpx;
  194. background-color: #FFF;
  195. font-size: 30rpx;
  196. }
  197. /* 头部区域 */
  198. .orderHead{
  199. display: flex;
  200. position: relative;
  201. height: 200rpx;
  202. padding-top: 20rpx;
  203. }
  204. /* 头像 */
  205. .headImg{
  206. width: 160rpx;
  207. height: 160rpx;
  208. border-radius: 30rpx;
  209. position: absolute;
  210. right: 30rpx;
  211. }
  212. .orderHeadTitle{
  213. display: flex;
  214. flex-direction: column;
  215. height: 80px;
  216. justify-content: space-around;
  217. }
  218. /* 设置内容样式 */
  219. .orderDetail,
  220. .courseNum,
  221. .orderPayStatus{
  222. margin-left: 20rpx;
  223. font-weight: bold;
  224. }
  225. .courseNum{
  226. color: #00B0F0;
  227. text-decoration: underline;
  228. }
  229. /* 支付状态字体样式 */
  230. .orderPayStatus{
  231. color: red;
  232. }
  233. /* 中部区域 */
  234. .orderMid{
  235. height: 220rpx;
  236. display: flex;
  237. flex-direction: column;
  238. justify-content: space-around;
  239. }
  240. /* 底部区域 */
  241. .orderBottom{
  242. margin-top: 40rpx;
  243. height: 260rpx;
  244. display: flex;
  245. flex-direction: column;
  246. justify-content: space-around;
  247. }
  248. /* 支付倒计时 */
  249. .orderPay{
  250. margin-top: 40rpx;
  251. display: flex;
  252. align-items: baseline;
  253. }
  254. /* 倒计时时间格式 */
  255. .orderPayTime{
  256. padding-left: 20rpx;
  257. font-weight: bold;
  258. font-size: 40rpx;
  259. color: red;
  260. }
  261. /* 提醒信息 */
  262. .warning{
  263. display: flex;
  264. justify-content: center;
  265. margin-top: 60rpx;
  266. }
  267. /* 提醒信息详情 */
  268. .warningDetail{
  269. width: 80%;
  270. display: flex;
  271. flex-direction: column;
  272. font-size: 44rpx;
  273. font-weight: bold;
  274. color: red;
  275. }
  276. /* 支付及查看信息按钮居中排列 */
  277. .payWrapper{
  278. display: flex;
  279. justify-content: center;
  280. }
  281. .payYesButton,
  282. .payNoButton{
  283. border-radius: 50rpx;
  284. color: white;
  285. }
  286. .payYesButton{
  287. background-color: #35b882;
  288. }
  289. .payNoButton{
  290. background-color: #3ed598;
  291. }
  292. .paidSucceed{
  293. display: flex;
  294. width: 100%;
  295. justify-content: space-around;
  296. }
  297. .pay{
  298. /* display: flex; */
  299. width: 100%;
  300. }
  301. // 提交按钮样式
  302. .submitBtnWrapper{
  303. margin-top: 60rpx;
  304. height: 140rpx;
  305. align-items: center;
  306. }
  307. .submitBtn{
  308. width: 300rpx;
  309. border-radius: 50rpx;
  310. // margin-bottom: 40rpx;
  311. background-color: #35b882;
  312. font-size: 30rpx;
  313. color: #fff;
  314. }
  315. ::v-deep .uni-button-color{
  316. color: #1aad19 !important;
  317. }
  318. </style>