推拿小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
4.7 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="核销详情" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="flex page-header">
  5. <image class="icon" src="@/pages_order/static/verifyOrder/icon-clock.png" mode="widthFix"></image>
  6. <text>待核销</text>
  7. </view>
  8. <view class="page-content">
  9. <!-- 商品详情 -->
  10. <productCard :data="orderDetail.massageItem" size="medium" :readonly="true"></productCard>
  11. <view class="card rights" v-if="orderDetail.rights && orderDetail.rights.length">
  12. <view class="flex rights-item" v-for="item in orderDetail.rights" :key="item">
  13. <image class="rights-icon" src="@/pages_order/static/verifyOrder/icon-checked.png" mode="widthFix">
  14. </image>
  15. <text>{{ item }}</text>
  16. </view>
  17. </view>
  18. <view class="card info">
  19. <view class="info-header">核销信息</view>
  20. <view class="flex flex-column info-content">
  21. <view class="" style="margin: 20rpx;">
  22. <uv-qrcode ref="qrcode" size="300px" :value="`${orderDetail.id},0`"></uv-qrcode>
  23. </view>
  24. <view class="info-no">{{ `订单号:${orderDetail.id}` }}</view>
  25. <view class="info-desc">{{ `有效时间:${validRange}` }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 下单 -->
  30. <view class="flex bar">
  31. <button plain class="btn btn-plain" @click="onRefund">申请退款</button>
  32. <button plain class="btn" @click="onBuyAgain">再次购买</button>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import productCard from '@/components/product/productCard.vue'
  38. export default {
  39. components: {
  40. productCard,
  41. },
  42. data() {
  43. return {
  44. orderDetail: {},
  45. }
  46. },
  47. computed: {
  48. validRange() {
  49. const { createTime, validTime } = this.orderDetail || {}
  50. let startTime = createTime ? this.$dayjs(createTime).format('YYYY-MM-DD') : '-'
  51. let endTime = validTime ? this.$dayjs(validTime).format('YYYY-MM-DD') : '-'
  52. return `${startTime}${endTime}`
  53. },
  54. },
  55. onLoad(args) {
  56. this.id = args.id
  57. this.fetchOrderDetail()
  58. },
  59. onPullDownRefresh() {
  60. this.fetchOrderDetail()
  61. },
  62. methods: {
  63. async fetchOrderDetail() {
  64. try {
  65. this.orderDetail = await this.$fetch('queryOrderById', {
  66. id: this.id
  67. })
  68. } catch (err) {
  69. }
  70. uni.stopPullDownRefresh()
  71. },
  72. async fetchRefund() {
  73. try {
  74. const res = await this.$fetch('refundOrder', { orderId: this.orderDetail.id }, false)
  75. if (res.code == 200) {
  76. uni.showToast({
  77. title: '退款成功',
  78. icon: 'none'
  79. })
  80. setTimeout(uni.navigateBack, 800, -1)
  81. } else {
  82. uni.showToast({
  83. title: res.data,
  84. icon: 'none'
  85. })
  86. }
  87. } catch (err) {
  88. }
  89. },
  90. onRefund() {
  91. uni.showModal({
  92. title: '确认申请订单退款嘛?',
  93. success: e => {
  94. if (e.confirm) {
  95. this.fetchRefund()
  96. uni.showToast({
  97. title: '已提交申请,请耐心等候',
  98. icon: 'none'
  99. })
  100. }
  101. }
  102. })
  103. },
  104. onBuyAgain() {
  105. // todo: check
  106. this.$utils.navigateTo(`/pages_order/product/productDetail?id=${this.orderDetail.massageItem.id}`)
  107. },
  108. },
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. $bar-height: 132rpx;
  113. .page {
  114. background-color: #F5F5F5;
  115. /deep/ .nav-bar__view {
  116. background-image: linear-gradient(#84A73F, #D8FF8F);
  117. }
  118. &-header {
  119. color: #000000;
  120. font-size: 28rpx;
  121. margin-top: 24rpx;
  122. .icon {
  123. width: 30rpx;
  124. height: auto;
  125. margin-right: 17rpx;
  126. }
  127. }
  128. &-content {
  129. padding: 11rpx 13rpx;
  130. }
  131. }
  132. .rights {
  133. margin-top: 15rpx;
  134. padding: 23rpx 48rpx;
  135. color: #000000;
  136. font-size: 28rpx;
  137. &-item {
  138. margin-right: 70rpx;
  139. display: inline-flex;
  140. }
  141. &-icon {
  142. width: 30rpx;
  143. height: auto;
  144. margin-right: 12rpx;
  145. }
  146. }
  147. .info {
  148. margin-top: 19rpx;
  149. padding: 25rpx 41rpx 51rpx 41rpx;
  150. font-size: 28rpx;
  151. &-header {
  152. color: #000000;
  153. padding: 0 0 16rpx 7rpx;
  154. border-bottom: 1rpx dashed #C7C7C7;
  155. }
  156. &-qr {
  157. width: 279rpx;
  158. height: auto;
  159. margin-top: 57rpx;
  160. }
  161. &-no {
  162. color: #84A73F;
  163. margin-top: 16rpx;
  164. }
  165. &-desc {
  166. color: #999999;
  167. font-size: 22rpx;
  168. margin-top: 65rpx;
  169. }
  170. }
  171. .bar {
  172. position: fixed;
  173. bottom: 0;
  174. left: 0;
  175. width: 100vw;
  176. height: $bar-height;
  177. padding-bottom: env(safe-area-inset-bottom);
  178. background-color: $uni-fg-color;
  179. justify-content: flex-end;
  180. }
  181. .btn {
  182. display: inline-block;
  183. width: auto;
  184. height: auto;
  185. padding: 24rpx 50rpx;
  186. box-sizing: border-box;
  187. border: none;
  188. border-radius: 44rpx;
  189. margin: 0;
  190. font-size: 28rpx;
  191. line-height: 1;
  192. color: #FFFFFF;
  193. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  194. &+& {
  195. margin-left: 39rpx;
  196. }
  197. &:last-child {
  198. margin-right: 54rpx;
  199. }
  200. &-plain {
  201. border: 2rpx solid #999999;
  202. color: #999999;
  203. background: none;
  204. }
  205. }
  206. </style>