student_order_detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. <view class="payWrapper">
  51. <view class="pay" v-if="!payment">
  52. <view class="paidSucceed">
  53. <button class="payYesButton" @click="getPhone" type="primary">联系方式</button>
  54. <button class="payNoButton" :disabled="buttonDisabled" @click="applyForRefund" type="warn">{{refundButton}}</button>
  55. </view>
  56. </view>
  57. </view>
  58. <uni-popup ref="popup" type="dialog">
  59. <uni-popup-dialog type="success" title="联系方式" message="成功消息" cancelText="复制手机号" confirmText="复制微信号" :content="content" @close="close" @confirm="confirm"></uni-popup-dialog>
  60. </uni-popup>
  61. <uni-popup ref="popup1" type="message">
  62. <uni-popup-message type="success" message="复制成功" :duration="1500"></uni-popup-message>
  63. </uni-popup>
  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. timer: '',
  77. refundButton: '同意退款',
  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. const queryObj = {
  122. orderNo: this.info.orderId,
  123. reason: '五天内试课不成功'
  124. }
  125. const {data: result} = await uni.$http.get('/payment/wx-pay/refunds', queryObj)
  126. if (result.message === '成功') {
  127. this.refundButton = '退款处理中'
  128. this.timer = setInterval(() => {
  129. this.queryIsRefundOrder()
  130. }, 1000)
  131. }
  132. },
  133. // 获取手机号
  134. async getPhone() {
  135. const {data: result} = await uni.$http.get('/education/student-requirements/getStuNeedPhoneAndWeixin', {uid: this.info.studentId})
  136. this.phone = result.data.phone
  137. this.weixin = result.data.weixin
  138. this.$refs.popup.open()
  139. this.content = '手机号:'+ this.phone + '\n\n微信号:' + this.weixin
  140. },
  141. // 获取订单信息
  142. async getOne(id) {
  143. const queryObj = {
  144. orderId: id
  145. }
  146. const {data: result} = await uni.$http.get('/payment/order-info/getOrderInfoByOrderId', queryObj)
  147. this.info = result.data.one
  148. if (this.info.isRefund === 1) this.buttonDisabled = false
  149. if (this.info.status === '已退款') this.payment = true
  150. this.showPage = true
  151. },
  152. async queryIsRefundOrder() {
  153. const {data: result} = await uni.$http.get('/payment/order-info/queryIsRefundOrder', {orderId: this.info.orderId})
  154. if('已退款' === result.message) {
  155. clearInterval(this.timer)
  156. this.payment = true
  157. this.info.status = '已退款'
  158. uni.$showMsg('退款成功')
  159. }
  160. }
  161. }
  162. }
  163. </script>
  164. <!-- 设置页面背景 -->
  165. <style lang="scss">
  166. page{
  167. height: 100%;
  168. // background-color: #FFF;
  169. }
  170. </style>
  171. <style lang="scss" scoped>
  172. /* 设置全局边距 */
  173. .orderWrapper{
  174. padding-left: 20rpx;
  175. /* background-color: yellowgreen; */
  176. }
  177. /* 头部区域 */
  178. .orderHead{
  179. display: flex;
  180. position: relative;
  181. height: 200rpx;
  182. padding-top: 20rpx;
  183. }
  184. /* 头像 */
  185. .headImg{
  186. width: 160rpx;
  187. height: 160rpx;
  188. border-radius: 30rpx;
  189. position: absolute;
  190. right: 30rpx;
  191. }
  192. .orderHeadTitle{
  193. display: flex;
  194. flex-direction: column;
  195. height: 80px;
  196. justify-content: space-around;
  197. }
  198. /* 设置内容样式 */
  199. .orderDetail,
  200. .courseNum,
  201. .orderPayStatus{
  202. margin-left: 20rpx;
  203. font-weight: bold;
  204. }
  205. .courseNum{
  206. color: #00B0F0;
  207. text-decoration: underline;
  208. }
  209. /* 支付状态字体样式 */
  210. .orderPayStatus{
  211. color: red;
  212. }
  213. /* 中部区域 */
  214. .orderMid{
  215. height: 220rpx;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: space-around;
  219. }
  220. /* 底部区域 */
  221. .orderBottom{
  222. margin-top: 40rpx;
  223. height: 260rpx;
  224. display: flex;
  225. flex-direction: column;
  226. justify-content: space-around;
  227. }
  228. /* 支付倒计时 */
  229. .orderPay{
  230. margin-top: 40rpx;
  231. display: flex;
  232. align-items: baseline;
  233. }
  234. /* 倒计时时间格式 */
  235. .orderPayTime{
  236. padding-left: 20rpx;
  237. font-weight: bold;
  238. font-size: 40rpx;
  239. color: red;
  240. }
  241. /* 提醒信息 */
  242. .warning{
  243. display: flex;
  244. justify-content: center;
  245. margin-top: 60rpx;
  246. }
  247. /* 提醒信息详情 */
  248. .warningDetail{
  249. width: 80%;
  250. display: flex;
  251. flex-direction: column;
  252. font-size: 44rpx;
  253. font-weight: bold;
  254. color: red;
  255. }
  256. /* 支付及查看信息按钮居中排列 */
  257. .payWrapper{
  258. display: flex;
  259. justify-content: center;
  260. }
  261. .payYesButton,
  262. .payNoButton{
  263. border-radius: 50rpx;
  264. color: white;
  265. }
  266. .payYesButton{
  267. background-color: #35b882;
  268. }
  269. .payNoButton{
  270. background-color: #3ed598;
  271. }
  272. .paidSucceed{
  273. display: flex;
  274. width: 100%;
  275. justify-content: space-around;
  276. }
  277. .pay{
  278. /* display: flex; */
  279. width: 100%;
  280. }
  281. ::v-deep .uni-button-color{
  282. color: #1aad19 !important;
  283. }
  284. </style>