memberAccount.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!-- 我的账户 -->
  2. <template>
  3. <view>
  4. <global-loading />
  5. <view v-if="ifShow" class="container">
  6. <view class="balance"></view>
  7. <view class="balanceInfo">
  8. <view class="infoBox">
  9. <view v-if="accountInfo.price != null" class="cur-balance">{{ accountInfo.price }}</view>
  10. <view v-else class="cur-balance">0.00</view>
  11. <view class="mar-top-20">余额</view>
  12. </view>
  13. <view class="infoBox">
  14. <view v-if="accountInfo.price != null" class="cur-balance">{{ accountInfo.userVoucher }}</view>
  15. <view class="mar-top-20">代金券</view>
  16. </view>
  17. </view>
  18. <view class="balance-operation">
  19. <view class="item-btn" @click="memberAccountWithdraw">
  20. <image class="item-btn-icon" src="../../static/images/origin/withdraw.png" mode="widthFix"></image>
  21. <view class="item-btn-text">提现</view>
  22. <image class="item-btn-right" src="../../static/images/origin/greyArrow.png" mode="widthFix"></image>
  23. </view>
  24. </view>
  25. <view style="margin: 20upx 15upx 0;padding: 30upx 15upx;background-color: #f0efef;border-radius: 40upx;">
  26. <view style="font-size: 32upx;">代金券流水</view>
  27. <view v-if="accountInfo.voucherLogs && accountInfo.voucherLogs.length">
  28. <!-- <el-table-column align="center" label="ID" prop="id" sortable />
  29. <el-table-column align="center" label="赠与方id" prop="holdId" />
  30. <el-table-column align="center" label="被赠与方id" prop="userId" />
  31. <el-table-column align="center" label="数量" prop="number" />
  32. <el-table-column align="center" label="编号/流水号" prop="orderSn" />
  33. <el-table-column align="center" label="发放时间" prop="createTime" />
  34. <el-table-column align="center" label="流水类型" prop="type">
  35. <template slot-scope="scope">
  36. <el-tag v-if="scope.row.type === 1">充值</el-tag>
  37. <el-tag v-else-if="scope.row.type === 2" type="info">转赠</el-tag>
  38. <el-tag v-else-if="scope.row.type === 3" type="success">签到</el-tag>
  39. <el-tag v-else-if="scope.row.type === 4" type="danger">抵扣</el-tag>
  40. <el-tag v-else-if="scope.row.type === 5" type="success">核销</el-tag>
  41. <el-tag v-else-if="scope.row.type === 6" type="warning">抽奖</el-tag>
  42. <el-tag v-else-if="scope.row.type === 7">退款</el-tag>
  43. <span v-else>--</span>
  44. </template>
  45. </el-table-column> -->
  46. <view v-for="item in accountInfo.voucherLogs" :key="item.id" style="padding: 10upx 10upx 10upx 30upx;font-size: 26upx;">
  47. <view style="display: flex;justify-content: space-between;">
  48. <view>编号:{{ item.orderSn || '--' }}</view>
  49. <view style="color: #999999;">
  50. 流水类型:
  51. <text v-if="item.type === 1">充值</text>
  52. <text v-else-if="item.type === 2" type="info">转赠</text>
  53. <text v-else-if="item.type === 3" type="success">签到</text>
  54. <text v-else-if="item.type === 4" type="danger">抵扣</text>
  55. <text v-else-if="item.type === 5" type="success">核销</text>
  56. <text v-else-if="item.type === 6" type="warning">抽奖</text>
  57. <text v-else-if="item.type === 7">退款</text>
  58. <text v-else>--</text>
  59. </view>
  60. </view>
  61. <view style="display: flex;justify-content: space-between;">
  62. <text>赠与方ID:{{ item.holdId || '--' }}</text>
  63. <text style="color: #999999;">数量:{{ item.number }}</text>
  64. </view>
  65. <view>发放时间:{{ item.createTime }}</view>
  66. </view>
  67. </view>
  68. <view v-else>
  69. <tui-no-data :fixed="false" style="margin-top: 50upx;">暂无数据</tui-no-data>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import { getDistributorApi } from '../../api/user'
  77. export default {
  78. name: 'MemberAccount',
  79. filters: {
  80. parseMoney(money) {
  81. return parseFloat(money / 100).toFixed(2)
  82. }
  83. },
  84. data() {
  85. return {
  86. accountInfo: [],
  87. ifShow: false
  88. }
  89. },
  90. onShow() {
  91. this.getBalance()
  92. },
  93. onBackPress(e) {
  94. if (e.from === 'navigateBack') {
  95. return false
  96. }
  97. this.back()
  98. return true
  99. },
  100. methods: {
  101. back() {
  102. this.$switchTab('/pages/tabbar/user/index')
  103. },
  104. getBalance() {
  105. const _ = this
  106. // uni.showLoading({
  107. // mask: true,
  108. // title: '加载中...'
  109. // })
  110. getDistributorApi({}).then((res) => {
  111. uni.hideLoading()
  112. this.ifShow = true
  113. _.accountInfo = res.data
  114. })
  115. .catch((e) => {
  116. console.log(e)
  117. })
  118. },
  119. memberAccountWithdraw() {
  120. if (this.accountInfo.price <= 0) {
  121. uni.showToast({
  122. title: '您暂时没有余额,不能提现',
  123. duration: 2000,
  124. icon: 'none'
  125. })
  126. } else {
  127. uni.navigateTo({
  128. url: 'withdraw'
  129. })
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .container {
  137. background: #f8f8f8;
  138. .balance {
  139. display: block;
  140. height: 400rpx;
  141. background: url("../../static/images/origin/bankBg.png") no-repeat left top;
  142. background-size: cover;
  143. text-align: center;
  144. padding: 100rpx 20rpx 0 20rpx;
  145. }
  146. .balanceInfo {
  147. width: 712rpx;
  148. background: url("../../static/images/origin/accountBg.png") no-repeat left top;
  149. height: 342rpx;
  150. background-size: cover;
  151. margin: -300rpx auto 0 auto;
  152. display: flex;
  153. justify-content: space-around;
  154. align-items: center;
  155. border-radius: 20rpx;
  156. .infoBox {
  157. text-align: center;
  158. }
  159. .cur-balance {
  160. font-size: 60rpx;
  161. color: #71521B;
  162. }
  163. }
  164. .balance-operation {
  165. margin-top: 38rpx;
  166. padding: 0 24rpx;
  167. .item-btn {}
  168. }
  169. }
  170. .item-btn {
  171. width: 100%;
  172. height: 100upx;
  173. display: flex;
  174. flex-direction: row;
  175. align-items: center;
  176. box-sizing: border-box;
  177. background-color: #fff;
  178. padding: 0 30upx;
  179. .item-btn-icon {
  180. width: 90upx;
  181. height: 90upx;
  182. }
  183. .item-btn-text {
  184. font-size: 28upx;
  185. margin-left: 20upx;
  186. font-weight: 500;
  187. flex: 1;
  188. color: rgba(102, 102, 102, 1);
  189. }
  190. .item-btn-right {
  191. width: 60upx;
  192. height: 60upx;
  193. }
  194. }
  195. .mt20 {
  196. margin-top: 20upx;
  197. }
  198. .mt1 {
  199. margin-top: 1upx;
  200. }
  201. </style>