return-detail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="order-detail">
  3. <!-- 时间轴组件 -->
  4. <order-timeline :logVoList="orderInfo.logVoList" isReturn></order-timeline>
  5. <!-- 书籍列表组件 -->
  6. <book-list :books="bookList" :totalNum="orderInfo.totalNum" isReturn></book-list>
  7. <!-- 收入信息区块 -->
  8. <view class="info-block">
  9. <view class=" flex-a flex-j-b">
  10. <text class="common-title font-32">退回邮费:</text>
  11. <text class="common-text" style="color: #FF0000;font-weight: 600;">{{
  12. orderInfo.expressMoney ? `¥${orderInfo.expressMoney}` : '首单免费退回' }}</text>
  13. </view>
  14. <view class="desc-bg">
  15. <view class="flex-a flex-j-b">
  16. <text class="common-text-2 font-26">书籍数量:</text>
  17. <text class="common-text font-26">{{ orderInfo.totalNum }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 订单信息区块 -->
  22. <view class="info-block">
  23. <view class=" flex-a flex-j-b">
  24. <text class="common-title font-32">卖书编号:</text>
  25. <view class="common-text-2 font-26 flex-a">{{ orderInfo.orderId || '-' }}
  26. <image src="../static/copy.png" style="width: 42rpx;height:42rpx;margin-left: 20rpx;"
  27. @click="copyOrderNo"></image>
  28. </view>
  29. </view>
  30. <view class="desc-bg">
  31. <view class="flex-a flex-j-b">
  32. <view class="common-text-2 font-26">退回编号:</view>
  33. <text class="common-text font-26">{{ orderInfo.refundOrderId || '-' }}</text>
  34. <image src="../static/copy.png" style="width: 42rpx;height:42rpx;margin-left: 20rpx;"
  35. @click="copyRefundNo"></image>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 地址信息区块 -->
  40. <view class="info-block">
  41. <view class=" flex-a flex-j-b">
  42. <text class="common-title font-32" style="width: 220rpx;">收货地址:</text>
  43. <view class="flex-d flex-j-e flex-1">
  44. <view class="common-text-2 font-26 mb-12">
  45. <text>{{ orderInfo.receiveName }}</text>
  46. <text class="ml-40">{{ orderInfo.receiveMobile }}</text>
  47. </view>
  48. <text class="common-text" style="line-height: 42rpx;">
  49. {{ orderInfo.receiveAddress }}
  50. </text>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 底部操作栏 -->
  55. <view class="bottom-fixed-con detail-bottom flex-d">
  56. <service-promise></service-promise>
  57. <view class="flex-a" style="width: 100%;padding: 0 30rpx;">
  58. <order-return-actions :order="orderInfo" :status="orderInfo.status" @action="handleAction"
  59. style="width: 100%;" size="large"></order-return-actions>
  60. </view>
  61. </view>
  62. <!-- 弹窗 -->
  63. <common-dialog ref="dialog" :title="dialogTitle" @confirm="handleConfirm">{{dialogContent}}</common-dialog>
  64. </view>
  65. </template>
  66. <script>
  67. import OrderTimeline from '../components/order-timeline.vue'
  68. import BookList from '../components/book-list.vue'
  69. import ServicePromise from '../components/service-promise.vue';
  70. import OrderReturnActions from '../components/order-return-actions.vue';
  71. import CommonDialog from '@/components/common-dialog.vue';
  72. export default {
  73. components: {
  74. OrderTimeline,
  75. BookList,
  76. ServicePromise,
  77. OrderReturnActions,
  78. CommonDialog
  79. },
  80. data() {
  81. return {
  82. bookList: [],
  83. // 订单信息
  84. orderInfo: {},
  85. // 弹窗
  86. dialogTitle: '提示',
  87. dialogContent: '',
  88. actionType: '',
  89. orderId: '',
  90. fromCanReturn: false // 新增:标记是否从可退回tab进入
  91. }
  92. },
  93. onLoad(options) {
  94. if (options.orderId) {
  95. this.orderId = options.orderId
  96. this.fromCanReturn = options.fromCanReturn === 'true' // 新增:记录来源
  97. this.getOrderInfo(options.orderId)
  98. }
  99. },
  100. methods: {
  101. copyOrderNo() {
  102. uni.setClipboardData({
  103. data: this.orderInfo.orderId,
  104. success: () => {
  105. uni.$u.toast('复制成功')
  106. }
  107. })
  108. },
  109. //复制退回编号
  110. copyRefundNo() {
  111. uni.setClipboardData({
  112. data: this.orderInfo.refundOrderId,
  113. success: () => {
  114. uni.$u.toast('复制成功')
  115. }
  116. })
  117. },
  118. //获取订单信息
  119. getOrderInfo() {
  120. uni.$u.http.get('/token/order/getRefundOrderDetail?refundOrderId=' + this.orderId).then(res => {
  121. if (res.code === 200) {
  122. this.orderInfo = res.data
  123. this.bookList = res.data.detailVoList
  124. }
  125. })
  126. },
  127. //操作按钮
  128. handleAction({ type, order }) {
  129. console.log(type, 'action')
  130. this.actionType = type
  131. switch (type) {
  132. case 'cancel':
  133. this.dialogContent = '确定取消退回?'
  134. this.$refs.dialog?.openPopup()
  135. break;
  136. case 'confirm':
  137. this.dialogContent = '确定收货?'
  138. this.$refs.dialog?.openPopup()
  139. break;
  140. }
  141. },
  142. //取消退回
  143. handleCancel() {
  144. console.log('cancel')
  145. uni.$u.http.post('/token/order/refundOrderCancel', {
  146. refundOrderId: this.orderInfo.refundOrderId
  147. }).then(res => {
  148. if (res.code === 200) {
  149. uni.$u.toast('取消退回成功')
  150. this.getOrderInfo()
  151. } else {
  152. uni.$u.toast(res.msg)
  153. }
  154. })
  155. },
  156. //确认收货
  157. handleConfirmReceipt() {
  158. uni.$u.http.post('/token/order/refundOrderFinish', {
  159. refundOrderId: this.orderInfo.refundOrderId
  160. }).then(res => {
  161. if (res.code === 200) {
  162. uni.$u.toast('确认收货成功')
  163. this.getOrderInfo()
  164. } else {
  165. uni.$u.toast(res.msg)
  166. }
  167. })
  168. },
  169. //弹窗确认按钮
  170. handleConfirm() {
  171. console.log('confirm')
  172. switch (this.actionType) {
  173. case 'cancel':
  174. this.handleCancel()
  175. break;
  176. case 'confirm':
  177. this.handleConfirmReceipt()
  178. break;
  179. }
  180. },
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. .order-detail {
  186. min-height: 100vh;
  187. background: #f8f8f8;
  188. padding-bottom: 230rpx;
  189. .desc-bg {
  190. background: #fafafa;
  191. padding: 20rpx 30rpx;
  192. border-radius: 10rpx;
  193. margin-top: 20rpx;
  194. }
  195. .info-block {
  196. background: #FFFFFF;
  197. padding: 30rpx;
  198. margin: 30rpx;
  199. border-radius: 10rpx;
  200. }
  201. .detail-bottom {
  202. flex-direction: column;
  203. padding-left: 0;
  204. padding-right: 0;
  205. padding-top: 0;
  206. }
  207. }
  208. </style>