extractList.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="box">
  3. <view style="height: 20rpx;"></view>
  4. <view class="line" v-for="(item,index) in list">
  5. <view class="linetop" v-if="type!=2">
  6. <view class="nickNameBox">
  7. <view class="amount" >¥{{item.money}}</view>
  8. </view>
  9. </view>
  10. <view class="lineCOnt" v-if="type!=2">
  11. <view class="lineline">
  12. <view class="lineContLeft">
  13. <view class="lineContLeftMs">申请时间:{{item.applyTime}}</view>
  14. </view>
  15. <view class="lineTIme" >{{jkstateMap[~~item.applyState]}}</view>
  16. <view class="lineTIme">{{stateMap[~~item.auditState]}}</view>
  17. </view>
  18. </view>
  19. <view class="linetop" v-if="type==2">
  20. <view class="name">提现金额:{{item.applyMoney}}</view>
  21. <view class="lineTIme" style="color: rgb(255,102,0);font-size: 28rpx;">{{jkstateMap[~~item.applyState]}}</view>
  22. </view>
  23. <view class="lineCOnt" v-if="type==2">
  24. <view class="lineline">
  25. <view class="lineContLeft">
  26. <view class="lineContLeftMs">申请时间:{{item.applyTime}}</view>
  27. </view>
  28. <view class="lineTIme jkButton" @click="getMoney(item)" v-if="item.applyState == 2 && item.cashState == 0 && item.cashType == 0">去提现</view>
  29. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 1 && item.cashType == 0">提现中</view>
  30. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 2 && item.cashType == 0">提现失败</view>
  31. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashState == 3 && item.cashType == 0">已提现</view>
  32. <view class="lineTIme jkButton" v-if="item.applyState == 2 && item.cashType == 1">线下打款</view>
  33. </view>
  34. </view>
  35. </view>
  36. <nodata v-if="list.length==0"></nodata>
  37. </view>
  38. </template>
  39. <script>
  40. import { requestTransfer } from '@/utils/transfer';
  41. import nodata from '../../components/nodata/nodata.vue'
  42. export default {
  43. components: {
  44. nodata
  45. },
  46. data() {
  47. return {
  48. list:'',
  49. themeColor:'',
  50. userInfo:'',
  51. type:0,
  52. stateMap: ['待审核', '审核通过', '审核拒绝'],
  53. jkstateMap: ['待审核', '审核拒绝', '审核通过'],
  54. outBatchNo:'',
  55. packageInfo:'',
  56. state:'',
  57. mchId:'',
  58. appId:'',
  59. timer:'',
  60. jkcashid:'',
  61. cashState:2,
  62. showGet:1,
  63. money:0,
  64. intervalId: null
  65. }
  66. },
  67. onLoad(opt) {
  68. this.themeColor = uni.getStorageSync("themeColor");
  69. this.userInfo = uni.getStorageSync("userInfo");
  70. this.type = opt.type;
  71. if(this.type==2){
  72. this.getListByJkCashout()
  73. }else{
  74. this.getList()
  75. }
  76. },
  77. onShow() {
  78. },
  79. methods: {
  80. goRouter(url){
  81. uni.navigateTo({
  82. url:url
  83. })
  84. },
  85. getList(){
  86. uni.showLoading({
  87. title: '加载中'
  88. })
  89. this.$http('openMCustomer/getWithdrawalDetail', {
  90. }, 'GET').then(res => {
  91. uni.hideLoading();
  92. this.list = res.data;
  93. })
  94. },
  95. //推广
  96. getListByJkCashout(){
  97. uni.showLoading({
  98. title: '加载中'
  99. })
  100. this.$http('jkCashout/getJkCashoutDetail', {
  101. }, 'GET').then(res => {
  102. uni.hideLoading();
  103. this.list = res.data;
  104. })
  105. },
  106. //提现
  107. getMoney(jk){
  108. uni.showLoading({
  109. title: '加载中'
  110. })
  111. if(jk.cashState == 0){
  112. this.money = jk.applyMoney
  113. this.$http('jkCashout/jkCashout', {
  114. jkcashid:jk.id
  115. }, 'POST').then(res => {
  116. uni.hideLoading();
  117. if(res.code == 0){
  118. this.outBatchNo = res.data.outBatchNo
  119. this.packageInfo = res.data.packageInfo
  120. this.state = res.data.state
  121. this.mchId = res.data.mchId
  122. this.appId = res.data.appId
  123. this.jkcashid = jk.id
  124. uni.showLoading({
  125. title: '请稍候...'
  126. })
  127. this.stopInterval()
  128. this.intervalId = setInterval(() => {
  129. this.checkJkCashoutState()
  130. }, 2000)
  131. }else{
  132. uni.showLoading({
  133. title: res.msg
  134. })
  135. }
  136. })
  137. }else{
  138. uni.hideLoading();
  139. }
  140. },
  141. stopInterval() {
  142. if (this.intervalId) {
  143. clearInterval(this.intervalId);
  144. this.intervalId = null;
  145. }
  146. },
  147. //查询状态
  148. checkJkCashoutState(){
  149. this.$http('jkCashout/checkJkCashoutState', {
  150. outBatchNo:this.outBatchNo,
  151. jkcashid:this.jkcashid
  152. }, 'POST').then(res => {
  153. console.log(res);
  154. if(res.code == 0 && res.data.state =='WAIT_USER_CONFIRM'){
  155. uni.hideLoading();
  156. this.stopInterval();
  157. this.getWechatMoney();
  158. }
  159. if(res.code == 0 && res.data.state =='SUCCESS'){
  160. //成功页面
  161. console.log("领取成功-跳转成功页面");
  162. this.goRouter('../subPack/extractSuccess?money='+this.money);
  163. }
  164. if(res.code == 0 && res.data.state =='FAIL'){
  165. //失败页面
  166. console.log("领取失败-跳转失败页面");
  167. this.goRouter('../subPack/extractFail?money='+this.money)
  168. }
  169. })
  170. },
  171. getWechatMoney(){
  172. if (wx.canIUse('requestMerchantTransfer')) {
  173. wx.requestMerchantTransfer({
  174. mchId: this.mchId,
  175. appId: this.appId,
  176. package: this.packageInfo,
  177. success: (res) => {
  178. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
  179. console.log(res);
  180. if (res.errMsg === 'requestMerchantTransfer:ok') {
  181. // res.err_msg将在页面展示成功后返回应用时返回success,并不代表付款成功
  182. this.checkJkCashoutState();
  183. }
  184. },
  185. fail: (res) => {
  186. }
  187. });
  188. }
  189. }
  190. },
  191. onReachBottom(){
  192. //this.page++;
  193. if(this.type==2){
  194. this.getListByJkCashout()
  195. }else{
  196. this.getList()
  197. }
  198. //console.log("shanglas")
  199. },
  200. onPullDownRefresh(){
  201. //this.page=1;
  202. //this.list=[];
  203. if(this.type==2){
  204. this.getListByJkCashout()
  205. }else{
  206. this.getList()
  207. }
  208. //this.getList();
  209. setTimeout(() => {
  210. uni.stopPullDownRefresh(); // 关闭下拉刷新
  211. }, 2000);
  212. }
  213. }
  214. </script>
  215. <style scoped lang="less">
  216. .box {
  217. width: 100vw;
  218. min-height: 100vh;
  219. background: #F4F5F7;
  220. }
  221. .nickNameBox{
  222. display: flex;
  223. }
  224. .nickName{
  225. font-weight: 400;
  226. color: #999999;
  227. font-size: 24rpx;
  228. line-height: 30rpx;
  229. padding-left: 10rpx;
  230. }
  231. .lineContLeftImg{
  232. width: 30rpx;
  233. height: 30rpx;
  234. margin-right: 10rpx;
  235. }
  236. .line{
  237. width: 702rpx;
  238. background: #FFFFFF;
  239. border-radius: 10rpx;
  240. margin-bottom: 20rpx;
  241. margin-left: 24rpx;
  242. }
  243. .linetop{
  244. display: flex;
  245. justify-content: space-between;
  246. font-size: 30rpx;
  247. padding: 20rpx;
  248. padding-bottom: 0;
  249. }
  250. .lineline{
  251. display: flex;
  252. justify-content: space-between;
  253. padding: 20rpx;
  254. font-weight: 400;
  255. color: #999999;
  256. font-size: 24rpx;
  257. line-height: 30rpx;
  258. }
  259. .lineContLeft{
  260. display: flex;
  261. }
  262. .name{
  263. font-weight: 500;
  264. color: #3C3C3C;
  265. }
  266. .amount{
  267. color: #EC0F0A;
  268. }
  269. .nickNameImg{
  270. width: 30rpx;
  271. height: 30rpx;
  272. }
  273. .jkButton{
  274. color: #ffffff;
  275. font-size: 28rpx;
  276. border: 1rpx solid rgb( 7,183, 91);
  277. background-color: rgb( 7,183, 91);
  278. width: 120rpx;
  279. height: 40rpx;
  280. text-align: center;
  281. line-height: 40rpx;
  282. border-radius: 50rpx;
  283. }
  284. </style>