敢为人鲜小程序前端代码仓库
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.

218 lines
4.9 KiB

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