income.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view>
  3. <view class="padding bg-themeRed">
  4. <view class="text-center padding-top">
  5. <view class="text-sl padding-bottom-xs">{{brokerinfo.income}}</view>
  6. <view>
  7. 当前{{income_title}}
  8. </view>
  9. <view class="margin-top-sm" v-if="brokerinfo.type == 1">
  10. <button class="cu-btn round" data-name="cash" @tap="showModal" v-if="agentinfo.is_settle == 2">提现申请</button>
  11. </view>
  12. </view>
  13. <view class="flex solid-bottom padding-top justify-between">
  14. <view>上月获得:<text>{{month_income}}</text> {{income_unit}}</view>
  15. <view>累计已获:<text>{{brokerinfo.income_total}}</text> {{income_unit}}</view>
  16. </view>
  17. </view>
  18. <view class="cu-list menu">
  19. <block v-for="(item,index) in plist" :key="index">
  20. <view class="cu-item">
  21. <view class="content padding-tb-sm padding-right-sm">
  22. <view>
  23. {{item.title}}
  24. </view>
  25. <view class="text-gray text-sm">{{item.createtime}}</view>
  26. <view class="text-gray text-sm">
  27. {{item.remark}}
  28. </view>
  29. </view>
  30. <view class="action text-red">
  31. <view :class="item.status == 2 ? 'text-blue' : 'text-red'">{{item.status_text}}</view>
  32. <view class="text-red">{{item.value > 0 ? '+' : ''}}{{item.value}}{{income_unit}}</view>
  33. </view>
  34. </view>
  35. </block>
  36. </view>
  37. <uni-load-more :status="pstatus"></uni-load-more>
  38. <view class="cu-modal" :class="modalinfo.name=='cash'?'show':''">
  39. <view class="cu-dialog">
  40. <view class="cu-bar bg-white justify-end">
  41. <view class="content">提现申请</view>
  42. <view class="action" @tap="hideModal">
  43. <text class="cuIcon-close text-grey"></text>
  44. </view>
  45. </view>
  46. <view class="padding-xl bg-white solid-top solid-bottom">
  47. <input type="number" placeholder="请输入提现金额..." data-name="value" @input="bindInput" :value="modalinfo.value" />
  48. </view>
  49. <view class="cu-bar bg-white justify-end">
  50. <view class="action">
  51. <button class="cu-btn line-grey text-grey" @tap="hideModal">取消</button>
  52. <button class="cu-btn bg-green margin-left" @tap="cashModal">提交申请</button>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  61. var _this;
  62. export default {
  63. components: {
  64. uniLoadMore
  65. },
  66. data() {
  67. return {
  68. agentinfo: {},
  69. brokerinfo: {},
  70. month_income: 0,
  71. modalinfo: {
  72. name: null,
  73. value: "",
  74. },
  75. pstatus: 'more',
  76. ppage: 1,
  77. psize: 20,
  78. plist: []
  79. };
  80. },
  81. onLoad: function(){
  82. _this = this;
  83. _this.brokerinfo = uni.getStorageSync('brokerinfo') || false;
  84. if (_this.brokerinfo===false){
  85. uni.reLaunch({
  86. url: "/pages/my/my"
  87. });
  88. return false;
  89. }
  90. _this.getAgent();
  91. _this.getIncome();
  92. _this.getMore();
  93. },
  94. onPullDownRefresh: function() {
  95. _this.ppage = 1;
  96. _this.pstatus = 'more';
  97. _this.plist = [];
  98. _this.getMore();
  99. },
  100. onReachBottom: function() {
  101. if (_this.pstatus !== 'more') {
  102. return;
  103. }
  104. _this.getMore();
  105. },
  106. methods: {
  107. showModal: function(e) {
  108. _this.modalinfo.name = e.currentTarget.dataset.name;
  109. },
  110. hideModal: function() {
  111. _this.modalinfo.name = null;
  112. },
  113. bindInput: function(e) {
  114. var name = e.currentTarget.dataset.name;
  115. _this.modalinfo[name] = e.detail.value;
  116. },
  117. cashModal: function() {
  118. _this.$req.ajax({
  119. path: "broker/cash",
  120. data: {
  121. value: _this.modalinfo.value,
  122. brokerid: _this.brokerinfo.id
  123. }
  124. }).then((data) => {
  125. _this.hideModal();
  126. uni.showModal({
  127. title: '信息提示',
  128. content: '申请成功,请等待审核',
  129. showCancel: false,
  130. success: function() {
  131. _this.ppage = 1;
  132. _this.pstatus = 'more';
  133. _this.plist = [];
  134. _this.getMore();
  135. },
  136. });
  137. }).catch((err) => {
  138. uni.showModal({
  139. title: '信息提示',
  140. content: err,
  141. showCancel: false
  142. });
  143. });
  144. },
  145. getAgent: function() {
  146. _this.$req.ajax({
  147. path: "broker/agent",
  148. data: {
  149. agentid: _this.brokerinfo.agentid
  150. }
  151. }).then((data) => {
  152. _this.agentinfo = data;
  153. }).catch((err) => {
  154. uni.showModal({
  155. title: '信息提示',
  156. content: err,
  157. showCancel: false
  158. });
  159. });
  160. },
  161. getMore: function() {
  162. _this.$req.ajax({
  163. path: "broker/getIncome",
  164. data: {
  165. ppage: _this.ppage,
  166. psize: _this.psize,
  167. brokerid: _this.brokerinfo.id
  168. }
  169. }).then((data) => {
  170. _this.pstatus = data.pstatus;
  171. _this.plist = _this.plist.concat(data.plist);
  172. _this.ppage += 1;
  173. uni.stopPullDownRefresh();
  174. }).catch((err) => {
  175. uni.showModal({
  176. title: '信息提示',
  177. content: err,
  178. showCancel: false
  179. });
  180. });
  181. },
  182. getIncome: function() {
  183. _this.$req.ajax({
  184. path: "broker/brokerIncome",
  185. data: {
  186. brokerid: _this.brokerinfo.id
  187. }
  188. }).then((data) => {
  189. _this.brokerinfo = data.broker;
  190. _this.month_income = data.month_income;
  191. }).catch((err) => {
  192. uni.showModal({
  193. title: '信息提示',
  194. content: err,
  195. showCancel: false
  196. });
  197. });
  198. },
  199. goLPage: function(pageurl) {
  200. _this.userinfo = _this.checkLogin("/pages/my/my");
  201. if (_this.userinfo===false){
  202. return false;
  203. }
  204. uni.navigateTo({
  205. url: pageurl,
  206. fail: function(){
  207. uni.switchTab({
  208. url: pageurl
  209. });
  210. }
  211. });
  212. },
  213. goNavPage: function(pageurl) {
  214. _this.userinfo = _this.checkLogin("/pages/my/my");
  215. if (_this.userinfo===false){
  216. return false;
  217. }
  218. uni.redirectTo({
  219. url: pageurl
  220. });
  221. },
  222. },
  223. computed: {
  224. income_title() {
  225. return _this.brokerinfo.type == 1 ? '收益' : '积分';
  226. },
  227. income_unit() {
  228. return _this.brokerinfo.type == 1 ? '元' : '分';
  229. },
  230. },
  231. }
  232. </script>
  233. <style>
  234. .cu-list.menu-avatar .cu-item{ height: 170rpx !important; }
  235. </style>