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

212 lines
4.7 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="提现记录" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  5. <view class="tools">
  6. <uv-datetime-picker
  7. ref="datetimePicker"
  8. v-model="selectedTime"
  9. mode="year-month"
  10. confirmColor="#84A73F"
  11. @confirm="onTimeChange"
  12. ></uv-datetime-picker>
  13. <button plain class="flex btn" @click="openTimePicker">
  14. <text>{{ displaySelectedTime }}</text>
  15. <image class="btn-icon" src="../static/runningWater/icon-arrow.png" mode="widthFix"></image>
  16. </button>
  17. </view>
  18. <view class="card list">
  19. <template v-if="list.length">
  20. <view class="flex list-item"
  21. v-for="(item, index) in list"
  22. :key="index"
  23. >
  24. <image class="list-item-icon" src="../static/runningWater/icon-commission.png" mode="widthFix"></image>
  25. <view class="list-item-info">
  26. <view class="highlight">佣金提现</view>
  27. <view>{{ item.createTime }}</view>
  28. </view>
  29. <view class="list-item-value">{{ `-${item.amount}` }}</view>
  30. <view class="uni-color-btn"
  31. @click="withdraw(item)"
  32. v-if="item.status == 0">领取</view>
  33. </view>
  34. </template>
  35. <template v-else>
  36. <uv-empty mode="history" textSize="28rpx" iconSize="100rpx" />
  37. </template>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import mixinsList from "@/mixins/list.js"
  43. export default {
  44. mixins: [mixinsList],
  45. data() {
  46. return {
  47. selectedTime: new Date(),
  48. x: ['+', '-', '-', '+'],
  49. mixinsListApi: "queryCashoutLog",//getWaterPageList
  50. beforeDate: new Date(), //开始日期
  51. afterDate: new Date(), //结束日期
  52. totalMoney : 0,
  53. totalWithdraw : 0,
  54. }
  55. },
  56. computed: {
  57. displaySelectedTime() {
  58. return this.$dayjs(this.selectedTime).format("YYYY年M月")
  59. }
  60. },
  61. methods: {
  62. //打开日历
  63. openCalendars() {
  64. if (this?.$refs?.calendars) {
  65. this.$refs.calendars.open();
  66. }
  67. },
  68. // 选择了日期
  69. handleSelectCalendars(day) {
  70. console.log(day);
  71. // let beforeDate = this.getYearMonth(day?.range?.before)
  72. // let afterDate = this.getYearMonth(day?.range?.after)
  73. // this.beforeYear = beforeDate.year;
  74. // this.beforeMonth = beforeDate.month;
  75. // this.afterYear = afterDate.year;
  76. // this.afterMonth = afterDate.month;
  77. },
  78. getDataThen(list, total, result){
  79. this.totalMoney = result.totalMoney
  80. this.totalWithdraw = result.totalWithdraw
  81. this.list = result.page.records
  82. this.total = result.page.total
  83. },
  84. openTimePicker() {
  85. this.$refs.datetimePicker.open();
  86. },
  87. onTimeChange(e) {
  88. // todo
  89. console.log('--onTimeChange', e)
  90. },
  91. withdraw(item){
  92. // 拉起微信收款确认页面
  93. if (!wx.canIUse('requestMerchantTransfer')) {
  94. wx.showModal({
  95. content: '你的微信版本过低,请更新至最新版本。',
  96. showCancel: false,
  97. });
  98. return
  99. }
  100. // 在真机环境中,调用API
  101. wx.requestMerchantTransfer({
  102. mchId: this.$config.mchId,
  103. appId: wx.getAccountInfoSync().miniProgram.appId,
  104. package: item.packageInfo,
  105. success: (res) => {
  106. uni.showToast({
  107. title: '提现申请已提交',
  108. icon: 'success'
  109. })
  110. this.$store.commit('getUserInfo')
  111. this.$store.commit('getRiceInfo')
  112. this.$api('getMoney', {
  113. id : item.id,
  114. }).then(res => {
  115. this.getData()
  116. })
  117. },
  118. fail: (res) => {
  119. console.log('fail:', res);
  120. uni.showToast({
  121. title: '提现失败,请稍后再试',
  122. icon: 'none'
  123. })
  124. },
  125. complete: (res) => {
  126. console.log('requestMerchantTransfer完成:', res);
  127. }
  128. });
  129. },
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .page {
  135. background-color: $uni-bg-color;
  136. min-height: 100vh;
  137. /deep/ .nav-bar__view {
  138. background-image: linear-gradient(#84A73F, #D8FF8F);
  139. }
  140. }
  141. .uni-color-btn{
  142. padding: 10rpx 20rpx;
  143. margin: 0;
  144. font-size: 26rpx;
  145. margin-left: 20rpx;
  146. }
  147. .tools {
  148. background-color: $uni-fg-color;
  149. padding: 25rpx 42rpx;
  150. .btn {
  151. display: inline-block;
  152. border: none;
  153. color: #000000;
  154. font-size: 28rpx;
  155. line-height: 40rpx;
  156. &-icon {
  157. width: 28rpx;
  158. height: 28rpx;
  159. margin-left: 12rpx;
  160. }
  161. }
  162. }
  163. .list {
  164. margin: 9rpx 13rpx;
  165. padding: 31rpx 20rpx;
  166. &-item {
  167. padding-bottom: 19rpx;
  168. border-bottom: 1rpx solid #E0E0E0;
  169. margin-bottom: 20rpx;
  170. font-size: 28rpx;
  171. &-icon {
  172. width: 56rpx;
  173. height: auto;
  174. margin-right: 10rpx;
  175. }
  176. &-info {
  177. flex: 1;
  178. color: #949494;
  179. .highlight {
  180. color: #333333;
  181. }
  182. }
  183. &-value {
  184. color: #FF2A2A;
  185. }
  186. }
  187. }
  188. </style>