推拿小程序前端代码仓库
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.

202 lines
4.2 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="核销明细" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="tabs">
  5. <uv-tabs
  6. :list="tabs"
  7. @click="onTabChange"
  8. :customStyle="{
  9. backgroundColor: '#FFFFFF',
  10. }"
  11. :activeStyle="{
  12. color: '#84A73F',
  13. fontSize: '28rpx',
  14. whiteSpace: 'nowrap',
  15. paddingTop: '29rpx',
  16. paddingBottom: '21rpx',
  17. }"
  18. :inactiveStyle="{
  19. color: '#000000',
  20. fontSize: '28rpx',
  21. whiteSpace: 'nowrap',
  22. paddingTop: '29rpx',
  23. paddingBottom: '21rpx',
  24. }"
  25. lineHeight="5rpx"
  26. lineWidth="92rpx"
  27. lineColor="linear-gradient(to right, #84A73F, #D8FF8F)"
  28. :scrollable="false"
  29. ></uv-tabs>
  30. </view>
  31. <view class="flex bar">
  32. <view class="left">
  33. <uv-datetime-picker
  34. ref="datetimePicker"
  35. v-model="selectedTime"
  36. mode="year-month"
  37. confirmColor="#84A73F"
  38. @confirm="onTimeChange"
  39. ></uv-datetime-picker>
  40. <button plain class="flex btn" @click="openTimePicker">
  41. <text>{{ displaySelectedTime }}</text>
  42. <image class="btn-icon" src="../static/runningWater/icon-arrow.png" mode="widthFix"></image>
  43. </button>
  44. </view>
  45. <view class="right">
  46. <text>{{ `${displaySelectedMonth}总核销:` }}</text>
  47. <!-- todo: 对接接口字段 -->
  48. <text class="highlight">{{ 12 }}</text>
  49. </view>
  50. </view>
  51. <template v-if="current == 0" >
  52. <view class="list order">
  53. <orderCard class="list-item"
  54. v-for="item in list"
  55. :key="item.id"
  56. :data="data"
  57. ></orderCard>
  58. </view>
  59. </template>
  60. <template v-else-if="current == 1" >
  61. <view class="list voucher">
  62. <voucherCard class="list-item"
  63. v-for="item in list"
  64. :key="item.id"
  65. :data="data"
  66. ></voucherCard>
  67. <!-- todo: delete -->
  68. <voucherCard class="list-item"></voucherCard>
  69. <voucherCard class="list-item"></voucherCard>
  70. </view>
  71. </template>
  72. </view>
  73. </template>
  74. <script>
  75. import mixinsList from '@/mixins/list.js'
  76. import orderCard from '@/components/order/orderCard.vue'
  77. import voucherCard from '../components/verifyRecord/voucherCard.vue'
  78. const TAB_AND_API_FIELDS_MAPPING = {
  79. // todo: 接口对接
  80. 0: 'fetchVoucher',
  81. 1: 'fetchStore',
  82. }
  83. export default {
  84. mixins : [mixinsList],
  85. components: {
  86. orderCard,
  87. voucherCard,
  88. },
  89. data() {
  90. return {
  91. tabs: [{
  92. name: "核销商品"
  93. }, {
  94. name: "核销代金券"
  95. }],
  96. current: 0,
  97. selectedTime: new Date(),
  98. };
  99. },
  100. computed: {
  101. mixinsListApi() {
  102. // todo
  103. return TAB_AND_API_FIELDS_MAPPING[this.current]
  104. },
  105. displaySelectedTime() {
  106. return this.$dayjs(this.selectedTime).format("YYYY年M月")
  107. },
  108. displaySelectedMonth() {
  109. return this.$dayjs(this.selectedTime).format("M月")
  110. },
  111. },
  112. methods: {
  113. onTabChange(e) {
  114. this.current = e.index
  115. },
  116. openTimePicker() {
  117. this.$refs.datetimePicker.open();
  118. },
  119. onTimeChange(e) {
  120. // todo
  121. console.log('--onTimeChange', e)
  122. },
  123. },
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .page {
  128. background-color: $uni-bg-color;
  129. min-height: 100vh;
  130. /deep/ .nav-bar__view {
  131. background-image: linear-gradient(#84A73F, #D8FF8F);
  132. }
  133. }
  134. .tabs {
  135. /deep/ .uv-tabs__wrapper__nav__line {
  136. bottom: 0;
  137. }
  138. }
  139. .bar {
  140. padding: 0 58rpx 0 25rpx;
  141. margin-top: 32rpx;
  142. justify-content: space-between;
  143. .left {
  144. .btn {
  145. border: none;
  146. color: #000000;
  147. font-size: 28rpx;
  148. line-height: 40rpx;
  149. &-icon {
  150. width: 28rpx;
  151. height: auto;
  152. margin-left: 12rpx;
  153. }
  154. }
  155. }
  156. .right {
  157. color: #333333;
  158. font-size: 28rpx;
  159. .highlight {
  160. margin-left: 10rpx;
  161. color: $uni-color-light;
  162. }
  163. }
  164. }
  165. .list {
  166. margin-top: 26rpx;
  167. &-item {
  168. display: block;
  169. & + & {
  170. margin-top: 20rpx;
  171. }
  172. }
  173. &.order {
  174. padding: 0 17rpx;
  175. }
  176. &.voucher {
  177. padding: 0 13rpx;
  178. }
  179. }
  180. </style>