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

210 lines
4.3 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  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">{{ 0 }}</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. <voucherCard class="list-item"
  59. v-for="item in list"
  60. :key="item.id"
  61. :data="data"
  62. ></voucherCard>
  63. </view>
  64. </template>
  65. <template v-else-if="current == 1" >
  66. <view class="list voucher">
  67. <voucherCard class="list-item"
  68. v-for="item in list"
  69. :key="item.id"
  70. :data="data"
  71. ></voucherCard>
  72. <voucherCard class="list-item"></voucherCard>
  73. <voucherCard class="list-item"></voucherCard>
  74. </view>
  75. </template>
  76. </view>
  77. </template>
  78. <script>
  79. import mixinsList from '@/mixins/list.js'
  80. import orderCard from '@/components/order/orderCard.vue'
  81. import voucherCard from '../components/verifyRecord/voucherCard.vue'
  82. const TAB_AND_API_FIELDS_MAPPING = {
  83. // todo: 接口对接
  84. 0: 'fetchVoucher',
  85. 1: 'fetchStore',
  86. }
  87. export default {
  88. mixins : [mixinsList],
  89. components: {
  90. orderCard,
  91. voucherCard,
  92. },
  93. data() {
  94. return {
  95. tabs: [{
  96. name: "核销商品"
  97. }, {
  98. name: "核销代金券"
  99. }],
  100. current: 0,
  101. selectedTime: new Date(),
  102. };
  103. },
  104. computed: {
  105. mixinsListApi() {
  106. // todo
  107. return TAB_AND_API_FIELDS_MAPPING[this.current]
  108. },
  109. displaySelectedTime() {
  110. return this.$dayjs(this.selectedTime).format("YYYY年M月")
  111. },
  112. displaySelectedMonth() {
  113. return this.$dayjs(this.selectedTime).format("M月")
  114. },
  115. },
  116. methods: {
  117. onTabChange(e) {
  118. this.current = e.index
  119. },
  120. openTimePicker() {
  121. this.$refs.datetimePicker.open();
  122. },
  123. onTimeChange(e) {
  124. // todo
  125. console.log('--onTimeChange', e)
  126. },
  127. },
  128. }
  129. </script>
  130. <style scoped lang="scss">
  131. .page {
  132. background-color: $uni-bg-color;
  133. min-height: 100vh;
  134. /deep/ .nav-bar__view {
  135. background-image: linear-gradient(#84A73F, #D8FF8F);
  136. }
  137. }
  138. .tabs {
  139. /deep/ .uv-tabs__wrapper__nav__line {
  140. bottom: 0;
  141. }
  142. }
  143. .bar {
  144. padding: 0 58rpx 0 25rpx;
  145. margin-top: 32rpx;
  146. justify-content: space-between;
  147. .left {
  148. .btn {
  149. border: none;
  150. color: #000000;
  151. font-size: 28rpx;
  152. line-height: 40rpx;
  153. &-icon {
  154. width: 28rpx;
  155. height: auto;
  156. margin-left: 12rpx;
  157. }
  158. }
  159. }
  160. .right {
  161. color: #333333;
  162. font-size: 28rpx;
  163. .highlight {
  164. margin-left: 10rpx;
  165. color: $uni-color-light;
  166. }
  167. }
  168. }
  169. .list {
  170. margin-top: 26rpx;
  171. &-item {
  172. display: block;
  173. & + & {
  174. margin-top: 20rpx;
  175. }
  176. }
  177. &.order {
  178. padding: 0 17rpx;
  179. }
  180. &.voucher {
  181. padding: 0 13rpx;
  182. }
  183. }
  184. </style>