point-bills.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <mescroll :down="downOption" :up="upOption" @up="upCallback" :fixed="false" @down="downCallback"
  3. @init="mescrollInit">
  4. <view class="head_box u-flex u-row-center u-col-center">
  5. <view class="card-box">
  6. <view class="card-head u-flex u-col-center">
  7. <view class="card-title u-m-r-10">可提现积分(元)</view>
  8. <view class="u-iconfont uicon-eye" style="color: #fff;font-size: 50rpx;"></view>
  9. </view>
  10. <view class="money-num u-p-t-50">{{dataInfo.point}}</view>
  11. <view class="padding-top-40 text-white text-df">
  12. <text class="price">总收益:{{dataInfo.totalPoint}}</text>
  13. <text class="margin-left-30 price">今日收益:{{dataInfo.todayPoint}}</text>
  14. </view>
  15. <button @click="jump" class="u-reset-button withdraw-btn">提现</button>
  16. </view>
  17. </view>
  18. <view @click.stop="showTime = true" class="flex justify-between"
  19. style="font-size: 24rpx;color: #666666;background-color: #f6f6f6;">
  20. <view class="flex">
  21. <view class="bg-white cu-btn round margin-30 sm">
  22. <text>{{defaultTime}}</text>
  23. <text class="cuIcon-triangledownfill text-gray" style="font-size: 50rpx;"></text>
  24. </view>
  25. <!-- <view class="total-box">收入¥0.00 支出¥0.00</view> -->
  26. </view>
  27. <!-- <view class="center margin-right-30">
  28. 统计
  29. <text class="cuIcon-right"></text>
  30. </view> -->
  31. </view>
  32. <scroll-view scroll-x class="bg-white nav">
  33. <view class="flex text-center">
  34. <view class="cu-item flex-sub" :class="index==stateCurrent?'text-base cur text-xl text-bold ':'text-lg'"
  35. v-for="(item,index) in statusList" :key="index" @tap="onTab(index)">
  36. {{item.name}}
  37. </view>
  38. </view>
  39. </scroll-view>
  40. <u-sticky v-if="stateCurrent==0" offset-top="0" :enable="true">
  41. <view class="flex bg-white u-border-top " style="padding: 30rpx">
  42. <view style="width: 51%;margin-left: 60rpx;">
  43. 来源
  44. </view>
  45. <view class="text-center" style="width: 25%;">
  46. 折扣
  47. </view>
  48. <view class="text-right" style="width: 24%;margin-right: 20rpx;">
  49. 金额
  50. </view>
  51. </view>
  52. </u-sticky>
  53. <view v-show="stateCurrent==0" class="bg-white safe-area-inset-bottom tabsClass" style="height: 100%;">
  54. <navigator :url="'/pages/my-bills/bills-detail?id='+item.id+'&type=all'" class="u-border-bottom flex"
  55. v-for="(item,index) in list" :key="index">
  56. <view class="area1">
  57. <image :src="item.avatar?item.avatar:'/static/icon/avatar.png'" mode=""></image>
  58. <view>
  59. <text>{{item.nickName || '用户支付'}}</text>
  60. <text>{{item.createTime}}</text>
  61. </view>
  62. </view>
  63. <view class="area2">
  64. <text>{{discount(item.discount)}}</text>
  65. </view>
  66. <view class="area3">
  67. <text class="text-base price plus">{{item.balanceNum || 0}}</text>
  68. </view>
  69. </navigator>
  70. </view>
  71. <view v-show="stateCurrent==1" class="bg-white safe-area-inset-bottom tabsClass" style="height: 100%;">
  72. <navigator :url="'/pages/withdraw/detail?id='+item.id" class="card u-border-bottom"
  73. v-for="(item,index) in list" :key="index">
  74. <view class="left">
  75. <view class="margin-bottom-20 flex">
  76. <text class="text-bold" style="font-size: 32rpx;">积分提现</text>
  77. </view>
  78. <text class="desc">{{item.createTime}}</text>
  79. </view>
  80. <view class="right center text-base">
  81. <view v-if="item.withdrawStatus == 'DONE'" class="value" style="margin-bottom: 10rpx;">
  82. <text>-</text>
  83. <text class="" style="margin: 0 4rpx;">{{item.price}}</text>
  84. <text class="text-sm">元</text>
  85. </view>
  86. <view v-else class="text-sm">
  87. <text v-if="item.withdrawStatus == 'WAITING'" class="text-warn"
  88. style="font-size: 26rpx;margin-left: 10rpx;">处理中</text>
  89. <text v-if="item.withdrawStatus == 'FAIL'" class="text-error"
  90. style="font-size: 26rpx;margin-left: 10rpx;">提现失败</text>
  91. <text v-if="item.withdrawStatus == 'FAIL'" @click.stop="toast(item.failReason)"
  92. class="cuIcon-question text-error u-m-l-4"></text>
  93. </view>
  94. </view>
  95. </navigator>
  96. </view>
  97. <toast ref="toast"></toast>
  98. <u-picker confirm-color="#EF9944" v-model="showTime" mode="time" :params="params" @confirm="confirmTime">
  99. </u-picker>
  100. </mescroll>
  101. </template>
  102. <script>
  103. import mescroll from '@/components/mescroll-body/mescroll-uni.vue'
  104. export default {
  105. components: {
  106. mescroll
  107. },
  108. props: {
  109. type: Number,
  110. dataInfo: Object
  111. },
  112. data() {
  113. return {
  114. stateCurrent: 0, //默认
  115. statusList: [{
  116. name: '收入',
  117. value: 0
  118. },
  119. {
  120. name: '支出',
  121. value: 1
  122. }
  123. ],
  124. //时间
  125. showTime: false,
  126. params: {
  127. year: true,
  128. month: true,
  129. },
  130. defaultTime: '',
  131. //数据
  132. list: [],
  133. mescroll: null,
  134. upOption: {
  135. noMoreSize: 5,
  136. auto: false,
  137. },
  138. // 下拉配置参数
  139. downOption: {
  140. use: false,
  141. auto: false
  142. },
  143. };
  144. },
  145. watch: {
  146. type() {
  147. if (!this.isInit && this.type === 2) {
  148. this.mescroll.resetUpScroll()
  149. }
  150. }
  151. },
  152. mounted() {
  153. if (!this.isInit && this.type === 2) {
  154. this.mescroll.resetUpScroll()
  155. }
  156. },
  157. created() {
  158. this.defaultTime = this.$dateTime.format(new Date(), 'YYYY-mm')
  159. },
  160. methods: {
  161. toast(msg) {
  162. this.$refs.toast.toast(msg)
  163. },
  164. jump() {
  165. let params = {
  166. type: 'POINT_WITHDRAW',
  167. canWithDraw: this.dataInfo.point,
  168. }
  169. uni.navigateTo({
  170. url: "/pages/withdraw/withdraw" + this.$u.queryParams(params)
  171. })
  172. },
  173. mescrollInit(mescroll) {
  174. this.mescroll = mescroll
  175. },
  176. onTab(index) {
  177. this.stateCurrent = index
  178. this.mescroll.resetUpScroll();
  179. },
  180. confirmTime(e) {
  181. this.defaultTime = e.year + '-' + e.month
  182. this.mescroll.resetUpScroll();
  183. },
  184. fetchIncome(mescroll) {
  185. let params = {
  186. receiveId: this.vuex_shopId,
  187. current: mescroll.num,
  188. size: mescroll.size,
  189. payStatus: this.$global.PAY_STATUS.SUCCESS,
  190. billType: 'balanceNum'
  191. }
  192. if (this.defaultTime) {
  193. params.createTime = this.$dateTime.format(new Date(this.defaultTime))
  194. } else {
  195. params.createTime = this.$dateTime.format(new Date())
  196. }
  197. try {
  198. this.$api.bills.list(params).then(res => {
  199. let data = res.data.records
  200. let total = res.data.total
  201. mescroll.endBySize(data.length, total);
  202. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  203. this.list = this.list.concat(data); //追加新数据
  204. })
  205. } catch (e) {
  206. this.mescroll.endErr()
  207. }
  208. },
  209. fetchOutcome(mescroll) {
  210. let params = {
  211. current: mescroll.num,
  212. size: mescroll.size,
  213. ownerype: '商户',
  214. ownerId: this.vuex_shopId,
  215. type: 'POINT_WITHDRAW'
  216. }
  217. try {
  218. this.$api.withdraw.list(params).then(res => {
  219. let data = res.data.records
  220. let total = res.data.total
  221. mescroll.endBySize(data.length, total);
  222. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  223. this.list = this.list.concat(data); //追加新数据
  224. })
  225. } catch (e) {
  226. this.mescroll.endErr()
  227. }
  228. },
  229. upCallback(mescroll) {
  230. if (this.stateCurrent == 0) {
  231. this.fetchIncome(mescroll)
  232. } else {
  233. this.fetchOutcome(mescroll)
  234. }
  235. },
  236. downCallback() {
  237. setTimeout(() => {
  238. this.mescroll.resetUpScroll();
  239. }, 500)
  240. },
  241. }
  242. };
  243. </script>
  244. <style>
  245. page {
  246. background-color: #FFFFFF;
  247. }
  248. </style>
  249. <style lang="scss" scoped>
  250. .area1 {
  251. $img-width: 70rpx;
  252. width: 54%;
  253. display: flex;
  254. height: 120rpx;
  255. padding-left: 30rpx;
  256. justify-content: center;
  257. align-items: center;
  258. image {
  259. display: flex;
  260. align-items: center;
  261. justify-content: center;
  262. width: $img-width;
  263. height: $img-width;
  264. border-radius: 50%;
  265. }
  266. view {
  267. width: 80%;
  268. display: flex;
  269. flex-direction: column;
  270. justify-content: space-between;
  271. margin-left: 10rpx;
  272. }
  273. text:first-child {
  274. margin-bottom: 8rpx;
  275. }
  276. text:last-child {
  277. margin-top: 8rpx;
  278. color: #999;
  279. }
  280. }
  281. .area2 {
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. text-align: center;
  286. width: 22%;
  287. margin-top: 10rpx;
  288. font-weight: 300;
  289. color: #666;
  290. }
  291. .area3 {
  292. display: flex;
  293. justify-content: center;
  294. align-items: center;
  295. width: 24%;
  296. font-size: 32rpx;
  297. margin-top: 10rpx;
  298. }
  299. .head_box {
  300. font-weight: 300;
  301. background-color: #fff;
  302. padding: 30rpx 0;
  303. .card-box {
  304. width: 700rpx;
  305. min-height: 300rpx;
  306. padding: 40rpx 40rpx 0rpx;
  307. background-color: #ff9201;
  308. box-shadow: 1rpx 5rpx 16rpx 0 rgba(255, 148, 71, .6);
  309. border-radius: 30rpx;
  310. overflow: hidden;
  311. position: relative;
  312. .card-head {
  313. color: #fff;
  314. font-size: 30rpx;
  315. }
  316. .money-num {
  317. font-size: 70rpx;
  318. line-height: 70rpx;
  319. font-weight: 500;
  320. color: #ffffff;
  321. }
  322. .reduce-num {
  323. font-size: 26rpx;
  324. font-weight: 400;
  325. color: #ffffff;
  326. }
  327. .withdraw-btn {
  328. width: 120rpx;
  329. height: 60rpx;
  330. line-height: 60rpx;
  331. background: #ffffff;
  332. border-radius: 30px;
  333. font-size: 24rpx;
  334. font-weight: 500;
  335. color: #ff9201;
  336. position: absolute;
  337. right: 30rpx;
  338. top: 40rpx;
  339. }
  340. }
  341. }
  342. .total-box {
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. margin-right: 40rpx;
  347. font-size: 24rpx;
  348. font-weight: 500;
  349. color: #999999;
  350. }
  351. .card {
  352. display: flex;
  353. justify-content: space-between;
  354. background-color: #FFFFFF;
  355. padding: 30rpx 50rpx;
  356. .desc {
  357. color: #b2b2b2;
  358. font-size: 24rpx;
  359. font-weight: 400;
  360. }
  361. .left {
  362. display: flex;
  363. flex-direction: column;
  364. .title {
  365. font-size: 32rpx;
  366. color: #2a2a2a;
  367. }
  368. }
  369. .right {
  370. display: flex;
  371. flex-direction: column;
  372. .value {
  373. text-align: right;
  374. font-size: 36rpx;
  375. color: #FF9447;
  376. }
  377. }
  378. }
  379. </style>